HTML;
msg("options", $echo['editCat'], $msg);
}
}
}
// ********************************************************************************
// DO Edit Category
// ********************************************************************************
elseif($action == "doedit")
{
$cat_name = htmlspecialchars(stripslashes($cat_name));
if(!$catid){ msg("error", $echo['error'], $echo['noIdCat'], "$PHP_SELF?mod=categories"); }
if($cat_name == ""){ msg("error", $echo['error'], $echo['insertCat'], "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", $echo['header']);
echo<<
HTML;
$all_cats = file("./data/category.db.php");
$count_categories = 0;
foreach($all_cats as $cat_line)
{
if($i%2 != 0){ $bg = "class=\"alternate\""; }else{ $bg = "class=\"alternate2\""; }
$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 .= " "; }
else{ $result .= "---"; }
$result .= " | ";
$result .= ($cat_arr[3] == "" || $cat_arr[3] == "0") ? "".$e_all."" : "";
$result .= ($cat_arr[3] == "1") ? "$e_admin" : "";
$result .= ($cat_arr[3] == "2") ? "$e_editor" : "";
$result .= " |
$e_actionEdit $e_actionDelete |
";
$count_categories ++;
}
if($count_categories == 0){
echo"
|
$e_empty $e_emptyInfo
|
";
}else{
echo"
";
}
echo"
";
echofooter();
?>