0) { $set = ''; while ($row = mysql_fetch_array($result)) $set .= $row['cid'] . ','; $set = '(' . substr($set, 0, -1) . ')'; $sql = "UPDATE {$CONFIG['TABLE_CATEGORIES']} " . "SET parent = '0' " . "WHERE parent=cid OR parent NOT IN $set"; $result = db_query($sql); } } function get_subcat_data($parent, $ident = '') { global $CONFIG, $CAT_LIST; $sql = "SELECT cid, name, description " . "FROM {$CONFIG['TABLE_CATEGORIES']} " . "WHERE parent = '$parent' " . "ORDER BY pos"; $result = db_query($sql); if (($cat_count = mysql_num_rows($result)) > 0) { $rowset = db_fetch_rowset($result); $pos = 0; foreach ($rowset as $subcat) { if ($pos > 0) { $CAT_LIST[] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'prev' => $prev_cid, 'cat_count' => $cat_count, 'name' => $ident . $subcat['name']); $CAT_LIST[$last_index]['next'] = $subcat['cid']; } else { $CAT_LIST[] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'cat_count' => $cat_count, 'name' => $ident . $subcat['name']); } $prev_cid = $subcat['cid']; $last_index = count($CAT_LIST) -1; get_subcat_data($subcat['cid'], $ident . '   '); } } } function update_cat_order() { global $CAT_LIST, $CONFIG; foreach ($CAT_LIST as $category) db_query("UPDATE {$CONFIG['TABLE_CATEGORIES']} SET pos='{$category['pos']}' WHERE cid = '{$category['cid']}' LIMIT 1"); } function cat_list_box($highlight = 0, $curr_cat, $on_change_refresh = true) { global $CAT_LIST, $PHP_SELF,$lang_albmgr_php; if ($on_change_refresh) { $lb = <<< EOT EOT; } $lb .= ' \n"; foreach($CAT_LIST as $category) if ($category['cid'] != 1 && $category['cid'] != $curr_cat) { $lb .= ' \n"; } elseif ($category['cid'] != 1 && $category['cid'] == $curr_cat) { $lb .= ' \n"; } $lb .= << EOT; return $lb; } function form_alb_thumb() { global $CONFIG, $lang_catmgr_php, $lang_modifyalb_php, $current_category, $cid; $results = db_query("SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND {$CONFIG['TABLE_ALBUMS']}.category = '$cid' AND approved='YES' ORDER BY filename"); if (mysql_num_rows($results) == 0) { echo << {$lang_modifyalb_php['alb_thumb']} {$lang_modifyalb_php['alb_empty']} EOT; return; } echo << var Pic = new Array() Pic[0] = 'images/nopic.jpg' EOT; $initial_thumb_url = 'images/nopic.jpg'; $img_list = array(0 => $lang_modifyalb_php['last_uploaded']); while ($picture = mysql_fetch_array($results)) { $thumb_url = get_pic_url($picture, 'thumb'); echo "Pic[{$picture['pid']}] = '" . $thumb_url . "'\n"; if ($picture['pid'] == $current_category['thumb']) $initial_thumb_url = $thumb_url; $img_list[$picture['pid']] = htmlspecialchars($picture['filename']); } // while echo << EOT; $thumb_cell_height = $CONFIG['thumb_width'] + 17; echo << {$lang_catmgr_php['cat_thumb']}

{$lang_catmgr_php['parent_cat']} $lb {$lang_catmgr_php['cat_title']} {$lang_catmgr_php['cat_desc']} EOT; form_alb_thumb(); echo << EOT; endtable(); pagefooter(); ob_end_flush(); ?>