| <?php class clsstyle { function clsstyle($do) { www.shengfang.org switch ($do) { case "add": www.shengfang.org $this->add(); break; case "add1": $this->add1(); break; case "show": $this->show(); break; case "del": www.shengfang.org $this->del(); break; case "edit": www.shengfang.org $this->edit(); break; case "edit1": $this->edit1(); break; } } function edit() { global $db,$tools,$stylename; $tools->index(); require"doc/style_edit_form.html"; } function edit1() { global $db,$tools,$name,$dir; $tools->index(); www.shengfang.org $dir=trim($dir); $dir=str_replace(" ","",$dir); if($dir==""){ $tools->goback("-1","模板地址不能为空"); exit; } if(!file_exists("./$dir")){ $tools->goback("-1","模板地址无法访问"); exit; www.shengfang.org } echo $dir; $tools->goback("-1","修改成功,请返回"); $db->UpdateStyle($name,$dir); //$itpl->editfile("../data/style/list.php","$id","\n","$name|$dir"); /*$itpl->writetofile("../data/style/$name.php","<?\$tpl$name='$dir';?>","w+");*/ } function del() www.shengfang.org { global $db,$tools,$stylename; $tools->index(); $db->DelStyle($stylename); //$itpl->deletefromfile("../data/style/list.php","$id","\n"); // at unlink(" dot ./data/style/$stylename.php"); $tools->goback("-1","删除成功,请返回"); } function show() www.shengfang.org { global $db,$tools; $tools->index(); $arr=$db->GetStyleAry(); $total=count($arr); if ($total<2) $total=0; require"doc/stylelist.html"; } function add1() { www.shengfang.org //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)){ $tools->goback("-1","风格名称只能字母子,数字,下划线的组合"); exit; } $dir=str_replace(" ","",$dir); if($dir==""){ $tools->goback("-1","模板地址不能为空"); exit; } if(!file_exists("./$dir")){ $tools->goback("-1","模板地址无法访问"); exit; www.shengfang.org } $db->AddStyle($name,$dir); $tools->goback("-1","添加成功,请返回"); } function add() { //require"./doc/header.html"; global $tools; $tools->index(); require"doc/style.html"; } } www.shengfang.org ?> 字体:大 中 小 |
![]() | 永久地址 http://www.shengfang.org/blog/p/iwas14style.php |
![]() | 引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1125196477 |
2005年8月28日10:34星期日 [Dev开发]





