uid(); $page_content=""; if(!file_exists(XOOPS_ROOT_PATH."/modules/tadtools/ck.php")){ redirect_header("http://www.tad0616.net/modules/tad_uploader/index.php?of_cat_sn=50",3, _TAD_NEED_TADTOOLS); } include_once XOOPS_ROOT_PATH."/modules/tadtools/ck.php"; $fck=new CKEditor("tad_ebook","page_content",$page_content); $fck->setHeight(350); $editor=$fck->render(); $xoopsTpl->assign('editor' , $editor); //安全機制 include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); $XoopsFormHiddenToken=new XoopsFormHiddenToken(); $HiddenToken = $XoopsFormHiddenToken->render(); $xoopsTpl->assign('HiddenToken' , $HiddenToken); //取出可投稿期數資料 $myts =& MyTextSanitizer::getInstance(); //2015-04-25 10:47:56 $today=date("Y-m-d H:i:s"); $tbl=$xoopsDB->prefix('tad_ebook'); $sql="select * from `{$tbl}` where `ebook_post_date` > '{$today}' order by `ebook_post_date` limit 0,1"; $result=$xoopsDB->query($sql) or redirect_header("index.php",3, mysql_error()); $ebook=$xoopsDB->fetchArray($result); $ebook['ebook_title']=$myts->htmlSpecialChars($ebook['ebook_title']); $ebook['ebook_post_date']=$myts->htmlSpecialChars($ebook['ebook_post_date']); $ebook['ebook_publish_date']=$myts->htmlSpecialChars($ebook['ebook_publish_date']); $xoopsTpl->assign('ebook' , $ebook); }else{ redirect_header(XOOPS_URL."/user.php",3, "請先登入,才能投稿。"); } $xoopsTpl->assign('uid' , $uid); } //儲存文章 function insert_page(){ global $xoopsDB,$xoopsUser; include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); //安全判斷 if(!$GLOBALS['xoopsSecurity']->check()){ //錯誤訊息 $error=implode("" , $GLOBALS['xoopsSecurity']->getErrors()); //轉向到首頁 redirect_header($_SERVER['PHP_SELF'],3, $error); } $myts =& MyTextSanitizer::getInstance(); $page_title=$myts->addSlashes($_POST['page_title']); $page_content=$myts->addSlashes($_POST['page_content']); $page_tag=$myts->addSlashes($_POST['page_tag']); $ebook_sn=intval($_POST['ebook_sn']); $page_author=$xoopsUser->name(); if(empty($page_author)){ $page_author=$xoopsUser->uname(); } $uid=$xoopsUser->uid(); $page_post_time=date("Y-m-d H:i:s"); $tbl=$xoopsDB->prefix('tad_ebook_page'); $sql="insert into `{$tbl}` (`ebook_sn`, `page_title`, `page_content`, `page_author`, `uid`, `page_sort`, `page_status`, `page_post_time`, `page_counter`, `page_tag`) values('{$ebook_sn}' , '{$page_title}' ,'{$page_content}' ,'{$page_author}' ,'{$uid}' ,'0' ,'0' , '{$page_post_time}' ,'0' ,'{$page_tag}')"; $xoopsDB->queryF($sql) or die(mysql_error()); $page_sn=$xoopsDB->getInsertId(); return $page_sn; } /*-----------執行動作判斷區----------*/ $op=empty($_REQUEST['op'])?"":$_REQUEST['op']; switch($op){ case "insert_page": $page_sn=insert_page(); header("location: index.php?page_sn={$page_sn}"); exit; break; default: edit_form(); break; } /*-----------秀出結果區--------------*/ $xoopsTpl->assign( "toolbar" , toolbar_bootstrap($interface_menu)) ; include_once XOOPS_ROOT_PATH.'/footer.php'; ?> ```
進階搜尋
69人線上 (8人在瀏覽線上書籍)
會員: 0
訪客: 69