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

#51
PasteBin / Paste-1309742515:v:use_geshi-1...
Last post by SleePy - Jul 04, 2011, 01:21 AM
<?php
/**********************************************************************************
* Settings.php                                                                    *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel (zef@zefhemel.com)                    *
* =============================================================================== *
* Software Version:           SMF 2.0 RC1                                         *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2009 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/

if (isset($revision))
   $forum_version .= ' Revision:' . $revision;

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$mtitle = 'Maintenance Mode';      # Title for the Maintenance Mode message.
$mmessage = 'Okay faithful users...we\'re attempting to restore an older backup of the database...news will be posted once we\'re back!';      # Description of why the forum is in maintenance mode.

########## Forum Info ##########
$mbname = 'SleePys Development Community';      # The name of your forum.
$language = 'english';      # The default language file set for the forum.
$boardurl = 'http://smf-svn.test';      # URL to your forum's folder. (without the trailing /!)
$webmaster_email = 'noreply@svn.test';      # Email address to send emails from. (like noreply@yourdomain.com.)
$cookiename = 'svn_test';      # Name of the cookie to set for authentication.

########## Database Info ##########
# Always have the defualt (MySQL)
$db_type = 'mysql';
$db_server = 'localhost';
$db_name = '__smf_svn_trunk';
$db_user = 'smf';
$db_passwd = 'smf';
$ssi_db_user = '';
$ssi_db_passwd = '';
$db_prefix = 'smf_';
$db_persist = 0;
$db_error_send = 1;
$db_show_debug = true;

# Maybe we are using Postgresql?
if (isset($_SERVER['HTTP_HOST']) && substr($_SERVER['HTTP_HOST'], 0, strlen('postgresql')) == 'postgresql')
{
   $boardurl = 'http://postgresql.svn.test';
   $cookiename .= '_postgresql';

   $db_type = 'postgresql';
   $db_user = 'SMF';
}
# Maybe Sqlite?
elseif (isset($_SERVER['HTTP_HOST']) && substr($_SERVER['HTTP_HOST'], 0, strlen('sqlite')) == 'sqlite')
{
   $boardurl = 'http://sqlite.svn.test';
   $cookiename .= '_sqlite';

   $db_type = 'sqlite';
   $db_name = '/home/data/sqlite_db';
}

########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir = '/home/svn/sm-smf/trunk';      # The absolute path to the forum's folder. (not just '.'!)
$sourcedir = '/home/svn/sm-smf/trunk/Sources';      # Path to the Sources directory.
$cachedir = '/home/smf/svn_files/cache';      # Path to the cache directory.
$cachedir_fix = $cachedir;

########## Error-Catching ##########
# Note: You shouldn't touch these settings.
$db_last_error = 0;

# Make sure the paths are correct... at least try to fix them.
if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
   $boarddir = dirname(__FILE__);
if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources'))
   $sourcedir = $boarddir . '/Sources';
if (!file_exists($cachedir) && file_exists($boarddir . '/cache'))
   $cachedir = $boarddir . '/cache';
?>
#52
PasteBin / Paste-1309742389:v:use_geshi-1...
Last post by SleePy - Jul 04, 2011, 01:19 AM
# svn.test
   # Where the Physical files exist for good.
   <Directory "/home/svn/sm-smf/trunk">
       Options Indexes FollowSymLinks ExecCGI
      AllowOverride AuthConfig Indexes
       Order allow,deny
       Allow from all
   </Directory>
   <Directory "/home/smf/svn_files">
       Options Indexes FollowSymLinks ExecCGI
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>
   <VirtualHost *:80>
      # Our urls.
      ServerName smf-svn.test
      ServerAlias postgresql.smf-svn.test sqlite.smf-svn.test mysql.svn.test

      # Setup the document root to our svn files.
      DocumentRoot /home/svn/sm-smf/trunk

      # We will use PHP 5.3 for this.
      AddHandler php5-script .php

      # Put the error log somewhere nice.
      ErrorLog "logs/custom/svn.test/error_php5.log"
      CustomLog "logs/custom/svn.test/access-80.log" common

      # Fake our Settings.php automatically :D
      php_value auto_prepend_file "/home/smf/svn_files/Settings.php"

      # Append a exit script at the end to handle url changes for postgresql.svn.test and sqlite.svn.test
      php_value auto_append_file "/home/smf/svn_files/exit_script.php"

      # Emulate some files to fake what we are really doing.
      Alias /upgrade.php /home/smf/svn_files/upgrade_emulator.php
      Alias /index.php /home/smf/svn_files/index_emulator.php
      Alias /phpinfo.php /home/smf/public_html/phpinfo.php
   </VirtualHost>
#53
PasteBin / Paste-1299743401:v:use_geshi-1...
Last post by SleePy - Mar 10, 2011, 07:50 AM
<?php

/**
* A SMF based cache engine using Memcache.
* @since 3.0
* @version 3.0
*/
class SmCache
{
   /**
   * Is memcache enabled?
   * @since 3.0
   * @version 3.0
   */
   private static $disabled = false;

   /**
   * The memcache object.
   * @since 3.0
   * @version 3.0
   */
   private static $memcache = null;

   /**
   * The prekey, basically the prefix used on this memcache instance.
   * @since 3.0
   * @version 3.0
   */
   private static $prekey = '';

   /**
   * Gets data from MemCache.
   * @param string $key The unique key.
   * @param int $ttl How long the key should exist.
   * @return mixed The data which was stored is now returned.
   * @since 3.0
   * @version 3.0
   */
   public static function get($key, $ttl)
   {
      if (self::$disabled)
         return;

      $st = microtime();

      $value = self::$memcache->get(self::$prekey . strtr($key, ':', '-'), $ttl);

      // Update our hit counter.
      self::__cacheHits('get', strtr($key, ':', '-'), null, $ttl, $st, microtime());

      // Return the correct value.
      if (empty($value))
         return null;
      else
         return @unserialize($value);
   }

   /**
   * Sets the data into the memcache server.
   * @param string $key The unique key.
   * @param string $value The data to cache.
   * @param int $ttl How long the key should exist.
   * @return void Nothing is returned.
   * @since 3.0
   * @version 3.0
   */
   public static function set($key, $value, $ttl)
   {
      if (self::$disabled)
         return;

      $st = microtime();

      $value = $value === null ? null : serialize($value);

      // Note: due to inconsistencies in pecl, we use 0 as ttl to resolve a bug.
      if (is_null($value))
         self::$memcache->delete(self::$prekey  . strtr($key, ':', '-'), 0);
      else
         self::$memcache->set(self::$prekey . strtr($key, ':', '-'), $value, 0, $ttl);

      // Update our hit counter.
      self::__cacheHits('put', $key, strtr($key, ':', '-'), $ttl, $st, microtime());
   }

   /**
   * This does the hefty startup work.  Gets memcache going.
   * @param int $level Allows us to call this multiple times to try and start memcache up.
   * @return void Nothing is returned.
   * @since 3.0
   * @version 3.0
   */
   public static function __loadMemCache($level = 0)
   {
      global $modSettings;

      // If it is off, let the class know.
      if (empty($modSettings['cache_enable']) && !empty($modSettings))
      {
         return;
      }

      // Create our new memcache instance.
      self::$memcache = new Memcache;

      // Basic load balancing.
      $servers = explode(',', $modSettings['cache_memcached']);
      $server = explode(':', trim($servers[array_rand($servers)]));

      // Connect to memcache now.
      $connected = $memcache->pconnect($server[0], empty($server[1]) ? 11211 : $server[1]);

      // Try a few times to connect.
      if (!$connected && $level > 3)
         self::__loadMemCache(++$level);
      elseif ($level =< 2)
         return false;

      self::$prekey = md5(filemtime(__FILE__)) . '-SmSite-';
   }

   /**
   * Updates SMFs cache counter and debugging info.
   * @param string $type Either "get" or "put" based on what type of usage.
   * @param string $key The unique key.
   * @param string $value The data to cache.
   * @param int $ttl How long the key should exist.
   * @param int $start Time before trying caching.
   * @param int $stop Time after trying caching.
   * @return void Nothing is returned.
   * @since 3.0
   * @version 3.0
   */
   public static function __cacheHits($type, $key, $value, $ttl, $start, $stop)
   {
      global $cache_hits, $cache_count, $db_show_debug;

      $cache_count = isset($cache_count) ? $cache_count + 1 : 1;
      if (isset($db_show_debug) && $db_show_debug === true)
      {
         $cache_hits[$cache_count] = array('k' => $key, 'd' => $type, 's' => $value === null ? 0 : strlen(serialize($value)), 't' => array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st)));

      $cache_hits[$cache_count]['t'] = array_sum(explode(' ', $stop)) - array_sum(explode(' ', $start));

      }
   }
}

?>
#54
PasteBin / Paste-1299743302:v:use_geshi-1...
Last post by SleePy - Mar 10, 2011, 07:48 AM
<?php

/**
* A SMF based cache engine using Memcache.
* @since 3.0
* @version 3.0
*/
class SmCache
{
   /**
   * Is memcache enabled?
   * @since 3.0
   * @version 3.0
   */
   private static $disabled = false;

   /**
   * The memcache object.
   * @since 3.0
   * @version 3.0
   */
   private static $memcache = null;

   /**
   * The prekey, basically the prefix used on this memcache instance.
   * @since 3.0
   * @version 3.0
   */
   private static $prekey = '';

   /**
   * Gets data from MemCache.
   * @param string $key The unique key.
   * @param int $ttl How long the key should exist.
   * @return mixed The data which was stored is now returned.
   * @since 3.0
   * @version 3.0
   */
   public static function get($key, $ttl)
   {
      if (self::$disabled)
         return;

      $st = microtime();

      $value = self::$memcache->get(self::$prekey . strtr($key, ':', '-'), $ttl);

      // Update our hit counter.
      self::__cacheHits('get', strtr($key, ':', '-'), null, $ttl, $st, microtime());

      // Return the correct value.
      if (empty($value))
         return null;
      else
         return @unserialize($value);
   }

   /**
   * Sets the data into the memcache server.
   * @param string $key The unique key.
   * @param string $value The data to cache.
   * @param int $ttl How long the key should exist.
   * @return void Nothing is returned.
   * @since 3.0
   * @version 3.0
   */
   public static function set($key, $value, $ttl)
   {
      if (self::$disabled)
         return;

      $st = microtime();

      $value = $value === null ? null : serialize($value);

      // Note: due to inconsistencies in pecl, we use 0 as ttl to resolve a bug.
      if (is_null($value))
         self::$memcache->delete(self::$prekey  . strtr($key, ':', '-'), 0);
      else
         self::$memcache->set(self::$prekey . strtr($key, ':', '-'), $value, 0, $ttl);

      // Update our hit counter.
      self::__cacheHits('put', $key, strtr($key, ':', '-'), $ttl, $st, microtime());
   }

   /**
   * This does the hefty startup work.  Gets memcache going.
   * @param int $level Allows us to call this multiple times to try and start memcache up.
   * @return void Nothing is returned.
   * @since 3.0
   * @version 3.0
   */
   public static function __loadMemCache($level = 0)
   {
      global $modSettings;

      // If it is off, let the class know.
      if (empty($modSettings['cache_enable']) && !empty($modSettings))
      {
         return;
      }

      // Create our new memcache instance.
      self::$memcache = new Memcache;

      // Basic load balancing.
      $servers = explode(',', $modSettings['cache_memcached']);
      $server = explode(':', trim($servers[array_rand($servers)]));

      // Connect to memcache now.
      $connected = $memcache->pconnect($server[0], empty($server[1]) ? 11211 : $server[1]);

      // Try a few times to connect.
      if (!$connected && $level > 3)
         self::__loadMemCache(++$level);
      elseif ($level =< 2)
         return false;

      self::$prekey = md5($boardurl . filemtime(__FILE__)) . '-SmSite-';
   }

   /**
   * Updates SMFs cache counter and debugging info.
   * @param string $type Either "get" or "put" based on what type of usage.
   * @param string $key The unique key.
   * @param string $value The data to cache.
   * @param int $ttl How long the key should exist.
   * @param int $start Time before trying caching.
   * @param int $stop Time after trying caching.
   * @return void Nothing is returned.
   * @since 3.0
   * @version 3.0
   */
   public static function __cacheHits($type, $key, $value, $ttl, $start, $stop)
   {
      global $cache_hits, $cache_count, $db_show_debug;

      $cache_count = isset($cache_count) ? $cache_count + 1 : 1;
      if (isset($db_show_debug) && $db_show_debug === true)
      {
         $cache_hits[$cache_count] = array('k' => $key, 'd' => $type, 's' => $value === null ? 0 : strlen(serialize($value)), 't' => array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st)));

      $cache_hits[$cache_count]['t'] = array_sum(explode(' ', $stop)) - array_sum(explode(' ', $start));

      }
   }
}

?>
#55
PasteBin / Paste-1299091677:v:use_geshi-1...
Last post by SleePy - Mar 02, 2011, 06:47 PM
        #PasteBin!
        location /Pastebin/
        {
                try_files $uri @pastebin;
        }
        location @pastebin
        {
                rewrite "^/Pastebin/([0-9]+)/([A-Za-z0-9]{5})$" /Pastebin/index.php?view=$1&key=$2 last;
                rewrite ^/Pastebin/([0-9]+)/?$ /Pastebin/index.php?view=$1 last;
                rewrite ^/Pastebin/credits$ /Pastebin/index.php?credits last;
        }
#56
PasteBin / Paste-1292188712:v:use_geshi-1...
Last post by SleePy - Dec 12, 2010, 09:18 PM
[***@**** ~]$ telnet irc.villageirc.net 6667
Trying 69.72.215.132...
Connected to irc.villageirc.net.
Escape character is '^]'.
:Loopy.NJ.US.VillageIRC.net NOTICE AUTH :*** Looking up your hostname...
:Loopy.NJ.US.VillageIRC.net NOTICE AUTH :*** Checking Ident
:Loopy.NJ.US.VillageIRC.net NOTICE AUTH :*** Found your hostname
join #simplemachines
nick Tester123
:Loopy.NJ.US.VillageIRC.net NOTICE AUTH :*** No Ident response
:Loopy.NJ.US.VillageIRC.net 451  join :Register first.
ERROR :Closing Link: 0.0.0.0 (Ping timeout: 36 seconds)
#57
PasteBin / Paste-1292038198:v:use_geshi-1...
Last post by SleePy - Dec 11, 2010, 03:29 AM
   // What are we editing anyway?
   $config_vars = array(
         // Permission...
         array('permissions', 'search_posts'),
         // Some simple settings.
         array('check', 'simpleSearch'),
         array('int', 'search_results_per_page'),
         array('int', 'search_max_results', 'subtext' => $txt['search_max_results_disable']),
      '',
         // Some limitations.
         array('int', 'search_floodcontrol_time', 'subtext' => $txt['search_floodcontrol_time_desc']),
   );

   // A custom API may need additional settings.
   db_extend('search');
   $modSettings['search_index'] = empty($modSettings['search_index']) ? 'standard' : $modSettings['search_index'];
   if (file_exists($sourcedir . '/SearchAPI-' . ucwords($modSettings['search_index']) . '.php'))
   {
      loadClassFile('SearchAPI-' . ucwords($modSettings['search_index']) . '.php');

      $search_class_name = $modSettings['search_index'] . '_search';
      $searchAPI = new $search_class_name();      

      if (method_exists($searchAPI, 'searchSettings'))
         $config_vars .= $searchAPI->searchAPI();
   }


   if ($return_config)
      return $config_vars;
#58
PasteBin / Paste-1291337652:v:use_geshi-1...
Last post by SleePy - Dec 03, 2010, 12:54 AM
Server Software:        nginx
Server Hostname:        *******
Server Port:            80

Document Path:          /
Document Length:        18047 bytes

Concurrency Level:      20
Time taken for tests:   583.669 seconds
Complete requests:      10000
Failed requests:        8400
   (Connect: 0, Receive: 0, Length: 8400, Exceptions: 0)
Write errors:           0
Total transferred:      184384323 bytes
HTML transferred:       180532398 bytes
Requests per second:    17.13 [#/sec] (mean)
Time per request:       1167.339 [ms] (mean)
Time per request:       58.367 [ms] (mean, across all concurrent requests)
Transfer rate:          308.50 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       70  276 136.2    271    3285
Processing:   566  890 210.9    866    4238
Waiting:      105  293 118.0    290    3326
Total:        833 1166 241.1   1128    4491

Percentage of the requests served within a certain time (ms)
  50%   1128
  66%   1149
  75%   1168
  80%   1184
  90%   1232
  95%   1283
  98%   1356
  99%   1535
 100%   4491 (longest request)
#59
General Discussion / Smell Like A Monster
Last post by Oldiesmann - Oct 18, 2010, 04:17 AM
Sesame Street's answer to the Old Spice "The Man Your Man Could Smell Like" ad...

http://www.youtube.com/watch?v=zkd5dJIVjgM
#60
The test zone / Hi
Last post by Oldiesmann - Oct 18, 2010, 04:13 AM
bold
italic
underline
strikeout
preformatted

left
center
right
Courier
Arial
Arial Black
Impact
Verdana
Times New Roman
Georgia
Andale Mono
Trebuchet MS
Comic Sans MS
8pt
10pt
12pt
14pt
18pt
24pt
36pt
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
Lime Green
White

Archie Comics Fan Forum
Spam Me!
local FTP
Glow
Shadow
I like to move it move it!superscript
subscript
teletype
table cell
<?php echo 'Hello, world!'; ?>

Quote from: KilroyI was here.
  • Item
  • Another Item
  • 1
  • 2