<?php
class clsstyle
&leftsign;
 function clsstyle($do)
 &leftsign; www.yippeesoft.com
  switch ($do)
  &leftsign;
   case "add": www.yippeesoft.com
    $this->add();
    break;
   case "add1":
    $this->add1();
    break;
   case "show":
    $this->show();
    break;
   case "del": www.yippeesoft.com
    $this->del();
    break;  
   case "edit":   www.yippeesoft.com
    $this->edit();
    break;
   case "edit1":  
    $this->edit1();
    break;
  &rightsign;
 &rightsign;
 function edit()
 &leftsign;
  global $db,$tools,$stylename;
  $tools->index();
     require"doc/style_edit_form.html";
 &rightsign;
 function edit1()
 &leftsign;
  global $db,$tools,$name,$dir;
  
  $tools->index(); www.yippeesoft.com
      $dir=trim($dir);
   $dir=str_replace(" ","",$dir);
   if($dir=="")&leftsign;
     $tools->goback("-1","模板地址不能为空");
  exit;
   &rightsign;
   if(!file_exists("./$dir"))&leftsign;
     $tools->goback("-1","模板地址无法访问");
  exit; www.yippeesoft.com
   &rightsign;
   echo $dir;
   $tools->goback("-1","修改成功,请返回");
   $db->UpdateStyle($name,$dir);
   //$itpl->editfile("../data/style/list.php","$id","\\n","$name&line;$dir");
   /*$itpl->writetofile("../data/style/$name.php","<?\\$tpl$name=\’$dir\’;?>","w+");*/
 &rightsign;
 function del() www.yippeesoft.com
 &leftsign;
  global $db,$tools,$stylename;
  $tools->index();
  $db->DelStyle($stylename);
  //$itpl->deletefromfile("../data/style/list.php","$id","\\n");
    //@unlink("../data/style/$stylename.php");
    $tools->goback("-1","删除成功,请返回");
 &rightsign;
 
 function show() www.yippeesoft.com
 &leftsign;
  global $db,$tools;
  $tools->index();
  $arr=$db->GetStyleAry();
  $total=count($arr);
  if ($total<2)
   $total=0;
  require"doc/stylelist.html";
 &rightsign;
 function add1()
 &leftsign; www.yippeesoft.com
  //require"./doc/header.html";
  global $db,$tools;
  $tools->index();
  print_r($_POST);
  $name=trim($_POST["name"]);
    $dir=trim($_POST["dir"]);
    if(!ereg("^[a-zA-Z0-9_]*$",$name))&leftsign;
      $tools->goback("-1","风格名称只能字母子,数字,下划线的组合");
   exit;
    &rightsign;
    $dir=str_replace(" ","",$dir);
    if($dir=="")&leftsign;
      $tools->goback("-1","模板地址不能为空");
   exit;
    &rightsign;
    if(!file_exists("./$dir"))&leftsign;
      $tools->goback("-1","模板地址无法访问");
   exit; www.yippeesoft.com
    &rightsign;
    $db->AddStyle($name,$dir);   
    $tools->goback("-1","添加成功,请返回");
 &rightsign;
 function add()
 &leftsign;
  //require"./doc/header.html";
  global $tools;
  $tools->index();
  require"doc/style.html";
 &rightsign;
&rightsign; www.yippeesoft.com
?>

历史博文

该日志未加标签。
八月 28, 2005 at 10:34 上午 by yippee 1,006 次
Category: Dev