Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro
Author Message
WD-40
Regular
Regular


Joined: Dec 29, 2005
Posts: 62

PostPosted: Thu Jan 19, 2006 3:35 pm Reply with quote

Theres a small list of errors within mainfile included w/ 3.1 patch of PHP-Nuke which is used within RavenNuke76. Below is a quick fix to resolve get_theme(); function not properly displaying user selected theme during account navigation.

Currently, this is how it looks:

Code:


function get_theme() {
    global $user, $userinfo, $Default_Theme, $name, $op;
    if (isset($ThemeSelSave)) return $ThemeSelSave;
    if(is_user($user) && ($name != "Your_Account" && $op != "logout")) {
        getusrinfo($user);
        if(empty($userinfo['theme'])) $userinfo['theme']=$Default_Theme;
        if(file_exists("themes/".$userinfo['theme']."/theme.php")) {
            $ThemeSel = $userinfo['theme'];
        } else {
            $ThemeSel = $Default_Theme;
        }
    } else {
        $ThemeSel = $Default_Theme;
    }
    static $ThemeSelSave;
    $ThemeSelSave = $ThemeSel;
    return $ThemeSelSave;
}



Should be like this:

Code:


function get_theme() {
    global $user, $userinfo, $Default_Theme, $name, $op;
    if (isset($ThemeSelSave)) return $ThemeSelSave;
    if(is_user($user) && (($name == "Your_Account")+($op != "logout"))) {
        getusrinfo($user);
        if(empty($userinfo['theme'])) $userinfo['theme']=$Default_Theme;
        if(file_exists("themes/".$userinfo['theme']."/theme.php")) {
            $ThemeSel = $userinfo['theme'];
        } else {
            $ThemeSel = $Default_Theme;
        }
    } else {
        $ThemeSel = $Default_Theme;
    }
    static $ThemeSelSave;
    $ThemeSelSave = $ThemeSel;
    return $ThemeSelSave;
}



Additional errors are only minimal and will not be seen w/ use of RavenNuke76.

_________________
Image

...multi-purpose problem solver

Last edited by WD-40 on Thu Jan 19, 2006 5:41 pm; edited 1 time in total 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Thu Jan 19, 2006 5:33 pm Reply with quote

Your code is
if(is_user($user) && (($name == "Your_Account")+($op != "logout"))) {

What is that? There's nothing wrong with the original code that I can see.
 
View user's profile Send private message
Raven
PostPosted: Thu Jan 19, 2006 5:37 pm Reply with quote

And themes don't use an index.php file as you have added
if(file_exists("themes/".$userinfo['theme']."/index.php")) {
 
WD-40
PostPosted: Thu Jan 19, 2006 5:48 pm Reply with quote

I corrected the above code, Core-Nuke uses index versus theme. That was my mistake and do apologize.

This fix makes sure while logged in and operation is not equal to user logout to use user selected theme otherwise if not present to use default otherwise if guest use default.

The way it was written previously makes it use user selected theme while logged in and module is not equal to Your_Accout and operation is not equal to logout versus Your_Account is not equal to operation logout.


Hope that helps
 
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Thu Jan 19, 2006 6:42 pm Reply with quote

Okay, we have three conditions

- if the $module isn't "Your_Account" - use the user-selected theme
- if the $module is "Your_Account" but the $op isn't "logout" - use the user-selected theme
- if the $module is "Your_Account" and the $op is "logout" - use the default theme

For this condition, we have to negate
($module == "Your_Account) && ($op == "logout")

that would be
($module != "Your_Account) || ($op != "logout")

That's a logical OR if its more readable to you


Not sure what you're doing with that + sign, if its meant as an OR, then wouldn't the first check still be $module != "Your_Account"

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
FireATST
RavenNuke(tm) Development Team


Joined: Jun 12, 2004
Posts: 637
Location: Ohio

PostPosted: Thu Jan 19, 2006 8:17 pm Reply with quote

I think Chatserv has addressed this one already.
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number
WD-40
PostPosted: Thu Jan 19, 2006 8:30 pm Reply with quote

evaders99 wrote:

- if the $module is "Your_Account" but the $op isn't "logout" - use the user-selected theme


That's what it's not doing correctly and what I addressed. Way it's written from chatserv just check if module and if operation not combined string.

most of these patches are just taken from dragonfly, just thought I would try to help out.


Last edited by WD-40 on Thu Jan 19, 2006 8:37 pm; edited 2 times in total 
WD-40
PostPosted: Thu Jan 19, 2006 8:35 pm Reply with quote

FireATST wrote:
I think Chatserv has addressed this one already.
Only registered users can see links on this board! Get registered or login!


I looked at that post, doubt that's correct however probably will work cause cookies are thrown back in from original function.
 
evaders99
PostPosted: Thu Jan 19, 2006 9:18 pm Reply with quote

Yep looks like chatserv got it
Code:


if(is_user($user) && ($name != "Your_Account" OR $op != "logout")) {
 
WD-40
PostPosted: Thu Jan 19, 2006 9:31 pm Reply with quote

I just don't think you all like me much which is fine...


Here is three (3) photos prior code change:

1. Before changing theme:
Image

2. After changing theme:
Image

3. After change, back to index:
Image


Here is two (2) photos after code change:

1. After changing theme:
Image

2. After changing back to default:
Image


Code:


function get_theme() {
    global $user, $userinfo, $Default_Theme, $name, $op;
    if (isset($ThemeSelSave)) return $ThemeSelSave;
    if(is_user($user) && (($name == "Your_Account")+($op != "logout"))) {
        getusrinfo($user);
        if(empty($userinfo['theme'])) $userinfo['theme']=$Default_Theme;
        if(file_exists("themes/".$userinfo['theme']."/theme.php")) {
            $ThemeSel = $userinfo['theme'];
        } else {
            $ThemeSel = $Default_Theme;
        }
    } else {
        $ThemeSel = $Default_Theme;
    }
    static $ThemeSelSave;
    $ThemeSelSave = $ThemeSel;
    return $ThemeSelSave;
}



If you would like to use this fix, please feel free otherwise just have a coke and smile and...
 
WD-40
PostPosted: Thu Jan 19, 2006 9:37 pm Reply with quote

In regards to chatservs update or whom ever provided this line change:

Quote:
if(is_user($user) && ($name != "Your_Account" OR $op != "logout")) {


mise well just put:

Quote:
if(is_user($user) && ($op != "logout")) {


because that's the only thing it's checking, it's not checkin the combined string which is all I'm trying to describe.

your thinking correctly about module name is not equal to your account and operation not equal to logout however, just have to write it correctly describing module name equal to your account plus operation not equal to logout... thinking "and" but, needs to be written "plus".
 
Raven
PostPosted: Thu Jan 19, 2006 10:14 pm Reply with quote

WD-40, this is not a personality contest. Your code is flawed and so is your logic. You are correct in that the distributed code is in error.

This fix by Chatserv works.

if(is_user($user) && ($name != "Your_Account" OR $op != "logout")) {

WD-40, you are mistaken in your assumption that it equals if(is_user($user) && ($op != "logout")) {

In actuality, it equals if(is_user($user) && !($name == "Your_Account" && $op == "logout")) {

The + operator has no meaning in this context.
 
WD-40
PostPosted: Thu Jan 19, 2006 11:26 pm Reply with quote

{edit}

code was error, only arithmetic or chatservs fix works...


Last edited by WD-40 on Fri Jan 20, 2006 6:39 pm; edited 3 times in total 
Raven
PostPosted: Thu Jan 19, 2006 11:33 pm Reply with quote

I never called you names.

It's just that this code is correct so what's the beef?

if (is_user($user) && ($name != "Your_Account" OR $op != "logout")) {
 
WD-40
PostPosted: Thu Jan 19, 2006 11:44 pm Reply with quote

You said neither does my logic...

Anywhoots, just trying to fix these errors while doing these patches and been playing around w/ lot of arithmetic and perhaps thats why and it's used frequently w/ pear php within Joomla!

The above code I wrote works as you prefer, guess reason why I believe this is correct versus what you wrote above is that I believe it's checking one or other versus complete url which is goal.

I guess the arithmetic is odd looking, only adding two sets together to make sure it's operation from Your_Account which needs to be enclosed.

Only other thing I'm trying to learn is when or when not to enclose cause according to W3C, I'll be enclosing all day long...
 
Raven
PostPosted: Thu Jan 19, 2006 11:48 pm Reply with quote

You are misunderstanding the code. It (the corrected code) is checking everything just the way it needs to. Try it out. It works perfectly.

And saying your logic is flawed is not calling you a name. It is making a statement based upon examination.
 
WD-40
PostPosted: Fri Jan 20, 2006 12:09 am Reply with quote

1. Don't we want it to make sure where checking module name is "Your_Account?
Above to me is making sure module name is not equal to "Your_Account"

2. Don't we want it to make sure operation is not equal to logout?
Above to me looks correct in regards to operation


Seems as it does work, which I'm not stating it doesn't however shouldn't it make sure module name is Your_Account and operation is not logout?

I honestly don't see that however I do understand why it works as you describe because as long as module is not Your_Account or operation is not logout proceed otherwise force default.
 
FireATST
PostPosted: Fri Jan 20, 2006 4:52 am Reply with quote

Whoa sorry for making the post about Chatserv's fix. WD-40 I was in no way trying to offend you or call you anything. I just have had this problem in the past and found that answer that worked for me. I thought by posting that, the problem would be answered, or at least one way of fixing the problem would have been shown. I, by no means, am a coder. That is why I come here to seek advise of ones that are much more intelligent than I. I have found in the past that Chatservs responses to errors found has been pretty accurate, and I trust his to work well. Sorry if this post offended you in anyway. It wasn't meant to do that. You asked not to be called names and such which I agree shouldn't happen, but at the same time, you sarcasm needs to end also. As the above posts show: "If you would like to use this fix, please feel free otherwise just have a coke and smile and..." If you ask for respect, and decent treatment, you must also be willing to give it. Have a good day!
 
WD-40
PostPosted: Fri Jan 20, 2006 8:50 am Reply with quote

There's a few ways to get the same result, in regards to my coke and smile.. several years ago I watched some movie and that's just always been a tagline I use, just for fun and games not to be rude.

I like to have fun with everything I do, otherwise why do it ya know. I'm from midwest chicago region and perhaps I'm just rude.

:p

{edit}

I didn't want to make another post however I was wrong w/ second alternative.. only the arithmetic or chatservs fix works.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro

View next topic
View previous 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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©