/***************************************************************************
Jupiter Content System @ Jupiterportal.com
Copyright (C) 2005 Cosmin Flavius (highstrike@gmail.com)
This program 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.
More Info About The Licence At http://www.gnu.org/copyleft/gpl.html
****************************************************************************/
ini_set("zlib.output_compression","on");
ini_set("zlib.output_compression_level","9");
//-----------------------------------------------------------------
// Start up the script
//-----------------------------------------------------------------
ob_start();
$PHP_SELF = $_SERVER['PHP_SELF'];
require "includes/config.php";
$siteurl = "http://www.moddz.com/";
$feedfilename = "feed.rss";
//You will also need to go to line 357, and change $smilies_path to reflect your site url
if(@!mysql_connect($database_server,$database_username,$database_password))
{
?>
Couldn't establish link. Reason: = mysql_error() ?>
exit;
}
//-----------------------------------------------------------------
// Load WAMIS conformant module - DB
//-----------------------------------------------------------------
require_once("includes/functions_db.php");
DB_initialize();
//-----------------------------------------------------------------
// Database Check
//-----------------------------------------------------------------
if(!$db->connect())
{
?>
Error, the database "= $database_name ?>" dosen't exist.
exit;
}
//-----------------------------------------------------------------
// Tabels Check
//-----------------------------------------------------------------
if(!$config_db = $db->query("SELECT * FROM config"))
{
?>
Error, the database "= $database_name ?>" is empty.
exit;
}
//-----------------------------------------------------------------
// Load Config + Misc
//-----------------------------------------------------------------
while ($config_item = mysql_fetch_row($config_db)) $config[$config_item[0]] = $config_item[1];
$misc_db = $db->query("SELECT * FROM misc");
while ($misc_item = mysql_fetch_row($misc_db)) $misc[$misc_item[0]] = $misc_item[1];
//-----------------------------------------------------------------
// RSS Functions
//-----------------------------------------------------------------
////////////////////////////////////////////////////////
// Description: Notice fix
if(!isset($a)) $a = NULL; // Action fix
if(!isset($c)) $c = NULL; // Another Action fix
if(!isset($l)) $l = NULL; // Poll Action fix
if(!isset($d)) $d = NULL; // Data fix
if(!isset($o)) $o = NULL; // Other fix
if(!isset($q)) $q = NULL; // Another Other fix
if(!isset($k)) $k = NULL; // Another Another Other fix
if(!isset($i)) $i = NULL; // Info fix
if(!isset($p)) $p = 1; // Pagination fix
if(!isset($m)) $m = date('n'); // Calendar fix
if(!isset($action)) $action = NULL;
if(!isset($template_left)) $template_left = NULL;
if(!isset($session_id)) $session_id = session_id();
if(!isset($layout)) $layout = NULL;
if(!isset($layout2)) $layout2 = NULL;
if(!isset($template_right)) $template_right = NULL;
if(!isset($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = NULL;
if(!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
if(!isset($_SESSION['authorization'])) $_SESSION['authorization'] = 0;
////////////////////////////////////////////////////////
// Description: Autoexecute these querys
$badwords_db = $db->getTable("SELECT * FROM badwords");
$emoticons_db = $db->getTable("SELECT * FROM emoticons");
////////////////////////////////////////////////////////
// Function: jcm_linebreaks
// Description: Convert \r\n and \r to \n
function jcm_linebreaks($str){ return str_replace("\r", "\n", str_replace("\r\n", "\n", $str)); }
////////////////////////////////////////////////////////
// Function: jcm_stripslashes
// Description: Strip slashes
function jcm_stripslashes($str){ return (get_magic_quotes_gpc() == 1) ? stripslashes($str) : $str; }
////////////////////////////////////////////////////////
// Function: jcm_strlen
// Description: A more special strlen()
function jcm_strlen($str){ return strlen(preg_replace('/([0-9]+);/', '!', $str)); }
////////////////////////////////////////////////////////
// Function: jcm_htmlspecialchars
// Description: A more special htmlspecialchars()
function jcm_htmlspecialchars($str)
{
$str = preg_replace('/&(?!#[0-9]+;)/s', '&', $str);
$str = str_replace(array('<', '>', '"'), array('<', '>', '"'), $str);
return $str;
}
function paginate()
{
}
////////////////////////////////////////////////////////
// Function: split_text
// Description: Split the message into tokens
function split_text($text, $start, $end)
{
$num_spaces = 4;
$tokens = explode($start, $text);
$outside[] = $tokens[0];
$num_tokens = count($tokens);
for ($i = 1; $i < $num_tokens; ++$i)
{
$temp = explode($end, $tokens[$i]);
$inside[] = $temp[0];
$outside[] = $temp[1];
}
if ($num_spaces != 8 && $start == '[code]')
{
$spaces = str_repeat(' ', $num_spaces);
$inside = str_replace("\t", $spaces, $inside);
}
return array($inside, $outside);
}
////////////////////////////////////////////////////////
// Function: check_tag_order
// Description: Check for [code] and [quote]
function check_tag_order($text,$x)
{
// The maximum allowed quote depth
$max_depth = 3;
while (true)
{
$c_start = strpos($text, '[code]');
$c_end = strpos($text, '[/code]');
$q_start = strpos($text, '[quote]');
$q_end = strpos($text, '[/quote]');
if (preg_match('#\[quote=("|"|\'|)(.*)\\1\]#sU', $text, $matches)) $q2_start = strpos($text, $matches[0]);
else $q2_start = 65536;
if ($c_start === false) $c_start = 65536;
if ($c_end === false) $c_end = 65536;
if ($q_start === false) $q_start = 65536;
if ($q_end === false) $q_end = 65536;
if (min($c_start, $c_end, $q_start, $q_end, $q2_start) == 65536) break;
$q3_start = ($q_start < $q2_start) ? $q_start : $q2_start;
if ($q3_start < min($q_end, $c_start, $c_end))
{
$step = ($q_start < $q2_start) ? 7 : strlen($matches[0]);
$cur_index += $q3_start + $step;
if ($q_depth == $max_depth) $overflow_begin = $cur_index - $step;
++$q_depth;
$text = substr($text, $q3_start + $step);
}
else if ($q_end < min($q_start, $c_start, $c_end))
{
if ($q_depth == 0){ return $x = 1; exit; }
$q_depth--;
$cur_index += $q_end+8;
if ($q_depth == $max_depth) $overflow_end = $cur_index;
$text = substr($text, $q_end+8);
}
else if ($c_start < min($c_end, $q_start, $q_end))
{
$tmp = strpos($text, '[/code]');
if ($tmp === false){ return $x = 2; exit; }
else $text = substr($text, $tmp+7);
$cur_index += $tmp+7;
}
else if ($c_end < min($c_start, $q_start, $q_end)){ return $x = 3; exit; }
}
if ($q_depth > 0){ return $x = 4; exit; }
else if ($q_depth < 0){ return $x = 5; exit; }
if (isset($overflow_begin)) return array($overflow_begin, $overflow_end);
else return null;
}
////////////////////////////////////////////////////////
// Function: truncate_url
// Description: Takes care of url
function truncate_url($url, $link = '')
{
$full_url = $url;
if (strpos($url, 'www.') === 0) $full_url = 'http://'.$full_url;
else if (strpos($url, 'ftp.') === 0) $full_url = 'ftp://'.$full_url;
else if (strpos($url, 'http://') !== 0) $full_url = 'http://'.$full_url;
$link = ($link == '' || $link == $url) ? ((strlen($url) > 55) ? substr($url, 0 , 39).' ... '.substr($url, -10) : $url) : stripslashes($link);
return ''.$link.'';
}
////////////////////////////////////////////////////////
// Function: handle_img_tag
// Description: Takes care of the image
function handle_img_tag($url)
{
$img_tag = '';
return $img_tag;
}
////////////////////////////////////////////////////////
// Function: do_bbcode
// Description: Takes care of bbcode
function do_bbcode($message)
{
$pattern[] = '#\[b\](.*?)\[/b\]#s';
$pattern[] = '#\[i\](.*?)\[/i\]#s';
$pattern[] = '#\[u\](.*?)\[/u\]#s';
$pattern[] = '#\[font=(.*?)\](.*?)\[/font\]#s';
$pattern[] = '#\[size=(.*?)\](.*?)\[/size\]#s';
$pattern[] = '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s';
$pattern[] = '#\[left\](.*?)\[/left\]#s';
$pattern[] = '#\[center\](.*?)\[/center\]#s';
$pattern[] = '#\[right\](.*?)\[/right\]#s';
$pattern[] = '#\[list\]#s';
$pattern[] = '#\[/list\]#s';
$pattern[] = '#\[\*\]#s';
$pattern[] = '#\[image=((ht|f)tps?://)([^\s<"]*?)\\]#e';
$pattern[] = '#\[url\](.*?)\[/url\]#e';
$pattern[] = '#\[url=(.*?)\](.*?)\[/url\]#e';
$pattern[] = '#\[email\](.*?)\[/email\]#';
$pattern[] = '#\[email=(.*?)\](.*?)\[/email\]#';
$replace[] = '$1';
$replace[] = '$1;';
$replace[] = '$1;';
$replace[] = '$2';
$replace[] = '$2';
$replace[] = '$2';
$replace[] = '
', ' ', ' ', ' '); $message = str_replace($pattern, $replace, $message); if (isset($inside)) { $outside = explode('<">', $message); $message = ''; $num_tokens = count($outside); for ($i = 0; $i < $num_tokens; $i++) { $message .= $outside[$i]; if (isset($inside[$i])) $message .= '