punbb-1.2.7/upload/include/common.php |
punbb-1.2.9/upload/include/common.php |
80: // Load the functions script | 80: // Load the functions script |
81: require PUN_ROOT.'include/functions.php'; | 81: require PUN_ROOT.'include/functions.php'; |
82: | 82: |
| 83: // Reverse the effect of register_globals |
| 84: if (@ini_get('register_globals')) |
| 85: unregister_globals(); |
| 86: |
| 87: |
83: // Load DB abstraction layer and connect | 88: // Load DB abstraction layer and connect |
84: require PUN_ROOT.'include/dblayer/common_db.php'; | 89: require PUN_ROOT.'include/dblayer/common_db.php'; |
85: | 90: |
punbb-1.2.7/upload/include/email.php |
punbb-1.2.9/upload/include/email.php |
75: $subject = trim(preg_replace('#[\n\r]+#s', '', $subject)); | 75: $subject = trim(preg_replace('#[\n\r]+#s', '', $subject)); |
76: $from = trim(preg_replace('#[\n\r:]+#s', '', $from)); | 76: $from = trim(preg_replace('#[\n\r:]+#s', '', $from)); |
77: | 77: |
78: // Detect what linebreak we should use for the headers | 78: $headers = 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\r\n".'X-Mailer: PunBB Mailer'; |
79: if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
80: $eol = "\r\n"; | |
81: else if (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) | |
82: $eol = "\r"; | |
83: else | |
84: $eol = "\n"; | |
85: | |
86: $headers = 'From: '.$from.$eol.'Date: '.date('r').$eol.'MIME-Version: 1.0'.$eol.'Content-transfer-encoding: 8bit'.$eol.'Content-type: text/plain; charset='.$lang_common['lang_encoding'].$eol.'X-Mailer: PunBB Mailer'; | |
87: | 79: |
88: // Make sure all linebreaks are CRLF in message | 80: // Make sure all linebreaks are CRLF in message |
89: $message = str_replace("\n", "\r\n", pun_linebreaks($message)); | 81: $message = str_replace("\n", "\r\n", pun_linebreaks($message)); |
91: if ($pun_config['o_smtp_host'] != '') | 83: if ($pun_config['o_smtp_host'] != '') |
92: smtp_mail($to, $subject, $message, $headers); | 84: smtp_mail($to, $subject, $message, $headers); |
93: else | 85: else |
| 86: { |
| 87: // Change the linebreaks used in the headers according to OS |
| 88: if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') |
| 89: $headers = str_replace("\r\n", "\r", $headers); |
| 90: else if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') |
| 91: $headers = str_replace("\r\n", "\n", $headers); |
| 92: |
94: mail($to, $subject, $message, $headers); | 93: mail($to, $subject, $message, $headers); |
| 94: } |
95: } | 95: } |
96: | 96: |
97: | 97: |
punbb-1.2.7/upload/include/functions.php |
punbb-1.2.9/upload/include/functions.php |
209: $now = time(); | 209: $now = time(); |
210: | 210: |
211: // Fetch all online list entries that are older than "o_timeout_online" | 211: // Fetch all online list entries that are older than "o_timeout_online" |
212: $result = $db->query('SELECT * FROM '.$db->prefix.'online WHERE logged<'.($now-$pun_config['o_timeout_online'])) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); | 212: $result = $db->query('SELECT * FROM '.$db->prefix.'online WHERE logged<'.($now-$pun_config['o_timeout_online'])) or error('Unable to fetch old entries from online list', __FILE__, __LINE__, $db->error()); |
213: while ($cur_user = $db->fetch_assoc($result)) | 213: while ($cur_user = $db->fetch_assoc($result)) |
214: { | 214: { |
215: // If the entry is a guest, delete it | 215: // If the entry is a guest, delete it |
1046: </div> | 1046: </div> |
1047: <?php | 1047: <?php |
1048: | 1048: |
| 1049: } |
| 1050: |
| 1051: |
| 1052: // |
| 1053: // Unset any variables instantiated as a result of register_globals being enabled |
| 1054: // |
| 1055: function unregister_globals() |
| 1056: { |
| 1057: // Prevent script.php?GLOBALS[foo]=bar |
| 1058: if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) |
| 1059: exit('I\'ll have a steak sandwich and... a steak sandwich.'); |
| 1060: |
| 1061: // Variables that shouldn't be unset |
| 1062: $no_unset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES'); |
| 1063: |
| 1064: // Remove elements in $GLOBALS that are present in any of the superglobals |
| 1065: $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); |
| 1066: foreach ($input as $k => $v) |
| 1067: { |
| 1068: if (!in_array($k, $no_unset) && isset($GLOBALS[$k])) |
| 1069: unset($GLOBALS[$k]); |
| 1070: } |
1049: } | 1071: } |
1050: | 1072: |
1051: | 1073: |
punbb-1.2.7/upload/search.php |
punbb-1.2.9/upload/search.php |
51: $action = (isset($_GET['action'])) ? $_GET['action'] : null; | 51: $action = (isset($_GET['action'])) ? $_GET['action'] : null; |
52: $forum = (isset($_GET['forum'])) ? intval($_GET['forum']) : -1; | 52: $forum = (isset($_GET['forum'])) ? intval($_GET['forum']) : -1; |
53: $sort_dir = (isset($_GET['sort_dir'])) ? (($_GET['sort_dir'] == 'DESC') ? 'DESC' : 'ASC') : 'DESC'; | 53: $sort_dir = (isset($_GET['sort_dir'])) ? (($_GET['sort_dir'] == 'DESC') ? 'DESC' : 'ASC') : 'DESC'; |
| 54: if (isset($search_id)) unset($search_id); |
54: | 55: |
55: // If a search_id was supplied | 56: // If a search_id was supplied |
56: if (isset($_REQUEST['search_id'])) | 57: if (isset($_GET['search_id'])) |
57: { | 58: { |
58: $search_id = intval($_GET['search_id']); | 59: $search_id = intval($_GET['search_id']); |
59: if ($search_id < 1) | 60: if ($search_id < 1) |
386: | 387: |
387: | 388: |
388: // Prune "old" search results | 389: // Prune "old" search results |
| 390: $old_searches = array(); |
389: $result = $db->query('SELECT ident FROM '.$db->prefix.'online') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error()); | 391: $result = $db->query('SELECT ident FROM '.$db->prefix.'online') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error()); |
390: | 392: |
391: if ($db->num_rows($result)) | 393: if ($db->num_rows($result)) |
punbb-1.2.7/upload/viewforum.php |
punbb-1.2.9/upload/viewforum.php |
242: | 242: |
243: <div class="linksb"> | 243: <div class="linksb"> |
244: <div class="inbox"> | 244: <div class="inbox"> |
245: <p class="pagelink conl"><?php echo $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewforum.php?id='.$id) ?></p> | 245: <p class="pagelink conl"><?php echo $paging_links ?></p> |
246: <?php echo $post_link ?> | 246: <?php echo $post_link ?> |
247: <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a> </li><li>» <?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul> | 247: <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a> </li><li>» <?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul> |
248: <div class="clearer"></div> | 248: <div class="clearer"></div> |