Viewing file: ax5.inc (13.38 KB) -rwxrwxr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
ob_start("ob_gzhandler"); // compress HTML output if possible, to conserve bandwidth
//ini_set('include_path',ini_get('include_path').':/www/advertise.axkickboxing.com/public_html'); //require_once('adlib.inc.php');
function my_error_handler($errno, $errstring, $errfile, $errline, $errcontext) { if (!($errno & error_reporting())) return;
ob_start(); print_r($GLOBALS); $globals=ob_get_contents(); ob_end_clean();
ob_start(); print_r($errcontext); $context=ob_get_contents(); ob_end_clean();
$uzenet=''; $uzenet="The following error occured:\r\n"; $uzenet.="errno: ".$errno."\r\n"; $uzenet.="errstring: ".$errstring."\r\n"; $uzenet.="errfile: ".$errfile."\r\n"; $uzenet.="errline: ".$errline."\r\n"; $uzenet.="errcontext:\r\n"; $uzenet.=$context; $uzenet.="\r\n"; $uzenet.="GLOBALS:\r\n"; $uzenet.=$globals; $uzenet.="\r\n";
error_log($uzenet,1,'hostmaster@axkickboxing.com'); #echo "<pre>".htmlspecialchars($uzenet)."</pre>"; }
set_error_handler("my_error_handler");
function error($message) { echo $message."<br>"; echo "We would be glad, if you could <a href=\"./contact\">contact us</a> if the problem persists.<br>\n"; ob_start(); print_r($GLOBALS); $env=ob_get_contents(); ob_end_clean(); //mail("moderation@axkickboxing.com","new server msgboard automated error reporting","The following error occured: ".$message."\r\n\r\n".$env); }
function psqltime($psqltimestampstring) { return mktime(substr($psqltimestampstring,11,2),substr($psqltimestampstring,14,2), substr($psqltimestampstring,17,2),substr($psqltimestampstring,5,2), substr($psqltimestampstring,8,2),substr($psqltimestampstring,0,4)); }
function lastmodified($datestring) { header("Last-Modified: " . gmdate("D, d M Y H:i:s",psqltime($datestring)) . " GMT"); header("Cache-Control: must-revalidate"); }
function disp_preamble($title1,$title2="") {
require('_header.inc.php'); global $action;
/*switch($title1) { case 'Message Board': $ad_zone='message.axkickboxing.com/topic_topad'; break; case 'Profiles section': $ad_zone='message.axkickboxing.com/profiles'; break; }*/
//if ($action=="") header("Refresh: 300"); /*if ($action=="") { echo "<p>Meta goes: <meta http-equiv=\"refresh\" content=\"300\" /> </p>\n"; echo '<p>this is the topic list</p>'."\n"; }*/ //include('/www/message.axkickboxing.com/public_html/newdesign/_htmlheader.inc.php'); /* This was used to display the graphic at the top of the thread display switch($graphic) { case 0: //include('_newheadergraphic.inc.php'); //include('/www/www.axkickboxing.com/public_html/_graphic.inc.php'); if ($ad) echo '<p align=center>'.insert_ad_here($ad_zone).'</p>'; break; default: echo '<div align=center><img src="axtopnew.gif" alt="AX Kickboxing" align="middle" border="0" vspace="0"></div>'; if ($ad) echo '<p align=center>'.insert_ad_here($ad_zone).'</p>'; break; } */ /*if ($title1!="" and ($graphic==0 and $title1!="Message Board")) echo "<h2>------------TEST 1------------</h2>\n"; echo '<p align=center><font size=6><b>'.$title1.'</b></font></p>'; */ if ($title2!="") { echo "<div id=\"forumHeading\">\n"; /*<div id="loginLogout"> Logged in : Dave Jackson : <a href="">Logout</a> </div> */ echo " <div id=\"topicTitle\">\n"; if ($_REQUEST['action'] == "browse") { echo " ".$title2."\n"; } else { echo " Topic:".$title2."\n"; } echo " </div>\n";
// echo " <div id=\"textAd\"> // <span class=\"sponsorLabel\">Sponsor:</span> // //<script type='text/javascript'><!--//<![CDATA[ // var m3_u = (location.protocol=='https:'?'https://fightadvertisements.com/adserver/www/delivery/ajs.php':'http://fightadvertisements.com/adserver/www/delivery/ajs.php'); // var m3_r = Math.floor(Math.random()*99999999999); // if (!document.MAX_used) document.MAX_used = ','; // document.write (\"<scr\"+\"ipt type='text/javascript' src='\"+m3_u); // document.write (\"?zoneid=2&source=_blank&target=_blank&charset=UTF-8\"); // document.write ('&cb=' + m3_r); // if (document.MAX_used != ',') document.write (\"&exclude=\" + document.MAX_used); // document.write ('&charset=UTF-8'); // document.write (\"&loc=\" + escape(window.location)); // if (document.referrer) document.write (\"&referer=\" + escape(document.referrer)); // if (document.context) document.write (\"&context=\" + escape(document.context)); // if (document.mmm_fo) document.write (\"&mmm_fo=1\"); // document.write (\"'><\/scr\"+\"ipt>\"); // //]]>--></script> // </div>"; echo "<div class=\"returnLink\">\n"; if ($_GET['action'] == 'dispthread') { $end_link = " <a id=\"endLink\" href=\"#end\">Jump to last post</a>"; } else { $end_link = ""; } if ($_REQUEST['action'] == "display") echo ' <a href="./profiles?action=browse"> Back to : '.$title1."</a>\n"; elseif ($_REQUEST['action'] != "browse") { echo ' <a href="'; switch($_REQUEST['topicgroup']) { case '': echo "."; break; case 'axmain': echo "."; break; case 'mma': echo "?topicgroup=mma"; break; case 'boxing': echo "?topicgroup=boxing"; break; case 'axsportscience': echo "?topicgroup=axsportscience"; break; case 'axofftopic': echo "?topicgroup=axofftopic"; break; } echo "\"> Back to : ".$title1."</a>".$end_link."\n"; } echo " </div>\n"; echo "</div>\n"; /* echo "<h2></h2>\n"; echo '<p align=center><font size=5><b>'.$title2.'</b></font></p>'; */ } }
/* function upload_image($user_id, $userfile) { global $HTTP_POST_FILES; $full_base_path = "/www/message.axkickboxing.com/public_html/"; $baseurl = "http://message.axkickboxing.com/"; $basedir = "user_images/"; $namepart = $user_id; $mydir = $full_base_path.$basedir.$namepart; $myumask=umask(2); @ mkdir($mydir,02775); @ chgrp($mydir,'www-data');
if (copy($userfile['tmp_name'],$mydir."/".$userfile['name'])) { @ chmod($mydir."/".$userfile['name'],0664); @ chgrp($mydir."/".$userfile['name'],'www-data'); $link=$baseurl.$basedir.rawurlencode($namepart)."/".rawurlencode($userfile['name']); //$posttext = "<img src=\"".$link."\" />\n".$_POST['text']; $posttext = "[img]".$link."[/img]\n".$_POST['text']; } else { $posttext = "[image upload attempt failed for id: $user_id]\n------------------------\n".$_POST['text']; }; umask($myumask);
return $posttext; } */
function upload_image($user_id, $userfile) { global $HTTP_POST_FILES; $full_base_path = "/www/message.axkickboxing.com/public_html/"; $baseurl = "http://message.axkickboxing.com/"; $basedir = "user_images/"; $namepart = $user_id; $mydir = $full_base_path.$basedir.$namepart; $myumask=umask(2); @ mkdir($mydir,02775); @ chgrp($mydir,'www-data'); if (copy($userfile['tmp_name'],$mydir."/".$userfile['name'])) { $photo = $mydir."/".$userfile['name']; // Get the image info from the photo $image_info = getimagesize($photo); $width = $image_info[0]; if ($width > 900) { $height = $image_info[1]; $type = $image_info[2]; $image_result = "image info:".$photo."\n<br /> width:".$width."\n<br /> height:".$height."\n<br /> type:".$type."\n<br />-------------\n<br />"; // Load the image switch ($type) { case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($photo); break; case IMAGETYPE_GIF: $image = imagecreatefromgif($photo); break; case IMAGETYPE_PNG: $image = imagecreatefrompng($photo); break; default: die('Error loading '.$photo.' - File type '.$type.' not supported'); }
// Create a new, resized image $new_width = 900; $new_height = $height / ($width / $new_width); $new_image = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Save the new image over the top of the original photo switch ($type) { case IMAGETYPE_JPEG: imagejpeg($new_image, $photo, 100); break; case IMAGETYPE_GIF: imagegif($new_image, $photo); break; case IMAGETYPE_PNG: imagepng($new_image, $photo); break; default: die('Error saving image: '.$photo); } } $result_info = getimagesize($photo); $result_width = $result_info[0]; $result_height = $result_info[1]; $result_type = $result_info[2]; $image_result .= "new image info:".$photo."\n<br /> result width:".$result_width."\n<br /> result height:".$result_height."\n<br /> result type:".$result_type; //die($image_result);
@ chmod($mydir."/".$userfile['name'],0664); @ chgrp($mydir."/".$userfile['name'],'www-data'); $link=$baseurl.$basedir.rawurlencode($namepart)."/".rawurlencode($userfile['name']); //$posttext = "<img src=\"".$link."\" />\n".$_POST['text']; $posttext = "[img]".$link."[/img]\n".$_POST['text']; } else { $posttext = "[image upload attempt failed for id: $user_id]\n------------------------\n".$_POST['text']; }; umask($myumask);
return $posttext; }
function bbcode($input){ //$input = strip_tags($input); //$input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=(.*?)\](.*?)\[\/url\]/is', '/\[font color=(.*?) size=(.*?) face=(.*?)\](.*?)\[\/font\]/is', '/\[h1\](.*?)\[\/h1\]/is', '/\[h2\](.*?)\[\/h2\]/is', '/\[h3\](.*?)\[\/h3\]/is' ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<img src="$1" />', '<a href="$1" rel="nofollow" target="_blank">$2</a>', '<font style="color:$1;font-size:$2;font-face:$3">$4</font>', '<h1>$1</h1>', '<h2>$1</h2>', '<h3>$1</h3>' ); return preg_replace($search,$replace,$input); }
function auto_link($input){
//http://stackoverflow.com/questions/12538358/convert-url-to-links-from-string-except-if-they-are-in-a-attribute-of-a-html-tag
// return preg_replace("#http://([\S]+?)#Uis", '<a rel="nofollow" rel="external" href="http://\\1">\\1</a>', $input); //$input = preg_replace('$(https?://[a-z0-9_./?=&#+%-]+)(?![^<>]*>)$i', ' <a href="$1" target="_blank">$1</a> ', $input." "); //$input = preg_replace('$(www\.[a-z0-9_./?=&#+%-]+)(?![^<>]*>)$i', '<a target="_blank" href="http://$1" target="_blank">$1</a> ', $input." ");
$input = preg_replace( array( '~(\s|^)(www\..+?)(\s|$)~im', '~(\s|^)(https?://)(.+?)(\s|$)~im', ), array( '$1http://$2$3', '$1<a href="$2$3" target="_blank">$3</a>$4', ), $input );
return $input; }
function strip_only($str, $tags) { if(!is_array($tags)) { $tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags)); if(end($tags) == '') array_pop($tags); } foreach($tags as $tag) $str = preg_replace('#</?'.$tag.'[^>]*>#is', '', $str); return $str; }
function filterpost($input){
$bbdecoded = bbcode($input);
$autolinked = auto_link($bbdecoded);
$remove_attributes = array( '/onclick/is', '/onmousehover/is', '/ondblclick/is', '/onmousedown/is', '/onmouseup/is', '/onmousemove/is', '/onmouseout/is', '/onmouseover/is', '/onkeydown/is', '/onkeyup/is', '/onkeypress/is', '/onfocus/is', '/onblur/is', '/onchange/is', '/javascript:/is' );
$replace_attributes = array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ); //$ok_tags = array('p', 'h1', 'h2', 'h3', 'table', 'td', 'tr', 'hr', 'em', 'i', 'strong', 'b', 'ul', 'ol', 'li', 'center', 'span', 'font', 'object', 'embed'); $ok_tags = '<p><img><a><h1><h2><h3><table><td><tr><hr><em><i><strong><b><ul><ol><li><center><span><font><object><embed><iframe>';
$tags_removed = strip_tags($autolinked, $ok_tags); $filtered = preg_replace($remove_attributes, $replace_attributes, $tags_removed); return $filtered; }
function disp_tail() { global $PHP_SELF; /*<p align="center"><font color="#FEFFD2">AX name and logo copyright Brian Ritchie - </font><a href="mailto:axteam@axkickboxing.com"><font color="#408080">axteam@axkickboxing.com</font></a></p> </body> </html>*/
}
|