| Author |
Message |
reikimaster
Sergeant


Joined: Jan 31, 2004
Posts: 148
|
Posted:
Sun Feb 22, 2004 7:35 pm |
  |
in admin/modules/stories.php
to get you in the vicinity of the changes, around line 260 find:
| Code: |
| function SaveEditCategory($catid, $title) |
down a couple lines... right after the line that says:
| Code: |
$check = sql_query("select catid from ".$prefix."_stories_cat where title='$title'", $dbi);
$catid = intval($catid); |
add this:
| Code: |
| $numrows3 = sql_num_rows($check, $dbi); |
then right after that you'll see:
replace it with:
This will allow you to change a category name but will NOT allow you to inadvertantly change it to one that already exists.
Now for ADDing a category...
to get you in the vicinity of the changes, around line 290 find:
| Code: |
| function SaveCategory($title) |
down a couple lines...right after the line that says:
| Code: |
| $check = sql_query("select catid from ".$prefix."_stories_cat where title='$title'", $dbi); |
insert this line:
| Code: |
| $numrows2 = sql_num_rows($check, $dbi); |
immediately below that change this:
to this:
Now you should be able to add a category as long as you don't already have one by that name.
Please test this and let me know. I've tried to break it but it seems like a good fix. |
|
|
   |
 |
bigtree
Sergeant


Joined: Feb 04, 2004
Posts: 100
|
Posted:
Sun Feb 29, 2004 9:17 pm |
  |
Can't add categories in Topics
This bug is in the recent 7.1 bug fix "71patched" from
/* Additional security checking code 2003 by chatserv */
/* http://www.nukefixes.com -- http://www.nukeresources.com
I read they had some security fixes for phpnuke 7.1 so respectfully downloaded their bundle and bam!... this problem accured. If you added their security fixes I would start checking a few.
Install the orginal 7.1 admin/stories.php file back and the problem is fixed. Hopefully http://www.nukefixes.com finds these issues and corrects them.
Cheers! |
|
|
   |
 |
reikimaster
Sergeant


Joined: Jan 31, 2004
Posts: 148
|
Posted:
Mon Mar 01, 2004 6:21 am |
  |
Interesting. I found this bug on a "stock" 7.0 installation. Didn't realize it was fixed in 7.1.
Basically it works like this:
In the line that says:
| Code: |
| $check = sql_query("select catid from ".$prefix."_stories_cat where title='$title'", $dbi); |
the intent is apparently to look for $title in the stories_cat table to be sure you aren't adding the category when it already exists. It LOOKED to me (as a php newbie) that $check would equal the catid of a table entry with a title=$title as a result of that query, but it doesn't).
However (and I had to read some php manual entries to get this) the code pasted above results in $check always having a value as long as the query is syntactically correct. So when we later check to see if $check has something:
well it ALWAYS has something because it gets set to hold a Resource id as a result of the previous code (the query).
So... instead of checking to see if $check has a value, my fix simply checks to see how many rows are affected by the query. If ANY rows are affected then there's already an entry where title=$title.
I'm not a php guru, but this made sense to me to check it this way.  |
|
|
   |
 |
alienx
Nuke Cadet


Joined: Aug 02, 2004
Posts: 5
|
Posted:
Mon Aug 09, 2004 5:07 am |
  |
|
   |
 |
beekay
Nuke Cadet


Joined: Aug 21, 2004
Posts: 1
|
Posted:
Fri Aug 20, 2004 10:16 pm |
  |
Yes, its working fine.,
Thank you
Beekay |
|
|
   |
 |
tag
Nuke Cadet


Joined: Nov 14, 2003
Posts: 5
|
Posted:
Mon Sep 20, 2004 1:18 am |
  |
Stories was not updated in 7.5, so I guess I was using 7.4 stories.php
Nevertheless this fix worked on it
Thank you. |
_________________ Tag
Hugsssssssssss |
|
    |
 |
mdwong
Nuke Cadet


Joined: Aug 07, 2005
Posts: 7
|
Posted:
Thu Aug 11, 2005 8:56 pm |
  |
I'm not sure if this relates to 7.7 but I'm having the same problem....can't add categories. everytime I try it replies that the category already exists!? I looked under admin/modules/stories.php...and it's not there.. could this be my problem. |
|
|
   |
 |
|
|