Changeset 1263

Show
Ignore:
Timestamp:
01/14/08 23:23:25 (7 months ago)
Author:
Neal
Message:

Fixed some miscellaneous display/HTML validation issues in admin_forums.php when there are no forums/categories.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/upload/admin_forums.php

    r941 r1263  
    386386 
    387387        $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()); 
    388         while ($cur_cat = $db->fetch_assoc($result)) 
    389                 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n"; 
     388        if ($db->num_rows($result) > 0) 
     389        { 
     390                while ($cur_cat = $db->fetch_assoc($result)) 
     391                        echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_cat['id'].'">'.pun_htmlspecialchars($cur_cat['cat_name']).'</option>'."\n"; 
     392        } 
     393        else 
     394                echo "\t\t\t\t\t\t\t\t\t".'<option value="0" disabled="disabled">No categories exist</option>'."\n"; 
    390395 
    391396?> 
     
    400405                        </form> 
    401406                </div> 
    402  
     407<?php 
     408 
     409// Display all the categories and forums 
     410$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()); 
     411 
     412if ($db->num_rows($result) > 0) 
     413
     414 
     415?> 
    403416                <h2 class="block2"><span>Edit forums</span></h2> 
    404417                <div class="box"> 
     
    408421 
    409422$tabindex_count = 4; 
    410  
    411 // Display all the categories and forums 
    412 $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()); 
    413423 
    414424$cur_category = 0; 
     
    450460                        </form> 
    451461                </div> 
     462<?php 
     463 
     464} 
     465 
     466?> 
    452467        </div> 
    453468        <div class="clearer"></div>