if ($_SERVER['SERVER_PORT'] != '80') { $pageURL .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI']; } else { $pageURL .= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; } } return $pageURL; } if (is_numeric($_REQUEST['pid'])) { $pid = intval(cleanit($_REQUEST['pid'])); STemplate::assign('pid', $pid); } else { $error = $lang['138']; } if ($error == "") { if (does_post_exist($pid)) { $query = "SELECT * FROM posts_comments WHERE PID='" . mysql_real_escape_string($pid) . "' ORDER BY CID desc"; $executequery = $conn->execute($query); $parray = $executequery->getarray(); $newArr = sancomment($parray); STemplate::assign('comments', $newArr); STemplate::assign('totComments', count($newArr)); $query = "SELECT A.*, B.username, B.profilepicture FROM posts A, members B WHERE A.PID='" . mysql_real_escape_string($pid) . "' AND A.USERID=B.USERID"; $executequery = $conn->execute($query); $parray = $executequery->getarray(); $titleWithHash = _getHash($parray[0]['story']); if ($parray[0]['profilepicture'] == "") { $parray[0]['profilepicture'] = 'noprofilepicture.jpg'; } STemplate::assign('p', $parray[0]); STemplate::assign('titleWithHash', $titleWithHash);
$error = $lang['138']; } if ($error == "") { if ($cache_enabled) { $filename = $config['basedir'] . '/themes/cache/' . $pid . '.txt'; if (file_exists($filename)) { $json = file_get_contents($filename); $parray[0] = (array) json_decode($json); $post_exists = true; } else { $cache_enabled = false; } } $cache_enabled = true; if (!$cache_enabled) { $post_exists = does_post_exist($pid); } if ($post_exists) { $query = "SELECT * FROM posts_comments WHERE PID='" . mysql_real_escape_string($pid) . "' ORDER BY CID desc"; $executequery = $conn->execute($query); $par = $executequery->getarray(); $newArr = sancomment($par); STemplate::assign('comments', $newArr); STemplate::assign('totComments', count($newArr)); if (!$cache_enabled) { $query = "SELECT A.*, B.username, B.profilepicture FROM posts A, members B WHERE A.PID='" . mysql_real_escape_string($pid) . "' AND A.USERID=B.USERID"; $executequery = $conn->execute($query); $parray = $executequery->getarray(); } $titleWithHash = _getHash($parray[0]['story']); $showAd = showAd($parray[0]['story']);