<?php defined('SYSPATH') or die('No direct script access.'); require SMARTY . 'Smarty.class' . EXT; require MODPATH . 'admin.news' . EXT; $header = AdminNewsFactory::intance()->getheader(); $smarty = new Smarty(); $template_dir = TEMPLATES . 'templates' . DIRECTORY_SEPARATOR . 'admin'; $smarty->template_dir = $template_dir; $smarty->assign(AdminNewsFactory::intance()->getheader()); $smarty->assign(AdminNewsFactory::intance()->getData('add')); $smarty->assign(array('links' => array(), 'scripts' => array())); $smarty->assign(array('caption' => '新闻平台')); $smarty->display('index.tpl');
<?php defined('SYSPATH') or die('No direct script access.'); require SMARTY . 'Smarty.class' . EXT; require MODPATH . 'admin.news' . EXT; $smarty = new Smarty(); $template_dir = TEMPLATES . 'templates' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'news'; $smarty->assign(AdminNewsFactory::intance()->getheader()); $smarty->assign(AdminNewsFactory::intance()->getData('add', array('act' => 'list'))); $smarty->assign(array('links' => array(), 'scripts' => array())); $smarty->assign(array('caption' => '新闻列表', 'news_list' => AdminNewsFactory::intance()->getData('list'))); $smarty->template_dir = $template_dir; $smarty->display('list.tpl');
$htmlData = $_POST['content']; } } $htmlData = htmlspecialchars($htmlData); $smarty->assign(array('htmlData' => $htmlData)); $smarty->template_dir = $template_dir; $smarty->display('add.tpl'); if ($_POST) { $str = ob_get_contents(); $outpath = 'news/' . date('Ymd'); //.DIRECTORY_SEPARATOR.date('m').DIRECTORY_SEPARATOR.date('d'); if (!is_dir($outpath)) { mkdir($outpath); chmod($outpath, 0777); } $num = CommonFactory::Create()->random(10); $outfilename = $outpath . DIRECTORY_SEPARATOR . '' . $num . '.html'; $fp = @fopen($outfilename, 'w'); if (!$fp) { //Show_Error_Message( ERROR_WRITE_FILE ); echo 'error'; exit; } fwrite($fp, $str); fclose($fp); ob_end_clean(); $data = array('title' => $_POST['title'], 'subtitle' => $_POST['subtitle'], 'content' => $_POST['content']); AdminNewsFactory::intance()->setData($data); //@header ( "Location: ../../admin/news/msgs?msg=ok" ); echo "<script>self.location.href='../../admin/news/msgs?msg=ok&goto=admin/news/list';</script>"; }
<?php defined('SYSPATH') or die('No direct script access.'); require SMARTY . 'Smarty.class' . EXT; require MODPATH . 'admin.news' . EXT; $smarty = new Smarty(); $template_dir = TEMPLATES . 'templates' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'msg'; $smarty->assign(AdminNewsFactory::intance()->getheader()); $smarty->assign(AdminFactory::intance()->getData('msgs')); $smarty->assign(array('links' => array(), 'scripts' => array())); if ($_GET) { $param = array('msg' => $_GET['msg'], 'goto' => $_GET['goto']); } $msgs = AdminFactory::intance()->getData('msg', $param); $smarty->assign(array('caption' => '消息', 'msg' => $msgs, 'gotourl' => $param['goto'])); $smarty->template_dir = $template_dir; $smarty->display('msg.tpl');