punbb-1.3.1/admin/bans.php |
punbb-1.3.6/admin/bans.php |
4: * | 4: * |
5: * Allows administrators and moderators to create, modify, and delete bans. | 5: * Allows administrators and moderators to create, modify, and delete bans. |
6: * | 6: * |
7: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 7: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
9: * @package PunBB | 9: * @package PunBB |
10: */ | 10: */ |
24: require FORUM_ROOT.'lang/'.$forum_user['language'].'/admin_common.php'; | 24: require FORUM_ROOT.'lang/'.$forum_user['language'].'/admin_common.php'; |
25: require FORUM_ROOT.'lang/'.$forum_user['language'].'/admin_bans.php'; | 25: require FORUM_ROOT.'lang/'.$forum_user['language'].'/admin_bans.php'; |
26: | 26: |
27: | |
28: // Add/edit a ban (stage 1) | 27: // Add/edit a ban (stage 1) |
29: if (isset($_REQUEST['add_ban']) || isset($_GET['edit_ban'])) | 28: if (isset($_REQUEST['add_ban']) || isset($_GET['edit_ban'])) |
30: { | 29: { |
157: <h2 class="hn"><span><?php echo $lang_admin_bans['Ban advanced heading'] ?></span></h2> | 156: <h2 class="hn"><span><?php echo $lang_admin_bans['Ban advanced heading'] ?></span></h2> |
158: </div> | 157: </div> |
159: <div class="main-content main-frm"> | 158: <div class="main-content main-frm"> |
160: <div class="ct-box"> | 159: <div class="ct-box warn-box"> |
161: <p class="warn"><?php echo $lang_admin_bans['Ban IP warning'] ?></p> | 160: <p class="warn"><?php echo $lang_admin_bans['Ban IP warning'] ?></p> |
162: </div> | 161: </div> |
163: <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo forum_link($forum_url['admin_bans']) ?>"> | 162: <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo forum_link($forum_url['admin_bans']) ?>"> |
164: <div class="hidden"> | 163: <div class="hidden"> |
165: <input type="hidden" name="csrf_token" value="<?php echo generate_form_token(forum_link($forum_url['admin_bans'])) ?>" /> | 164: <input type="hidden" name="csrf_token" value="<?php echo generate_form_token(forum_link($forum_url['admin_bans'])) ?>" /> |
166: <input type="hidden" name="mode" value="<?php echo $mode ?>" /> | 165: <input type="hidden" name="mode" value="<?php echo $mode ?>" /> |
167: <?php if ($mode == 'edit'): ?> <input type="hidden" name="ban_id" value="<?php echo $ban_id ?>" /> | 166: <?php if ($mode == 'edit'): ?> |
168: <?php endif; ?> </div> | 167: <input type="hidden" name="ban_id" value="<?php echo $ban_id ?>" /> |
| 168: <?php endif; ?> |
| 169: </div> |
169: <?php ($hook = get_hook('aba_add_edit_ban_pre_criteria_fieldset')) ? eval($hook) : null; ?> | 170: <?php ($hook = get_hook('aba_add_edit_ban_pre_criteria_fieldset')) ? eval($hook) : null; ?> |
170: <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>"> | 171: <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>"> |
171: <legend class="group-legend"><span><?php echo $lang_admin_bans['Ban criteria legend'] ?></span></legend> | 172: <legend class="group-legend"><span><?php echo $lang_admin_bans['Ban criteria legend'] ?></span></legend> |
382: | 383: |
383: // Setup the form | 384: // Setup the form |
384: $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0; | 385: $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0; |
385: $forum_page['form_action'] = forum_link($forum_url['admin_bans']).'?action=more'; | 386: $forum_page['form_action'] = forum_link($forum_url['admin_bans']).'&action=more'; |
386: | 387: |
387: $forum_page['hidden_fields'] = array( | 388: $forum_page['hidden_fields'] = array( |
388: 'csrf_token' => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />' | 389: 'csrf_token' => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />' |
398: $forum_page['crumbs'][] = array($lang_admin_common['Bans'], forum_link($forum_url['admin_bans'])); | 399: $forum_page['crumbs'][] = array($lang_admin_common['Bans'], forum_link($forum_url['admin_bans'])); |
399: | 400: |
400: | 401: |
| 402: // Fetch user count |
| 403: $query = array( |
| 404: 'SELECT' => 'COUNT(id)', |
| 405: 'FROM' => 'bans' |
| 406: ); |
| 407: |
| 408: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 409: $forum_page['num_bans'] = $forum_db->result($result); |
| 410: $forum_page['num_pages'] = ceil($forum_page['num_bans'] / $forum_user['disp_topics']); |
| 411: $forum_page['page'] = (!isset($_GET['p']) || !is_numeric($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $forum_page['num_pages']) ? 1 : intval($_GET['p']); |
| 412: $forum_page['start_from'] = $forum_user['disp_topics'] * ($forum_page['page'] - 1); |
| 413: $forum_page['finish_at'] = min(($forum_page['start_from'] + $forum_user['disp_topics']), ($forum_page['num_bans'])); |
| 414: |
| 415: // Generate paging |
| 416: $forum_page['page_post']['paging']='<p class="paging"><span class="pages">'.$lang_common['Pages'].'</span> '.paginate($forum_page['num_pages'], $forum_page['page'], $forum_url['admin_bans'], $lang_common['Paging separator'], null, true).'</p>'; |
| 417: |
| 418: // Navigation links for header and page numbering for title/meta description |
| 419: if ($forum_page['page'] < $forum_page['num_pages']) |
| 420: { |
| 421: $forum_page['nav']['last'] = '<link rel="last" href="'.forum_sublink($forum_url['admin_bans'], $forum_url['page'], $forum_page['num_pages']).'" title="'.$lang_common['Page'].' '.$forum_page['num_pages'].'" />'; |
| 422: $forum_page['nav']['next'] = '<link rel="next" href="'.forum_sublink($forum_url['admin_bans'], $forum_url['page'], ($forum_page['page'] + 1)).'" title="'.$lang_common['Page'].' '.($forum_page['page'] + 1).'" />'; |
| 423: } |
| 424: if ($forum_page['page'] > 1) |
| 425: { |
| 426: $forum_page['nav']['prev'] = '<link rel="prev" href="'.forum_sublink($forum_url['admin_bans'], $forum_url['page'], ($forum_page['page'] - 1)).'" title="'.$lang_common['Page'].' '.($forum_page['page'] - 1).'" />'; |
| 427: $forum_page['nav']['first'] = '<link rel="first" href="'.forum_link($forum_url['admin_bans']).'" title="'.$lang_common['Page'].' 1" />'; |
| 428: } |
| 429: |
401: ($hook = get_hook('aba_pre_header_load')) ? eval($hook) : null; | 430: ($hook = get_hook('aba_pre_header_load')) ? eval($hook) : null; |
402: | 431: |
403: define('FORUM_PAGE_SECTION', 'users'); | 432: define('FORUM_PAGE_SECTION', 'users'); |
447: <div class="main-content main-frm"> | 476: <div class="main-content main-frm"> |
448: <?php | 477: <?php |
449: | 478: |
450: if (!empty($forum_bans)) | 479: if ($forum_page['num_bans'] > 0) |
451: { | 480: { |
452: | 481: |
453: ?> | 482: ?> |
454: <div class="ct-group"> | 483: <div class="ct-group"> |
455: <?php | 484: <?php |
456: | 485: |
| 486: // Grab the bans |
| 487: $query = array( |
| 488: 'SELECT' => 'b.*, u.username AS ban_creator_username', |
| 489: 'FROM' => 'bans AS b', |
| 490: 'JOINS' => array( |
| 491: array( |
| 492: 'LEFT JOIN' => 'users AS u', |
| 493: 'ON' => 'u.id=b.ban_creator' |
| 494: ) |
| 495: ), |
| 496: 'ORDER BY' => 'b.id', |
| 497: 'LIMIT' => $forum_page['start_from'].', '.$forum_page['finish_at'] |
| 498: ); |
| 499: |
| 500: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 501: |
457: $forum_page['item_num'] = 0; | 502: $forum_page['item_num'] = 0; |
458: foreach ($forum_bans as $ban_key => $cur_ban) | 503: while ($cur_ban = $forum_db->fetch_assoc($result)) |
459: { | 504: { |
460: $forum_page['ban_info'] = array(); | 505: $forum_page['ban_info'] = array(); |
461: $forum_page['ban_creator'] = ($cur_ban['ban_creator_username'] != '') ? '<a href="'.forum_link($forum_url['user'], $cur_ban['ban_creator']).'">'.forum_htmlencode($cur_ban['ban_creator_username']).'</a>' : $lang_admin_common['Unknown']; | 506: $forum_page['ban_creator'] = ($cur_ban['ban_creator_username'] != '') ? '<a href="'.forum_link($forum_url['user'], $cur_ban['ban_creator']).'">'.forum_htmlencode($cur_ban['ban_creator_username']).'</a>' : $lang_admin_common['Unknown']; |
482: <div class="ct-box"> | 527: <div class="ct-box"> |
483: <div class="ct-legend"> | 528: <div class="ct-legend"> |
484: <h3 class=""><span><?php printf($lang_admin_bans['Current ban head'], $forum_page['ban_creator']) ?></span></h3> | 529: <h3 class=""><span><?php printf($lang_admin_bans['Current ban head'], $forum_page['ban_creator']) ?></span></h3> |
485: <p><?php printf($lang_admin_bans['Edit or remove'], '<a href="'.forum_link($forum_url['admin_bans']).'?edit_ban='.$cur_ban['id'].'">'.$lang_admin_bans['Edit ban'].'</a>', '<a href="'.forum_link($forum_url['admin_bans']).'?del_ban='.$cur_ban['id'].'&csrf_token='.generate_form_token('del_ban'.$cur_ban['id']).'">'.$lang_admin_bans['Remove ban'].'</a>') ?></p> | 530: <p><?php printf($lang_admin_bans['Edit or remove'], '<a href="'.forum_link($forum_url['admin_bans']).'&edit_ban='.$cur_ban['id'].'">'.$lang_admin_bans['Edit ban'].'</a>', '<a href="'.forum_link($forum_url['admin_bans']).'&del_ban='.$cur_ban['id'].'&csrf_token='.generate_form_token('del_ban'.$cur_ban['id']).'">'.$lang_admin_bans['Remove ban'].'</a>') ?></p> |
486: </div> | 531: </div> |
487: <?php if (!empty($forum_page['ban_info'])): ?> <ul> | 532: <?php if (!empty($forum_page['ban_info'])): ?> |
| 533: <ul> |
488: <?php echo implode("\n", $forum_page['ban_info'])."\n" ?> | 534: <?php echo implode("\n", $forum_page['ban_info'])."\n" ?> |
489: </ul> | 535: </ul> |
490: <?php endif; ?> </div> | 536: <?php endif; ?> |
| 537: </div> |
491: </div> | 538: </div> |
492: <?php | 539: <?php |
493: | 540: |
punbb-1.3.1/admin/db_update.php |
punbb-1.3.6/admin/db_update.php |
4: * | 4: * |
5: * Updates the database to the latest version. | 5: * Updates the database to the latest version. |
6: * | 6: * |
7: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 7: * @copyright (C) 2008-2011 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
9: * @package PunBB | 9: * @package PunBB |
10: */ | 10: */ |
11: | 11: |
12: | 12: |
13: define('UPDATE_TO', '1.3.1'); | 13: define('UPDATE_TO', '1.3.6'); |
14: define('UPDATE_TO_DB_REVISION', 3); | 14: define('UPDATE_TO_DB_REVISION', 4); |
15: | 15: |
16: // The number of items to process per pageview (lower this if the update script times out during UTF-8 conversion) | 16: // The number of items to process per pageview (lower this if the update script times out during UTF-8 conversion) |
17: define('PER_PAGE', 300); | 17: define('PER_PAGE', 300); |
39: exit('Cannot find config.php, are you sure it exists?'); | 39: exit('Cannot find config.php, are you sure it exists?'); |
40: | 40: |
41: // Enable debug mode | 41: // Enable debug mode |
42: define('FORUM_DEBUG', 1); | 42: if (!defined('FORUM_DEBUG')) |
| 43: define('FORUM_DEBUG', 1); |
43: | 44: |
44: // Turn on full PHP error reporting | 45: // Turn on full PHP error reporting |
45: error_reporting(E_ALL); | 46: error_reporting(E_ALL); |
46: | 47: |
47: // Turn off magic_quotes_runtime | 48: // Turn off magic_quotes_runtime |
48: set_magic_quotes_runtime(0); | 49: if (get_magic_quotes_runtime()) |
| 50: @ini_set('magic_quotes_runtime', false); |
49: | 51: |
50: // Turn off PHP time limit | 52: // Turn off PHP time limit |
51: @set_time_limit(0); | 53: @set_time_limit(0); |
284: $seems_utf8 = true; | 286: $seems_utf8 = true; |
285: | 287: |
286: $query = array( | 288: $query = array( |
287: 'SELECT' => 'MIN(id), MAX(id)', | 289: 'SELECT' => 'MIN(id), MAX(id), COUNT(id)', |
288: 'FROM' => 'posts' | 290: 'FROM' => 'posts' |
289: ); | 291: ); |
290: | 292: |
291: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); | 293: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
292: list($min_id, $max_id) = $forum_db->fetch_row($result); | 294: list($min_id, $max_id, $count_id) = $forum_db->fetch_row($result); |
| 295: |
| 296: if ($count_id == 0) |
| 297: return false; |
293: | 298: |
294: // Get a random soup of data and check if it appears to be UTF-8 | 299: // Get a random soup of data and check if it appears to be UTF-8 |
295: for ($i = 0; $i < 100; ++$i) | 300: for ($i = 0; $i < 100; ++$i) |
408: <div id="brd-main" class="main basic"> | 413: <div id="brd-main" class="main basic"> |
409: | 414: |
410: <div class="main-head"> | 415: <div class="main-head"> |
411: <h1 class="hn"><span>PunBB Database Update : Perform update of database tables</span></h1> | 416: <h1 class="hn"><span>PunBB Database Update: Perform update of database tables</span></h1> |
412: </div> | 417: </div> |
413: | 418: |
414: <div class="main-content frm"> | 419: <div class="main-content frm"> |
416: <ul class="spaced"> | 421: <ul class="spaced"> |
417: <li class="warn"><span><strong>WARNING!</strong> This script will update your PunBB forum database. The update procedure might take anything from a few seconds to a few minutes (or in extreme cases, hours) depending on the speed of the server, the size of the forum database and the number of changes required.</span></li> | 422: <li class="warn"><span><strong>WARNING!</strong> This script will update your PunBB forum database. The update procedure might take anything from a few seconds to a few minutes (or in extreme cases, hours) depending on the speed of the server, the size of the forum database and the number of changes required.</span></li> |
418: <li><span>Do not forget to make a backup of the database before continuing.</span></li> | 423: <li><span>Do not forget to make a backup of the database before continuing.</span></li> |
419: <li><span> Did you read the update instructions in the documentation? If not, start there.</span></li> | 424: <li><span>Did you read the update instructions in the documentation? If not, start there.</span></li> |
420: <?php | 425: <?php |
421: | 426: |
422: if (strpos($cur_version, '1.2') === 0 && (!$db_seems_utf8 || isset($_GET['force']))) | 427: if (strpos($cur_version, '1.2') === 0 && (!$db_seems_utf8 || isset($_GET['force']))) |
725: | 730: |
726: // Make all IP fields VARCHAR(39) to support IPv6 | 731: // Make all IP fields VARCHAR(39) to support IPv6 |
727: $forum_db->alter_field('posts', 'poster_ip', 'VARCHAR(39)', true); | 732: $forum_db->alter_field('posts', 'poster_ip', 'VARCHAR(39)', true); |
728: $forum_db->alter_field('user', 'registration_ip', 'VARCHAR(39)', false, '0.0.0.0'); | 733: $forum_db->alter_field('users', 'registration_ip', 'VARCHAR(39)', false, '0.0.0.0'); |
729: | 734: |
730: // Add the DST option to the users table | 735: // Add the DST option to the users table |
731: $forum_db->add_field('users', 'dst', 'TINYINT(1)', false, 0, 'timezone'); | 736: $forum_db->add_field('users', 'dst', 'TINYINT(1)', false, 0, 'timezone'); |
1165: } | 1170: } |
1166: } | 1171: } |
1167: | 1172: |
| 1173: // Add the index for the post time |
| 1174: if (!$forum_db->index_exists('posts', 'posted_idx')) |
| 1175: $forum_db->add_index('posts', 'posted_idx', array('posted')); |
| 1176: |
1168: // Move any users with the old unverified status to their new group | 1177: // Move any users with the old unverified status to their new group |
1169: $query = array( | 1178: $query = array( |
1170: 'UPDATE' => 'users', | 1179: 'UPDATE' => 'users', |
1203: } | 1212: } |
1204: | 1213: |
1205: // Should we do charset conversion or not? | 1214: // Should we do charset conversion or not? |
1206: if (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) | 1215: if (strpos($cur_version, '1.3') === 0) |
| 1216: $query_str = '?stage=finish'; |
| 1217: elseif (strpos($cur_version, '1.2') === 0 && isset($_GET['convert_charset'])) |
1207: $query_str = '?stage=conv_misc&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; | 1218: $query_str = '?stage=conv_misc&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; |
1208: else | 1219: else |
1209: $query_str = '?stage=conv_tables'; | 1220: $query_str = '?stage=conv_tables'; |
1991: <div class="main-content frm"> | 2002: <div class="main-content frm"> |
1992: <div class="ct-box info-box"> | 2003: <div class="ct-box info-box"> |
1993: <p>Your forum database was updated successfully.</p> | 2004: <p>Your forum database was updated successfully.</p> |
1994: <?php if (isset($new_config) && !$written): ?> <p>In order to complete the process, you must now update your config.php script. <strong>Copy and paste the text in the text box below into the file called config.php in the root directory of your PunBB installation</strong>. The file already exists, so you must edit/overwrite the contents of the old file. You may then <a href="<?php echo $base_url ?>/index.php">go to the forum index</a> once config.php has been updated.</p> | 2005: <?php if (isset($new_config) && !$written): ?> |
1995: <?php else: ?> <p>You may <a href="<?php echo $base_url ?>/index.php">go to the forum index</a> now.</p> | 2006: <p>In order to complete the process, you must now update your config.php script. <strong>Copy and paste the text in the text box below into the file called config.php in the root directory of your PunBB installation</strong>. The file already exists, so you must edit/overwrite the contents of the old file. You may then <a href="<?php echo $base_url ?>/index.php">go to the forum index</a> once config.php has been updated.</p> |
| 2007: <?php else: ?> |
| 2008: <p>You may <a href="<?php echo $base_url ?>/index.php">go to the forum index</a> now.</p> |
1996: <?php endif; ?> </div> | 2009: <?php endif; ?> </div> |
1997: <?php if (isset($new_config) && !$written): ?> <form class="frm-form" action="foo"> | 2010: <?php if (isset($new_config) && !$written): ?> |
| 2011: <form class="frm-form" action="foo"> |
1998: <fieldset class="frm-group group1"> | 2012: <fieldset class="frm-group group1"> |
1999: <legend class="group-legend"><span>New config.php contents</span></legend> | 2013: <legend class="group-legend"><span>New config.php contents</span></legend> |
2000: <div class="txt-set set1"> | 2014: <div class="txt-set set1"> |
punbb-1.3.1/admin/install.php |
punbb-1.3.6/admin/install.php |
4: * | 4: * |
5: * Used to actually install PunBB. | 5: * Used to actually install PunBB. |
6: * | 6: * |
7: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 7: * @copyright (C) 2008-2011 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
9: * @package PunBB | 9: * @package PunBB |
10: */ | 10: */ |
11: | 11: |
12: | 12: |
13: define('FORUM_VERSION', '1.3.1'); | 13: define('FORUM_VERSION', '1.3.6'); |
14: define('FORUM_DB_REVISION', 3); | 14: define('FORUM_DB_REVISION', 4); |
15: define('MIN_PHP_VERSION', '4.3.0'); | 15: define('MIN_PHP_VERSION', '4.3.0'); |
16: define('MIN_MYSQL_VERSION', '4.1.2'); | 16: define('MIN_MYSQL_VERSION', '4.1.2'); |
17: | 17: |
57: return '<?php'."\n\n".'$db_type = \''.$db_type."';\n".'$db_host = \''.$db_host."';\n".'$db_name = \''.addslashes($db_name)."';\n".'$db_username = \''.addslashes($db_username)."';\n".'$db_password = \''.addslashes($db_password)."';\n".'$db_prefix = \''.addslashes($db_prefix)."';\n".'$p_connect = false;'."\n\n".'$base_url = \''.$base_url.'\';'."\n\n".'$cookie_name = '."'".$cookie_name."';\n".'$cookie_domain = '."'';\n".'$cookie_path = '."'/';\n".'$cookie_secure = 0;'."\n\ndefine('FORUM', 1);"; | 57: return '<?php'."\n\n".'$db_type = \''.$db_type."';\n".'$db_host = \''.$db_host."';\n".'$db_name = \''.addslashes($db_name)."';\n".'$db_username = \''.addslashes($db_username)."';\n".'$db_password = \''.addslashes($db_password)."';\n".'$db_prefix = \''.addslashes($db_prefix)."';\n".'$p_connect = false;'."\n\n".'$base_url = \''.$base_url.'\';'."\n\n".'$cookie_name = '."'".$cookie_name."';\n".'$cookie_domain = '."'';\n".'$cookie_path = '."'/';\n".'$cookie_secure = 0;'."\n\ndefine('FORUM', 1);"; |
58: } | 58: } |
59: | 59: |
60: $language = isset($_GET['lang']) ? preg_replace('#[\.\\\/]#', '', $_GET['lang']) : 'English'; | 60: $language = isset($_GET['lang']) ? $_GET['lang'] : (isset($_POST['req_language']) ? forum_trim($_POST['req_language']) : 'English'); |
| 61: $language = preg_replace('#[\.\\\/]#', '', $language); |
61: if (!file_exists(FORUM_ROOT.'lang/'.$language.'/install.php')) | 62: if (!file_exists(FORUM_ROOT.'lang/'.$language.'/install.php')) |
62: exit('The language pack you have chosen doesn\'t seem to exist or is corrupt. Please recheck and try again.'); | 63: exit('The language pack you have chosen doesn\'t seem to exist or is corrupt. Please recheck and try again.'); |
63: | 64: |
64: // Load the language file | 65: // Load the language files |
65: require FORUM_ROOT.'lang/'.$language.'/install.php'; | 66: require FORUM_ROOT.'lang/'.$language.'/install.php'; |
66: | 67: require FORUM_ROOT.'lang/'.$language.'/admin_settings.php'; |
67: | 68: |
68: if (isset($_POST['generate_config'])) | 69: if (isset($_POST['generate_config'])) |
69: { | 70: { |
83: exit; | 84: exit; |
84: } | 85: } |
85: | 86: |
| 87: header('Content-Type: text/html; charset=utf-8'); |
86: | 88: |
87: if (!isset($_POST['form_sent'])) | 89: if (!isset($_POST['form_sent'])) |
88: { | 90: { |
90: $dual_mysql = false; | 92: $dual_mysql = false; |
91: $db_extensions = array(); | 93: $db_extensions = array(); |
92: if (function_exists('mysqli_connect')) | 94: if (function_exists('mysqli_connect')) |
| 95: { |
93: $db_extensions[] = array('mysqli', 'MySQL Improved'); | 96: $db_extensions[] = array('mysqli', 'MySQL Improved'); |
| 97: } |
| 98: |
94: if (function_exists('mysql_connect')) | 99: if (function_exists('mysql_connect')) |
95: { | 100: { |
96: $db_extensions[] = array('mysql', 'MySQL Standard'); | 101: $db_extensions[] = array('mysql', 'MySQL Standard'); |
214: <div class="sf-set set1"> | 219: <div class="sf-set set1"> |
215: <div class="sf-box text required"> | 220: <div class="sf-box text required"> |
216: <label for="fld2"><span><?php echo $lang_install['Database server'] ?> <em><?php echo $lang_install['Required'] ?></em></span> <small><?php echo $lang_install['Database server help'] ?></small></label><br /> | 221: <label for="fld2"><span><?php echo $lang_install['Database server'] ?> <em><?php echo $lang_install['Required'] ?></em></span> <small><?php echo $lang_install['Database server help'] ?></small></label><br /> |
217: <span class="fld-input"><input id="fld2" type="text" name="req_db_host" value="localhost" size="50" maxlength="100" /></span> | 222: <span class="fld-input"><input id="fld2" type="text" name="req_db_host" value="localhost" size="35" maxlength="100" /></span> |
218: </div> | 223: </div> |
219: </div> | 224: </div> |
220: <div class="sf-set set2"> | 225: <div class="sf-set set2"> |
274: <div class="sf-set set4"> | 279: <div class="sf-set set4"> |
275: <div class="sf-box text required"> | 280: <div class="sf-box text required"> |
276: <label for="fld10"><span><?php echo $lang_install['Admin e-mail'] ?> <em><?php echo $lang_install['Required'] ?></em></span> <small><?php echo $lang_install['E-mail address help'] ?></small></label><br /> | 281: <label for="fld10"><span><?php echo $lang_install['Admin e-mail'] ?> <em><?php echo $lang_install['Required'] ?></em></span> <small><?php echo $lang_install['E-mail address help'] ?></small></label><br /> |
277: <span class="fld-input"><input id="fld10" type="text" name="req_email" size="50" maxlength="80" /></span> | 282: <span class="fld-input"><input id="fld10" type="text" name="req_email" size="35" maxlength="80" /></span> |
278: </div> | 283: </div> |
279: </div> | 284: </div> |
280: </fieldset> | 285: </fieldset> |
295: <div class="sf-set set1"> | 300: <div class="sf-set set1"> |
296: <div class="sf-box text"> | 301: <div class="sf-box text"> |
297: <label for="fld11"><span><?php echo $lang_install['Board title'] ?></span></label><br /> | 302: <label for="fld11"><span><?php echo $lang_install['Board title'] ?></span></label><br /> |
298: <span class="fld-input"><input id="fld11" type="text" name="board_title" size="50" maxlength="255" /></span> | 303: <span class="fld-input"><input id="fld11" type="text" name="board_title" size="35" maxlength="255" /></span> |
299: </div> | 304: </div> |
300: </div> | 305: </div> |
301: <div class="sf-set set2"> | 306: <div class="sf-set set2"> |
302: <div class="sf-box text"> | 307: <div class="sf-box text"> |
303: <label for="fld12"><span><?php echo $lang_install['Board description'] ?></span></label><br /> | 308: <label for="fld12"><span><?php echo $lang_install['Board description'] ?></span></label><br /> |
304: <span class="fld-input"><input id="fld12" type="text" name="board_descrip" size="50" maxlength="255" /></span> | 309: <span class="fld-input"><input id="fld12" type="text" name="board_descrip" size="35" maxlength="255" /></span> |
305: </div> | 310: </div> |
306: </div> | 311: </div> |
307: <div class="sf-set set3"> | 312: <div class="sf-set set3"> |
308: <div class="sf-box text required"> | 313: <div class="sf-box text required"> |
309: <label for="fld13"><span><?php echo $lang_install['Base URL'] ?> <em><?php echo $lang_install['Required'] ?></em></span> <small><?php echo $lang_install['Base URL help'] ?></small></label><br /> | 314: <label for="fld13"><span><?php echo $lang_install['Base URL'] ?> <em><?php echo $lang_install['Required'] ?></em></span> <small><?php echo $lang_install['Base URL help'] ?></small></label><br /> |
310: <span class="fld-input"><input id="fld13" type="text" name="req_base_url" value="<?php echo $base_url_guess ?>" size="60" maxlength="100" /></span> | 315: <span class="fld-input"><input id="fld13" type="text" name="req_base_url" value="<?php echo $base_url_guess ?>" size="35" maxlength="100" /></span> |
311: </div> | 316: </div> |
312: </div> | 317: </div> |
313: <?php | 318: <?php |
459: break; | 464: break; |
460: | 465: |
461: default: | 466: default: |
462: error(sprintf($lang_install['No such database type'], $db_type)); | 467: error(sprintf($lang_install['No such database type'], forum_htmlencode($db_type))); |
463: } | 468: } |
464: | 469: |
465: // Create the database object (and connect/select db) | 470: // Create the database object (and connect/select db) |
471: { | 476: { |
472: $mysql_info = $forum_db->get_version(); | 477: $mysql_info = $forum_db->get_version(); |
473: if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) | 478: if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) |
474: error(sprintf($lang_install['Invalid MySQL version'], $mysql_version, MIN_MYSQL_VERSION)); | 479: error(sprintf($lang_install['Invalid MySQL version'], forum_htmlencode($mysql_info['version']), MIN_MYSQL_VERSION)); |
475: } | 480: } |
476: | 481: |
477: // Validate prefix | 482: // Validate prefix |
1018: 'PRIMARY KEY' => array('id'), | 1023: 'PRIMARY KEY' => array('id'), |
1019: 'INDEXES' => array( | 1024: 'INDEXES' => array( |
1020: 'topic_id_idx' => array('topic_id'), | 1025: 'topic_id_idx' => array('topic_id'), |
1021: 'multi_idx' => array('poster_id', 'topic_id') | 1026: 'multi_idx' => array('poster_id', 'topic_id'), |
| 1027: 'posted_idx' => array('posted') |
1022: ) | 1028: ) |
1023: ); | 1029: ); |
1024: | 1030: |
1600: 'o_date_format' => "'Y-m-d'", | 1606: 'o_date_format' => "'Y-m-d'", |
1601: 'o_check_for_updates' => "'$check_for_updates'", | 1607: 'o_check_for_updates' => "'$check_for_updates'", |
1602: 'o_check_for_versions' => "'$check_for_updates'", | 1608: 'o_check_for_versions' => "'$check_for_updates'", |
1603: 'o_timeout_visit' => "'1800'", | 1609: 'o_timeout_visit' => "'5400'", |
1604: 'o_timeout_online' => "'300'", | 1610: 'o_timeout_online' => "'300'", |
1605: 'o_redirect_delay' => "'1'", | 1611: 'o_redirect_delay' => "'1'", |
1606: 'o_show_version' => "'0'", | 1612: 'o_show_version' => "'0'", |
1653: 'o_rules' => "'0'", | 1659: 'o_rules' => "'0'", |
1654: 'o_rules_message' => "'".$lang_install['Default rules']."'", | 1660: 'o_rules_message' => "'".$lang_install['Default rules']."'", |
1655: 'o_maintenance' => "'0'", | 1661: 'o_maintenance' => "'0'", |
1656: 'o_maintenance_message' => "'".$lang_install['Default maint message']."'", | 1662: 'o_maintenance_message' => "'".$lang_admin_settings['Maintenance message default']."'", |
1657: 'o_default_dst' => "'0'", | 1663: 'o_default_dst' => "'0'", |
1658: 'p_message_bbcode' => "'1'", | 1664: 'p_message_bbcode' => "'1'", |
1659: 'p_message_img_tag' => "'1'", | 1665: 'p_message_img_tag' => "'1'", |
1744: | 1750: |
1745: | 1751: |
1746: $alerts = array(); | 1752: $alerts = array(); |
| 1753: |
1747: // Check if the cache directory is writable | 1754: // Check if the cache directory is writable |
1748: if (!is_writable('./cache/')) | 1755: if (!is_writable(FORUM_ROOT.'cache/')) |
1749: $alerts[] = '<li>'.$lang_install['No cache write'].'</li>'; | 1756: $alerts[] = '<li><span>'.$lang_install['No cache write'].'</span></li>'; |
1750: | 1757: |
1751: // Check if default avatar directory is writable | 1758: // Check if default avatar directory is writable |
1752: if (!is_writable('./img/avatars/')) | 1759: if (!is_writable(FORUM_ROOT.'img/avatars/')) |
1753: $alerts[] = '<li>'.$lang_install['No avatar write'].'</li>'; | 1760: $alerts[] = '<li><span>'.$lang_install['No avatar write'].'</span></li>'; |
1754: | 1761: |
1755: // Check if we disabled uploading avatars because file_uploads was disabled | 1762: // Check if we disabled uploading avatars because file_uploads was disabled |
1756: if ($avatars == '0') | 1763: if ($avatars == '0') |
1757: $alerts[] = '<li>'.$lang_install['File upload alert'].'</li>'; | 1764: $alerts[] = '<li><span>'.$lang_install['File upload alert'].'</span></li>'; |
1758: | 1765: |
1759: // Add some random bytes at the end of the cookie name to prevent collisions | 1766: // Add some random bytes at the end of the cookie name to prevent collisions |
1760: $cookie_name = 'forum_cookie_'.random_key(6, false, true); | 1767: $cookie_name = 'forum_cookie_'.random_key(6, false, true); |
1841: <p><?php echo $lang_install['Success welcome'] ?></p> | 1848: <p><?php echo $lang_install['Success welcome'] ?></p> |
1842: </div> | 1849: </div> |
1843: | 1850: |
1844: <?php | |
1845: ?> | |
1846: | |
1847: <div id="brd-main" class="main basic"> | 1851: <div id="brd-main" class="main basic"> |
1848: | 1852: |
1849: <div class="main-head"> | 1853: <div class="main-head"> |
1851: </div> | 1855: </div> |
1852: | 1856: |
1853: <div class="main-content main-frm"> | 1857: <div class="main-content main-frm"> |
1854: <?php | 1858: <?php if (!empty($alerts)): ?> |
| 1859: <div class="ct-box error-box"> |
| 1860: <p class="warn"><strong><?php echo $lang_install['Warning'] ?></strong></p> |
| 1861: <ul> |
| 1862: <?php echo implode("\n\t\t\t\t", $alerts)."\n" ?> |
| 1863: </ul> |
| 1864: </div> |
| 1865: <?php endif; |
1855: | 1866: |
1856: if (!$written) | 1867: if (!$written) |
1857: { | 1868: { |
1861: <p class="warn"><?php echo $lang_install['No write info 1'] ?></p> | 1872: <p class="warn"><?php echo $lang_install['No write info 1'] ?></p> |
1862: <p class="warn"><?php printf($lang_install['No write info 2'], '<a href="'.FORUM_ROOT.'index.php">'.$lang_install['Go to index'].'</a>') ?></p> | 1873: <p class="warn"><?php printf($lang_install['No write info 2'], '<a href="'.FORUM_ROOT.'index.php">'.$lang_install['Go to index'].'</a>') ?></p> |
1863: </div> | 1874: </div> |
1864: <?php if (!empty($alerts)): ?> | |
1865: <div class="ct-box error-box"> | |
1866: <p class="warn"><strong><?php echo $lang_install['Warning'] ?></strong></p> | |
1867: <ul> | |
1868: <?php echo implode("\n\t\t\t\t", $alerts)."\n" ?> | |
1869: </ul> | |
1870: </div> | |
1871: <?php endif; ?> | |
1872: <form class="frm-form" method="post" accept-charset="utf-8" action="install.php"> | 1875: <form class="frm-form" method="post" accept-charset="utf-8" action="install.php"> |
1873: <div class="hidden"> | 1876: <div class="hidden"> |
1874: <input type="hidden" name="generate_config" value="1" /> | 1877: <input type="hidden" name="generate_config" value="1" /> |
punbb-1.3.1/admin/users.php |
punbb-1.3.6/admin/users.php |
4: * | 4: * |
5: * Allows administrators or moderators to search the existing users based on various criteria. | 5: * Allows administrators or moderators to search the existing users based on various criteria. |
6: * | 6: * |
7: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 7: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 8: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
9: * @package PunBB | 9: * @package PunBB |
10: */ | 10: */ |
812: } | 812: } |
813: | 813: |
814: | 814: |
815: else if (isset($_POST['find_user'])) | 815: else if (isset($_GET['find_user'])) |
816: { | 816: { |
817: $form = $_POST['form']; | 817: $form = isset($_GET['form']) ? $_GET['form'] : array(); |
818: $form['username'] = $_POST['username']; | 818: |
| 819: // trim() all elements in $form |
| 820: $form = array_map('forum_trim', $form); |
| 821: $conditions = $query_str = array(); |
| 822: |
| 823: //Check up for order_by and direction values |
| 824: $order_by = isset($_GET['order_by']) ? forum_trim($_GET['order_by']) : null; |
| 825: $direction = isset($_GET['direction']) ? forum_trim($_GET['direction']) : null; |
| 826: if ($order_by == null || $direction == null) |
| 827: message($lang_common['Bad request']); |
| 828: |
| 829: if (!in_array($order_by, array('username', 'email', 'num_posts', 'num_posts', 'registered')) || !in_array($direction, array('ASC', 'DESC'))) |
| 830: message($lang_common['Bad request']); |
819: | 831: |
820: ($hook = get_hook('aus_find_user_selected')) ? eval($hook) : null; | 832: ($hook = get_hook('aus_find_user_selected')) ? eval($hook) : null; |
821: | 833: |
822: // forum_trim() all elements in $form | 834: $query_str[] = 'order_by='.$order_by; |
823: $form = array_map('trim', $form); | 835: $query_str[] = 'direction='.$direction; |
824: $conditions = array(); | 836: |
825: | 837: $posts_greater = isset($_GET['posts_greater']) ? forum_trim($_GET['posts_greater']) : ''; |
826: $posts_greater = forum_trim($_POST['posts_greater']); | 838: $posts_less = isset($_GET['posts_less']) ? forum_trim($_GET['posts_less']) : ''; |
827: $posts_less = forum_trim($_POST['posts_less']); | 839: $last_post_after = isset($_GET['last_post_after']) ? forum_trim($_GET['last_post_after']) : ''; |
828: $last_post_after = forum_trim($_POST['last_post_after']); | 840: $last_post_before = isset($_GET['last_post_before']) ? forum_trim($_GET['last_post_before']) : ''; |
829: $last_post_before = forum_trim($_POST['last_post_before']); | 841: $registered_after = isset($_GET['registered_after']) ? forum_trim($_GET['registered_after']) : ''; |
830: $registered_after = forum_trim($_POST['registered_after']); | 842: $registered_before = isset($_GET['registered_before']) ? forum_trim($_GET['registered_before']) : ''; |
831: $registered_before = forum_trim($_POST['registered_before']); | 843: $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; |
832: $order_by = $_POST['order_by']; | 844: |
833: $direction = $_POST['direction']; | 845: $query_str[] = 'user_group='.$user_group; |
834: $user_group = $_POST['user_group']; | |
835: | 846: |
836: if ((!empty($posts_greater) || !empty($posts_less)) && !ctype_digit($posts_greater.$posts_less)) | 847: if ((!empty($posts_greater) || !empty($posts_less)) && !ctype_digit($posts_greater.$posts_less)) |
837: message($lang_admin_users['Non numeric value message']); | 848: message($lang_admin_users['Non numeric value message']); |
838: | 849: |
839: // Try to convert date/time to timestamps | 850: // Try to convert date/time to timestamps |
840: if ($last_post_after != '') | 851: if ($last_post_after != '') |
841: $last_post_after = strtotime($last_post_after); | 852: { |
842: if ($last_post_before != '') | 853: $query_str[] = 'last_post_after='.$last_post_after; |
843: $last_post_before = strtotime($last_post_before); | |
844: if ($registered_after != '') | |
845: $registered_after = strtotime($registered_after); | |
846: if ($registered_before != '') | |
847: $registered_before = strtotime($registered_before); | |
848: | 854: |
849: if ($last_post_after == -1 || $last_post_before == -1 || $registered_after == -1 || $registered_before == -1) | 855: $last_post_after = strtotime($last_post_after); |
850: message($lang_admin_users['Invalid date/time message']); | 856: if ($last_post_after === false || $last_post_after == -1) |
| 857: message($lang_admin_users['Invalid date/time message']); |
851: | 858: |
852: if ($last_post_after != '') | |
853: $conditions[] = 'u.last_post>'.$last_post_after; | 859: $conditions[] = 'u.last_post>'.$last_post_after; |
| 860: } |
854: if ($last_post_before != '') | 861: if ($last_post_before != '') |
| 862: { |
| 863: $query_str[] = 'last_post_before='.$last_post_before; |
| 864: |
| 865: $last_post_before = strtotime($last_post_before); |
| 866: if ($last_post_before === false || $last_post_before == -1) |
| 867: message($lang_admin_users['Invalid date/time message']); |
| 868: |
855: $conditions[] = 'u.last_post<'.$last_post_before; | 869: $conditions[] = 'u.last_post<'.$last_post_before; |
| 870: } |
856: if ($registered_after != '') | 871: if ($registered_after != '') |
| 872: { |
| 873: $query_str[] = 'registered_after='.$registered_after; |
| 874: |
| 875: $registered_after = strtotime($registered_after); |
| 876: if ($registered_after === false || $registered_after == -1) |
| 877: message($lang_admin_users['Invalid date/time message']); |
| 878: |
857: $conditions[] = 'u.registered>'.$registered_after; | 879: $conditions[] = 'u.registered>'.$registered_after; |
| 880: } |
858: if ($registered_before != '') | 881: if ($registered_before != '') |
| 882: { |
| 883: $query_str[] = 'registered_before='.$registered_before; |
| 884: |
| 885: $registered_before = strtotime($registered_before); |
| 886: if ($registered_before === false || $registered_before == -1) |
| 887: message($lang_admin_users['Invalid date/time message']); |
| 888: |
859: $conditions[] = 'u.registered<'.$registered_before; | 889: $conditions[] = 'u.registered<'.$registered_before; |
| 890: } |
860: | 891: |
861: $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; | 892: $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; |
862: foreach ($form as $key => $input) | 893: foreach ($form as $key => $input) |
863: { | 894: { |
864: if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note'))) | 895: if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note'))) |
| 896: { |
865: $conditions[] = 'u.'.$forum_db->escape($key).' '.$like_command.' \''.$forum_db->escape(str_replace('*', '%', $input)).'\''; | 897: $conditions[] = 'u.'.$forum_db->escape($key).' '.$like_command.' \''.$forum_db->escape(str_replace('*', '%', $input)).'\''; |
| 898: $query_str[] = 'form%5B'.$key.'%5D='.urlencode($input); |
| 899: } |
866: } | 900: } |
867: | 901: |
868: if ($posts_greater != '') | 902: if ($posts_greater != '') |
| 903: { |
| 904: $query_str[] = 'posts_greater='.$posts_greater; |
869: $conditions[] = 'u.num_posts>'.$posts_greater; | 905: $conditions[] = 'u.num_posts>'.$posts_greater; |
| 906: } |
870: if ($posts_less != '') | 907: if ($posts_less != '') |
| 908: { |
| 909: $query_str[] = 'posts_less='.$posts_less; |
871: $conditions[] = 'u.num_posts<'.$posts_less; | 910: $conditions[] = 'u.num_posts<'.$posts_less; |
| 911: } |
872: | 912: |
873: if ($user_group != 'all') | 913: if ($user_group > -1) |
874: $conditions[] = 'u.group_id='.intval($user_group); | 914: $conditions[] = 'u.group_id='.intval($user_group); |
875: | 915: |
876: if (empty($conditions)) | 916: if (empty($conditions)) |
877: message($lang_admin_users['No search terms message']); | 917: message($lang_admin_users['No search terms message']); |
878: | 918: |
879: | |
880: // Load the misc.php language file | 919: // Load the misc.php language file |
881: require FORUM_ROOT.'lang/'.$forum_user['language'].'/misc.php'; | 920: require FORUM_ROOT.'lang/'.$forum_user['language'].'/misc.php'; |
882: | 921: |
883: // Find any users matching the conditions | 922: // Fetch user count |
884: $query = array( | 923: $query = array( |
885: 'SELECT' => 'u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title', | 924: 'SELECT' => 'COUNT(id)', |
886: 'FROM' => 'users AS u', | 925: 'FROM' => 'users AS u', |
887: 'JOINS' => array( | 926: 'JOINS' => array( |
888: array( | 927: array( |
890: 'ON' => 'g.g_id=u.group_id' | 929: 'ON' => 'g.g_id=u.group_id' |
891: ) | 930: ) |
892: ), | 931: ), |
893: 'WHERE' => 'u.id>1 AND '.implode(' AND ', $conditions), | 932: 'WHERE' => 'u.id>1 AND '.implode(' AND ', $conditions) |
894: 'ORDER BY' => $forum_db->escape($order_by).' '.$forum_db->escape($direction) | |
895: ); | 933: ); |
896: | 934: |
897: ($hook = get_hook('aus_find_user_qr_find_users')) ? eval($hook) : null; | 935: ($hook = get_hook('aus_find_user_qr_count_find_users')) ? eval($hook) : null; |
898: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); | |
899: $forum_page['num_users'] = $forum_db->num_rows($result); | |
900: | 936: |
| 937: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 938: $forum_page['num_users'] = $forum_db->result($result); |
| 939: $forum_page['num_pages'] = ceil($forum_page['num_users'] / $forum_user['disp_topics']); |
| 940: $forum_page['page'] = (!isset($_GET['p']) || !is_numeric($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $forum_page['num_pages']) ? 1 : $_GET['p']; |
| 941: $forum_page['start_from'] = $forum_user['disp_topics'] * ($forum_page['page'] - 1); |
| 942: $forum_page['finish_at'] = min(($forum_page['start_from'] + $forum_user['disp_topics']), ($forum_page['num_users'])); |
901: | 943: |
902: // Setup breadcrumbs | 944: // Setup breadcrumbs |
903: $forum_page['crumbs'] = array( | 945: $forum_page['crumbs'] = array( |
909: $forum_page['crumbs'][] = array($lang_admin_common['Searches'], forum_link($forum_url['admin_users'])); | 951: $forum_page['crumbs'][] = array($lang_admin_common['Searches'], forum_link($forum_url['admin_users'])); |
910: $forum_page['crumbs'][] = $lang_admin_users['User search results']; | 952: $forum_page['crumbs'][] = $lang_admin_users['User search results']; |
911: | 953: |
| 954: // Generate paging |
| 955: $forum_page['page_post']['paging'] = '<p class="paging"><span class="pages">'.$lang_common['Pages'].'</span> '.paginate($forum_page['num_pages'], $forum_page['page'], $forum_url['admin_users'].'?find_user=&'.implode('&', $query_str), $lang_common['Paging separator'], null, true).'</p>'; |
| 956: |
912: ($hook = get_hook('aus_find_user_pre_header_load')) ? eval($hook) : null; | 957: ($hook = get_hook('aus_find_user_pre_header_load')) ? eval($hook) : null; |
913: | 958: |
914: define('FORUM_PAGE_SECTION', 'users'); | 959: define('FORUM_PAGE_SECTION', 'users'); |
955: <tbody> | 1000: <tbody> |
956: <?php | 1001: <?php |
957: | 1002: |
| 1003: // Find any users matching the conditions |
| 1004: $query = array( |
| 1005: 'SELECT' => 'u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title', |
| 1006: 'FROM' => 'users AS u', |
| 1007: 'JOINS' => array( |
| 1008: array( |
| 1009: 'LEFT JOIN' => 'groups AS g', |
| 1010: 'ON' => 'g.g_id=u.group_id' |
| 1011: ) |
| 1012: ), |
| 1013: 'WHERE' => 'u.id>1 AND '.implode(' AND ', $conditions), |
| 1014: 'ORDER BY' => $order_by.' '.$direction, |
| 1015: 'LIMIT' => $forum_page['start_from'].', '.$forum_page['finish_at'] |
| 1016: ); |
| 1017: |
| 1018: ($hook = get_hook('aus_find_user_qr_find_users')) ? eval($hook) : null; |
| 1019: |
| 1020: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 1021: |
958: if ($forum_page['num_users'] > 0) | 1022: if ($forum_page['num_users'] > 0) |
959: { | 1023: { |
960: $forum_page['item_count'] = 0; | 1024: $forum_page['item_count'] = 0; |
1075: | 1139: |
1076: // Setup form | 1140: // Setup form |
1077: $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0; | 1141: $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0; |
1078: $forum_page['form_action'] = ''; | |
1079: | 1142: |
1080: // Setup breadcrumbs | 1143: // Setup breadcrumbs |
1081: $forum_page['crumbs'] = array( | 1144: $forum_page['crumbs'] = array( |
1102: <h2 class="hn"><span><?php echo $lang_admin_users['Search head'] ?></span></h2> | 1165: <h2 class="hn"><span><?php echo $lang_admin_users['Search head'] ?></span></h2> |
1103: </div> | 1166: </div> |
1104: <div class="main-content main-frm"> | 1167: <div class="main-content main-frm"> |
1105: <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo forum_link($forum_url['admin_users']) ?>?action=find_user"> | 1168: <form class="frm-form" method="get" accept-charset="utf-8" action="<?php echo forum_link($forum_url['admin_users']) ?>"> |
1106: <div class="hidden"> | 1169: <div class="hidden"> |
1107: <input type="hidden" name="csrf_token" value="<?php echo generate_form_token(forum_link($forum_url['admin_users']).'?action=find_user') ?>" /> | 1170: <input type="hidden" name="csrf_token" value="<?php echo generate_form_token(forum_link($forum_url['admin_users']).'?action=find_user') ?>" /> |
1108: </div> | 1171: </div> |
1116: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1179: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1117: <div class="sf-box text"> | 1180: <div class="sf-box text"> |
1118: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Username label'] ?></span></label><br /> | 1181: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Username label'] ?></span></label><br /> |
1119: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="username" size="25" maxlength="25" /></span> | 1182: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[username]" size="35" maxlength="25" /></span> |
1120: </div> | 1183: </div> |
1121: </div> | 1184: </div> |
1122: <?php ($hook = get_hook('aus_search_form_pre_user_title')) ? eval($hook) : null; ?> | 1185: <?php ($hook = get_hook('aus_search_form_pre_user_title')) ? eval($hook) : null; ?> |
1123: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1186: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1124: <div class="sf-box text"> | 1187: <div class="sf-box text"> |
1125: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Title label'] ?></span></label><br /> | 1188: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Title label'] ?></span></label><br /> |
1126: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[title]" size="30" maxlength="50" /></span> | 1189: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[title]" size="35" maxlength="50" /></span> |
1127: </div> | 1190: </div> |
1128: </div> | 1191: </div> |
1129: <?php ($hook = get_hook('aus_search_form_pre_realname')) ? eval($hook) : null; ?> | 1192: <?php ($hook = get_hook('aus_search_form_pre_realname')) ? eval($hook) : null; ?> |
1130: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1193: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1131: <div class="sf-box text"> | 1194: <div class="sf-box text"> |
1132: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Real name label'] ?></span></label><br /> | 1195: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Real name label'] ?></span></label><br /> |
1133: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[realname]" size="30" maxlength="40" /></span> | 1196: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[realname]" size="35" maxlength="40" /></span> |
1134: </div> | 1197: </div> |
1135: </div> | 1198: </div> |
1136: <?php ($hook = get_hook('aus_search_form_pre_location')) ? eval($hook) : null; ?> | 1199: <?php ($hook = get_hook('aus_search_form_pre_location')) ? eval($hook) : null; ?> |
1137: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1200: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1138: <div class="sf-box text"> | 1201: <div class="sf-box text"> |
1139: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Location label'] ?></span></label><br /> | 1202: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Location label'] ?></span></label><br /> |
1140: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[location]" size="30" maxlength="30" /></span> | 1203: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[location]" size="35" maxlength="30" /></span> |
1141: </div> | 1204: </div> |
1142: </div> | 1205: </div> |
1143: <?php ($hook = get_hook('aus_search_form_pre_signature')) ? eval($hook) : null; ?> | 1206: <?php ($hook = get_hook('aus_search_form_pre_signature')) ? eval($hook) : null; ?> |
1151: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1214: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1152: <div class="sf-box text"> | 1215: <div class="sf-box text"> |
1153: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Admin note label'] ?></span></label><br /> | 1216: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Admin note label'] ?></span></label><br /> |
1154: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[admin_note]" size="30" maxlength="30" /></span> | 1217: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[admin_note]" size="35" maxlength="30" /></span> |
1155: </div> | 1218: </div> |
1156: </div> | 1219: </div> |
1157: <?php ($hook = get_hook('aus_search_form_pre_user_details_fieldset_end')) ? eval($hook) : null; ?> | 1220: <?php ($hook = get_hook('aus_search_form_pre_user_details_fieldset_end')) ? eval($hook) : null; ?> |
1165: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1228: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1166: <div class="sf-box text"> | 1229: <div class="sf-box text"> |
1167: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['E-mail address label'] ?></span></label><br /> | 1230: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['E-mail address label'] ?></span></label><br /> |
1168: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[email]" size="30" maxlength="80" /></span> | 1231: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[email]" size="35" maxlength="80" /></span> |
1169: </div> | 1232: </div> |
1170: </div> | 1233: </div> |
1171: <?php ($hook = get_hook('aus_search_form_pre_website')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1234: <?php ($hook = get_hook('aus_search_form_pre_website')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1177: <?php ($hook = get_hook('aus_search_form_pre_jabber')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1240: <?php ($hook = get_hook('aus_search_form_pre_jabber')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1178: <div class="sf-box text"> | 1241: <div class="sf-box text"> |
1179: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Jabber label'] ?></span></label><br /> | 1242: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['Jabber label'] ?></span></label><br /> |
1180: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[jabber]" size="30" maxlength="80" /></span> | 1243: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[jabber]" size="35" maxlength="80" /></span> |
1181: </div> | 1244: </div> |
1182: </div> | 1245: </div> |
1183: <?php ($hook = get_hook('aus_search_form_pre_icq')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1246: <?php ($hook = get_hook('aus_search_form_pre_icq')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1189: <?php ($hook = get_hook('aus_search_form_pre_msn')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1252: <?php ($hook = get_hook('aus_search_form_pre_msn')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1190: <div class="sf-box text"> | 1253: <div class="sf-box text"> |
1191: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['MSN Messenger label'] ?></span></label><br /> | 1254: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['MSN Messenger label'] ?></span></label><br /> |
1192: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[msn]" size="30" maxlength="80" /></span> | 1255: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[msn]" size="35" maxlength="80" /></span> |
1193: </div> | 1256: </div> |
1194: </div> | 1257: </div> |
1195: <?php ($hook = get_hook('aus_search_form_pre_aim')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1258: <?php ($hook = get_hook('aus_search_form_pre_aim')) ? eval($hook) : null; ?> <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1298: <div class="sf-box select"> | 1361: <div class="sf-box select"> |
1299: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['User group label'] ?></span></label><br /> | 1362: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_admin_users['User group label'] ?></span></label><br /> |
1300: <span class="fld-input"><select id="fld<?php echo $forum_page['fld_count'] ?>" name="user_group"> | 1363: <span class="fld-input"><select id="fld<?php echo $forum_page['fld_count'] ?>" name="user_group"> |
1301: <option value="all" selected="selected"><?php echo $lang_admin_users['All groups'] ?></option> | 1364: <option value="-1" selected="selected"><?php echo $lang_admin_users['All groups'] ?></option> |
1302: <option value="<?php echo FORUM_UNVERIFIED ?>"><?php echo $lang_admin_users['Unverified users'] ?></option> | 1365: <option value="<?php echo FORUM_UNVERIFIED ?>"><?php echo $lang_admin_users['Unverified users'] ?></option> |
1303: <?php | 1366: <?php |
1304: | 1367: |
punbb-1.3.1/extern.php |
punbb-1.3.6/extern.php |
5: * Allows forum content to be syndicated outside of the site in various formats | 5: * Allows forum content to be syndicated outside of the site in various formats |
6: * (ie: RSS, Atom, XML, HTML). | 6: * (ie: RSS, Atom, XML, HTML). |
7: * | 7: * |
8: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 8: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
9: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 9: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
10: * @package PunBB | 10: * @package PunBB |
11: */ | 11: */ |
120: else | 120: else |
121: echo "\t\t".'<generator>PunBB</generator>'."\n"; | 121: echo "\t\t".'<generator>PunBB</generator>'."\n"; |
122: | 122: |
123: foreach ($feed['items'] as $item) | 123: ($hook = get_hook('ex_add_new_rss_info')) ? eval($hook) : null; |
124: | 124: |
| 125: foreach ($feed['items'] as $item) |
125: { | 126: { |
126: echo "\t\t".'<item>'."\n"; | 127: echo "\t\t".'<item>'."\n"; |
127: echo "\t\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; | 128: echo "\t\t\t".'<title><![CDATA['.escape_cdata($item['title']).']]></title>'."\n"; |
128: echo "\t\t\t".'<link>'.$item['link'].'</link>'."\n"; | 129: echo "\t\t\t".'<link>'.$item['link'].'</link>'."\n"; |
129: echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n"; | 130: echo "\t\t\t".'<description><![CDATA['.escape_cdata($item['description']).']]></description>'."\n"; |
130: echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'dummy@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n"; | 131: echo "\t\t\t".'<author><![CDATA['.(isset($item['author']['email']) ? escape_cdata($item['author']['email']) : 'null@example.com').' ('.escape_cdata($item['author']['name']).')]]></author>'."\n"; |
131: echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; | 132: echo "\t\t\t".'<pubDate>'.gmdate('r', $item['pubdate']).'</pubDate>'."\n"; |
132: echo "\t\t\t".'<guid>'.$item['link'].'</guid>'."\n"; | 133: echo "\t\t\t".'<guid>'.$item['link'].'</guid>'."\n"; |
133: | 134: |
| 135: ($hook = get_hook('ex_add_new_rss_item_info')) ? eval($hook) : null; |
| 136: |
134: echo "\t\t".'</item>'."\n"; | 137: echo "\t\t".'</item>'."\n"; |
135: } | 138: } |
136: | 139: |
164: else | 167: else |
165: echo "\t".'<generator>PunBB</generator>'."\n"; | 168: echo "\t".'<generator>PunBB</generator>'."\n"; |
166: | 169: |
| 170: ($hook = get_hook('ex_add_new_atom_info')) ? eval($hook) : null; |
| 171: |
167: echo "\t".'<id>'.$feed['link'].'</id>'."\n"; | 172: echo "\t".'<id>'.$feed['link'].'</id>'."\n"; |
168: | 173: |
169: $content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary'; | 174: $content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary'; |
186: echo "\t\t\t".'</author>'."\n"; | 191: echo "\t\t\t".'</author>'."\n"; |
187: echo "\t\t\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', $item['pubdate']).'</updated>'."\n"; | 192: echo "\t\t\t".'<updated>'.gmdate('Y-m-d\TH:i:s\Z', $item['pubdate']).'</updated>'."\n"; |
188: | 193: |
| 194: ($hook = get_hook('ex_add_new_atom_item_info')) ? eval($hook) : null; |
| 195: |
189: echo "\t\t\t".'<id>'.$item['link'].'</id>'."\n"; | 196: echo "\t\t\t".'<id>'.$item['link'].'</id>'."\n"; |
190: echo "\t\t".'</entry>'."\n"; | 197: echo "\t\t".'</entry>'."\n"; |
191: } | 198: } |
202: global $lang_common, $forum_config; | 209: global $lang_common, $forum_config; |
203: | 210: |
204: // Send XML/no cache headers | 211: // Send XML/no cache headers |
205: header('Content-Type: text/xml; charset=utf-8'); | 212: header('Content-Type: application/xml; charset=utf-8'); |
206: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); | 213: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); |
207: header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | 214: header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
208: header('Pragma: public'); | 215: header('Pragma: public'); |
211: echo '<source>'."\n"; | 218: echo '<source>'."\n"; |
212: echo "\t".'<url>'.$feed['link'].'</url>'."\n"; | 219: echo "\t".'<url>'.$feed['link'].'</url>'."\n"; |
213: | 220: |
| 221: ($hook = get_hook('ex_add_new_xml_info')) ? eval($hook) : null; |
| 222: |
214: $forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic'; | 223: $forum_tag = ($feed['type'] == 'posts') ? 'post' : 'topic'; |
215: | 224: |
216: foreach ($feed['items'] as $item) | 225: foreach ($feed['items'] as $item) |
232: echo "\t\t".'</author>'."\n"; | 241: echo "\t\t".'</author>'."\n"; |
233: echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n"; | 242: echo "\t\t".'<posted>'.gmdate('r', $item['pubdate']).'</posted>'."\n"; |
234: | 243: |
| 244: ($hook = get_hook('ex_add_new_xml_item_info')) ? eval($hook) : null; |
| 245: |
235: echo "\t".'</'.$forum_tag.'>'."\n"; | 246: echo "\t".'</'.$forum_tag.'>'."\n"; |
236: } | 247: } |
237: | 248: |
247: | 258: |
248: // Send the Content-type header in case the web server is setup to send something else | 259: // Send the Content-type header in case the web server is setup to send something else |
249: header('Content-type: text/html; charset=utf-8'); | 260: header('Content-type: text/html; charset=utf-8'); |
| 261: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); |
| 262: header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 263: header('Pragma: public'); |
250: | 264: |
251: foreach ($feed['items'] as $item) | 265: foreach ($feed['items'] as $item) |
252: { | 266: { |
269: if ($show < 1 || $show > 50) | 283: if ($show < 1 || $show > 50) |
270: $show = 15; | 284: $show = 15; |
271: | 285: |
| 286: ($hook = get_hook('ex_set_syndication_type')) ? eval($hook) : null; |
| 287: |
272: // Was a topic ID supplied? | 288: // Was a topic ID supplied? |
273: if (isset($_GET['tid'])) | 289: if (isset($_GET['tid'])) |
274: { | 290: { |
276: | 292: |
277: // Fetch topic subject | 293: // Fetch topic subject |
278: $query = array( | 294: $query = array( |
279: 'SELECT' => 't.subject, t.num_replies, t.first_post_id', | 295: 'SELECT' => 't.subject, t.first_post_id', |
280: 'FROM' => 'topics AS t', | 296: 'FROM' => 'topics AS t', |
281: 'JOINS' => array( | 297: 'JOINS' => array( |
282: array( | 298: array( |
297: | 313: |
298: $cur_topic = $forum_db->fetch_assoc($result); | 314: $cur_topic = $forum_db->fetch_assoc($result); |
299: | 315: |
| 316: if (!defined('FORUM_PARSER_LOADED')) |
| 317: require FORUM_ROOT.'include/parser.php'; |
| 318: |
300: if ($forum_config['o_censoring'] == '1') | 319: if ($forum_config['o_censoring'] == '1') |
301: $cur_topic['subject'] = censor_words($cur_topic['subject']); | 320: $cur_topic['subject'] = censor_words($cur_topic['subject']); |
302: | 321: |
303: // Setup the feed | 322: // Setup the feed |
304: $feed = array( | 323: $feed = array( |
305: 'title' => $forum_config['o_board_title'].' - '.$cur_topic['subject'], | 324: 'title' => $forum_config['o_board_title'].$lang_common['Title separator'].$cur_topic['subject'], |
306: 'link' => forum_link($forum_url['topic'], array($tid, sef_friendly($cur_topic['subject']))), | 325: 'link' => forum_link($forum_url['topic'], array($tid, sef_friendly($cur_topic['subject']))), |
307: 'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']), | 326: 'description' => sprintf($lang_common['RSS description topic'], $cur_topic['subject']), |
308: 'items' => array(), | 327: 'items' => array(), |
311: | 330: |
312: // Fetch $show posts | 331: // Fetch $show posts |
313: $query = array( | 332: $query = array( |
314: 'SELECT' => 'p.id, p.poster, p.message, p.posted, p.poster_id, u.email_setting, u.email, p.poster_email', | 333: 'SELECT' => 'p.id, p.poster, p.message, p.hide_smilies, p.posted, p.poster_id, u.email_setting, u.email, p.poster_email', |
315: 'FROM' => 'posts AS p', | 334: 'FROM' => 'posts AS p', |
316: 'JOINS' => array( | 335: 'JOINS' => array( |
317: array( | 336: array( |
318: 'INNER JOIN' => 'users AS u', | 337: 'INNER JOIN' => 'users AS u', |
319: 'ON' => 'u.id = p.poster_id' | 338: 'ON' => 'u.id = p.poster_id' |
320: ) | 339: ) |
321: ), | 340: ), |
322: 'WHERE' => 'p.topic_id='.$tid, | 341: 'WHERE' => 'p.topic_id='.$tid, |
323: 'ORDER BY' => 'p.posted DESC', | 342: 'ORDER BY' => 'p.posted DESC', |
324: 'LIMIT' => $show | 343: 'LIMIT' => $show |
325: ); | 344: ); |
326: | |
327: ($hook = get_hook('ex_qr_get_posts')) ? eval($hook) : null; | 345: ($hook = get_hook('ex_qr_get_posts')) ? eval($hook) : null; |
328: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); | 346: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 347: |
329: while ($cur_post = $forum_db->fetch_assoc($result)) | 348: while ($cur_post = $forum_db->fetch_assoc($result)) |
330: { | 349: { |
331: if ($forum_config['o_censoring'] == '1') | 350: if ($forum_config['o_censoring'] == '1') |
332: $cur_post['message'] = censor_words($cur_post['message']); | 351: $cur_post['message'] = censor_words($cur_post['message']); |
333: | 352: |
| 353: $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); |
| 354: |
334: $item = array( | 355: $item = array( |
335: 'id' => $cur_post['id'], | 356: 'id' => $cur_post['id'], |
336: 'title' => $cur_topic['first_post_id'] == $cur_post['id'] ? $cur_topic['subject'] : $lang_common['RSS reply'].$cur_topic['subject'], | 357: 'title' => $cur_topic['first_post_id'] == $cur_post['id'] ? $cur_topic['subject'] : $lang_common['RSS reply'].$cur_topic['subject'], |
344: | 365: |
345: if ($cur_post['poster_id'] > 1) | 366: if ($cur_post['poster_id'] > 1) |
346: { | 367: { |
347: if ($cur_post['email_setting'] == '0') | 368: if ($cur_post['email_setting'] == '0' && !$forum_user['is_guest']) |
348: $item['author']['email'] = $cur_post['email']; | 369: $item['author']['email'] = $cur_post['email']; |
349: | 370: |
350: $item['author']['uri'] = forum_link($forum_url['user'], $cur_post['poster_id']); | 371: $item['author']['uri'] = forum_link($forum_url['user'], $cur_post['poster_id']); |
351: } | 372: } |
352: else if ($cur_post['poster_email'] != '') | 373: else if ($cur_post['poster_email'] != '' && !$forum_user['is_guest']) |
353: $item['author']['email'] = $cur_post['poster_email']; | 374: $item['author']['email'] = $cur_post['poster_email']; |
354: | 375: |
355: $feed['items'][] = $item; | 376: $feed['items'][] = $item; |
364: } | 385: } |
365: else | 386: else |
366: { | 387: { |
| 388: $forum_name = ''; |
| 389: |
| 390: if (!defined('FORUM_PARSER_LOADED')) |
| 391: require FORUM_ROOT.'include/parser.php'; |
| 392: |
367: // Were any forum ID's supplied? | 393: // Were any forum ID's supplied? |
368: if (isset($_GET['fid']) && is_scalar($_GET['fid']) && $_GET['fid'] != '') | 394: if (isset($_GET['fid']) && is_scalar($_GET['fid']) && $_GET['fid'] != '') |
369: { | 395: { |
372: | 398: |
373: if (!empty($fids)) | 399: if (!empty($fids)) |
374: $forum_sql = ' AND t.forum_id IN('.implode(',', $fids).')'; | 400: $forum_sql = ' AND t.forum_id IN('.implode(',', $fids).')'; |
| 401: |
| 402: if (count($fids) == 1) |
| 403: { |
| 404: // Fetch forum name |
| 405: $query = array( |
| 406: 'SELECT' => 'f.forum_name', |
| 407: 'FROM' => 'forums AS f', |
| 408: 'JOINS' => array( |
| 409: array( |
| 410: 'LEFT JOIN' => 'forum_perms AS fp', |
| 411: 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')' |
| 412: ) |
| 413: ), |
| 414: 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fids[0] |
| 415: ); |
| 416: |
| 417: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 418: if ($forum_db->num_rows($result)) |
| 419: $forum_name = $lang_common['Title separator'].$forum_db->result($result); |
| 420: } |
375: } | 421: } |
376: | 422: |
377: // Any forum ID's to exclude? | 423: // Any forum ID's to exclude? |
386: | 432: |
387: // Setup the feed | 433: // Setup the feed |
388: $feed = array( | 434: $feed = array( |
389: 'title' => $forum_config['o_board_title'], | 435: 'title' => $forum_config['o_board_title'].$forum_name, |
390: 'link' => forum_link($forum_url['index']), | 436: 'link' => forum_link($forum_url['index']), |
391: 'description' => sprintf($lang_common['RSS description'], $forum_config['o_board_title']), | 437: 'description' => sprintf($lang_common['RSS description'], $forum_config['o_board_title']), |
392: 'items' => array(), | 438: 'items' => array(), |
395: | 441: |
396: // Fetch $show topics | 442: // Fetch $show topics |
397: $query = array( | 443: $query = array( |
398: 'SELECT' => 't.id, t.poster, t.subject, t.last_post, t.last_poster, p.message, u.email_setting, u.email, p.poster_id, p.poster_email', | 444: 'SELECT' => 't.id, t.poster, t.posted, t.subject, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email', |
399: 'FROM' => 'topics AS t', | 445: 'FROM' => 'topics AS t', |
400: 'JOINS' => array( | 446: 'JOINS' => array( |
401: array( | 447: array( |
402: 'INNER JOIN' => 'posts AS p', | 448: 'INNER JOIN' => 'posts AS p', |
403: 'ON' => 'p.id=t.first_post_id' | 449: 'ON' => 'p.id = t.first_post_id' |
404: ), | 450: ), |
405: array( | 451: array( |
406: 'INNER JOIN' => 'users AS u', | 452: 'INNER JOIN' => 'users AS u', |
407: 'ON' => 'u.id = p.poster_id' | 453: 'ON' => 'u.id = p.poster_id' |
408: ), | 454: ), |
409: array( | 455: array( |
410: 'LEFT JOIN' => 'forum_perms AS fp', | 456: 'LEFT JOIN' => 'forum_perms AS fp', |
411: 'ON' => '(fp.forum_id=t.forum_id AND fp.group_id='.$forum_user['g_id'].')' | 457: 'ON' => '(fp.forum_id = t.forum_id AND fp.group_id = '.$forum_user['g_id'].')' |
412: ) | 458: ) |
413: ), | 459: ), |
414: 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL', | 460: 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum = 1) AND t.moved_to IS NULL', |
415: 'ORDER BY' => 't.last_post DESC', | 461: 'ORDER BY' => 't.posted DESC', |
416: 'LIMIT' => $show | 462: 'LIMIT' => $show |
417: ); | 463: ); |
418: | 464: |
429: $cur_topic['message'] = censor_words($cur_topic['message']); | 475: $cur_topic['message'] = censor_words($cur_topic['message']); |
430: } | 476: } |
431: | 477: |
| 478: $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']); |
| 479: |
432: $item = array( | 480: $item = array( |
433: 'id' => $cur_topic['id'], | 481: 'id' => $cur_topic['id'], |
434: 'title' => $cur_topic['subject'], | 482: 'title' => $cur_topic['subject'], |
435: 'link' => forum_link($forum_url['topic_new_posts'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))), | 483: 'link' => forum_link($forum_url['topic_new_posts'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))), |
436: 'description' => $cur_topic['message'], | 484: 'description' => $cur_topic['message'], |
437: 'author' => array( | 485: 'author' => array( |
438: 'name' => $cur_topic['last_poster'] | 486: 'name' => $cur_topic['poster'] |
439: ), | 487: ), |
440: 'pubdate' => $cur_topic['last_post'] | 488: 'pubdate' => $cur_topic['posted'] |
441: ); | 489: ); |
442: | 490: |
443: if ($cur_topic['poster_id'] > 1) | 491: if ($cur_topic['poster_id'] > 1) |
444: { | 492: { |
445: if ($cur_topic['email_setting'] == '0') | 493: if ($cur_topic['email_setting'] == '0' && !$forum_user['is_guest']) |
446: $item['author']['email'] = $cur_topic['email']; | 494: $item['author']['email'] = $cur_topic['email']; |
447: | 495: |
448: $item['author']['uri'] = forum_link($forum_url['user'], $cur_topic['poster_id']); | 496: $item['author']['uri'] = forum_link($forum_url['user'], $cur_topic['poster_id']); |
449: } | 497: } |
450: else if ($cur_topic['poster_email'] != '') | 498: else if ($cur_topic['poster_email'] != '' && !$forum_user['is_guest']) |
451: $item['author']['email'] = $cur_topic['poster_email']; | 499: $item['author']['email'] = $cur_topic['poster_email']; |
452: | 500: |
453: $feed['items'][] = $item; | 501: $feed['items'][] = $item; |
487: { | 535: { |
488: if ($forum_user_online['user_id'] > 1) | 536: if ($forum_user_online['user_id'] > 1) |
489: { | 537: { |
490: $users[] = '<a href="'.forum_link($forum_url['user'], $forum_user_online['user_id']).'">'.forum_htmlencode($forum_user_online['ident']).'</a>'; | 538: $users[] = $forum_user['g_view_users'] == '1' ?'<a href="'.forum_link($forum_url['user'], $forum_user_online['user_id']).'">'.forum_htmlencode($forum_user_online['ident']).'</a>' : forum_htmlencode($forum_user_online['ident']); |
491: ++$num_users; | 539: ++$num_users; |
492: } | 540: } |
493: else | 541: else |
495: } | 543: } |
496: | 544: |
497: ($hook = get_hook('ex_pre_online_output')) ? eval($hook) : null; | 545: ($hook = get_hook('ex_pre_online_output')) ? eval($hook) : null; |
| 546: // Send the Content-type header in case the web server is setup to send something else |
| 547: header('Content-type: text/html; charset=utf-8'); |
| 548: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); |
| 549: header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 550: header('Pragma: public'); |
| 551: |
498: | 552: |
499: echo $lang_index['Guests online'].': '.forum_number_format($num_guests).'<br />'."\n"; | 553: echo $lang_index['Guests online'].': '.forum_number_format($num_guests).'<br />'."\n"; |
500: | 554: |
501: if ($_GET['action'] == 'online_full') | 555: if ($_GET['action'] == 'online_full' && !empty($users)) |
502: echo $lang_index['Users online'].': '.implode(', ', $users).'<br />'."\n"; | 556: echo $lang_index['Users online'].': '.implode($lang_index['Online list separator'], $users).'<br />'."\n"; |
503: else | 557: else |
504: echo $lang_index['Users online'].': '.forum_number_format($num_users).'<br />'."\n"; | 558: echo $lang_index['Users online'].': '.forum_number_format($num_users).'<br />'."\n"; |
505: | 559: |
544: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); | 598: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
545: list($stats['total_topics'], $stats['total_posts']) = $forum_db->fetch_row($result); | 599: list($stats['total_topics'], $stats['total_posts']) = $forum_db->fetch_row($result); |
546: | 600: |
| 601: // Send the Content-type header in case the web server is setup to send something else |
| 602: header('Content-type: text/html; charset=utf-8'); |
| 603: header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); |
| 604: header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 605: header('Pragma: public'); |
| 606: |
547: ($hook = get_hook('ex_pre_stats_output')) ? eval($hook) : null; | 607: ($hook = get_hook('ex_pre_stats_output')) ? eval($hook) : null; |
548: | 608: |
549: echo sprintf($lang_index['No of users'], forum_number_format($stats['total_users'])).'<br />'."\n"; | 609: echo sprintf($lang_index['No of users'], forum_number_format($stats['total_users'])).'<br />'."\n"; |
punbb-1.3.1/include/dblayer/mysqli_innodb.php |
punbb-1.3.6/include/dblayer/mysqli_innodb.php |
| 1: <?php |
| 2: /** |
| 3: * A database layer class supporting transactions that relies on the MySQLi PHP extension. |
| 4: * |
| 5: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
| 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 7: * @package PunBB |
| 8: */ |
| 9: |
| 10: |
| 11: // Make sure we have built in support for MySQL |
| 12: if (!function_exists('mysqli_connect')) |
| 13: exit('This PHP environment doesn\'t have Improved MySQL (mysqli) support built in. Improved MySQL support is required if you want to use a MySQL 4.1 (or later) database to run this forum. Consult the PHP documentation for further assistance.'); |
| 14: |
| 15: |
| 16: class DBLayer |
| 17: { |
| 18: var $prefix; |
| 19: var $link_id; |
| 20: var $query_result; |
| 21: |
| 22: var $saved_queries = array(); |
| 23: var $num_queries = 0; |
| 24: var $in_transaction = 0; |
| 25: |
| 26: var $datatype_transformations = array( |
| 27: '/^SERIAL$/' => 'INT(10) UNSIGNED AUTO_INCREMENT' |
| 28: ); |
| 29: |
| 30: |
| 31: function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $foo) |
| 32: { |
| 33: $this->prefix = $db_prefix; |
| 34: |
| 35: // Was a custom port supplied with $db_host? |
| 36: if (strpos($db_host, ':') !== false) |
| 37: list($db_host, $db_port) = explode(':', $db_host); |
| 38: |
| 39: if (isset($db_port)) |
| 40: $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name, $db_port); |
| 41: else |
| 42: $this->link_id = @mysqli_connect($db_host, $db_username, $db_password, $db_name); |
| 43: |
| 44: if (!$this->link_id) |
| 45: error('Unable to connect to MySQL and select database. MySQL reported: '.mysqli_connect_error(), __FILE__, __LINE__); |
| 46: |
| 47: // Setup the client-server character set (UTF-8) |
| 48: if (!defined('FORUM_NO_SET_NAMES')) |
| 49: $this->set_names('utf8'); |
| 50: |
| 51: return $this->link_id; |
| 52: } |
| 53: |
| 54: |
| 55: function start_transaction() |
| 56: { |
| 57: ++$this->in_transaction; |
| 58: |
| 59: mysqli_query($this->link_id, 'START TRANSACTION'); |
| 60: return; |
| 61: } |
| 62: |
| 63: |
| 64: function end_transaction() |
| 65: { |
| 66: --$this->in_transaction; |
| 67: |
| 68: mysqli_query($this->link_id, 'COMMIT'); |
| 69: return; |
| 70: } |
| 71: |
| 72: |
| 73: function query($sql, $unbuffered = false) |
| 74: { |
| 75: if (strlen($sql) > 140000) |
| 76: exit('Insane query. Aborting.'); |
| 77: |
| 78: if (defined('FORUM_SHOW_QUERIES')) |
| 79: $q_start = get_microtime(); |
| 80: |
| 81: $this->query_result = @mysqli_query($this->link_id, $sql); |
| 82: |
| 83: if ($this->query_result) |
| 84: { |
| 85: if (defined('FORUM_SHOW_QUERIES')) |
| 86: $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start)); |
| 87: |
| 88: ++$this->num_queries; |
| 89: |
| 90: return $this->query_result; |
| 91: } |
| 92: else |
| 93: { |
| 94: if (defined('FORUM_SHOW_QUERIES')) |
| 95: $this->saved_queries[] = array($sql, 0); |
| 96: |
| 97: // Rollback transaction |
| 98: if ($this->in_transaction) |
| 99: mysqli_query($this->link_id, 'ROLLBACK'); |
| 100: |
| 101: --$this->in_transaction; |
| 102: |
| 103: return false; |
| 104: } |
| 105: } |
| 106: |
| 107: |
| 108: function result($query_id = 0, $row = 0, $col = 0) |
| 109: { |
| 110: if ($query_id) |
| 111: { |
| 112: if ($row) |
| 113: @mysqli_data_seek($query_id, $row); |
| 114: |
| 115: $cur_row = @mysqli_fetch_row($query_id); |
| 116: return $cur_row[$col]; |
| 117: } |
| 118: else |
| 119: return false; |
| 120: } |
| 121: |
| 122: |
| 123: function fetch_assoc($query_id = 0) |
| 124: { |
| 125: return ($query_id) ? @mysqli_fetch_assoc($query_id) : false; |
| 126: } |
| 127: |
| 128: |
| 129: function fetch_row($query_id = 0) |
| 130: { |
| 131: return ($query_id) ? @mysqli_fetch_row($query_id) : false; |
| 132: } |
| 133: |
| 134: |
| 135: function num_rows($query_id = 0) |
| 136: { |
| 137: return ($query_id) ? @mysqli_num_rows($query_id) : false; |
| 138: } |
| 139: |
| 140: |
| 141: function affected_rows() |
| 142: { |
| 143: return ($this->link_id) ? @mysqli_affected_rows($this->link_id) : false; |
| 144: } |
| 145: |
| 146: |
| 147: function insert_id() |
| 148: { |
| 149: return ($this->link_id) ? @mysqli_insert_id($this->link_id) : false; |
| 150: } |
| 151: |
| 152: |
| 153: function get_num_queries() |
| 154: { |
| 155: return $this->num_queries; |
| 156: } |
| 157: |
| 158: |
| 159: function get_saved_queries() |
| 160: { |
| 161: return $this->saved_queries; |
| 162: } |
| 163: |
| 164: |
| 165: function free_result($query_id = false) |
| 166: { |
| 167: return ($query_id) ? @mysqli_free_result($query_id) : false; |
| 168: } |
| 169: |
| 170: |
| 171: function escape($str) |
| 172: { |
| 173: return is_array($str) ? '' : mysqli_real_escape_string($this->link_id, $str); |
| 174: } |
| 175: |
| 176: |
| 177: function error() |
| 178: { |
| 179: $result['error_sql'] = @current(@end($this->saved_queries)); |
| 180: $result['error_no'] = @mysqli_errno($this->link_id); |
| 181: $result['error_msg'] = @mysqli_error($this->link_id); |
| 182: |
| 183: return $result; |
| 184: } |
| 185: |
| 186: |
| 187: function close() |
| 188: { |
| 189: if ($this->link_id) |
| 190: { |
| 191: if ($this->query_result) |
| 192: @mysqli_free_result($this->query_result); |
| 193: |
| 194: return @mysqli_close($this->link_id); |
| 195: } |
| 196: else |
| 197: return false; |
| 198: } |
| 199: |
| 200: |
| 201: function set_names($names) |
| 202: { |
| 203: return $this->query('SET NAMES \''.$this->escape($names).'\''); |
| 204: } |
| 205: |
| 206: |
| 207: function get_version() |
| 208: { |
| 209: $result = $this->query('SELECT VERSION()'); |
| 210: |
| 211: return array( |
| 212: 'name' => 'MySQL Improved (InnoDB)', |
| 213: 'version' => preg_replace('/^([^-]+).*$/', '\\1', $this->result($result)) |
| 214: ); |
| 215: } |
| 216: |
| 217: |
| 218: function table_exists($table_name, $no_prefix = false) |
| 219: { |
| 220: $result = $this->query('SHOW TABLES LIKE \''.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'\''); |
| 221: return $this->num_rows($result) > 0; |
| 222: } |
| 223: |
| 224: |
| 225: function field_exists($table_name, $field_name, $no_prefix = false) |
| 226: { |
| 227: $result = $this->query('SHOW COLUMNS FROM '.($no_prefix ? '' : $this->prefix).$table_name.' LIKE \''.$this->escape($field_name).'\''); |
| 228: return $this->num_rows($result) > 0; |
| 229: } |
| 230: |
| 231: |
| 232: function index_exists($table_name, $index_name, $no_prefix = false) |
| 233: { |
| 234: $exists = false; |
| 235: |
| 236: $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
| 237: while ($cur_index = $this->fetch_assoc($result)) |
| 238: { |
| 239: if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) |
| 240: { |
| 241: $exists = true; |
| 242: break; |
| 243: } |
| 244: } |
| 245: |
| 246: return $exists; |
| 247: } |
| 248: |
| 249: |
| 250: function create_table($table_name, $schema, $no_prefix = false) |
| 251: { |
| 252: if ($this->table_exists($table_name, $no_prefix)) |
| 253: return; |
| 254: |
| 255: $query = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$table_name." (\n"; |
| 256: |
| 257: // Go through every schema element and add it to the query |
| 258: foreach ($schema['FIELDS'] as $field_name => $field_data) |
| 259: { |
| 260: $field_data['datatype'] = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_data['datatype']); |
| 261: |
| 262: $query .= $field_name.' '.$field_data['datatype']; |
| 263: |
| 264: if (isset($field_data['collation'])) |
| 265: $query .= 'CHARACTER SET utf8 COLLATE utf8_'.$field_data['collation']; |
| 266: |
| 267: if (!$field_data['allow_null']) |
| 268: $query .= ' NOT NULL'; |
| 269: |
| 270: if (isset($field_data['default'])) |
| 271: $query .= ' DEFAULT '.$field_data['default']; |
| 272: |
| 273: $query .= ",\n"; |
| 274: } |
| 275: |
| 276: // If we have a primary key, add it |
| 277: if (isset($schema['PRIMARY KEY'])) |
| 278: $query .= 'PRIMARY KEY ('.implode(',', $schema['PRIMARY KEY']).'),'."\n"; |
| 279: |
| 280: // Add unique keys |
| 281: if (isset($schema['UNIQUE KEYS'])) |
| 282: { |
| 283: foreach ($schema['UNIQUE KEYS'] as $key_name => $key_fields) |
| 284: $query .= 'UNIQUE KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$key_name.'('.implode(',', $key_fields).'),'."\n"; |
| 285: } |
| 286: |
| 287: // Add indexes |
| 288: if (isset($schema['INDEXES'])) |
| 289: { |
| 290: foreach ($schema['INDEXES'] as $index_name => $index_fields) |
| 291: $query .= 'KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.'('.implode(',', $index_fields).'),'."\n"; |
| 292: } |
| 293: |
| 294: // We remove the last two characters (a newline and a comma) and add on the ending |
| 295: $query = substr($query, 0, strlen($query) - 2)."\n".') ENGINE = '.(isset($schema['ENGINE']) ? $schema['ENGINE'] : 'InnoDB').' CHARACTER SET utf8'; |
| 296: |
| 297: $this->query($query) or error(__FILE__, __LINE__); |
| 298: } |
| 299: |
| 300: |
| 301: function drop_table($table_name, $no_prefix = false) |
| 302: { |
| 303: if (!$this->table_exists($table_name, $no_prefix)) |
| 304: return; |
| 305: |
| 306: $this->query('DROP TABLE '.($no_prefix ? '' : $this->prefix).$table_name) or error(__FILE__, __LINE__); |
| 307: } |
| 308: |
| 309: |
| 310: function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
| 311: { |
| 312: if ($this->field_exists($table_name, $field_name, $no_prefix)) |
| 313: return; |
| 314: |
| 315: $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type); |
| 316: |
| 317: if ($default_value !== null && !is_int($default_value) && !is_float($default_value)) |
| 318: $default_value = '\''.$this->escape($default_value).'\''; |
| 319: |
| 320: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__); |
| 321: } |
| 322: |
| 323: |
| 324: function alter_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
| 325: { |
| 326: if (!$this->field_exists($table_name, $field_name, $no_prefix)) |
| 327: return; |
| 328: |
| 329: $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type); |
| 330: |
| 331: if ($default_value !== null && !is_int($default_value) && !is_float($default_value)) |
| 332: $default_value = '\''.$this->escape($default_value).'\''; |
| 333: |
| 334: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' MODIFY '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__); |
| 335: } |
| 336: |
| 337: |
| 338: function drop_field($table_name, $field_name, $no_prefix = false) |
| 339: { |
| 340: if (!$this->field_exists($table_name, $field_name, $no_prefix)) |
| 341: return; |
| 342: |
| 343: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP '.$field_name) or error(__FILE__, __LINE__); |
| 344: } |
| 345: |
| 346: |
| 347: function add_index($table_name, $index_name, $index_fields, $unique = false, $no_prefix = false) |
| 348: { |
| 349: if ($this->index_exists($table_name, $index_name, $no_prefix)) |
| 350: return; |
| 351: |
| 352: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.($unique ? 'UNIQUE ' : '').'INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.' ('.implode(',', $index_fields).')') or error(__FILE__, __LINE__); |
| 353: } |
| 354: |
| 355: |
| 356: function drop_index($table_name, $index_name, $no_prefix = false) |
| 357: { |
| 358: if (!$this->index_exists($table_name, $index_name, $no_prefix)) |
| 359: return; |
| 360: |
| 361: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) or error(__FILE__, __LINE__); |
| 362: } |
| 363: } |
punbb-1.3.1/include/dblayer/mysql_innodb.php |
punbb-1.3.6/include/dblayer/mysql_innodb.php |
| 1: <?php |
| 2: /** |
| 3: * A database layer class supporting transactions that relies on the MySQL PHP extension. |
| 4: * |
| 5: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
| 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
| 7: * @package PunBB |
| 8: */ |
| 9: |
| 10: |
| 11: // Make sure we have built in support for MySQL |
| 12: if (!function_exists('mysql_connect')) |
| 13: exit('This PHP environment doesn\'t have MySQL support built in. MySQL support is required if you want to use a MySQL database to run this forum. Consult the PHP documentation for further assistance.'); |
| 14: |
| 15: |
| 16: class DBLayer |
| 17: { |
| 18: var $prefix; |
| 19: var $link_id; |
| 20: var $query_result; |
| 21: var $in_transaction = 0; |
| 22: |
| 23: var $saved_queries = array(); |
| 24: var $num_queries = 0; |
| 25: |
| 26: var $datatype_transformations = array( |
| 27: '/^SERIAL$/' => 'INT(10) UNSIGNED AUTO_INCREMENT' |
| 28: ); |
| 29: |
| 30: |
| 31: function DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect) |
| 32: { |
| 33: $this->prefix = $db_prefix; |
| 34: |
| 35: if ($p_connect) |
| 36: $this->link_id = @mysql_pconnect($db_host, $db_username, $db_password); |
| 37: else |
| 38: $this->link_id = @mysql_connect($db_host, $db_username, $db_password); |
| 39: |
| 40: if ($this->link_id) |
| 41: { |
| 42: if (!@mysql_select_db($db_name, $this->link_id)) |
| 43: error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__); |
| 44: } |
| 45: else |
| 46: error('Unable to connect to MySQL server. MySQL reported: '.mysql_error(), __FILE__, __LINE__); |
| 47: |
| 48: // Setup the client-server character set (UTF-8) |
| 49: if (!defined('FORUM_NO_SET_NAMES')) |
| 50: $this->set_names('utf8'); |
| 51: |
| 52: return $this->link_id; |
| 53: } |
| 54: |
| 55: |
| 56: function start_transaction() |
| 57: { |
| 58: ++$this->in_transaction; |
| 59: |
| 60: mysql_query('START TRANSACTION', $this->link_id); |
| 61: return; |
| 62: } |
| 63: |
| 64: |
| 65: function end_transaction() |
| 66: { |
| 67: --$this->in_transaction; |
| 68: |
| 69: mysql_query('COMMIT', $this->link_id); |
| 70: return; |
| 71: } |
| 72: |
| 73: |
| 74: function query($sql, $unbuffered = false) |
| 75: { |
| 76: if (strlen($sql) > 140000) |
| 77: exit('Insane query. Aborting.'); |
| 78: |
| 79: if (defined('FORUM_SHOW_QUERIES')) |
| 80: $q_start = get_microtime(); |
| 81: |
| 82: if ($unbuffered) |
| 83: $this->query_result = @mysql_unbuffered_query($sql, $this->link_id); |
| 84: else |
| 85: $this->query_result = @mysql_query($sql, $this->link_id); |
| 86: |
| 87: if ($this->query_result) |
| 88: { |
| 89: if (defined('FORUM_SHOW_QUERIES')) |
| 90: $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start)); |
| 91: |
| 92: ++$this->num_queries; |
| 93: |
| 94: return $this->query_result; |
| 95: } |
| 96: else |
| 97: { |
| 98: if (defined('FORUM_SHOW_QUERIES')) |
| 99: $this->saved_queries[] = array($sql, 0); |
| 100: |
| 101: // Rollback transaction |
| 102: if ($this->in_transaction) |
| 103: mysql_query('ROLLBACK', $this->link_id); |
| 104: |
| 105: --$this->in_transaction; |
| 106: |
| 107: return false; |
| 108: } |
| 109: } |
| 110: |
| 111: |
| 112: function result($query_id = 0, $row = 0, $col = 0) |
| 113: { |
| 114: return ($query_id) ? @mysql_result($query_id, $row, $col) : false; |
| 115: } |
| 116: |
| 117: |
| 118: function fetch_assoc($query_id = 0) |
| 119: { |
| 120: return ($query_id) ? @mysql_fetch_assoc($query_id) : false; |
| 121: } |
| 122: |
| 123: |
| 124: function fetch_row($query_id = 0) |
| 125: { |
| 126: return ($query_id) ? @mysql_fetch_row($query_id) : false; |
| 127: } |
| 128: |
| 129: |
| 130: function num_rows($query_id = 0) |
| 131: { |
| 132: return ($query_id) ? @mysql_num_rows($query_id) : false; |
| 133: } |
| 134: |
| 135: |
| 136: function affected_rows() |
| 137: { |
| 138: return ($this->link_id) ? @mysql_affected_rows($this->link_id) : false; |
| 139: } |
| 140: |
| 141: |
| 142: function insert_id() |
| 143: { |
| 144: return ($this->link_id) ? @mysql_insert_id($this->link_id) : false; |
| 145: } |
| 146: |
| 147: |
| 148: function get_num_queries() |
| 149: { |
| 150: return $this->num_queries; |
| 151: } |
| 152: |
| 153: |
| 154: function get_saved_queries() |
| 155: { |
| 156: return $this->saved_queries; |
| 157: } |
| 158: |
| 159: |
| 160: function free_result($query_id = false) |
| 161: { |
| 162: return ($query_id) ? @mysql_free_result($query_id) : false; |
| 163: } |
| 164: |
| 165: |
| 166: function escape($str) |
| 167: { |
| 168: if (is_array($str)) |
| 169: return ''; |
| 170: else if (function_exists('mysql_real_escape_string')) |
| 171: return mysql_real_escape_string($str, $this->link_id); |
| 172: else |
| 173: return mysql_escape_string($str); |
| 174: } |
| 175: |
| 176: |
| 177: function error() |
| 178: { |
| 179: $result['error_sql'] = @current(@end($this->saved_queries)); |
| 180: $result['error_no'] = @mysql_errno($this->link_id); |
| 181: $result['error_msg'] = @mysql_error($this->link_id); |
| 182: |
| 183: return $result; |
| 184: } |
| 185: |
| 186: |
| 187: function close() |
| 188: { |
| 189: if ($this->link_id) |
| 190: { |
| 191: if ($this->query_result) |
| 192: @mysql_free_result($this->query_result); |
| 193: |
| 194: return @mysql_close($this->link_id); |
| 195: } |
| 196: else |
| 197: return false; |
| 198: } |
| 199: |
| 200: |
| 201: function set_names($names) |
| 202: { |
| 203: return $this->query('SET NAMES \''.$this->escape($names).'\''); |
| 204: } |
| 205: |
| 206: |
| 207: function get_version() |
| 208: { |
| 209: $result = $this->query('SELECT VERSION()'); |
| 210: |
| 211: return array( |
| 212: 'name' => 'MySQL Standard (InnoDB)', |
| 213: 'version' => preg_replace('/^([^-]+).*$/', '\\1', $this->result($result)) |
| 214: ); |
| 215: } |
| 216: |
| 217: |
| 218: function table_exists($table_name, $no_prefix = false) |
| 219: { |
| 220: $result = $this->query('SHOW TABLES LIKE \''.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'\''); |
| 221: return $this->num_rows($result) > 0; |
| 222: } |
| 223: |
| 224: |
| 225: function field_exists($table_name, $field_name, $no_prefix = false) |
| 226: { |
| 227: $result = $this->query('SHOW COLUMNS FROM '.($no_prefix ? '' : $this->prefix).$table_name.' LIKE \''.$this->escape($field_name).'\''); |
| 228: return $this->num_rows($result) > 0; |
| 229: } |
| 230: |
| 231: |
| 232: function index_exists($table_name, $index_name, $no_prefix = false) |
| 233: { |
| 234: $exists = false; |
| 235: |
| 236: $result = $this->query('SHOW INDEX FROM '.($no_prefix ? '' : $this->prefix).$table_name); |
| 237: while ($cur_index = $this->fetch_assoc($result)) |
| 238: { |
| 239: if ($cur_index['Key_name'] == ($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) |
| 240: { |
| 241: $exists = true; |
| 242: break; |
| 243: } |
| 244: } |
| 245: |
| 246: return $exists; |
| 247: } |
| 248: |
| 249: |
| 250: function create_table($table_name, $schema, $no_prefix = false) |
| 251: { |
| 252: if ($this->table_exists($table_name, $no_prefix)) |
| 253: return; |
| 254: |
| 255: $query = 'CREATE TABLE '.($no_prefix ? '' : $this->prefix).$table_name." (\n"; |
| 256: |
| 257: // Go through every schema element and add it to the query |
| 258: foreach ($schema['FIELDS'] as $field_name => $field_data) |
| 259: { |
| 260: $field_data['datatype'] = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_data['datatype']); |
| 261: |
| 262: $query .= $field_name.' '.$field_data['datatype']; |
| 263: |
| 264: if (isset($field_data['collation'])) |
| 265: $query .= 'CHARACTER SET utf8 COLLATE utf8_'.$field_data['collation']; |
| 266: |
| 267: if (!$field_data['allow_null']) |
| 268: $query .= ' NOT NULL'; |
| 269: |
| 270: if (isset($field_data['default'])) |
| 271: $query .= ' DEFAULT '.$field_data['default']; |
| 272: |
| 273: $query .= ",\n"; |
| 274: } |
| 275: |
| 276: // If we have a primary key, add it |
| 277: if (isset($schema['PRIMARY KEY'])) |
| 278: $query .= 'PRIMARY KEY ('.implode(',', $schema['PRIMARY KEY']).'),'."\n"; |
| 279: |
| 280: // Add unique keys |
| 281: if (isset($schema['UNIQUE KEYS'])) |
| 282: { |
| 283: foreach ($schema['UNIQUE KEYS'] as $key_name => $key_fields) |
| 284: $query .= 'UNIQUE KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$key_name.'('.implode(',', $key_fields).'),'."\n"; |
| 285: } |
| 286: |
| 287: // Add indexes |
| 288: if (isset($schema['INDEXES'])) |
| 289: { |
| 290: foreach ($schema['INDEXES'] as $index_name => $index_fields) |
| 291: $query .= 'KEY '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.'('.implode(',', $index_fields).'),'."\n"; |
| 292: } |
| 293: |
| 294: // We remove the last two characters (a newline and a comma) and add on the ending |
| 295: $query = substr($query, 0, strlen($query) - 2)."\n".') ENGINE = '.(isset($schema['ENGINE']) ? $schema['ENGINE'] : 'InnoDB').' CHARACTER SET utf8'; |
| 296: |
| 297: $this->query($query) or error(__FILE__, __LINE__); |
| 298: } |
| 299: |
| 300: |
| 301: function drop_table($table_name, $no_prefix = false) |
| 302: { |
| 303: if (!$this->table_exists($table_name, $no_prefix)) |
| 304: return; |
| 305: |
| 306: $this->query('DROP TABLE '.($no_prefix ? '' : $this->prefix).$table_name) or error(__FILE__, __LINE__); |
| 307: } |
| 308: |
| 309: |
| 310: function add_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
| 311: { |
| 312: if ($this->field_exists($table_name, $field_name, $no_prefix)) |
| 313: return; |
| 314: |
| 315: $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type); |
| 316: |
| 317: if ($default_value !== null && !is_int($default_value) && !is_float($default_value)) |
| 318: $default_value = '\''.$this->escape($default_value).'\''; |
| 319: |
| 320: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__); |
| 321: } |
| 322: |
| 323: |
| 324: function alter_field($table_name, $field_name, $field_type, $allow_null, $default_value = null, $after_field = null, $no_prefix = false) |
| 325: { |
| 326: if (!$this->field_exists($table_name, $field_name, $no_prefix)) |
| 327: return; |
| 328: |
| 329: $field_type = preg_replace(array_keys($this->datatype_transformations), array_values($this->datatype_transformations), $field_type); |
| 330: |
| 331: if ($default_value !== null && !is_int($default_value) && !is_float($default_value)) |
| 332: $default_value = '\''.$this->escape($default_value).'\''; |
| 333: |
| 334: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' MODIFY '.$field_name.' '.$field_type.($allow_null ? ' ' : ' NOT NULL').($default_value !== null ? ' DEFAULT '.$default_value : ' ').($after_field != null ? ' AFTER '.$after_field : '')) or error(__FILE__, __LINE__); |
| 335: } |
| 336: |
| 337: |
| 338: function drop_field($table_name, $field_name, $no_prefix = false) |
| 339: { |
| 340: if (!$this->field_exists($table_name, $field_name, $no_prefix)) |
| 341: return; |
| 342: |
| 343: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP '.$field_name) or error(__FILE__, __LINE__); |
| 344: } |
| 345: |
| 346: |
| 347: function add_index($table_name, $index_name, $index_fields, $unique = false, $no_prefix = false) |
| 348: { |
| 349: if ($this->index_exists($table_name, $index_name, $no_prefix)) |
| 350: return; |
| 351: |
| 352: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' ADD '.($unique ? 'UNIQUE ' : '').'INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name.' ('.implode(',', $index_fields).')') or error(__FILE__, __LINE__); |
| 353: } |
| 354: |
| 355: |
| 356: function drop_index($table_name, $index_name, $no_prefix = false) |
| 357: { |
| 358: if (!$this->index_exists($table_name, $index_name, $no_prefix)) |
| 359: return; |
| 360: |
| 361: $this->query('ALTER TABLE '.($no_prefix ? '' : $this->prefix).$table_name.' DROP INDEX '.($no_prefix ? '' : $this->prefix).$table_name.'_'.$index_name) or error(__FILE__, __LINE__); |
| 362: } |
| 363: } |
punbb-1.3.1/include/functions.php |
punbb-1.3.6/include/functions.php |
2: /** | 2: /** |
3: * Loads common functions used throughout the site. | 3: * Loads common functions used throughout the site. |
4: * | 4: * |
5: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 5: * @copyright (C) 2008-2011 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: * @package PunBB | 7: * @package PunBB |
8: */ | 8: */ |
404: if ($type == FORUM_FT_DATETIME || $type == FORUM_FT_TIME) | 404: if ($type == FORUM_FT_DATETIME || $type == FORUM_FT_TIME) |
405: $formatted_time .= gmdate($time_format, $timestamp); | 405: $formatted_time .= gmdate($time_format, $timestamp); |
406: | 406: |
| 407: ($hook = get_hook('fn_format_time_end')) ? eval($hook) : null; |
| 408: |
407: return $formatted_time; | 409: return $formatted_time; |
408: } | 410: } |
409: | 411: |
448: else | 450: else |
449: { | 451: { |
450: $links['search'] = '<li id="navsearch"'.((FORUM_PAGE == 'search') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['search']).'">'.$lang_common['Search'].'</a></li>'; | 452: $links['search'] = '<li id="navsearch"'.((FORUM_PAGE == 'search') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['search']).'">'.$lang_common['Search'].'</a></li>'; |
451: $links['profile'] = '<li id="navprofile"'.((FORUM_PAGE == 'editprofile' || FORUM_PAGE == 'viewprofile') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['user'], $forum_user['id']).'">'.$lang_common['Profile'].'</a></li>'; | 453: $links['profile'] = '<li id="navprofile"'.((substr(FORUM_PAGE, 0, 7) == 'profile') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['user'], $forum_user['id']).'">'.$lang_common['Profile'].'</a></li>'; |
452: $links['logout'] = '<li id="navlogout"><a href="'.forum_link($forum_url['logout'], array($forum_user['id'], generate_form_token('logout'.$forum_user['id']))).'">'.$lang_common['Logout'].'</a></li>'; | 454: $links['logout'] = '<li id="navlogout"><a href="'.forum_link($forum_url['logout'], array($forum_user['id'], generate_form_token('logout'.$forum_user['id']))).'">'.$lang_common['Logout'].'</a></li>'; |
453: $links['admin'] = '<li id="navadmin"'.((substr(FORUM_PAGE, 0, 5) == 'admin') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['admin_index']).'">'.$lang_common['Admin'].'</a></li>'; | 455: $links['admin'] = '<li id="navadmin"'.((substr(FORUM_PAGE, 0, 5) == 'admin') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['admin_index']).'">'.$lang_common['Admin'].'</a></li>'; |
454: } | 456: } |
555: | 557: |
556: | 558: |
557: // Generate a string with numbered links (for multipage scripts) | 559: // Generate a string with numbered links (for multipage scripts) |
558: function paginate($num_pages, $cur_page, $link, $separator, $args = null) | 560: function paginate($num_pages, $cur_page, $link, $separator, $args = null, $is_default_scheme = null) |
559: { | 561: { |
560: global $forum_url, $lang_common; | 562: global $forum_url, $lang_common; |
561: | 563: |
| 564: if ($is_default_scheme == null) |
| 565: $forum_url_page = $forum_url['page']; |
| 566: else |
| 567: { |
| 568: $forum_url_page = '&p=$1'; |
| 569: unset($forum_url['insertion_find']); |
| 570: } |
| 571: |
562: $pages = array(); | 572: $pages = array(); |
563: $link_to_all = false; | 573: $link_to_all = false; |
564: | 574: |
574: } | 584: } |
575: | 585: |
576: if ($num_pages <= 1) | 586: if ($num_pages <= 1) |
577: $pages = array('<strong class="first-item">1</strong>'); | 587: $pages = array('<strong class="first-item">'.forum_number_format(1).'</strong>'); |
578: else | 588: else |
579: { | 589: { |
580: // Add a previous page link | 590: // Add a previous page link |
581: if ($num_pages > 1 && $cur_page > 1) | 591: if ($num_pages > 1 && $cur_page > 1) |
582: $pages[] = '<a'.(empty($pages) ? ' class="first-item"' : '').' href="'.forum_sublink($link, $forum_url['page'], ($cur_page - 1), $args).'">'.$lang_common['Previous'].'</a>'; | 592: $pages[] = '<a'.(empty($pages) ? ' class="first-item"' : '').' href="'.forum_sublink($link, $forum_url_page, ($cur_page - 1), $args).'">'.$lang_common['Previous'].'</a>'; |
583: | 593: |
584: if ($cur_page > 3) | 594: if ($cur_page > 3) |
585: { | 595: { |
586: $pages[] = '<a'.(empty($pages) ? ' class="first-item"' : '').' href="'.forum_sublink($link, $forum_url['page'], 1, $args).'">1</a>'; | 596: $pages[] = '<a'.(empty($pages) ? ' class="first-item"' : '').' href="'.forum_sublink($link, $forum_url_page, 1, $args).'">'.forum_number_format(1).'</a>'; |
587: | 597: |
588: if ($cur_page > 5) | 598: if ($cur_page > 5) |
589: $pages[] = '<span>'.$lang_common['Spacer'].'</span>'; | 599: $pages[] = '<span>'.$lang_common['Spacer'].'</span>'; |
594: if ($current < 1 || $current > $num_pages) | 604: if ($current < 1 || $current > $num_pages) |
595: continue; | 605: continue; |
596: else if ($current != $cur_page || $link_to_all) | 606: else if ($current != $cur_page || $link_to_all) |
597: $pages[] = '<a'.(empty($pages) ? ' class="first-item" ' : '').' href="'.forum_sublink($link, $forum_url['page'], $current, $args).'">'.forum_number_format($current).'</a>'; | 607: $pages[] = '<a'.(empty($pages) ? ' class="first-item" ' : '').' href="'.forum_sublink($link, $forum_url_page, $current, $args).'">'.forum_number_format($current).'</a>'; |
598: else | 608: else |
599: $pages[] = '<strong'.(empty($pages) ? ' class="first-item"' : '').'>'.forum_number_format($current).'</strong>'; | 609: $pages[] = '<strong'.(empty($pages) ? ' class="first-item"' : '').'>'.forum_number_format($current).'</strong>'; |
600: | 610: |
603: if ($cur_page != ($num_pages-3) && $cur_page != ($num_pages-4)) | 613: if ($cur_page != ($num_pages-3) && $cur_page != ($num_pages-4)) |
604: $pages[] = '<span>'.$lang_common['Spacer'].'</span>'; | 614: $pages[] = '<span>'.$lang_common['Spacer'].'</span>'; |
605: | 615: |
606: $pages[] = '<a'.(empty($pages) ? ' class="first-item" ' : '').' href="'.forum_sublink($link, $forum_url['page'], $num_pages, $args).'">'.forum_number_format($num_pages).'</a>'; | 616: $pages[] = '<a'.(empty($pages) ? ' class="first-item" ' : '').' href="'.forum_sublink($link, $forum_url_page, $num_pages, $args).'">'.forum_number_format($num_pages).'</a>'; |
607: } | 617: } |
608: | 618: |
609: // Add a next page link | 619: // Add a next page link |
610: if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages) | 620: if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages) |
611: $pages[] = '<a'.(empty($pages) ? ' class="first-item" ' : '').' href="'.forum_sublink($link, $forum_url['page'], ($cur_page + 1), $args).'">'.$lang_common['Next'].'</a>'; | 621: $pages[] = '<a'.(empty($pages) ? ' class="first-item" ' : '').' href="'.forum_sublink($link, $forum_url_page, ($cur_page + 1), $args).'">'.$lang_common['Next'].'</a>'; |
612: } | 622: } |
613: | 623: |
614: ($hook = get_hook('fn_paginate_end')) ? eval($hook) : null; | 624: ($hook = get_hook('fn_paginate_end')) ? eval($hook) : null; |
631: <div id="brd-debug" class="main"> | 641: <div id="brd-debug" class="main"> |
632: | 642: |
633: <div class="main-head"> | 643: <div class="main-head"> |
634: <h2><span><?php echo $lang_common['Debug table'] ?></span></h2> | 644: <h2 class="hn"><span><?php echo $lang_common['Debug table'] ?></span></h2> |
635: </div> | 645: </div> |
636: | 646: |
637: <div class="main-content debug"> | 647: <div class="main-content debug"> |
749: global $forum_config, $forum_user; | 759: global $forum_config, $forum_user; |
750: static $lang_url_replace, $forum_reserved_strings; | 760: static $lang_url_replace, $forum_reserved_strings; |
751: | 761: |
752: if (!isset($lang_replace)) | 762: if (!isset($lang_url_replace)) |
753: require FORUM_ROOT.'lang/'.$forum_user['language'].'/url_replace.php'; | 763: require FORUM_ROOT.'lang/'.$forum_user['language'].'/url_replace.php'; |
754: | 764: |
755: if (!isset($forum_reserved_strings)) | 765: if (!isset($forum_reserved_strings)) |
772: foreach ($forum_reserved_strings as $match => $replace) | 782: foreach ($forum_reserved_strings as $match => $replace) |
773: if ($str == $match) | 783: if ($str == $match) |
774: return $replace; | 784: return $replace; |
| 785: else if ($match != '') |
| 786: $str = str_replace($match, $replace, $str); |
775: | 787: |
776: return $str; | 788: return $str; |
777: } | 789: } |
937: function get_scheme_packs() | 949: function get_scheme_packs() |
938: { | 950: { |
939: $schemes = array(); | 951: $schemes = array(); |
940: | 952: |
941: if($handle = opendir(FORUM_ROOT.'include/url')) | 953: if($handle = opendir(FORUM_ROOT.'include/url')) |
942: { | 954: { |
943: while (false !== ($dirname = readdir($handle))) | 955: while (false !== ($dirname = readdir($handle))) |
959: function get_style_packs() | 971: function get_style_packs() |
960: { | 972: { |
961: $styles = array(); | 973: $styles = array(); |
962: | 974: |
963: if($handle = opendir(FORUM_ROOT.'style')) | 975: if($handle = opendir(FORUM_ROOT.'style')) |
964: { | 976: { |
965: while (false !== ($dirname = readdir($handle))) | 977: while (false !== ($dirname = readdir($handle))) |
1360: | 1372: |
1361: $forum_user = $forum_db->fetch_assoc($result); | 1373: $forum_user = $forum_db->fetch_assoc($result); |
1362: | 1374: |
1363: // Update online list | 1375: if (!defined('FORUM_QUIET_VISIT')) |
1364: if (!$forum_user['logged']) | |
1365: { | 1376: { |
1366: $forum_user['logged'] = time(); | 1377: // Update online list |
1367: $forum_user['csrf_token'] = random_key(40, false, true); | 1378: if (!$forum_user['logged']) |
1368: $forum_user['prev_url'] = get_current_url(255); | 1379: { |
| 1380: $forum_user['logged'] = time(); |
| 1381: $forum_user['csrf_token'] = random_key(40, false, true); |
| 1382: $forum_user['prev_url'] = get_current_url(255); |
1369: | 1383: |
1370: // REPLACE INTO avoids a user having two rows in the online table | 1384: // REPLACE INTO avoids a user having two rows in the online table |
1371: $query = array( | 1385: $query = array( |
1372: 'REPLACE' => 'user_id, ident, logged, csrf_token', | 1386: 'REPLACE' => 'user_id, ident, logged, csrf_token', |
1373: 'INTO' => 'online', | 1387: 'INTO' => 'online', |
1374: 'VALUES' => '1, \''.$forum_db->escape($remote_addr).'\', '.$forum_user['logged'].', \''.$forum_user['csrf_token'].'\'', | 1388: 'VALUES' => '1, \''.$forum_db->escape($remote_addr).'\', '.$forum_user['logged'].', \''.$forum_user['csrf_token'].'\'', |
1375: 'UNIQUE' => 'user_id=1 AND ident=\''.$forum_db->escape($remote_addr).'\'' | 1389: 'UNIQUE' => 'user_id=1 AND ident=\''.$forum_db->escape($remote_addr).'\'' |
1376: ); | 1390: ); |
1377: | 1391: |
1378: if ($forum_user['prev_url'] != null) | 1392: if ($forum_user['prev_url'] != null) |
1379: { | 1393: { |
1380: $query['REPLACE'] .= ', prev_url'; | 1394: $query['REPLACE'] .= ', prev_url'; |
1381: $query['VALUES'] .= ', \''.$forum_db->escape($forum_user['prev_url']).'\''; | 1395: $query['VALUES'] .= ', \''.$forum_db->escape($forum_user['prev_url']).'\''; |
1382: } | 1396: } |
1383: | 1397: |
1384: ($hook = get_hook('fn_set_default_user_qr_add_online_guest_user')) ? eval($hook) : null; | 1398: ($hook = get_hook('fn_set_default_user_qr_add_online_guest_user')) ? eval($hook) : null; |
1385: $forum_db->query_build($query) or error(__FILE__, __LINE__); | 1399: $forum_db->query_build($query) or error(__FILE__, __LINE__); |
1386: } | 1400: } |
1387: else | 1401: else |
1388: { | 1402: { |
1389: $query = array( | 1403: $query = array( |
1390: 'UPDATE' => 'online', | 1404: 'UPDATE' => 'online', |
1391: 'SET' => 'logged='.time(), | 1405: 'SET' => 'logged='.time(), |
1392: 'WHERE' => 'ident=\''.$forum_db->escape($remote_addr).'\'' | 1406: 'WHERE' => 'ident=\''.$forum_db->escape($remote_addr).'\'' |
1393: ); | 1407: ); |
1394: | 1408: |
1395: $current_url = get_current_url(255); | 1409: $current_url = get_current_url(255); |
1396: if ($current_url != null) | 1410: if ($current_url != null) |
1397: $query['SET'] .= ', prev_url=\''.$forum_db->escape($current_url).'\''; | 1411: $query['SET'] .= ', prev_url=\''.$forum_db->escape($current_url).'\''; |
1398: | 1412: |
1399: ($hook = get_hook('fn_set_default_user_qr_update_online_guest_user')) ? eval($hook) : null; | 1413: ($hook = get_hook('fn_set_default_user_qr_update_online_guest_user')) ? eval($hook) : null; |
1400: $forum_db->query_build($query) or error(__FILE__, __LINE__); | 1414: $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 1415: } |
1401: } | 1416: } |
1402: | 1417: |
1403: $forum_user['disp_topics'] = $forum_config['o_disp_topics_default']; | 1418: $forum_user['disp_topics'] = $forum_config['o_disp_topics_default']; |
1408: $forum_user['style'] = $forum_config['o_default_style']; | 1423: $forum_user['style'] = $forum_config['o_default_style']; |
1409: $forum_user['is_guest'] = true; | 1424: $forum_user['is_guest'] = true; |
1410: $forum_user['is_admmod'] = false; | 1425: $forum_user['is_admmod'] = false; |
| 1426: |
| 1427: ($hook = get_hook('fn_set_default_user_end')) ? eval($hook) : null; |
1411: } | 1428: } |
1412: | 1429: |
1413: | 1430: |
1452: if ($cur_ban['username'] != '' && utf8_strtolower($forum_user['username']) == utf8_strtolower($cur_ban['username'])) | 1469: if ($cur_ban['username'] != '' && utf8_strtolower($forum_user['username']) == utf8_strtolower($cur_ban['username'])) |
1453: $is_banned = true; | 1470: $is_banned = true; |
1454: | 1471: |
| 1472: if ($cur_ban['email'] != '' && $forum_user['email'] == $cur_ban['email']) |
| 1473: $is_banned = true; |
| 1474: |
1455: if ($cur_ban['ip'] != '') | 1475: if ($cur_ban['ip'] != '') |
1456: { | 1476: { |
1457: $cur_ban_ips = explode(' ', $cur_ban['ip']); | 1477: $cur_ban_ips = explode(' ', $cur_ban['ip']); |
1534: else | 1554: else |
1535: { | 1555: { |
1536: // If the entry is older than "o_timeout_visit", update last_visit for the user in question, then delete him/her from the online list | 1556: // If the entry is older than "o_timeout_visit", update last_visit for the user in question, then delete him/her from the online list |
1537: if ($cur_user['idle'] != '0') | 1557: if ($cur_user['logged'] < ($now - $forum_config['o_timeout_visit'])) |
1538: { | 1558: { |
1539: $query = array( | 1559: $query = array( |
1540: 'UPDATE' => 'users', | 1560: 'UPDATE' => 'users', |
2652: <div class="ct-box info-box"> | 2672: <div class="ct-box info-box"> |
2653: <p><?php echo $lang_common['CSRF token mismatch'] ?></p> | 2673: <p><?php echo $lang_common['CSRF token mismatch'] ?></p> |
2654: </div> | 2674: </div> |
2655: <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>"> | 2675: <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo forum_htmlencode($forum_page['form_action']) ?>"> |
2656: <div class="hidden"> | 2676: <div class="hidden"> |
2657: <?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields'])."\n" ?> | 2677: <?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields'])."\n" ?> |
2658: </div> | 2678: </div> |
2772: | 2792: |
2773: | 2793: |
2774: // START SUBST - <!-- forum_head --> | 2794: // START SUBST - <!-- forum_head --> |
| 2795: |
2775: ob_start(); | 2796: ob_start(); |
2776: | 2797: |
2777: ?> | 2798: require FORUM_ROOT.'style/'.$forum_user['style'].'/'.$forum_user['style'].'.php'; |
2778: <title><?php echo $lang_common['Maintenance'].' - '.forum_htmlencode($forum_config['o_board_title']) ?></title> | |
2779: <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'.css' ?>" /> | |
2780: <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'_cs.css' ?>" /> | |
2781: <!--[if lte IE 6]><link rel="stylesheet" type="text/css" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'_fix.css' ?>" /><![endif]--> | |
2782: <!--[if IE 7]><link rel="stylesheet" type="text/css" href="<?php echo $base_url ?>/style/<?php echo $forum_user['style'] ?>/<?php echo $forum_user['style'].'_fix7.css' ?>" /><![endif]--> | |
2783: <?php | |
2784: | 2799: |
2785: $tpl_temp = forum_trim(ob_get_contents()); | 2800: $tpl_temp = forum_trim(ob_get_contents()); |
2786: $tpl_maint = str_replace('<!-- forum_head -->', $tpl_temp, $tpl_maint); | 2801: $tpl_maint = str_replace('<!-- forum_head -->', $tpl_temp, $tpl_maint); |
2792: ob_start(); | 2807: ob_start(); |
2793: | 2808: |
2794: ?> | 2809: ?> |
2795: <div id="brd-main" class="main basic"> | |
2796: | |
2797: <div class="main-head"> | 2810: <div class="main-head"> |
2798: <h1 class="hn"><span><?php echo $lang_common['Maintenance mode'] ?></span></h1> | 2811: <h1 class="hn"><span><?php echo $lang_common['Maintenance mode'] ?></span></h1> |
2799: </div> | 2812: </div> |
2802: <?php echo $message."\n" ?> | 2815: <?php echo $message."\n" ?> |
2803: </div> | 2816: </div> |
2804: </div> | 2817: </div> |
2805: | |
2806: </div> | |
2807: <?php | 2818: <?php |
2808: | 2819: |
2809: $tpl_temp = "\t".forum_trim(ob_get_contents()); | 2820: $tpl_temp = "\t".forum_trim(ob_get_contents()); |
2887: // START SUBST - <!-- forum_head --> | 2898: // START SUBST - <!-- forum_head --> |
2888: | 2899: |
2889: $forum_head['refresh'] = '<meta http-equiv="refresh" content="'.$forum_config['o_redirect_delay'].';URL='.str_replace(array('<', '>', '"'), array('<', '>', '"'), $destination_url).'" />'; | 2900: $forum_head['refresh'] = '<meta http-equiv="refresh" content="'.$forum_config['o_redirect_delay'].';URL='.str_replace(array('<', '>', '"'), array('<', '>', '"'), $destination_url).'" />'; |
2890: $forum_head['title'] = '<title>'.$lang_common['Redirecting'].' - '.forum_htmlencode($forum_config['o_board_title']).'</title>'; | 2901: $forum_head['title'] = '<title>'.$lang_common['Redirecting'].$lang_common['Title separator'].forum_htmlencode($forum_config['o_board_title']).'</title>'; |
2891: | 2902: |
2892: ob_start(); | 2903: ob_start(); |
2893: | 2904: |
2966: // Display a simple error message | 2977: // Display a simple error message |
2967: function error() | 2978: function error() |
2968: { | 2979: { |
| 2980: global $forum_config; |
| 2981: |
2969: if (!headers_sent()) | 2982: if (!headers_sent()) |
2970: { | 2983: { |
| 2984: // if no HTTP responce code is set we send 503 |
| 2985: if (!defined('FORUM_HTTP_RESPONSE_CODE_SET')) |
| 2986: header('HTTP/1.1 503 Service Temporarily Unavailable'); |
2971: header('Content-type: text/html; charset=utf-8'); | 2987: header('Content-type: text/html; charset=utf-8'); |
2972: header('HTTP/1.1 503 Service Temporarily Unavailable'); | |
2973: } | 2988: } |
2974: | 2989: |
2975: global $forum_config; | |
2976: | |
2977: /* | 2990: /* |
2978: Parse input parameters. Possible function signatures: | 2991: Parse input parameters. Possible function signatures: |
2979: error('Error message.'); | 2992: error('Error message.'); |
3006: while (@ob_end_clean()); | 3019: while (@ob_end_clean()); |
3007: | 3020: |
3008: // "Restart" output buffering if we are using ob_gzhandler (since the gzip header is already sent) | 3021: // "Restart" output buffering if we are using ob_gzhandler (since the gzip header is already sent) |
3009: if (!empty($forum_config['o_gzip']) && extension_loaded('zlib') && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false || strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') !== false)) | 3022: if (!empty($forum_config['o_gzip']) && extension_loaded('zlib') && !empty($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false || strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') !== false)) |
3010: ob_start('ob_gzhandler'); | 3023: ob_start('ob_gzhandler'); |
3011: | 3024: |
3012: ?> | 3025: ?> |
3057: | 3070: |
3058: exit; | 3071: exit; |
3059: } | 3072: } |
| 3073: |
| 3074: // Check the text is CAPSED |
| 3075: function check_is_all_caps($text) |
| 3076: { |
| 3077: return (bool)/**/(utf8_strtoupper($text) == $text && utf8_strtolower($text) != $text); |
| 3078: } |
3060: | 3079: |
punbb-1.3.1/include/parser.php |
punbb-1.3.6/include/parser.php |
2: /** | 2: /** |
3: * Loads various functions used to parse posts. | 3: * Loads various functions used to parse posts. |
4: * | 4: * |
5: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 5: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: * @package PunBB | 7: * @package PunBB |
8: */ | 8: */ |
44: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 44: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
45: { | 45: { |
46: list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); | 46: list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); |
47: $text = implode("\0", $outside); | 47: $text = implode("\xc1", $outside); |
48: } | 48: } |
49: | 49: |
50: // Tidy up lists | 50: // Tidy up lists |
51: $pattern = array('/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems'); | 51: $pattern = array('%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise'); |
52: $replace = array('preparse_list_tag(\'$2\', \'$1\', $errors)'); | 52: $replace = array('preparse_list_tag(\'$2\', \'$1\', $errors)'); |
53: $text = preg_replace($pattern, $replace, $text); | 53: $text = preg_replace($pattern, $replace, $text); |
54: | 54: |
60: // If we split up the message before we have to concatenate it together again (code tags) | 60: // If we split up the message before we have to concatenate it together again (code tags) |
61: if (isset($inside)) | 61: if (isset($inside)) |
62: { | 62: { |
63: $outside = explode("\0", $text); | 63: $outside = explode("\xc1", $text); |
64: $text = ''; | 64: $text = ''; |
65: | 65: |
66: $num_tokens = count($outside); | 66: $num_tokens = count($outside); |
520: | 520: |
521: if (strpos($content,'[list') !== false) | 521: if (strpos($content,'[list') !== false) |
522: { | 522: { |
523: $pattern = array('/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems'); | 523: $pattern = array('%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise'); |
524: $replace = array('preparse_list_tag(\'$2\', \'$1\', $errors)'); | 524: $replace = array('preparse_list_tag(\'$2\', \'$1\', $errors)'); |
525: $content = preg_replace($pattern, $replace, $content); | 525: $content = preg_replace($pattern, $replace, $content); |
526: } | 526: } |
592: | 592: |
593: // Ok, not very pretty :-) | 593: // Ok, not very pretty :-) |
594: if (!$bbcode) | 594: if (!$bbcode) |
595: $link = ($link == '' || $link == $url) ? ((utf8_strlen($url) > 55) ? utf8_substr($url, 0 , 39).' … '.utf8_substr($url, -10) : $url) : stripslashes($link); | 595: $link = ($link == '' || $link == $url) ? ((utf8_strlen($url) > 55) ? utf8_substr($url, 0 , 39).' … '.utf8_substr($url, -10) : $url) : stripslashes($link); |
596: | 596: |
597: $return = ($hook = get_hook('ps_handle_url_tag_end')) ? eval($hook) : null; | 597: $return = ($hook = get_hook('ps_handle_url_tag_end')) ? eval($hook) : null; |
598: if ($return != null) | 598: if ($return != null) |
649: | 649: |
650: if (strpos($content,'[list') !== false) | 650: if (strpos($content,'[list') !== false) |
651: { | 651: { |
652: $pattern = array('/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems'); | 652: $pattern = array('%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise'); |
653: $replace = array('handle_list_tag(\'$2\', \'$1\')'); | 653: $replace = array('handle_list_tag(\'$2\', \'$1\')'); |
654: $content = preg_replace($pattern, $replace, $content); | 654: $content = preg_replace($pattern, $replace, $content); |
655: } | 655: } |
681: | 681: |
682: if (strpos($text, '[quote') !== false) | 682: if (strpos($text, '[quote') !== false) |
683: { | 683: { |
| 684: $text = preg_replace('#\[quote=("|"|\'|)(.*?)\\1\]#e', '"</p><div class=\"quotebox\"><cite>".str_replace(array(\'[\', \'\\"\'), array(\'[\', \'"\'), \'$2\')." ".$lang_common[\'wrote\'].":</cite><blockquote><p>"', $text); |
684: $text = preg_replace('#\[quote\]\s*#', '</p><div class="quotebox"><blockquote><p>', $text); | 685: $text = preg_replace('#\[quote\]\s*#', '</p><div class="quotebox"><blockquote><p>', $text); |
685: $text = preg_replace('#\[quote=("|"|\'|)(.*?)\\1\]#se', '"</p><div class=\"quotebox\"><cite>".str_replace(array(\'[\', \'\\"\'), array(\'[\', \'"\'), \'$2\')." ".$lang_common[\'wrote\'].":</cite><blockquote><p>"', $text); | |
686: $text = preg_replace('#\s*\[\/quote\]#S', '</p></blockquote></div><p>', $text); | 686: $text = preg_replace('#\s*\[\/quote\]#S', '</p></blockquote></div><p>', $text); |
687: } | 687: } |
688: | 688: |
689: if (!$is_signature) | 689: if (!$is_signature) |
690: { | 690: { |
691: $pattern[] = '/\[list(?:=([1a\*]))?\]((?>(?:(?!\[list(?:=(?:[1a\*]))\]|\[\/list\]).+?)|(?R))*)\[\/list\]/ems'; | 691: $pattern[] = '%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%ise'; |
692: $replace[] = 'handle_list_tag(\'$2\', \'$1\')'; | 692: $replace[] = 'handle_list_tag(\'$2\', \'$1\')'; |
693: } | 693: } |
694: | 694: |
766: { | 766: { |
767: global $forum_config, $base_url, $smilies; | 767: global $forum_config, $base_url, $smilies; |
768: | 768: |
| 769: $return = ($hook = get_hook('ps_do_smilies_start')) ? eval($hook) : null; |
| 770: if ($return != null) |
| 771: return $return; |
| 772: |
769: $text = ' '.$text.' '; | 773: $text = ' '.$text.' '; |
770: | 774: |
771: foreach ($smilies as $smiley_text => $smiley_img) | 775: foreach ($smilies as $smiley_text => $smiley_img) |
774: $text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$base_url.'/img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text); | 778: $text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, '#')."(?=\W)#m", '<img src="'.$base_url.'/img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.substr($smiley_img, 0, strrpos($smiley_img, '.')).'" />', $text); |
775: } | 779: } |
776: | 780: |
| 781: $return = ($hook = get_hook('ps_do_smilies_end')) ? eval($hook) : null; |
| 782: |
777: return substr($text, 1, -1); | 783: return substr($text, 1, -1); |
778: } | 784: } |
779: | 785: |
807: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) | 813: if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) |
808: { | 814: { |
809: list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); | 815: list($inside, $outside) = split_text($text, '[code]', '[/code]', $errors); |
810: $text = implode("\0", $outside); | 816: $text = implode("\xc1", $outside); |
811: } | 817: } |
812: | 818: |
813: $return = ($hook = get_hook('ps_parse_message_post_split')) ? eval($hook) : null; | 819: $return = ($hook = get_hook('ps_parse_message_post_split')) ? eval($hook) : null; |
836: // If we split up the message before we have to concatenate it together again (code tags) | 842: // If we split up the message before we have to concatenate it together again (code tags) |
837: if (isset($inside)) | 843: if (isset($inside)) |
838: { | 844: { |
839: $outside = explode("\0", $text); | 845: $outside = explode("\xc1", $text); |
840: $text = ''; | 846: $text = ''; |
841: | 847: |
842: $num_tokens = count($outside); | 848: $num_tokens = count($outside); |
punbb-1.3.1/lang/English/admin_settings.php |
punbb-1.3.6/lang/English/admin_settings.php |
24: 'Setup timeouts' => 'Default timeouts and redirect delay', | 24: 'Setup timeouts' => 'Default timeouts and redirect delay', |
25: 'Setup timeouts legend' => 'Timeout defaults', | 25: 'Setup timeouts legend' => 'Timeout defaults', |
26: 'Visit timeout label' => 'Visit timeout', | 26: 'Visit timeout label' => 'Visit timeout', |
27: 'Visit timeout help' => 'Seconds idle before last visit data is updated', | 27: 'Visit timeout help' => 'Seconds idle before user is logged out', |
28: 'Online timeout label' => 'Online timeout', | 28: 'Online timeout label' => 'Online timeout', |
29: 'Online timeout help' => 'Seconds idle before being removed from the online users list', | 29: 'Online timeout help' => 'Seconds idle before being removed from the online users list', |
30: 'Redirect time label' => 'Redirect wait', | 30: 'Redirect time label' => 'Redirect wait', |
51: 'Setup links legend' => 'Menu items', | 51: 'Setup links legend' => 'Menu items', |
52: 'Enter links label' => 'Enter your links', | 52: 'Enter links label' => 'Enter your links', |
53: 'Error no board title' => 'You must enter a board title.', | 53: 'Error no board title' => 'You must enter a board title.', |
54: 'Error timeout value' => 'The value of "Timeout online" must be smaller than the value of "Timeout visit".', | 54: 'Error timeout value' => 'The value of "Online timeout" must be smaller than the value of "Visit timeout".', |
55: | 55: |
56: | 56: |
57: // Features section | 57: // Features section |
78: 'Guest posting' => 'Guest posting', | 78: 'Guest posting' => 'Guest posting', |
79: 'Guest posting label' => 'Guests must supply e-mail addresses when posting.', | 79: 'Guest posting label' => 'Guests must supply e-mail addresses when posting.', |
80: 'User has posted' => 'User has posted', | 80: 'User has posted' => 'User has posted', |
81: 'User has posted label' => 'Display a dot in front of topics to indicate to a user that they have posted in that topic earlier. Disable if you are experiencing high server load.', | 81: 'User has posted label' => 'Display a dot in front of topics to indicate to a user that they have posted in that topic earlier. Disable if you are experiencing high server load. Ignore for SQLite.', |
82: 'Topic views' => 'Topic views', | 82: 'Topic views' => 'Topic views', |
83: 'Topic views label' => 'Keep track of the number of views a topic has. Disable if you are experiencing high server load in a busy forum.', | 83: 'Topic views label' => 'Keep track of the number of views a topic has. Disable if you are experiencing high server load in a busy forum.', |
84: 'User post count' => 'User post count', | 84: 'User post count' => 'User post count', |
164: 'Allow form e-mail label' => 'Hide e-mail address but allow e-mail via the forum.', | 164: 'Allow form e-mail label' => 'Hide e-mail address but allow e-mail via the forum.', |
165: 'Disallow form e-mail label' => 'Hide e-mail address and disallow e-mail via the forum.', | 165: 'Disallow form e-mail label' => 'Hide e-mail address and disallow e-mail via the forum.', |
166: 'Registration rules' => 'Forum rules (enable and compose forum rules)', | 166: 'Registration rules' => 'Forum rules (enable and compose forum rules)', |
167: 'Registration rules info' => 'You may require new users to agree to a set of rules when registering. The rules will always be available through a link in the navigation table at the top of every page. You may enable the use of rules and then compose your rules below.', | 167: 'Registration rules info' => 'You may require new users to agree to a set of rules when registering. The rules will always be available through a link in the navigation menu at the top of every page. You may enable the use of rules and then compose your rules below.', |
168: 'Registration rules legend' => 'Forum rules', | 168: 'Registration rules legend' => 'Forum rules', |
169: 'Require rules' => 'Require agreement', | 169: 'Require rules' => 'Use rules', |
170: 'Require rules label' => 'Users must agree to forum rules before registering.', | 170: 'Require rules label' => 'Users must agree to forum rules before registering.', |
171: 'Compose rules label' => 'Compose rules', | 171: 'Compose rules label' => 'Compose rules', |
172: 'Compose rules help' => 'You may use HTML as text is not parsed. Leaving empty disables the use of rules.', | 172: 'Compose rules help' => 'You may use HTML as text is not parsed.', |
173: 'Rules default' => 'Enter your rules here.', | 173: 'Rules default' => 'Enter your rules here.', |
174: | 174: |
175: // Email section | 175: // Email section |
196: | 196: |
197: // Maintenance section | 197: // Maintenance section |
198: 'Maintenance head' => 'Setup maintenance message and activate maintenance mode', | 198: 'Maintenance head' => 'Setup maintenance message and activate maintenance mode', |
199: 'Maintenance mode info' => '<strong>IMPORTANT!</strong> Putting the board into maintenance mode means it will only be available to administrators. This should be used if the board needs to taken down temporarily for maintenance.', | 199: 'Maintenance mode info' => '<strong>IMPORTANT!</strong> Putting the board into maintenance mode means it will only be available to administrators. This should be used if the board needs to be taken down temporarily for maintenance.', |
200: 'Maintenance mode warn' => '<strong>WARNING!</strong> DO NOT LOGOUT when the board is in maintenance mode. You will not be able to login again.', | 200: 'Maintenance mode warn' => '<strong>WARNING!</strong> DO NOT LOGOUT when the board is in maintenance mode. You will not be able to login again.', |
201: 'Maintenance legend' => 'Maintenance', | 201: 'Maintenance legend' => 'Maintenance', |
202: 'Maintenance mode' => 'Maintenance mode', | 202: 'Maintenance mode' => 'Maintenance mode', |
punbb-1.3.1/lang/English/common.php |
punbb-1.3.6/lang/English/common.php |
8: 'lang_identifier' => 'en', | 8: 'lang_identifier' => 'en', |
9: | 9: |
10: // Number formatting | 10: // Number formatting |
11: 'lang_decimal_point' => '.', | 11: 'lang_decimal_point' => '.', |
12: 'lang_thousands_sep' => ',', | 12: 'lang_thousands_sep' => ',', |
13: | 13: |
14: // Notices | 14: // Notices |
15: 'Bad request' => 'Bad request. The link you followed is incorrect or outdated.', | 15: 'Bad request' => 'Bad request. The link you followed is incorrect or outdated.', |
50: 'Unanswered topics title' => 'Find topics which have not been replied to.', | 50: 'Unanswered topics title' => 'Find topics which have not been replied to.', |
51: 'Username' => 'Username', | 51: 'Username' => 'Username', |
52: 'Registered' => 'Registered', | 52: 'Registered' => 'Registered', |
53: 'Write message' => 'Write message:', | 53: 'Write message' => 'Write message', |
54: 'Forum' => 'Forum', | 54: 'Forum' => 'Forum', |
55: 'Posts' => 'Posts', | 55: 'Posts' => 'Posts', |
56: 'Pages' => 'Pages', | 56: 'Pages' => 'Pages', |
85: 'Item info single' => '%s [ %s ]', | 85: 'Item info single' => '%s [ %s ]', |
86: 'Item info plural' => '%s [ %s to %s of %s ]', // e.g. Topics [ 10 to 20 of 30 ] | 86: 'Item info plural' => '%s [ %s to %s of %s ]', // e.g. Topics [ 10 to 20 of 30 ] |
87: 'Info separator' => ' ', // e.g. 1 Page | 10 Topics | 87: 'Info separator' => ' ', // e.g. 1 Page | 10 Topics |
88: 'Powered by' => 'Powered by <strong>%s</strong>', | 88: 'Powered by' => 'Powered by <strong>%s</strong>, supported by <strong>%s</strong>.', |
89: 'Maintenance' => 'Maintenance', | 89: 'Maintenance' => 'Maintenance', |
| 90: 'Installed extension' => 'The %s official extension is installed. Copyright © 2003–2011 <a href="http://punbb.informer.com/">PunBB</a>.', |
| 91: 'Installed extensions' => 'Currently installed <span id="extensions-used" title="%s">%s official extensions</span>. Copyright © 2003–2011 <a href="http://punbb.informer.com/">PunBB</a>.', |
90: | 92: |
91: // CSRF confirmation form | 93: // CSRF confirmation form |
92: 'Confirm' => 'Confirm', // Button | 94: 'Confirm' => 'Confirm', // Button |
135: 'Maintenance alert' => '<strong>WARNING! Maintenance mode enabled.</strong> This board is currently in maintenance mode. <em>DO NOT</em> logout, if you do you will not be able to login again.', | 137: 'Maintenance alert' => '<strong>WARNING! Maintenance mode enabled.</strong> This board is currently in maintenance mode. <em>DO NOT</em> logout, if you do you will not be able to login again.', |
136: 'Updates' => 'PunBB updates:', | 138: 'Updates' => 'PunBB updates:', |
137: 'Updates failed' => 'The latest attempt at checking for updates against the punbb.informer.com updates service failed. This probably just means that the service is temporarily overloaded or out of order. However, if this alert does not disappear within a day or two, you should disable the automatic check for updates and check for updates manually in the future.', | 139: 'Updates failed' => 'The latest attempt at checking for updates against the punbb.informer.com updates service failed. This probably just means that the service is temporarily overloaded or out of order. However, if this alert does not disappear within a day or two, you should disable the automatic check for updates and check for updates manually in the future.', |
138: 'Updates version n hf' => 'A newer version of PunBB, version %s, is available for download at <a href="http://punbb.informer.com/">punbb.informer.com</a>. Furthermore, one or more hotfixes are available for install on the strong>Extensions</strong> » <strong>Manage hotfixes</strong> tab of the admin interface.', | 140: 'Updates version n hf' => 'A newer version of PunBB, version %s, is available for download at <a href="http://punbb.informer.com/">punbb.informer.com</a>. Furthermore, one or more hotfixes are available for install on the <a href="%s">Manage hotfixes</a> tab of the admin interface.', |
139: 'Updates version' => 'A newer version of PunBB, version %s, is available for download at <a href="http://punbb.informer.com/">punbb.informer.com</a>.', | 141: 'Updates version' => 'A newer version of PunBB, version %s, is available for download at <a href="http://punbb.informer.com/">punbb.informer.com</a>.', |
140: 'Updates hf' => 'One or more hotfixes are available for install on the <a href="%s">Manage hotfixes</a> tab of the admin interface.', | 142: 'Updates hf' => 'One or more hotfixes are available for install on the <a href="%s">Manage hotfixes</a> tab of the admin interface.', |
141: 'Database mismatch' => 'Database version mismatch', | 143: 'Database mismatch' => 'Database version mismatch', |
146: 'Jump to' => 'Jump to forum:', | 148: 'Jump to' => 'Jump to forum:', |
147: | 149: |
148: // For extern.php RSS feed | 150: // For extern.php RSS feed |
149: 'ATOM Feed' => 'Atom', | |
150: 'RSS Feed' => 'RSS', | |
151: 'RSS description' => 'The most recent topics at %s.', | 151: 'RSS description' => 'The most recent topics at %s.', |
152: 'RSS description topic' => 'The most recent posts in %s.', | 152: 'RSS description topic' => 'The most recent posts in %s.', |
153: 'RSS reply' => 'Re: ', // The topic subject will be appended to this string (to signify a reply) | 153: 'RSS reply' => 'Re: ', // The topic subject will be appended to this string (to signify a reply) |
154: | 154: |
155: // Accessibility | 155: // Accessibility |
156: 'Skip to content' => 'Skip to forum content', | 156: 'Skip to content' => 'Skip to forum content', |
157: | 157: |
158: // Debug information | 158: // Debug information |
159: 'Querytime' => 'Generated in %1$s seconds, %2$s queries executed', | 159: 'Querytime' => 'Generated in %1$s seconds, %2$s queries executed', |
160: 'Debug table' => 'Debug information', | 160: 'Debug table' => 'Debug information', |
161: 'Debug summary' => 'Database query performance information', | 161: 'Debug summary' => 'Database query performance information', |
162: 'Query times' => 'Time (s)', | 162: 'Query times' => 'Time (s)', |
163: 'Query' => 'Query', | 163: 'Query' => 'Query', |
164: 'Total query time' => 'Total query time', | 164: 'Total query time' => 'Total query time', |
165: | 165: |
166: ); | 166: ); |
punbb-1.3.1/lang/English/profile.php |
punbb-1.3.6/lang/English/profile.php |
44: 'Too wide or high' => 'The file you tried to upload is wider and/or higher than the maximum allowed %sx%s pixels.', | 44: 'Too wide or high' => 'The file you tried to upload is wider and/or higher than the maximum allowed %sx%s pixels.', |
45: 'Unknown failure' => 'An unknown error occurred. Please try again.', | 45: 'Unknown failure' => 'An unknown error occurred. Please try again.', |
46: 'Avatar' => 'Avatar', | 46: 'Avatar' => 'Avatar', |
47: 'Current avatar' => 'Current Avatar', | 47: 'Current avatar' => 'Current avatar', |
48: 'No avatar info' => 'No avatar is currently uploaded.', | 48: 'No avatar info' => 'No avatar is currently uploaded.', |
49: 'Avatar info replace' => 'Uploading a new avatar will replace your existing avatar.', | 49: 'Avatar info replace' => 'Uploading a new avatar will replace your existing avatar.', |
50: 'Avatar info none' => 'To display an avatar you first need to upload one.', | 50: 'Avatar info none' => 'To display an avatar you first need to upload one.', |
51: 'Avatar info type' => 'The allowed image file types are gif, jpeg and png.', | 51: 'Avatar info type' => 'The allowed image file types are gif, jpeg and png.', |
52: 'Avatar info size' => 'The maximum image size allowed is %sx%s pixels and %s bytes (%s KB).', | 52: 'Avatar info size' => 'The maximum image size allowed is %sx%s pixels and %s bytes (%s KB).', |
53: 'Delete avatar info' => 'Delete avatar to cease displaying any avatar.', | 53: 'Delete avatar info' => 'Delete avatar to stop displaying any avatar.', |
54: 'Upload avatar file' => 'Upload avatar file', | 54: 'Upload avatar file' => 'Upload avatar file', |
55: 'Avatar upload help' => 'Select file then update your profile to install.', | 55: 'Avatar upload help' => 'Select file then update your profile to install.', |
56: 'No upload warn' => '<strong>IMPORTANT! </strong> You must choose a file to upload before updating your profile.', | 56: 'No upload warn' => '<strong>IMPORTANT! </strong> You must choose a file to upload before updating your profile.', |
183: 'Change e-mail errors' => '<strong>Warning!</strong> The following errors must be corrected before your e-mail address can be updated:', | 183: 'Change e-mail errors' => '<strong>Warning!</strong> The following errors must be corrected before your e-mail address can be updated:', |
184: 'E-mail key bad' => 'The specified e-mail activation key was incorrect or has expired. Please re-request change of e-mail address. If that fails, contact the forum administrator at %s.', | 184: 'E-mail key bad' => 'The specified e-mail activation key was incorrect or has expired. Please re-request change of e-mail address. If that fails, contact the forum administrator at %s.', |
185: 'E-mail updated' => 'Your e-mail address has been updated.', | 185: 'E-mail updated' => 'Your e-mail address has been updated.', |
| 186: 'E-mail updated redirect' => 'Your e-mail address has been updated. Redirecting…', |
186: 'Wrong password' => 'The password you entered was incorrect.', | 187: 'Wrong password' => 'The password you entered was incorrect.', |
187: 'Activate e-mail sent' => 'An email has been sent to the specified address with instructions on how to activate the new e-mail address. If it doesn\'t arrive you can contact the forum administrator at %s.', | 188: 'Activate e-mail sent' => 'An email has been sent to the specified address with instructions on how to activate the new e-mail address. If it doesn\'t arrive you can contact the forum administrator at %s.', |
188: 'Change your e-mail' => 'Change your e-mail address', | 189: 'Change your e-mail' => 'Change your e-mail address', |
215: 'Reg complete' => 'Registration complete. Logging in and redirecting…', | 216: 'Reg complete' => 'Registration complete. Logging in and redirecting…', |
216: 'Register errors' => '<strong>Warning!</strong> The following errors must be corrected before you can register:', | 217: 'Register errors' => '<strong>Warning!</strong> The following errors must be corrected before you can register:', |
217: 'E-mail info' => '<strong>Important!</strong> An e-mail will be sent to your new address with an activation link. You must click the link in the e-mail you receive to activate the new address. You must therefore ensure that you enter a valid and current e-mail address.', | 218: 'E-mail info' => '<strong>Important!</strong> An e-mail will be sent to your new address with an activation link. You must click the link in the e-mail you receive to activate the new address. You must therefore ensure that you enter a valid and current e-mail address.', |
218: 'Reg e-mail info' => '<strong>Important!</strong> An e-mail with an activation link will be sent to the address you provide. You must click the link in the e-mail in order to activate your new account. You must therefore ensure that you enter a valid and current e-mail address.', | 219: 'Reg e-mail info' => '<strong>Important!</strong> An e-mail with an activation link will be sent to the address you provide. You must click the link in the e-mail in order to activate your new account. It must be done in 72 hours after registration, or else your account will be deleted.', |
219: 'Register at' => 'Register at %s', | 220: 'Register at' => 'Register at %s', |
220: 'Register intro' => 'Registration enables you to use features not available when browsing the board as a guest. The fields below only make up a small part of all the settings you can alter in your profile. If you have any questions regarding this forum you should ask an administrator. Please complete the form below in order to register.', | 221: 'Register intro' => 'Registration enables you to use features not available when browsing the board as a guest. The fields below only make up a small part of all the settings you can alter in your profile. If you have any questions regarding this forum you should ask an administrator. Please complete the form below in order to register.', |
221: 'Username' => 'Username', | 222: 'Username' => 'Username', |
252: 'Username too short' => 'Usernames must be at least 2 characters long. Please choose another (longer) username.', | 253: 'Username too short' => 'Usernames must be at least 2 characters long. Please choose another (longer) username.', |
253: 'Signature quote/code' => 'The quote and code BBCodes are not allowed in signatures.', | 254: 'Signature quote/code' => 'The quote and code BBCodes are not allowed in signatures.', |
254: 'Invalid e-mail' => 'The e-mail address you entered is invalid.', | 255: 'Invalid e-mail' => 'The e-mail address you entered is invalid.', |
| 256: 'Signature quote/code/list' => 'Signature may not contain of the text formatting tags (BBCode) [quote], [code] or [list]. Please choose another tags or delete it.', |
255: | 257: |
256: ); | 258: ); |
punbb-1.3.1/misc.php |
punbb-1.3.6/misc.php |
2: /** | 2: /** |
3: * Provides various features for forum users (ie: display rules, send emails through the forum, mark a forum as read, etc). | 3: * Provides various features for forum users (ie: display rules, send emails through the forum, mark a forum as read, etc). |
4: * | 4: * |
5: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 5: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: * @package PunBB | 7: * @package PunBB |
8: */ | 8: */ |
106: if ($forum_user['is_guest']) | 106: if ($forum_user['is_guest']) |
107: message($lang_common['No permission']); | 107: message($lang_common['No permission']); |
108: | 108: |
109: $fid = intval($_GET['fid']); | 109: $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; |
110: if ($fid < 1) | 110: if ($fid < 1) |
111: message($lang_common['Bad request']); | 111: message($lang_common['Bad request']); |
112: | 112: |
113: // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid. | 113: // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid. |
114: // If it's in GET, we need to make sure it's valid. | 114: // If it's in GET, we need to make sure it's valid. |
115: if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('markforumread'.intval($_GET['fid']).$forum_user['id']))) | 115: if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('markforumread'.$fid.$forum_user['id']))) |
116: csrf_confirm_form(); | 116: csrf_confirm_form(); |
117: | 117: |
118: ($hook = get_hook('mi_markforumread_selected')) ? eval($hook) : null; | 118: ($hook = get_hook('mi_markforumread_selected')) ? eval($hook) : null; |
154: message($lang_common['No permission']); | 154: message($lang_common['No permission']); |
155: | 155: |
156: $recipient_id = intval($_GET['email']); | 156: $recipient_id = intval($_GET['email']); |
| 157: |
157: if ($recipient_id < 2) | 158: if ($recipient_id < 2) |
158: message($lang_common['Bad request']); | 159: message($lang_common['Bad request']); |
159: | 160: |
170: ); | 171: ); |
171: | 172: |
172: ($hook = get_hook('mi_email_qr_get_form_email_data')) ? eval($hook) : null; | 173: ($hook = get_hook('mi_email_qr_get_form_email_data')) ? eval($hook) : null; |
| 174: |
173: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); | 175: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 176: |
174: if (!$forum_db->num_rows($result)) | 177: if (!$forum_db->num_rows($result)) |
175: message($lang_common['Bad request']); | 178: message($lang_common['Bad request']); |
176: | 179: |
179: if ($email_setting == 2 && !$forum_user['is_admmod']) | 182: if ($email_setting == 2 && !$forum_user['is_admmod']) |
180: message($lang_misc['Form e-mail disabled']); | 183: message($lang_misc['Form e-mail disabled']); |
181: | 184: |
| 185: if ($recipient_email == '') |
| 186: message($lang_common['Bad request']); |
182: | 187: |
183: if (isset($_POST['form_sent'])) | 188: if (isset($_POST['form_sent'])) |
184: { | 189: { |
367: { | 372: { |
368: ($hook = get_hook('mi_report_form_submitted')) ? eval($hook) : null; | 373: ($hook = get_hook('mi_report_form_submitted')) ? eval($hook) : null; |
369: | 374: |
| 375: // Start with a clean slate |
| 376: $errors = array(); |
| 377: |
370: // Flood protection | 378: // Flood protection |
371: if ($forum_user['last_email_sent'] != '' && (time() - $forum_user['last_email_sent']) < $forum_user['g_email_flood'] && (time() - $forum_user['last_email_sent']) >= 0) | 379: if ($forum_user['last_email_sent'] != '' && (time() - $forum_user['last_email_sent']) < $forum_user['g_email_flood'] && (time() - $forum_user['last_email_sent']) >= 0) |
372: message(sprintf($lang_misc['Report flood'], $forum_user['g_email_flood'])); | 380: message(sprintf($lang_misc['Report flood'], $forum_user['g_email_flood'])); |
376: if ($reason == '') | 384: if ($reason == '') |
377: message($lang_misc['No reason']); | 385: message($lang_misc['No reason']); |
378: | 386: |
379: // Get some info about the topic we're reporting | 387: if (strlen($reason) > FORUM_MAX_POSTSIZE_BYTES) |
380: $query = array( | |
381: 'SELECT' => 't.id, t.subject, t.forum_id', | |
382: 'FROM' => 'posts AS p', | |
383: 'JOINS' => array( | |
384: array( | |
385: 'INNER JOIN' => 'topics AS t', | |
386: 'ON' => 't.id=p.topic_id' | |
387: ) | |
388: ), | |
389: 'WHERE' => 'p.id='.$post_id | |
390: ); | |
391: | |
392: ($hook = get_hook('mi_report_qr_get_topic_data')) ? eval($hook) : null; | |
393: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); | |
394: if (!$forum_db->num_rows($result)) | |
395: message($lang_common['Bad request']); | |
396: | |
397: list($topic_id, $subject, $forum_id) = $forum_db->fetch_row($result); | |
398: | |
399: ($hook = get_hook('mi_report_pre_reports_sent')) ? eval($hook) : null; | |
400: | |
401: // Should we use the internal report handling? | |
402: if ($forum_config['o_report_method'] == 0 || $forum_config['o_report_method'] == 2) | |
403: { | 388: { |
| 389: $errors[] = sprintf($lang_misc['Too long reason'], forum_number_format(strlen($reason)), forum_number_format(FORUM_MAX_POSTSIZE_BYTES)); |
| 390: } |
| 391: |
| 392: if (empty($errors)) { |
| 393: // Get some info about the topic we're reporting |
404: $query = array( | 394: $query = array( |
405: 'INSERT' => 'post_id, topic_id, forum_id, reported_by, created, message', | 395: 'SELECT' => 't.id, t.subject, t.forum_id', |
406: 'INTO' => 'reports', | 396: 'FROM' => 'posts AS p', |
407: 'VALUES' => $post_id.', '.$topic_id.', '.$forum_id.', '.$forum_user['id'].', '.time().', \''.$forum_db->escape($reason).'\'' | 397: 'JOINS' => array( |
| 398: array( |
| 399: 'INNER JOIN' => 'topics AS t', |
| 400: 'ON' => 't.id=p.topic_id' |
| 401: ) |
| 402: ), |
| 403: 'WHERE' => 'p.id='.$post_id |
408: ); | 404: ); |
409: | 405: |
410: ($hook = get_hook('mi_report_add_report')) ? eval($hook) : null; | 406: ($hook = get_hook('mi_report_qr_get_topic_data')) ? eval($hook) : null; |
411: $forum_db->query_build($query) or error(__FILE__, __LINE__); | 407: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
412: } | 408: if (!$forum_db->num_rows($result)) |
| 409: message($lang_common['Bad request']); |
413: | 410: |
414: // Should we e-mail the report? | 411: list($topic_id, $subject, $forum_id) = $forum_db->fetch_row($result); |
415: if ($forum_config['o_report_method'] == 1 || $forum_config['o_report_method'] == 2) | 412: |
416: { | 413: ($hook = get_hook('mi_report_pre_reports_sent')) ? eval($hook) : null; |
417: // We send it to the complete mailing-list in one swoop | 414: |
418: if ($forum_config['o_mailing_list'] != '') | 415: // Should we use the internal report handling? |
| 416: if ($forum_config['o_report_method'] == 0 || $forum_config['o_report_method'] == 2) |
419: { | 417: { |
420: $mail_subject = 'Report('.$forum_id.') - \''.$subject.'\''; | 418: $query = array( |
421: $mail_message = 'User \''.$forum_user['username'].'\' has reported the following message:'."\n".forum_link($forum_url['post'], $post_id)."\n\n".'Reason:'."\n".$reason; | 419: 'INSERT' => 'post_id, topic_id, forum_id, reported_by, created, message', |
| 420: 'INTO' => 'reports', |
| 421: 'VALUES' => $post_id.', '.$topic_id.', '.$forum_id.', '.$forum_user['id'].', '.time().', \''.$forum_db->escape($reason).'\'' |
| 422: ); |
422: | 423: |
423: if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) | 424: ($hook = get_hook('mi_report_add_report')) ? eval($hook) : null; |
424: require FORUM_ROOT.'include/email.php'; | 425: $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 426: } |
425: | 427: |
426: ($hook = get_hook('mi_report_modify_message')) ? eval($hook) : null; | 428: // Should we e-mail the report? |
| 429: if ($forum_config['o_report_method'] == 1 || $forum_config['o_report_method'] == 2) |
| 430: { |
| 431: // We send it to the complete mailing-list in one swoop |
| 432: if ($forum_config['o_mailing_list'] != '') |
| 433: { |
| 434: $mail_subject = 'Report('.$forum_id.') - \''.$subject.'\''; |
| 435: $mail_message = 'User \''.$forum_user['username'].'\' has reported the following message:'."\n".forum_link($forum_url['post'], $post_id)."\n\n".'Reason:'."\n".$reason; |
| 436: |
| 437: if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) |
| 438: require FORUM_ROOT.'include/email.php'; |
427: | 439: |
428: forum_mail($forum_config['o_mailing_list'], $mail_subject, $mail_message); | 440: ($hook = get_hook('mi_report_modify_message')) ? eval($hook) : null; |
| 441: |
| 442: forum_mail($forum_config['o_mailing_list'], $mail_subject, $mail_message); |
| 443: } |
429: } | 444: } |
430: } | |
431: | 445: |
432: // Set last_email_sent time to prevent flooding | 446: // Set last_email_sent time to prevent flooding |
433: $query = array( | 447: $query = array( |
434: 'UPDATE' => 'users', | 448: 'UPDATE' => 'users', |
435: 'SET' => 'last_email_sent='.time(), | 449: 'SET' => 'last_email_sent='.time(), |
436: 'WHERE' => 'id='.$forum_user['id'] | 450: 'WHERE' => 'id='.$forum_user['id'] |
437: ); | 451: ); |
438: | 452: |
439: ($hook = get_hook('mi_report_qr_update_last_email_sent')) ? eval($hook) : null; | 453: ($hook = get_hook('mi_report_qr_update_last_email_sent')) ? eval($hook) : null; |
440: $forum_db->query_build($query) or error(__FILE__, __LINE__); | 454: $forum_db->query_build($query) or error(__FILE__, __LINE__); |
441: | 455: |
442: ($hook = get_hook('mi_report_pre_redirect')) ? eval($hook) : null; | 456: ($hook = get_hook('mi_report_pre_redirect')) ? eval($hook) : null; |
443: | 457: |
444: redirect(forum_link($forum_url['post'], $post_id), $lang_misc['Report redirect']); | 458: redirect(forum_link($forum_url['post'], $post_id), $lang_misc['Report redirect']); |
| 459: } |
445: } | 460: } |
446: | 461: |
447: // Setup form | 462: // Setup form |
480: <div id="req-msg" class="req-warn ct-box error-box"> | 495: <div id="req-msg" class="req-warn ct-box error-box"> |
481: <p class="important"><?php printf($lang_common['Required warn'], '<em>'.$lang_common['Required'].'</em>') ?></p> | 496: <p class="important"><?php printf($lang_common['Required warn'], '<em>'.$lang_common['Required'].'</em>') ?></p> |
482: </div> | 497: </div> |
| 498: <?php |
| 499: // If there were any errors, show them |
| 500: if (!empty($errors)) { |
| 501: $forum_page['errors'] = array(); |
| 502: foreach ($errors as $cur_error) { |
| 503: $forum_page['errors'][] = '<li class="warn"><span>'.$cur_error.'</span></li>'; |
| 504: } |
| 505: |
| 506: ($hook = get_hook('mi_pre_report_errors')) ? eval($hook) : null; |
| 507: ?> |
| 508: <div class="ct-box error-box"> |
| 509: <h2 class="warn hn"><?php echo $lang_misc['Report errors'] ?></h2> |
| 510: <ul class="error-list"> |
| 511: <?php echo implode("\n\t\t\t\t", $forum_page['errors'])."\n" ?> |
| 512: </ul> |
| 513: </div> |
| 514: <?php |
| 515: } |
| 516: ?> |
483: <form id="afocus" class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>"> | 517: <form id="afocus" class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>"> |
484: <div class="hidden"> | 518: <div class="hidden"> |
485: <?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields'])."\n" ?> | 519: <?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields'])."\n" ?> |
528: | 562: |
529: // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid. | 563: // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid. |
530: // If it's in GET, we need to make sure it's valid. | 564: // If it's in GET, we need to make sure it's valid. |
531: if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('subscribe'.intval($_GET['subscribe']).$forum_user['id']))) | 565: if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('subscribe'.$topic_id.$forum_user['id']))) |
532: csrf_confirm_form(); | 566: csrf_confirm_form(); |
533: | 567: |
534: ($hook = get_hook('mi_subscribe_selected')) ? eval($hook) : null; | 568: ($hook = get_hook('mi_subscribe_selected')) ? eval($hook) : null; |
590: | 624: |
591: // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid. | 625: // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid. |
592: // If it's in GET, we need to make sure it's valid. | 626: // If it's in GET, we need to make sure it's valid. |
593: if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('unsubscribe'.intval($_GET['unsubscribe']).$forum_user['id']))) | 627: if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('unsubscribe'.$topic_id.$forum_user['id']))) |
594: csrf_confirm_form(); | 628: csrf_confirm_form(); |
595: | 629: |
596: ($hook = get_hook('mi_unsubscribe_selected')) ? eval($hook) : null; | 630: ($hook = get_hook('mi_unsubscribe_selected')) ? eval($hook) : null; |
punbb-1.3.1/moderate.php |
punbb-1.3.6/moderate.php |
2: /** | 2: /** |
3: * Provides various mass-moderation tools to moderators. | 3: * Provides various mass-moderation tools to moderators. |
4: * | 4: * |
5: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 5: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: * @package PunBB | 7: * @package PunBB |
8: */ | 8: */ |
63: | 63: |
64: // Get some info about the forum we're moderating | 64: // Get some info about the forum we're moderating |
65: $query = array( | 65: $query = array( |
66: 'SELECT' => 'f.forum_name, f.redirect_url, f.num_topics, f.moderators', | 66: 'SELECT' => 'f.forum_name, f.redirect_url, f.num_topics, f.moderators, f.sort_by', |
67: 'FROM' => 'forums AS f', | 67: 'FROM' => 'forums AS f', |
68: 'JOINS' => array( | 68: 'JOINS' => array( |
69: array( | 69: array( |
373: <?php ($hook = get_hook('mr_confirm_split_posts_pre_subject')) ? eval($hook) : null; ?> | 373: <?php ($hook = get_hook('mr_confirm_split_posts_pre_subject')) ? eval($hook) : null; ?> |
374: <div class="sf-box text required"> | 374: <div class="sf-box text required"> |
375: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_misc['New subject'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label><br /> | 375: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_misc['New subject'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label><br /> |
376: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="new_subject" value="" size="80" maxlength="70" /></span> | 376: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="new_subject" value="" size="70" maxlength="70" /></span> |
377: </div> | 377: </div> |
378: <?php ($hook = get_hook('mr_confirm_split_posts_pre_confirm_checkbox')) ? eval($hook) : null; ?> | 378: <?php ($hook = get_hook('mr_confirm_split_posts_pre_confirm_checkbox')) ? eval($hook) : null; ?> |
379: <div class="sf-box checkbox"> | 379: <div class="sf-box checkbox"> |
416: | 416: |
417: // Determine the post offset (based on $_GET['p']) | 417: // Determine the post offset (based on $_GET['p']) |
418: $forum_page['num_pages'] = ceil(($cur_topic['num_replies'] + 1) / $forum_user['disp_posts']); | 418: $forum_page['num_pages'] = ceil(($cur_topic['num_replies'] + 1) / $forum_user['disp_posts']); |
419: $forum_page['page'] = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $forum_page['num_pages']) ? 1 : intval($_GET['p']); | 419: $forum_page['page'] = (!isset($_GET['p']) || !is_numeric($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $forum_page['num_pages']) ? 1 : intval($_GET['p']); |
420: $forum_page['start_from'] = $forum_user['disp_posts'] * ($forum_page['page'] - 1); | 420: $forum_page['start_from'] = $forum_user['disp_posts'] * ($forum_page['page'] - 1); |
421: $forum_page['finish_at'] = min(($forum_page['start_from'] + $forum_user['disp_posts']), ($cur_topic['num_replies'] + 1)); | 421: $forum_page['finish_at'] = min(($forum_page['start_from'] + $forum_user['disp_posts']), ($cur_topic['num_replies'] + 1)); |
422: $forum_page['items_info'] = generate_items_info($lang_misc['Posts'], ($forum_page['start_from'] + 1), ($cur_topic['num_replies'] + 1)); | 422: $forum_page['items_info'] = generate_items_info($lang_misc['Posts'], ($forum_page['start_from'] + 1), ($cur_topic['num_replies'] + 1)); |
521: | 521: |
522: $forum_page['post_ident'] = array(); | 522: $forum_page['post_ident'] = array(); |
523: $forum_page['message'] = array(); | 523: $forum_page['message'] = array(); |
524: $forum_page['author_title'] = ''; | |
525: $forum_page['user_ident'] = array(); | 524: $forum_page['user_ident'] = array(); |
526: $cur_post['username'] = $cur_post['poster']; | 525: $cur_post['username'] = $cur_post['poster']; |
527: | 526: |
1039: </div> | 1038: </div> |
1040: <?php ($hook = get_hook('mr_merge_topics_pre_fieldset')) ? eval($hook) : null; ?> | 1039: <?php ($hook = get_hook('mr_merge_topics_pre_fieldset')) ? eval($hook) : null; ?> |
1041: <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>"> | 1040: <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>"> |
1042: <legend class="group-legend"><strong><?php echo $lang_misc['Merge topic'] ?></strong></legend> | 1041: <legend class="group-legend"><strong><?php echo $lang_misc['Merge topics'] ?></strong></legend> |
1043: <?php ($hook = get_hook('mr_merge_topics_pre_redirect_checkbox')) ? eval($hook) : null; ?> | 1042: <?php ($hook = get_hook('mr_merge_topics_pre_redirect_checkbox')) ? eval($hook) : null; ?> |
1044: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1043: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1045: <div class="sf-box checkbox"> | 1044: <div class="sf-box checkbox"> |
1424: // Determine the topic offset (based on $_GET['p']) | 1423: // Determine the topic offset (based on $_GET['p']) |
1425: $forum_page['num_pages'] = ceil($cur_forum['num_topics'] / $forum_user['disp_topics']); | 1424: $forum_page['num_pages'] = ceil($cur_forum['num_topics'] / $forum_user['disp_topics']); |
1426: | 1425: |
1427: $forum_page['page'] = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $forum_page['num_pages']) ? 1 : $_GET['p']; | 1426: $forum_page['page'] = (!isset($_GET['p']) || !is_numeric($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $forum_page['num_pages']) ? 1 : $_GET['p']; |
1428: $forum_page['start_from'] = $forum_user['disp_topics'] * ($forum_page['page'] - 1); | 1427: $forum_page['start_from'] = $forum_user['disp_topics'] * ($forum_page['page'] - 1); |
1429: $forum_page['finish_at'] = min(($forum_page['start_from'] + $forum_user['disp_topics']), ($cur_forum['num_topics'])); | 1428: $forum_page['finish_at'] = min(($forum_page['start_from'] + $forum_user['disp_topics']), ($cur_forum['num_topics'])); |
1430: $forum_page['items_info'] = generate_items_info($lang_misc['Topics'], ($forum_page['start_from'] + 1), $cur_forum['num_topics']); | 1429: $forum_page['items_info'] = generate_items_info($lang_misc['Topics'], ($forum_page['start_from'] + 1), $cur_forum['num_topics']); |
1434: 'SELECT' => 't.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to', | 1433: 'SELECT' => 't.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to', |
1435: 'FROM' => 'topics AS t', | 1434: 'FROM' => 'topics AS t', |
1436: 'WHERE' => 'forum_id='.$fid, | 1435: 'WHERE' => 'forum_id='.$fid, |
1437: 'ORDER BY' => 't.sticky DESC, last_post DESC', | 1436: 'ORDER BY' => 't.sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 't.posted' : 't.last_post').' DESC', |
1438: 'LIMIT' => $forum_page['start_from'].', '.$forum_user['disp_topics'] | 1437: 'LIMIT' => $forum_page['start_from'].', '.$forum_user['disp_topics'] |
1439: ); | 1438: ); |
1440: | 1439: |
1535: ++$forum_page['item_count']; | 1534: ++$forum_page['item_count']; |
1536: | 1535: |
1537: // Start from scratch | 1536: // Start from scratch |
1538: $forum_page['item_subject'] = $forum_page['item_body'] = $forum_page['item_status'] = $forum_page['item_nav'] = $forum_page['item_title'] = $forum_page['item_subject_status'] = array(); | 1537: $forum_page['item_subject'] = $forum_page['item_body'] = $forum_page['item_status'] = $forum_page['item_nav'] = $forum_page['item_title'] = $forum_page['item_title_status'] = array(); |
1539: $forum_page['item_indicator'] = ''; | |
1540: | 1538: |
1541: if ($forum_config['o_censoring'] == '1') | 1539: if ($forum_config['o_censoring'] == '1') |
1542: $cur_topic['subject'] = censor_words($cur_topic['subject']); | 1540: $cur_topic['subject'] = censor_words($cur_topic['subject']); |
1543: | 1541: |
| 1542: $forum_page['item_subject']['starter'] = '<span class="item-starter">'.sprintf($lang_forum['Topic starter'], forum_htmlencode($cur_topic['poster'])).'</span>'; |
| 1543: |
1544: if ($cur_topic['moved_to'] != null) | 1544: if ($cur_topic['moved_to'] != null) |
1545: { | 1545: { |
1546: $forum_page['item_status']['moved'] = 'moved'; | 1546: $forum_page['item_status']['moved'] = 'moved'; |
1547: $forum_page['item_title']['link'] = '<a href="'.forum_link($forum_url['topic'], array($cur_topic['moved_to'], sef_friendly($cur_topic['subject']))).'"><span>'.$lang_forum['Moved'].'</span> '.forum_htmlencode($cur_topic['subject']).'</a>'; | 1547: $forum_page['item_title']['link'] = '<span class="item-status"><em class="moved">'.sprintf($lang_forum['Item status'], $lang_forum['Moved']).'</em></span> <a href="'.forum_link($forum_url['topic'], array($cur_topic['moved_to'], sef_friendly($cur_topic['subject']))).'">'.forum_htmlencode($cur_topic['subject']).'</a>'; |
1548: | 1548: |
1549: // Combine everything to produce the Topic heading | 1549: // Combine everything to produce the Topic heading |
1550: $forum_page['item_body']['subject']['title'] = '<h3 class="hn"><span class="item-num">'.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span> <strong>'.$forum_page['item_title']['link'].'</strong></h3>'; | 1550: $forum_page['item_body']['subject']['title'] = '<h3 class="hn"><span class="item-num">'.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span> <strong>'.$forum_page['item_title']['link'].'</strong></h3>'; |
1573: $forum_page['item_status']['posted'] = 'posted'; | 1573: $forum_page['item_status']['posted'] = 'posted'; |
1574: } | 1574: } |
1575: | 1575: |
| 1576: if ($cur_topic['sticky'] == '1') |
| 1577: { |
| 1578: $forum_page['item_title_status']['sticky'] = '<em class="sticky">'.$lang_forum['Sticky'].'</em>'; |
| 1579: $forum_page['item_status']['sticky'] = 'sticky'; |
| 1580: } |
| 1581: |
| 1582: if ($cur_topic['closed'] == '1') |
| 1583: { |
| 1584: $forum_page['item_title_status']['closed'] = '<em class="closed">'.$lang_forum['Closed'].'</em>'; |
| 1585: $forum_page['item_status']['closed'] = 'closed'; |
| 1586: } |
| 1587: |
| 1588: ($hook = get_hook('mr_topic_loop_normal_topic_pre_item_title_status_merge')) ? eval($hook) : null; |
| 1589: |
| 1590: if (!empty($forum_page['item_title_status'])) |
| 1591: $forum_page['item_title']['status'] = '<span class="item-status">'.sprintf($lang_forum['Item status'], implode(', ', $forum_page['item_title_status'])).'</span>'; |
| 1592: |
1576: $forum_page['item_title']['link'] = '<strong><a href="'.forum_link($forum_url['topic'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))).'">'.forum_htmlencode($cur_topic['subject']).'</a></strong>'; | 1593: $forum_page['item_title']['link'] = '<strong><a href="'.forum_link($forum_url['topic'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))).'">'.forum_htmlencode($cur_topic['subject']).'</a></strong>'; |
1577: | 1594: |
| 1595: ($hook = get_hook('mr_topic_loop_normal_topic_pre_item_title_merge')) ? eval($hook) : null; |
| 1596: |
| 1597: $forum_page['item_body']['subject']['title'] = '<h3 class="hn"><span class="item-num">'.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span> '.implode(' ', $forum_page['item_title']).'</h3>'; |
| 1598: |
| 1599: |
| 1600: if (empty($forum_page['item_status'])) |
| 1601: $forum_page['item_status']['normal'] = 'normal'; |
| 1602: |
1578: $forum_page['item_pages'] = ceil(($cur_topic['num_replies'] + 1) / $forum_user['disp_posts']); | 1603: $forum_page['item_pages'] = ceil(($cur_topic['num_replies'] + 1) / $forum_user['disp_posts']); |
1579: | 1604: |
1580: if ($forum_page['item_pages'] > 1) | 1605: if ($forum_page['item_pages'] > 1) |
1587: $forum_page['item_status']['new'] = 'new'; | 1612: $forum_page['item_status']['new'] = 'new'; |
1588: } | 1613: } |
1589: | 1614: |
1590: if (!empty($forum_page['item_nav'])) | 1615: ($hook = get_hook('mr_topic_loop_normal_topic_pre_item_nav_merge')) ? eval($hook) : null; |
1591: $forum_page['item_title']['nav'] = '<span class="item-nav">'.sprintf($lang_forum['Topic navigation'], implode('  ', $forum_page['item_nav'])).'</span>'; | |
1592: | |
1593: ($hook = get_hook('mr_topic_actions_moved_row_pre_item_title_merge')) ? eval($hook) : null; | |
1594: | 1616: |
1595: $forum_page['item_body']['subject']['title'] = '<h3 class="hn"><span class="item-num">'.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span> '.implode(' ', $forum_page['item_title']).'</h3>'; | 1617: if (!empty($forum_page['item_nav'])) |
| 1618: $forum_page['item_subject']['nav'] = '<span class="item-nav">'.sprintf($lang_forum['Topic navigation'], implode('  ', $forum_page['item_nav'])).'</span>'; |
1596: | 1619: |
1597: // Assemble the Topic subject | 1620: // Assemble the Topic subject |
1598: | 1621: |
1599: if ($cur_topic['sticky'] == '1') | |
1600: { | |
1601: $forum_page['item_subject_status']['sticky'] = $lang_forum['Sticky']; | |
1602: $forum_page['item_status']['sticky'] = 'sticky'; | |
1603: } | |
1604: | |
1605: if ($cur_topic['closed'] == '1') | |
1606: { | |
1607: $forum_page['item_subject_status']['closed'] = $lang_forum['Closed']; | |
1608: $forum_page['item_status']['closed'] = 'closed'; | |
1609: } | |
1610: | |
1611: ($hook = get_hook('mr_topic_actions_moved_row_pre_item_subject_status_merge')) ? eval($hook) : null; | |
1612: | |
1613: if (!empty($forum_page['item_subject_status'])) | |
1614: $forum_page['item_subject']['status'] = '<span class="item-status">'.sprintf($lang_forum['Item status'], implode(' ', $forum_page['item_subject_status'])).'</span>'; | |
1615: | |
1616: if (empty($forum_page['item_status'])) | |
1617: $forum_page['item_status']['normal'] = 'normal'; | |
1618: | |
1619: $forum_page['item_body']['info']['replies'] = '<li class="info-replies"><strong>'.forum_number_format($cur_topic['num_replies']).'</strong> <span class="label">'.(($cur_topic['num_replies'] == 1) ? $lang_forum['Reply'] : $lang_forum['Replies']).'</span></li>'; | 1622: $forum_page['item_body']['info']['replies'] = '<li class="info-replies"><strong>'.forum_number_format($cur_topic['num_replies']).'</strong> <span class="label">'.(($cur_topic['num_replies'] == 1) ? $lang_forum['Reply'] : $lang_forum['Replies']).'</span></li>'; |
1620: | 1623: |
1621: if ($forum_config['o_topic_views'] == '1') | 1624: if ($forum_config['o_topic_views'] == '1') |
1627: ($hook = get_hook('mr_topic_actions_normal_row_pre_output')) ? eval($hook) : null; | 1630: ($hook = get_hook('mr_topic_actions_normal_row_pre_output')) ? eval($hook) : null; |
1628: } | 1631: } |
1629: | 1632: |
1630: $forum_page['item_subject']['starter'] = '<span class="item-starter">'.sprintf($lang_forum['Topic starter'], '<cite>'.forum_htmlencode($cur_topic['poster']).'</cite>').'</span>'; | 1633: $forum_page['item_body']['subject']['desc'] = '<p>'.implode(' ', $forum_page['item_subject']).'</p>'; |
1631: $forum_page['item_body']['subject']['desc'] = implode(' ', $forum_page['item_subject']); | 1634: |
| 1635: ($hook = get_hook('mr_topic_actions_row_pre_item_status_merge')) ? eval($hook) : null; |
1632: | 1636: |
1633: $forum_page['item_style'] = (($forum_page['item_count'] % 2 != 0) ? ' odd' : ' even').(($forum_page['item_count'] == 1) ? ' main-first-item' : '').((!empty($forum_page['item_status'])) ? ' '.implode(' ', $forum_page['item_status']) : ''); | 1637: $forum_page['item_style'] = (($forum_page['item_count'] % 2 != 0) ? ' odd' : ' even').(($forum_page['item_count'] == 1) ? ' main-first-item' : '').((!empty($forum_page['item_status'])) ? ' '.implode(' ', $forum_page['item_status']) : ''); |
1634: | 1638: |
punbb-1.3.1/post.php |
punbb-1.3.6/post.php |
2: /** | 2: /** |
3: * Adds a new post to the specified topic or a new topic to the specified forum. | 3: * Adds a new post to the specified topic or a new topic to the specified forum. |
4: * | 4: * |
5: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 5: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: * @package PunBB | 7: * @package PunBB |
8: */ | 8: */ |
124: $errors[] = $lang_post['No subject']; | 124: $errors[] = $lang_post['No subject']; |
125: else if (utf8_strlen($subject) > 70) | 125: else if (utf8_strlen($subject) > 70) |
126: $errors[] = $lang_post['Too long subject']; | 126: $errors[] = $lang_post['Too long subject']; |
127: else if ($forum_config['p_subject_all_caps'] == '0' && utf8_strtoupper($subject) == $subject && !$forum_page['is_admmod']) | 127: else if ($forum_config['p_subject_all_caps'] == '0' && check_is_all_caps($subject) && !$forum_page['is_admmod']) |
128: $errors[] = $lang_post['All caps subject']; | 128: $errors[] = $lang_post['All caps subject']; |
129: } | 129: } |
130: | 130: |
153: | 153: |
154: if (!is_valid_email($email)) | 154: if (!is_valid_email($email)) |
155: $errors[] = $lang_post['Invalid e-mail']; | 155: $errors[] = $lang_post['Invalid e-mail']; |
| 156: |
| 157: if (is_banned_email($email)) |
| 158: $errors[] = $lang_profile['Banned e-mail']; |
156: } | 159: } |
157: } | 160: } |
158: | 161: |
165: | 168: |
166: if (strlen($message) > FORUM_MAX_POSTSIZE_BYTES) | 169: if (strlen($message) > FORUM_MAX_POSTSIZE_BYTES) |
167: $errors[] = sprintf($lang_post['Too long message'], forum_number_format(strlen($message)), forum_number_format(FORUM_MAX_POSTSIZE_BYTES)); | 170: $errors[] = sprintf($lang_post['Too long message'], forum_number_format(strlen($message)), forum_number_format(FORUM_MAX_POSTSIZE_BYTES)); |
168: else if ($forum_config['p_message_all_caps'] == '0' && utf8_strtoupper($message) == $message && !$forum_page['is_admmod']) | 171: else if ($forum_config['p_message_all_caps'] == '0' && check_is_all_caps($message) && !$forum_page['is_admmod']) |
169: $errors[] = $lang_post['All caps message']; | 172: $errors[] = $lang_post['All caps message']; |
170: | 173: |
171: // Validate BBCode syntax | 174: // Validate BBCode syntax |
262: | 265: |
263: list($q_poster, $q_message) = $forum_db->fetch_row($result); | 266: list($q_poster, $q_message) = $forum_db->fetch_row($result); |
264: | 267: |
| 268: ($hook = get_hook('po_modify_quote_info')) ? eval($hook) : null; |
| 269: |
265: if ($forum_config['p_message_bbcode'] == '1') | 270: if ($forum_config['p_message_bbcode'] == '1') |
266: { | 271: { |
267: // If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends) | 272: // If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends) |
462: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 467: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
463: <div class="sf-box text required longtext"> | 468: <div class="sf-box text required longtext"> |
464: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_post['Topic subject'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label><br /> | 469: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_post['Topic subject'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label><br /> |
465: <span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo forum_htmlencode($subject); ?>" size="80" maxlength="70" /></span> | 470: <span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo forum_htmlencode($subject); ?>" size="70" maxlength="70" /></span> |
466: </div> | 471: </div> |
467: </div> | 472: </div> |
468: <?php | 473: <?php |
543: if (!defined('FORUM_PARSER_LOADED')) | 548: if (!defined('FORUM_PARSER_LOADED')) |
544: require FORUM_ROOT.'include/parser.php'; | 549: require FORUM_ROOT.'include/parser.php'; |
545: | 550: |
| 551: // Get the amount of posts in the topic |
| 552: $query = array( |
| 553: 'SELECT' => 'count(p.id)', |
| 554: 'FROM' => 'posts AS p', |
| 555: 'WHERE' => 'topic_id='.$tid |
| 556: ); |
| 557: |
| 558: ($hook = get_hook('po_topic_review_qr_get_post_count')) ? eval($hook) : null; |
| 559: $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 560: $forum_page['total_post_count'] = $forum_db->result($result, 0); |
| 561: |
546: // Get posts to display in topic review | 562: // Get posts to display in topic review |
547: $query = array( | 563: $query = array( |
548: 'SELECT' => 'p.id, p.poster, p.message, p.hide_smilies, p.posted', | 564: 'SELECT' => 'p.id, p.poster, p.message, p.hide_smilies, p.posted', |
549: 'FROM' => 'posts AS p', | 565: 'FROM' => 'posts AS p', |
550: 'WHERE' => 'topic_id='.$tid, | 566: 'WHERE' => 'topic_id='.$tid, |
551: 'ORDER BY' => 'id DESC', | 567: 'ORDER BY' => 'id DESC', |
552: 'LIMIT' => $forum_config['o_topic_review'] | 568: 'LIMIT' => $forum_config['o_topic_review'] |
553: ); | 569: ); |
554: | 570: |
555: ($hook = get_hook('po_topic_review_qr_get_topic_review_posts')) ? eval($hook) : null; | 571: ($hook = get_hook('po_topic_review_qr_get_topic_review_posts')) ? eval($hook) : null; |
564: | 580: |
565: $forum_page['item_count'] = 0; | 581: $forum_page['item_count'] = 0; |
566: $forum_page['item_total'] = $forum_db->num_rows($result); | 582: $forum_page['item_total'] = $forum_db->num_rows($result); |
567: $forum_page['author_title'] = ''; | |
568: | 583: |
569: while ($cur_post = $forum_db->fetch_assoc($result)) | 584: while ($cur_post = $forum_db->fetch_assoc($result)) |
570: { | 585: { |
571: ++$forum_page['item_count']; | 586: ++$forum_page['item_count']; |
572: | 587: |
573: // Generate the post heading | |
574: $forum_page['post_ident'] = array( | |
575: 'num' => '<span class="post-num">'.forum_number_format($forum_page['item_count']).'</span>', | |
576: 'link' => '<span class="post-link">'.sprintf($lang_post['Post posted'], '<a class="permalink" rel="bookmark" title="'.$lang_post['Permalink post'].'" href="'.forum_link($forum_url['post'], $cur_post['id']).'">'.format_time($cur_post['posted']).'</a>').'</span>' | |
577: ); | |
578: | |
579: ($hook = get_hook('po_topic_review_pre_item_indent_merge')) ? eval($hook) : null; | |
580: | |
581: $forum_page['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); | 588: $forum_page['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); |
582: | 589: |
583: // Generate the post heading | 590: // Generate the post heading |
584: $forum_page['post_ident'] = array(); | 591: $forum_page['post_ident'] = array(); |
585: $forum_page['post_ident']['num'] = '<span class="post-num">'.forum_number_format($forum_page['item_count']).'</span>'; | 592: $forum_page['post_ident']['num'] = '<span class="post-num">'.forum_number_format($forum_page['total_post_count'] - $forum_page['item_count'] + 1).'</span>'; |
586: $forum_page['post_ident']['byline'] = '<span class="post-byline">'.sprintf($lang_post['Post byline'], '<strong>'.forum_htmlencode($cur_post['poster']).'</strong>').'</span>'; | 593: $forum_page['post_ident']['byline'] = '<span class="post-byline">'.sprintf($lang_post['Post byline'], '<strong>'.forum_htmlencode($cur_post['poster']).'</strong>').'</span>'; |
587: $forum_page['post_ident']['link'] = '<span class="post-link"><a class="permalink" rel="bookmark" title="'.$lang_post['Permalink post'].'" href="'.forum_link($forum_url['post'], $cur_post['id']).'">'.format_time($cur_post['posted']).'</a></span>'; | 594: $forum_page['post_ident']['link'] = '<span class="post-link"><a class="permalink" rel="bookmark" title="'.$lang_post['Permalink post'].'" href="'.forum_link($forum_url['post'], $cur_post['id']).'">'.format_time($cur_post['posted']).'</a></span>'; |
588: | 595: |
punbb-1.3.1/profile.php |
punbb-1.3.6/profile.php |
2: /** | 2: /** |
3: * Allows users to view and edit their details. | 3: * Allows users to view and edit their details. |
4: * | 4: * |
5: * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org | 5: * @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org |
6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | 6: * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
7: * @package PunBB | 7: * @package PunBB |
8: */ | 8: */ |
176: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 176: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
177: <div class="sf-box text required"> | 177: <div class="sf-box text required"> |
178: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['New password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Password help'] ?></small></label><br /> | 178: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['New password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Password help'] ?></small></label><br /> |
179: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password1" size="35" value="<?php echo(isset($_POST['req_new_password1']) ? ($_POST['req_new_password1']) : ''); ?>"/></span><br /> | 179: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password1" size="35" value="<?php echo(isset($_POST['req_new_password1']) ? forum_htmlencode($_POST['req_new_password1']) : ''); ?>"/></span><br /> |
180: </div> | 180: </div> |
181: </div> | 181: </div> |
182: <?php ($hook = get_hook('pf_change_pass_key_pre_new_password_confirm')) ? eval($hook) : null; ?> | 182: <?php ($hook = get_hook('pf_change_pass_key_pre_new_password_confirm')) ? eval($hook) : null; ?> |
183: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 183: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
184: <div class="sf-box text required"> | 184: <div class="sf-box text required"> |
185: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Confirm new password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Confirm password help'] ?></small></label><br /> | 185: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Confirm new password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Confirm password help'] ?></small></label><br /> |
186: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password2" size="35" value="<?php echo(isset($_POST['req_new_password2']) ? ($_POST['req_new_password2']) : ''); ?>"/></span><br /> | 186: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password2" size="35" value="<?php echo(isset($_POST['req_new_password2']) ? forum_htmlencode($_POST['req_new_password2']) : ''); ?>"/></span><br /> |
187: </div> | 187: </div> |
188: </div> | 188: </div> |
189: <?php ($hook = get_hook('pf_change_pass_key_pre_fieldset_end')) ? eval($hook) : null; ?> | 189: <?php ($hook = get_hook('pf_change_pass_key_pre_fieldset_end')) ? eval($hook) : null; ?> |
336: <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>"> | 336: <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>"> |
337: <legend class="group-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend> | 337: <legend class="group-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend> |
338: <?php ($hook = get_hook('pf_change_pass_normal_pre_old_password')) ? eval($hook) : null; ?> | 338: <?php ($hook = get_hook('pf_change_pass_normal_pre_old_password')) ? eval($hook) : null; ?> |
339: <?php if (!$forum_user['is_admmod']): ?> | 339: <?php if (!$forum_user['is_admmod'] || $forum_user['id'] == $id): ?> |
340: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 340: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
341: <div class="sf-box text required"> | 341: <div class="sf-box text required"> |
342: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Old password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Old password help'] ?></small></label><br /> | 342: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Old password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Old password help'] ?></small></label><br /> |
343: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_old_password" size="35" value="<?php echo(isset($_POST['req_old_password']) ? ($_POST['req_old_password']) : ''); ?>"/></span> | 343: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_old_password" size="35" value="<?php echo(isset($_POST['req_old_password']) ? forum_htmlencode($_POST['req_old_password']) : ''); ?>"/></span> |
344: </div> | 344: </div> |
345: </div> | 345: </div> |
346: <?php endif; ($hook = get_hook('pf_change_pass_normal_pre_new_password')) ? eval($hook) : null; ?> | 346: <?php endif; ($hook = get_hook('pf_change_pass_normal_pre_new_password')) ? eval($hook) : null; ?> |
347: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 347: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
348: <div class="sf-box text required"> | 348: <div class="sf-box text required"> |
349: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['New password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Password help'] ?></small></label><br /> | 349: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['New password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Password help'] ?></small></label><br /> |
350: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password1" size="35" value="<?php echo(isset($_POST['req_new_password1']) ? ($_POST['req_new_password1']) : ''); ?>"/></span><br /> | 350: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password1" size="35" value="<?php echo(isset($_POST['req_new_password1']) ? forum_htmlencode($_POST['req_new_password1']) : ''); ?>"/></span><br /> |
351: </div> | 351: </div> |
352: </div> | 352: </div> |
353: <?php ($hook = get_hook('pf_change_pass_normal_pre_new_password_confirm')) ? eval($hook) : null; ?> | 353: <?php ($hook = get_hook('pf_change_pass_normal_pre_new_password_confirm')) ? eval($hook) : null; ?> |
354: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 354: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
355: <div class="sf-box text required"> | 355: <div class="sf-box text required"> |
356: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Confirm new password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Confirm password help'] ?></small></label><br /> | 356: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Confirm new password'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['Confirm password help'] ?></small></label><br /> |
357: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password2" size="35" value="<?php echo(isset($_POST['req_new_password2']) ? ($_POST['req_new_password2']) : ''); ?>"/></span><br /> | 357: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_new_password2" size="35" value="<?php echo(isset($_POST['req_new_password2']) ? forum_htmlencode($_POST['req_new_password2']) : ''); ?>"/></span><br /> |
358: </div> | 358: </div> |
359: </div> | 359: </div> |
360: <?php ($hook = get_hook('pf_change_pass_normal_pre_fieldset_end')) ? eval($hook) : null; ?> | 360: <?php ($hook = get_hook('pf_change_pass_normal_pre_fieldset_end')) ? eval($hook) : null; ?> |
430: if (!is_valid_email($new_email)) | 430: if (!is_valid_email($new_email)) |
431: $errors[] = $lang_common['Invalid e-mail']; | 431: $errors[] = $lang_common['Invalid e-mail']; |
432: | 432: |
433: // Check it it's a banned e-mail address | 433: // Check if it's a banned e-mail address |
434: if (is_banned_email($new_email)) | 434: if (is_banned_email($new_email)) |
435: { | 435: { |
436: ($hook = get_hook('pf_change_email_normal_banned_email')) ? eval($hook) : null; | 436: ($hook = get_hook('pf_change_email_normal_banned_email')) ? eval($hook) : null; |
476: // Did everything go according to plan? | 476: // Did everything go according to plan? |
477: if (empty($errors)) | 477: if (empty($errors)) |
478: { | 478: { |
| 479: if ($forum_config['o_regs_verify'] != '1') |
| 480: { |
| 481: // We have no confirmed e-mail so we change e-mail right now |
| 482: $query = array( |
| 483: 'UPDATE' => 'users', |
| 484: 'SET' => 'email=\''.$forum_db->escape($new_email).'\'', |
| 485: 'WHERE' => 'id='.$id |
| 486: ); |
| 487: |
| 488: ($hook = get_hook('pf_change_email_key_qr_update_email')) ? eval($hook) : null; |
| 489: $forum_db->query_build($query) or error(__FILE__, __LINE__); |
| 490: |
| 491: redirect(forum_link($forum_url['profile_about'], $id), $lang_profile['E-mail updated redirect']); |
| 492: } |
| 493: |
| 494: // We have a confirmed e-mail so we going to send an activation link |
| 495: |
479: $new_email_key = random_key(8, true); | 496: $new_email_key = random_key(8, true); |
480: | 497: |
481: // Save new e-mail and activation key | 498: // Save new e-mail and activation key |
593: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 610: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
594: <div class="sf-box text required"> | 611: <div class="sf-box text required"> |
595: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Password'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label><br /> | 612: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Password'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label><br /> |
596: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_password" size="25" value="<?php echo(isset($_POST['req_password']) ? ($_POST['req_password']) : ''); ?>"/></span> | 613: <span class="fld-input"><input type="password" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_password" size="25" value="<?php echo(isset($_POST['req_password']) ? forum_htmlencode($_POST['req_password']) : ''); ?>"/></span> |
597: </div> | 614: </div> |
598: </div> | 615: </div> |
599: <?php ($hook = get_hook('pf_change_email_normal_pre_fieldset_end')) ? eval($hook) : null; ?> | 616: <?php ($hook = get_hook('pf_change_email_normal_pre_fieldset_end')) ? eval($hook) : null; ?> |
830: | 847: |
831: ($hook = get_hook('pf_ban_user_selected')) ? eval($hook) : null; | 848: ($hook = get_hook('pf_ban_user_selected')) ? eval($hook) : null; |
832: | 849: |
833: redirect(forum_link($forum_url['admin_bans']).'?add_ban='.$id, $lang_profile['Ban redirect']); | 850: redirect(forum_link($forum_url['admin_bans']).'&add_ban='.$id, $lang_profile['Ban redirect']); |
834: } | 851: } |
835: | 852: |
836: | 853: |
889: $form['num_posts'] = intval($_POST['num_posts']); | 906: $form['num_posts'] = intval($_POST['num_posts']); |
890: } | 907: } |
891: | 908: |
892: if ($forum_config['o_regs_verify'] == '0' || $forum_user['is_admmod']) | 909: if ($forum_user['is_admmod']) |
893: { | 910: { |
894: if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) | 911: if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) |
895: require FORUM_ROOT.'include/email.php'; | 912: require FORUM_ROOT.'include/email.php'; |
940: $form['dst'] = (isset($form['dst'])) ? 1 : 0; | 957: $form['dst'] = (isset($form['dst'])) ? 1 : 0; |
941: $form['time_format'] = (isset($form['time_format'])) ? intval($form['time_format']) : 0; | 958: $form['time_format'] = (isset($form['time_format'])) ? intval($form['time_format']) : 0; |
942: $form['date_format'] = (isset($form['date_format'])) ? intval($form['date_format']) : 0; | 959: $form['date_format'] = (isset($form['date_format'])) ? intval($form['date_format']) : 0; |
| 960: $form['timezone'] = (isset($form['timezone'])) ? floatval($form['timezone']) : $forum_config['o_default_timezone']; |
| 961: |
| 962: // Validate timezone |
| 963: if (($form['timezone'] > 14.0) || ($form['timezone'] < -12.0)) { |
| 964: message($lang_common['Bad request']); |
| 965: } |
943: | 966: |
944: $form['email_setting'] = intval($form['email_setting']); | 967: $form['email_setting'] = intval($form['email_setting']); |
945: if ($form['email_setting'] < 0 && $form['email_setting'] > 2) $form['email_setting'] = 1; | 968: if ($form['email_setting'] < 0 || $form['email_setting'] > 2) $form['email_setting'] = 1; |
946: | 969: |
947: if ($forum_config['o_subscriptions'] == '1') | 970: if ($forum_config['o_subscriptions'] == '1') |
948: { | 971: { |
995: if (substr_count($form['signature'], "\n") > ($forum_config['p_sig_lines'] - 1)) | 1018: if (substr_count($form['signature'], "\n") > ($forum_config['p_sig_lines'] - 1)) |
996: $errors[] = sprintf($lang_profile['Sig too many lines'], forum_number_format($forum_config['p_sig_lines'])); | 1019: $errors[] = sprintf($lang_profile['Sig too many lines'], forum_number_format($forum_config['p_sig_lines'])); |
997: | 1020: |
998: if ($form['signature'] != '' && $forum_config['p_sig_all_caps'] == '0' && utf8_strtoupper($form['signature']) == $form['signature'] && !$forum_user['is_admmod']) | 1021: if ($form['signature'] != '' && $forum_config['p_sig_all_caps'] == '0' && check_is_all_caps($form['signature']) && !$forum_user['is_admmod']) |
999: $form['signature'] = utf8_ucwords(utf8_strtolower($form['signature'])); | 1022: $form['signature'] = utf8_ucwords(utf8_strtolower($form['signature'])); |
1000: | 1023: |
1001: // Validate BBCode syntax | 1024: // Validate BBCode syntax |
1284: $forum_user['g_id'] != FORUM_ADMIN && | 1307: $forum_user['g_id'] != FORUM_ADMIN && |
1285: ($forum_user['g_moderator'] != '1' || $forum_user['g_mod_edit_users'] == '0' || $user['g_id'] == FORUM_ADMIN || $user['g_moderator'] == '1')) | 1308: ($forum_user['g_moderator'] != '1' || $forum_user['g_mod_edit_users'] == '0' || $user['g_id'] == FORUM_ADMIN || $user['g_moderator'] == '1')) |
1286: { | 1309: { |
1287: ($hook = get_hook('pf_view_details_selected')) ? eval($hook) : null; | |
1288: | |
1289: // Setup user identification | 1310: // Setup user identification |
1290: $forum_page['user_ident'] = array(); | 1311: $forum_page['user_ident'] = array(); |
1291: | 1312: |
1292: ($hook = get_hook('pf_view_details_selected')) ? eval($hook) : null; | 1313: ($hook = get_hook('pf_view_details_selected')) ? eval($hook) : null; |
1293: | 1314: |
1294: $forum_page['user_ident']['username'] = '<li class="username'.(($user['realname'] =='') ? ' fn nickname' : ' nickname').'"><strong>'.forum_htmlencode($user['username']).'</strong></li>'; | 1315: $forum_page['user_ident']['username'] = '<li class="username'.(($user['realname'] =='') ? ' fn nickname' : ' nickname').'"><strong>'.forum_htmlencode($user['username']).'</strong></li>'; |
1295: $forum_page['user_ident']['usertitle'] = '<li class="usertitle"><span>'.get_title($user).'</span></li>'; | |
1296: | 1316: |
1297: if ($forum_config['o_avatars'] == '1') | 1317: if ($forum_config['o_avatars'] == '1') |
1298: { | 1318: { |
1302: $forum_page['user_ident']['avatar'] = '<li class="useravatar">'.$forum_page['avatar_markup'].'</li>'; | 1322: $forum_page['user_ident']['avatar'] = '<li class="useravatar">'.$forum_page['avatar_markup'].'</li>'; |
1303: } | 1323: } |
1304: | 1324: |
| 1325: $forum_page['user_ident']['usertitle'] = '<li class="usertitle"><span>'.get_title($user).'</span></li>'; |
| 1326: |
1305: // Setup user information | 1327: // Setup user information |
1306: $forum_page['user_info'] = array(); | 1328: $forum_page['user_info'] = array(); |
1307: | 1329: |
1407: </ul> | 1429: </ul> |
1408: </div> | 1430: </div> |
1409: </div> | 1431: </div> |
1410: <?php ($hook = get_hook('pf_view_details_pre_user_activity_info')) ? eval($hook) : null; ?> | 1432: <?php endif; ($hook = get_hook('pf_view_details_pre_user_activity_info')) ? eval($hook) : null; ?> |
1411: <?php endif; if (!empty($forum_page['user_activity'])): ?> | 1433: <?php if (!empty($forum_page['user_activity'])): ?> |
1412: <div class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>"> | 1434: <div class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>"> |
1413: <div class="ct-box data-box"> | 1435: <div class="ct-box data-box"> |
1414: <h3 class="ct-legend hn"><span><?php echo $lang_profile['Posts and topics'] ?></span></h3> | 1436: <h3 class="ct-legend hn"><span><?php echo $lang_profile['Posts and topics'] ?></span></h3> |
1417: </ul> | 1439: </ul> |
1418: </div> | 1440: </div> |
1419: </div> | 1441: </div> |
1420: <?php ($hook = get_hook('pf_view_details_pre_user_sig_info')) ? eval($hook) : null; ?> | 1442: <?php endif; ($hook = get_hook('pf_view_details_pre_user_sig_info')) ? eval($hook) : null; ?> |
1421: <?php endif; if (isset($forum_page['sig_demo'])): ?> | 1443: <?php if (isset($forum_page['sig_demo'])): ?> |
1422: <div class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>"> | 1444: <div class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>"> |
1423: <div class="ct-box data-box"> | 1445: <div class="ct-box data-box"> |
1424: <h3 class="ct-legend hn"><span><?php echo $lang_profile['Current signature'] ?></span></h3> | 1446: <h3 class="ct-legend hn"><span><?php echo $lang_profile['Current signature'] ?></span></h3> |
1486: ($hook = get_hook('pf_change_details_about_selected')) ? eval($hook) : null; | 1508: ($hook = get_hook('pf_change_details_about_selected')) ? eval($hook) : null; |
1487: | 1509: |
1488: $forum_page['user_ident']['username'] = '<li class="username'.(($user['realname'] =='') ? ' fn nickname' : ' nickname').'"><strong>'.forum_htmlencode($user['username']).'</strong></li>'; | 1510: $forum_page['user_ident']['username'] = '<li class="username'.(($user['realname'] =='') ? ' fn nickname' : ' nickname').'"><strong>'.forum_htmlencode($user['username']).'</strong></li>'; |
1489: $forum_page['user_ident']['usertitle'] = '<li class="usertitle"><span>'.get_title($user).'</span></li>'; | |
1490: | 1511: |
1491: if ($forum_config['o_avatars'] == '1') | 1512: if ($forum_config['o_avatars'] == '1') |
1492: { | 1513: { |
1496: $forum_page['user_ident']['avatar'] = '<li class="useravatar">'.$forum_page['avatar_markup'].'</li>'; | 1517: $forum_page['user_ident']['avatar'] = '<li class="useravatar">'.$forum_page['avatar_markup'].'</li>'; |
1497: } | 1518: } |
1498: | 1519: |
| 1520: $forum_page['user_ident']['usertitle'] = '<li class="usertitle"><span>'.get_title($user).'</span></li>'; |
| 1521: |
1499: // Create array for private information | 1522: // Create array for private information |
1500: $forum_page['user_private'] = array(); | 1523: $forum_page['user_private'] = array(); |
1501: | 1524: |
1549: | 1572: |
1550: // Setup user messaging | 1573: // Setup user messaging |
1551: if ($user['jabber'] !='') | 1574: if ($user['jabber'] !='') |
1552: $forum_page['user_contact']['jabber'] = '<li><span><strong>'.$lang_profile['Jabber'].':</strong> '.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['jabber']) : $user['jabber']).'</span></li>'; | 1575: $forum_page['user_contact']['jabber'] = '<li><span>'.$lang_profile['Jabber'].': <strong>'.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['jabber']) : $user['jabber']).'</strong></span></li>'; |
1553: if ($user['icq'] !='') | 1576: if ($user['icq'] !='') |
1554: $forum_page['user_contact']['icq'] = '<li><span><strong>'.$lang_profile['ICQ'].':</strong> '.forum_htmlencode($user['icq']).'</span></li>'; | 1577: $forum_page['user_contact']['icq'] = '<li><span>'.$lang_profile['ICQ'].': <strong>'.forum_htmlencode($user['icq']).'</strong></span></li>'; |
1555: if ($user['msn'] !='') | 1578: if ($user['msn'] !='') |
1556: $forum_page['user_contact']['msn'] = '<li><span><strong>'.$lang_profile['MSN'].':</strong> '.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['msn']) : $user['msn']).'</span></li>'; | 1579: $forum_page['user_contact']['msn'] = '<li><span>'.$lang_profile['MSN'].': <strong>'.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['msn']) : $user['msn']).'</strong></span></li>'; |
1557: if ($user['aim'] !='') | 1580: if ($user['aim'] !='') |
1558: $forum_page['user_contact']['aim'] = '<li><span><strong>'.$lang_profile['AOL IM'].':</strong> '.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['aim']) : $user['aim']).'</span></li>'; | 1581: $forum_page['user_contact']['aim'] = '<li><span>'.$lang_profile['AOL IM'].': <strong>'.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['aim']) : $user['aim']).'</strong></span></li>'; |
1559: if ($user['yahoo'] !='') | 1582: if ($user['yahoo'] !='') |
1560: $forum_page['user_contact']['yahoo'] = '<li><span><strong>'.$lang_profile['Yahoo'].':</strong> '.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']).'</span></li>'; | 1583: $forum_page['user_contact']['yahoo'] = '<li><span>'.$lang_profile['Yahoo'].': <strong>'.forum_htmlencode(($forum_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']).'</strong></span></li>'; |
1561: | 1584: |
1562: // Setup signature demo | 1585: // Setup signature demo |
1563: if ($forum_config['o_signatures'] == '1' && isset($parsed_signature)) | 1586: if ($forum_config['o_signatures'] == '1' && isset($parsed_signature)) |
1580: if ($forum_page['own_profile'] || $forum_user['g_id'] == FORUM_ADMIN || ($forum_user['g_moderator'] == '1' && $forum_user['g_mod_change_passwords'] == '1')) | 1603: if ($forum_page['own_profile'] || $forum_user['g_id'] == FORUM_ADMIN || ($forum_user['g_moderator'] == '1' && $forum_user['g_mod_change_passwords'] == '1')) |
1581: $forum_page['user_options']['change_password'] = '<span'.(empty($forum_page['user_options']) ? ' class="first-item"' : '').'><a href="'.forum_link($forum_url['change_password'], $id).'">'.(($forum_page['own_profile']) ? $lang_profile['Change your password'] : sprintf($lang_profile['Change user password'], forum_htmlencode($user['username']))).'</a></span>'; | 1604: $forum_page['user_options']['change_password'] = '<span'.(empty($forum_page['user_options']) ? ' class="first-item"' : '').'><a href="'.forum_link($forum_url['change_password'], $id).'">'.(($forum_page['own_profile']) ? $lang_profile['Change your password'] : sprintf($lang_profile['Change user password'], forum_htmlencode($user['username']))).'</a></span>'; |
1582: | 1605: |
1583: if (!$forum_user['is_admmod'] && $forum_config['o_regs_verify'] == '1') | 1606: if (!$forum_user['is_admmod']) |
1584: $forum_page['user_options']['change_email'] = '<span'.(empty($forum_page['user_options']) ? ' class="first-item"' : '').'><a href="'.forum_link($forum_url['change_email'], $id).'">'.(($forum_page['own_profile']) ? $lang_profile['Change your e-mail'] : sprintf($lang_profile['Change user e-mail'], forum_htmlencode($user['username']))).'</a></span>'; | 1607: $forum_page['user_options']['change_email'] = '<span'.(empty($forum_page['user_options']) ? ' class="first-item"' : '').'><a href="'.forum_link($forum_url['change_email'], $id).'">'.(($forum_page['own_profile']) ? $lang_profile['Change your e-mail'] : sprintf($lang_profile['Change user e-mail'], forum_htmlencode($user['username']))).'</a></span>'; |
1585: | 1608: |
1586: $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0; | 1609: $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0; |
1690: $forum_page['hidden_fields']['old_username'] = '<input type="hidden" name="old_username" value="'.forum_htmlencode($user['username']).'" />'; | 1713: $forum_page['hidden_fields']['old_username'] = '<input type="hidden" name="old_username" value="'.forum_htmlencode($user['username']).'" />'; |
1691: | 1714: |
1692: // Does the form have required fields | 1715: // Does the form have required fields |
1693: $forum_page['has_required'] = ((($forum_user['is_admmod'] && ($forum_user['g_id'] == FORUM_ADMIN || $forum_user['g_mod_rename_users'] == '1')) || ($forum_user['is_admmod'] || $forum_config['o_regs_verify'] != '1')) ? true : false); | 1716: $forum_page['has_required'] = ((($forum_user['is_admmod'] && ($forum_user['g_id'] == FORUM_ADMIN || $forum_user['g_mod_rename_users'] == '1')) || $forum_user['is_admmod']) ? true : false); |
1694: | 1717: |
1695: ($hook = get_hook('pf_change_details_identity_pre_header_load')) ? eval($hook) : null; | 1718: ($hook = get_hook('pf_change_details_identity_pre_header_load')) ? eval($hook) : null; |
1696: | 1719: |
1750: </div> | 1773: </div> |
1751: </div> | 1774: </div> |
1752: <?php endif; ($hook = get_hook('pf_change_details_identity_pre_email')) ? eval($hook) : null; ?> | 1775: <?php endif; ($hook = get_hook('pf_change_details_identity_pre_email')) ? eval($hook) : null; ?> |
1753: <?php if ($forum_user['is_admmod'] || $forum_config['o_regs_verify'] != '1'): ?> | 1776: <?php if ($forum_user['is_admmod']): ?> |
1754: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1777: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1755: <div class="sf-box text required"> | 1778: <div class="sf-box text required"> |
1756: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['E-mail'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['E-mail help'] ?></small></label><br /> | 1779: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['E-mail'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_profile['E-mail help'] ?></small></label><br /> |
1811: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1834: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1812: <div class="sf-box text"> | 1835: <div class="sf-box text"> |
1813: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Website'] ?></span></label><br /> | 1836: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Website'] ?></span></label><br /> |
1814: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[url]" value="<?php echo(isset($form['url']) ? forum_htmlencode($form['url']) : forum_htmlencode($user['url'])) ?>" size="50" maxlength="80" /></span> | 1837: <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[url]" value="<?php echo(isset($form['url']) ? forum_htmlencode($form['url']) : forum_htmlencode($user['url'])) ?>" size="35" maxlength="80" /></span> |
1815: </div> | 1838: </div> |
1816: </div> | 1839: </div> |
1817: <?php ($hook = get_hook('pf_change_details_identity_pre_jabber')) ? eval($hook) : null; ?> | 1840: <?php ($hook = get_hook('pf_change_details_identity_pre_jabber')) ? eval($hook) : null; ?> |
1818: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1841: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1819: <div class="sf-box text"> | 1842: <div class="sf-box text"> |
1820: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Jabber'] ?></span></label><br /> | 1843: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['Jabber'] ?></span></label><br /> |
1821: <span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="form[jabber]" value="<?php echo(isset($form['jabber']) ? forum_htmlencode($form['jabber']) : forum_htmlencode($user['jabber'])) ?>" size="40" maxlength="80" /></span> | 1844: <span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="form[jabber]" value="<?php echo(isset($form['jabber']) ? forum_htmlencode($form['jabber']) : forum_htmlencode($user['jabber'])) ?>" size="35" maxlength="80" /></span> |
1822: </div> | 1845: </div> |
1823: </div> | 1846: </div> |
1824: <?php ($hook = get_hook('pf_change_details_identity_pre_icq')) ? eval($hook) : null; ?> | 1847: <?php ($hook = get_hook('pf_change_details_identity_pre_icq')) ? eval($hook) : null; ?> |
1832: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | 1855: <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> |
1833: <div class="sf-box text"> | 1856: <div class="sf-box text"> |
1834: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['MSN'] ?></span></label><br /> | 1857: <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_profile['MSN'] ?></span></label><br /> |
1835: <span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="form[msn]" value="<?php echo(isset($form['msn']) ? forum_htmlencode($form['msn']) : forum_htmlencode($user['msn'])) ?>" size="40" maxlength="80" /></span> | 1858: <span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="form[msn]" value="<?php echo(isset($form['msn']) ? forum_htmlencode($form['msn']) : forum_htmlencode($user['msn'])) ?>" size="35" maxlength="80" /></span> |
1836: </div> | 1859: </div> |
1837: </div> | 1860: </div> |
1838: <?php ($hook = get_hook('pf_change_details_identity_pre_aim')) ? eval($hook) : null; ?> | 1861: <?php ($hook = get_hook('pf_change_details_identity_pre_aim')) ? eval($hook) : null; ?> |
2239: $forum_page['crumbs'] = array( | 2262: $forum_page['crumbs'] = array( |
2240: array($forum_config['o_board_title'], forum_link($forum_url['index'])), | 2263: array($forum_config['o_board_title'], forum_link($forum_url['index'])), |
2241: array(sprintf($lang_profile['Users profile'], $user['username']), forum_link($forum_url['user'], $id)), | 2264: array(sprintf($lang_profile['Users profile'], $user['username']), forum_link($forum_url['user'], $id)), |
2242: array($lang_profile['Section signature'],forum_link($forum_url['profile_signature'], $id)) | 2265: array($lang_profile['Section signature'], forum_link($forum_url['profile_signature'], $id)) |
2243: ); | 2266: ); |
2244: | 2267: |
2245: // Setup the form | 2268: // Setup the form |
2291: | 2314: |
2292: ?> | 2315: ?> |
2293: <div class="ct-box error-box"> | 2316: <div class="ct-box error-box"> |
2294: <h2 class="warn hn"><?php echo $lang_profile['Profile update errors'] ?></h3> | 2317: <h2 class="warn hn"><?php echo $lang_profile['Profile update errors'] ?></h2> |
2295: <ul class="error-list"> | 2318: <ul class="error-list"> |
2296: <?php echo implode("\n\t\t\t\t\t", $forum_page['errors'])."\n" ?> | 2319: <?php echo implode("\n\t\t\t\t\t", $forum_page['errors'])."\n" ?> |
2297: </ul> | 2320: </ul> |
2496: $forum_page['user_management'] = array(); | 2519: $forum_page['user_management'] = array(); |
2497: | 2520: |
2498: if ($forum_user['g_moderator'] == '1') | 2521: if ($forum_user['g_moderator'] == '1') |
2499: $forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'?add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>'; | 2522: $forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'&add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>'; |
2500: else if ($forum_user['g_moderator'] != '1' && $user['g_id'] != FORUM_ADMIN ) | 2523: else if ($forum_user['g_moderator'] != '1' && $user['g_id'] != FORUM_ADMIN ) |
2501: { | 2524: { |
2502: $forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'?add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>'; | 2525: $forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'&add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>'; |
2503: $forum_page['user_management']['delete'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Delete user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['delete_user'], $id).'">'.$lang_profile['Delete user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>'; | 2526: $forum_page['user_management']['delete'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Delete user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['delete_user'], $id).'">'.$lang_profile['Delete user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>'; |
2504: } | 2527: } |
2505: | 2528: |
2532: | 2555: |
2533: echo "\t\t\t".implode("\n\t\t\t", $forum_page['user_management'])."\n"; | 2556: echo "\t\t\t".implode("\n\t\t\t", $forum_page['user_management'])."\n"; |
2534: | 2557: |
2535: ($hook = get_hook('pf_change_details_admin_pre_group_membership')) ? eval($hook) : null; | 2558: ($hook = get_hook('pf_change_details_admin_pre_membership')) ? eval($hook) : null; |
2536: | 2559: |
2537: if ($forum_user['g_moderator'] != '1' && !$forum_page['own_profile']) | 2560: if ($forum_user['g_moderator'] != '1' && !$forum_page['own_profile']) |
2538: { | 2561: { |