<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[5]!=1 && isset($_GET['action']))
  jump("jump.php?id=25&jump=main.php");
$phpcolor->table="nav";
if(isset($_GET['action']) and $_GET['action'] == "adddo")
{
  if($_POST['name']=="" || $_POST['link']=="" || $_POST['queue']=="")
    jump("jump.php?id=2&jump=nav.php");
  $phpcolor->field="name, link, type, queue";
  $phpcolor->where="'".$_POST['name']."', '".$_POST['link']."', '".$_POST['type']."', '".$_POST['queue']."'";
  $phpcolor->write();
  jump("jump.php?id=24&jump=nav.php");
}
if(isset($_GET['action']) and $_GET['action'] == "editdo")
{
  for($i=1;$i<=count($_POST['id']);$i++)
  {
    if($_POST['name'][$i]!="" && $_POST['link'][$i]!="" && $_POST['queue'][$i]!="")
	{
      $phpcolor->field="name = '".$_POST['name'][$i]."',link = '".$_POST['link'][$i]."',type = '".$_POST['type'][$i]."',queue = '".$_POST['queue'][$i]."'";
      $phpcolor->where="id='".$_POST['id'][$i]."'";
      $phpcolor->upgrade();
    }
  }
  jump("jump.php?id=24&jump=nav.php");
}
if(isset($_GET['action']) and $_GET['action'] == "del")
{
  $phpcolor->where="id = '".$_GET['id']."'";
  $phpcolor->delete(); 
  jump("jump.php?id=24&jump=nav.php");
}
$phpcolor->field="*";
$phpcolor->where="1 = 1 order by type , queue";
$nav=$phpcolor->assignment();
$tpl -> assign("nav", $nav);
$tpl -> display("nav.htm");
?>