<?php include 'base.php'; User::protect(); include_class('links'); $section = 'links'; $page_title = 'View/Edit Links'; $category_id = $_GET['category_id'] > 0 && is_numeric($_GET['category_id']) ? $_GET['category_id'] : 0; $lc = LinkCategory::get($category_id); if (!db::isError($l)) { switch ($_GET['task']) { case 'deactivate': $res = $lc->deactivate(); if (!db::isError($res)) { header('Location: links.php?category_id=' . $category_id); } break; case 'activate': $res = $lc->activate(); if (!db::isError($res)) { header('Location: links.php?category_id=' . $category_id); } break; case 'delete': $res = $lc->remove(); if (!db::isError($res)) { header('Location: links.php'); } break; } }
function getCategoryTrail() { $trail = array(); $trail[$this->ID] = $this; $currentParent = $this->parent_id; while ($currentParent > 0) { $q = "SELECT ID, parent_id FROM Links_Categories WHERE ID = {$currentParent}"; $r = mysql_query($q); if ($r) { $row = mysql_fetch_assoc($r); $trail[$currentParent] = LinkCategory::get($row['ID']); $currentParent = $row['parent_id']; } else { $e = new Error(); $e->add(mysql_error()); return $e; } } $trail = array_reverse($trail); return $trail; }