Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.3 RN Feedback/Suggestions
Author Message
ToolBox
Regular
Regular



Joined: Mar 16, 2005
Posts: 74

PostPosted: Thu Jun 11, 2009 11:10 pm Reply with quote

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 
View user's profile Send private message
ToolBox







PostPosted: Thu Jun 11, 2009 11:12 pm Reply with quote

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

PostPosted: Thu Jun 11, 2009 11:26 pm Reply with quote

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.

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
ToolBox







PostPosted: Thu Jun 11, 2009 11:35 pm Reply with quote

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







PostPosted: Fri Jun 12, 2009 12:47 am Reply with quote

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







PostPosted: Fri Jun 12, 2009 1:02 am Reply with quote

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
Involved



Joined: Jul 03, 2006
Posts: 273

PostPosted: Fri Jun 12, 2009 3:42 am Reply with quote

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!
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Fri Jun 12, 2009 1:59 pm Reply with quote

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...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Fri Jun 12, 2009 2:36 pm Reply with quote

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').
 
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Fri Jun 12, 2009 11:57 pm Reply with quote

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.
 
View user's profile Send private message
Raven







PostPosted: Sat Jun 13, 2009 4:59 pm Reply with quote

PLEASE NOTE: This thread got way off topic and has been split. To continue the with the new thread, please see RavenNuke(tm) seems to be put on a pedestal of Gold?

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

PostPosted: Sun Jul 12, 2009 5:02 pm Reply with quote

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.
[ Only registered users can see links on this board! Get registered or login! ]

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 Very Happy

_________________
$ mount /dev/spoon /eat/fun auto,overclock 0 1
ERROR: there is no spoon [ Only registered users can see links on this board! Get registered or login! ] 
View user's profile Send private message Visit poster's website
kguske







PostPosted: Tue Jul 14, 2009 4:26 pm Reply with quote

Sorry for the short response: ROTFL
 
evaders99







PostPosted: Tue Jul 14, 2009 7:43 pm Reply with quote

^
|
|
what he said
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.3 RN Feedback/Suggestions

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 ©