| Current Path : /home/zqegovsj/public_html/us3.supplierlist.com/webmaster/ |
| Current File : /home/zqegovsj/public_html/us3.supplierlist.com/webmaster/templet.php |
<?php
$inc_path = "../haibo/cn/";$ua_sm_compile_dir = "ua-admin/";
require($inc_path."global.php");
require($inc_path .APP_NAME. 'configs/db_session.php');
uses("templet");
require($inc_path.APP_NAME.'include/page_admin.php');
require("session_cp.inc.php");
$templet = new Templets();
$conditions = null;
$tpl_file = "templet_index";
function search_templets()
{
@chdir(BASE_DIR."templates".DS."member");
$handle = @opendir(BASE_DIR."templates".DS."member");
while($dir = @readdir($handle))
{
if (is_dir($dir) and $dir<>"." and $dir<>"..")
$t[] = strtolower($dir);
}
closedir($handle);
return $t;
}
if ($_GET['action'] == "del" && $_GET['id']) {
$templet->del($_GET['id']) ;
}
if (isset($_POST['del']) and is_array($_POST['id'])) {
$result = $templet->del($_POST['id']);
}
if (isset($_POST['save']) && !empty($_POST['templet']['title'])) {
$vals = array();
$vals = $_POST['templet'];
array_walk($vals, "uatrim");
if ($_POST['id']) {
$result = $templet->save($vals, "update", $_POST['id']);
}else{
$result = $templet->save($vals);
}
if($result){
flash("./alert.php");
}else{
flash("./alert.php","./templet.php", null, 0);
}
}
if($_GET['action'] == "mod"){
$templet_id = intval($_GET['id']);
setvar("t",$templet->read(null, $templet_id));
$tpl_file = "templet_edit";
}elseif($_GET['action'] = "list"){
$amount = $templet->findCount($conditions);
pageft($amount,15);
$tmp_templets = $templet->findAll($templet->getFieldAliasNames(), null, " Templet.id DESC",$firstcount,$displaypg);
setvar("TempletList",$tmp_templets);
setvar("Amount",$amount);
setvar("PageHeader",$page_header);
setvar("ByPages",$pagenav);
}
template("ua-admin/".$tpl_file);
if ($_GET['action']=="list") {
$folder_templets = search_templets();
foreach ($tmp_templets as $key=>$val) {
$db_templets[] = strtolower($val['TempletTitle']);
}
}
?>