Location: PHPKode > projects > Astanda Open Directory Project > adp-1.3b/admin/categories.php
<?php
//-------------------------------------------------//
//                                                 //
//        ASTANDA DIRECTORY PROJECT  [ADP]         //
//                  Version 1.3b                   //
//               License: SHAREWARE                //
//             http://www.astanda.com              //
//      © Copyright 2005, 2006, Pavel Golovko      //
//                                                 //
//-------------------------------------------------//
//                                                 //
// Any attempt to remove or alter "Powered by ADP" //
// recip link will automatically wave your rights  //
// to any use of ADP software!                     //
//                                                 //
// Reverse engineering and redistribution of       //
// ADP code or any part of its code is strictly    //
// prohibited!                                     //
//                                                 //
//-------------------------------------------------//
//                                                 //
// ADP is distributed in the hope that it will be  //
// useful, but WITHOUT ANY WARRANTY; without even  //
// the implied warranty of MERCHANTABILITY or      //
// FITNESS FOR A PARTICULAR PURPOSE.               //
//                                                 //
//-------------------------------------------------//

menu($adp); switch ($action) { case "main": ?> Date - the date when this category was last indexed. Subcategories are resorted again under parent categories.<br> <img src="images/edit.png"> - edit category.<br> <img src="images/spider.png"> - reindex all links within category, but not subcategories.<br> <img src="images/delete.png"> - delete category, including subcategories, and all links within.<p> <table width="100%" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"><tr><td> <table width="100%" cellspacing="1" cellpadding="3" border="0"> <tr bgcolor="#CCCCCC"><td></td> <td><font size="1">Title (<a href="index.php?adp=categories&action=main&orderby=title&how=ASC"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=categories&action=main&orderby=title&how=DESC"><img border=0 src="images/desc.png"></a>)</font></td> <td></td> <td nowrap><font size="1">Date (<a href="index.php?adp=categories&action=main&orderby=date&how=ASC"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=categories&action=main&orderby=date&how=DESC"><img border=0 src="images/desc.png"></a>)</font></td> <td></td></tr> <?main_cats(0,0,$orderby,$how);?> <tr bgcolor="#CCCCCC"><td></td> <td><font size="1">Title (<a href="index.php?adp=categories&action=main&orderby=title&how=ASC"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=categories&action=main&orderby=title&how=DESC"><img border=0 src="images/desc.png"></a>)</font></td> <td></td> <td><font size="1">Date (<a href="index.php?adp=categories&action=main&orderby=date&how=ASC"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=categories&action=main&orderby=date&how=DESC"><img border=0 src="images/desc.png"></a>)</font></td> <td></td></tr> </table></td></tr></table> <? break; case "add": ?> <form action="index.php" method="POST"><input type="hidden" name="adp" value="categories"><input type="hidden" name="action" value="insert"> <b>Category title:</b><br><input type="text" name="title" value="" size="80"><br> This is the title of your sub/category.<br>Example: <b>Apples & Oranges</b><hr><p> <b>Category name:</b><br><input type="text" name="path" value="" size="80"><br> Category name is the path name.<br>Example: If your category title is <b>Apples & Oranges</b>, then the path name should be <b>Apples_and_Oranges</b><hr><p> <b>Category description:</b><br><textarea rows="5" name="description" cols="60"></textarea><br> This description will also be used in Description meta tags for this category. If you leave this field empty, then your default directory description will be used.<hr><p> <b>Category keywords:</b><br><textarea rows="5" name="keywords" cols="60"></textarea><br> These keywords will be used in Keywords meta tags for this category. If you leave this field empty, then your default directory keywords will be used.<hr><p> <b>Parent category:</b><br> <select name="parent"> <option value="0">root/</option> <? list_cats (0,0,0,0); ?> </select><br> Where would you like to place this category?<hr><p> <input type="submit" value="Add category!"></form> <? break; case "edit": where_ami($_REQUEST['category_id']); print "<p>"; $query = "SELECT * FROM categories WHERE `id` = ".$_REQUEST['category_id']." LIMIT 1"; $result = mysql_query($query); echo mysql_error(); if (mysql_num_rows($result) <> '') { while ($row = mysql_fetch_array($result)) { ?> <form action="index.php" method="POST"><input type="hidden" name="adp" value="categories"><input type="hidden" name="action" value="update"> <input type="hidden" name="id" value="<?=$_REQUEST['category_id']?>"> <b>Category title:</b><br><input type="text" name="title" value="<?=$row['title']?>" size="80"><br> This is the title of your sub/category.<br>Example: <b>Apples & Oranges</b><hr><p> <b>Category name:</b><br><input type="text" name="path" value="<?=$row['path']?>" size="80"><br> Category name is the path name.<br>Example: If your category title is <b>Apples & Oranges</b>, then the path name should be <b>Apples_and_Oranges</b><hr><p> <b>Category description:</b><br><textarea rows="5" name="description" cols="60"><?=$row['description']?></textarea><br> This description will also be used in Description meta tags for this category. If you leave this field empty, then your default directory description will be used.<hr><p> <b>Category keywords:</b><br><textarea rows="5" name="keywords" cols="60"><?=$row['keywords']?></textarea><br> These keywords will be used in Keywords meta tags for this category. If you leave this field empty, then your default directory keywords will be used.<hr><p> <b>Parent category:</b><br> <select name="parent"> <option value="0">root/</option> <? list_cats (0,0,$_REQUEST['category_id'],$row['parent']); ?> </select><br> Where would you like to place this category?<hr><p> <input type="submit" value="Save Category!"></form> <? } } break; case "delete": if($demo == "1"){ print "DISABLED IN DEMO MODE"; } else { $list = implode(",", get_cats($_REQUEST['cat_id'])); mysql_query("DELETE FROM `links` WHERE `category_id` in ($list)"); echo mysql_error(); mysql_query("DELETE FROM `categories` WHERE `id` in ($list)"); echo mysql_error(); ?> Deleted category ID:<?=$list?> <? } break; case "insert": if($demo == "1"){ print "DISABLED IN DEMO MODE"; } else { mysql_query("INSERT INTO categories (title, description, keywords, parent, path) VALUES ('".$_REQUEST['title']."', '".$_REQUEST['description']."', '".$_REQUEST['keywords']."', '".$_REQUEST['parent']."', '".$_REQUEST['path']."')"); echo mysql_error(); ?> Inserting new category...<p> Parent ID: <?=$_REQUEST['parent']?><br> Title: <?=$_REQUEST['title']?><br> Name: <?=$_REQUEST['path']?><br> Description: <?=$_REQUEST['description']?><br> Keywords: <?=$_REQUEST['keywords']?><br> <? } break; case "update": if($demo == "1"){ print "DISABLED IN DEMO MODE"; } else { mysql_query("UPDATE `categories` SET `parent` = '".$_REQUEST['parent']."', `title` = '".$_REQUEST['title']."', `path` = '".$_REQUEST['path']."', `description` = '".$_REQUEST['description']."', `keywords` = '".$_REQUEST['keywords']."' WHERE `id` = '".$_REQUEST['id']."' LIMIT 1"); echo mysql_error(); ?> Updating category ...<P> ID: <?=$_REQUEST['id']?><br> Parent ID: <?=$_REQUEST['parent']?><br> Title: <?=$_REQUEST['title']?><br> Name: <?=$_REQUEST['path']?><br> Description: <?=$_REQUEST['description']?><br> Keywords: <?=$_REQUEST['keywords']?><br> <? } break; }
?>
Return current item: Astanda Open Directory Project