punbb-1.2.1/upload/admin_loader.php |
punbb-1.2.2/upload/admin_loader.php |
36: | 36: |
37: | 37: |
38: // The plugin to load should be supplied via GET | 38: // The plugin to load should be supplied via GET |
39: $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : null; | 39: $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : ''; |
40: if (!$plugin) | 40: if (!preg_match('/^AM?P_(\w*?)\.php$/i', $plugin)) |
41: message($lang_common['Bad request']); | 41: message($lang_common['Bad request']); |
42: | 42: |
43: // AP_ == Admins only, AMP_ == admins and moderators | 43: // AP_ == Admins only, AMP_ == admins and moderators |
49: if (!file_exists(PUN_ROOT.'plugins/'.$plugin)) | 49: if (!file_exists(PUN_ROOT.'plugins/'.$plugin)) |
50: message('There is no plugin called \''.$plugin.'\' in the plugin directory.'); | 50: message('There is no plugin called \''.$plugin.'\' in the plugin directory.'); |
51: | 51: |
| 52: // Construct REQUEST_URI if it isn't set |
| 53: if (!isset($_SERVER['REQUEST_URI'])) |
| 54: $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); |
52: | 55: |
53: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / '.$plugin; | 56: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / '.$plugin; |
54: require PUN_ROOT.'header.php'; | 57: require PUN_ROOT.'header.php'; |
punbb-1.2.1/upload/include/email.php |
punbb-1.2.2/upload/include/email.php |
71: $from = str_replace(':', ' ', $from); | 71: $from = str_replace(':', ' ', $from); |
72: | 72: |
73: // Detect what linebreak we should use for the headers | 73: // Detect what linebreak we should use for the headers |
74: if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | 74: if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) |
75: $eol = "\r\n"; | 75: $eol = "\r\n"; |
76: else if (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) | 76: else if (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) |
77: $eol = "\r"; | 77: $eol = "\r"; |
78: else | 78: else |
79: $eol = "\n"; | 79: $eol = "\n"; |
80: | 80: |
81: $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'; | 81: $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'; |
82: | 82: |
punbb-1.2.1/upload/include/functions.php |
punbb-1.2.2/upload/include/functions.php |
108: | 108: |
109: // Fetch guest user | 109: // Fetch guest user |
110: $result = $db->query('SELECT u.*, g.*, o.logged FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.ident=\''.$remote_addr.'\' WHERE u.id=1') or error('Unable to fetch guest information', __FILE__, __LINE__, $db->error()); | 110: $result = $db->query('SELECT u.*, g.*, o.logged FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.ident=\''.$remote_addr.'\' WHERE u.id=1') or error('Unable to fetch guest information', __FILE__, __LINE__, $db->error()); |
| 111: if (!$db->num_rows($result)) |
| 112: exit('Unable to fetch guest information. The table \''.$db->prefix.'users\' must contain an entry with id = 1 that represents anonymous users.'); |
| 113: |
111: $pun_user = $db->fetch_assoc($result); | 114: $pun_user = $db->fetch_assoc($result); |
112: | 115: |
113: // Update online list | 116: // Update online list |
229: global $pun_config, $lang_common, $pun_user; | 232: global $pun_config, $lang_common, $pun_user; |
230: | 233: |
231: // Index and Userlist should always be displayed | 234: // Index and Userlist should always be displayed |
232: $links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>'; | 235: $links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>'; |
233: $links[] = '<li id="navuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>'; | 236: $links[] = '<li id="navuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>'; |
234: | 237: |
235: if ($pun_config['o_rules'] == '1') | 238: if ($pun_config['o_rules'] == '1') |
236: $links[] = '<li id="navrules"><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>'; | 239: $links[] = '<li id="navrules"><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>'; |
| 240: |
| 241: if ($pun_user['is_guest']) |
| 242: { |
| 243: if ($pun_user['g_search'] == '1') |
| 244: $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; |
| 245: |
| 246: $links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>'; |
| 247: $links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>'; |
237: | 248: |
238: if ($pun_user['is_guest']) | 249: $info = $lang_common['Not logged in']; |
239: { | 250: } |
240: if ($pun_user['g_search'] == '1') | |
241: $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; | |
242: | |
243: $links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>'; | |
244: $links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>'; | |
245: | |
246: $info = $lang_common['Not logged in']; | |
247: } | |
248: else | 251: else |
249: { | 252: { |
250: if ($pun_user['g_id'] > PUN_MOD) | 253: if ($pun_user['g_id'] > PUN_MOD) |
251: { | 254: { |
252: if ($pun_user['g_search'] == '1') | 255: if ($pun_user['g_search'] == '1') |
253: $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; | 256: $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; |
254: | 257: |
255: $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>'; | 258: $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>'; |
256: $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; | 259: $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; |
257: } | 260: } |
258: else | 261: else |
259: { | 262: { |
260: $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; | 263: $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; |
261: $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>'; | 264: $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>'; |
262: $links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>'; | 265: $links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>'; |
263: $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; | 266: $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; |
264: } | 267: } |
265: } | 268: } |
266: | 269: |
267: // Are there any additional navlinks we should insert into the array before imploding it? | 270: // Are there any additional navlinks we should insert into the array before imploding it? |
268: if ($pun_config['o_additional_navlinks'] != '') | 271: if ($pun_config['o_additional_navlinks'] != '') |
271: { | 274: { |
272: // Insert any additional links into the $links array (at the correct index) | 275: // Insert any additional links into the $links array (at the correct index) |
273: for ($i = 0; $i < count($extra_links[1]); ++$i) | 276: for ($i = 0; $i < count($extra_links[1]); ++$i) |
274: array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i])); | 277: array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i])); |
275: } | 278: } |
276: } | 279: } |
277: | 280: |
278: return '<ul>'."\n\t\t\t\t".implode($lang_common['Link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>'; | 281: return '<ul>'."\n\t\t\t\t".implode($lang_common['Link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>'; |
279: } | 282: } |
280: | 283: |
281: | 284: |
punbb-1.2.1/upload/install.php |
punbb-1.2.2/upload/install.php |
24: | 24: |
25: | 25: |
26: // The PunBB version this script installs | 26: // The PunBB version this script installs |
27: $punbb_version = '1.2.1'; | 27: $punbb_version = '1.2.2'; |
28: | 28: |
29: | 29: |
30: define('PUN_ROOT', './'); | 30: define('PUN_ROOT', './'); |
33: | 33: |
34: | 34: |
35: // Make sure we are running at least PHP 4.1.0 | 35: // Make sure we are running at least PHP 4.1.0 |
36: if (version_compare(PHP_VERSION, '4.1.0', '<')) | 36: if (intval(str_replace('.', '', phpversion())) < 410) |
37: exit('You are running PHP version '.PHP_VERSION.'. PunBB requires at least PHP 4.1.0 to run properly. You must upgrade your PHP installation before you can continue.'); | 37: exit('You are running PHP version '.PHP_VERSION.'. PunBB requires at least PHP 4.1.0 to run properly. You must upgrade your PHP installation before you can continue.'); |
38: | 38: |
39: // Disable error reporting for uninitialized variables | 39: // Disable error reporting for uninitialized variables |
punbb-1.2.1/upload/login.php |
punbb-1.2.2/upload/login.php |
91: // Remove user from "users online" list. | 91: // Remove user from "users online" list. |
92: $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id']) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); | 92: $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$pun_user['id']) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error()); |
93: | 93: |
94: // Update last_visit | 94: // Update last_visit (make sure there's something to update it with) |
95: $db->query('UPDATE '.$db->prefix.'users SET last_visit='.$pun_user['logged'].' WHERE id='.$pun_user['id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error()); | 95: if (isset($pun_user['logged'])) |
| 96: $db->query('UPDATE '.$db->prefix.'users SET last_visit='.$pun_user['logged'].' WHERE id='.$pun_user['id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error()); |
96: | 97: |
97: pun_setcookie(1, random_pass(8), time() + 31536000); | 98: pun_setcookie(1, random_pass(8), time() + 31536000); |
98: | 99: |
punbb-1.2.1/upload/moderate.php |
punbb-1.2.2/upload/moderate.php |
98: { | 98: { |
99: confirm_referrer('moderate.php'); | 99: confirm_referrer('moderate.php'); |
100: | 100: |
| 101: if (preg_match('/[^0-9,]/', $posts)) |
| 102: message($lang_common['Bad request']); |
| 103: |
101: // Delete the posts | 104: // Delete the posts |
102: $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$posts.')') or error('Unable to delete posts', __FILE__, __LINE__, $db->error()); | 105: $db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$posts.')') or error('Unable to delete posts', __FILE__, __LINE__, $db->error()); |
103: | 106: |
278: { | 281: { |
279: confirm_referrer('moderate.php'); | 282: confirm_referrer('moderate.php'); |
280: | 283: |
| 284: if (preg_match('/[^0-9,]/', $_POST['topics'])) |
| 285: message($lang_common['Bad request']); |
| 286: |
281: $topics = explode(',', $_POST['topics']); | 287: $topics = explode(',', $_POST['topics']); |
282: $move_to_forum = intval($_POST['move_to_forum']); | 288: $move_to_forum = intval($_POST['move_to_forum']); |
283: if (empty($topics) || $move_to_forum < 1) | 289: if (empty($topics) || $move_to_forum < 1) |
394: { | 400: { |
395: confirm_referrer('moderate.php'); | 401: confirm_referrer('moderate.php'); |
396: | 402: |
| 403: if (preg_match('/[^0-9,]/', $topics)) |
| 404: message($lang_common['Bad request']); |
| 405: |
397: require PUN_ROOT.'include/search_idx.php'; | 406: require PUN_ROOT.'include/search_idx.php'; |
398: | 407: |
399: // Delete the topics and any redirect topics | 408: // Delete the topics and any redirect topics |
459: { | 468: { |
460: confirm_referrer('moderate.php'); | 469: confirm_referrer('moderate.php'); |
461: | 470: |
462: $topics = isset($_POST['topics']) ? $_POST['topics'] : array(); | 471: $topics = isset($_POST['topics']) ? @array_map('intval', @array_keys($_POST['topics'])) : array(); |
463: if (empty($topics)) | 472: if (empty($topics)) |
464: message($lang_misc['No topics selected']); | 473: message($lang_misc['No topics selected']); |
465: | 474: |
punbb-1.2.1/upload/profile.php |
punbb-1.2.2/upload/profile.php |
223: } | 223: } |
224: | 224: |
225: // Check if someone else already has registered with that e-mail address | 225: // Check if someone else already has registered with that e-mail address |
226: $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$new_email.'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); | 226: $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($new_email).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
227: if ($db->num_rows($result)) | 227: if ($db->num_rows($result)) |
228: { | 228: { |
229: if ($pun_config['p_allow_dupe_email'] == '0') | 229: if ($pun_config['p_allow_dupe_email'] == '0') |
243: | 243: |
244: $new_email_key = random_pass(8); | 244: $new_email_key = random_pass(8); |
245: | 245: |
246: $db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.$new_email.'\', activate_key=\''.$new_email_key.'\' WHERE id='.$id) or error('Unable to update activation data', __FILE__, __LINE__, $db->error()); | 246: $db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.$db->escape($new_email).'\', activate_key=\''.$new_email_key.'\' WHERE id='.$id) or error('Unable to update activation data', __FILE__, __LINE__, $db->error()); |
247: | 247: |
248: // Load the "activate e-mail" template | 248: // Load the "activate e-mail" template |
249: $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl')); | 249: $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl')); |
711: { | 711: { |
712: $form = extract_elements(array('realname', 'url', 'location')); | 712: $form = extract_elements(array('realname', 'url', 'location')); |
713: | 713: |
714: if ($pun_user['g_id'] < PUN_GUEST) | 714: if ($pun_user['g_id'] == PUN_ADMIN) |
715: $form['title'] = trim($_POST['title']); | 715: $form['title'] = trim($_POST['title']); |
716: else if ($pun_user['g_set_title'] == '1') | 716: else if ($pun_user['g_set_title'] == '1') |
717: { | 717: { |
819: // Singlequotes around non-empty values and NULL for empty values | 819: // Singlequotes around non-empty values and NULL for empty values |
820: while (list($key, $input) = @each($form)) | 820: while (list($key, $input) = @each($form)) |
821: { | 821: { |
822: $value = ($input != '') ? '\''.$db->escape($input).'\'' : 'NULL'; | 822: $value = ($input !== '') ? '\''.$db->escape($input).'\'' : 'NULL'; |
823: | 823: |
824: $temp[] = $key.'='.$value; | 824: $temp[] = $key.'='.$value; |
825: } | 825: } |
1182: } | 1182: } |
1183: else if ($section == 'personal') | 1183: else if ($section == 'personal') |
1184: { | 1184: { |
1185: if ($pun_user['g_set_title'] == '1' || $pun_user['g_id'] < PUN_GUEST) | 1185: if ($pun_user['g_set_title'] == '1') |
1186: $title_field = '<label>'.$lang_common['Title'].' (<em>'.$lang_profile['Leave blank'].'</em>)<br /><input type="text" name="title" value="'.pun_htmlspecialchars($user['title']).'" size="30" maxlength="50" /><br /></label>'."\n"; | 1186: $title_field = '<label>'.$lang_common['Title'].' (<em>'.$lang_profile['Leave blank'].'</em>)<br /><input type="text" name="title" value="'.pun_htmlspecialchars($user['title']).'" size="30" maxlength="50" /><br /></label>'."\n"; |
1187: | 1187: |
1188: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; | 1188: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
punbb-1.2.1/upload/register.php |
punbb-1.2.2/upload/register.php |
180: $password_hash = pun_hash($password1); | 180: $password_hash = pun_hash($password1); |
181: | 181: |
182: // Add the user | 182: // Add the user |
183: $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$language.'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error()); | 183: $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error()); |
184: $new_uid = $db->insert_id(); | 184: $new_uid = $db->insert_id(); |
185: | 185: |
186: | 186: |