"; } return $result; } function add_color($string,$color) { return "".$string.""; } function add_style($string,$color) { return "".$string.""; } if (isset($_GET['id'])) { if (!($list = $db->get_it('SELECT * FROM pbot_content WHERE md5="'. $_GET['id'] .'" LIMIT 1'))) { echo('entry notfound'); } else { foreach ($list as $e) { $source = stripslashes($e['content']); $language = $e['highlight']; $path = 'include/geshi/'; $geshi = new GeSHi($source, $language); $geshi->set_overall_style('font-size:15px;'); $geshi->set_header_type(GESHI_HEADER_NONE); $geshi->set_comments_style(1, 'font-style: normal; color:red'); $geshi->set_comments_style('MULTI', 'font-style: normal; color:red'); $temp_text = $geshi->parse_code(); $pokercss = 0; if ($e['highlight'] == "poker") { $pokercss = 1; $nick = ''; $poker = explode("\n",$e['content']); $IsFullTilt = False; for ($i = 0;$i < count($poker);$i++ ) { if ( preg_match('/^Full Tilt Poker Game/',$poker[$i])) { $IsFullTilt = True; } if ($nick == '') { if ( $IsFullTilt == True ) { $dealregexp = "/^Dealt to ([^ ]+) \\[([^ ]+) ([^ ]+)\\]/"; } else { $dealregexp = "/^Dealt to ([^ ]+) \\[ ([^ ]+) ([^ ]+) \\]/"; } if (preg_match($dealregexp,$poker[$i],$matches)) { $owncards = $matches[2]." ". $matches[3]; $nick = $matches[1]; $upperhalf = array_slice($poker,$i+1); $poker[$i] = ""; $poker[++$i] = "Holecards"; $poker[++$i] = "Dealt to ". $nick . " [ " . add_pictures($owncards). " ]"; array_splice($poker, $i+1, count($poker), $upperhalf); } } else if (preg_match('/([^ ]+) raises \\[([^\\]]+)\\]/',$poker[$i],$matches)) { $poker[$i] = add_color("RAISE: " . $matches[1] . ", " . $matches[2],"#FF0000"); } else if (preg_match('/([^ ]+) raises to ([^ ]+)/',$poker[$i],$matches)) { $poker[$i] = add_color("RAISE: " . $matches[1] . ", " . $matches[2],"#FF0000"); } else if (preg_match('/(.+) folds/',$poker[$i],$matches)) { $poker[$i] = add_color("FOLD: " . $matches[1],"#000000"); } else if (preg_match('/([^ ]+) calls \\[([^\\]]+)\\]/',$poker[$i],$matches)) { $poker[$i] = add_color("CALL: " . $matches[1] . ", " . $matches[2],"#000000"); } else if (preg_match('/(.+) calls ([^ ]+)/',$poker[$i],$matches)) { $poker[$i] = add_color("CALL: " . $matches[1] . ", " . $matches[2],"#000000"); } else if (preg_match('/(.+) is all-In \\[([^\\]]+)\\]/',$poker[$i],$matches)) { $poker[$i] = add_color("ALL-IN: " . $matches[1] . ", " . $matches[2],"#FF0000"); } else if (preg_match('/(.+) checks/',$poker[$i],$matches)) { $poker[$i] = add_color("CHECK: " . $matches[1],"#000000"); } else if (preg_match('/([^ ]+) bets \\[([^\\]]+)\\]/',$poker[$i],$matches)) { $poker[$i] = add_color("BET: " . $matches[1] . ", " . $matches[2],"#FF0000"); } else if (preg_match('/(.+) bets ([^ ]+)/',$poker[$i],$matches)) { $poker[$i] = add_color("BET: " . $matches[1] . ", " . $matches[2],"#FF0000"); } else if (preg_match('/\*\*\* FLOP \*\*\* \\[([^ ]+) ([^ ]+) ([^ ]+)\\]/',$poker[$i],$matches)) { $upperhalf = array_slice($poker,$i+1); $poker[$i] = ""; $flopcards = $matches[1]." ".$matches[2]." ".$matches[3]; $poker[++$i] = "Flop"; $poker[++$i] = ""; $poker[++$i] = "[ " . add_pictures($flopcards). "]"; array_splice($poker, $i+1, count($poker), $upperhalf); } else if (preg_match('/\*\*\* TURN \*\*\* \\[.*\\] \\[([^ ]+)\\]/',$poker[$i],$matches)) { $upperhalf = array_slice($poker,$i+1); $poker[$i] = ""; $poker[++$i] = "Turn"; $poker[++$i] = ""; $poker[++$i] = "[ " . add_pictures($matches[1]). "]"; array_splice($poker, $i+1, count($poker), $upperhalf); } else if (preg_match('/\*\*\* RIVER \*\*\* \\[.*\\] \\[([^ ]+)\\]/',$poker[$i],$matches)) { $upperhalf = array_slice($poker,$i+1); $poker[$i] = ""; $poker[++$i] = "Turn"; $poker[++$i] = ""; $poker[++$i] = "[ " . add_pictures($matches[1]). "]"; array_splice($poker, $i+1, count($poker), $upperhalf); } else if (preg_match('/Dealing Flop \*\* \\[ ([^,]+), ([^,]+), ([^ ]+)/',$poker[$i],$matches)) { $upperhalf = array_slice($poker,$i+1); $poker[$i] = ""; $flopcards = $matches[1]." ".$matches[2]." ".$matches[3]; $poker[++$i] = "Flop"; $poker[++$i] = ""; $poker[++$i] = "[ " . add_pictures($flopcards). "]"; array_splice($poker, $i+1, count($poker), $upperhalf); } else if (preg_match('/Dealing Turn \*\* \\[ ([^ ]+)/',$poker[$i],$matches)) { $upperhalf = array_slice($poker,$i+1); $poker[$i] = ""; $poker[++$i] = "Turn"; $poker[++$i] = ""; $poker[++$i] = "[ " . add_pictures($matches[1]). "]"; array_splice($poker, $i+1, count($poker), $upperhalf); } else if (preg_match('/Dealing River \*\* \\[ ([^ ]+)/',$poker[$i],$matches)) { $upperhalf = array_slice($poker,$i+1); $poker[$i] = ""; $poker[++$i] = "River"; $poker[++$i] = ""; $poker[++$i] = "[ " . add_pictures($matches[1]). "]"; array_splice($poker, $i+1, count($poker), $upperhalf); } else if (preg_match('/^([^ ]+).*shows.*\\[ ([^,]+), ([^ ]+) \\](.*)/',$poker[$i],$matches)) { $poker[$i] = "Show: " . $matches[1] . " [ " . add_pictures($matches[2]." ".$matches[3]) . " ] " . add_color($matches[4],"#FF0000"); } else if (preg_match('/^([^ ]+).*doesn.*\\[ ([^,]+), ([^ ]+) \\](.*)/',$poker[$i],$matches)) { $poker[$i] = "Muck: " . $matches[1] . " [ " . add_pictures($matches[2]." ".$matches[3]) . " ] " . add_color($matches[4],"#FF0000"); } else if (preg_match('/^Seat..: ([^ ]+).*mucked \\[([^ ]+) ([^ ]+)\\](.*)/',$poker[$i],$matches)) { $poker[$i] = "Muck: " . $matches[1] . " [ " . add_pictures($matches[2]." ".$matches[3]) . " ] " . add_color($matches[4],"#FF0000"); } else if (preg_match('/^Seat..: ([^ ]+).*showed \\[([^ ]+) ([^ ]+)\\](.*)/',$poker[$i],$matches)) { $poker[$i] = "SHOW: " . $matches[1] . " [ " . add_pictures($matches[2]." ".$matches[3]) . " ] " . add_color($matches[4],"#FF0000"); } else if (preg_match('/^([^ ]+) wins ([^ ]+)(.*)(from[^w]*).*with ([^.]*)/',$poker[$i],$matches)) { $string1 = $matches[1] . " wins " . add_color($matches[2],"#FF0000") . $matches[3] . add_style($matches[4],"bold") . "with ". add_color($matches[5],"#FF0000"); $poker[$i] = str_replace(' ',' ',$string1); } else { $upperhalf = array_slice($poker,$i+1); array_splice($poker, $i, count($poker), $upperhalf); $i--; } } $temp_text = implode("\n",$poker); $temp_text = str_replace($nick,"".$nick."",$temp_text); } $tpl->assign('poker',$pokercss); $tpl->assign('text',$temp_text); $tpl->assign('language',$language); $tpl->assign('link',$e['md5']); $numbers = count($lines = explode("\n", $temp_text)); $tpl->display('pbot.htm'); } } } elseif (isset($_POST['content'])) { if ($_POST['content'] == "") { echo('lame'); } else { if ($list = $db->get_it('SELECT * FROM pbot_content WHERE md5="'. md5($_POST['content'].$_POST['highlight']) .'"')) { foreach ($list as $e) { header("location:/pbot/". md5($_POST['content'].$_POST['highlight'])); } } else { $db->query( 'INSERT INTO `pbot_content` ( `md5` , `content` , `highlight`, `time`, `ip` ) VALUES ( "' . md5($_POST['content'].$_POST['highlight']). '", "' . mysql_real_escape_string($_POST['content']) . '", "' . mysql_real_escape_string($_POST['highlight']) . '", "' . time() . '", "' . $_SERVER['REMOTE_ADDR'] . '" )'); header("location:/pbot/". md5($_POST['content'].$_POST['highlight'])); } } } else { $dateien = array(); $dateien[] = "none"; $file_dir = 'includes/geshi/geshi/'; $fsize=0; if(is_dir($file_dir)) { $handle=opendir($file_dir); while (false !== ($file = readdir($handle))) { if ((substr($file,0,1) != ".")) { $dateien[] = substr($file,0,-4); } } sort($dateien); } $tpl->assign('highlight',$dateien); $tpl->display("main.htm"); } ?>