Author |
Message |
Nuke8
New Member
Joined: Feb 20, 2018
Posts: 14
|
Posted:
Sun Oct 28, 2018 6:55 am |
|
I found some bugs - the older versions may contain these, too -, so I'd like to share them with my fixes.
1. When submitting news in the admin page, date given in the "Notes" section isn't inserted in the database. That's because the modules/News/admin/index.php file in line 1595 has this:
Simply removing it fixes the problem.
2. When submitting news in the admin page, the original topic can be selected as an associated topic as well. Doing this, in the article view the original topic is also listed in the "Associated Topics" section. Well, it's not a bug, but I made a modification in order to avoid it. So, modules/News/articles.php file, line 410.
Original:
Code:echo '<a href="modules.php?name='.$module_name.'&new_topic='.(int)$asso_t[$i].'"><br /><br /><img src="'.$tipath.$topicimage.'" hspace="10" alt="'.$topictext.'" title="'.$topictext.'" /></a>';
|
My modification:
Code:
if ($asso_t[$i] == $topic) {
echo '';
} else {
echo '<a href="modules.php?name='.$module_name.'&new_topic='.(int)$asso_t[$i].'"><br /><br /><img src="'.$tipath.$topicimage.'" hspace="10" alt="'.$topictext.'" title="'.$topictext.'" /></a>';
}
|
3. Even if the setting in "Allow Anonymous to Post? " is set to "No", anonymous users can submit news. I made the following modifications in the modules/Submit_News/index.php file:
In the function defaultDisplay section I added $anonpost to the global variables.
After the global variables line the original file is:
Code:
include_once 'header.php';
OpenTable();
echo '<div class="text-center"><p class="title thick">' , _SUBMITNEWS , '</p>'
, '<p class="content italic">' , _SUBMITADVICE , '</p></div>';
CloseTable();
|
I modified it to:
Code:
include_once 'header.php';
OpenTable();
echo '<div class="text-center"><p class="title thick">' , _SUBMITNEWS , '</p>';
if ($anonpost == 0 and !is_user($user)) {
echo '<p class="content italic">' , _SUBMITWARN , '</p></div>';
} else {
echo '<p class="content italic">' , _SUBMITADVICE , '</p></div>';
CloseTable();
|
Don't forget to add the closing } before CloseTable(); which is line 128 in the original file.
In the function PreviewStory section I added $anonpost to the global variables.
Before include_once 'header.php'; I added this:
Code:
if ($anonpost == 0 and !is_user($user)) {
header('Location: index.php');
die();
} else {
|
and of course the closing } after include_once 'footer.php';.
I made the same in the function SubmitStory section. And also defined _SUBMITWARN in the language file. Something like "Submitting news isn't allowed for anonymous users." |
|
|
|
|
neralex
Site Admin
Joined: Aug 22, 2007
Posts: 1774
|
Posted:
Sun Oct 28, 2018 12:36 pm |
|
Nuke8, thanks for reporting this. I've removed/added/tweaked your suggestions from point 1 and 3 on the github repo. I shortened the changes on point 3, in order to prevent adding a new language definition, because this would affect all language files.
[ Only registered users can see links on this board! Get registered or login! ]
Point 2 is based on your own prefrences and its ok, if it works for you. I made a deep modifaction for the News module some years ago, where I also add point 3 today. It has a lof other features like this on point 2. Keep an eye one it and feel free to test on your local test server.
[ Only registered users can see links on this board! Get registered or login! ]
|
_________________ Github: RavenNuke
Last edited by neralex on Wed Dec 31, 1969 6:00 pm; edited 1 time in total |
|
|
|
kguske
Site Admin
Joined: Jun 04, 2004
Posts: 6433
|
Posted:
Sun Oct 28, 2018 5:38 pm |
|
|
|
|
Nuke8
|
Posted:
Mon Oct 29, 2018 2:50 am |
|
Your welcome!
In the Submit_News module I decided to do this way, because I think it's more user friendly, than a simple redirection.
I mean, with the shorter solution anonymous users don't know why nothing happens when visiting the Submit_News module.
Of course there's no need to follow my idea. The most important is that the bug is fixed. |
|
|
|
|
|