Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • osian/sucs-site
  • kais58/sucs-site
  • imranh/sucs-site
  • foshjedi2004/sucs-site
  • gigosaurus/sucs-site
  • matstn/sucs-site
  • ripp_/sucs-site
  • eggnog/sucs-site
  • sucssite/sucs-site
  • elbows/sucs-site
  • realitykiller/sucs-site
  • crox/sucs-site
  • vectre/sucs-site
  • welshbyte/sucs-site
  • paperclipman/sucs-site
15 results
Show changes
Showing
with 0 additions and 1676 deletions
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>
\ No newline at end of file
lib/punbb/img/smilies/lol.png

538 B

lib/punbb/img/smilies/mad.png

560 B

lib/punbb/img/smilies/neutral.png

565 B

lib/punbb/img/smilies/roll.png

559 B

lib/punbb/img/smilies/sad.png

568 B

lib/punbb/img/smilies/smile.png

598 B

lib/punbb/img/smilies/tongue.png

563 B

lib/punbb/img/smilies/wink.png

642 B

lib/punbb/img/smilies/yikes.png

554 B

<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
pun_exit();
//
// If we are running pre PHP 4.2.0, we add our own implementation of var_export
//
if (!function_exists('var_export'))
{
function var_export()
{
$args = func_get_args();
$indent = (isset($args[2])) ? $args[2] : '';
if (is_array($args[0]))
{
$output = 'array ('."\n";
foreach ($args[0] as $k => $v)
{
if (is_numeric($k))
$output .= $indent.' '.$k.' => ';
else
$output .= $indent.' \''.str_replace('\'', '\\\'', str_replace('\\', '\\\\', $k)).'\' => ';
if (is_array($v))
$output .= var_export($v, true, $indent.' ');
else
{
if (gettype($v) != 'string' && !empty($v))
$output .= $v.','."\n";
else
$output .= '\''.str_replace('\'', '\\\'', str_replace('\\', '\\\\', $v)).'\','."\n";
}
}
$output .= ($indent != '') ? $indent.'),'."\n" : ')';
}
else
$output = $args[0];
if ($args[1] == true)
return $output;
else
echo $output;
}
}
//
// Generate the config cache PHP script
//
function generate_config_cache()
{
global $db;
// Get the forum config from the DB
$result = $db->query('SELECT * FROM '.$db->prefix.'config', true) or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());
while ($cur_config_item = $db->fetch_row($result))
$output[$cur_config_item[0]] = $cur_config_item[1];
// Output config as PHP code
$fh = @fopen(PUN_ROOT.'cache/cache_config.php', 'wb');
if (!$fh)
error('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
fwrite($fh, '<?php'."\n\n".'define(\'PUN_CONFIG_LOADED\', 1);'."\n\n".'$pun_config = '.var_export($output, true).';'."\n\n".'?>');
fclose($fh);
}
//
// Generate the bans cache PHP script
//
function generate_bans_cache()
{
global $db;
// Get the ban list from the DB
$result = $db->query('SELECT * FROM '.$db->prefix.'bans', true) or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error());
$output = array();
while ($cur_ban = $db->fetch_assoc($result))
$output[] = $cur_ban;
// Output ban list as PHP code
$fh = @fopen(PUN_ROOT.'cache/cache_bans.php', 'wb');
if (!$fh)
error('Unable to write bans cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
fwrite($fh, '<?php'."\n\n".'define(\'PUN_BANS_LOADED\', 1);'."\n\n".'$pun_bans = '.var_export($output, true).';'."\n\n".'?>');
fclose($fh);
}
//
// Generate the ranks cache PHP script
//
function generate_ranks_cache()
{
global $db;
// Get the rank list from the DB
$result = $db->query('SELECT * FROM '.$db->prefix.'ranks ORDER BY min_posts', true) or error('Unable to fetch rank list', __FILE__, __LINE__, $db->error());
$output = array();
while ($cur_rank = $db->fetch_assoc($result))
$output[] = $cur_rank;
// Output ranks list as PHP code
$fh = @fopen(PUN_ROOT.'cache/cache_ranks.php', 'wb');
if (!$fh)
error('Unable to write ranks cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
fwrite($fh, '<?php'."\n\n".'define(\'PUN_RANKS_LOADED\', 1);'."\n\n".'$pun_ranks = '.var_export($output, true).';'."\n\n".'?>');
fclose($fh);
}
//
// Generate quickjump cache PHP scripts
//
function generate_quickjump_cache($group_id = false)
{
global $db, $lang_common, $pun_user;
// If a group_id was supplied, we generate the quickjump cache for that group only
if ($group_id !== false)
$groups[0] = $group_id;
else
{
// A group_id was now supplied, so we generate the quickjump cache for all groups
$result = $db->query('SELECT g_id FROM '.$db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
$num_groups = $db->num_rows($result);
for ($i = 0; $i < $num_groups; ++$i)
$groups[] = $db->result($result, $i);
}
// Loop through the groups in $groups and output the cache for each of them
while (list(, $group_id) = @each($groups))
{
// Output quickjump as PHP code
$fh = @fopen(PUN_ROOT.'cache/cache_quickjump_'.$group_id.'.php', 'wb');
if (!$fh)
error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
$output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>';
$output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><?php echo $lang_common[\'Jump to\'] ?>'."\n\n\t\t\t\t\t".'<br /><select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n";
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$group_id.') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
$cur_category = 0;
while ($cur_forum = $db->fetch_assoc($result))
{
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
{
if ($cur_category)
$output .= "\t\t\t\t\t\t".'</optgroup>'."\n";
$output .= "\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($cur_forum['cat_name']).'">'."\n";
$cur_category = $cur_forum['cid'];
}
$redirect_tag = ($cur_forum['redirect_url'] != '') ? ' &gt;&gt;&gt;' : '';
$output .= "\t\t\t\t\t\t\t".'<option value="'.$cur_forum['fid'].'"<?php echo ($forum_id == '.$cur_forum['fid'].') ? \' selected="selected"\' : \'\' ?>>'.pun_htmlspecialchars($cur_forum['forum_name']).$redirect_tag.'</option>'."\n";
}
$output .= "\t\t\t\t\t".'</optgroup>'."\n\t\t\t\t\t".'</select>'."\n\t\t\t\t\t".'<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />'."\n\t\t\t\t\t".'</label></div>'."\n\t\t\t\t".'</form>'."\n";
fwrite($fh, $output);
fclose($fh);
}
}
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Enable DEBUG mode by removing // from the following line
//define('PUN_DEBUG', 1);
// This displays all executed queries in the page footer.
// DO NOT enable this in a production environment!
//define('PUN_SHOW_QUERIES', 1);
if (!defined('PUN_ROOT'))
pun_exit('The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.');
// Load the functions script
require PUN_ROOT.'include/functions.php';
// Reverse the effect of register_globals
unregister_globals();
@include PUN_ROOT.'config.php';
// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
pun_exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run <a href="install.php">install.php</a> to install PunBB first.');
// Record the start time (will be used to calculate the generation time for the page)
list($usec, $sec) = explode(' ', microtime());
$pun_start = ((float)$usec + (float)$sec);
// Make sure PHP reports all errors except E_NOTICE. PunBB supports E_ALL, but a lot of scripts it may interact with, do not.
error_reporting(E_ALL ^ E_NOTICE);
// Turn off magic_quotes_runtime
set_magic_quotes_runtime(0);
// Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled)
if (get_magic_quotes_gpc())
{
function stripslashes_array($array)
{
return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
}
$_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
$_COOKIE = stripslashes_array($_COOKIE);
}
// Seed the random number generator (PHP <4.2.0 only)
if (version_compare(PHP_VERSION, '4.2.0', '<'))
mt_srand((double)microtime()*1000000);
// If a cookie name is not specified in config.php, we use the default (punbb_cookie)
if (empty($cookie_name))
$cookie_name = 'punbb_cookie';
// Define a few commonly used constants
define('PUN_UNVERIFIED', 32000);
define('PUN_ADMIN', 1);
define('PUN_MOD', 2);
define('PUN_GUEST', 3);
define('PUN_MEMBER', 4);
// Load DB abstraction layer and connect
require PUN_ROOT.'include/dblayer/common_db.php';
// Start a transaction
$db->start_transaction();
// Load cached config
@include PUN_ROOT.'cache/cache_config.php';
if (!defined('PUN_CONFIG_LOADED'))
{
require PUN_ROOT.'include/cache.php';
generate_config_cache();
require PUN_ROOT.'cache/cache_config.php';
}
// Enable output buffering
if (!defined('PUN_DISABLE_BUFFERING'))
{
// For some very odd reason, "Norton Internet Security" unsets this
$_SERVER['HTTP_ACCEPT_ENCODING'] = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : '';
// Should we use gzip output compression?
if ($pun_config['o_gzip'] && extension_loaded('zlib') && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false || strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') !== false))
ob_start('ob_gzhandler');
else
ob_start();
}
// Check/update/set cookie and fetch user info
$pun_user = array();
//check_cookie($pun_user);
auth_user($pun_user);
// Attempt to load the common language file
@include PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
if (!isset($lang_common))
pun_exit('There is no valid language pack \''.pun_htmlspecialchars($pun_user['language']).'\' installed. Please reinstall a language of that name.');
// Check if we are to display a maintenance message
if ($pun_config['o_maintenance'] && $pun_user['g_id'] > PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT'))
maintenance_message();
// Load cached bans
@include PUN_ROOT.'cache/cache_bans.php';
if (!defined('PUN_BANS_LOADED'))
{
require_once PUN_ROOT.'include/cache.php';
generate_bans_cache();
require PUN_ROOT.'cache/cache_bans.php';
}
// Check if current user is banned
check_bans();
// Update online list
update_users_online();
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
//
// Display the admin navigation menu
//
function generate_admin_menu($page = '')
{
global $pun_config, $pun_user;
$is_admin = $pun_user['g_id'] == PUN_ADMIN ? true : false;
?>
<div id="adminconsole" class="block2col">
<div id="adminmenu" class="blockmenu">
<h2><span><?php echo ($is_admin) ? 'Admin' : 'Moderator' ?> menu</span></h2>
<div class="box">
<div class="inbox">
<ul>
<li<?php if ($page == 'index') echo ' class="isactive"'; ?>><a href="admin_index.php">Index</a></li>
<?php if ($is_admin): ?> <li<?php if ($page == 'categories') echo ' class="isactive"'; ?>><a href="admin_categories.php">Categories</a></li>
<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'forums') echo ' class="isactive"'; ?>><a href="admin_forums.php">Forums</a></li>
<?php endif; ?> <li<?php if ($page == 'users') echo ' class="isactive"'; ?>><a href="admin_users.php">Users</a></li>
<?php if ($is_admin): ?> <li<?php if ($page == 'groups') echo ' class="isactive"'; ?>><a href="admin_groups.php">User groups</a></li>
<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'options') echo ' class="isactive"'; ?>><a href="admin_options.php">Options</a></li>
<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'permissions') echo ' class="isactive"'; ?>><a href="admin_permissions.php">Permissions</a></li>
<?php endif; ?> <li<?php if ($page == 'censoring') echo ' class="isactive"'; ?>><a href="admin_censoring.php">Censoring</a></li>
<?php if ($is_admin): ?> <li<?php if ($page == 'ranks') echo ' class="isactive"'; ?>><a href="admin_ranks.php">Ranks</a></li>
<?php endif; ?><?php if ($is_admin || $pun_config['p_mod_ban_users'] == '1'): ?> <li<?php if ($page == 'bans') echo ' class="isactive"'; ?>><a href="admin_bans.php">Bans</a></li>
<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'prune') echo ' class="isactive"'; ?>><a href="admin_prune.php">Prune</a></li>
<?php endif; ?><?php if ($is_admin): ?> <li<?php if ($page == 'maintenance') echo ' class="isactive"'; ?>><a href="admin_maintenance.php">Maintenance</a></li>
<?php endif; ?> <li<?php if ($page == 'reports') echo ' class="isactive"'; ?>><a href="admin_reports.php">Reports</a></li>
</ul>
</div>
</div>
<?php
// See if there are any plugins
$plugins = array();
$d = dir(PUN_ROOT.'plugins');
while (($entry = $d->read()) !== false)
{
$prefix = substr($entry, 0, strpos($entry, '_'));
$suffix = substr($entry, strlen($entry) - 4);
if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP'))))
$plugins[] = array(substr(substr($entry, strpos($entry, '_') + 1), 0, -4), $entry);
}
$d->close();
// Did we find any plugins?
if (!empty($plugins))
{
?>
<h2 class="block2"><span>Plugins</span></h2>
<div class="box">
<div class="inbox">
<ul>
<?php
while (list(, $cur_plugin) = @each($plugins))
echo "\t\t\t\t\t".'<li'.(($page == $cur_plugin[1]) ? ' class="isactive"' : '').'><a href="admin_loader.php?plugin='.$cur_plugin[1].'">'.str_replace('_', ' ', $cur_plugin[0]).'</a></li>'."\n";
?>
</ul>
</div>
</div>
<?php
}
?>
</div>
<?php
}
//
// Delete topics from $forum_id that are "older than" $prune_date (if $prune_sticky is 1, sticky topics will also be deleted)
//
function prune($forum_id, $prune_sticky, $prune_date)
{
global $db;
$extra_sql = ($prune_date != -1) ? ' AND last_post<'.$prune_date : '';
if (!$prune_sticky)
$extra_sql .= ' AND sticky=\'0\'';
// Fetch topics to prune
$result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.$extra_sql, true) or error('Unable to fetch topics', __FILE__, __LINE__, $db->error());
$topic_ids = '';
while ($row = $db->fetch_row($result))
$topic_ids .= (($topic_ids != '') ? ',' : '').$row[0];
if ($topic_ids != '')
{
// Fetch posts to prune
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topic_ids.')', true) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
$post_ids = '';
while ($row = $db->fetch_row($result))
$post_ids .= (($post_ids != '') ? ',' : '').$row[0];
if ($post_ids != '')
{
// Delete topics
$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $db->error());
// Delete subscriptions
$db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error());
// Delete posts
$db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error());
// We removed a bunch of posts, so now we have to update the search index
require_once PUN_ROOT.'include/search_idx.php';
strip_search_index($post_ids);
}
}
}
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
//
// Return current timestamp (with microseconds) as a float (used in dblayer)
//
if (defined('PUN_SHOW_QUERIES'))
{
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
}
// Load the appropriate DB layer class
switch ($db_type)
{
case 'mysql':
require PUN_ROOT.'include/dblayer/mysql.php';
break;
case 'mysqli':
require PUN_ROOT.'include/dblayer/mysqli.php';
break;
case 'pgsql':
require PUN_ROOT.'include/dblayer/pgsql.php';
break;
case 'sqlite':
require PUN_ROOT.'include/dblayer/sqlite.php';
break;
default:
error('\''.$db_type.'\' is not a valid database type. Please check settings in config.php.', __FILE__, __LINE__);
break;
}
// Create the database adapter object (and open/connect to/select db)
$db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect);
<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>
\ No newline at end of file
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure we have built in support for MySQL
if (!function_exists('mysql_connect'))
exit('This PHP environment doesn\'t have MySQL support built in. MySQL support is required if you want to use a MySQL database to run this forum. Consult the PHP documentation for further assistance.');
class DBLayer
{
var $prefix;
var $link_id;
var $query_result;
var $saved_queries = array();
var $num_queries = 0;
function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
{
$this->prefix = $db_prefix;
if ($p_connect)
$this->link_id = @mysql_pconnect($db_host, $db_username, $db_password);
else
$this->link_id = @mysql_connect($db_host, $db_username, $db_password);
if ($this->link_id)
{
if (@mysql_select_db($db_name, $this->link_id))
return $this->link_id;
else
error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}
else
error('Unable to connect to MySQL server. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
}
function start_transaction()
{
return;
}
function end_transaction()
{
return;
}
function query($sql, $unbuffered = false)
{
if (defined('PUN_SHOW_QUERIES'))
$q_start = get_microtime();
if ($unbuffered)
$this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
else
$this->query_result = @mysql_query($sql, $this->link_id);
if ($this->query_result)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
++$this->num_queries;
return $this->query_result;
}
else
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, 0);
return false;
}
}
function result($query_id = 0, $row = 0)
{
return ($query_id) ? @mysql_result($query_id, $row) : false;
}
function fetch_assoc($query_id = 0)
{
return ($query_id) ? @mysql_fetch_assoc($query_id) : false;
}
function fetch_row($query_id = 0)
{
return ($query_id) ? @mysql_fetch_row($query_id) : false;
}
function num_rows($query_id = 0)
{
return ($query_id) ? @mysql_num_rows($query_id) : false;
}
function affected_rows()
{
return ($this->link_id) ? @mysql_affected_rows($this->link_id) : false;
}
function insert_id()
{
return ($this->link_id) ? @mysql_insert_id($this->link_id) : false;
}
function get_num_queries()
{
return $this->num_queries;
}
function get_saved_queries()
{
return $this->saved_queries;
}
function free_result($query_id = false)
{
return ($query_id) ? @mysql_free_result($query_id) : false;
}
function escape($str)
{
if (is_array($str))
return '';
else if (function_exists('mysql_real_escape_string'))
return mysql_real_escape_string($str, $this->link_id);
else
return mysql_escape_string($str);
}
function error()
{
$result['error_sql'] = @current(@end($this->saved_queries));
$result['error_no'] = @mysql_errno($this->link_id);
$result['error_msg'] = @mysql_error($this->link_id);
return $result;
}
function close()
{
if ($this->link_id)
{
if ($this->query_result)
@mysql_free_result($this->query_result);
return @mysql_close($this->link_id);
}
else
return false;
}
}
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure we have built in support for MySQL
if (!function_exists('mysqli_connect'))
exit('This PHP environment doesn\'t have Improved MySQL (mysqli) support built in. Improved MySQL support is required if you want to use a MySQL 4.1 (or later) database to run this forum. Consult the PHP documentation for further assistance.');
class DBLayer
{
var $prefix;
var $link_id;
var $query_result;
var $saved_queries = array();
var $num_queries = 0;
function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $foo)
{
$this->prefix = $db_prefix;
// Was a custom port supplied with $db_host?
if (strpos($db_host, ':') !== false)
list($db_host, $db_port) = explode(':', $db_host);
if (isset($db_port))
$this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name, $db_port);
else
$this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name);
if (!$this->link_id)
error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__);
}
function start_transaction()
{
return;
}
function end_transaction()
{
return;
}
function query($sql, $unbuffered = false)
{
if (defined('PUN_SHOW_QUERIES'))
$q_start = get_microtime();
$this->query_result = @mysqli_query($this->link_id, $sql);
if ($this->query_result)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
++$this->num_queries;
return $this->query_result;
}
else
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, 0);
return false;
}
}
function result($query_id = 0, $row = 0)
{
if ($query_id)
{
if ($row)
@mysqli_data_seek($query_id, $row);
$cur_row = @mysqli_fetch_row($query_id);
return $cur_row[0];
}
else
return false;
}
function fetch_assoc($query_id = 0)
{
return ($query_id) ? @mysqli_fetch_assoc($query_id) : false;
}
function fetch_row($query_id = 0)
{
return ($query_id) ? @mysqli_fetch_row($query_id) : false;
}
function num_rows($query_id = 0)
{
return ($query_id) ? @mysqli_num_rows($query_id) : false;
}
function affected_rows()
{
return ($this->link_id) ? @mysqli_affected_rows($this->link_id) : false;
}
function insert_id()
{
return ($this->link_id) ? @mysqli_insert_id($this->link_id) : false;
}
function get_num_queries()
{
return $this->num_queries;
}
function get_saved_queries()
{
return $this->saved_queries;
}
function free_result($query_id = false)
{
return ($query_id) ? @mysqli_free_result($query_id) : false;
}
function escape($str)
{
return is_array($str) ? '' : mysqli_real_escape_string($this->link_id, $str);
}
function error()
{
$result['error_sql'] = @current(@end($this->saved_queries));
$result['error_no'] = @mysqli_errno($this->link_id);
$result['error_msg'] = @mysqli_error($this->link_id);
return $result;
}
function close()
{
if ($this->link_id)
{
if ($this->query_result)
@mysqli_free_result($this->query_result);
return @mysqli_close($this->link_id);
}
else
return false;
}
}
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure we have built in support for PostgreSQL
if (!function_exists('pg_connect'))
pun_exit('This PHP environment doesn\'t have PostgreSQL support built in. PostgreSQL support is required if you want to use a PostgreSQL database to run this forum. Consult the PHP documentation for further assistance.');
class DBLayer
{
var $prefix;
var $link_id;
var $query_result;
var $last_query_text = array();
var $in_transaction = 0;
var $saved_queries = array();
var $num_queries = 0;
var $error_no = false;
var $error_msg = 'Unknown';
function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
{
$this->prefix = $db_prefix;
if ($db_host != '')
{
if (strpos($db_host, ':') !== false)
{
list($db_host, $dbport) = explode(':', $db_host);
$connect_str[] = 'host='.$db_host.' port='.$dbport;
}
else
{
if ($db_host != 'localhost')
$connect_str[] = 'host='.$db_host;
}
}
if ($db_name)
$connect_str[] = 'dbname='.$db_name;
if ($db_username != '')
$connect_str[] = 'user='.$db_username;
if ($db_password != '')
$connect_str[] = 'password='.$db_password;
if ($p_connect)
$this->link_id = @pg_pconnect(implode(' ', $connect_str));
else
$this->link_id = @pg_connect(implode(' ', $connect_str));
if (!$this->link_id)
error('Unable to connect to PostgreSQL server', __FILE__, __LINE__);
else
return $this->link_id;
}
function start_transaction()
{
++$this->in_transaction;
return (@pg_query($this->link_id, 'BEGIN')) ? true : false;
}
function end_transaction()
{
--$this->in_transaction;
if (@pg_query($this->link_id, 'COMMIT'))
return true;
else
{
@pg_query($this->link_id, 'ROLLBACK');
return false;
}
}
function query($sql, $unbuffered = false) // $unbuffered is ignored since there is no pgsql_unbuffered_query()
{
if (strrpos($sql, 'LIMIT') !== false)
$sql = preg_replace('#LIMIT ([0-9]+),([ 0-9]+)#', 'LIMIT \\2 OFFSET \\1', $sql);
if (defined('PUN_SHOW_QUERIES'))
$q_start = get_microtime();
@pg_send_query($this->link_id, $sql);
$this->query_result = @pg_get_result($this->link_id);
if (pg_result_status($this->query_result) != PGSQL_FATAL_ERROR)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
++$this->num_queries;
$this->last_query_text[$this->query_result] = $sql;
return $this->query_result;
}
else
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, 0);
$this->error_msg = @pg_result_error($this->query_result);
if ($this->in_transaction)
@pg_query($this->link_id, 'ROLLBACK');
--$this->in_transaction;
return false;
}
}
function result($query_id = 0, $row = 0)
{
return ($query_id) ? @pg_fetch_result($query_id, $row, 0) : false;
}
function fetch_assoc($query_id = 0)
{
return ($query_id) ? @pg_fetch_assoc($query_id) : false;
}
function fetch_row($query_id = 0)
{
return ($query_id) ? @pg_fetch_row($query_id) : false;
}
function num_rows($query_id = 0)
{
return ($query_id) ? @pg_num_rows($query_id) : false;
}
function affected_rows()
{
return ($this->query_result) ? @pg_affected_rows($this->query_result) : false;
}
function insert_id()
{
$query_id = $this->query_result;
if ($query_id && $this->last_query_text[$query_id] != '')
{
if (preg_match('/^INSERT INTO ([a-z0-9\_\-]+)/is', $this->last_query_text[$query_id], $table_name))
{
// Hack (don't ask)
if (substr($table_name[1], -6) == 'groups')
$table_name[1] .= '_g';
$temp_q_id = @pg_query($this->link_id, 'SELECT currval(\''.$table_name[1].'_id_seq\')');
return ($temp_q_id) ? intval(@pg_fetch_result($temp_q_id, 0)) : false;
}
}
return false;
}
function get_num_queries()
{
return $this->num_queries;
}
function get_saved_queries()
{
return $this->saved_queries;
}
function free_result($query_id = false)
{
if (!$query_id)
$query_id = $this->query_result;
return ($query_id) ? @pg_free_result($query_id) : false;
}
function escape($str)
{
return is_array($str) ? '' : pg_escape_string($str);
}
function error()
{
$result['error_sql'] = @current(@end($this->saved_queries));
$result['error_no'] = false;
/*
if (!empty($this->query_result))
{
$result['error_msg'] = trim(@pg_result_error($this->query_result));
if ($result['error_msg'] != '')
return $result;
}
$result['error_msg'] = (!empty($this->link_id)) ? trim(@pg_last_error($this->link_id)) : trim(@pg_last_error());
*/
$result['error_msg'] = $this->error_msg;
return $result;
}
function close()
{
if ($this->link_id)
{
if ($this->in_transaction)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array('COMMIT', 0);
@pg_query($this->link_id, 'COMMIT');
}
if ($this->query_result)
@pg_free_result($this->query_result);
return @pg_close($this->link_id);
}
else
return false;
}
}
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure we have built in support for SQLite
if (!function_exists('sqlite_open'))
exit('This PHP environment doesn\'t have SQLite support built in. SQLite support is required if you want to use a SQLite database to run this forum. Consult the PHP documentation for further assistance.');
class DBLayer
{
var $prefix;
var $link_id;
var $query_result;
var $in_transaction = 0;
var $saved_queries = array();
var $num_queries = 0;
var $error_no = false;
var $error_msg = 'Unknown';
function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
{
// Prepend $db_name with the path to the forum root directory
$db_name = PUN_ROOT.$db_name;
$this->prefix = $db_prefix;
if (!file_exists($db_name))
{
@touch($db_name);
@chmod($db_name, 0666);
if (!file_exists($db_name))
error('Unable to create new database \''.$db_name.'\'. Permission denied', __FILE__, __LINE__);
}
if (!is_readable($db_name))
error('Unable to open database \''.$db_name.'\' for reading. Permission denied', __FILE__, __LINE__);
if (!is_writable($db_name))
error('Unable to open database \''.$db_name.'\' for writing. Permission denied', __FILE__, __LINE__);
if ($p_connect)
$this->link_id = @sqlite_popen($db_name, 0666, $sqlite_error);
else
$this->link_id = @sqlite_open($db_name, 0666, $sqlite_error);
if (!$this->link_id)
error('Unable to open database \''.$db_name.'\'. SQLite reported: '.$sqlite_error, __FILE__, __LINE__);
else
return $this->link_id;
}
function start_transaction()
{
++$this->in_transaction;
return (@sqlite_query($this->link_id, 'BEGIN')) ? true : false;
}
function end_transaction()
{
--$this->in_transaction;
if (@sqlite_query($this->link_id, 'COMMIT'))
return true;
else
{
@sqlite_query($this->link_id, 'ROLLBACK');
return false;
}
}
function query($sql, $unbuffered = false)
{
if (defined('PUN_SHOW_QUERIES'))
$q_start = get_microtime();
if ($unbuffered)
$this->query_result = @sqlite_unbuffered_query($this->link_id, $sql);
else
$this->query_result = @sqlite_query($this->link_id, $sql);
if ($this->query_result)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
++$this->num_queries;
return $this->query_result;
}
else
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array($sql, 0);
$this->error_no = @sqlite_last_error($this->link_id);
$this->error_msg = @sqlite_error_string($this->error_no);
if ($this->in_transaction)
@sqlite_query($this->link_id, 'ROLLBACK');
--$this->in_transaction;
return false;
}
}
function result($query_id = 0, $row = 0)
{
if ($query_id)
{
if ($row != 0)
@sqlite_seek($query_id, $row);
return @current(@sqlite_current($query_id));
}
else
return false;
}
function fetch_assoc($query_id = 0)
{
if ($query_id)
{
$cur_row = @sqlite_fetch_array($query_id, SQLITE_ASSOC);
if ($cur_row)
{
// Horrible hack to get rid of table names and table aliases from the array keys
while (list($key, $value) = @each($cur_row))
{
$dot_spot = strpos($key, '.');
if ($dot_spot !== false)
{
unset($cur_row[$key]);
$key = substr($key, $dot_spot+1);
$cur_row[$key] = $value;
}
}
}
return $cur_row;
}
else
return false;
}
function fetch_row($query_id = 0)
{
return ($query_id) ? @sqlite_fetch_array($query_id, SQLITE_NUM) : false;
}
function num_rows($query_id = 0)
{
return ($query_id) ? @sqlite_num_rows($query_id) : false;
}
function affected_rows()
{
return ($this->query_result) ? @sqlite_changes($this->query_result) : false;
}
function insert_id()
{
return ($this->link_id) ? @sqlite_last_insert_rowid($this->link_id) : false;
}
function get_num_queries()
{
return $this->num_queries;
}
function get_saved_queries()
{
return $this->saved_queries;
}
function free_result($query_id = false)
{
return true;
}
function escape($str)
{
return is_array($str) ? '' : sqlite_escape_string($str);
}
function error()
{
$result['error_sql'] = @current(@end($this->saved_queries));
$result['error_no'] = $this->error_no;
$result['error_msg'] = $this->error_msg;
return $result;
}
function close()
{
if ($this->link_id)
{
if ($this->in_transaction)
{
if (defined('PUN_SHOW_QUERIES'))
$this->saved_queries[] = array('COMMIT', 0);
@sqlite_query($this->link_id, 'COMMIT');
}
return @sqlite_close($this->link_id);
}
else
return false;
}
}
<?php
/***********************************************************************
Copyright (C) 2002-2008 PunBB
Partially based on code copyright (C) 2008 FluxBB.org
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
pun_exit();
//
// Validate an e-mail address
//
function is_valid_email($email)
{
if (strlen($email) > 50)
return false;
return preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);
}
//
// Check if $email is banned
//
function is_banned_email($email)
{
global $db, $pun_bans;
foreach ($pun_bans as $cur_ban)
{
if ($cur_ban['email'] != '' &&
($email == $cur_ban['email'] ||
(strpos($cur_ban['email'], '@') === false && stristr($email, '@'.$cur_ban['email']))))
return true;
}
return false;
}
//
// Wrapper for PHP's mail()
//
function pun_mail($to, $subject, $message, $from = '')
{
global $pun_config, $lang_common;
// Default sender/return address
if (!$from)
$from = '"'.str_replace('"', '', $pun_config['o_board_title'].' '.$lang_common['Mailer']).'" <'.$pun_config['o_webmaster_email'].'>';
// Do a little spring cleaning
$to = trim(preg_replace('#[\n\r]+#s', '', $to));
$subject = trim(preg_replace('#[\n\r]+#s', '', $subject));
$from = trim(preg_replace('#[\n\r:]+#s', '', $from));
$headers = 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\r\n".'X-Mailer: PunBB Mailer';
// Make sure all linebreaks are CRLF in message (and strip out any NULL bytes)
$message = str_replace(array("\n", "\0"), array("\r\n", ''), pun_linebreaks($message));
if ($pun_config['o_smtp_host'] != '')
smtp_mail($to, $subject, $message, $headers);
else
{
// Change the linebreaks used in the headers according to OS
if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC')
$headers = str_replace("\r\n", "\r", $headers);
else if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
$headers = str_replace("\r\n", "\n", $headers);
mail($to, $subject, $message, $headers);
}
}
//
// This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com).
// They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards.
//
function server_parse($socket, $expected_response)
{
$server_response = '';
while (substr($server_response, 3, 1) != ' ')
{
if (!($server_response = fgets($socket, 256)))
error('Couldn\'t get mail server response codes. Please contact the forum administrator.', __FILE__, __LINE__);
}
if (!(substr($server_response, 0, 3) == $expected_response))
error('Unable to send e-mail. Please contact the forum administrator with the following error message reported by the SMTP server: "'.$server_response.'"', __FILE__, __LINE__);
}
//
// This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com).
// They deserve all the credit for writing it. I made small modifications for it to suit PunBB and it's coding standards.
//
function smtp_mail($to, $subject, $message, $headers = '')
{
global $pun_config;
$recipients = explode(',', $to);
// Sanitize the message
$message = str_replace("\r\n.", "\r\n..", $message);
$message = (substr($message, 0, 1) == '.' ? '.'.$message : $message);
// Are we using port 25 or a custom port?
if (strpos($pun_config['o_smtp_host'], ':') !== false)
list($smtp_host, $smtp_port) = explode(':', $pun_config['o_smtp_host']);
else
{
$smtp_host = $pun_config['o_smtp_host'];
$smtp_port = 25;
}
if (!($socket = fsockopen($smtp_host, $smtp_port, $errno, $errstr, 15)))
error('Could not connect to smtp host "'.$pun_config['o_smtp_host'].'" ('.$errno.') ('.$errstr.')', __FILE__, __LINE__);
server_parse($socket, '220');
if ($pun_config['o_smtp_user'] != '' && $pun_config['o_smtp_pass'] != '')
{
fwrite($socket, 'EHLO '.$smtp_host."\r\n");
server_parse($socket, '250');
fwrite($socket, 'AUTH LOGIN'."\r\n");
server_parse($socket, '334');
fwrite($socket, base64_encode($pun_config['o_smtp_user'])."\r\n");
server_parse($socket, '334');
fwrite($socket, base64_encode($pun_config['o_smtp_pass'])."\r\n");
server_parse($socket, '235');
}
else
{
fwrite($socket, 'HELO '.$smtp_host."\r\n");
server_parse($socket, '250');
}
fwrite($socket, 'MAIL FROM: <'.$pun_config['o_webmaster_email'].'>'."\r\n");
server_parse($socket, '250');
$to_header = 'To: ';
@reset($recipients);
while (list(, $email) = @each($recipients))
{
fwrite($socket, 'RCPT TO: <'.$email.'>'."\r\n");
server_parse($socket, '250');
$to_header .= '<'.$email.'>, ';
}
fwrite($socket, 'DATA'."\r\n");
server_parse($socket, '354');
fwrite($socket, 'Subject: '.$subject."\r\n".$to_header."\r\n".$headers."\r\n\r\n".$message."\r\n");
fwrite($socket, '.'."\r\n");
server_parse($socket, '250');
fwrite($socket, 'QUIT'."\r\n");
fclose($socket);
return true;
}