[ PHPXref.com ] [ Generated: Thu Aug 19 03:35:06 2010 ] [ FluxBB 1.4.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> admin_forums.php (source)

   1  <?php
   2  
   3  /**
   4   * Copyright (C) 2008-2010 FluxBB
   5   * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
   6   * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
   7   */
   8  
   9  // Tell header.php to use the admin template
  10  define('PUN_ADMIN_CONSOLE', 1);
  11  
  12  define('PUN_ROOT', './');
  13  require  PUN_ROOT.'include/common.php';
  14  require  PUN_ROOT.'include/common_admin.php';
  15  
  16  
  17  if ($pun_user['g_id'] != PUN_ADMIN)
  18      message($lang_common['No permission']);
  19  
  20  // Load the admin_forums.php language file
  21  require PUN_ROOT.'lang/'.$admin_language.'/admin_forums.php';
  22  
  23  // Add a "default" forum
  24  if (isset($_POST['add_forum']))
  25  {
  26      confirm_referrer('admin_forums.php');
  27  
  28      $add_to_cat = intval($_POST['add_to_cat']);
  29      if ($add_to_cat < 1)
  30          message($lang_common['Bad request']);
  31  
  32      $db->query('INSERT INTO '.$db->prefix.'forums (forum_name, cat_id) VALUES(\''.$db->escape($lang_admin_forums['New forum']).'\', '.$add_to_cat.')') or error('Unable to create forum', __FILE__, __LINE__, $db->error());
  33  
  34      // Regenerate the quick jump cache
  35      if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
  36          require  PUN_ROOT.'include/cache.php';
  37  
  38      generate_quickjump_cache();
  39  
  40      redirect('admin_forums.php', $lang_admin_forums['Forum added redirect']);
  41  }
  42  
  43  // Delete a forum
  44  else if (isset($_GET['del_forum']))
  45  {
  46      confirm_referrer('admin_forums.php');
  47  
  48      $forum_id = intval($_GET['del_forum']);
  49      if ($forum_id < 1)
  50          message($lang_common['Bad request']);
  51  
  52      if (isset($_POST['del_forum_comply'])) // Delete a forum with all posts
  53      {
  54          @set_time_limit(0);
  55  
  56          // Prune all posts and topics
  57          prune($forum_id, 1, -1);
  58  
  59          // Locate any "orphaned redirect topics" and delete them
  60          $result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error());
  61          $num_orphans = $db->num_rows($result);
  62  
  63          if ($num_orphans)
  64          {
  65              for ($i = 0; $i < $num_orphans; ++$i)
  66                  $orphans[] = $db->result($result, $i);
  67  
  68              $db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
  69          }
  70  
  71          // Delete the forum and any forum specific group permissions
  72          $db->query('DELETE FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to delete forum', __FILE__, __LINE__, $db->error());
  73          $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
  74  
  75          // Regenerate the quick jump cache
  76          if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
  77              require  PUN_ROOT.'include/cache.php';
  78  
  79          generate_quickjump_cache();
  80  
  81          redirect('admin_forums.php', $lang_admin_forums['Forum deleted redirect']);
  82      }
  83      else // If the user hasn't confirmed the delete
  84      {
  85          $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
  86          $forum_name = pun_htmlspecialchars($db->result($result));
  87  
  88          $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
  89          define('PUN_ACTIVE_PAGE', 'admin');
  90          require  PUN_ROOT.'header.php';
  91  
  92          generate_admin_menu('forums');
  93  
  94  ?>
  95      <div class="blockform">
  96          <h2><span><?php echo $lang_admin_forums['Confirm delete head'] ?></span></h2>
  97          <div class="box">
  98              <form method="post" action="admin_forums.php?del_forum=<?php echo $forum_id ?>">
  99                  <div class="inform">
 100                      <fieldset>
 101                          <legend><?php echo $lang_admin_forums['Confirm delete subhead'] ?></legend>
 102                          <div class="infldset">
 103                              <p><?php printf($lang_admin_forums['Confirm delete info'], $forum_name) ?></p>
 104                              <p class="warntext"><?php echo $lang_admin_forums['Confirm delete warn'] ?></p>
 105                          </div>
 106                      </fieldset>
 107                  </div>
 108                  <p class="buttons"><input type="submit" name="del_forum_comply" value="<?php echo $lang_admin_common['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p>
 109              </form>
 110          </div>
 111      </div>
 112      <div class="clearer"></div>
 113  </div>
 114  <?php
 115  
 116          require  PUN_ROOT.'footer.php';
 117      }
 118  }
 119  
 120  // Update forum positions
 121  else if (isset($_POST['update_positions']))
 122  {
 123      confirm_referrer('admin_forums.php');
 124  
 125      foreach ($_POST['position'] as $forum_id => $disp_position)
 126      {
 127          $disp_position = trim($disp_position);
 128          if ($disp_position == '' || preg_match('/[^0-9]/', $disp_position))
 129              message($lang_admin_forums['Must be integer message']);
 130  
 131          $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());
 132      }
 133  
 134      // Regenerate the quick jump cache
 135      if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
 136          require  PUN_ROOT.'include/cache.php';
 137  
 138      generate_quickjump_cache();
 139  
 140      redirect('admin_forums.php', $lang_admin_forums['Forums updated redirect']);
 141  }
 142  
 143  else if (isset($_GET['edit_forum']))
 144  {
 145      $forum_id = intval($_GET['edit_forum']);
 146      if ($forum_id < 1)
 147          message($lang_common['Bad request']);
 148  
 149      // Update group permissions for $forum_id
 150      if (isset($_POST['save']))
 151      {
 152          confirm_referrer('admin_forums.php');
 153  
 154          // Start with the forum details
 155          $forum_name = pun_trim($_POST['forum_name']);
 156          $forum_desc = pun_linebreaks(pun_trim($_POST['forum_desc']));
 157          $cat_id = intval($_POST['cat_id']);
 158          $sort_by = intval($_POST['sort_by']);
 159          $redirect_url = isset($_POST['redirect_url']) ? trim($_POST['redirect_url']) : null;
 160  
 161          if ($forum_name == '')
 162              message($lang_admin_forums['Must enter name message']);
 163  
 164          if ($cat_id < 1)
 165              message($lang_common['Bad request']);
 166  
 167          $forum_desc = ($forum_desc != '') ? '\''.$db->escape($forum_desc).'\'' : 'NULL';
 168          $redirect_url = ($redirect_url != '') ? '\''.$db->escape($redirect_url).'\'' : 'NULL';
 169  
 170          $db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.$db->escape($forum_name).'\', forum_desc='.$forum_desc.', redirect_url='.$redirect_url.', sort_by='.$sort_by.', cat_id='.$cat_id.' WHERE id='.$forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
 171  
 172          // Now let's deal with the permissions
 173          if (isset($_POST['read_forum_old']))
 174          {
 175              $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());
 176              while ($cur_group = $db->fetch_assoc($result))
 177              {
 178                  $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']]);
 179                  $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? '1' : '0';
 180                  $post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? '1' : '0';
 181  
 182                  // Check if the new settings differ from the old
 183                  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']])
 184                  {
 185                      // If the new settings are identical to the default settings for this group, delete it's row in forum_perms
 186                      if ($read_forum_new == '1' && $post_replies_new == $cur_group['g_post_replies'] && $post_topics_new == $cur_group['g_post_topics'])
 187                          $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
 188                      else
 189                      {
 190                          // Run an UPDATE and see if it affected a row, if not, INSERT
 191                          $db->query('UPDATE '.$db->prefix.'forum_perms SET read_forum='.$read_forum_new.', post_replies='.$post_replies_new.', post_topics='.$post_topics_new.' WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
 192                          if (!$db->affected_rows())
 193                              $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$cur_group['g_id'].', '.$forum_id.', '.$read_forum_new.', '.$post_replies_new.', '.$post_topics_new.')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());
 194                      }
 195                  }
 196              }
 197          }
 198  
 199          // Regenerate the quick jump cache
 200          if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
 201              require  PUN_ROOT.'include/cache.php';
 202  
 203          generate_quickjump_cache();
 204  
 205          redirect('admin_forums.php', $lang_admin_forums['Forum updated redirect']);
 206      }
 207      else if (isset($_POST['revert_perms']))
 208      {
 209          confirm_referrer('admin_forums.php');
 210  
 211          $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE forum_id='.$forum_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
 212  
 213          // Regenerate the quick jump cache
 214          if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
 215              require  PUN_ROOT.'include/cache.php';
 216  
 217          generate_quickjump_cache();
 218  
 219          redirect('admin_forums.php?edit_forum='.$forum_id, $lang_admin_forums['Perms reverted redirect']);
 220      }
 221  
 222      // Fetch forum info
 223      $result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
 224      if (!$db->num_rows($result))
 225          message($lang_common['Bad request']);
 226  
 227      $cur_forum = $db->fetch_assoc($result);
 228  
 229      $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
 230      define('PUN_ACTIVE_PAGE', 'admin');
 231      require  PUN_ROOT.'header.php';
 232  
 233      generate_admin_menu('forums');
 234  
 235  ?>
 236      <div class="blockform">
 237          <h2><span><?php echo $lang_admin_forums['Edit forum head'] ?></span></h2>
 238          <div class="box">
 239              <form id="edit_forum" method="post" action="admin_forums.php?edit_forum=<?php echo $forum_id ?>">
 240                  <p class="submittop"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" tabindex="6" /></p>
 241                  <div class="inform">
 242                      <fieldset>
 243                          <legend><?php echo $lang_admin_forums['Edit details subhead'] ?></legend>
 244                          <div class="infldset">
 245                              <table class="aligntop" cellspacing="0">
 246                                  <tr>
 247                                      <th scope="row"><?php echo $lang_admin_forums['Forum name label'] ?></th>
 248                                      <td><input type="text" name="forum_name" size="35" maxlength="80" value="<?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?>" tabindex="1" /></td>
 249                                  </tr>
 250                                  <tr>
 251                                      <th scope="row"><?php echo $lang_admin_forums['Forum description label'] ?></th>
 252                                      <td><textarea name="forum_desc" rows="3" cols="50" tabindex="2"><?php echo pun_htmlspecialchars($cur_forum['forum_desc']) ?></textarea></td>
 253                                  </tr>
 254                                  <tr>
 255                                      <th scope="row"><?php echo $lang_admin_forums['Category label'] ?></th>
 256                                      <td>
 257                                          <select name="cat_id" tabindex="3">
 258  <?php
 259  
 260      $result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
 261      while ($cur_cat = $db->fetch_assoc($result))
 262      {
 263          $selected = ($cur_cat['id'] == $cur_forum['cat_id']) ? ' selected="selected"' : '';
 264          echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'"'.$selected.'>'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n";
 265      }
 266  
 267  ?>
 268                                          </select>
 269                                      </td>
 270                                  </tr>
 271                                  <tr>
 272                                      <th scope="row"><?php echo $lang_admin_forums['Sort by label'] ?></th>
 273                                      <td>
 274                                          <select name="sort_by" tabindex="4">
 275                                              <option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Last post'] ?></option>
 276                                              <option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>><?php echo $lang_admin_forums['Topic start'] ?></option>
 277                                          </select>
 278                                      </td>
 279                                  </tr>
 280                                  <tr>
 281                                      <th scope="row"><?php echo $lang_admin_forums['Redirect label'] ?></th>
 282                                      <td><?php echo ($cur_forum['num_topics']) ? $lang_admin_forums['Redirect help'] : '<input type="text" name="redirect_url" size="45" maxlength="100" value="'.pun_htmlspecialchars($cur_forum['redirect_url']).'" tabindex="5" />'; ?></td>
 283                                  </tr>
 284                              </table>
 285                          </div>
 286                      </fieldset>
 287                  </div>
 288                  <div class="inform">
 289                      <fieldset>
 290                          <legend><?php echo $lang_admin_forums['Group permissions subhead'] ?></legend>
 291                          <div class="infldset">
 292                              <p><?php printf($lang_admin_forums['Group permissions info'], '<a href="admin_groups.php">'.$lang_admin_common['User groups'].'</a>') ?></p>
 293                              <table id="forumperms" cellspacing="0">
 294                              <thead>
 295                                  <tr>
 296                                      <th class="atcl">&#160;</th>
 297                                      <th><?php echo $lang_admin_forums['Read forum label'] ?></th>
 298                                      <th><?php echo $lang_admin_forums['Post replies label'] ?></th>
 299                                      <th><?php echo $lang_admin_forums['Post topics label'] ?></th>
 300                                  </tr>
 301                              </thead>
 302                              <tbody>
 303  <?php
 304  
 305      $result = $db->query('SELECT g.g_id, g.g_title, g.g_read_board, g.g_post_replies, g.g_post_topics, fp.read_forum, fp.post_replies, fp.post_topics FROM '.$db->prefix.'groups AS g LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (g.g_id=fp.group_id AND fp.forum_id='.$forum_id.') WHERE g.g_id!='.PUN_ADMIN.' ORDER BY g.g_id') or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error());
 306  
 307      while ($cur_perm = $db->fetch_assoc($result))
 308      {
 309          $read_forum = ($cur_perm['read_forum'] != '0') ? true : false;
 310          $post_replies = (($cur_perm['g_post_replies'] == '0' && $cur_perm['post_replies'] == '1') || ($cur_perm['g_post_replies'] == '1' && $cur_perm['post_replies'] != '0')) ? true : false;
 311          $post_topics = (($cur_perm['g_post_topics'] == '0' && $cur_perm['post_topics'] == '1') || ($cur_perm['g_post_topics'] == '1' && $cur_perm['post_topics'] != '0')) ? true : false;
 312  
 313          // Determine if the current settings differ from the default or not
 314          $read_forum_def = ($cur_perm['read_forum'] == '0') ? false : true;
 315          $post_replies_def = (($post_replies && $cur_perm['g_post_replies'] == '0') || (!$post_replies && ($cur_perm['g_post_replies'] == '' || $cur_perm['g_post_replies'] == '1'))) ? false : true;
 316          $post_topics_def = (($post_topics && $cur_perm['g_post_topics'] == '0') || (!$post_topics && ($cur_perm['g_post_topics'] == '' || $cur_perm['g_post_topics'] == '1'))) ? false : true;
 317  
 318  ?>
 319                                  <tr>
 320                                      <th class="atcl"><?php echo pun_htmlspecialchars($cur_perm['g_title']) ?></th>
 321                                      <td<?php if (!$read_forum_def) echo ' class="nodefault"'; ?>>
 322                                          <input type="hidden" name="read_forum_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($read_forum) ? '1' : '0'; ?>" />
 323                                          <input type="checkbox" name="read_forum_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($read_forum) ? ' checked="checked"' : ''; ?><?php echo ($cur_perm['g_read_board'] == '0') ? ' disabled="disabled"' : ''; ?> />
 324                                      </td>
 325                                      <td<?php if (!$post_replies_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>>
 326                                          <input type="hidden" name="post_replies_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($post_replies) ? '1' : '0'; ?>" />
 327                                          <input type="checkbox" name="post_replies_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_replies) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> />
 328                                      </td>
 329                                      <td<?php if (!$post_topics_def && $cur_forum['redirect_url'] == '') echo ' class="nodefault"'; ?>>
 330                                          <input type="hidden" name="post_topics_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($post_topics) ? '1' : '0'; ?>" />
 331                                          <input type="checkbox" name="post_topics_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($post_topics) ? ' checked="checked"' : ''; ?><?php echo ($cur_forum['redirect_url'] != '') ? ' disabled="disabled"' : ''; ?> />
 332                                      </td>
 333                                  </tr>
 334  <?php
 335  
 336      }
 337  
 338  ?>
 339                              </tbody>
 340                              </table>
 341                              <div class="fsetsubmit"><input type="submit" name="revert_perms" value="<?php echo $lang_admin_forums['Revert to default'] ?>" /></div>
 342                          </div>
 343                      </fieldset>
 344                  </div>
 345                  <p class="submitend"><input type="submit" name="save" value="<?php echo $lang_admin_common['Save changes'] ?>" /></p>
 346              </form>
 347          </div>
 348      </div>
 349      <div class="clearer"></div>
 350  </div>
 351  
 352  <?php
 353  
 354      require  PUN_ROOT.'footer.php';
 355  }
 356  
 357  $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Forums']);
 358  define('PUN_ACTIVE_PAGE', 'admin');
 359  require  PUN_ROOT.'header.php';
 360  
 361  generate_admin_menu('forums');
 362  
 363  ?>
 364      <div class="blockform">
 365          <h2><span><?php echo $lang_admin_forums['Add forum head'] ?></span></h2>
 366          <div class="box">
 367              <form method="post" action="admin_forums.php?action=adddel">
 368                  <div class="inform">
 369                      <fieldset>
 370                          <legend><?php echo $lang_admin_forums['Create new subhead'] ?></legend>
 371                          <div class="infldset">
 372                              <table class="aligntop" cellspacing="0">
 373                                  <tr>
 374                                      <th scope="row"><?php echo $lang_admin_forums['Add forum label'] ?><div><input type="submit" name="add_forum" value="<?php echo $lang_admin_forums['Add forum'] ?>" tabindex="2" /></div></th>
 375                                      <td>
 376                                          <select name="add_to_cat" tabindex="1">
 377  <?php
 378  
 379      $result = $db->query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
 380      if ($db->num_rows($result) > 0)
 381      {
 382          while ($cur_cat = $db->fetch_assoc($result))
 383              echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n";
 384      }
 385      else
 386          echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="0" disabled="disabled">'.$lang_admin_forums['No categories exist'].'</option>'."\n";
 387  
 388  ?>
 389                                          </select>
 390                                          <span><?php echo $lang_admin_forums['Add forum help'] ?></span>
 391                                      </td>
 392                                  </tr>
 393                              </table>
 394                          </div>
 395                      </fieldset>
 396                  </div>
 397              </form>
 398          </div>
 399  <?php
 400  
 401  // Display all the categories and forums
 402  $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.disp_position FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
 403  
 404  if ($db->num_rows($result) > 0)
 405  {
 406  
 407  ?>
 408          <h2 class="block2"><span><?php echo $lang_admin_forums['Edit forums head'] ?></span></h2>
 409          <div class="box">
 410              <form id="edforum" method="post" action="admin_forums.php?action=edit">
 411                  <p class="submittop"><input type="submit" name="update_positions" value="<?php echo $lang_admin_forums['Update positions'] ?>" tabindex="3" /></p>
 412  <?php
 413  
 414  $tabindex_count = 4;
 415  
 416  $cur_category = 0;
 417  while ($cur_forum = $db->fetch_assoc($result))
 418  {
 419      if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
 420      {
 421          if ($cur_category != 0)
 422              echo "\t\t\t\t\t\t\t".'</tbody>'."\n\t\t\t\t\t\t\t".'</table>'."\n\t\t\t\t\t\t".'</div>'."\n\t\t\t\t\t".'</fieldset>'."\n\t\t\t\t".'</div>'."\n";
 423  
 424  ?>
 425                  <div class="inform">
 426                      <fieldset>
 427                          <legend><?php echo $lang_admin_forums['Category subhead'] ?> <?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></legend>
 428                          <div class="infldset">
 429                              <table cellspacing="0">
 430                              <thead>
 431                                  <tr>
 432                                      <th class="tcl"><?php echo $lang_admin_common['Action'] ?></th>
 433                                      <th class="tc2"><?php echo $lang_admin_forums['Position label'] ?></th>
 434                                      <th class="tcr"><?php echo $lang_admin_forums['Forum label'] ?></th>
 435                                  </tr>
 436                              </thead>
 437                              <tbody>
 438  <?php
 439  
 440          $cur_category = $cur_forum['cid'];
 441      }
 442  
 443  ?>
 444                                  <tr>
 445                                      <td class="tcl"><a href="admin_forums.php?edit_forum=<?php echo $cur_forum['fid'] ?>"><?php echo $lang_admin_forums['Edit link'] ?></a> | <a href="admin_forums.php?del_forum=<?php echo $cur_forum['fid'] ?>"><?php echo $lang_admin_forums['Delete link'] ?></a></td>
 446                                      <td class="tc2"><input type="text" name="position[<?php echo $cur_forum['fid'] ?>]" size="3" maxlength="3" value="<?php echo $cur_forum['disp_position'] ?>" tabindex="<?php echo $tabindex_count ?>" /></td>
 447                                      <td class="tcr"><strong><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></strong></td>
 448                                  </tr>
 449  <?php
 450  
 451      $tabindex_count += 2;
 452  }
 453  
 454  ?>
 455                              </tbody>
 456                              </table>
 457                          </div>
 458                      </fieldset>
 459                  </div>
 460                  <p class="submitend"><input type="submit" name="update_positions" value="<?php echo $lang_admin_forums['Update positions'] ?>" tabindex="<?php echo $tabindex_count ?>" /></p>
 461              </form>
 462          </div>
 463  <?php
 464  
 465  }
 466  
 467  ?>
 468      </div>
 469      <div class="clearer"></div>
 470  </div>
 471  <?php
 472  
 473  require  PUN_ROOT.'footer.php';


[ Powered by PHPXref - Served by Debian GNU/Linux ]