You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 41 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - FIXED - Can't add categories in Topics [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
reikimaster
Sergeant
Sergeant


Joined: Jan 31, 2004
Posts: 148


PostPosted: Sun Feb 22, 2004 7:35 pm Reply with quoteBack to top

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:
Code:
if ($check) {


replace it with:
Code:
if ($numrows3>0) {


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:
Code:
if ($check) {


to this:
Code:
if ($numrows2>0) {


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.
Find all posts by reikimasterView user's profileSend private message
bigtree
Sergeant
Sergeant


Joined: Feb 04, 2004
Posts: 100


PostPosted: Sun Feb 29, 2004 9:17 pm Reply with quoteBack to top

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!
Find all posts by bigtreeView user's profileSend private message
reikimaster
Sergeant
Sergeant


Joined: Jan 31, 2004
Posts: 148


PostPosted: Mon Mar 01, 2004 6:21 am Reply with quoteBack to top

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:
Code:
if ($check) {

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. Smile
Find all posts by reikimasterView user's profileSend private message
alienx
Nuke Cadet
Nuke Cadet


Joined: Aug 02, 2004
Posts: 5


PostPosted: Mon Aug 09, 2004 5:07 am Reply with quoteBack to top

http://www.nukeresources.com/downloadview-details-887-Sec-Fix_Patch_7.3.html

try this link if u r using 7.3

cheers
Find all posts by alienxView user's profileSend private message
beekay
Nuke Cadet
Nuke Cadet


Joined: Aug 21, 2004
Posts: 1


PostPosted: Fri Aug 20, 2004 10:16 pm Reply with quoteBack to top

Yes, its working fine.,

Thank you

Beekay
Find all posts by beekayView user's profileSend private message
tag
Nuke Cadet
Nuke Cadet


Joined: Nov 14, 2003
Posts: 5


PostPosted: Mon Sep 20, 2004 1:18 am Reply with quoteBack to top

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
Find all posts by tagView user's profileSend private messageVisit poster's website
mdwong
Nuke Cadet
Nuke Cadet


Joined: Aug 07, 2005
Posts: 7


PostPosted: Thu Aug 11, 2005 8:56 pm Reply with quoteBack to top

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.
Find all posts by mdwongView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.731 Seconds - 150 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::