Name
Icon
Category Access

HTML; msg("options", "Edit Category", $msg); } } } // ******************************************************************************** // DO Edit Category // ******************************************************************************** elseif($action == "doedit") { $cat_name = htmlspecialchars(stripslashes($cat_name)); if(!$catid){ msg("error","Error !!!","No category ID", "$PHP_SELF?mod=categories"); } if($cat_name == ""){ msg("error", "Error !!!", "Category name can not be blank", "javascript:history.go(-1)"); } $old_cats = file("./data/category.db.php"); $new_cats = fopen("./data/category.db.php", "w"); foreach($old_cats as $cat_line){ $cat_arr = explode("|", $cat_line); if($cat_arr[0] == $catid){ fwrite($new_cats, "$catid|$cat_name|$cat_icon|$cat_access|||\n"); }else{ fwrite($new_cats, "$cat_line"); } } fclose($new_cats); } // ******************************************************************************** // List all Categories // ******************************************************************************** echoheader("options", "Categories"); echo<<
Add Category
 Name
 Icon URL
 Category Access
 
 What are categories and
 How to use them

HTML; $all_cats = file("./data/category.db.php"); $count_categories = 0; foreach($all_cats as $cat_line) { if($i%2 != 0){ $bg = "bgcolor=#F7F6F4"; }else{ $bg = ""; } $i++; $cat_arr = explode("|", $cat_line); $cat_arr[1] = stripslashes( preg_replace(array("'\"'", "'\''"), array(""", "'"), $cat_arr[1]) ); $cat_help_names[] = $cat_arr[1]; $cat_help_ids[] = $cat_arr[0]; $result .= "  $cat_arr[0] $cat_arr[1] "; if($cat_arr[2] != ""){ $result .= "\"$cat_arr[2]\""; } else{ $result .= "---"; } $result .= ""; $result .= ($cat_arr[3] == "" || $cat_arr[3] == "0") ? "---" : ""; $result .= ($cat_arr[3] == "1") ? "Only Admin" : ""; $result .= ($cat_arr[3] == "2") ? "Only Editors & Admin" : ""; $result .= " [edit] [delete] "; $count_categories ++; } if($count_categories == 0){ echo"


You havn't defined any categories yet
categories are optional and you can write your news without having categories
"; }else{ echo" Categories "; echo $result; echo"
 ID name icon restriction action
"; } echo" "; echofooter(); ?>