| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 | <?php /** * 邮件模版管理 */require_once( ONU_ROOT . 'application/module/ctrl/Action.class.php');require_once ( ONU_ROOT . 'application/lib/data/adminAction.php');class Email_template_adminAction extends Action{		public function __construct(){		parent::__construct();		if(empty($_SESSION['mds_user'])){			header("Location:/?a=index&m=admin_login");			exit();		}//		$this->checkAdministratorRight('3');			}		function index(){		require_once (ONU_ROOT . "frame/Page.class.php");		$admin = new AdvertAdminAction();		$where = "where uid='{$_SESSION['user_infos']['id']}' and type=1 ";		$page     = $_REQUEST['page']?$_REQUEST['page']:1;		$pageSize = 5;		$n        = ($page-1)*$pageSize;		$pa       = "";//查询参数		$limit = " $n,$pageSize";		$info           = $_REQUEST['info'];		$error			= $_REQUEST['error'];		$uname          = $_SESSION['user_infos']['uname'];		$list  = $admin->select_msg_list($where,$limit);		$all_total = $admin->select_msg_count($where);		$p = new Page($all_total,$pageSize,$pa);		$pp = $p->fpage();		$status_array = array(			'1' => '开启',			'2' => '禁用',		);		$this->assign('status_array',$status_array);		$this->assign('info',$info);		$this->assign('error',$error);		$this->assign('page',$page);		$this->assign("show",$pp);		$this->assign('list',$list);		$this->assign('uname',$uname);		$this->display('index.html');	}			function add(){		$admin = new AdvertAdminAction();//		$_POST['msg_content'] = str_replace("\n","<br/>",$_POST['msg_content']);		$msg_content	= $_POST['msg_content'];		$data['uid'] = $_SESSION['user_infos']['id'];		$data['msg_title'] = addslashes($_POST['msg_title']);		$data['msg_content'] = addslashes($msg_content);		$data['status'] = $_POST['status'];		$data['add_time'] = time();		$data['update_time'] = time();		$data['type'] = 1;		if($_POST['msg_content']|| $_POST['msg_title']){						if(!empty($data['msg_title']) && !empty($data['msg_content']) ){									$add = $admin->add_email_msg($data);									if($add){					$info = "添加邮件模板成功";					header("Location:/?a=email_template_admin&m=index&info=$info");					exit();				}else{					$info = "添加失败";				}								}else{				$info = "模板标题、内容均不能为空";			}		}		$this->assign('data',$data);		$this->assign('info',$info);		$this->display('add.html');	}				function update(){		$admin = new AdvertAdminAction();		$id				= $_REQUEST['id'];				$one_info 		= $admin->select_one_template($id);//		$one_info['msg_content'] = str_replace("<br/>","\n",$one_info['msg_content']);//		$_POST['msg_content'] = str_replace("\n","<br/>",$_POST['msg_content']);		$msg_content	= addslashes($_POST['msg_content']);		$data['msg_title'] = addslashes($_POST['msg_title']);		$data['msg_content'] = $msg_content;		$data['status'] = $_POST['status'];		$data['update_time'] = time();				if($_POST['msg_title'] || $_POST['msg_content']){							if(!empty($data['msg_title']) && !empty($data['msg_content']) ){									$update = $admin->update_email_msg($data, $id,$_SESSION['user_infos']['id']);									if($update){					$info = "修改邮件模板成功";					header("Location:/?a=email_template_admin&m=index&info=$info");					exit();				}else{					$info = "修改失败";				}								}else{				$info = "模板标题、内容均不能为空";			}		}			$one_info 		= $admin->select_one_template($id);//		$one_info['msg_content'] = str_replace("<br/>","\n",$one_info['msg_content']);//		$one_info['msg_content'] =  htmlspecialchars(stripslashes($one_info['msg_content']));		$this->assign('id',$id);		$this->assign('one_info',$one_info);		$this->assign('info',$info);		$this->display('update.html');	}		//删除就是改状态为禁用	public function delete(){				$admin = new AdvertAdminAction();				$id	   = $_REQUEST['id'];		$status = $_REQUEST['status'];				if(!empty($id)){			$delete = $admin->deleteEmailTemplate($status,$id,$_SESSION['user_infos']['id']);			$info = "禁用成功";		}else{			$error = "禁用失败";		}				header("Location:/?a=email_template_admin&m=index&info=$info&error=$error");		exit();	}	//end class}?>
 |