Warning: Invalid argument supplied for foreach() in /srv/sleepycode.com/public_html/forum/Sources/Subs-Editor.php on line 2095

Warning: Invalid argument supplied for foreach() in /srv/sleepycode.com/public_html/forum/Sources/Subs-Editor.php on line 2095

Warning: Invalid argument supplied for foreach() in /srv/sleepycode.com/public_html/forum/Sources/Subs-Editor.php on line 2095

Warning: Invalid argument supplied for foreach() in /srv/sleepycode.com/public_html/forum/Sources/Subs-Editor.php on line 2095

Warning: Invalid argument supplied for foreach() in /srv/sleepycode.com/public_html/forum/Sources/Subs-Editor.php on line 2095

Warning: Invalid argument supplied for foreach() in /srv/sleepycode.com/public_html/forum/Sources/Subs-Editor.php on line 2095

Warning: Invalid argument supplied for foreach() in /srv/sleepycode.com/public_html/forum/Sources/Subs-Editor.php on line 2095
Paste-1319594570:v:use_geshi-1:v:type-php
 

Paste-1319594570:v:use_geshi-1:v:type-php

Started by SleePy, Oct 26, 2011, 02:02 am

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

SleePy

<?php

// Get the contents man.
$contents = ob_get_contents();
ob_clean();

// The contents.
if ($boardurl != 'http://svn.test')
   $contents = str_replace('http://svn.test', $boardurl, $contents);

// Only do the Theme changer in certain cases.
if (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('xmlhttp', '.xml', 'viewsmfile', 'viewquery', 'verificationcode', 'suggest', 'smstats', 'quickmod', 'quickmod2', 'quotefast', 'openidreturn', 'jsoption', 'jsmodify', 'jseditor')))
   themechanger($contents);

// The true execution time.
$time = round(array_sum(explode(' ', $GLOBALS['true_end'])) - array_sum(explode(' ', $GLOBALS['true_start'])), 3);
preg_match('~<p>Page created in ([\d.]+) seconds with (\d+) queries.</p>~i', $contents, $matches);
$contents = str_replace($matches[0], $matches[0] . '<p>Page REALLY created in ' . ($time) . ' seconds</p>', $contents);

echo $contents;

exit;

function themechanger(&$contents)
{
   global $smcFunc, $context, $user_info;

   if (empty($_SERVER['REQUEST_URL']))
      return;

   // Figure out our location easily.
   $location = preg_replace('~[;|?]theme=(\d+)~i', '', $_SERVER['REQUEST_URL']);
   if (strpos($location, '?') !== false)
      $location = $location . ';';
   else
      $location = $location . '?';

   // Is the current theme, wrong!
   if (isset($_REQUEST['theme']))
      $user_info['theme'] = (int) $_REQUEST['theme'];
   elseif (!empty($_SESSION['id_theme']))
      $user_info['theme'] = (int) $_SESSION['id_theme'];

   // Start.
   $thestring = '
<div id="svn_theme_changer" style="position: absolute; top:1em; left: 40em; color:red; z-index:999; display: none;">
   <form method="get" action="javascript://void;">
      <select name="theme" onchange="location=\''. $location . 'theme=\' + this.options[this.selectedIndex].value">';

   // Go database!
   $request = $smcFunc['db_query']('', '
      SELECT value, id_theme
      FROM {db_prefix}themes
         WHERE id_theme != {int:no_theme}
         AND id_member = {int:guest_id}
         AND variable = {string:theme_name}',
      array(
         'no_theme' => 0,
         'guest_id' => 0,
         'theme_name' => 'name',
   ));
   while ($row = $smcFunc['db_fetch_assoc']($request))
      $thestring .= '
         <option value="' . $row['id_theme'] . '"' . ($user_info['theme'] == $row['id_theme'] ? ' selected="selected"' : ''). '>' . $row['value'] . '</option>';

   $thestring .= '
      </select>
   </form>
</div>
<div style="position: absolute; top:0; left: 0; right: 0; color:red; z-index:999; dislay: none;">
<div id="svn_theme_changer_show" style="display: block; float: right;" ><a href="#1" onclick="document.getElementById(\'svn_theme_changer\').style.display = \'\'; document.getElementById(\'svn_theme_changer_show\').style.display = \'none\'; document.getElementById(\'svn_theme_changer_hide\').style.display = \'\';">expand</a></div>
<div id="svn_theme_changer_hide" style="display: none; float: right;"><a href="#2" onclick="document.getElementById(\'svn_theme_changer\').style.display = \'none\'; document.getElementById(\'svn_theme_changer_show\').style.display = \'\'; document.getElementById(\'svn_theme_changer_hide\').style.display = \'none\';">collapse</a></div></div>
<a style="float: right;" href="javascript:location=\'' . $_SERVER['REQUEST_URL'] . '&destory_session&secs=' . $context['session_id'] . '\'">[Destroy Session]</a>';
   

   // board_select_spot.gif   collapse
   // smiley_select_spot.gif  expand
   // Hack out and display the few themes we have quickly.
   $contents = str_replace('<body>', '<body>' . $thestring, $contents);

   return $contents;
}
?>
No siggy! :D

 
Browser ID: smf ()
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 2: index+Modifications.english (default), Post.english (default).
Style sheets: 3: index.css, responsive.css, jquery.sceditor.css.
Hooks called: 40 (show)
Files included: 30 - 1045KB. (show)
Memory used: 1575KB.
Tokens: post-login, post-register.
Queries used: 23.

[Show Queries]