:::

18-3 上課範例:view.php

<?php
/*** 引入檔案 ***/
include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH."/header.php";
include_once 'function.php';

$xoopsOption['template_main'] = "tad_note_view.html";

/*** 函數檔 ***/

//顯示文章列表或單一文章
function show_doc($note_sn=''){
  global $xoopsDB, $xoopsUser, $xoopsModuleConfig, $xoopsTpl, $xoopsModule;

  $perm_name = 'tad_note_perm';
  $perm_itemid = 1;
  if($xoopsUser)
  {
  	$groups = $xoopsUser->getGroups();
  }else{
  	$groups = XOOPS_GROUP_ANONYMOUS;
  }
  $module_id = $xoopsModule->getVar('mid');
  $gperm_handler =& xoops_gethandler('groupperm');
  if($gperm_handler->checkRight($perm_name, $perm_itemid, $groups, $module_id))
  {
    $now_uid=($xoopsUser)?$xoopsUser->uid():"";

    $myts =& MyTextSanitizer::getInstance();


    $sql="select * from ".$xoopsDB->prefix("tad_notes")." where `note_sn`='$note_sn' and `note_public`='1'";
    $result=$xoopsDB->query($sql) or redirect_header('index.php', 3, mysql_error());
    $doc=$xoopsDB->fetchArray($result);

    $doc['note_title'] = $myts->htmlSpecialChars($doc['note_title']);
    $doc['note_date'] = $myts->htmlSpecialChars($doc['note_date']);
    $doc['note_content'] = $myts->displayTarea($doc['note_content'], 1, 1, 0, 1, 0);


    $xoopsTpl->assign("note_title",$doc['note_title']);
    $xoopsTpl->assign("note_date", $doc['note_date']);
    $xoopsTpl->assign("note_content",$doc['note_content']);
  }else{
    $xoopsTpl->assign("note_title","無觀看權限");
    $xoopsTpl->assign("note_date", "");
    $xoopsTpl->assign("note_content","");
  }
}

/*** 流程判斷 ***/
$op = empty($_REQUEST['op'])? "" : $_REQUEST['op'];
$note_sn = empty($_REQUEST['note_sn'])? "" : intval($_REQUEST['note_sn']);

show_doc($note_sn);

include_once XOOPS_ROOT_PATH.'/include/comment_view.php';
include_once XOOPS_ROOT_PATH.'/footer.php';
?>

:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D678%26tbsn%3D22

書籍目錄

展開 | 闔起

線上使用者

62人線上 (20人在瀏覽線上書籍)

會員: 0

訪客: 62

更多…