<?php
include(dirname(__FILE__)."/require.php");
$phpcolor->table="plugin";
if(isset($_GET['action']) and $_GET['action'] == "adddo")
{
  if($_POST['name']=="" || $_POST['link']=="")
    jump("jump.php?id=2&jump=plugin.php");
  $phpcolor->field="name, link, type, state";
  $phpcolor->where="'".$_POST['name']."', '".$_POST['link']."', '".$_POST['type']."', '".$_POST['state']."'";
  $phpcolor->write();
  jump("jump.php?id=24&jump=plugin.php");
}
elseif(isset($_GET['action']) and $_GET['action'] == "editdo")
{
  for($i=1;$i<=count($_POST['id']);$i++)
  {
    if($_POST['name'][$i]!="" && $_POST['link'][$i]!="")
	{
      $phpcolor->field="name = '".$_POST['name'][$i]."',link = '".$_POST['link'][$i]."',type = '".$_POST['type'][$i]."',state = '".$_POST['state'][$i]."'";
      $phpcolor->where="id='".$_POST['id'][$i]."'";
      $phpcolor->upgrade();
    }
  }
  jump("jump.php?id=24&jump=plugin.php");
}
else
{
  if(!isset($_GET['page']))
    $_GET['page']=0;
  $phpcolor->field="*";
  $phpcolor->where="1=1";
  $plugin=$phpcolor->assignment();
  $tpl -> assign("plugin", $plugin);
  $tpl -> display("plugin.htm");
}
?>