Announcement

Collapse
No announcement yet.

Question on PHP Syntax used in AdminCP/Index.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ocean
    replied
    Originally posted by Freddie Bingham

    Geez!

    You must have really enjoyed reading this thread on a Monday... <grin>

    Thanks for helping to clear this up, I'm sure you've made a lot of people gain closure, if not feelings of outright vindication.


    Thank you, everyone, for helping with this!

    Leave a comment:


  • slappy
    replied
    Thanks Freddie for the "official" word.

    In the companion Thread, started by Ocean in the "How Do I" forum, Mystic from the vBG team also "piped in" (bad pun intended) and stated essentially the same thing:

    Actually it's a relict of vB2 / the old admin cp style. "|" and "<br />" used to be the seperator between two nav links. But now all links start in a new line, so this is no longer used anywhere.
    He, also, confirmed what is mentioned above, that leaving either or both of them off and ending the line with a simple " ); " will result in no visual difference in the navbar." You have also confirmed, for those who might not have completely understood CarCdr's discussion of the "why" they are ignored, that it is because the change in the use of "$extra to $_extra," which defines how this functions of the navbar responds (found in "includes\adminfunctions_navpanel.php", not "adminCP/index.php") forces php to "effectively ignore the 'extra' setting without removing the code".

    And to sum up, for those who might not want to read this whole thread (or it's confused parts) this is because, as CarCdr stated, "adminfunctions_navpanel.php" defines $extra, (function construct_nav_option($title, $url, $extra = '') which "creates an <option> or <a href for the left-panel of index.php," but does not define "$_extra." So when the code reaches the line (line 60 in 3.0.3) "$options[] = "\t\t<div class=\... ... <a href=\"$url$sessionlink\"$bubblefix>$title</a>$_extra</div>\n" the "$_extra" doesn't cause anything "$extra" to happen.

    And the reason I failed to recognize "|" as the Pipe symbol is I last used it in DOS and there, if I remember back that far, it was displayed as "¦" with a break in the middle of the line, but that's probably just the html version. Using shift + \ on the keyboard gives the '|' Pipe symbol shown in the php code. (Doh!)

    Thanks again to everyone for their patience and clearing all of it up.

    Regards,
    Last edited by slappy; Mon 26th Jul '04, 1:22pm.

    Leave a comment:


  • Freddie Bingham
    replied
    Geez!

    For awhile, the admincp links would allow multiple items on one line. The pipe, |, was the character that seperated the items. Specifying a <br /> would, of course, send the text to the next line.

    At some point, Kier, decided to put everything on one line and he changed $extra to $_extra to effectively ignore the extra setting without removing the code, in the event he wished to revert. That third paramater can be deemed useless at this point and I'll remove it.

    Leave a comment:


  • Ocean
    replied
    Originally posted by slappy

    [Edit: I've now taken a look at the adminCP/index file in version v2.3.0 and it also uses a mix of the two symbols for ending the lines. So maybe we need a vBulletin answer as to why. ]

    Regards,

    I wonder if the Devs are watching this thread while chuckling behind their hands...

    Certainly, if one of them would like to shed some light on this - I don't think any of us would mind... At this point, I think this puzzle has become something like a sore tooth, that you can't help but keep prodding every now and then.

    Leave a comment:


  • slappy
    replied
    Yep. That's clearer, it's just that all of these have only one entry per line and they end with two different symbols. This is true of many other entries in this particular file and my guess is that one or the other is, indeed, left over from vB2 and the files weren't edited to make them all consistent.

    With this structure, two entries per line does not seem doable and there is little space for such entries.

    [Edit: I've now taken a look at the adminCP/index file in version v2.3.0 and it also uses a mix of the two symbols for ending the lines. So maybe we need a vBulletin answer as to why. ]

    Regards,
    Last edited by slappy; Sun 25th Jul '04, 10:47pm.

    Leave a comment:


  • Colin F
    replied
    And I'm not contradicting anything you just wrote, but adding to it.

    Like I said, my opinion for the use of this is (was) to allow more than one Link an a line.
    It may be used in future versions, but may also be a leftover bit from vB2.

    Hope that's clearer

    Leave a comment:


  • slappy
    replied
    Which suggests why reading through the whole thread might shead light on the issue. Simply put, the question was why did these lines end in different symbols when they each appeared in a separate menu option box in the "Users" section of the adminCP.

    PHP Code:
    construct_nav_option($vbphrase['add_new_user'], 'user.php?do=add''|');
    construct_nav_option($vbphrase['search_for_users'], 'user.php?do=modify''|');
    construct_nav_option($vbphrase['merge_users'], 'usertools.php?do=merge''|');
    construct_nav_option($vbphrase['ban_user'], "../$modcpdir/banning.php?do=banuser"'<br />');
    construct_nav_option($vbphrase['prune_users'], 'user.php?do=prune''|');
    construct_nav_option($vbphrase['private_message_statistics'], 'usertools.php?do=pmstats''<br />');
    construct_nav_option($vbphrase['referrals'], 'usertools.php?do=referrers''|');
    construct_nav_option($vbphrase['search_ip_addresses'], 'usertools.php?do=doips''<br />');
    construct_nav_option($vbphrase['view_banned_users'], "../$modcpdir/banning.php?do=modify"'<br />');
    construct_nav_option($vbphrase['send_email_to_users'], 'email.php?do=start''|');
    construct_nav_option($vbphrase['generate_mailing_list'], 'email.php?do=genlist''<br />');
    construct_nav_option($vbphrase['access_masks'], 'accessmask.php?do=modify''<br />');
    construct_nav_group($vbphrase['users']);

    Through CarCdr's knowledge of the proper functioning of "functions" and my empirical tests, we confirmed that the endings '<br />' and '|' made no difference in the appearance and fuctionality of the menu options at all and that menu options appeared to work equally well without either symbol at the end of a line, if there was a ); to terminate the line.

    What we have not discovered or been told is WHY vBulletin intermixes these two variations at the ends of the lines within the adminCP/index file, but we are surmising that it may most likely be the simple failure to completely edit the file for consistency.

    Regards,

    Leave a comment:


  • Colin F
    replied
    I didn't bother reading through all of this, but could it be that the idea behind all this was maybe to allow two menu entries on *one* line. I think there was something like that in vb" already, not?

    Leave a comment:


  • slappy
    replied
    CarCdr:

    I've now had a chance to re-run my experiment on the adminCP file, this time using an editor which will show me white spaces, to ensure no such errors. And making sure there were no white spaces, I retried replacing each of the '<br />' entries, one at a time, with '|'; saving the file; restarting the "server'; and trying the adminCP. This time (because there were no white space errors) the adminCP worked as you said it would, each time, no matter how many of the '<br />' were changed to '|'.

    So the only question left, which was really the one I started with, is how does vBulletin explain the different usage, and are they related to different versions of php and/or xml and/or xhtlm. All of this would have been so easy if my search on the net had found a reference discussing the '|' symbol, but so far I have not found one. Certainly as you explained, and as my (properly performed) tests revealed, they both appear to cause a line break in the output display.

    [Edit: And as to your code edit, to give the "Show All Users", in v3.0.3 the line you describe, to find the place to add the line, starts at Line 664. Adding the line:

    construct_nav_option('List All Users', 'user.php?do=find');

    worked completely, but raises another take on the previous question. The line you added ends with NEITHER a '<br />' NOR an '|', so one would be left to assume that, at least in this case, NEITHER of them is required. ]

    [Edit2: Of course, in v3.0.3, there is already a "Show All Users" in the "Quick Search" menu at the top of the 'Search for Users" option selection.]

    Thanks for your assistance and patience.

    Regards,
    Last edited by slappy; Mon 26th Jul '04, 9:49am.

    Leave a comment:


  • CarCdr
    replied
    Ocean stated this question originally in another thread wondering if a "Show All Users" option could be added to the "User's" options.
    Actually, I have run with that option on my board for quite awhile. I agree it is very handy. To add such an option, fine this code in "admincp/index.php" around line 641 in v3.0.0:
    Code:
    	 if (can_administer('canadminusers'))
    	 {
    		 $printhr = true;
    then add this line right after it:
    Code:
     construct_nav_option('List All Users', 'user.php?do=find');
    Last edited by CarCdr; Sun 25th Jul '04, 8:18pm.

    Leave a comment:


  • CarCdr
    replied
    It does not matter what the HTML definition of '<br>' is. The PHP function being called is passed some string, in this case, either the string '<br />' or the string '|'. In order for the string to become part of the HTML page, the PHP output, the function would have to do something with the string being passed.

    This is either a bug or some unimplemented vB feature (they changed their minds and did not change the function.)

    If I have the following script, called 'mypage.php', say, referenced in the URL 'www.mysite.com/mypage.php', then the HTML page produced (sent to the user's browser) will show exactly two lines, with some vertical whitespace between them:

    First line.
    Second line.


    Script:
    Code:
    <?php
     
    /* mypage.php */
     
    function sendLineToBrowser($textToSend, $endingToSend) {
    	 echo '<p>' . $textToSend . ' line.</p>';
    }
     
    sendLineToBrowser('First', '<!--');
    sendLineToBrowser('Second', '</body>');
    ?>
    The function sendLineToBrowser takes two arguments/parameters, named $textToSend and $endingToSend, but the latter is ignored -- it has no affect whatsoever.

    The AdminCP function in question ALWAYS send HTML to make the option appear on separate "lines", regardless of what is passed as the last parameter. It always generates '<div>URL tag</div>'.

    Cheers

    http://www.crazygrrl.com/weav/intro4.php
    Last edited by CarCdr; Sun 25th Jul '04, 8:07pm.

    Leave a comment:


  • slappy
    replied
    Thank you for clarifying which file you were using to find the functions you were talking about, it didn't make any sense without that reference.

    But as I said, I'm using v3.0.3 and I changed the adminCP/index file at the referenced location to change the line endings from '<br />' endings to '|' and couldn't get the adminCP to run at all after that. I recognize there could have been a white space problem which might have caused that to occur, but I've not had time to repeat the test again yet.

    However, nothing you have said explains why these entries, and many others in the adminCP/index file use the different endings of '<br />' and '|' if they serve no purpose at all, unless they are simply remnants from previous versions of the software and were never updated. That really is the issue we still have had no clarity on, which is "why did they do it that way" all over that file, especially if it doesn't matter? I have looked and found a definition for the '<br />' endings in relation to xhtml (which is to act as a line break), but, as of yet, have found no description of what the '|' symbol is supposed to do as compared to the '<br />' . Clearly, each of these elements are displayed on separate lines in the AdminCP Navbar.

    Regards,
    Last edited by slappy; Sun 25th Jul '04, 7:48pm.

    Leave a comment:


  • CarCdr
    replied
    To find the function being called, "construct_nav_option", you need to look in "includes\adminfunctions_navpanel.php", not "index.php".

    It does not matter what you pass this function as the last parameter. You could pass '<br />', '|', or 'anything you like', it will have no affect in vB 3.0.0 or 3.0.1 (the only versions I have downloaded).

    Leave a comment:


  • slappy
    replied
    No problem here. It's a home test version, and the "server" is just my pc. But unless I made an error with the white spaces, as I said, those endings are important for something. We just don't know why yet.

    Regards,

    Leave a comment:


  • Ocean
    replied
    Originally posted by slappy

    OK. I changed three of the '<br />' endings to '|' ; saved the file; rebooted my "server"; and the AdminCP would not start at all. Barring the possibility I may have had a white space issue, it would seem those endings do have some purpose, as yet unknown to Ocean and to me.

    Regards,

    Ouch! Well, thank you for enduring that for me...

    Leave a comment:

widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X