diff -r e3d7322305bf -r 5e1f1e916419 punbb/admin_ranks.php --- a/punbb/admin_ranks.php Sun Sep 02 11:00:57 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -query('SELECT 1 FROM '.$pun_db->prefix.'ranks WHERE min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $pun_db->error()); - if ($pun_db->num_rows($result)) - message('There is already a rank with a minimun posts value of '.$min_posts.'.'); - - $pun_db->query('INSERT INTO '.$pun_db->prefix.'ranks (rank, min_posts) VALUES(\''.$pun_db->escape($rank).'\', '.$min_posts.')') or error('Unable to add rank', __FILE__, __LINE__, $pun_db->error()); - - // Regenerate the ranks cache - require_once PUN_ROOT.'include/cache.php'; - generate_ranks_cache(); - - pun_redirect('admin_ranks.php', 'Rank added. Redirecting …'); -} - - -// Update a rank -else if (isset($_POST['update'])) -{ - confirm_referrer('admin_ranks.php'); - - $id = intval(key($_POST['update'])); - - $rank = trim($_POST['rank'][$id]); - $min_posts = trim($_POST['min_posts'][$id]); - - if ($rank == '') - message('You must enter a rank title.'); - - if (!@preg_match('#^\d+$#', $min_posts)) - message('Minimum posts must be a positive integer value.'); - - // Make sure there isn't already a rank with the same min_posts value - $result = $pun_db->query('SELECT 1 FROM '.$pun_db->prefix.'ranks WHERE id!='.$id.' AND min_posts='.$min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $pun_db->error()); - if ($pun_db->num_rows($result)) - message('There is already a rank with a minimun posts value of '.$min_posts.'.'); - - $pun_db->query('UPDATE '.$pun_db->prefix.'ranks SET rank=\''.$pun_db->escape($rank).'\', min_posts='.$min_posts.' WHERE id='.$id) or error('Unable to update rank', __FILE__, __LINE__, $pun_db->error()); - - // Regenerate the ranks cache - require_once PUN_ROOT.'include/cache.php'; - generate_ranks_cache(); - - pun_redirect('admin_ranks.php', 'Rank updated. Redirecting …'); -} - - -// Remove a rank -else if (isset($_POST['remove'])) -{ - confirm_referrer('admin_ranks.php'); - - $id = intval(key($_POST['remove'])); - - $pun_db->query('DELETE FROM '.$pun_db->prefix.'ranks WHERE id='.$id) or error('Unable to delete rank', __FILE__, __LINE__, $pun_db->error()); - - // Regenerate the ranks cache - require_once PUN_ROOT.'include/cache.php'; - generate_ranks_cache(); - - pun_redirect('admin_ranks.php', 'Rank removed. Redirecting …'); -} - - -$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Ranks'; -$focus_element = array('ranks', 'new_rank'); -require PUN_ROOT.'header.php'; - -generate_admin_menu('ranks'); - -?> -
-

Ranks

-
-
-
-
- Add rank -
-

Enter a rank and the minimum number of posts that a user has to have to aquire the rank. Different ranks cannot have the same value for minimum posts. If a title is set for a user, the title will be displayed instead of any rank. User ranks must be enabled in Options for this to have any effect.

- - - - - - - - - - - - - - - -
Rank titleMinimum postsAction
-
-
-
-
-
- Edit/remove ranks -
-query('SELECT id, rank, min_posts FROM '.$pun_db->prefix.'ranks ORDER BY min_posts') or error('Unable to fetch rank list', __FILE__, __LINE__, $pun_db->error()); -if ($pun_db->num_rows($result)) -{ - -?> - - - - - - - - - -fetch_assoc($result)) - echo "\t\t\t\t\t\t\t\t".''."\n"; - -?> - -
Rank titleMinimum PostsActions
 
-No ranks in list.

'."\n"; - -?> -
-
-
-
-
-
-
- -