Viewing Paste 453

Formated Paste

  1. <?php
  2.  
  3. // Get the contents man.
  4. $contents = ob_get_contents();
  5.  
  6. // The contents.
  7. if ($boardurl != 'http://svn.test')
  8. $contents = str_replace('http://svn.test', $boardurl, $contents);
  9.  
  10. // Only do the Theme changer in certain cases.
  11. if (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('xmlhttp', '.xml', 'viewsmfile', 'viewquery', 'verificationcode', 'suggest', 'smstats', 'quickmod', 'quickmod2', 'quotefast', 'openidreturn', 'jsoption', 'jsmodify', 'jseditor')))
  12. themechanger($contents);
  13.  
  14. echo $contents;
  15.  
  16.  
  17.  
  18. function themechanger(&$contents)
  19. {
  20. global $smcFunc, $user_info;
  21.  
  22. if (empty($_SERVER['REQUEST_URL']))
  23. return;
  24.  
  25. // Figure out our location easily.
  26. $location = preg_replace('~[;|?]theme=(\d+)~i', '', $_SERVER['REQUEST_URL']);
  27. if (strpos($location, '?') !== false)
  28. $location = $location . ';';
  29. else
  30. $location = $location . '?';
  31.  
  32. // Is the current theme, wrong!
  33. if (isset($_REQUEST['theme']))
  34. $user_info['theme'] = (int) $_REQUEST['theme'];
  35. elseif (!empty($_SESSION['id_theme']))
  36. $user_info['theme'] = (int) $_SESSION['id_theme'];
  37.  
  38. // Start.
  39. $thestring = '
  40. <div id="svn_theme_changer" style="position: absolute; top:1em; left: 40em; color:red; z-index:999; display: none;">
  41. <form method="get" action="javascript://void;">
  42. <select name="theme" onchange="location=\''. $location . 'theme=\' + this.options[this.selectedIndex].value">';
  43.  
  44. // Go database!
  45. $request = $smcFunc['db_query']('', '
  46. SELECT value, id_theme
  47. FROM {db_prefix}themes
  48. WHERE id_theme != {int:no_theme}
  49. AND id_member = {int:guest_id}
  50. AND variable = {string:theme_name}',
  51. 'no_theme' => 0,
  52. 'guest_id' => 0,
  53. 'theme_name' => 'name',
  54. ));
  55. while ($row = $smcFunc['db_fetch_assoc']($request))
  56. $thestring .= '
  57. <option value="' . $row['id_theme'] . '"' . ($user_info['theme'] == $row['id_theme'] ? ' selected="selected"' : ''). '>' . $row['value'] . '</option>';
  58.  
  59. $thestring .= '
  60. </select>
  61. </form>
  62. </div>
  63. <div style="position: absolute; top:0; left: 0; right: 0; color:red; z-index:999; dislay: none;">
  64. <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 = \'\';"><img src="http://svn.test/Themes/default/images/smiley_select_spot.gif" alt="expand" /></a></div>
  65. <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\';"><img src="http://svn.test/Themes/default/images/board_select_spot.gif" alt="collapse" /></a></div></div>';
  66.  
  67. // board_select_spot.gif collapse
  68. // smiley_select_spot.gif expand
  69. // Hack out and display the few themes we have quickly.
  70. $contents = str_replace('<body>', '<body>' . $thestring, $contents);
  71.  
  72. return $contents;
  73. }
  74. ?>
Name:
Email:
Code/text to paste:
  • Enable code highlighting
  • Code Language:
  • A duck, cat and a goose walk into a bar. How many animals walked into a bar?:
Highslide for Wordpress Plugin