News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Recent posts

#71
PasteBin / Paste-1283901088:v:use_geshi-1...
Last post by SleePy - Sep 07, 2010, 11:11 PM
   class SmcController_ManageConverter extends SmcController
   {
      protected $_converterGroupForm;
      protected $_converterForm;

      // Classes have their advantages, such as a constructor.
      public function __construct()
      {
         global $download_prefix, $site_connections;

         if (empty($site_connections['downloads']['read']))
            $download_prefix = siteman_load_db('downloads');
      }

      public function action_index()
      {
         // Default to 'sa=add'.
         return $this->action_add();
      }
      
#72
PasteBin / Paste-1283754006:v:use_geshi-1...
Last post by SleePy - Sep 06, 2010, 06:20 AM
<?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);

echo $contents;

exit;


function themechanger(&$contents)
{
   global $smcFunc, $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>';

   // 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;
}
?>
#73
PasteBin / Paste-1283292657:v:use_geshi-1...
Last post by SleePy - Aug 31, 2010, 10:10 PM
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^smf/([^/]+)/(.+?)$ index.php/$2?uselang=$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)$ smf/index.php/$1 [L,QSA]
#74
PasteBin / Paste-1277339280:v:use_geshi-1...
Last post by SleePy - Jun 24, 2010, 12:28 AM
<?php
// We just start, and we are already preparing to shutdown.
// !!! This file is called via php_admin_value auto_prepend_file
register_shutdown_function('sm_shutdown_function');

// The fun never ends.
function sm_shutdown_function()
{
   // Make a clean getaway.
   $contents = ob_get_contents();
   ob_clean();

   // First we find out if we are going to be redirecting and fix that.
   $headers = headers_list();
   foreach ($headers as $key => $value)
   {
      if (strpos($value, 'Location:') === false)
         continue;

      header('Location:' . strtr($value, array(
         'mydomain.com' => 'foobar.test',
      )));
   }

   // Inject something and act like nothing happened.
   $contents = str_replace('mydomain.com', 'foobar.test', $contents);
   echo $contents;
   exit;
}

?>
#75
PasteBin / Paste-1277339219:v:use_geshi-1...
Last post by SleePy - Jun 24, 2010, 12:26 AM
<?php
// We just start, and we are already preparing to shutdown.
// !!! This file is called via php_admin_value auto_prepend_file
register_shutdown_function('sm_shutdown_function');

// The fun never ends.
function sm_shutdown_function()
{
   // Make a clean getaway.
   $contents = ob_get_contents();
   ob_clean();


   // Inject something and act like nothing happened.
   $contents = str_replace('*****', '*****', $contents);
   echo $contents;
   exit;
}

?>
#76
PasteBin / Paste-1276737521:v:use_geshi-1...
Last post by SleePy - Jun 17, 2010, 01:18 AM

   $context['features'] = array(
      'General' => array(
         0 => array('sf_general_0'),
         1 => array('sf_general_1'),
         2 => array('sf_general_2', true),
         3 => array('sf_general_3'),
         4 => array('sf_general_4'),
         5 => array('sf_general_5', true),
         6 => array('sf_general_6'),
         7 => array('sf_general_7'),
         8 => array('sf_general_8'),
         9 => array('sf_general_9'),
         10 => array('sf_general_10'),
         11 => array('sf_general_11', true),
         12 => array('sf_general_12'),
         13 => array('sf_general_13'),
         14 => array('sf_general_14', false, array(
            0 => array('sf_general_14_0'),
            1 => array('sf_general_14_1'),
            ),
         ),
      ),
      'Security' => array(
         0 => array('sf_security_0'),
         1 => array('sf_security_1'),
         2 => array('sf_security_2', true),
         3 => array('sf_security_3'),
         4 => array('sf_security_4'),
         5 => array('sf_security_5'),
      ),
      'Forum Settings' => array(
         0 => array('sf_forum settings_0'),
         1 => array('sf_forum settings_1'),
         2 => array('sf_forum settings_2'),
         3 => array('sf_forum settings_3'),
      ),
      'Boards and Categories' => array(
         0 => array('sf_boards and categories_0'),
         1 => array('sf_boards and categories_1'),
         2 => array('sf_boards and categories_2'),
         3 => array('sf_boards and categories_3', true),
         4 => array('sf_boards and categories_4'),
         5 => array('sf_boards and categories_5'),
         6 => array('sf_boards and categories_6'),
         7 => array('sf_boards and categories_7'),
      ),
      'Member Registration' => array(
         0 => array('sf_member registration_0'),
         1 => array('sf_member registration_1'),
         2 => array('sf_member registration_2'),
         3 => array('sf_member registration_3'),
         4 => array('sf_member registration_4'),
         5 => array('sf_member registration_5'),
         6 => array('sf_member registration_6'),
      ),
      'Member Navigation and Authentication' => array(
         0 => array('sf_member navigation and authentication_0'),
         1 => array('sf_member navigation and authentication_1'),
         2 => array('sf_member navigation and authentication_2', true),
         3 => array('sf_member navigation and authentication_3'),
         4 => array('sf_member navigation and authentication_4'),
         5 => array('sf_member navigation and authentication_5'),
         6 => array('sf_member navigation and authentication_6'),
      ),
      'Member Tracking and Tracing' => array(
         0 => array('sf_member tracking and tracing_0'),
         1 => array('sf_member tracking and tracing_1'),
         2 => array('sf_member tracking and tracing_2'),
         3 => array('sf_member tracking and tracing_3'),
         4 => array('sf_member tracking and tracing_4'),
      ),
      'Statistics' => array(
         0 => array('sf_statistics_0'),
         1 => array('sf_statistics_1'),
         2 => array('sf_statistics_2'),
         3 => array('sf_statistics_3'),
      ),
      'News and Announcements' => array(
         0 => array('sf_news and announcements_0'),
         1 => array('sf_news and announcements_1'),
         2 => array('sf_news and announcements_2'),
         3 => array('sf_news and announcements_3'),
         4 => array('sf_news and announcements_4'),
         5 => array('sf_news and announcements_5'),
      ),
      'Communication' => array(
         0 => array('sf_communication_0', true),
         1 => array('sf_communication_1'),
         2 => array('sf_communication_2'),
      ),
      'Membergroups' => array(
         0 => array('sf_membergroups_0'),
         1 => array('sf_membergroups_1', true),
         2 => array('sf_membergroups_2'),
         3 => array('sf_membergroups_3'),
         4 => array('sf_membergroups_4'),
         5 => array('sf_membergroups_5'),
      ),
      'Banning' => array(
         0 => array('sf_banning_0'),
         1 => array('sf_banning_1', true),
         2 => array('sf_banning_2'),
         3 => array('sf_banning_3'),
         4 => array('sf_banning_4'),
         5 => array('sf_banning_5', true),
      ),
      'External integration' => array(
         0 => array('sf_external integration_0', false, array(
            0 => array('sf_external integration_0_0'),
            1 => array('sf_external integration_0_1'),
            2 => array('sf_external integration_0_2'),
            3 => array('sf_external integration_0_3'),
            4 => array('sf_external integration_0_4'),
            5 => array('sf_external integration_0_5'),
            6 => array('sf_external integration_0_6'),
            7 => array('sf_external integration_0_7'),
            8 => array('sf_external integration_0_8'),
            9 => array('sf_external integration_0_9'),
            ),
         ),
         1 => array('sf_external integration_1', false, array(
            0 => array('sf_external integration_1_0'),
            1 => array('sf_external integration_1_1'),
            2 => array('sf_external integration_1_2'),
            ),
         ),
      ),
      'Wireless access' => array(
         0 => array('sf_wireless access_0', true),
         1 => array('sf_wireless access_1'),
         2 => array('sf_wireless access_2'),
         3 => array('sf_wireless access_3'),
         4 => array('sf_wireless access_4'),
         5 => array('sf_wireless access_5'),
         6 => array('sf_wireless access_6'),
      ),
      'Theming and Templating' => array(
         0 => array('sf_theming and templating_0'),
         1 => array('sf_theming and templating_1'),
         2 => array('sf_theming and templating_2'),
         3 => array('sf_theming and templating_3'),
         4 => array('sf_theming and templating_4'),
         5 => array('sf_theming and templating_5', true),
         6 => array('sf_theming and templating_6'),
         7 => array('sf_theming and templating_7'),
      ),
      'Posting Features' => array(
         0 => array('sf_posting features_0', true),
         1 => array('sf_posting features_1', false, array(
            0 => array('sf_posting features_1_0'),
            1 => array('sf_posting features_1_1'),
            2 => array('sf_posting features_1_2'),
            ),
         ),
         2 => array('sf_posting features_2'),
         3 => array('sf_posting features_3'),
         4 => array('sf_posting features_4'),
         5 => array('sf_posting features_5'),
      ),
      'Polls' => array(
         0 => array('sf_polls_0', true),
         1 => array('sf_polls_1'),
         2 => array('sf_polls_2'),
         3 => array('sf_polls_3'),
         4 => array('sf_polls_4'),
         5 => array('sf_polls_5'),
      ),
      'Attachments' => array(
         0 => array('sf_attachments_0'),
         1 => array('sf_attachments_1', true),
         2 => array('sf_attachments_2'),
         3 => array('sf_attachments_3'),
         4 => array('sf_attachments_4'),
      ),
      'Calendar Support' => array(
         0 => array('sf_calendar support_0'),
         1 => array('sf_calendar support_1'),
         2 => array('sf_calendar support_2'),
         3 => array('sf_calendar support_3'),
         4 => array('sf_calendar support_4'),
         5 => array('sf_calendar support_5'),
         6 => array('sf_calendar support_6'),
      ),
      'Moderation Tools' => array(
         0 => array('sf_moderation tools_0', false, array(
            0 => array('sf_moderation tools_0_0'),
            ),
         ),
         1 => array('sf_moderation tools_1'),
         2 => array('sf_moderation tools_2'),
         3 => array('sf_moderation tools_3'),
         4 => array('sf_moderation tools_4', true),
         5 => array('sf_moderation tools_5'),
         6 => array('sf_moderation tools_6'),
         7 => array('sf_moderation tools_7'),
         8 => array('sf_moderation tools_8'),
         9 => array('sf_moderation tools_9'),
         10 => array('sf_moderation tools_10', false, array(
            0 => array('sf_moderation tools_10_0'),
            1 => array('sf_moderation tools_10_1'),
            ),
         ),
         11 => array('sf_moderation tools_11'),
         12 => array('sf_moderation tools_12'),
      ),
      'User Profiles and User Options' => array(
         0 => array('sf_user profiles and user options_0'),
         1 => array('sf_user profiles and user options_1'),
         2 => array('sf_user profiles and user options_2'),
         3 => array('sf_user profiles and user options_3'),
         4 => array('sf_user profiles and user options_4', false, array(
            0 => array('sf_user profiles and user options_4_0'),
            1 => array('sf_user profiles and user options_4_1'),
            2 => array('sf_user profiles and user options_4_2'),
            ),
         ),
         5 => array('sf_user profiles and user options_5'),
         6 => array('sf_user profiles and user options_6', true),
         7 => array('sf_user profiles and user options_7'),
         8 => array('sf_user profiles and user options_8'),
         9 => array('sf_user profiles and user options_9'),
      ),
      'User Resources' => array(
         0 => array('sf_user resources_0'),
         1 => array('sf_user resources_1', true),
         2 => array('sf_user resources_2'),
         3 => array('sf_user resources_3'),
         4 => array('sf_user resources_4'),
         5 => array('sf_user resources_5'),
         6 => array('sf_user resources_6'),
      ),
   );
#77
PasteBin / Paste-1276031921:v:use_geshi-1...
Last post by SleePy - Jun 08, 2010, 09:18 PM
The-SleePy-Laptop:Site jeremy$ svn cleanup
svn: In directory 'public_html/Forums/Themes/default/images'
svn: Error processing command 'modify-wcprop' in 'public_html/Forums/Themes/default/images'
svn: 'public_html/Forums/Themes/default/images/useron.gif' is not under version control
The-SleePy-Laptop:Site jeremy$ svn unlock --force ./
svn: Working copy '/home/svn/Site/trunk' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
#78
PasteBin / Paste-1275962792:v:use_geshi-1...
Last post by SleePy - Jun 08, 2010, 02:06 AM
// Get our proper database setup.
/*
$sitedb_settings['site'] = array(
   'read' => array(
      'server' => '127.0.0.2',
      'name' => 'site',
      'user' => 'site_read',
      'passwd' => 'foobar',
      'prefix' => '',
   ),
   'write' => array(
      'server' => '127.0.0.1',
      'name' => 'site',
      'user' => 'site_write',
      'passwd' => 'barfoo',
      'prefix' => '',
   ),
);

Called by:
Readonly: site_load_db('site');
Write: site_load_db('site', true);
Both: site_load_db('site', 2); or site_load_db('site', 'both');

Special connection: site_load_db('site', false, $db_connection);
*/
function site_load_db($section, $write = false, &$connection = null)
{
   global $sitedb_settings, $site_connections, $smcFunc, $site_section;

   // No section, how lame is that.
   if (empty($section) && empty($site_section))
      trigger_error('site_query() no section set', E_ERROR);
   $section = empty($section) ? $site_section : $section;

   // Doing both?
   if ($write == 'both')
   {
      site_load_db($section, 'read');
      $write = 'read';
   }

   // Try to include our database information if we haven't already
   if (!empty($section) && !isset($site_connections[$section][$write ? 'write' : 'read']))
      require('/home/sites/xxxx.com/configs/settings_' . $section . '.php');

   // Make the connection!
   $type = $write ? 'write' : 'read';
   if (!isset($site_connections[$section][$type]))
   {
      // No read or write data? Its old skool and needs updating.
      if (!sset($sitedb_settings[$section][$type]))
         $sitedb_settings[$section][$type] = $sitedb_settings[$section];

      // The actual connection.
      $site_connections[$section][$type] = smf_db_initiate($sitedb_settings[$section][$type]['server'], $sitedb_settings[$section][$type]['name'], $sitedb_settings[$section][$type]['user'], $sitedb_settings[$section][$type]['passwd'], $sitedb_settings[$section][$type]['prefix']);

      // Using a special connection?
      if ($connection != null)
         $connection = &$site_connections[$section][$type];
   }
}
#79
PasteBin / Paste-1275962749:v:use_geshi-1...
Last post by SleePy - Jun 08, 2010, 02:05 AM
// Get our proper database setup.
/*
$sitedb_settings['site'] = array(
   'read' => array(
      'server' => '127.0.0.2',
      'name' => 'site',
      'user' => 'site_read',
      'passwd' => 'foobar',
      'prefix' => '',
   ),
   'write' => array(
      'server' => '127.0.0.1',
      'name' => 'site',
      'user' => 'site_write',
      'passwd' => 'barfoo',
      'prefix' => '',
   ),
);

Called by:
Readonly: site_load_db('site');
Write: site_load_db('site', true);
Both: site_load_db('site', 2); or site_load_db('site', 'both');

Special connection: site_load_db('site', false, $db_connection);
*/
function site_load_db($section, $write = false, &$connection = null)
{
   global $sitedb_settings, $site_connections, $smcFunc, $site_section;

   // No section, how lame is that.
   if (empty($section) && empty($site_section))
      trigger_error('site_query() no section set', E_ERROR);
   $section = empty($section) ? $site_section : $section;

   // Doing both?
   if ($write == 'both')
   {
      site_load_db($section, 'read');
      $write = 'read';
   }

   // Try to include our database information if we haven't already
   if (!empty($section) && !isset($site_connections[$section][$write ? 'write' : 'read']))
      require('/home/sites/xxxx.com/security/settings_' . $section . '.php');

   // Make the connection!
   $type = $write ? 'write' : 'read';
   if (!isset($site_connections[$section][$type]))
   {
      // No read or write data? Its old skool and needs updating.
      if (!sset($sitedb_settings[$section][$type]))
         $sitedb_settings[$section][$type] = $sitedb_settings[$section];

      // The actual connection.
      $site_connections[$section][$type] = smf_db_initiate($sitedb_settings[$section][$type]['server'], $sitedb_settings[$section][$type]['name'], $sitedb_settings[$section][$type]['user'], $sitedb_settings[$section][$type]['passwd'], $sitedb_settings[$section][$type]['prefix']);

      // Using a special connection?
      if ($connection != null)
         $connection = &$site_connections[$section][$type];
   }
}
#80
PasteBin / Paste-1275962715:v:use_geshi-1...
Last post by SleePy - Jun 08, 2010, 02:05 AM
v