FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Changing GLOBAL.php VAR_NAMES
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Changing GLOBAL.php VAR_NAMES [message #11152] Thu, 19 June 2003 18:59 Go to previous message
mogilla is currently offline  mogilla   United States
Messages: 5
Registered: June 2003
Location: New York, USA
Karma:
Junior Member
Excuse me, but I am relatively new to php.

While attempting to integrate FUDforum into my existing site, I found that a few global variables are the same as what I am currently using.

Changing WWW_ROOT_DIR to FUD_WWW_ROOT_DISK forum-wide appears to work correctly until I attempt to enter the administration section. I receive the following two errors:

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Group\Apache2\forum\include\glob.inc on line 35

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Group\Apache2\forum\include\core.inc on line 24

This occurs on both windows and linux boxes. This even persists after I change FUD_WWW_ROOT_DISK back to WWW_ROOT_DISK forum-wide. I thought that the FUD_WWW_ROOT_DISK may have been saved into memory, but a reboot of either box did not resolve the errors. So, one by one, I replaced each file that had the variable changed and attempted to open the administration pages after each change. Alas, when replacing the GLOBALS_HELP with the original, I could access the administration pages. I opened both the altered GLOBALS_HELP and the original GLOBALS_HELP. I found no difference between the two other than a file size difference. All hidden characters appeared to be the same also.

Altered GLOBALS_HELP: 13.2kb
Original GLOBALS_HELP: 12.8kb

This is not my major concern, but an explanation might help in with problems which may arise in the future. Knowing the reason behind why adding and then removing 4 characters would leave a file wih two different sizes?

My major concern is understanding the following:

function read_help() in glob.inc has trouble with my prepending "FUD_" to any GLOBAL variables. I have studied this function and have the basics of what it does, but am having a bit of trouble deciphering it in it's entirety. Might someone with more knowledge than I aid me in understanding it more?

function read_help()
{
	/* retrieve GLOBALS_HELP file and set data to contents */
	$data = file_get_contents($GLOBALS['INCLUDE'].'GLOBALS_HELP');
	
	/* $len is number of characters of $data */
	$len = strlen($data);
	
	/* set $p to 0 as a starting position  */
	$p = 0;
	
	/* while $p (position) has a real value  */
	while (($p = strpos($data, "\n", $p)) !== FALSE) {
		
		/* if $p (position) +1 is greater than or equal
                      to $len, break from loop  */
		if (++$p >= $len) {
			break;
		}
		
		/* ?????????????  */
		if ($data[$p] < 'A' || $data[$p] > 'Z') {
			continue;
		}
		
		/* $ke is position of the next new line  */
		$ke = strpos($data, "\n", $p);
		
		/* $key is the string (var_name) from position
                     $ke to $p  */
		$key = substr($data, $p, ($ke - $p));
		
		/* $ke + 1  */
		++$ke;
		
		/* $e is position of end of GLOBALS variable 
                      definition signified by a period and 
                      double new line  */
		$e = strpos($data, ".\n\n", $ke);
		
		/* definine array $key's value by using 
                      information between end of GLOBALS 
                      var_name value and end of GLOBALS 
                      var_name */
		$help_ar[$key] = nl2br(htmlspecialchars(substr($data, $ke, ($e - $ke))));
		
		/* ?????????????  */
		$p = $e + 2;
		
		/* if $p (position) is greater than or equal to
                     $len, break from loop  */
		if ($p >= $len) {
			break;
		}
	}
	
	/* add to $help_ar  */
	return (isset($help_ar) ? $help_ar : NULL);
}


I appreciate any help. I do enjoy different code and learning new ways to accomplish a task, but time is a commodity I cannot afford at this time.

[Updated on: Thu, 19 June 2003 20:17]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Timeout units
Next Topic: How to allow users to delete their posts?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 04:38:15 GMT 2024

Total time taken to generate the page: 0.03947 seconds