Author |
Message |
ToolBox
Regular


Joined: Mar 16, 2005
Posts: 74
|
Posted:
Thu Jun 11, 2009 11:10 pm |
|
Most themes have a string as a theme-name.
However, from time to time, we may use two words or three words. These words are accptible in most operation systems.
Now, you may create or rename your theme-name to a different name consisted of two words and one space. For instance,
My Theme
So far, most phpnuke themes have name like “My_Theme”, which had been fine. However, most phpnuke themes came from phpBB2 or similarly designed themes.
Next, let's do an experiment with “My Theme.” Simply change or create this directory under
<nuke-root>/themes/My Theme
Go to Admin CP or Your_Account. In Admin CP you will see a broken theme name in system default theme. This is not exceptional in your account view: Theme menu in Your_Account.
Why does this happen?
Absolutely it comes from “a wrong assumption that all directory names should have no spaces.” Now, it’s time to adopt all operating systems directory naming method.
To correct this bug, look at the code first (from <nuke-root>/admin/
Code:
echo "<center><font class='option'><b>"._THEMECONFIG."</b></font></center>"
."<form action='".$admin_file.".php' method='post'>"
."<table border=\"0\" align=\"center\" cellpadding=\"3\"><tr><td>"
.""._AUTOTHEMESTATUS.":</td><td><b>$auto_status</b></td></tr>"
."<tr><td>" . _DEFAULTTHEME . ":</td><td><select name='xDefault_Theme'>";
$handle=opendir('themes');
while ($file = readdir($handle)) {
if ( (!ereg("[.]",$file)) ) {
$themelist .= "$file ";
}
}
closedir($handle);
$themelist = explode(" ", $themelist);
sort($themelist);
for ($i=0; $i < sizeof($themelist); $i++) {
if(!empty($themelist[$i])) {
echo "<option name='xDefault_Theme' value='$themelist[$i]' ";
if($themelist[$i]==$Default_Theme) echo "selected";
echo ">$themelist[$i]\n";
}
}
echo "</select>"
|
In this code, the wrong part is as follows:
Code:
$themelist = explode(" ", $themelist);
|
While reading /themes directory, the above code weaves a string which will be an array after separating by ‘ ‘ (space). This is the cause.
So, we may change this code block to the followings
Code:
while ($file = readdir($handle)) {
if ( (!ereg("[.]",$file)) ) {
$themelist .= $file."::";
}
}
closedir($handle);
$themelist = explode("::", $themelist);
|
You may argue that the separater which I used here, “::” may be another possible cause if a theme name includes “::”.
However, in general, these double colones are not included and consisted in any type of directory name. If you will use “..” character, then php library routine, readdir() function, will parse it as a directory indicator such as parent and child.
In this way, Your_Account module should be corrected.
Lastly, Raven NUKE has the same wrong code.
While working on phpBB3ToNuke and integration with Raven NUKE, I found some codes incorrect and still loosely coded lines remained, which have been found in phpnukes. I hope this correction will be included in a bug list or correction codes in the follow Raven’s. |
Last edited by ToolBox on Fri Jun 12, 2009 12:38 am; edited 5 times in total |
|
|
 |
ToolBox

|
Posted:
Thu Jun 11, 2009 11:12 pm |
|
abstracted codes from Raven's.
<nuke-root>/admin/modules/settings - around line 188:
Code:
$handle=opendir('themes');
$themelist = '';
while ($file = readdir($handle)) {
if ( (!ereg('[.]',$file)) ) {
$themelist .= $file.' ';
}
}
closedir($handle);
$themelist = explode(' ', $themelist);
sort($themelist);
for ($i=0; $i < sizeof($themelist); $i++) {
if(!empty($themelist[$i])) {
echo '<option value="'.$themelist[$i].'" ';
if($themelist[$i]==$Default_Theme) echo 'selected="selected"';
echo '>'.$themelist[$i].'</option>';
}
}
echo '</select>'
|
I don't list up the similar codes found in Your_Account. |
|
|
|
 |
evaders99
Former Moderator in Good Standing

Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Thu Jun 11, 2009 11:26 pm |
|
Directory names do not have spaces. This is seen throughout phpNuke and many other software projects. Modules like Your_Account use underscores, why should themes operate differently?
This goes back to the days where Unix did not allow spaces. As most servers wanted to keep Unix compatible, they also kept that convention. Today's operating systems aren't so restricted, but you'll find many computer projects that keep to this anyway.
Call me a traditionalist, but I don't really see this as a bug. |
_________________ - 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! |
|
|
 |
ToolBox

|
Posted:
Thu Jun 11, 2009 11:35 pm |
|
Oh, you are right, evaders99.
I just assumed it has the same.
Very keen.
Quote: |
Call me a traditionalist, but I don't really see this as a bug. | depending on how we define or classifiy, it may not be a bug.
Between us, it's ok. But when users who downloaded or create their themes (name with spaces) may say "that's a bug." due to this, they will notbe able to change their themes properly. In this sense, I called it a bug.
Whatever we call it, it might run unlike what users expect. |
|
|
|
 |
evaders99

|
Posted:
Fri Jun 12, 2009 12:47 am |
|
I totally like the idea of helping new users out. I just think that 99.9% attempting to make themes or even write PHP code know that they shouldn't be using "Long filenames like in Windows" on their web servers
Does it make a difference if its My_Theme or "My Theme"? For most people, no.
I think the work required to change everything to support spaces may not be necessary. But if we're looking to get outside the Latin A-Z letters.. that is more worthwhile goal. If we go into Unicode, then we can support a large number of characters and naming becomes a lot more diverse. That would require significant effort and would be, in my opinion, something worth pursuing. |
|
|
|
 |
ToolBox

|
Posted:
Fri Jun 12, 2009 1:02 am |
|
Oh, by the way, phpBB3 styles come up in names with spaces.
Your though about UTF-8 code and/or Unicode should not be ignored, either.
Personally, I experimented more than 30 styles released in phpBB3 community and I found 6 theme names had spaces. If theme-creators or some users who are ready to create their own themes may adopt the exact same names. That's what I found.
This discussion was so productive. |
|
|
|
 |
duck
Involved


Joined: Jul 03, 2006
Posts: 273
|
Posted:
Fri Jun 12, 2009 3:42 am |
|
Well I have to say Nice Tute Toolbox. A little overlooked "Bug/Whathaveyou" made better. Nice job! Don't feel sad that Ravennuke is not perfect evaders (I know it is shocking but I have found the latest release far from!) Toolbox is only offering suggestions for improvement. This is a good thing! |
|
|
|
 |
kguske
Site Admin

Joined: Jun 04, 2004
Posts: 6437
|
Posted:
Fri Jun 12, 2009 1:59 pm |
|
duck, no one claims that RavenNuke is perfect, but we do appreciate those who point out that it is not to provide specific suggestions for improvement or at least to identify the imperfections so they can be addressed.
As for having spaces in the name, it's not a bug - it's a standard. The bug would be in the new theme that didn't follow that standard. A request to enhance RN to enable support for themes with spaces - i.e. a change to the standard - is certainly appropriate, and toolbox's "fix" (enhancement) may be the right solution. But it's certainly not a "bug." |
_________________ I search, therefore I exist...
Only registered users can see links on this board! Get registered or login! |
|
|
 |
Guardian2003
Site Admin

Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Fri Jun 12, 2009 2:36 pm |
|
It is really bad practise to have file or directory names with spaces as *nix usually treats spaces as a delimiter.
A lot of browsers do not support spaces in directory names either as they see the space as the end of the URL. Most modern browsers usually insert %20 (or whatever the hex code is for 'space'). |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Fri Jun 12, 2009 11:57 pm |
|
I have been involved in nuke for 7 years and this is the first time I ever recall even having a discussion on it. Aside from that I would like to respond to 2 things.
It is not now, nor has it ever been a "bug" and to refer to it as such is as wrong as wrong can be. The _ was and is by design. php-nuke has had many bugs but something purposely coded, by design, should never be referred to as a "bug". As was stated above, we might look at the subject as a future enhancement but I really see no reason, at the moment, to even address this further.
I, nor any member of the RN Team, have ever claimed that RavenNuke(tm) was perfect or even near perfect and I do take exception to the statement and I challenge anyone to prove different. We know that RavenNuke(tm) is FAR from perfect! If we felt that way then our work would be done and we would no longer develop it. We do claim that it is one of the most SECURE releases available. And we have made great strides from where we first began. With each release we try to target specific areas for focus. One release might be to clean up as many XHTML compliance errors as we can. Another release might have the focus of new functionality. We purposely have tried to keep as much backward functionality as possible with each release in order to bring the Community along with our fixes/changes/etc. rather than leave them with no choice but to adopt our way of doing things. For example, I have resisted moving to a strict PHP v5.x coding standard even though that would make our life so much easier in so many ways. We have only so much time to devote to this "hobby" and we will continue to do the most we can to target the most serious and then the nice to haves. |
|
|
|
 |
Raven

|
Posted:
Sat Jun 13, 2009 4:59 pm |
|
PLEASE NOTE: This thread got way off topic and has been split. To continue the with the new thread, please see Only registered users can see links on this board! Get registered or login!
Continue to post in this, the current, thread about the theme naming issue. |
|
|
|
 |
djmaze
Subject Matter Expert

Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv
|
Posted:
Sun Jul 12, 2009 5:02 pm |
|
http://tools.ietf.org/html/rfc2396#section-2.3 wrote: | 2.3. Unreserved Characters
Data characters that are allowed in a URI but do not have a reserved
purpose are called unreserved. These include upper and lower case
letters, decimal digits, and a limited set of punctuation marks and
symbols.
unreserved = alphanum | mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
Unreserved characters can be escaped without changing the semantics
of the URI, but this should not be done unless the URI is being used
in a context that does not allow the unescaped character to appear.
|
http://tools.ietf.org/html/rfc2396#section-2.3
So spaces are not allowed and must be escaped in one way or another.
If you feel fine to replace all spaces everywhere with %20 feel free to do so (that is all Open Source is about), but it won't be doable for most themers who use phpnuke or ravennuke.
Therefore, my opinion is that there shouldn't be special characters in any directory structure.
If you don't like encoding spaces then you are free to join the IETF and propose a new RFC version  |
_________________ $ mount /dev/spoon /eat/fun auto,overclock 0 1
ERROR: there is no spoon
http://claimedavatar.net/ |
|
|
 |
kguske

|
Posted:
Tue Jul 14, 2009 4:26 pm |
|
Sorry for the short response:  |
|
|
|
 |
evaders99

|
Posted:
Tue Jul 14, 2009 7:43 pm |
|
|
|
 |
|