@@ -489,6 +489,43 @@ function leet_text($value)
489489 @ini_set ("display_errors " , 0 );
490490}
491491
492+
493+ class MicroTimer {
494+
495+ private $ startTime ;
496+ private $ stopTime ;
497+
498+ // Creates and starts a timer
499+ public function __construct ()
500+ {
501+ $ this ->startTime = microtime (true );
502+ $ this ->stopTime = null ; // Initialize stopTime to null
503+ }
504+
505+ // Stops a timer
506+ public function stop ()
507+ {
508+ $ this ->stopTime = microtime (true );
509+ }
510+
511+ // Returns the number of seconds from the timer's creation, or elapsed
512+ // between creation and call to ->stop()
513+ public function elapsed ()
514+ {
515+ if (isset ($ this ->stopTime )) {
516+ return round ($ this ->stopTime - $ this ->startTime , 4 );
517+ }
518+
519+ return round (microtime (true ) - $ this ->startTime , 4 );
520+ }
521+
522+ // Called when using a MicroTimer object as a string
523+ public function __toString ()
524+ {
525+ return (string ) $ this ->elapsed ();
526+ }
527+ }
528+
492529// start the timer to record page load time
493530$ pageTimer = new MicroTimer ();
494531
@@ -509,6 +546,28 @@ function leet_text($value)
509546// stripslashes if MAGIC QUOTES is turned on
510547// This is only a workaround. Please better turn off magic quotes!
511548// This code is from http://php.net/manual/en/security.magicquotes.disabling.php
549+
550+
551+ function get_magic_quotes_gpc () {
552+ // Recursive function to process arrays and strings
553+ function stripslashes_deep ($ value )
554+ {
555+ if (is_array ($ value )) {
556+ $ value = array_map ('stripslashes_deep ' , $ value );
557+ } elseif (is_string ($ value )) {
558+ $ value = stripslashes ($ value );
559+ }
560+ return $ value ;
561+ }
562+
563+ // Process superglobals to simulate magic quotes
564+ $ _GET = stripslashes_deep ($ _GET );
565+ $ _POST = stripslashes_deep ($ _POST );
566+ $ _COOKIE = stripslashes_deep ($ _COOKIE );
567+ $ _REQUEST = stripslashes_deep ($ _REQUEST );
568+ }
569+
570+
512571if (get_magic_quotes_gpc ()) {
513572 $ process = array (&$ _GET , &$ _POST , &$ _COOKIE , &$ _REQUEST );
514573 while (list ($ key , $ val ) = each ($ process )) {
@@ -5639,42 +5698,10 @@ public function export_sql($tables, $drop, $structure, $data, $transaction, $com
56395698 echo "COMMIT; \r\n" ;
56405699 }
56415700}
5642- // class MicroTimer (issue #146)
5643- // wraps calls to microtime(), calculating the elapsed time and rounding output
5644- //
5645- class MicroTimer {
56465701
5647- private $ startTime , $ stopTime ;
56485702
5649- // creates and starts a timer
5650- function __construct ()
5651- {
5652- $ this ->startTime = microtime (true );
5653- }
5654-
5655- // stops a timer
5656- public function stop ()
5657- {
5658- $ this ->stopTime = microtime (true );
5659- }
5660-
5661- // returns the number of seconds from the timer's creation, or elapsed
5662- // between creation and call to ->stop()
5663- public function elapsed ()
5664- {
5665- if ($ this ->stopTime )
5666- return round ($ this ->stopTime - $ this ->startTime , 4 );
5667-
5668- return round (microtime (true ) - $ this ->startTime , 4 );
5669- }
56705703
5671- // called when using a MicroTimer object as a string
5672- public function __toString ()
5673- {
5674- return (string ) $ this ->elapsed ();
5675- }
56765704
5677- }
56785705// class Resources (issue #157)
56795706// outputs secondary files, such as css and javascript
56805707// data is stored gzipped (gzencode) and encoded (base64_encode)
0 commit comments