Author |
Message |
WD-40
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/0cd97f3543f3a6730b287.png)
Joined: Dec 29, 2005
Posts: 62
|
Posted:
Thu Jan 19, 2006 3:35 pm |
|
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. |
_________________
...multi-purpose problem solver
Last edited by WD-40 on Thu Jan 19, 2006 5:41 pm; edited 1 time in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
Site Admin/Owner
![](modules/Forums/images/avatars/45030c033f18773153cd2.gif)
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Thu Jan 19, 2006 5:33 pm |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 5:37 pm |
|
And themes don't use an index.php file as you have added
if(file_exists("themes/".$userinfo['theme']."/index.php")) { |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 5:48 pm |
|
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 |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
Former Moderator in Good Standing
![](modules/Forums/images/avatars/803d73f6452557b947721.jpg)
Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Thu Jan 19, 2006 6:42 pm |
|
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! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
FireATST
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/1890b00a421a4615ecd23.jpg)
Joined: Jun 12, 2004
Posts: 654
Location: Ohio
|
Posted:
Thu Jan 19, 2006 8:17 pm |
|
|
![ICQ Number ICQ Number](themes/RavenIce/forums/images/lang_english/icon_icq_add.gif) |
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 8:30 pm |
|
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 |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 8:35 pm |
|
I looked at that post, doubt that's correct however probably will work cause cookies are thrown back in from original function. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 9:18 pm |
|
Yep looks like chatserv got it
Code:
if(is_user($user) && ($name != "Your_Account" OR $op != "logout")) {
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 9:31 pm |
|
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:
2. After changing theme:
3. After change, back to index:
Here is two (2) photos after code change:
1. After changing theme:
2. After changing back to default:
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... |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 9:37 pm |
|
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". |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 10:14 pm |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 11:26 pm |
|
{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 |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 11:33 pm |
|
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")) { |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 11:44 pm |
|
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... |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jan 19, 2006 11:48 pm |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 20, 2006 12:09 am |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
FireATST
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 20, 2006 4:52 am |
|
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! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
WD-40
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 20, 2006 8:50 am |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|