PunBB 1.2.2 to 1.2.16 changes Legend
Lines removed 
Lines changed
 Lines added

punbb-1.2.2/upload/admin_bans.php punbb-1.2.16/upload/admin_bans.php
 44:         if (isset($_GET['add_ban'])) 44:         if (isset($_GET['add_ban']))
 45:         { 45:         {
 46:             $add_ban = intval($_GET['add_ban']); 46:             $add_ban = intval($_GET['add_ban']);
 47:             if ($add_ban < 1) 47:             if ($add_ban < 2)
 48:                 message($lang_common['Bad request']); 48:                 message($lang_common['Bad request']);
 49:  49: 
 50:             $user_id = $add_ban; 50:             $user_id = $add_ban;
 61:  61: 
 62:             if ($ban_user != '') 62:             if ($ban_user != '')
 63:             { 63:             {
 64:                 $result = $db->query('SELECT id, group_id, username, email FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 64:                 $result = $db->query('SELECT id, group_id, username, email FROM '.$db->prefix.'users WHERE username=\''.$db->escape($ban_user).'\' AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
 65:                 if ($db->num_rows($result)) 65:                 if ($db->num_rows($result))
 66:                     list($user_id, $group_id, $ban_user, $ban_email) = $db->fetch_row($result); 66:                     list($user_id, $group_id, $ban_user, $ban_email) = $db->fetch_row($result);
 67:                 else 67:                 else
192: 192: 
193:     if ($ban_user == '' && $ban_ip == '' && $ban_email == '')193:     if ($ban_user == '' && $ban_ip == '' && $ban_email == '')
194:         message('You must enter either a username, an IP address or an e-mail address (at least).');194:         message('You must enter either a username, an IP address or an e-mail address (at least).');
 195:     else if (strtolower($ban_user) == 'guest')
 196:         message('The guest user cannot be banned.');
195: 197: 
196:     // Validate IP/IP range (it's overkill, I know)198:     // Validate IP/IP range (it's overkill, I know)
197:     if ($ban_ip != '')199:     if ($ban_ip != '')
244:     if ($_POST['mode'] == 'add')246:     if ($_POST['mode'] == 'add')
245:         $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire) VALUES('.$ban_user.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.')') or error('Unable to add ban', __FILE__, __LINE__, $db->error());247:         $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire) VALUES('.$ban_user.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.')') or error('Unable to add ban', __FILE__, __LINE__, $db->error());
246:     else248:     else
247:         $db->query('UPDATE '.$db->prefix.'bans SET username='.$ban_user.', ip='.$ban_ip.', email='.$ban_email.', message='.$ban_message.', expire='.$ban_expire.' WHERE id='.$_POST['ban_id']) or error('Unable to update ban', __FILE__, __LINE__, $db->error());249:         $db->query('UPDATE '.$db->prefix.'bans SET username='.$ban_user.', ip='.$ban_ip.', email='.$ban_email.', message='.$ban_message.', expire='.$ban_expire.' WHERE id='.intval($_POST['ban_id'])) or error('Unable to update ban', __FILE__, __LINE__, $db->error());
248: 250: 
249:     // Regenerate the bans cache251:     // Regenerate the bans cache
250:     require_once PUN_ROOT.'include/cache.php';252:     require_once PUN_ROOT.'include/cache.php';


punbb-1.2.2/upload/admin_categories.php punbb-1.2.16/upload/admin_categories.php
118:                     <fieldset>118:                     <fieldset>
119:                         <legend>Confirm delete category</legend>119:                         <legend>Confirm delete category</legend>
120:                         <div class="infldset">120:                         <div class="infldset">
121:                             <p>Are you sure that you want to delete the category "<?php echo $cat_name ?>"?</p>121:                             <p>Are you sure that you want to delete the category "<?php echo pun_htmlspecialchars($cat_name) ?>"?</p>
122:                             <p>WARNING! Deleting a category will delete all forums and posts (if any) in that category!</p>122:                             <p>WARNING! Deleting a category will delete all forums and posts (if any) in that category!</p>
123:                         </div>123:                         </div>
124:                     </fieldset>124:                     </fieldset>
125:                 </div>125:                 </div>
126:                 <p><input type="submit" name="del_cat_comply" value="Delete" />&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)" />Go back</a></p>126:                 <p><input type="submit" name="del_cat_comply" value="Delete" /><a href="javascript:history.go(-1)">Go back</a></p>
127:             </form>127:             </form>
128:         </div>128:         </div>
129:     </div>129:     </div>
151:         if ($cat_name[$i] == '')151:         if ($cat_name[$i] == '')
152:             message('You must enter a category name.');152:             message('You must enter a category name.');
153: 153: 
154:         if (!preg_match('#^\d+$#', $cat_order[$i]))154:         if (!@preg_match('#^\d+$#', $cat_order[$i]))
155:             message('Position must be an integer value.');155:             message('Position must be an integer value.');
156: 156: 
157:         list($cat_id, $position) = $db->fetch_row($result);157:         list($cat_id, $position) = $db->fetch_row($result);


punbb-1.2.2/upload/admin_censoring.php punbb-1.2.16/upload/admin_censoring.php
 57: { 57: {
 58:     confirm_referrer('admin_censoring.php'); 58:     confirm_referrer('admin_censoring.php');
 59:  59: 
 60:     $id = key($_POST['update']); 60:     $id = intval(key($_POST['update']));
 61:  61: 
 62:     $search_for = trim($_POST['search_for'][$id]); 62:     $search_for = trim($_POST['search_for'][$id]);
 63:     $replace_with = trim($_POST['replace_with'][$id]); 63:     $replace_with = trim($_POST['replace_with'][$id]);
 76: { 76: {
 77:     confirm_referrer('admin_censoring.php'); 77:     confirm_referrer('admin_censoring.php');
 78:  78: 
 79:     $id = key($_POST['remove']); 79:     $id = intval(key($_POST['remove']));
 80:  80: 
 81:     $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error()); 81:     $db->query('DELETE FROM '.$db->prefix.'censoring WHERE id='.$id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error());
 82:  82: 


punbb-1.2.2/upload/admin_forums.php punbb-1.2.16/upload/admin_forums.php
117:                         </div>117:                         </div>
118:                     </fieldset>118:                     </fieldset>
119:                 </div>119:                 </div>
120:                 <p><input type="submit" name="del_forum_comply" value="Delete" />&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)" />Go back</a></p>120:                 <p><input type="submit" name="del_forum_comply" value="Delete" /><a href="javascript:history.go(-1)">Go back</a></p>
121:             </form>121:             </form>
122:         </div>122:         </div>
123:     </div>123:     </div>
137: 137: 
138:     while (list($forum_id, $disp_position) = @each($_POST['position']))138:     while (list($forum_id, $disp_position) = @each($_POST['position']))
139:     {139:     {
140:         if (!preg_match('#^\d+$#', $disp_position))140:         if (!@preg_match('#^\d+$#', $disp_position))
141:             message('Position must be a positive integer value.');141:             message('Position must be a positive integer value.');
142: 142: 
143:         $db->query('UPDATE '.$db->prefix.'forums SET disp_position='.$disp_position.' WHERE id='.$forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());143:         $db->query('UPDATE '.$db->prefix.'forums SET disp_position='.$disp_position.' WHERE id='.intval($forum_id)) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
144:     }144:     }
145: 145: 
146:     // Regenerate the quickjump cache146:     // Regenerate the quickjump cache
186:             $result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN) or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());186:             $result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN) or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
187:             while ($cur_group = $db->fetch_assoc($result))187:             while ($cur_group = $db->fetch_assoc($result))
188:             {188:             {
189:                 $read_forum_new = ($cur_group['g_read_board'] == '1') ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? $_POST['read_forum_new'][$cur_group['g_id']] : '0' : $_POST['read_forum_old'][$cur_group['g_id']];189:                 $read_forum_new = ($cur_group['g_read_board'] == '1') ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? '1' : '0' : intval($_POST['read_forum_old'][$cur_group['g_id']]);
190:                 $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? $_POST['post_replies_new'][$cur_group['g_id']] : '0';190:                 $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? '1' : '0';
191:                 $post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? $_POST['post_topics_new'][$cur_group['g_id']] : '0';191:                 $post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? '1' : '0';
192: 192: 
193:                 // Check if the new settings differ from the old193:                 // Check if the new settings differ from the old
194:                 if ($read_forum_new != $_POST['read_forum_old'][$cur_group['g_id']] || $post_replies_new != $_POST['post_replies_old'][$cur_group['g_id']] || $post_topics_new != $_POST['post_topics_old'][$cur_group['g_id']])194:                 if ($read_forum_new != $_POST['read_forum_old'][$cur_group['g_id']] || $post_replies_new != $_POST['post_replies_old'][$cur_group['g_id']] || $post_topics_new != $_POST['post_topics_old'][$cur_group['g_id']])


punbb-1.2.2/upload/admin_groups.php punbb-1.2.16/upload/admin_groups.php
209: 209: 
210:     $title = trim($_POST['req_title']);210:     $title = trim($_POST['req_title']);
211:     $user_title = trim($_POST['user_title']);211:     $user_title = trim($_POST['user_title']);
212:     $read_board = isset($_POST['read_board']) ? $_POST['read_board'] : '1';212:     $read_board = isset($_POST['read_board']) ? intval($_POST['read_board']) : '1';
213:     $post_replies = isset($_POST['post_replies']) ? $_POST['post_replies'] : '1';213:     $post_replies = isset($_POST['post_replies']) ? intval($_POST['post_replies']) : '1';
214:     $post_topics = isset($_POST['post_topics']) ? $_POST['post_topics'] : '1';214:     $post_topics = isset($_POST['post_topics']) ? intval($_POST['post_topics']) : '1';
215:     $edit_posts = isset($_POST['edit_posts']) ? $_POST['edit_posts'] : ($is_admin_group) ? '1' : '0';215:     $edit_posts = isset($_POST['edit_posts']) ? intval($_POST['edit_posts']) : ($is_admin_group) ? '1' : '0';
216:     $delete_posts = isset($_POST['delete_posts']) ? $_POST['delete_posts'] : ($is_admin_group) ? '1' : '0';216:     $delete_posts = isset($_POST['delete_posts']) ? intval($_POST['delete_posts']) : ($is_admin_group) ? '1' : '0';
217:     $delete_topics = isset($_POST['delete_topics']) ? $_POST['delete_topics'] : ($is_admin_group) ? '1' : '0';217:     $delete_topics = isset($_POST['delete_topics']) ? intval($_POST['delete_topics']) : ($is_admin_group) ? '1' : '0';
218:     $set_title = isset($_POST['set_title']) ? $_POST['set_title'] : ($is_admin_group) ? '1' : '0';218:     $set_title = isset($_POST['set_title']) ? intval($_POST['set_title']) : ($is_admin_group) ? '1' : '0';
219:     $search = isset($_POST['search']) ? $_POST['search'] : '1';219:     $search = isset($_POST['search']) ? intval($_POST['search']) : '1';
220:     $search_users = isset($_POST['search_users']) ? $_POST['search_users'] : '1';220:     $search_users = isset($_POST['search_users']) ? intval($_POST['search_users']) : '1';
221:     $edit_subjects_interval = isset($_POST['edit_subjects_interval']) ? intval($_POST['edit_subjects_interval']) : '0';221:     $edit_subjects_interval = isset($_POST['edit_subjects_interval']) ? intval($_POST['edit_subjects_interval']) : '0';
222:     $post_flood = isset($_POST['post_flood']) ? intval($_POST['post_flood']) : '0';222:     $post_flood = isset($_POST['post_flood']) ? intval($_POST['post_flood']) : '0';
223:     $search_flood = isset($_POST['search_flood']) ? intval($_POST['search_flood']) : '0';223:     $search_flood = isset($_POST['search_flood']) ? intval($_POST['search_flood']) : '0';
229: 229: 
230:     if ($_POST['mode'] == 'add')230:     if ($_POST['mode'] == 'add')
231:     {231:     {
232:         $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\'') or error('Unable to check group title collision', __FILE__, __LINE__, $db->error());232:         $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\'') or error('Unable to check group title collision', __FILE__, __LINE__, $db->error());
233:         if ($db->num_rows())233:         if ($db->num_rows($result))
234:             message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.');234:             message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.');
235: 235: 
236:         $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$read_board.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$edit_subjects_interval.', '.$post_flood.', '.$search_flood.')') or error('Unable to add group', __FILE__, __LINE__, $db->error());236:         $db->query('INSERT INTO '.$db->prefix.'groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES(\''.$db->escape($title).'\', '.$user_title.', '.$read_board.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$edit_subjects_interval.', '.$post_flood.', '.$search_flood.')') or error('Unable to add group', __FILE__, __LINE__, $db->error());
242:             $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());242:             $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
243:     }243:     }
244:     else244:     else
245:         $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_read_board='.$read_board.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_edit_subjects_interval='.$edit_subjects_interval.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.' WHERE g_id='.$_POST['group_id']) or error('Unable to update group', __FILE__, __LINE__, $db->error());245:     {
 246:         $result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\' AND g_id!='.intval($_POST['group_id'])) or error('Unable to check group title collision', __FILE__, __LINE__, $db->error());
 247:         if ($db->num_rows($result))
 248:             message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.');
 249: 
 250:         $db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$db->escape($title).'\', g_user_title='.$user_title.', g_read_board='.$read_board.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_edit_subjects_interval='.$edit_subjects_interval.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $db->error());
 251:     }
246: 252: 
247:     // Regenerate the quickjump cache253:     // Regenerate the quickjump cache
248:     require_once PUN_ROOT.'include/cache.php';254:     require_once PUN_ROOT.'include/cache.php';
258:     confirm_referrer('admin_groups.php');264:     confirm_referrer('admin_groups.php');
259: 265: 
260:     $group_id = intval($_POST['default_group']);266:     $group_id = intval($_POST['default_group']);
261:     if ($group_id < 1)267:     if ($group_id < 4)
262:         message($lang_common['Bad request']);268:         message($lang_common['Bad request']);
263: 269: 
264:     $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());270:     $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());


punbb-1.2.2/upload/admin_index.php punbb-1.2.16/upload/admin_index.php
 64:  64: 
 65:  65: 
 66: // Show phpinfo() output 66: // Show phpinfo() output
 67: else if ($action == 'phpinfo') 67: else if ($action == 'phpinfo' && $pun_user['g_id'] == PUN_ADMIN)
 68: { 68: {
 69:     // Is phpinfo() a disabled function? 69:     // Is phpinfo() a disabled function?
 70:     if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false) 70:     if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false)
 86:     $load_averages = @explode(' ', $load_averages); 86:     $load_averages = @explode(' ', $load_averages);
 87:     $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Not available'; 87:     $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Not available';
 88: } 88: }
 89: else if (preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/i', @exec('uptime'), $load_averages)) 89: else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/i', @exec('uptime'), $load_averages))
 90:     $server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3]; 90:     $server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3];
 91: else 91: else
 92:     $server_load = 'Not available'; 92:     $server_load = 'Not available';
 93:  93: 
 94:  94: 
 95: // Get number of current visitors 95: // Get number of current visitors
 96: $result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error()); 96: $result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error());
 97: $num_online = $db->result($result); 97: $num_online = $db->result($result);
 98:  98: 
 99:  99: 


punbb-1.2.2/upload/admin_loader.php punbb-1.2.16/upload/admin_loader.php
 37:  37: 
 38: // The plugin to load should be supplied via GET 38: // The plugin to load should be supplied via GET
 39: $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : ''; 39: $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : '';
 40: if (!preg_match('/^AM?P_(\w*?)\.php$/i', $plugin)) 40: if (!@preg_match('/^AM?P_(\w*?)\.php$/i', $plugin))
 41:     message($lang_common['Bad request']); 41:     message($lang_common['Bad request']);
 42:  42: 
 43: // AP_ == Admins only, AMP_ == admins and moderators 43: // AP_ == Admins only, AMP_ == admins and moderators


punbb-1.2.2/upload/admin_maintenance.php punbb-1.2.16/upload/admin_maintenance.php
 52:         // This is the only potentially "dangerous" thing we can do here, so we check the referer 52:         // This is the only potentially "dangerous" thing we can do here, so we check the referer
 53:         confirm_referrer('admin_maintenance.php'); 53:         confirm_referrer('admin_maintenance.php');
 54:  54: 
 55:         $truncate_sql = ($db_type != 'sqlite') ? 'TRUNCATE TABLE ' : 'DELETE FROM '; 55:         $truncate_sql = ($db_type != 'sqlite' && $db_type != 'pgsql') ? 'TRUNCATE TABLE ' : 'DELETE FROM ';
 56:         $db->query($truncate_sql.$db->prefix.'search_matches') or error('Unable to empty search index match table', __FILE__, __LINE__, $db->error()); 56:         $db->query($truncate_sql.$db->prefix.'search_matches') or error('Unable to empty search index match table', __FILE__, __LINE__, $db->error());
 57:         $db->query($truncate_sql.$db->prefix.'search_words') or error('Unable to empty search index words table', __FILE__, __LINE__, $db->error()); 57:         $db->query($truncate_sql.$db->prefix.'search_words') or error('Unable to empty search index words table', __FILE__, __LINE__, $db->error());
 58:  58: 
 65:                 break; 65:                 break;
 66:  66: 
 67:             case 'pgsql'; 67:             case 'pgsql';
 68:                 $result = $db->query('SELECT setval(\'search_words_id_seq\', 1, false)') or error('Unable to update sequence', __FILE__, __LINE__, $db->error()); 68:                 $result = $db->query('SELECT setval(\''.$db->prefix.'search_words_id_seq\', 1, false)') or error('Unable to update sequence', __FILE__, __LINE__, $db->error());
 69:         } 69:         }
 70:     } 70:     }
 71:  71: 


punbb-1.2.2/upload/admin_options.php punbb-1.2.16/upload/admin_options.php
 37:  37: 
 38: if (isset($_POST['form_sent'])) 38: if (isset($_POST['form_sent']))
 39: { 39: {
 40:     // Lazy referer check (in case base_url isn't correct) 40:     // Custom referrer check (so we can output a custom error message)
 41:     if (!preg_match('#/admin_options\.php#i', $_SERVER['HTTP_REFERER'])) 41:     if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/admin_options.php', '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''))))
 42:         message($lang_common['Bad referrer']); 42:         message('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.');
 43:  43: 
 44:     $form = array_map('trim', $_POST['form']); 44:     $form = array_map('trim', $_POST['form']);
 45:  45: 
 46:     if ($form['board_title'] == '') 46:     if ($form['board_title'] == '')
 47:         message('You must enter a board title.'); 47:         message('You must enter a board title.');
 48:  48: 
  49:     // Clean default_lang
  50:     $form['default_lang'] = preg_replace('#[\.\\\/]#', '', $form['default_lang']);
  51: 
 49:     require PUN_ROOT.'include/email.php'; 52:     require PUN_ROOT.'include/email.php';
 50:  53: 
 51:     $form['admin_email'] = strtolower($form['admin_email']); 54:     $form['admin_email'] = strtolower($form['admin_email']);
 63:     if (substr($form['base_url'], -1) == '/') 66:     if (substr($form['base_url'], -1) == '/')
 64:         $form['base_url'] = substr($form['base_url'], 0, -1); 67:         $form['base_url'] = substr($form['base_url'], 0, -1);
 65:  68: 
  69:     // Clean avatars_dir
  70:     $form['avatars_dir'] = str_replace("\0", '', $form['avatars_dir']);
  71: 
 66:     // Make sure avatars_dir doesn't end with a slash 72:     // Make sure avatars_dir doesn't end with a slash
 67:     if (substr($form['avatars_dir'], -1) == '/') 73:     if (substr($form['avatars_dir'], -1) == '/')
 68:         $form['avatars_dir'] = substr($form['avatars_dir'], 0, -1); 74:         $form['avatars_dir'] = substr($form['avatars_dir'], 0, -1);
117:     while (list($key, $input) = @each($form))123:     while (list($key, $input) = @each($form))
118:     {124:     {
119:         // Only update values that have changed125:         // Only update values that have changed
120:         if ($pun_config['o_'.$key] != $input)126:         if (array_key_exists('o_'.$key, $pun_config) && $pun_config['o_'.$key] != $input)
121:         {127:         {
122:             if ($input != '' || is_int($input))128:             if ($input != '' || is_int($input))
123:                 $value = '\''.$db->escape($input).'\'';129:                 $value = '\''.$db->escape($input).'\'';
124:             else130:             else
125:                 $value = 'NULL';131:                 $value = 'NULL';
126: 132: 
127:             $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'o_'.$key.'\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());133:             $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'o_'.$db->escape($key).'\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
128:         }134:         }
129:     }135:     }
130: 136: 
229:         $d = dir(PUN_ROOT.'lang');235:         $d = dir(PUN_ROOT.'lang');
230:         while (($entry = $d->read()) !== false)236:         while (($entry = $d->read()) !== false)
231:         {237:         {
232:             if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry))238:             if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/common.php'))
233:                 $languages[] = $entry;239:                 $languages[] = $entry;
234:         }240:         }
235:         $d->close();241:         $d->close();
236: 242: 
 243:         @natsort($languages);
 244: 
237:         while (list(, $temp) = @each($languages))245:         while (list(, $temp) = @each($languages))
238:         {246:         {
239:             if ($pun_config['o_default_lang'] == $temp)247:             if ($pun_config['o_default_lang'] == $temp)
262:         }270:         }
263:         $d->close();271:         $d->close();
264: 272: 
 273:         @natsort($styles);
 274: 
265:         while (list(, $temp) = @each($styles))275:         while (list(, $temp) = @each($styles))
266:         {276:         {
267:             if ($pun_config['o_default_style'] == $temp)277:             if ($pun_config['o_default_style'] == $temp)


punbb-1.2.2/upload/admin_permissions.php punbb-1.2.16/upload/admin_permissions.php
 39: { 39: {
 40:     confirm_referrer('admin_permissions.php'); 40:     confirm_referrer('admin_permissions.php');
 41:  41: 
 42:     $form = array_map('trim', $_POST['form']); 42:     $form = array_map('intval', $_POST['form']);
 43:  
 44:     $form['sig_length'] = intval($form['sig_length']); 
 45:     $form['sig_lines'] = intval($form['sig_lines']); 
 46:  43: 
 47:     while (list($key, $input) = @each($form)) 44:     while (list($key, $input) = @each($form))
 48:     { 45:     {
 49:         // Only update values that have changed 46:         // Only update values that have changed
 50:         if ($pun_config['p_'.$key] != $input) 47:         if (array_key_exists('p_'.$key, $pun_config) && $pun_config['p_'.$key] != $input)
 51:         { 48:             $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$input.' WHERE conf_name=\'p_'.$db->escape($key).'\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
 52:             if ($input != '' || is_int($input)) 
 53:                 $value = '\''.$db->escape($input).'\''; 
 54:             else 
 55:                 $value = 'NULL'; 
 56:  
 57:             $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'p_'.$key.'\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error()); 
 58:         } 
 59:     } 49:     }
 60:  50: 
 61:     // Regenerate the config cache 51:     // Regenerate the config cache


punbb-1.2.2/upload/admin_prune.php punbb-1.2.16/upload/admin_prune.php
 62:         } 62:         }
 63:         else 63:         else
 64:         { 64:         {
  65:             $prune_from = intval($prune_from);
 65:             prune($prune_from, $_POST['prune_sticky'], $prune_date); 66:             prune($prune_from, $_POST['prune_sticky'], $prune_date);
 66:             update_forum($prune_from); 67:             update_forum($prune_from);
 67:         } 68:         }
 83:  84: 
 84:  85: 
 85:     $prune_days = $_POST['req_prune_days']; 86:     $prune_days = $_POST['req_prune_days'];
 86:     if (!preg_match('#^\d+$#', $prune_days)) 87:     if (!@preg_match('#^\d+$#', $prune_days))
 87:         message('Days to prune must be a positive integer.'); 88:         message('Days to prune must be a positive integer.');
 88:  89: 
 89:     $prune_date = time() - ($prune_days*86400); 90:     $prune_date = time() - ($prune_days*86400);
 97:  98: 
 98:     if ($prune_from != 'all') 99:     if ($prune_from != 'all')
 99:     {100:     {
 101:         $prune_from = intval($prune_from);
100:         $sql .= ' AND forum_id='.$prune_from;102:         $sql .= ' AND forum_id='.$prune_from;
101: 103: 
102:         // Fetch the forum name (just for cosmetic reasons)104:         // Fetch the forum name (just for cosmetic reasons)
135:                         </div>137:                         </div>
136:                     </fieldset>138:                     </fieldset>
137:                 </div>139:                 </div>
138:                 <p><input type="submit" name="prune_comply" value="Prune" />&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)" />Go back</a></p>140:                 <p><input type="submit" name="prune_comply" value="Prune" /><a href="javascript:history.go(-1)">Go back</a></p>
139:             </form>141:             </form>
140:         </div>142:         </div>
141:     </div>143:     </div>


punbb-1.2.2/upload/admin_ranks.php punbb-1.2.16/upload/admin_ranks.php
 46:     if ($rank == '') 46:     if ($rank == '')
 47:         message('You must enter a rank title.'); 47:         message('You must enter a rank title.');
 48:  48: 
 49:     if (!preg_match('#^\d+$#', $min_posts)) 49:     if (!@preg_match('#^\d+$#', $min_posts))
 50:         message('Minimum posts must be a positive integer value.'); 50:         message('Minimum posts must be a positive integer value.');
 51:  51: 
 52:     // Make sure there isn't already a rank with the same min_posts value 52:     // Make sure there isn't already a rank with the same min_posts value
 69: { 69: {
 70:     confirm_referrer('admin_ranks.php'); 70:     confirm_referrer('admin_ranks.php');
 71:  71: 
 72:     $id = key($_POST['update']); 72:     $id = intval(key($_POST['update']));
 73:  73: 
 74:     $rank = trim($_POST['rank'][$id]); 74:     $rank = trim($_POST['rank'][$id]);
 75:     $min_posts = trim($_POST['min_posts'][$id]); 75:     $min_posts = trim($_POST['min_posts'][$id]);
 77:     if ($rank == '') 77:     if ($rank == '')
 78:         message('You must enter a rank title.'); 78:         message('You must enter a rank title.');
 79:  79: 
 80:     if (!preg_match('#^\d+$#', $min_posts)) 80:     if (!@preg_match('#^\d+$#', $min_posts))
 81:         message('Minimum posts must be a positive integer value.'); 81:         message('Minimum posts must be a positive integer value.');
 82:  82: 
 83:     // Make sure there isn't already a rank with the same min_posts value 83:     // Make sure there isn't already a rank with the same min_posts value
 84:     $result = $db->query('SELECT 1 FROM '.$db->prefix.'ranks WHERE id!='.$id.' && min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error()); 84:     $result = $db->query('SELECT 1 FROM '.$db->prefix.'ranks WHERE id!='.$id.' AND min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());
 85:     if ($db->num_rows($result)) 85:     if ($db->num_rows($result))
 86:         message('There is already a rank with a minimun posts value of '.$min_posts.'.'); 86:         message('There is already a rank with a minimun posts value of '.$min_posts.'.');
 87:  87: 
100: {100: {
101:     confirm_referrer('admin_ranks.php');101:     confirm_referrer('admin_ranks.php');
102: 102: 
103:     $id = key($_POST['remove']);103:     $id = intval(key($_POST['remove']));
104: 104: 
105:     $db->query('DELETE FROM '.$db->prefix.'ranks WHERE id='.$id) or error('Unable to delete rank', __FILE__, __LINE__, $db->error());105:     $db->query('DELETE FROM '.$db->prefix.'ranks WHERE id='.$id) or error('Unable to delete rank', __FILE__, __LINE__, $db->error());
106: 106: 


punbb-1.2.2/upload/admin_reports.php punbb-1.2.16/upload/admin_reports.php
 40: { 40: {
 41:     confirm_referrer('admin_reports.php'); 41:     confirm_referrer('admin_reports.php');
 42:  42: 
 43:     $zap_id = key($_POST['zap_id']); 43:     $zap_id = intval(key($_POST['zap_id']));
 44:  44: 
 45:     $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE id='.$zap_id) or error('Unable to fetch report info', __FILE__, __LINE__, $db->error()); 45:     $result = $db->query('SELECT zapped FROM '.$db->prefix.'reports WHERE id='.$zap_id) or error('Unable to fetch report info', __FILE__, __LINE__, $db->error());
 46:     $zapped = $db->result($result); 46:     $zapped = $db->result($result);


punbb-1.2.2/upload/admin_users.php punbb-1.2.16/upload/admin_users.php
 49: ?> 49: ?>
 50: <div class="linkst"> 50: <div class="linkst">
 51:     <div class="inbox"> 51:     <div class="inbox">
 52:         <div><a href="javascript:history.go(-1)" />Go back</a></div> 52:         <div><a href="javascript:history.go(-1)">Go back</a></div>
 53:     </div> 53:     </div>
 54: </div> 54: </div>
 55:  55: 
 98:  98: 
 99: <div class="linksb"> 99: <div class="linksb">
100:     <div class="inbox">100:     <div class="inbox">
101:         <div><a href="javascript:history.go(-1)" />Go back</a></div>101:         <div><a href="javascript:history.go(-1)">Go back</a></div>
102:     </div>102:     </div>
103: </div>103: </div>
104: <?php104: <?php
111: {111: {
112:     $ip = $_GET['show_users'];112:     $ip = $_GET['show_users'];
113: 113: 
114:     if (!preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip))114:     if (!@preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip))
115:         message('The supplied IP address is not correctly formatted.');115:         message('The supplied IP address is not correctly formatted.');
116: 116: 
117: 117: 
121: ?>121: ?>
122: <div class="linkst">122: <div class="linkst">
123:     <div class="inbox">123:     <div class="inbox">
124:         <div><a href="javascript:history.go(-1)" />Go back</a></div>124:         <div><a href="javascript:history.go(-1)">Go back</a></div>
125:     </div>125:     </div>
126: </div>126: </div>
127: 127: 
202: 202: 
203: <div class="linksb">203: <div class="linksb">
204:     <div class="inbox">204:     <div class="inbox">
205:         <div><a href="javascript:history.go(-1)" />Go back</a></div>205:         <div><a href="javascript:history.go(-1)">Go back</a></div>
206:     </div>206:     </div>
207: </div>207: </div>
208: <?php208: <?php
217: 217: 
218:     // trim() all elements in $form218:     // trim() all elements in $form
219:     $form = array_map('trim', $form);219:     $form = array_map('trim', $form);
 220:     $conditions = array();
220: 221: 
221:     $posts_greater = trim($_POST['posts_greater']);222:     $posts_greater = trim($_POST['posts_greater']);
222:     $posts_less = trim($_POST['posts_less']);223:     $posts_less = trim($_POST['posts_less']);
256:     $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';257:     $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
257:     while (list($key, $input) = @each($form))258:     while (list($key, $input) = @each($form))
258:     {259:     {
259:         if ($input != '')260:         if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note')))
260:             $conditions[] = 'u.'.$key.' '.$like_command.' \''.str_replace('*', '%', $input).'\'';261:             $conditions[] = 'u.'.$db->escape($key).' '.$like_command.' \''.$db->escape(str_replace('*', '%', $input)).'\'';
261:     }262:     }
262: 263: 
263:     if ($posts_greater != '')264:     if ($posts_greater != '')
266:         $conditions[] = 'u.num_posts<'.$posts_less;267:         $conditions[] = 'u.num_posts<'.$posts_less;
267: 268: 
268:     if ($user_group != 'all')269:     if ($user_group != 'all')
269:         $conditions[] = 'u.group_id='.$user_group;270:         $conditions[] = 'u.group_id='.intval($user_group);
270: 271: 
271:     if (!isset($conditions))272:     if (empty($conditions))
272:         message('You didn\'t enter any search terms.');273:         message('You didn\'t enter any search terms.');
273: 274: 
274: 275: 
278: ?>279: ?>
279: <div class="linkst">280: <div class="linkst">
280:     <div class="inbox">281:     <div class="inbox">
281:         <div><a href="javascript:history.go(-1)" />Go back</a></div>282:         <div><a href="javascript:history.go(-1)">Go back</a></div>
282:     </div>283:     </div>
283: </div>284: </div>
284: 285: 
300:             <tbody>301:             <tbody>
301: <?php302: <?php
302: 303: 
303:     $result = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1 AND '.implode(' AND ', $conditions).' ORDER BY '.$order_by.' '.$direction) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());304:     $result = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1 AND '.implode(' AND ', $conditions).' ORDER BY '.$db->escape($order_by).' '.$db->escape($direction)) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
304:     if ($db->num_rows($result))305:     if ($db->num_rows($result))
305:     {306:     {
306:         while ($user_data = $db->fetch_assoc($result))307:         while ($user_data = $db->fetch_assoc($result))
338: 339: 
339: <div class="linksb">340: <div class="linksb">
340:     <div class="inbox">341:     <div class="inbox">
341:         <div><a href="javascript:history.go(-1)" />Go back</a></div>342:         <div><a href="javascript:history.go(-1)">Go back</a></div>
342:     </div>343:     </div>
343: </div>344: </div>
344: <?php345: <?php


punbb-1.2.2/upload/edit.php punbb-1.2.16/upload/edit.php
175: else if (isset($_POST['preview']))175: else if (isset($_POST['preview']))
176: {176: {
177:     require_once PUN_ROOT.'include/parser.php';177:     require_once PUN_ROOT.'include/parser.php';
178:     $message = parse_message(trim($_POST['req_message']), $hide_smilies);178:     $preview_message = parse_message($message, $hide_smilies);
179: 179: 
180: ?>180: ?>
181: <div id="postpreview" class="blockpost">181: <div id="postpreview" class="blockpost">
184:         <div class="inbox">184:         <div class="inbox">
185:             <div class="postright">185:             <div class="postright">
186:                 <div class="postmsg">186:                 <div class="postmsg">
187:                     <?php echo $message."\n" ?>187:                     <?php echo $preview_message."\n" ?>
188:                 </div>188:                 </div>
189:             </div>189:             </div>
190:         </div>190:         </div>
208: <?php if ($can_edit_subject): ?>                        <label><?php echo $lang_common['Subject'] ?><br />208: <?php if ($can_edit_subject): ?>                        <label><?php echo $lang_common['Subject'] ?><br />
209:                         <input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>209:                         <input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>
210: <?php endif; ?>                        <label><?php echo $lang_common['Message'] ?><br />210: <?php endif; ?>                        <label><?php echo $lang_common['Message'] ?><br />
211:                         <textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo pun_htmlspecialchars(isset($_POST['req_message']) ? $_POST['req_message'] : $cur_post['message']) ?></textarea><br /></label>211:                         <textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo pun_htmlspecialchars(isset($_POST['req_message']) ? $message : $cur_post['message']) ?></textarea><br /></label>
212:                         <ul class="bblinks">212:                         <ul class="bblinks">
213:                             <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>213:                             <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
214:                             <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>214:                             <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>


punbb-1.2.2/upload/extern.php punbb-1.2.16/upload/extern.php
116:     exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');116:     exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');
117: 117: 
118: 118: 
119: // Disable error reporting for uninitialized variables119: // Make sure PHP reports all errors except E_NOTICE
120: error_reporting(E_ALL);120: error_reporting(E_ALL ^ E_NOTICE);
121: 121: 
122: // Turn off magic_quotes_runtime122: // Turn off magic_quotes_runtime
123: set_magic_quotes_runtime(0);123: set_magic_quotes_runtime(0);
129: // Load DB abstraction layer and try to connect129: // Load DB abstraction layer and try to connect
130: require PUN_ROOT.'include/dblayer/common_db.php';130: require PUN_ROOT.'include/dblayer/common_db.php';
131: 131: 
132: // Get the forum config132: // Load cached config
133: $result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());133: @include PUN_ROOT.'cache/cache_config.php';
134: while ($cur_config_item = $db->fetch_row($result))134: if (!defined('PUN_CONFIG_LOADED'))
135:     $pun_config[$cur_config_item[0]] = $cur_config_item[1];135: {
 136:     require PUN_ROOT.'include/cache.php';
 137:     generate_config_cache();
 138:     require PUN_ROOT.'cache/cache_config.php';
 139: }
136: 140: 
137: // Make sure we (guests) have permission to read the forums141: // Make sure we (guests) have permission to read the forums
138: $result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());142: $result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
145: if (!isset($lang_common))149: if (!isset($lang_common))
146:     exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.');150:     exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.');
147: 151: 
 152: // Check if we are to display a maintenance message
 153: if ($pun_config['o_maintenance'] && !defined('PUN_TURN_OFF_MAINT'))
 154:     maintenance_message();
 155: 
148: if (!isset($_GET['action']))156: if (!isset($_GET['action']))
149:     exit('No parameters supplied. See extern.php for instructions.');157:     exit('No parameters supplied. See extern.php for instructions.');
150: 158: 


punbb-1.2.2/upload/footer.php punbb-1.2.16/upload/footer.php
139: // END SUBST - <pun_footer>139: // END SUBST - <pun_footer>
140: 140: 
141: 141: 
142: // START SUBST - <pun_include "*"> 
143: while (preg_match('/<pun_include "(.*?)">/', $tpl_main, $cur_include)) 
144: { 
145:     ob_start(); 
146:     include PUN_ROOT.$cur_include[1]; 
147:     $tpl_temp = ob_get_contents(); 
148:     $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main); 
149:     ob_end_clean(); 
150: } 
151: // END SUBST - <pun_include "*"> 
152:  
153:  
154: // Close the db connection (and free up any result data)142: // Close the db connection (and free up any result data)
155: $db->close();143: $db->close();
156: 144: 


punbb-1.2.2/upload/header.php punbb-1.2.16/upload/header.php
 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 15:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16:   GNU General Public License for more details. 16:   GNU General Public License for more details.
 17:  17: 
 18:   You should have received a copy of the GNU G>eneral Public License 18:   You should have received a copy of the GNU General Public License
 19:   along with this program; if not, write to the Free Software 19:   along with this program; if not, write to the Free Software
 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20:   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 21:   MA  02111-1307  USA 21:   MA  02111-1307  USA
 43:     $tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl'); 43:     $tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
 44:  44: 
 45:  45: 
  46: // START SUBST - <pun_include "*">
  47: while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
  48: {
  49:     if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
  50:         error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template main.tpl. There is no such file in folder /include/user/');
  51: 
  52:     ob_start();
  53:     include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
  54:     $tpl_temp = ob_get_contents();
  55:     $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
  56:     ob_end_clean();
  57: }
  58: // END SUBST - <pun_include "*">
  59: 
  60: 
 46: // START SUBST - <pun_content_direction> 61: // START SUBST - <pun_content_direction>
 47: $tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main); 62: $tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
 48: // END SUBST - <pun_content_direction> 63: // END SUBST - <pun_content_direction>
 68: if (defined('PUN_ADMIN_CONSOLE')) 83: if (defined('PUN_ADMIN_CONSOLE'))
 69:     echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n"; 84:     echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";
 70:  85: 
 71: if (isset($destination_url)) 86: if (isset($required_fields))
 72:     echo '<meta http-equiv="refresh" content="'.$delay.';URL='.$destination.'" />'."\n"; 
 73:  
 74: else if (isset($required_fields)) 
 75: { 87: {
 76:     // Output JavaScript to validate form (make sure required fields are filled out) 88:     // Output JavaScript to validate form (make sure required fields are filled out)
 77:  89: 
134: 146: 
135: 147: 
136: // START SUBST - <pun_page>148: // START SUBST - <pun_page>
137: $tpl_main = str_replace('<pun_page>', basename($_SERVER['PHP_SELF'], '.php'), $tpl_main);149: $tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main);
138: // END SUBST - <pun_title>150: // END SUBST - <pun_title>
139: 151: 
140: 152: 
171:             $tpl_temp .= "\n\t\t\t\t".'<li class="maintenancelink"><strong><a href="admin_options.php#maintenance">Maintenance mode is enabled!</a></strong></li>';183:             $tpl_temp .= "\n\t\t\t\t".'<li class="maintenancelink"><strong><a href="admin_options.php#maintenance">Maintenance mode is enabled!</a></strong></li>';
172:     }184:     }
173: 185: 
174:     if (basename($_SERVER['PHP_SELF']) == 'index.php')186:     if (in_array(basename($_SERVER['PHP_SELF']), array('index.php', 'search.php')))
175:         $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'."\n\t\t\t\t".'<li><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></li>'."\n\t\t\t\t".'<li><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';187:         $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<ul class="conr">'."\n\t\t\t\t".'<li><a href="search.php?action=show_new">'.$lang_common['Show new posts'].'</a></li>'."\n\t\t\t\t".'<li><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></li>'."\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
176:     else if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == 'action=show_new') 
177:         $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<p class="conr"><a href="misc.php?action=markread">'.$lang_common['Mark all as read'].'</a></p>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'; 
178:     else188:     else
179:         $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';189:         $tpl_temp .= "\n\t\t\t".'</ul>'."\n\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>';
180: }190: }


punbb-1.2.2/upload/help.php punbb-1.2.16/upload/help.php
 86:         &nbsp;&nbsp;&nbsp;&nbsp;[quote]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br /> 86:         &nbsp;&nbsp;&nbsp;&nbsp;[quote]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br />
 87:         <?php echo $lang_help['produces quote box'] ?><br /><br /> 87:         <?php echo $lang_help['produces quote box'] ?><br /><br />
 88:         <div class="postmsg"> 88:         <div class="postmsg">
 89:             <blockquote><div class="incqbox"></h4><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote> 89:             <blockquote><div class="incqbox"><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote>
 90:         </div> 90:         </div>
 91:     </div> 91:     </div>
 92: </div> 92: </div>


punbb-1.2.2/upload/include/cache.php punbb-1.2.16/upload/include/cache.php
129:     global $db;129:     global $db;
130: 130: 
131:     // Get the rank list from the DB131:     // Get the rank list from the DB
132:     $result = $db->query('SELECT * FROM '.$db->prefix.'ranks', true) or error('Unable to fetch rank list', __FILE__, __LINE__, $db->error());132:     $result = $db->query('SELECT * FROM '.$db->prefix.'ranks ORDER BY min_posts', true) or error('Unable to fetch rank list', __FILE__, __LINE__, $db->error());
133: 133: 
134:     $output = array();134:     $output = array();
135:     while ($cur_rank = $db->fetch_assoc($result))135:     while ($cur_rank = $db->fetch_assoc($result))
174:         if (!$fh)174:         if (!$fh)
175:             error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);175:             error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'', __FILE__, __LINE__);
176: 176: 
177:         $output = '<?php'."\n\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>';177:         $output = '<?php'."\n\n".'if (!defined(\'PUN\')) exit;'."\n".'define(\'PUN_QJ_LOADED\', 1);'."\n\n".'?>';
178:         $output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><?php echo $lang_common[\'Jump to\'] ?>'."\n\n\t\t\t\t\t".'<br /><select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n";178:         $output .= "\t\t\t\t".'<form id="qjump" method="get" action="viewforum.php">'."\n\t\t\t\t\t".'<div><label><?php echo $lang_common[\'Jump to\'] ?>'."\n\n\t\t\t\t\t".'<br /><select name="id" onchange="window.location=(\'viewforum.php?id=\'+this.options[this.selectedIndex].value)">'."\n";
179: 179: 
180: 180: 


punbb-1.2.2/upload/include/common.php punbb-1.2.16/upload/include/common.php
 32: if (!defined('PUN_ROOT')) 32: if (!defined('PUN_ROOT'))
 33:     exit('The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.'); 33:     exit('The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.');
 34:  34: 
  35: 
  36: // Load the functions script
  37: require PUN_ROOT.'include/functions.php';
  38: 
  39: // Reverse the effect of register_globals
  40: unregister_globals();
  41: 
  42: 
 35: @include PUN_ROOT.'config.php'; 43: @include PUN_ROOT.'config.php';
 36:  44: 
 37: // If PUN isn't defined, config.php is missing or corrupt 45: // If PUN isn't defined, config.php is missing or corrupt
 43: list($usec, $sec) = explode(' ', microtime()); 51: list($usec, $sec) = explode(' ', microtime());
 44: $pun_start = ((float)$usec + (float)$sec); 52: $pun_start = ((float)$usec + (float)$sec);
 45:  53: 
 46: // Enable full error, warning and notice reporting 54: // Make sure PHP reports all errors except E_NOTICE. PunBB supports E_ALL, but a lot of scripts it may interact with, do not.
 47: error_reporting(E_ALL); 55: error_reporting(E_ALL ^ E_NOTICE);
 48:  56: 
 49: // Turn off magic_quotes_runtime 57: // Turn off magic_quotes_runtime
 50: set_magic_quotes_runtime(0); 58: set_magic_quotes_runtime(0);
 77: define('PUN_MEMBER', 4); 85: define('PUN_MEMBER', 4);
 78:  86: 
 79:  87: 
 80: // Load the functions script 
 81: require PUN_ROOT.'include/functions.php'; 
 82:  
 83: // Load DB abstraction layer and connect 88: // Load DB abstraction layer and connect
 84: require PUN_ROOT.'include/dblayer/common_db.php'; 89: require PUN_ROOT.'include/dblayer/common_db.php';
 85:  90: 
117: // Attempt to load the common language file122: // Attempt to load the common language file
118: @include PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';123: @include PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
119: if (!isset($lang_common))124: if (!isset($lang_common))
120:     exit('There is no valid language pack \''.$pun_user['language'].'\' installed. Please reinstall a language of that name.');125:     exit('There is no valid language pack \''.pun_htmlspecialchars($pun_user['language']).'\' installed. Please reinstall a language of that name.');
121: 126: 
122: // Check if we are to display a maintenance message127: // Check if we are to display a maintenance message
123: if ($pun_config['o_maintenance'] && $pun_user['g_id'] > PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT'))128: if ($pun_config['o_maintenance'] && $pun_user['g_id'] > PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT'))


punbb-1.2.2/upload/include/dblayer/common_db.php punbb-1.2.16/upload/include/dblayer/common_db.php
 23: ************************************************************************/ 23: ************************************************************************/
 24:  24: 
 25:  25: 
  26: // Make sure no one attempts to run this script "directly"
  27: if (!defined('PUN'))
  28:     exit;
  29: 
  30: 
 26: // 31: //
 27: // Return current timestamp (with microseconds) as a float (used in dblayer) 32: // Return current timestamp (with microseconds) as a float (used in dblayer)
 28: // 33: //


punbb-1.2.2/upload/include/dblayer/mysql.php punbb-1.2.16/upload/include/dblayer/mysql.php
156: 156: 
157:     function escape($str)157:     function escape($str)
158:     {158:     {
159:         if (function_exists('mysql_real_escape_string'))159:         if (is_array($str))
 160:             return '';
 161:         else if (function_exists('mysql_real_escape_string'))
160:             return mysql_real_escape_string($str, $this->link_id);162:             return mysql_real_escape_string($str, $this->link_id);
161:         else163:         else
162:             return mysql_escape_string($str);164:             return mysql_escape_string($str);


punbb-1.2.2/upload/include/dblayer/mysqli.php punbb-1.2.16/upload/include/dblayer/mysqli.php
159: 159: 
160:     function escape($str)160:     function escape($str)
161:     {161:     {
162:         return mysqli_real_escape_string($this->link_id, $str);162:         return is_array($str) ? '' : mysqli_real_escape_string($this->link_id, $str);
163:     }163:     }
164: 164: 
165: 165: 


punbb-1.2.2/upload/include/dblayer/pgsql.php punbb-1.2.16/upload/include/dblayer/pgsql.php
217: 217: 
218:     function escape($str)218:     function escape($str)
219:     {219:     {
220:         return pg_escape_string($str);220:         return is_array($str) ? '' : pg_escape_string($str);
221:     }221:     }
222: 222: 
223: 223: 


punbb-1.2.2/upload/include/dblayer/sqlite.php punbb-1.2.16/upload/include/dblayer/sqlite.php
219: 219: 
220:     function escape($str)220:     function escape($str)
221:     {221:     {
222:         return sqlite_escape_string($str);222:         return is_array($str) ? '' : sqlite_escape_string($str);
223:     }223:     }
224: 224: 
225: 225: 


punbb-1.2.2/upload/include/email.php punbb-1.2.16/upload/include/email.php
 33: // 33: //
 34: function is_valid_email($email) 34: function is_valid_email($email)
 35: { 35: {
 36:     return preg_match('#^.{1,}@.{2,}\..{2,}$#', $email); 36:     if (strlen($email) > 50)
  37:         return false;
  38: 
  39:     return preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);
 37: } 40: }
 38:  41: 
 39:  42: 
 65:  68: 
 66:     // Default sender/return address 69:     // Default sender/return address
 67:     if (!$from) 70:     if (!$from)
 68:         $from = '"'.$pun_config['o_board_title'].' '.$lang_common['Mailer'].'" <'.$pun_config['o_webmaster_email'].'>'; 71:         $from = '"'.str_replace('"', '', $pun_config['o_board_title'].' '.$lang_common['Mailer']).'" <'.$pun_config['o_webmaster_email'].'>';
 69:  
 70:     // Make sure the from line doesn't contain a colon (the character, that is :D) 
 71:     $from = str_replace(':', ' ', $from); 
 72:  72: 
 73:     // Detect what linebreak we should use for the headers 73:     // Do a little spring cleaning
 74:     if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) 74:     $to = trim(preg_replace('#[\n\r]+#s', '', $to));
 75:         $eol = "\r\n"; 75:     $subject = trim(preg_replace('#[\n\r]+#s', '', $subject));
 76:     else if (strtoupper(substr(PHP_OS, 0, 3) == 'MAC')) 76:     $from = trim(preg_replace('#[\n\r:]+#s', '', $from));
 77:         $eol = "\r"; 
 78:     else 
 79:         $eol = "\n"; 
 80:  77: 
 81:     $headers = 'From: '.$from.$eol.'Date: '.date('r').$eol.'MIME-Version: 1.0'.$eol.'Content-transfer-encoding: 8bit'.$eol.'Content-type: text/plain; charset='.$lang_common['lang_encoding'].$eol.'X-Mailer: PunBB Mailer'; 78:     $headers = 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\r\n".'X-Mailer: PunBB Mailer';
 82:  79: 
 83:     // Make sure all linebreaks are CRLF in message 80:     // Make sure all linebreaks are CRLF in message (and strip out any NULL bytes)
 84:     $message = str_replace("\n", "\r\n", pun_linebreaks($message)); 81:     $message = str_replace(array("\n", "\0"), array("\r\n", ''), pun_linebreaks($message));
 85:  82: 
 86:     if ($pun_config['o_smtp_host'] != '') 83:     if ($pun_config['o_smtp_host'] != '')
 87:         smtp_mail($to, $subject, $message, $headers); 84:         smtp_mail($to, $subject, $message, $headers);
 88:     else 85:     else
  86:     {
  87:         // Change the linebreaks used in the headers according to OS
  88:         if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC')
  89:             $headers = str_replace("\r\n", "\r", $headers);
  90:         else if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
  91:             $headers = str_replace("\r\n", "\n", $headers);
  92: 
 89:         mail($to, $subject, $message, $headers); 93:         mail($to, $subject, $message, $headers);
  94:     }
 90: } 95: }
 91:  96: 
 92:  97: 


punbb-1.2.2/upload/include/functions.php punbb-1.2.16/upload/include/functions.php
 27: // 27: //
 28: function check_cookie(&$pun_user) 28: function check_cookie(&$pun_user)
 29: { 29: {
 30:     global $db, $pun_config, $cookie_name, $cookie_seed; 30:     global $db, $db_type, $pun_config, $cookie_name, $cookie_seed;
 31:  31: 
 32:     $now = time(); 32:     $now = time();
 33:     $expire = $now + 31536000;    // The cookie expires after a year 33:     $expire = $now + 31536000;    // The cookie expires after a year
 46:         $pun_user = $db->fetch_assoc($result); 46:         $pun_user = $db->fetch_assoc($result);
 47:  47: 
 48:         // If user authorisation failed 48:         // If user authorisation failed
 49:         if (!isset($pun_user['id']) || md5($cookie_seed.$pun_user['password']) != $cookie['password_hash']) 49:         if (!isset($pun_user['id']) || md5($cookie_seed.$pun_user['password']) !== $cookie['password_hash'])
 50:         { 50:         {
 51:             pun_setcookie(0, random_pass(8), $expire); 51:             pun_setcookie(0, random_pass(8), $expire);
 52:             set_default_user(); 52:             set_default_user();
 75:         { 75:         {
 76:             // Update the online list 76:             // Update the online list
 77:             if (!$pun_user['logged']) 77:             if (!$pun_user['logged'])
 78:                 $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$now.')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); 78:             {
  79:                 $pun_user['logged'] = $now;
  80: 
  81:                 // With MySQL/MySQLi, REPLACE INTO avoids a user having two rows in the online table
  82:                 switch ($db_type)
  83:                 {
  84:                     case 'mysql':
  85:                     case 'mysqli':
  86:                         $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
  87:                         break;
  88: 
  89:                     default:
  90:                         $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
  91:                         break;
  92:                 }
  93:             }
 79:             else 94:             else
 80:             { 95:             {
 81:                 // Special case: We've timed out, but no other user has browsed the forums since we timed out 96:                 // Special case: We've timed out, but no other user has browsed the forums since we timed out
102: //117: //
103: function set_default_user()118: function set_default_user()
104: {119: {
105:     global $db, $pun_user, $pun_config;120:     global $db, $db_type, $pun_user, $pun_config;
106: 121: 
107:     $remote_addr = get_remote_address();122:     $remote_addr = get_remote_address();
108: 123: 
115: 130: 
116:     // Update online list131:     // Update online list
117:     if (!$pun_user['logged'])132:     if (!$pun_user['logged'])
118:         $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.time().')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());133:     {
 134:         $pun_user['logged'] = time();
 135: 
 136:         // With MySQL/MySQLi, REPLACE INTO avoids a user having two rows in the online table
 137:         switch ($db_type)
 138:         {
 139:             case 'mysql':
 140:             case 'mysqli':
 141:                 $db->query('REPLACE INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
 142:                 break;
 143: 
 144:             default:
 145:                 $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES(1, \''.$db->escape($remote_addr).'\', '.$pun_user['logged'].')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
 146:                 break;
 147:         }
 148:     }
119:     else149:     else
120:         $db->query('UPDATE '.$db->prefix.'online SET logged='.time().' WHERE ident=\''.$db->escape($remote_addr).'\'') or error('Unable to update online list', __FILE__, __LINE__, $db->error());150:         $db->query('UPDATE '.$db->prefix.'online SET logged='.time().' WHERE ident=\''.$db->escape($remote_addr).'\'') or error('Unable to update online list', __FILE__, __LINE__, $db->error());
121: 151: 
138:     // Enable sending of a P3P header by removing // from the following line (try this if login is failing in IE6)168:     // Enable sending of a P3P header by removing // from the following line (try this if login is failing in IE6)
139: //    @header('P3P: CP="CUR ADM"');169: //    @header('P3P: CP="CUR ADM"');
140: 170: 
141:     setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash))), $expire, $cookie_path, $cookie_domain, $cookie_secure);171:     if (version_compare(PHP_VERSION, '5.2.0', '>='))
 172:         setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash))), $expire, $cookie_path, $cookie_domain, $cookie_secure, true);
 173:     else
 174:         setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash))), $expire, $cookie_path.'; HttpOnly', $cookie_domain, $cookie_secure);
142: }175: }
143: 176: 
144: 177: 
168:         }201:         }
169: 202: 
170:         if ($cur_ban['username'] != '' && !strcasecmp($pun_user['username'], $cur_ban['username']))203:         if ($cur_ban['username'] != '' && !strcasecmp($pun_user['username'], $cur_ban['username']))
 204:         {
 205:             $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape($pun_user['username']).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
171:             message($lang_common['Ban message'].' '.(($cur_ban['expire'] != '') ? $lang_common['Ban message 2'].' '.strtolower(format_time($cur_ban['expire'], true)).'. ' : '').(($cur_ban['message'] != '') ? $lang_common['Ban message 3'].'<br /><br /><strong>'.pun_htmlspecialchars($cur_ban['message']).'</strong><br /><br />' : '<br /><br />').$lang_common['Ban message 4'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);206:             message($lang_common['Ban message'].' '.(($cur_ban['expire'] != '') ? $lang_common['Ban message 2'].' '.strtolower(format_time($cur_ban['expire'], true)).'. ' : '').(($cur_ban['message'] != '') ? $lang_common['Ban message 3'].'<br /><br /><strong>'.pun_htmlspecialchars($cur_ban['message']).'</strong><br /><br />' : '<br /><br />').$lang_common['Ban message 4'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);
 207:         }
172: 208: 
173:         if ($cur_ban['ip'] != '')209:         if ($cur_ban['ip'] != '')
174:         {210:         {
179:                 $cur_ban_ips[$i] = $cur_ban_ips[$i].'.';215:                 $cur_ban_ips[$i] = $cur_ban_ips[$i].'.';
180: 216: 
181:                 if (substr($user_ip, 0, strlen($cur_ban_ips[$i])) == $cur_ban_ips[$i])217:                 if (substr($user_ip, 0, strlen($cur_ban_ips[$i])) == $cur_ban_ips[$i])
 218:                 {
 219:                     $db->query('DELETE FROM '.$db->prefix.'online WHERE ident=\''.$db->escape($pun_user['username']).'\'') or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());
182:                     message($lang_common['Ban message'].' '.(($cur_ban['expire'] != '') ? $lang_common['Ban message 2'].' '.strtolower(format_time($cur_ban['expire'], true)).'. ' : '').(($cur_ban['message'] != '') ? $lang_common['Ban message 3'].'<br /><br /><strong>'.pun_htmlspecialchars($cur_ban['message']).'</strong><br /><br />' : '<br /><br />').$lang_common['Ban message 4'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);220:                     message($lang_common['Ban message'].' '.(($cur_ban['expire'] != '') ? $lang_common['Ban message 2'].' '.strtolower(format_time($cur_ban['expire'], true)).'. ' : '').(($cur_ban['message'] != '') ? $lang_common['Ban message 3'].'<br /><br /><strong>'.pun_htmlspecialchars($cur_ban['message']).'</strong><br /><br />' : '<br /><br />').$lang_common['Ban message 4'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true);
 221:                 }
183:             }222:             }
184:         }223:         }
185:     }224:     }
203:     $now = time();242:     $now = time();
204: 243: 
205:     // Fetch all online list entries that are older than "o_timeout_online"244:     // Fetch all online list entries that are older than "o_timeout_online"
206:     $result = $db->query('SELECT * FROM '.$db->prefix.'online WHERE logged<'.($now-$pun_config['o_timeout_online'])) or error('Unable to delete from online list', __FILE__, __LINE__, $db->error());245:     $result = $db->query('SELECT * FROM '.$db->prefix.'online WHERE logged<'.($now-$pun_config['o_timeout_online'])) or error('Unable to fetch old entries from online list', __FILE__, __LINE__, $db->error());
207:     while ($cur_user = $db->fetch_assoc($result))246:     while ($cur_user = $db->fetch_assoc($result))
208:     {247:     {
209:         // If the entry is a guest, delete it248:         // If the entry is a guest, delete it
313: 352: 
314: 353: 
315: //354: //
316: // Update posts, topics, last_post, last_post_id and last_poster for a forum (redirect topics are not included)355: // Update posts, topics, last_post, last_post_id and last_poster for a forum
317: //356: //
318: function update_forum($forum_id)357: function update_forum($forum_id)
319: {358: {
320:     global $db;359:     global $db;
321: 360: 
322:     $result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE moved_to IS NULL AND forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error());361:     $result = $db->query('SELECT COUNT(id), SUM(num_replies) FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id) or error('Unable to fetch forum topic count', __FILE__, __LINE__, $db->error());
323:     list($num_topics, $num_posts) = $db->fetch_row($result);362:     list($num_topics, $num_posts) = $db->fetch_row($result);
324: 363: 
325:     $num_posts = $num_posts + $num_topics;        // $num_posts is only the sum of all replies (we have to add the topic posts)364:     $num_posts = $num_posts + $num_topics;        // $num_posts is only the sum of all replies (we have to add the topic posts)
332:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.$db->escape($last_poster).'\' WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());371:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post='.$last_post.', last_post_id='.$last_post_id.', last_poster=\''.$db->escape($last_poster).'\' WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
333:     }372:     }
334:     else    // There are no topics373:     else    // There are no topics
335:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics=0, num_posts=0, last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());374:         $db->query('UPDATE '.$db->prefix.'forums SET num_topics='.$num_topics.', num_posts='.$num_posts.', last_post=NULL, last_post_id=NULL, last_poster=NULL WHERE id='.$forum_id) or error('Unable to update last_post/last_post_id/last_poster', __FILE__, __LINE__, $db->error());
336: }375: }
337: 376: 
338: 377: 
675: //714: //
676: function get_remote_address()715: function get_remote_address()
677: {716: {
678:     $remote_address = $_SERVER['REMOTE_ADDR'];717:     return $_SERVER['REMOTE_ADDR'];
679:  
680:     // If HTTP_X_FORWARDED_FOR is set, we try to grab the first non-LAN IP 
681:     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) 
682:     { 
683:         if (preg_match_all('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_SERVER['HTTP_X_FORWARDED_FOR'], $address_list)) 
684:         { 
685:             $lan_ips = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.((1[6-9])|(2[0-9])|(3[0-1]))\..*/', '/^10\..*/', '/^224\..*/', '/^240\..*/'); 
686:             $address_list = preg_replace($lan_ips, null, $address_list[0]); 
687:  
688:             while (list(, $cur_address) = each($address_list)) 
689:             { 
690:                 if ($cur_address) 
691:                 { 
692:                     $remote_address = $cur_address; 
693:                     break; 
694:                 } 
695:             } 
696:         } 
697:     } 
698:  
699:     return $remote_address; 
700: }718: }
701: 719: 
702: 720: 
739: 757: 
740:     if (strpos($lang_common['lang_encoding'], '8859') !== false)758:     if (strpos($lang_common['lang_encoding'], '8859') !== false)
741:     {759:     {
742:         $fishy_chars = array(chr(0x81), chr(0x8D), chr(0x8F), chr(0x90), chr(0x9D), chr(0xA0), chr(0xCA));760:         $fishy_chars = array(chr(0x81), chr(0x8D), chr(0x8F), chr(0x90), chr(0x9D), chr(0xA0));
743:         return trim(str_replace($fishy_chars, ' ', $str));761:         return trim(str_replace($fishy_chars, ' ', $str));
744:     }762:     }
745:     else763:     else
764:     $tpl_maint = trim(file_get_contents(PUN_ROOT.'include/template/maintenance.tpl'));782:     $tpl_maint = trim(file_get_contents(PUN_ROOT.'include/template/maintenance.tpl'));
765: 783: 
766: 784: 
 785:     // START SUBST - <pun_include "*">
 786:     while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_maint, $cur_include))
 787:     {
 788:         if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
 789:             error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template maintenance.tpl. There is no such file in folder /include/user/');
 790: 
 791:         ob_start();
 792:         include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
 793:         $tpl_temp = ob_get_contents();
 794:         $tpl_maint = str_replace($cur_include[0], $tpl_temp, $tpl_maint);
 795:         ob_end_clean();
 796:     }
 797:     // END SUBST - <pun_include "*">
 798: 
 799: 
767:     // START SUBST - <pun_content_direction>800:     // START SUBST - <pun_content_direction>
768:     $tpl_maint = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_maint);801:     $tpl_maint = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_maint);
769:     // END SUBST - <pun_content_direction>802:     // END SUBST - <pun_content_direction>
802:     $db->end_transaction();835:     $db->end_transaction();
803: 836: 
804: 837: 
805:     // START SUBST - <pun_include "*"> 
806:     while (preg_match('<pun_include "(.*?)">', $tpl_maint, $cur_include)) 
807:     { 
808:         ob_start(); 
809:         include PUN_ROOT.$cur_include[1]; 
810:         $tpl_temp = ob_get_contents(); 
811:         $tpl_maint = str_replace('<'.$cur_include[0].'>', $tpl_temp, $tpl_maint); 
812:         ob_end_clean(); 
813:     } 
814:     // END SUBST - <pun_include "*"> 
815:  
816:  
817:     // Close the db connection (and free up any result data)838:     // Close the db connection (and free up any result data)
818:     $db->close();839:     $db->close();
819: 840: 
828: {849: {
829:     global $db, $pun_config, $lang_common, $pun_user;850:     global $db, $pun_config, $lang_common, $pun_user;
830: 851: 
831:     if ($destination_url == '')852:     // Prefix with o_base_url (unless it's there already)
832:         $destination_url = 'index.php';853:     if (strpos($destination_url, $pun_config['o_base_url']) !== 0)
 854:         $destination_url = $pun_config['o_base_url'].'/'.$destination_url;
 855: 
 856:     // Do a little spring cleaning
 857:     $destination_url = preg_replace('/([\r\n])|(%0[ad])|(;[\s]*data[\s]*:)/i', '', $destination_url);
833: 858: 
834:     // If the delay is 0 seconds, we might as well skip the redirect all together859:     // If the delay is 0 seconds, we might as well skip the redirect all together
835:     if ($pun_config['o_redirect_delay'] == '0')860:     if ($pun_config['o_redirect_delay'] == '0')
840:     $tpl_redir = trim(file_get_contents(PUN_ROOT.'include/template/redirect.tpl'));865:     $tpl_redir = trim(file_get_contents(PUN_ROOT.'include/template/redirect.tpl'));
841: 866: 
842: 867: 
 868:     // START SUBST - <pun_include "*">
 869:     while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_redir, $cur_include))
 870:     {
 871:         if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
 872:             error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template redirect.tpl. There is no such file in folder /include/user/');
 873: 
 874:         ob_start();
 875:         include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
 876:         $tpl_temp = ob_get_contents();
 877:         $tpl_redir = str_replace($cur_include[0], $tpl_temp, $tpl_redir);
 878:         ob_end_clean();
 879:     }
 880:     // END SUBST - <pun_include "*">
 881: 
 882: 
843:     // START SUBST - <pun_content_direction>883:     // START SUBST - <pun_content_direction>
844:     $tpl_redir = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_redir);884:     $tpl_redir = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_redir);
845:     // END SUBST - <pun_content_direction>885:     // END SUBST - <pun_content_direction>
854:     ob_start();894:     ob_start();
855: 895: 
856: ?>896: ?>
857: <meta http-equiv="refresh" content="<?php echo $pun_config['o_redirect_delay'] ?>;URL=<?php echo $destination_url ?>" />897: <meta http-equiv="refresh" content="<?php echo $pun_config['o_redirect_delay'] ?>;URL=<?php echo str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $destination_url) ?>" />
858: <title><?php echo pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Redirecting'] ?></title>898: <title><?php echo pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Redirecting'] ?></title>
859: <link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />899: <link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
860: <?php900: <?php
892:     // END SUBST - <pun_footer>932:     // END SUBST - <pun_footer>
893: 933: 
894: 934: 
895:     // START SUBST - <pun_include "*"> 
896:     while (preg_match('<pun_include "(.*?)">', $tpl_redir, $cur_include)) 
897:     { 
898:         ob_start(); 
899:         include PUN_ROOT.$cur_include[1]; 
900:         $tpl_temp = ob_get_contents(); 
901:         $tpl_redir = str_replace('<'.$cur_include[0].'>', $tpl_temp, $tpl_redir); 
902:         ob_end_clean(); 
903:     } 
904:     // END SUBST - <pun_include "*"> 
905:  
906:  
907:     // Close the db connection (and free up any result data)935:     // Close the db connection (and free up any result data)
908:     $db->close();936:     $db->close();
909: 937: 
931: 959: 
932: ?>960: ?>
933: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">961: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
934: <html dir="ltr">962: <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
935: <head>963: <head>
936: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />964: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
937: <title><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?> / Error</title>965: <title><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?> / Error</title>
1038: 1066: 
1039: 1067: 
1040: //1068: //
 1069: // Unset any variables instantiated as a result of register_globals being enabled
 1070: //
 1071: function unregister_globals()
 1072: {
 1073:     $register_globals = @ini_get('register_globals');
 1074:     if ($register_globals === "" || $register_globals === "0" || strtolower($register_globals) === "off")
 1075:         return;
 1076: 
 1077:     // Prevent script.php?GLOBALS[foo]=bar
 1078:     if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS']))
 1079:         exit('I\'ll have a steak sandwich and... a steak sandwich.');
 1080:     
 1081:     // Variables that shouldn't be unset
 1082:     $no_unset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES');
 1083: 
 1084:     // Remove elements in $GLOBALS that are present in any of the superglobals
 1085:     $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
 1086:     foreach ($input as $k => $v)
 1087:     {
 1088:         if (!in_array($k, $no_unset) && isset($GLOBALS[$k]))
 1089:         {
 1090:             unset($GLOBALS[$k]);
 1091:             unset($GLOBALS[$k]);    // Double unset to circumvent the zend_hash_del_key_or_index hole in PHP <4.4.3 and <5.1.4
 1092:         }
 1093:     }
 1094: }
 1095: 
 1096: 
 1097: //
1041: // Dump contents of variable(s)1098: // Dump contents of variable(s)
1042: //1099: //
1043: function dump()1100: function dump()


punbb-1.2.2/upload/include/parser.php punbb-1.2.16/upload/include/parser.php
 45:     $b = array('[b]', '[i]', '[u]', '[/b]', '[/i]', '[/u]'); 45:     $b = array('[b]', '[i]', '[u]', '[/b]', '[/i]', '[/u]');
 46:     $text = str_replace($a, $b, $text); 46:     $text = str_replace($a, $b, $text);
 47:  47: 
 48:     // Do the more complex BBCodes (and strip excessive whitespace) 48:     // Do the more complex BBCodes (also strip excessive whitespace and useless quotes)
 49:     $a = array( '#\[url=(.*?)\]\s*#i', 49:     $a = array( '#\[url=("|\'|)(.*?)\\1\]\s*#i',
 50:                 '#\[url\]\s*#i', 50:                 '#\[url\]\s*#i',
 51:                 '#\s*\[/url\]#i', 51:                 '#\s*\[/url\]#i',
 52:                 '#\[email=(.*?)\]\s*#i', 52:                 '#\[email=("|\'|)(.*?)\\1\]\s*#i',
 53:                 '#\[email\]\s*#i', 53:                 '#\[email\]\s*#i',
 54:                 '#\s*\[/email\]#i', 54:                 '#\s*\[/email\]#i',
 55:                 '#\[img\]\s*(.*?)\s*\[/img\]#is', 55:                 '#\[img\]\s*(.*?)\s*\[/img\]#is',
 56:                 '#\[colou?r=(.*?)\](.*?)\[/colou?r\]#is'); 56:                 '#\[colou?r=("|\'|)(.*?)\\1\](.*?)\[/colou?r\]#is');
 57:  57: 
 58:     $b = array(    '[url=$1]', 58:     $b = array(    '[url=$2]',
 59:                 '[url]', 59:                 '[url]',
 60:                 '[/url]', 60:                 '[/url]',
 61:                 '[email=$1]', 61:                 '[email=$2]',
 62:                 '[email]', 62:                 '[email]',
 63:                 '[/email]', 63:                 '[/email]',
 64:                 '[img]$1[/img]', 64:                 '[img]$1[/img]',
 65:                 '[color=$1]$2[/color]'); 65:                 '[color=$2]$3[/color]');
 66:  66: 
 67:     if (!$is_signature) 67:     if (!$is_signature)
 68:     { 68:     {
 69:         // For non-signatures, we have to do the quote and code tags as well 69:         // For non-signatures, we have to do the quote and code tags as well
 70:         $a[] = '#\[quote=(&quot;|"|\'|)(.*)\\1\]\s*#i'; 70:         $a[] = '#\[quote=(&quot;|"|\'|)(.*?)\\1\]\s*#i';
 71:         $a[] = '#\[quote\]\s*#i'; 71:         $a[] = '#\[quote\]\s*#i';
 72:         $a[] = '#\s*\[/quote\]\s*#i'; 72:         $a[] = '#\s*\[/quote\]\s*#i';
 73:         $a[] = '#\[code\][\r\n]*(.*?)\s*\[/code\]\s*#is'; 73:         $a[] = '#\[code\][\r\n]*(.*?)\s*\[/code\]\s*#is';
182:         // We found a [code]182:         // We found a [code]
183:         else if ($c_start < min($c_end, $q_start, $q_end))183:         else if ($c_start < min($c_end, $q_start, $q_end))
184:         {184:         {
 185:             // Make sure there's a [/code] and that any new [code] doesn't occur before the end tag
185:             $tmp = strpos($text, '[/code]');186:             $tmp = strpos($text, '[/code]');
186:             if ($tmp === false)187:             $tmp2 = strpos(substr($text, $c_start+6), '[code]');
 188:             if ($tmp2 !== false)
 189:                 $tmp2 += $c_start+6;
 190: 
 191:             if ($tmp === false || ($tmp2 !== false && $tmp2 < $tmp))
187:             {192:             {
188:                 $error = $lang_common['BBCode error'].' '.$lang_common['BBCode error 2'];193:                 $error = $lang_common['BBCode error'].' '.$lang_common['BBCode error 2'];
189:                 return;194:                 return;
259: {264: {
260:     global $pun_user;265:     global $pun_user;
261: 266: 
262:     $full_url = str_replace(' ', '%20', $url);267:     $full_url = str_replace(array(' ', '\'', '`', '"'), array('%20', '', '', ''), $url);
263:     if (strpos($url, 'www.') === 0)            // If it starts with www, we add http://268:     if (strpos($url, 'www.') === 0)            // If it starts with www, we add http://
264:         $full_url = 'http://'.$full_url;269:         $full_url = 'http://'.$full_url;
265:     else if (strpos($url, 'ftp.') === 0)    // Else if it starts with ftp, we add ftp://270:     else if (strpos($url, 'ftp.') === 0)    // Else if it starts with ftp, we add ftp://
299: {304: {
300:     global $lang_common, $pun_user;305:     global $lang_common, $pun_user;
301: 306: 
 307:     if (strpos($text, 'quote') !== false)
 308:     {
 309:         $text = str_replace('[quote]', '</p><blockquote><div class="incqbox"><p>', $text);
 310:         $text = preg_replace('#\[quote=(&quot;|"|\'|)(.*)\\1\]#seU', '"</p><blockquote><div class=\"incqbox\"><h4>".str_replace(array(\'[\', \'\\"\'), array(\'&#91;\', \'"\'), \'$2\')." ".$lang_common[\'wrote\'].":</h4><p>"', $text);
 311:         $text = preg_replace('#\[\/quote\]\s*#', '</p></div></blockquote><p>', $text);
 312:     }
 313: 
302:     $pattern = array('#\[b\](.*?)\[/b\]#s',314:     $pattern = array('#\[b\](.*?)\[/b\]#s',
303:                      '#\[i\](.*?)\[/i\]#s',315:                      '#\[i\](.*?)\[/i\]#s',
304:                      '#\[u\](.*?)\[/u\]#s',316:                      '#\[u\](.*?)\[/u\]#s',
305:                      '#\[url\](.*?)\[/url\]#e',317:                      '#\[url\]([^\[]*?)\[/url\]#e',
306:                      '#\[url=(.*?)\](.*?)\[/url\]#e',318:                      '#\[url=([^\[]*?)\](.*?)\[/url\]#e',
307:                      '#\[email\](.*?)\[/email\]#',319:                      '#\[email\]([^\[]*?)\[/email\]#',
308:                      '#\[email=(.*?)\](.*?)\[/email\]#',320:                      '#\[email=([^\[]*?)\](.*?)\[/email\]#',
309:                      '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s');321:                      '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s');
310: 322: 
311:     $replace = array('<strong>$1</strong>',323:     $replace = array('<strong>$1</strong>',
320:     // This thing takes a while! :)332:     // This thing takes a while! :)
321:     $text = preg_replace($pattern, $replace, $text);333:     $text = preg_replace($pattern, $replace, $text);
322: 334: 
323:     if (strpos($text, 'quote') !== false) 
324:     { 
325:         $text = str_replace('[quote]', '</p><blockquote><div class="incqbox"><p>', $text); 
326:         $text = preg_replace('#\[quote=(&quot;|"|\'|)(.*)\\1\]#seU', '"</p><blockquote><div class=\"incqbox\"><h4>".str_replace(\'[\', \'&#91;\', \'$2\')." ".$lang_common[\'wrote\'].":</h4><p>"', $text); 
327:         $text = preg_replace('#\[\/quote\]\s*#', '</p></div></blockquote><p>', $text); 
328:     } 
329:  
330:     return $text;335:     return $text;
331: }336: }
332: 337: 


punbb-1.2.2/upload/include/search_idx.php punbb-1.2.16/upload/include/search_idx.php
 43:  43: 
 44:     if (empty($noise_match)) 44:     if (empty($noise_match))
 45:     { 45:     {
 46:         $noise_match =         array('quote', 'code', 'url', 'img', 'email', 'color', 'colour', '^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '~', '+', '[', ']', '{', '}', ':', '\\', '/', '=', '#', ';', '!', '*'); 46:         $noise_match =         array('[quote', '[code', '[url', '[img', '[email', '[color', '[colour', 'quote]', 'code]', 'url]', 'img]', 'email]', 'color]', 'colour]', '^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '~', '+', '[', ']', '{', '}', ':', '\\', '/', '=', '#', ';', '!', '*');
 47:         $noise_replace =    array('',      '',     '',    '',    '',      '',      '',       ' ', ' ', ' ', ' ', ' ', ' ', ' ', '',  '',   ' ', ' ', ' ', ' ', '',  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '' ,  ' ', ' ', ' ', ' ', ' ', ' '); 47:         $noise_replace =    array('',       '',      '',     '',     '',       '',       '',        '',       '',      '',     '',     '',       '',       '',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '',  '',   ' ', ' ', ' ', ' ', '',  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '' ,  ' ', ' ', ' ', ' ', ' ', ' ');
 48:  48: 
 49:         $stopwords = (array)@file(PUN_ROOT.'lang/'.$pun_user['language'].'/stopwords.txt'); 49:         $stopwords = (array)@file(PUN_ROOT.'lang/'.$pun_user['language'].'/stopwords.txt');
 50:         $stopwords = array_map('trim', $stopwords); 50:         $stopwords = array_map('trim', $stopwords);
 69:     { 69:     {
 70:         while (list($i, $word) = @each($words)) 70:         while (list($i, $word) = @each($words))
 71:         { 71:         {
  72:             $words[$i] = trim($word, '.');
 72:             $num_chars = pun_strlen($word); 73:             $num_chars = pun_strlen($word);
 73:  74: 
 74:             if (strrpos($word, '.') == ($num_chars-1)) 
 75:                 $words[$i] = substr($word, 0, -1); 
 76:  
 77:             if ($num_chars < 3 || $num_chars > 20 || in_array($word, $stopwords)) 75:             if ($num_chars < 3 || $num_chars > 20 || in_array($word, $stopwords))
 78:                 unset($words[$i]); 76:                 unset($words[$i]);
 79:         } 77:         }


punbb-1.2.2/upload/include/template/admin.tpl punbb-1.2.16/upload/include/template/admin.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
  6: <pun_head>  6: <pun_head>


punbb-1.2.2/upload/include/template/help.tpl punbb-1.2.16/upload/include/template/help.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
  6: <pun_head>  6: <pun_head>


punbb-1.2.2/upload/include/template/main.tpl punbb-1.2.16/upload/include/template/main.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
  6: <pun_head>  6: <pun_head>


punbb-1.2.2/upload/include/template/maintenance.tpl punbb-1.2.16/upload/include/template/maintenance.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
  6: <pun_head>  6: <pun_head>


punbb-1.2.2/upload/include/template/redirect.tpl punbb-1.2.16/upload/include/template/redirect.tpl
  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2:   2: 
  3: <html dir="<pun_content_direction>">  3: <html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>">
  4: <head>  4: <head>
  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />  5: <meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
  6: <pun_head>  6: <pun_head>


punbb-1.2.2/upload/install.php punbb-1.2.16/upload/install.php
 24:  24: 
 25:  25: 
 26: // The PunBB version this script installs 26: // The PunBB version this script installs
 27: $punbb_version = '1.2.2'; 27: $punbb_version = '1.2.16';
 28:  28: 
 29:  29: 
 30: define('PUN_ROOT', './'); 30: define('PUN_ROOT', './');
165:                 <fieldset>165:                 <fieldset>
166:                     <legend>Enter then name of your database</legend>166:                     <legend>Enter then name of your database</legend>
167:                     <div class="infldset">167:                     <div class="infldset">
168:                         <p>The name of the database that PunBB will be installed into. The database must exist. For SQLite, this is the relative path to the database file. If it doesn't exists, PunBB will attempt to create it.</p>168:                         <p>The name of the database that PunBB will be installed into. The database must exist. For SQLite, this is the relative path to the database file. If the SQLite database file does not exist, PunBB will attempt to create it.</p>
169:                         <label for="req_db_name"><strong>Database name</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label>169:                         <label for="req_db_name"><strong>Database name</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label>
170:                     </div>170:                     </div>
171:                 </fieldset>171:                 </fieldset>
324:     if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))324:     if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
325:         error('Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.');325:         error('Usernames may not contain any of the text formatting tags (BBCode) that the forum uses. Please go back and correct.');
326: 326: 
327:     if (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', $email))327:     if (strlen($email) > 50 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email))
328:         error('The administrator e-mail address you entered is invalid. Please go back and correct.');328:         error('The administrator e-mail address you entered is invalid. Please go back and correct.');
329: 329: 
330: 330: 
346:         case 'sqlite':346:         case 'sqlite':
347:             require PUN_ROOT.'include/dblayer/sqlite.php';347:             require PUN_ROOT.'include/dblayer/sqlite.php';
348:             break;348:             break;
 349: 
 350:         default:
 351:             error('\''.$db_type.'\' is not a valid database type.');
349:     }352:     }
350: 353: 
351:     // Create the database object (and connect/select db)354:     // Create the database object (and connect/select db)
525:             break;528:             break;
526:     }529:     }
527: 530: 
528:     $db->query($sql) or error('Unable to create table '.$db_prefix.'online. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());531:     $db->query($sql) or error('Unable to create table '.$db_prefix.'config. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());
529: 532: 
530: 533: 
531: 534: 
754:                     poster_id INT(10) UNSIGNED NOT NULL DEFAULT 1,757:                     poster_id INT(10) UNSIGNED NOT NULL DEFAULT 1,
755:                     poster_ip VARCHAR(15),758:                     poster_ip VARCHAR(15),
756:                     poster_email VARCHAR(50),759:                     poster_email VARCHAR(50),
757:                     message TEXT NOT NULL DEFAULT '',760:                     message TEXT,
758:                     hide_smilies TINYINT(1) NOT NULL DEFAULT 0,761:                     hide_smilies TINYINT(1) NOT NULL DEFAULT 0,
759:                     posted INT(10) UNSIGNED NOT NULL DEFAULT 0,762:                     posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
760:                     edited INT(10) UNSIGNED,763:                     edited INT(10) UNSIGNED,
771:                     poster_id INT NOT NULL DEFAULT 1,774:                     poster_id INT NOT NULL DEFAULT 1,
772:                     poster_ip VARCHAR(15),775:                     poster_ip VARCHAR(15),
773:                     poster_email VARCHAR(50),776:                     poster_email VARCHAR(50),
774:                     message TEXT NOT NULL DEFAULT '',777:                     message TEXT,
775:                     hide_smilies SMALLINT NOT NULL DEFAULT 0,778:                     hide_smilies SMALLINT NOT NULL DEFAULT 0,
776:                     posted INT NOT NULL DEFAULT 0,779:                     posted INT NOT NULL DEFAULT 0,
777:                     edited INT,780:                     edited INT,
788:                     poster_id INTEGER NOT NULL DEFAULT 1,791:                     poster_id INTEGER NOT NULL DEFAULT 1,
789:                     poster_ip VARCHAR(15),792:                     poster_ip VARCHAR(15),
790:                     poster_email VARCHAR(50),793:                     poster_email VARCHAR(50),
791:                     message TEXT NOT NULL DEFAULT '',794:                     message TEXT,
792:                     hide_smilies INTEGER NOT NULL DEFAULT 0,795:                     hide_smilies INTEGER NOT NULL DEFAULT 0,
793:                     posted INTEGER NOT NULL DEFAULT 0,796:                     posted INTEGER NOT NULL DEFAULT 0,
794:                     edited INTEGER,797:                     edited INTEGER,
849:                     forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0,852:                     forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
850:                     reported_by INT(10) UNSIGNED NOT NULL DEFAULT 0,853:                     reported_by INT(10) UNSIGNED NOT NULL DEFAULT 0,
851:                     created INT(10) UNSIGNED NOT NULL DEFAULT 0,854:                     created INT(10) UNSIGNED NOT NULL DEFAULT 0,
852:                     message TEXT NOT NULL DEFAULT '',855:                     message TEXT,
853:                     zapped INT(10) UNSIGNED,856:                     zapped INT(10) UNSIGNED,
854:                     zapped_by INT(10) UNSIGNED,857:                     zapped_by INT(10) UNSIGNED,
855:                     PRIMARY KEY (id)858:                     PRIMARY KEY (id)
864:                     forum_id INT NOT NULL DEFAULT 0,867:                     forum_id INT NOT NULL DEFAULT 0,
865:                     reported_by INT NOT NULL DEFAULT 0,868:                     reported_by INT NOT NULL DEFAULT 0,
866:                     created INT NOT NULL DEFAULT 0,869:                     created INT NOT NULL DEFAULT 0,
867:                     message TEXT NOT NULL DEFAULT '',870:                     message TEXT,
868:                     zapped INT,871:                     zapped INT,
869:                     zapped_by INT,872:                     zapped_by INT,
870:                     PRIMARY KEY (id)873:                     PRIMARY KEY (id)
879:                     forum_id INTEGER NOT NULL DEFAULT 0,882:                     forum_id INTEGER NOT NULL DEFAULT 0,
880:                     reported_by INTEGER NOT NULL DEFAULT 0,883:                     reported_by INTEGER NOT NULL DEFAULT 0,
881:                     created INTEGER NOT NULL DEFAULT 0,884:                     created INTEGER NOT NULL DEFAULT 0,
882:                     message TEXT NOT NULL DEFAULT '',885:                     message TEXT,
883:                     zapped INTEGER,886:                     zapped INTEGER,
884:                     zapped_by INTEGER,887:                     zapped_by INTEGER,
885:                     PRIMARY KEY (id)888:                     PRIMARY KEY (id)
898:             $sql = 'CREATE TABLE '.$db_prefix."search_cache (901:             $sql = 'CREATE TABLE '.$db_prefix."search_cache (
899:                     id INT(10) UNSIGNED NOT NULL DEFAULT 0,902:                     id INT(10) UNSIGNED NOT NULL DEFAULT 0,
900:                     ident VARCHAR(200) NOT NULL DEFAULT '',903:                     ident VARCHAR(200) NOT NULL DEFAULT '',
901:                     search_data TEXT NOT NULL DEFAULT '',904:                     search_data TEXT,
902:                     PRIMARY KEY (id)905:                     PRIMARY KEY (id)
903:                     ) TYPE=MyISAM;";906:                     ) TYPE=MyISAM;";
904:             break;907:             break;
907:             $sql = 'CREATE TABLE '.$db_prefix."search_cache (910:             $sql = 'CREATE TABLE '.$db_prefix."search_cache (
908:                     id INT NOT NULL DEFAULT 0,911:                     id INT NOT NULL DEFAULT 0,
909:                     ident VARCHAR(200) NOT NULL DEFAULT '',912:                     ident VARCHAR(200) NOT NULL DEFAULT '',
910:                     search_data TEXT NOT NULL DEFAULT '',913:                     search_data TEXT,
911:                     PRIMARY KEY (id)914:                     PRIMARY KEY (id)
912:                     )";915:                     )";
913:             break;916:             break;
916:             $sql = 'CREATE TABLE '.$db_prefix."search_cache (919:             $sql = 'CREATE TABLE '.$db_prefix."search_cache (
917:                     id INTEGER NOT NULL DEFAULT 0,920:                     id INTEGER NOT NULL DEFAULT 0,
918:                     ident VARCHAR(200) NOT NULL DEFAULT '',921:                     ident VARCHAR(200) NOT NULL DEFAULT '',
919:                     search_data TEXT NOT NULL DEFAULT '',922:                     search_data TEXT,
920:                     PRIMARY KEY (id)923:                     PRIMARY KEY (id)
921:                     )";924:                     )";
922:             break;925:             break;
1231:         case 'mysql':1234:         case 'mysql':
1232:         case 'mysqli':1235:         case 'mysqli':
1233:             // We use MySQL's ALTER TABLE ... ADD INDEX syntax instead of CREATE INDEX to avoid problems with users lacking the INDEX privilege1236:             // We use MySQL's ALTER TABLE ... ADD INDEX syntax instead of CREATE INDEX to avoid problems with users lacking the INDEX privilege
 1237:             $queries[] = 'ALTER TABLE '.$db_prefix.'online ADD UNIQUE INDEX '.$db_prefix.'online_user_id_ident_idx(user_id,ident)';
1234:             $queries[] = 'ALTER TABLE '.$db_prefix.'online ADD INDEX '.$db_prefix.'online_user_id_idx(user_id)';1238:             $queries[] = 'ALTER TABLE '.$db_prefix.'online ADD INDEX '.$db_prefix.'online_user_id_idx(user_id)';
1235:             $queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_topic_id_idx(topic_id)';1239:             $queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_topic_id_idx(topic_id)';
1236:             $queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_multi_idx(poster_id, topic_id)';1240:             $queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_multi_idx(poster_id, topic_id)';
1420:         <div class="fakeform">1424:         <div class="fakeform">
1421:             <div class="inform">1425:             <div class="inform">
1422:                 <div class="forminfo">1426:                 <div class="forminfo">
1423:                     <p>To finalize the installation all you need to do is to <strong>copy and paste the text in the text box below into a file called config.php and then upload this file to the root directory of your PunBB installation</strong>. Make sure there are no linebreaks or spaces before &lt;?php and after ?&gt; in the file. You can later edit config.php if you reconfigure your setup (e.g. change the database password or ).</p>1427:                     <p>To finalize the installation all you need to do is to <strong>copy and paste the text in the text box below into a file called config.php and then upload this file to the root directory of your PunBB installation</strong>. Make sure there are no linebreaks or spaces before &lt;?php. You can later edit config.php if you reconfigure your setup (e.g. change the database password or ).</p>
1424: <?php if ($alerts != ''): ?>                    <?php echo $alerts."\n" ?>1428: <?php if ($alerts != ''): ?>                    <?php echo $alerts."\n" ?>
1425: <?php endif; ?>                </div>1429: <?php endif; ?>                </div>
1426:                 <fieldset>1430:                 <fieldset>


punbb-1.2.2/upload/login.php punbb-1.2.16/upload/login.php
 40:     $form_username = trim($_POST['req_username']); 40:     $form_username = trim($_POST['req_username']);
 41:     $form_password = trim($_POST['req_password']); 41:     $form_password = trim($_POST['req_password']);
 42:  42: 
 43:     $result = $db->query('SELECT id, group_id, password, save_pass FROM '.$db->prefix.'users WHERE username=\''.$db->escape($form_username).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 43:     $username_sql = ($db_type == 'mysql' || $db_type == 'mysqli') ? 'username=\''.$db->escape($form_username).'\'' : 'LOWER(username)=LOWER(\''.$db->escape($form_username).'\')';
  44: 
  45:     $result = $db->query('SELECT id, group_id, password, save_pass FROM '.$db->prefix.'users WHERE '.$username_sql) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
 44:     list($user_id, $group_id, $db_password_hash, $save_pass) = $db->fetch_row($result); 46:     list($user_id, $group_id, $db_password_hash, $save_pass) = $db->fetch_row($result);
 45:  47: 
 46:     $authorized = false; 48:     $authorized = false;
 76:     $expire = ($save_pass == '1') ? time() + 31536000 : 0; 78:     $expire = ($save_pass == '1') ? time() + 31536000 : 0;
 77:     pun_setcookie($user_id, $form_password_hash, $expire); 79:     pun_setcookie($user_id, $form_password_hash, $expire);
 78:  80: 
 79:     redirect($_POST['redirect_url'], $lang_login['Login redirect']); 81:     redirect(htmlspecialchars($_POST['redirect_url']), $lang_login['Login redirect']);
 80: } 82: }
 81:  83: 
 82:  84: 
151:             message($lang_login['Forget mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');153:             message($lang_login['Forget mail'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
152:         }154:         }
153:         else155:         else
154:             message($lang_login['No e-mail match'].' '.$email.'.');156:             message($lang_login['No e-mail match'].' '.htmlspecialchars($email).'.');
155:     }157:     }
156: 158: 
157: 159: 
189:     header('Location: index.php');191:     header('Location: index.php');
190: 192: 
191: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)193: // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
192: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'index.php';194: $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';
193: 195: 
194: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Login'];196: $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Login'];
195: $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);197: $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);


punbb-1.2.2/upload/misc.php punbb-1.2.16/upload/misc.php
 76:         message($lang_common['No permission']); 76:         message($lang_common['No permission']);
 77:  77: 
 78:     $recipient_id = intval($_GET['email']); 78:     $recipient_id = intval($_GET['email']);
 79:     if ($recipient_id < 1) 79:     if ($recipient_id < 2)
 80:         message($lang_common['Bad request']); 80:         message($lang_common['Bad request']);
 81:  81: 
 82:     $result = $db->query('SELECT username, email, email_setting FROM '.$db->prefix.'users WHERE id='.$recipient_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 82:     $result = $db->query('SELECT username, email, email_setting FROM '.$db->prefix.'users WHERE id='.$recipient_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
118: 118: 
119:         require_once PUN_ROOT.'include/email.php';119:         require_once PUN_ROOT.'include/email.php';
120: 120: 
121:         pun_mail($recipient_email, $mail_subject, $mail_message, $pun_user['username'].' <'.$pun_user['email'].'>');121:         pun_mail($recipient_email, $mail_subject, $mail_message, '"'.str_replace('"', '', $pun_user['username']).'" <'.$pun_user['email'].'>');
122: 122: 
123:         redirect($_POST['redirect_url'], $lang_misc['E-mail sent redirect']);123:         redirect(htmlspecialchars($_POST['redirect_url']), $lang_misc['E-mail sent redirect']);
124:     }124:     }
125: 125: 
126: 126: 
127:     // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to the users profile after the e-mail is sent)127:     // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to the users profile after the e-mail is sent)
128:     $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'index.php';128:     $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';
129: 129: 
130:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Send e-mail to'].' '.pun_htmlspecialchars($recipient);130:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_misc['Send e-mail to'].' '.pun_htmlspecialchars($recipient);
131:     $required_fields = array('req_subject' => $lang_misc['E-mail subject'], 'req_message' => $lang_misc['E-mail message']);131:     $required_fields = array('req_subject' => $lang_misc['E-mail subject'], 'req_message' => $lang_misc['E-mail message']);
245: 245: 
246: else if (isset($_GET['subscribe']))246: else if (isset($_GET['subscribe']))
247: {247: {
248:     if ($pun_user['is_guest'])248:     if ($pun_user['is_guest'] || $pun_config['o_subscriptions'] != '1')
249:         message($lang_common['No permission']);249:         message($lang_common['No permission']);
250: 250: 
251:     $topic_id = intval($_GET['subscribe']);251:     $topic_id = intval($_GET['subscribe']);
264: 264: 
265: else if (isset($_GET['unsubscribe']))265: else if (isset($_GET['unsubscribe']))
266: {266: {
267:     if ($pun_user['is_guest'])267:     if ($pun_user['is_guest'] || $pun_config['o_subscriptions'] != '1')
268:         message($lang_common['No permission']);268:         message($lang_common['No permission']);
269: 269: 
270:     $topic_id = intval($_GET['unsubscribe']);270:     $topic_id = intval($_GET['unsubscribe']);


punbb-1.2.2/upload/moderate.php punbb-1.2.16/upload/moderate.php
 35:         message($lang_common['No permission']); 35:         message($lang_common['No permission']);
 36:  36: 
 37:     // Is get_host an IP address or a post ID? 37:     // Is get_host an IP address or a post ID?
 38:     if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_GET['get_host'])) 38:     if (@preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_GET['get_host']))
 39:         $ip = $_GET['get_host']; 39:         $ip = $_GET['get_host'];
 40:     else 40:     else
 41:     { 41:     {
 50:         $ip = $db->result($result); 50:         $ip = $db->result($result);
 51:     } 51:     }
 52:  52: 
 53:     message('The IP address is: '.$ip.'<br />The host name is: '.gethostbyaddr($ip).'<br /><br /><a href="admin_users.php?show_users='.$ip.'">Show more users for this IP</a>'); 53:     message('The IP address is: '.$ip.'<br />The host name is: '.@gethostbyaddr($ip).'<br /><br /><a href="admin_users.php?show_users='.$ip.'">Show more users for this IP</a>');
 54: } 54: }
 55:  55: 
 56:  56: 
 98:         { 98:         {
 99:             confirm_referrer('moderate.php'); 99:             confirm_referrer('moderate.php');
100: 100: 
101:             if (preg_match('/[^0-9,]/', $posts))101:             if (@preg_match('/[^0-9,]/', $posts))
 102:                 message($lang_common['Bad request']);
 103: 
 104:             // Verify that the post IDs are valid
 105:             $result = $db->query('SELECT 1 FROM '.$db->prefix.'posts WHERE id IN('.$posts.') AND topic_id='.$tid) or error('Unable to check posts', __FILE__, __LINE__, $db->error());
 106: 
 107:             if ($db->num_rows($result) != substr_count($posts, ',') + 1)
102:                 message($lang_common['Bad request']);108:                 message($lang_common['Bad request']);
103: 109: 
104:             // Delete the posts110:             // Delete the posts
281:     {287:     {
282:         confirm_referrer('moderate.php');288:         confirm_referrer('moderate.php');
283: 289: 
284:         if (preg_match('/[^0-9,]/', $_POST['topics']))290:         if (@preg_match('/[^0-9,]/', $_POST['topics']))
285:             message($lang_common['Bad request']);291:             message($lang_common['Bad request']);
286: 292: 
287:         $topics = explode(',', $_POST['topics']);293:         $topics = explode(',', $_POST['topics']);
288:         $move_to_forum = intval($_POST['move_to_forum']);294:         $move_to_forum = isset($_POST['move_to_forum']) ? intval($_POST['move_to_forum']) : 0;
289:         if (empty($topics) || $move_to_forum < 1)295:         if (empty($topics) || $move_to_forum < 1)
290:             message($lang_common['Bad request']);296:             message($lang_common['Bad request']);
291: 297: 
 298:         // Verify that the topic IDs are valid
 299:         $result = $db->query('SELECT 1 FROM '.$db->prefix.'topics WHERE id IN('.implode(',',$topics).') AND forum_id='.$fid) or error('Unable to check topics', __FILE__, __LINE__, $db->error());
 300: 
 301:         if ($db->num_rows($result) != count($topics))
 302:             message($lang_common['Bad request']);
 303: 
292:         // Delete any redirect topics if there are any (only if we moved/copied the topic back to where it where it was once moved from)304:         // Delete any redirect topics if there are any (only if we moved/copied the topic back to where it where it was once moved from)
293:         $db->query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to IN('.implode(',',$topics).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());305:         $db->query('DELETE FROM '.$db->prefix.'topics WHERE forum_id='.$move_to_forum.' AND moved_to IN('.implode(',',$topics).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
294: 306: 
351:                         <br /><select name="move_to_forum">363:                         <br /><select name="move_to_forum">
352: <?php364: <?php
353: 365: 
354:     $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());366:     $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
355: 367: 
356:     $cur_category = 0;368:     $cur_category = 0;
357:     while ($cur_forum = $db->fetch_assoc($result))369:     while ($cur_forum = $db->fetch_assoc($result))
400:     {412:     {
401:         confirm_referrer('moderate.php');413:         confirm_referrer('moderate.php');
402: 414: 
403:         if (preg_match('/[^0-9,]/', $topics))415:         if (@preg_match('/[^0-9,]/', $topics))
404:             message($lang_common['Bad request']);416:             message($lang_common['Bad request']);
405: 417: 
406:         require PUN_ROOT.'include/search_idx.php';418:         require PUN_ROOT.'include/search_idx.php';
407: 419: 
 420:         // Verify that the topic IDs are valid
 421:         $result = $db->query('SELECT 1 FROM '.$db->prefix.'topics WHERE id IN('.$topics.') AND forum_id='.$fid) or error('Unable to check topics', __FILE__, __LINE__, $db->error());
 422: 
 423:         if ($db->num_rows($result) != substr_count($topics, ',') + 1)
 424:             message($lang_common['Bad request']);
 425: 
408:         // Delete the topics and any redirect topics426:         // Delete the topics and any redirect topics
409:         $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topics.') OR moved_to IN('.$topics.')') or error('Unable to delete topic', __FILE__, __LINE__, $db->error());427:         $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topics.') OR moved_to IN('.$topics.')') or error('Unable to delete topic', __FILE__, __LINE__, $db->error());
410: 428: 
472:         if (empty($topics))490:         if (empty($topics))
473:             message($lang_misc['No topics selected']);491:             message($lang_misc['No topics selected']);
474: 492: 
475:         $db->query('UPDATE '.$db->prefix.'topics SET closed='.$action.' WHERE id IN('.implode(',', array_keys($topics)).')') or error('Unable to close topics', __FILE__, __LINE__, $db->error());493:         $db->query('UPDATE '.$db->prefix.'topics SET closed='.$action.' WHERE id IN('.implode(',', $topics).') AND forum_id='.$fid) or error('Unable to close topics', __FILE__, __LINE__, $db->error());
476: 494: 
477:         $redirect_msg = ($action) ? $lang_misc['Close topics redirect'] : $lang_misc['Open topics redirect'];495:         $redirect_msg = ($action) ? $lang_misc['Close topics redirect'] : $lang_misc['Open topics redirect'];
478:         redirect('moderate.php?fid='.$fid, $redirect_msg);496:         redirect('moderate.php?fid='.$fid, $redirect_msg);
486:         if ($topic_id < 1)504:         if ($topic_id < 1)
487:             message($lang_common['Bad request']);505:             message($lang_common['Bad request']);
488: 506: 
489:         $db->query('UPDATE '.$db->prefix.'topics SET closed='.$action.' WHERE id='.$topic_id) or error('Unable to close topic', __FILE__, __LINE__, $db->error());507:         $db->query('UPDATE '.$db->prefix.'topics SET closed='.$action.' WHERE id='.$topic_id.' AND forum_id='.$fid) or error('Unable to close topic', __FILE__, __LINE__, $db->error());
490: 508: 
491:         $redirect_msg = ($action) ? $lang_misc['Close topic redirect'] : $lang_misc['Open topic redirect'];509:         $redirect_msg = ($action) ? $lang_misc['Close topic redirect'] : $lang_misc['Open topic redirect'];
492:         redirect('viewtopic.php?id='.$topic_id, $redirect_msg);510:         redirect('viewtopic.php?id='.$topic_id, $redirect_msg);
503:     if ($stick < 1)521:     if ($stick < 1)
504:         message($lang_common['Bad request']);522:         message($lang_common['Bad request']);
505: 523: 
506:     $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'1\' WHERE id='.$stick) or error('Unable to stick topic', __FILE__, __LINE__, $db->error());524:     $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'1\' WHERE id='.$stick.' AND forum_id='.$fid) or error('Unable to stick topic', __FILE__, __LINE__, $db->error());
507: 525: 
508:     redirect('viewtopic.php?id='.$stick, $lang_misc['Stick topic redirect']);526:     redirect('viewtopic.php?id='.$stick, $lang_misc['Stick topic redirect']);
509: }527: }
518:     if ($unstick < 1)536:     if ($unstick < 1)
519:         message($lang_common['Bad request']);537:         message($lang_common['Bad request']);
520: 538: 
521:     $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'0\' WHERE id='.$unstick) or error('Unable to unstick topic', __FILE__, __LINE__, $db->error());539:     $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'0\' WHERE id='.$unstick.' AND forum_id='.$fid) or error('Unable to unstick topic', __FILE__, __LINE__, $db->error());
522: 540: 
523:     redirect('viewtopic.php?id='.$unstick, $lang_misc['Unstick topic redirect']);541:     redirect('viewtopic.php?id='.$unstick, $lang_misc['Unstick topic redirect']);
524: }542: }


punbb-1.2.2/upload/post.php punbb-1.2.16/upload/post.php
 33:  33: 
 34: $tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0; 34: $tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
 35: $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0; 35: $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
 36: if ($tid < 1 && $fid < 1) 36: if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0)
 37:     message($lang_common['Bad request']); 37:     message($lang_common['Bad request']);
 38:  38: 
 39: // Fetch some info about the topic and/or the forum 39: // Fetch some info about the topic and/or the forum
128:             $errors[] = $lang_register['Username censor'];128:             $errors[] = $lang_register['Username censor'];
129: 129: 
130:         // Check that the username (or a too similar username) is not already registered130:         // Check that the username (or a too similar username) is not already registered
131:         $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());131:         $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE (username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\') AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
132:         if ($db->num_rows($result))132:         if ($db->num_rows($result))
133:         {133:         {
134:             $busy = $db->result($result);134:             $busy = $db->result($result);
207: 207: 
208:             update_forum($cur_posting['id']);208:             update_forum($cur_posting['id']);
209: 209: 
210: 210:             // Should we send out notifications?
211:             // Get the post time for the previous post in this topic211:             if ($pun_config['o_subscriptions'] == '1')
212:             $result = $db->query('SELECT posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 
213:             $previous_post_time = $db->result($result); 
214:  
215:             // Get any subscribed users that should be notified (banned users are excluded) 
216:             $result = $db->query('SELECT u.id, u.email, u.notify_with_post, u.language FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'subscriptions AS s ON u.id=s.user_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id='.$cur_posting['id'].' AND fp.group_id=u.group_id) LEFT JOIN '.$db->prefix.'online AS o ON u.id=o.user_id LEFT JOIN '.$db->prefix.'bans AS b ON u.username=b.username WHERE b.username IS NULL AND COALESCE(o.logged, u.last_visit)>'.$previous_post_time.' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.topic_id='.$tid.' AND u.id!='.intval($pun_user['id'])) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error()); 
217:             if ($db->num_rows($result)) 
218:             {212:             {
219:                 require_once PUN_ROOT.'include/email.php';213:                 // Get the post time for the previous post in this topic
 214:                 $result = $db->query('SELECT posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
 215:                 $previous_post_time = $db->result($result);
 216: 
 217:                 // Get any subscribed users that should be notified (banned users are excluded)
 218:                 $result = $db->query('SELECT u.id, u.email, u.notify_with_post, u.language FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'subscriptions AS s ON u.id=s.user_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id='.$cur_posting['id'].' AND fp.group_id=u.group_id) LEFT JOIN '.$db->prefix.'online AS o ON u.id=o.user_id LEFT JOIN '.$db->prefix.'bans AS b ON u.username=b.username WHERE b.username IS NULL AND COALESCE(o.logged, u.last_visit)>'.$previous_post_time.' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.topic_id='.$tid.' AND u.id!='.intval($pun_user['id'])) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
 219:                 if ($db->num_rows($result))
 220:                 {
 221:                     require_once PUN_ROOT.'include/email.php';
220: 222: 
221:                 $notification_emails = array();223:                     $notification_emails = array();
222: 224: 
223:                 // Loop through subscribed users and send e-mails225:                     // Loop through subscribed users and send e-mails
224:                 while ($cur_subscriber = $db->fetch_assoc($result))226:                     while ($cur_subscriber = $db->fetch_assoc($result))
225:                 { 
226:                     // Is the subscription e-mail for $cur_subscriber['language'] cached or not? 
227:                     if (!isset($notification_emails[$cur_subscriber['language']])) 
228:                     {227:                     {
229:                         if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'))228:                         // Is the subscription e-mail for $cur_subscriber['language'] cached or not?
 229:                         if (!isset($notification_emails[$cur_subscriber['language']]))
230:                         {230:                         {
231:                             // Load the "new reply" template231:                             if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'))
232:                             $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'));232:                             {
233: 233:                                 // Load the "new reply" template
234:                             // Load the "new reply full" template (with post included)234:                                 $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'));
235:                             $mail_tpl_full = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply_full.tpl'));235: 
236: 236:                                 // Load the "new reply full" template (with post included)
237:                             // The first row contains the subject (it also starts with "Subject:")237:                                 $mail_tpl_full = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply_full.tpl'));
238:                             $first_crlf = strpos($mail_tpl, "\n");238: 
239:                             $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));239:                                 // The first row contains the subject (it also starts with "Subject:")
240:                             $mail_message = trim(substr($mail_tpl, $first_crlf));240:                                 $first_crlf = strpos($mail_tpl, "\n");
241: 241:                                 $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
242:                             $first_crlf = strpos($mail_tpl_full, "\n");242:                                 $mail_message = trim(substr($mail_tpl, $first_crlf));
243:                             $mail_subject_full = trim(substr($mail_tpl_full, 8, $first_crlf-8));243: 
244:                             $mail_message_full = trim(substr($mail_tpl_full, $first_crlf));244:                                 $first_crlf = strpos($mail_tpl_full, "\n");
245: 245:                                 $mail_subject_full = trim(substr($mail_tpl_full, 8, $first_crlf-8));
246:                             $mail_subject = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject);246:                                 $mail_message_full = trim(substr($mail_tpl_full, $first_crlf));
247:                             $mail_message = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message);247: 
248:                             $mail_message = str_replace('<replier>', $username, $mail_message);248:                                 $mail_subject = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject);
249:                             $mail_message = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message);249:                                 $mail_message = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message);
250:                             $mail_message = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message);250:                                 $mail_message = str_replace('<replier>', $username, $mail_message);
251:                             $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);251:                                 $mail_message = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message);
252: 252:                                 $mail_message = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message);
253:                             $mail_subject_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject_full);253:                                 $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);
254:                             $mail_message_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message_full);254: 
255:                             $mail_message_full = str_replace('<replier>', $username, $mail_message_full);255:                                 $mail_subject_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject_full);
256:                             $mail_message_full = str_replace('<message>', $message, $mail_message_full);256:                                 $mail_message_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message_full);
257:                             $mail_message_full = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message_full);257:                                 $mail_message_full = str_replace('<replier>', $username, $mail_message_full);
258:                             $mail_message_full = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message_full);258:                                 $mail_message_full = str_replace('<message>', $message, $mail_message_full);
259:                             $mail_message_full = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message_full);259:                                 $mail_message_full = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message_full);
260: 260:                                 $mail_message_full = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message_full);
261:                             $notification_emails[$cur_subscriber['language']][0] = $mail_subject;261:                                 $mail_message_full = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message_full);
262:                             $notification_emails[$cur_subscriber['language']][1] = $mail_message;262: 
263:                             $notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;263:                                 $notification_emails[$cur_subscriber['language']][0] = $mail_subject;
264:                             $notification_emails[$cur_subscriber['language']][3] = $mail_message_full;264:                                 $notification_emails[$cur_subscriber['language']][1] = $mail_message;
 265:                                 $notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;
 266:                                 $notification_emails[$cur_subscriber['language']][3] = $mail_message_full;
265: 267: 
266:                             $mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;268:                                 $mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;
 269:                             }
267:                         }270:                         }
268:                     } 
269: 271: 
270:                     // We have to double check here because the templates could be missing272:                         // We have to double check here because the templates could be missing
271:                     if (isset($notification_emails[$cur_subscriber['language']]))273:                         if (isset($notification_emails[$cur_subscriber['language']]))
272:                     {274:                         {
273:                         if ($cur_subscriber['notify_with_post'] == '0')275:                             if ($cur_subscriber['notify_with_post'] == '0')
274:                             pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);276:                                 pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);
275:                         else277:                             else
276:                             pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);278:                                 pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);
 279:                         }
277:                     }280:                     }
278:                 }281:                 }
279:             }282:             }
335:         if ($qid < 1)338:         if ($qid < 1)
336:             message($lang_common['Bad request']);339:             message($lang_common['Bad request']);
337: 340: 
338:         $result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error());341:         $result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid.' AND topic_id='.$tid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error());
339:         if (!$db->num_rows($result))342:         if (!$db->num_rows($result))
340:             message($lang_common['Bad request']);343:             message($lang_common['Bad request']);
341: 344: 
437: else if (isset($_POST['preview']))440: else if (isset($_POST['preview']))
438: {441: {
439:     require_once PUN_ROOT.'include/parser.php';442:     require_once PUN_ROOT.'include/parser.php';
440:     $message = parse_message($message, $hide_smilies);443:     $preview_message = parse_message($message, $hide_smilies);
441: 444: 
442: ?>445: ?>
443: <div id="postpreview" class="blockpost">446: <div id="postpreview" class="blockpost">
446:         <div class="inbox">449:         <div class="inbox">
447:             <div class="postright">450:             <div class="postright">
448:                 <div class="postmsg">451:                 <div class="postmsg">
449:                     <?php echo $message."\n" ?>452:                     <?php echo $preview_message."\n" ?>
450:                 </div>453:                 </div>
451:             </div>454:             </div>
452:         </div>455:         </div>
488: if ($fid): ?>491: if ($fid): ?>
489:                         <label><strong><?php echo $lang_common['Subject'] ?></strong><br /><input class="longinput" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo pun_htmlspecialchars($subject); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /></label>492:                         <label><strong><?php echo $lang_common['Subject'] ?></strong><br /><input class="longinput" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo pun_htmlspecialchars($subject); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
490: <?php endif; ?>                        <label><strong><?php echo $lang_common['Message'] ?></strong><br />493: <?php endif; ?>                        <label><strong><?php echo $lang_common['Message'] ?></strong><br />
491:                         <textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars(trim($_POST['req_message'])) : (isset($quote) ? $quote : ''); ?></textarea><br /></label>494:                         <textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea><br /></label>
492:                         <ul class="bblinks">495:                         <ul class="bblinks">
493:                             <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>496:                             <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
494:                             <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>497:                             <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>


punbb-1.2.2/upload/profile.php punbb-1.2.16/upload/profile.php
 59:         $result = $db->query('SELECT activate_string, activate_key FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch new password', __FILE__, __LINE__, $db->error()); 59:         $result = $db->query('SELECT activate_string, activate_key FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch new password', __FILE__, __LINE__, $db->error());
 60:         list($new_password_hash, $new_password_key) = $db->fetch_row($result); 60:         list($new_password_hash, $new_password_key) = $db->fetch_row($result);
 61:  61: 
 62:         if ($key != $new_password_key) 62:         if ($key == '' || $key != $new_password_key)
 63:             message($lang_profile['Pass key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); 63:             message($lang_profile['Pass key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
 64:         else 64:         else
 65:         { 65:         {
 87:  87: 
 88:     if (isset($_POST['form_sent'])) 88:     if (isset($_POST['form_sent']))
 89:     { 89:     {
  90:         if ($pun_user['g_id'] < PUN_GUEST)
  91:             confirm_referrer('profile.php');
  92: 
 90:         $old_password = isset($_POST['req_old_password']) ? trim($_POST['req_old_password']) : ''; 93:         $old_password = isset($_POST['req_old_password']) ? trim($_POST['req_old_password']) : '';
 91:         $new_password1 = trim($_POST['req_new_password1']); 94:         $new_password1 = trim($_POST['req_new_password1']);
 92:         $new_password2 = trim($_POST['req_new_password2']); 95:         $new_password2 = trim($_POST['req_new_password2']);
190:         $result = $db->query('SELECT activate_string, activate_key FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch activation data', __FILE__, __LINE__, $db->error());193:         $result = $db->query('SELECT activate_string, activate_key FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch activation data', __FILE__, __LINE__, $db->error());
191:         list($new_email, $new_email_key) = $db->fetch_row($result);194:         list($new_email, $new_email_key) = $db->fetch_row($result);
192: 195: 
193:         if ($key != $new_email_key)196:         if ($key == '' || $key != $new_email_key)
194:             message($lang_profile['E-mail key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');197:             message($lang_profile['E-mail key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
195:         else198:         else
196:         {199:         {
197:             $db->query('UPDATE '.$db->prefix.'users SET email=\''.$new_email.'\', activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Unable to update e-mail address', __FILE__, __LINE__, $db->error());200:             $db->query('UPDATE '.$db->prefix.'users SET email=activate_string, activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Unable to update e-mail address', __FILE__, __LINE__, $db->error());
198: 201: 
199:             message($lang_profile['E-mail updated'], true);202:             message($lang_profile['E-mail updated'], true);
200:         }203:         }
201:     }204:     }
202:     else if (isset($_POST['form_sent']))205:     else if (isset($_POST['form_sent']))
203:     {206:     {
 207:         if (pun_hash($_POST['req_password']) !== $pun_user['password'])
 208:             message($lang_profile['Wrong pass']);
 209: 
204:         require PUN_ROOT.'include/email.php';210:         require PUN_ROOT.'include/email.php';
205: 211: 
206:         // Validate the email-address212:         // Validate the email-address
264:     }270:     }
265: 271: 
266:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];272:     $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
267:     $required_fields = array('req_new_email' => $lang_profile['New e-mail']);273:     $required_fields = array('req_new_email' => $lang_profile['New e-mail'], 'req_password' => $lang_common['Password']);
268:     $focus_element = array('change_email', 'req_new_email');274:     $focus_element = array('change_email', 'req_new_email');
269:     require PUN_ROOT.'header.php';275:     require PUN_ROOT.'header.php';
270: 276: 
279:                     <div class="infldset">285:                     <div class="infldset">
280:                         <input type="hidden" name="form_sent" value="1" />286:                         <input type="hidden" name="form_sent" value="1" />
281:                         <label><strong><?php echo $lang_profile['New e-mail'] ?></strong><br /><input type="text" name="req_new_email" size="50" maxlength="50" /><br /></label>287:                         <label><strong><?php echo $lang_profile['New e-mail'] ?></strong><br /><input type="text" name="req_new_email" size="50" maxlength="50" /><br /></label>
 288:                         <label><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" /><br /></label>
282:                         <p><?php echo $lang_profile['E-mail instructions'] ?></p>289:                         <p><?php echo $lang_profile['E-mail instructions'] ?></p>
283:                     </div>290:                     </div>
284:                 </fieldset>291:                 </fieldset>
303: 310: 
304:     if (isset($_POST['form_sent']))311:     if (isset($_POST['form_sent']))
305:     {312:     {
 313:         if (!isset($_FILES['req_file']))
 314:             message($lang_profile['No file']);
 315:             
306:         $uploaded_file = $_FILES['req_file'];316:         $uploaded_file = $_FILES['req_file'];
307: 317: 
308:         // Make sure the upload went smooth318:         // Make sure the upload went smooth
359:                 message($lang_profile['Move failed'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');369:                 message($lang_profile['Move failed'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.');
360: 370: 
361:             // Now check the width/height371:             // Now check the width/height
362:             list($width, $height, ,) = getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.tmp');372:             list($width, $height, $type,) = getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
363:             if ($width > $pun_config['o_avatars_width'] || $height > $pun_config['o_avatars_height'])373:             if (empty($width) || empty($height) || $width > $pun_config['o_avatars_width'] || $height > $pun_config['o_avatars_height'])
364:             {374:             {
365:                 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');375:                 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
366:                 message($lang_profile['Too wide or high'].' '.$pun_config['o_avatars_width'].'x'.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].'.');376:                 message($lang_profile['Too wide or high'].' '.$pun_config['o_avatars_width'].'x'.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].'.');
367:             }377:             }
 378:             else if ($type == 1 && $uploaded_file['type'] != 'image/gif')    // Prevent dodgy uploads
 379:             {
 380:                 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
 381:                 message($lang_profile['Bad type']);
 382:             }            
368: 383: 
369:             // Delete any old avatars and put the new one in place384:             // Delete any old avatars and put the new one in place
370:             @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[0]);385:             @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[0]);
527:     $result = $db->query('SELECT group_id, username FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());542:     $result = $db->query('SELECT group_id, username FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
528:     list($group_id, $username) = $db->fetch_row($result);543:     list($group_id, $username) = $db->fetch_row($result);
529: 544: 
 545:     if ($group_id == PUN_ADMIN)
 546:         message('Administrators cannot be deleted. In order to delete this user, you must first move him/her to a different user group.');
 547: 
530:     if (isset($_POST['delete_user_comply']))548:     if (isset($_POST['delete_user_comply']))
531:     {549:     {
532:         // If the user is a moderator or an administrator, we remove him/her from the moderator list in all forums as well550:         // If the user is a moderator or an administrator, we remove him/her from the moderator list in all forums as well
704:                     message($lang_common['Invalid e-mail']);722:                     message($lang_common['Invalid e-mail']);
705:             }723:             }
706: 724: 
 725:             // Make sure we got a valid language string
 726:             if (isset($form['language']))
 727:             {
 728:                 $form['language'] = preg_replace('#[\.\\\/]#', '', $form['language']);
 729:                 if (!file_exists(PUN_ROOT.'lang/'.$form['language'].'/common.php'))
 730:                         message($lang_common['Bad request']);
 731:             }
 732: 
707:             break;733:             break;
708:         }734:         }
709: 735: 
729:             }755:             }
730: 756: 
731:             // Add http:// if the URL doesn't contain it already757:             // Add http:// if the URL doesn't contain it already
732:             if ($form['url'] != '' && !stristr($form['url'], 'http://'))758:             if ($form['url'] != '' && strpos(strtolower($form['url']), 'http://') !== 0)
733:                 $form['url'] = 'http://'.$form['url'];759:                 $form['url'] = 'http://'.$form['url'];
734: 760: 
735:             break;761:             break;
740:             $form = extract_elements(array('jabber', 'icq', 'msn', 'aim', 'yahoo'));766:             $form = extract_elements(array('jabber', 'icq', 'msn', 'aim', 'yahoo'));
741: 767: 
742:             // If the ICQ UIN contains anything other than digits it's invalid768:             // If the ICQ UIN contains anything other than digits it's invalid
743:             if ($form['icq'] != '' && preg_match('/[^0-9]/', $form['icq']))769:             if ($form['icq'] != '' && @preg_match('/[^0-9]/', $form['icq']))
744:                 message($lang_prof_reg['Bad ICQ']);770:                 message($lang_prof_reg['Bad ICQ']);
745: 771: 
746:             break;772:             break;
795:         {821:         {
796:             $form = extract_elements(array('email_setting', 'save_pass', 'notify_with_post'));822:             $form = extract_elements(array('email_setting', 'save_pass', 'notify_with_post'));
797: 823: 
798:             $form['email_setting'] == intval($form['email_setting']);824:             $form['email_setting'] = intval($form['email_setting']);
799:             if ($form['email_setting'] < 0 && $form['email_setting'] > 2) $form['email_setting'] = 1;825:             if ($form['email_setting'] < 0 && $form['email_setting'] > 2) $form['email_setting'] = 1;
800: 826: 
801:             if (!isset($form['save_pass']) || $form['save_pass'] != '1') $form['save_pass'] = '0';827:             if (!isset($form['save_pass']) || $form['save_pass'] != '1') $form['save_pass'] = '0';
817: 843: 
818: 844: 
819:     // Singlequotes around non-empty values and NULL for empty values845:     // Singlequotes around non-empty values and NULL for empty values
 846:     $temp = array();
820:     while (list($key, $input) = @each($form))847:     while (list($key, $input) = @each($form))
821:     {848:     {
822:         $value = ($input !== '') ? '\''.$db->escape($input).'\'' : 'NULL';849:         $value = ($input !== '') ? '\''.$db->escape($input).'\'' : 'NULL';
824:         $temp[] = $key.'='.$value;851:         $temp[] = $key.'='.$value;
825:     }852:     }
826: 853: 
 854:     if (empty($temp))
 855:         message($lang_common['Bad request']);
 856: 
827: 857: 
828:     $db->query('UPDATE '.$db->prefix.'users SET '.implode(',', $temp).' WHERE id='.$id) or error('Unable to update profile', __FILE__, __LINE__, $db->error());858:     $db->query('UPDATE '.$db->prefix.'users SET '.implode(',', $temp).' WHERE id='.$id) or error('Unable to update profile', __FILE__, __LINE__, $db->error());
829: 859: 
864: }894: }
865: 895: 
866: 896: 
867: $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());897: $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
868: if (!$db->num_rows($result))898: if (!$db->num_rows($result))
869:     message($lang_common['Bad request']);899:     message($lang_common['Bad request']);
870: 900: 
966:                     <div class="infldset">996:                     <div class="infldset">
967:                         <dl>997:                         <dl>
968:                             <dt><?php echo $lang_profile['Jabber'] ?>: </dt>998:                             <dt><?php echo $lang_profile['Jabber'] ?>: </dt>
969:                             <dd><?php echo ($user['jabber'] !='') ? $user['jabber'] : $lang_profile['Unknown']; ?></dd>999:                             <dd><?php echo ($user['jabber'] !='') ? pun_htmlspecialchars($user['jabber']) : $lang_profile['Unknown']; ?></dd>
970:                             <dt><?php echo $lang_profile['ICQ'] ?>: </dt>1000:                             <dt><?php echo $lang_profile['ICQ'] ?>: </dt>
971:                             <dd><?php echo ($user['icq'] !='') ? $user['icq'] : $lang_profile['Unknown']; ?></dd>1001:                             <dd><?php echo ($user['icq'] !='') ? $user['icq'] : $lang_profile['Unknown']; ?></dd>
972:                             <dt><?php echo $lang_profile['MSN'] ?>: </dt>1002:                             <dt><?php echo $lang_profile['MSN'] ?>: </dt>
1128:         $d = dir(PUN_ROOT.'lang');1158:         $d = dir(PUN_ROOT.'lang');
1129:         while (($entry = $d->read()) !== false)1159:         while (($entry = $d->read()) !== false)
1130:         {1160:         {
1131:             if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry))1161:             if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/common.php'))
1132:                 $languages[] = $entry;1162:                 $languages[] = $entry;
1133:         }1163:         }
1134:         $d->close();1164:         $d->close();
1136:         // Only display the language selection box if there's more than one language available1166:         // Only display the language selection box if there's more than one language available
1137:         if (count($languages) > 1)1167:         if (count($languages) > 1)
1138:         {1168:         {
 1169:             natsort($languages);
1139: 1170: 
1140: ?>1171: ?>
1141:                             <label><?php echo $lang_prof_reg['Language'] ?>: <?php echo $lang_prof_reg['Language info'] ?>1172:                             <label><?php echo $lang_prof_reg['Language'] ?>: <?php echo $lang_prof_reg['Language info'] ?>
1144: 1175: 
1145:             while (list(, $temp) = @each($languages))1176:             while (list(, $temp) = @each($languages))
1146:             {1177:             {
1147:                 if ($pun_user['language'] == $temp)1178:                 if ($user['language'] == $temp)
1148:                     echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";1179:                     echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
1149:                 else1180:                 else
1150:                     echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";1181:                     echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
1232:                         <legend><?php echo $lang_profile['Contact details legend'] ?></legend>1263:                         <legend><?php echo $lang_profile['Contact details legend'] ?></legend>
1233:                         <div class="infldset">1264:                         <div class="infldset">
1234:                             <input type="hidden" name="form_sent" value="1" />1265:                             <input type="hidden" name="form_sent" value="1" />
1235:                             <label><?php echo $lang_profile['Jabber'] ?><br /><input id="jabber" type="text" name="form[jabber]" value="<?php echo $user['jabber'] ?>" size="40" maxlength="75" /><br /></label>1266:                             <label><?php echo $lang_profile['Jabber'] ?><br /><input id="jabber" type="text" name="form[jabber]" value="<?php echo pun_htmlspecialchars($user['jabber']) ?>" size="40" maxlength="75" /><br /></label>
1236:                             <label><?php echo $lang_profile['ICQ'] ?><br /><input id="icq" type="text" name="form[icq]" value="<?php echo $user['icq'] ?>" size="12" maxlength="12" /><br /></label>1267:                             <label><?php echo $lang_profile['ICQ'] ?><br /><input id="icq" type="text" name="form[icq]" value="<?php echo $user['icq'] ?>" size="12" maxlength="12" /><br /></label>
1237:                             <label><?php echo $lang_profile['MSN'] ?><br /><input id="msn" type="text" name="form[msn]" value="<?php echo pun_htmlspecialchars($user['msn']) ?>" size="40" maxlength="50" /><br /></label>1268:                             <label><?php echo $lang_profile['MSN'] ?><br /><input id="msn" type="text" name="form[msn]" value="<?php echo pun_htmlspecialchars($user['msn']) ?>" size="40" maxlength="50" /><br /></label>
1238:                             <label><?php echo $lang_profile['AOL IM'] ?><br /><input id="aim" type="text" name="form[aim]" value="<?php echo pun_htmlspecialchars($user['aim']) ?>" size="20" maxlength="30" /><br /></label>1269:                             <label><?php echo $lang_profile['AOL IM'] ?><br /><input id="aim" type="text" name="form[aim]" value="<?php echo pun_htmlspecialchars($user['aim']) ?>" size="20" maxlength="30" /><br /></label>
1347:             echo "\t\t\t".'<div><input type="hidden" name="form[style]" value="'.$styles[0].'" /></div>'."\n";1378:             echo "\t\t\t".'<div><input type="hidden" name="form[style]" value="'.$styles[0].'" /></div>'."\n";
1348:         else if (count($styles) > 1)1379:         else if (count($styles) > 1)
1349:         {1380:         {
 1381:             natsort($styles);
1350: 1382: 
1351: ?>1383: ?>
1352:                 <div class="inform">1384:                 <div class="inform">
1485:         }1517:         }
1486:         else1518:         else
1487:         {1519:         {
 1520:             if ($pun_user['id'] != $id)
 1521:             {
1488: 1522: 
1489: ?>1523: ?>
1490:                         <legend><?php echo $lang_profile['Group membership legend'] ?></legend>1524:                         <legend><?php echo $lang_profile['Group membership legend'] ?></legend>
1492:                             <select id="group_id" name="group_id">1526:                             <select id="group_id" name="group_id">
1493: <?php1527: <?php
1494: 1528: 
1495:             $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());1529:                 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
1496: 1530: 
1497:             while ($cur_group = $db->fetch_assoc($result))1531:                 while ($cur_group = $db->fetch_assoc($result))
1498:             {1532:                 {
1499:                 if ($cur_group['g_id'] == $user['g_id'] || ($cur_group['g_id'] == $pun_config['o_default_user_group'] && $user['g_id'] == ''))1533:                     if ($cur_group['g_id'] == $user['g_id'] || ($cur_group['g_id'] == $pun_config['o_default_user_group'] && $user['g_id'] == ''))
1500:                     echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";1534:                         echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
1501:                 else1535:                     else
1502:                     echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";1536:                         echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
1503:             }1537:                 }
1504: 1538: 
1505: ?>1539: ?>
1506:                             </select>1540:                             </select>
1510:                 </div>1544:                 </div>
1511:                 <div class="inform">1545:                 <div class="inform">
1512:                     <fieldset>1546:                     <fieldset>
 1547: <?php
 1548: 
 1549:             }
 1550: 
 1551: ?>
1513:                         <legend><?php echo $lang_profile['Delete ban legend'] ?></legend>1552:                         <legend><?php echo $lang_profile['Delete ban legend'] ?></legend>
1514:                         <div class="infldset">1553:                         <div class="infldset">
1515:                             <input type="submit" name="delete_user" value="<?php echo $lang_profile['Delete user'] ?>" />&nbsp;&nbsp;<input type="submit" name="ban" value="<?php echo $lang_profile['Ban user'] ?>" />1554:                             <input type="submit" name="delete_user" value="<?php echo $lang_profile['Delete user'] ?>" />&nbsp;&nbsp;<input type="submit" name="ban" value="<?php echo $lang_profile['Ban user'] ?>" />


punbb-1.2.2/upload/register.php punbb-1.2.16/upload/register.php
 79:  79: 
 80: else if (isset($_POST['form_sent'])) 80: else if (isset($_POST['form_sent']))
 81: { 81: {
  82:     // Check that someone from this IP didn't register a user within the last hour (DoS prevention)
  83:     $result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE registration_ip=\''.get_remote_address().'\' AND registered>'.(time() - 3600)) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
  84: 
  85:     if ($db->num_rows($result))
  86:         message('A new user was registered with the same IP address as you within the last hour. To prevent registration flooding, at least an hour has to pass between registrations from the same IP. Sorry for the inconvenience.');
  87: 
  88: 
 82:     $username = pun_trim($_POST['req_username']); 89:     $username = pun_trim($_POST['req_username']);
 83:     $email1 = strtolower(trim($_POST['req_email1'])); 90:     $email1 = strtolower(trim($_POST['req_email1']));
 84:  91: 
125:     }132:     }
126: 133: 
127:     // Check that the username (or a too similar username) is not already registered134:     // Check that the username (or a too similar username) is not already registered
128:     $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());135:     $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE UPPER(username)=UPPER(\''.$db->escape($username).'\') OR UPPER(username)=UPPER(\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\')') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
129: 136: 
130:     if ($db->num_rows($result))137:     if ($db->num_rows($result))
131:     {138:     {
166:             $dupe_list[] = $cur_dupe['username'];173:             $dupe_list[] = $cur_dupe['username'];
167:     }174:     }
168: 175: 
169:     $timezone = intval($_POST['timezone']);176:     // Make sure we got a valid language string
170:     $language = isset($_POST['language']) ? $_POST['language'] : $pun_config['o_default_lang'];177:     if (isset($_POST['language']))
 178:     {
 179:         $language = preg_replace('#[\.\\\/]#', '', $_POST['language']);
 180:         if (!file_exists(PUN_ROOT.'lang/'.$language.'/common.php'))
 181:                 message($lang_common['Bad request']);
 182:     }
 183:     else
 184:         $language = $pun_config['o_default_lang'];
 185: 
 186:     $timezone = round($_POST['timezone'], 1);
171:     $save_pass = (!isset($_POST['save_pass']) || $_POST['save_pass'] != '1') ? '0' : '1';187:     $save_pass = (!isset($_POST['save_pass']) || $_POST['save_pass'] != '1') ? '0' : '1';
172: 188: 
173:     $email_setting = intval($_POST['email_setting']);189:     $email_setting = intval($_POST['email_setting']);
174:     if ($email_setting < 0 && $email_setting > 2) $email_setting = 1;190:     if ($email_setting < 0 || $email_setting > 2) $email_setting = 1;
175: 191: 
176:     // Insert the new user into the database. We do this now to get the last inserted id for later use.192:     // Insert the new user into the database. We do this now to get the last inserted id for later use.
177:     $now = time();193:     $now = time();
337:         $d = dir(PUN_ROOT.'lang');353:         $d = dir(PUN_ROOT.'lang');
338:         while (($entry = $d->read()) !== false)354:         while (($entry = $d->read()) !== false)
339:         {355:         {
340:             if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry))356:             if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/common.php'))
341:                 $languages[] = $entry;357:                 $languages[] = $entry;
342:         }358:         }
343:         $d->close();359:         $d->close();


punbb-1.2.2/upload/search.php punbb-1.2.16/upload/search.php
 51:     $action = (isset($_GET['action'])) ? $_GET['action'] : null; 51:     $action = (isset($_GET['action'])) ? $_GET['action'] : null;
 52:     $forum = (isset($_GET['forum'])) ? intval($_GET['forum']) : -1; 52:     $forum = (isset($_GET['forum'])) ? intval($_GET['forum']) : -1;
 53:     $sort_dir = (isset($_GET['sort_dir'])) ? (($_GET['sort_dir'] == 'DESC') ? 'DESC' : 'ASC') : 'DESC'; 53:     $sort_dir = (isset($_GET['sort_dir'])) ? (($_GET['sort_dir'] == 'DESC') ? 'DESC' : 'ASC') : 'DESC';
  54:     if (isset($search_id)) unset($search_id);
 54:  55: 
 55:     // If a search_id was supplied 56:     // If a search_id was supplied
 56:     if (isset($_GET['search_id'])) 57:     if (isset($_GET['search_id']))
 65:         $keywords = (isset($_GET['keywords'])) ? strtolower(trim($_GET['keywords'])) : null; 66:         $keywords = (isset($_GET['keywords'])) ? strtolower(trim($_GET['keywords'])) : null;
 66:         $author = (isset($_GET['author'])) ? strtolower(trim($_GET['author'])) : null; 67:         $author = (isset($_GET['author'])) ? strtolower(trim($_GET['author'])) : null;
 67:  68: 
  69:         if (preg_match('#^[\*%]+$#', $keywords) || strlen(str_replace(array('*', '%'), '', $keywords)) < 3)
  70:             $keywords = '';
  71: 
  72:         if (preg_match('#^[\*%]+$#', $author) || strlen(str_replace(array('*', '%'), '', $author)) < 3)
  73:             $author = '';
  74: 
 68:         if (!$keywords && !$author) 75:         if (!$keywords && !$author)
 69:             message($lang_search['No terms']); 76:             message($lang_search['No terms']);
 70:  77: 
115:         $keyword_results = $author_results = array();122:         $keyword_results = $author_results = array();
116: 123: 
117:         // Search a specific forum?124:         // Search a specific forum?
118:         $forum_sql = ($forum != -1) ? ' AND t.forum_id = '.$forum : '';125:         $forum_sql = ($forum != -1 || ($forum == -1 && $pun_config['o_search_all_forums'] == '0')) ? ' AND t.forum_id = '.$forum : '';
119: 126: 
120:         if (!empty($author) || !empty($keywords))127:         if (!empty($author) || !empty($keywords))
121:         {128:         {
163: 170: 
164:                 $word_count = 0;171:                 $word_count = 0;
165:                 $match_type = 'and';172:                 $match_type = 'and';
 173:                 $result_list = array();
166:                 @reset($keywords_array);174:                 @reset($keywords_array);
167:                 while (list(, $cur_word) = @each($keywords_array))175:                 while (list(, $cur_word) = @each($keywords_array))
168:                 {176:                 {
318:                 if ($pun_user['is_guest'])326:                 if ($pun_user['is_guest'])
319:                     message($lang_common['No permission']);327:                     message($lang_common['No permission']);
320: 328: 
321:                 $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$pun_user['last_visit']) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());329:                 $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$pun_user['last_visit'].' AND t.moved_to IS NULL') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
322:                 $num_hits = $db->num_rows($result);330:                 $num_hits = $db->num_rows($result);
323: 331: 
324:                 if (!$num_hits)332:                 if (!$num_hits)
327:             // If it's a search for todays posts335:             // If it's a search for todays posts
328:             else if ($action == 'show_24h')336:             else if ($action == 'show_24h')
329:             {337:             {
330:                 $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.(time() - 86400)) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());338:                 $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.(time() - 86400).' AND t.moved_to IS NULL') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
331:                 $num_hits = $db->num_rows($result);339:                 $num_hits = $db->num_rows($result);
332: 340: 
333:                 if (!$num_hits)341:                 if (!$num_hits)
380: 388: 
381: 389: 
382:         // Prune "old" search results390:         // Prune "old" search results
 391:         $old_searches = array();
383:         $result = $db->query('SELECT ident FROM '.$db->prefix.'online') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());392:         $result = $db->query('SELECT ident FROM '.$db->prefix.'online') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
384: 393: 
385:         if ($db->num_rows($result))394:         if ($db->num_rows($result))
421:     // Fetch results to display430:     // Fetch results to display
422:     if ($search_results != '')431:     if ($search_results != '')
423:     {432:     {
424:         $group_by_sql = ''; 
425:         switch ($sort_by)433:         switch ($sort_by)
426:         {434:         {
427:             case 1:435:             case 1:
441:                 break;449:                 break;
442: 450: 
443:             default:451:             default:
444:             { 
445:                 $sort_by_sql = ($show_as == 'topics') ? 't.posted' : 'p.posted';452:                 $sort_by_sql = ($show_as == 'topics') ? 't.posted' : 'p.posted';
446:  
447:                 if ($show_as == 'topics') 
448:                     $group_by_sql = ', t.posted'; 
449:  
450:                 break;453:                 break;
451:             } 
452:         }454:         }
453: 455: 
454:         if ($show_as == 'posts')456:         if ($show_as == 'posts')
457:             $sql = 'SELECT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, '.$substr_sql.'(p.message, 1, 1000) AS message, t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id IN('.$search_results.') ORDER BY '.$sort_by_sql;459:             $sql = 'SELECT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, '.$substr_sql.'(p.message, 1, 1000) AS message, t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id IN('.$search_results.') ORDER BY '.$sort_by_sql;
458:         }460:         }
459:         else461:         else
460:             $sql = 'SELECT t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE t.id IN('.$search_results.') GROUP BY t.id, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id'.$group_by_sql.' ORDER BY '.$sort_by_sql;462:             $sql = 'SELECT t.id AS tid, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id FROM '.$db->prefix.'topics AS t WHERE t.id IN('.$search_results.') ORDER BY '.$sort_by_sql;
461: 463: 
462: 464: 
463:         // Determine the topic or post offset (based on $_GET['p'])465:         // Determine the topic or post offset (based on $_GET['p'])
704: if ($pun_config['o_search_all_forums'] == '1' || $pun_user['g_id'] < PUN_GUEST)706: if ($pun_config['o_search_all_forums'] == '1' || $pun_user['g_id'] < PUN_GUEST)
705:     echo "\t\t\t\t\t\t\t".'<option value="-1">'.$lang_search['All forums'].'</option>'."\n";707:     echo "\t\t\t\t\t\t\t".'<option value="-1">'.$lang_search['All forums'].'</option>'."\n";
706: 708: 
707: $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['group_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());709: $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
708: 710: 
709: $cur_category = 0;711: $cur_category = 0;
710: while ($cur_forum = $db->fetch_assoc($result))712: while ($cur_forum = $db->fetch_assoc($result))


punbb-1.2.2/upload/style/imports/base.css punbb-1.2.16/upload/style/imports/base.css
 43:  43: 
 44: DIV>DIV>DIV.postfootleft, DIV>DIV>DIV.postfootright {PADDING-TOP: 1px; MARGIN-TOP: -1px} 44: DIV>DIV>DIV.postfootleft, DIV>DIV>DIV.postfootright {PADDING-TOP: 1px; MARGIN-TOP: -1px}
 45:  45: 
 46: /* 3.2 This is only visible to IE Windows and cures various bugs. Do not alter comments */ 46: /* 3.2 This is only visible to IE6 Windows and cures various bugs. Do not alter comments */
 47:  47: 
 48: /* Begin IEWin Fix \*/ 48: /* Begin IE6Win Fix \*/
 49: * HTML .inbox, * HTML .inform, * HTML .pun, * HTML .intd, * HTML .tclcon {HEIGHT: 1px} 49: * HTML .inbox, * HTML .inform, * HTML .pun, * HTML .intd, * HTML .tclcon {HEIGHT: 1px}
 50: * HTML .inbox DIV.postmsg {WIDTH: 98%} 50: * HTML .inbox DIV.postmsg {WIDTH: 98%}
 51: /* End of IEWin Fix */ 51: /* End of IE6Win Fix */
  52: 
  53: /* 3.3 This is the equivelant of 3.2 but for IE7. It is visible to other browsers
  54: but does no harm */
  55: 
  56: /*Begin IE7Win Fix */
  57: .pun, .pun .inbox, .pun .inform, .pun .intd, .pun .tclcon {min-height: 1px}
  58: /* End of IE7Win Fix */
 52:  59: 
 53: /****************************************************************/ 60: /****************************************************************/
 54: /* 4. HIDDEN ELEMENTS */ 61: /* 4. HIDDEN ELEMENTS */
168: DIV.postleft, DIV.postfootleft {175: DIV.postleft, DIV.postfootleft {
169:     FLOAT:left;176:     FLOAT:left;
170:     WIDTH: 18em;177:     WIDTH: 18em;
171:     OVERFLOW: hidden178:     OVERFLOW: hidden;
 179:     POSITION: relative;
172: }180: }
173:     181:     
174: DIV.postright, DIV.postfootright {182: DIV.postright, DIV.postfootright {


punbb-1.2.2/upload/userlist.php punbb-1.2.16/upload/userlist.php
 41: // Determine if we are allowed to view post counts 41: // Determine if we are allowed to view post counts
 42: $show_post_count = ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST) ? true : false; 42: $show_post_count = ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST) ? true : false;
 43:  43: 
 44: $username = (isset($_GET['username']) && $pun_user['g_search_users'] == '1') ? $_GET['username'] : ''; 44: $username = (isset($_GET['username']) && $pun_user['g_search_users'] == '1') ? pun_trim($_GET['username']) : '';
 45: $show_group = (!isset($_GET['show_group']) || intval($_GET['show_group']) < -1 && intval($_GET['show_group']) > 2) ? -1 : intval($_GET['show_group']); 45: $show_group = (!isset($_GET['show_group']) || intval($_GET['show_group']) < -1 && intval($_GET['show_group']) > 2) ? -1 : intval($_GET['show_group']);
 46: $sort_by = (!isset($_GET['sort_by']) || $_GET['sort_by'] != 'username' && $_GET['sort_by'] != 'registered' && ($_GET['sort_by'] != 'num_posts' || !$show_post_count)) ? 'username' : $_GET['sort_by']; 46: $sort_by = (!isset($_GET['sort_by']) || $_GET['sort_by'] != 'username' && $_GET['sort_by'] != 'registered' && ($_GET['sort_by'] != 'num_posts' || !$show_post_count)) ? 'username' : $_GET['sort_by'];
 47: $sort_dir = (!isset($_GET['sort_dir']) || $_GET['sort_dir'] != 'ASC' && $_GET['sort_dir'] != 'DESC') ? 'ASC' : strtoupper($_GET['sort_dir']); 47: $sort_dir = (!isset($_GET['sort_dir']) || $_GET['sort_dir'] != 'ASC' && $_GET['sort_dir'] != 'DESC') ? 'ASC' : strtoupper($_GET['sort_dir']);
116:     $where_sql[] = 'u.group_id='.$show_group;116:     $where_sql[] = 'u.group_id='.$show_group;
117: 117: 
118: // Fetch user count118: // Fetch user count
119: $result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users AS u'.(!empty($where_sql) ? ' WHERE '.implode(' AND ', $where_sql) : '')) or error('Unable to fetch user list count', __FILE__, __LINE__, $db->error());119: $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'users AS u WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '')) or error('Unable to fetch user list count', __FILE__, __LINE__, $db->error());
120: $num_users = $db->result($result);120: $num_users = $db->result($result);
121: 121: 
122: 122: 
154: <?php154: <?php
155: 155: 
156: // Grab the users156: // Grab the users
157: $result = $db->query('SELECT u.id, u.username, u.title, u.num_posts, u.registered, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '').' ORDER BY '.$sort_by.' '.$sort_dir.' LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());157: $result = $db->query('SELECT u.id, u.username, u.title, u.num_posts, u.registered, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '').' ORDER BY '.$sort_by.' '.$sort_dir.' LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());
158: if ($db->num_rows($result))158: if ($db->num_rows($result))
159: {159: {
160:     while ($user_data = $db->fetch_assoc($result))160:     while ($user_data = $db->fetch_assoc($result))


punbb-1.2.2/upload/viewforum.php punbb-1.2.16/upload/viewforum.php
242: 242: 
243: <div class="linksb">243: <div class="linksb">
244:     <div class="inbox">244:     <div class="inbox">
245:         <p class="pagelink conl"><?php echo $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewforum.php?id='.$id) ?></p>245:         <p class="pagelink conl"><?php echo $paging_links ?></p>
246: <?php echo $post_link ?>246: <?php echo $post_link ?>
247:         <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a>&nbsp;</li><li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul>247:         <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a>&nbsp;</li><li>&raquo;&nbsp;<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></li></ul>
248:         <div class="clearer"></div>248:         <div class="clearer"></div>


punbb-1.2.2/upload/viewtopic.php punbb-1.2.16/upload/viewtopic.php
183: $post_count = 0;    // Keep track of post numbers183: $post_count = 0;    // Keep track of post numbers
184: 184: 
185: // Retrieve the posts (and their respective poster/online status)185: // Retrieve the posts (and their respective poster/online status)
186: $result = $db->query('SELECT DISTINCT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());186: $result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
187: while ($cur_post = $db->fetch_assoc($result))187: while ($cur_post = $db->fetch_assoc($result))
188: {188: {
189:     $post_count++;189:     $post_count++;


hdiff - version: 2.1.0 (modified)