Example #1
0
function boardList($sql, &$list)
{
    global $db, $cache, $patt, $listitem, $config, $cat, $valid_date, $index, $page;
    $datas = $cache->get($sql);
    if (!$datas) {
        $datas = $db->customQuery($sql);
        $cache->save($sql, $datas);
    }
    foreach ($datas as $item) {
        $ctiime = $item['comment_date'] > 0 ? $item['comment_date'] : $item['last_update'];
        $replace = array();
        $replace[] = $item['id'];
        if ($item['pin'] > 0) {
            $replace[] = WEB_URL . '/' . SKIN . 'board/img/pin.png';
        } elseif (is_file(DATA_PATH . "board/thumb-{$item['picture']}")) {
            $replace[] = DATA_URL . "board/thumb-{$item['picture']}";
        } elseif (is_file(DATA_PATH . "board/{$item['picture']}")) {
            $replace[] = DATA_URL . "board/{$item['picture']}";
        } else {
            $replace[] = WEB_URL . "/{$index['default_icon']}";
        }
        $replace[] = gcms::getURL($index['module'], '', $cat, 0, "wbid={$item['id']}");
        $replace[] = $item['topic'];
        $replace[] = (int) $item['member_id'];
        $replace[] = $item['sender'];
        $replace[] = $item['status'];
        $replace[] = gcms::mktime2date($item['create_date']);
        $replace[] = date(DATE_ISO8601, $item['create_date']);
        $replace[] = number_format($item['visited']);
        $replace[] = number_format($item['comments']);
        $replace[] = $item['comment_date'] == 0 ? ' ' : gcms::mktime2date($item['comment_date']);
        $replace[] = $item['comment_date'] == 0 ? ' ' : $item['commentator'];
        $replace[] = (int) $item['commentator_id'];
        $replace[] = $item['replyer_status'];
        $replace[] = $ctiime >= $valid_date ? $item['comment_date'] > 0 ? ' update' : ' new' : '';
        $list[] = preg_replace($patt, $replace, $listitem);
    }
}
Example #2
0
echo sitemap(WEB_URL . '/index.php', $cdate);
// query โมดูลที่ติดตั้งแล้วทั้งหมด
$sql = "SELECT M.`module`,M.`owner`,I.`language`,M.`id`";
$sql .= " FROM `" . DB_MODULES . "` AS M";
$sql .= " LEFT JOIN `" . DB_INDEX . "` AS I ON I.`module_id`=M.`id` AND I.`index`='1'";
$datas = $cache->get($sql);
if (!$datas) {
    $datas = $db->customQuery($sql);
    $cache->save($sql, $datas);
}
$modules = array();
$owners = array();
foreach ($datas as $item) {
    $modules[$item['id']] = $item['module'];
    $owners[$item['owner']][] = $item['id'];
    echo sitemap(gcms::getURL($item['module'], '', 0, 0, $item['language'] == '' ? '' : "lang={$item['language']}", false), $cdate);
}
// modules
$dir = ROOT_PATH . 'modules/';
$f = @opendir($dir);
if ($f) {
    while (false !== ($owner = readdir($f))) {
        if ($owner != '.' && $owner != '..') {
            if (is_file($dir . "{$owner}/sitemap.php")) {
                include $dir . "{$owner}/sitemap.php";
            }
        }
    }
    closedir($f);
}
echo '</urlset>';
Example #3
0
 } else {
     // breadcrumbs
     $breadcrumb = gcms::loadtemplate($index['module'], '', 'breadcrumb');
     $breadcrumbs = array();
     // หน้าหลัก
     $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', $canonical, $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
     // โมดูล
     if ($index['module'] != $module_list[0]) {
         if (isset($install_modules[$index['module']]['menu_text'])) {
             $m = $install_modules[$index['module']]['menu_text'];
             $t = $install_modules[$index['module']]['menu_tooltip'];
         } else {
             $m = ucwords($index['module']);
             $t = $m;
         }
         $canonical = gcms::getURL($index['module']);
         $breadcrumbs['MODULE'] = gcms::breadcrumb('', $canonical, $t, $m, $breadcrumb);
     }
     // อัปเดทการเปิดดู
     if (!isset($_REQUEST['visited'])) {
         $index['visited']++;
         $db->edit(DB_INDEX, $index['id'], array('visited' => $index['visited']));
     }
     $cache->save($sql, $index);
     // แทนที่ลงใน template ของโมดูล
     $patt = array('/{BREADCRUMS}/', '/{TOPIC}/', '/{DETAIL}/', '/{MODULE}/');
     $replace = array();
     $replace[] = implode("\n", $breadcrumbs);
     $replace[] = $index['topic'];
     $replace[] = gcms::showDetail($index['detail'], true, false);
     $replace[] = $module;
Example #4
0
<?php

// modules/event/sitemap.php
if (is_array($owners['event'])) {
    $sql = "SELECT `id`,`begin_date`,`module_id`";
    $sql .= " FROM `" . DB_EVENTCALENDAR . "`";
    $sql .= " WHERE `module_id` IN(" . implode(',', $owners['event']) . ") AND `published`='1' AND `published_date`<='{$cdate}'";
    $datas = $cache->get($sql);
    if (!$datas) {
        $datas = $db->customQuery($sql);
        $cache->save($sql, $datas);
    }
    foreach ($datas as $item) {
        echo '<url>';
        echo '<loc>' . gcms::getURL($modules[$item['module_id']], '', 0, 0, "id={$item['id']}") . '</loc>';
        list($d, $t) = explode(' ', $item['begin_date']);
        echo '<lastmod>' . $d . '</lastmod>';
        echo '<changefreq>daily</changefreq>';
        echo '<priority>0.5</priority>';
        echo '</url>';
    }
}
Example #5
0
<?php

// modules/member/dologin.php
if (defined('MAIN_INIT')) {
    // title
    $title = $lng['LNG_LOGIN'];
    // breadcrumbs
    $breadcrumb = gcms::loadtemplate('member', '', 'breadcrumb');
    $breadcrumbs = array();
    // หน้าหลัก
    $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
    // url ของหน้านี้
    $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('dologin'), strip_tags($lng['LNG_LOGIN_TITLE']), $lng['LNG_LOGIN'], $breadcrumb);
    if (!gcms::isMember()) {
        // อ่านข้อมูลจาก cookie
        $login_email = empty($_COOKIE[PREFIX . '_login_email']) ? '' : gcms::decode($_COOKIE[PREFIX . '_login_email']);
        $login_password = empty($_COOKIE[PREFIX . '_login_password']) ? '' : gcms::decode($_COOKIE[PREFIX . '_login_password']);
        $login_remember = empty($_COOKIE[PREFIX . '_login_remember']) ? 0 : (int) $_COOKIE[PREFIX . '_login_remember'];
        if (!empty($config['custom_login']) && is_file(ROOT_PATH . $config['custom_login'])) {
            // custom login form
            include_once ROOT_PATH . $config['custom_login'];
        } else {
            // ฟอร์ม login
            $patt = array('/{BREADCRUMS}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{WEBTITLE}/', '/{SUBTITLE}/', '/{EMAIL}/', '/{PASSWORD}/', '/{REMEMBER}/', '/{WEBURL}/', '/{FACEBOOK}/', '/{NEXT}/');
            $replace = array();
            $replace[] = implode("\n", $breadcrumbs);
            $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
            $replace[] = $config['web_title'];
            $replace[] = empty($error) ? $config['web_description'] : '<span class=error>' . $error . '</span>';
            $replace[] = $login_email;
            $replace[] = $login_password;
Example #6
0
 // template
 $skin = gcms::loadfile(ROOT_PATH . 'widgets/relate/widgetitem.html');
 $patt = array('/{BG}/', '/{URL}/', '/{TOPIC}/', '/{DETAIL}/', '/{CATEGORY}/', '/{DATE}/', '/{UID}/', '/{SENDER}/', '/{STATUS}/', '/{COMMENTS}/', '/{VISITED}/', '/{THUMB}/', '/{ICON}/');
 $widget = array();
 $bg = 'bg2';
 foreach ($datas as $i => $item) {
     if ($i > 0 && $i % $match[2] == 0) {
         $widget[] = '</div><div class="row ' . $styles . 'view">';
     }
     $bg = $bg == 'bg1' ? 'bg2' : 'bg1';
     $replace = array();
     $replace[] = "{$bg} background" . rand(0, 5);
     if ($config['module_url'] == '1') {
         $replace[] = gcms::getURL($index['module'], $item['alias']);
     } else {
         $replace[] = gcms::getURL($index['module'], '', 0, $item['id']);
     }
     $replace[] = $item['topic'];
     $replace[] = $item['description'];
     $replace[] = gcms::ser2Str($item, 'category');
     $replace[] = gcms::mktime2date($item['create_date'], 'd M Y');
     $replace[] = $item['member_id'];
     $replace[] = $item['displayname'] == '' ? $item['email'] : $item['displayname'];
     $replace[] = $item['status'];
     $replace[] = number_format($item['comments']);
     $replace[] = number_format($item['visited']);
     if ($item['picture'] != '' && is_file(DATA_PATH . "document/{$item['picture']}")) {
         $replace[] = DATA_URL . "document/{$item['picture']}";
     } else {
         $replace[] = WEB_URL . "/{$index['default_icon']}";
     }
Example #7
0
<?php

// modules/board/sitemap.php
if (isset($owners['board'])) {
    $sql = "SELECT `id`,`module_id`,`last_update`,`comment_date`";
    $sql .= " FROM `" . DB_BOARD_Q . "` WHERE `module_id` IN(" . implode(',', $owners['board']) . ")";
    $datas = $cache->get($sql);
    if (!$datas) {
        $datas = $db->customQuery($sql);
        $cache->save($sql, $datas);
    }
    foreach ($datas as $item) {
        $link = gcms::getURL($modules[$item['module_id']]) . "?wbid={$item['id']}";
        echo '<url>';
        echo "<loc>{$link}</loc>";
        echo '<lastmod>' . date("Y-m-d", $item['comment_date'] > 0 ? $item['comment_date'] : $item['last_update']) . '</lastmod>';
        echo '<changefreq>daily</changefreq>';
        echo '<priority>0.5</priority>';
        echo '</url>';
    }
}
Example #8
0
 // จัดการแบ่งหน้าเพื่อแสดงผล
 $rows = sizeof($list);
 $maxlink = 9;
 $totalpage = round($rows / $list_per_page);
 $totalpage += $totalpage * $list_per_page < $rows ? 1 : 0;
 $page = $page < 1 ? 1 : $page;
 $page = $page > $totalpage ? $totalpage : $page;
 $start = $list_per_page * ($page - 1);
 $end = $start + $list_per_page > $rows ? $rows : $start + $list_per_page;
 if ($rows > 0) {
     for ($i = $rows - 1; $i >= 0; $i--) {
         if ($i >= $end || $i < $start) {
             unset($list[$i]);
         }
     }
     $url = '<a href="' . gcms::getURL('search', '', 0, 0, 'page=%1&amp;q=' . urlencode($search)) . '">%1</a>';
     if ($totalpage > $maxlink) {
         $s = $page - floor($maxlink / 2);
         if ($s < 1) {
             $s = 1;
         } elseif ($s + $maxlink > $totalpage) {
             $s = $totalpage - $maxlink + 1;
         }
     } else {
         $s = 1;
     }
     $splitpage = $s > 1 ? str_replace('%1', 1, $url) : ' ';
     for ($i = $s; $i <= $totalpage && $maxlink > 0; $i++) {
         $splitpage .= $i == $page ? '<strong>' . $i . '</strong> ' : str_replace('%1', $i, $url);
         $maxlink--;
     }
Example #9
0
 if (!$datas) {
     $datas = $db->customQuery($sql);
     $cache->save($sql, $datas);
 }
 // เครื่องหมาย new
 $valid_date = $mmktime - $match[5];
 // template
 $skin = gcms::loadtemplate($index['module'], 'board', 'widgetitem');
 $patt = array('/{BG}/', '/{URL}/', '/{TOPIC}/', '/{DATE}/', '/{UID}/', '/{SENDER}/', '/{STATUS}/', '/{THUMB}/', '/{ICON}/');
 $widget = array();
 $bg = 'bg2';
 foreach ($datas as $item) {
     $bg = $bg == 'bg1' ? 'bg2' : 'bg1';
     $replace = array();
     $replace[] = "{$bg} background" . rand(0, 5);
     $replace[] = gcms::getURL($index['module'], '', 0, 0, "wbid={$item['id']}");
     $replace[] = $item['topic'];
     $replace[] = gcms::mktime2date($item['comment_date'] > 0 ? $item['comment_date'] : $item['last_update']);
     $replace[] = $item['member_id'];
     $replace[] = $item['displayname'];
     $replace[] = $item['status'];
     if ($item['picture'] != '' && is_file(DATA_PATH . "board/thumb-{$item['picture']}")) {
         $replace[] = DATA_URL . "board/thumb-{$item['picture']}";
     } else {
         $replace[] = WEB_URL . "/{$index['default_icon']}";
     }
     if ($item['create_date'] > $valid_date && $item['comment_date'] == 0) {
         $replace[] = 'new';
     } elseif ($item['last_update'] > $valid_date || $item['comment_date'] > $valid_date) {
         $replace[] = 'update';
     } else {
Example #10
0
         $replace[] = gcms::showip($item['ip']);
         $replace[] = $i + 1;
         $replace[] = $item['id'];
         $comments[] = preg_replace($patt, $replace, $skin);
     }
 }
 if ($canReply) {
     // antispam
     $register_antispamchar = gcms::rndname(32);
     $_SESSION[$register_antispamchar] = gcms::rndname(4);
 }
 // url ของหน้านี้
 if ($config['module_url'] == '1') {
     $canonical = gcms::getURL($index['module'], $index['alias']);
 } else {
     $canonical = gcms::getURL($index['module'], '', 0, $index['id']);
 }
 // แก้ไขบทความ เจ้าของหรือ mod
 $canEdit = is_file(ROOT_PATH . 'modules/document/write.php') && ($moderator || $isMember && $login['id'] == $index['member_id']);
 // แทนที่ลงใน template ของโมดูล
 $patt = array('/{BREADCRUMS}/', '/{COMMENTLIST}/', '/{REPLYFORM}/', '/{TOPIC}/', '/<MEMBER>(.*)<\\/MEMBER>/s', '/(edit-{QID}-0-0-{MODULE})/', '/(delete-{QID}-0-0-{MODULE})/', '/(quote-{QID}-0-0-{MODULE})/', '/{DETAIL}/', '/{LANGUAGE}/', '/{UID}/', '/{DISPLAYNAME}/', '/{IMG}/', '/{STATUS}/', '/{DATE}/', '/{DATEISO}/', '/{CATEGORY}/', '/{VISITED}/', '/{TAGS}/', '/{COMMENTS}/', '/{QID}/', '/{LOGIN_PASSWORD}/', '/{LOGIN_EMAIL}/', '/{ANTISPAM}/', '/{ANTISPAMVAL}/', '/{DELETE}/', '/{MODULE}/', '/{MODULEID}/', '/{VOTE}/', '/{VOTE_COUNT}/', '/{CATID}/');
 $replace = array();
 $replace[] = implode("\n", $breadcrumbs);
 $replace[] = sizeof($comments) == 0 ? '' : implode("\n", $comments);
 $replace[] = $canReply ? gcms::loadtemplate($index['module'], 'document', 'reply') : '';
 $replace[] = $index['topic'];
 $replace[] = $isMember ? '' : '$1';
 $replace[] = $canEdit ? '\\1' : 'hidden';
 $replace[] = $canDelete ? '\\1' : 'hidden';
 $replace[] = $canReply ? '\\1' : 'hidden';
 $replace[] = gcms::HighlightSearch(gcms::showDetail($index['detail'], $canview, false), $search);
Example #11
0
// modules/member/editprofile.php
if (defined('MAIN_INIT') && $isMember) {
    // ข้อมูล user ที่ login
    $user = $db->getRec(DB_USER, $_SESSION['login']['id']);
    if (!$user) {
        $title = $lng['LNG_MEMBER_NOT_FOUND'];
        $content = '<div class=error>' . $title . '</div>';
    } else {
        // breadcrumbs
        $breadcrumb = gcms::loadtemplate('', '', 'breadcrumb');
        $breadcrumbs = array();
        // หน้าหลัก
        $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
        // url ของหน้านี้
        $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('forgot'), $lng['LNG_MEMBER_EDIT_TITLE'], $lng['LNG_MEMBER_EDIT_TITLE'], $breadcrumb);
        if ($user['fb'] == 1) {
            unset($member_tabs['password']);
        }
        // ตรวจสอบ tab ที่เลือก
        $title = '';
        $tab = gcms::getVars($_REQUEST, 'tab', '');
        $file = isset($member_tabs[$tab][1]) ? $member_tabs[$tab][1] : '';
        if ($file == '' || !is_file(ROOT_PATH . "{$file}.php")) {
            // เรียก tab แรก ถ้าไม่มีการระบุ tab มา
            reset($member_tabs);
            $tab = key($member_tabs);
            $file = $member_tabs[$tab][1];
        }
        if ($file != 'modules/member/editprofile') {
            include ROOT_PATH . "{$file}.php";
Example #12
0
     }
     $items = array();
     $patt = array('/{ID}/', '/{THUMB}/', '/{YOUTUBE}/', '/{TOPIC}/', '/{DESCRIPTION}/', '/{VIEWS}/');
     $skin = gcms::loadtemplate($index['module'], 'video', 'listitem');
     foreach ($list as $i => $item) {
         $replace = array();
         $replace[] = $item['id'];
         $replace[] = is_file(DATA_PATH . "video/{$item['youtube']}.jpg") ? DATA_URL . "video/{$item['youtube']}.jpg" : WEB_URL . '/modules/video/img/nopicture.jpg';
         $replace[] = $item['youtube'];
         $replace[] = $item['topic'];
         $replace[] = $item['description'];
         $replace[] = $item['views'];
         $items[] = preg_replace($patt, $replace, $skin);
     }
     // URL สำหรับแบ่งหน้า
     $url = '<a href="' . gcms::getURL($index['module'], '', 0, 0, "page=%d") . '">%d</a>';
     // แสดงผล list รายการ
     $patt = array('/{BREADCRUMS}/', '/{TOPIC}/', '/{DETAIL}/', '/{LIST}/', '/{SPLITPAGE}/', '/{COLS}/', '/{ID}/');
     $replace = array();
     $replace[] = implode("\n", $breadcrumbs);
     $replace[] = $index['topic'];
     $replace[] = nl2br($index['detail']);
     $replace[] = implode("\n", $items);
     $replace[] = gcms::pagination($totalpage, $page, $url);
     $replace[] = $config['video_cols'];
     $replace[] = $index['module_id'];
     $content = preg_replace($patt, $replace, gcms::loadtemplate($index['module'], 'video', 'list'));
 }
 // title,keywords,description
 $title = $index['topic'];
 $keywords = $index['keywords'];
Example #13
0
    $count = $count <= 0 ? 10 : $count;
    // วันที่วันนี้
    $cdate = date("D, d M Y H:i:s +0700", $mmktime);
    $today = date('Y-m-d', $mmktime);
    // ตรวจสอบโมดูลที่เรียก
    $sql = "SELECT M.`id`,M.`module`,M.`owner`,D.`topic`,D.`description`,M.`config`";
    $sql .= " FROM `" . DB_INDEX . "` AS I";
    $sql .= " INNER JOIN `" . DB_MODULES . "` AS M ON M.`id`=I.`module_id` AND M.`module`='{$module}'";
    $sql .= " INNER JOIN `" . DB_INDEX_DETAIL . "` AS D ON D.`id`=I.`id` AND D.`module_id`=I.`module_id` AND D.`language` IN ('" . LANGUAGE . "','')";
    $sql .= " WHERE I.`module_id`=M.`id` AND I.`index`='1' AND I.`language` IN ('" . LANGUAGE . "','')";
    $sql .= " AND I.`published`='1' AND I.`published_date`<='{$today}'";
    $sql .= " LIMIT 1";
    $modules = $db->customQuery($sql);
    if (sizeof($modules) == 1) {
        $modules = $modules[0];
        echo '<' . '?xml version="1.0" encoding="UTF-8"?' . '>';
        echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
        echo '<channel>';
        echo '<atom:link href="' . WEB_URL . '/' . $module . '.rss" rel="self" type="application/rss+xml" />';
        echo "<title>" . $modules['topic'] . "</title>";
        echo '<link>' . gcms::getURL($modules['module']) . '</link>';
        echo '<description><![CDATA[' . $modules['description'] . ']]></description>';
        echo "<pubDate>{$cdate}</pubDate>";
        echo "<lastBuildDate>{$cdate}</lastBuildDate>";
        if (is_file(ROOT_PATH . "modules/{$modules['owner']}/feed.php")) {
            include ROOT_PATH . "modules/{$modules['owner']}/feed.php";
        }
        echo '</channel>';
        echo '</rss>';
    }
}
Example #14
0
 // หน้าหลัก
 $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', $canonical, $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
 // โมดูล
 if ($index['module'] != $module_list[0]) {
     if (isset($install_modules[$index['module']]['menu_text'])) {
         $m = $install_modules[$index['module']]['menu_text'];
         $t = $install_modules[$index['module']]['menu_tooltip'];
     } else {
         $m = ucwords($index['module']);
         $t = $m;
     }
     $canonical = gcms::getURL($index['module']);
     $breadcrumbs['MODULE'] = gcms::breadcrumb('', $canonical, $t, $m, $breadcrumb);
 }
 // url ของหน้านี้
 $canonical = gcms::getURL($index['module'], '', 0, 0, "m={$match['1']}-{$match['2']}");
 // โหลด calendar
 $calendar = array();
 $sql = "SELECT D.`id`,D.`color`,D.`topic`,D.`description`,TIME(D.`begin_date`) AS `t`";
 $sql .= " FROM `" . DB_EVENTCALENDAR . "` AS D";
 $sql .= " WHERE D.`module_id`='{$index['module_id']}' AND YEAR(D.`begin_date`)='{$match['1']}' AND MONTH(D.`begin_date`)='{$match['2']}' AND DAY(D.`begin_date`)='{$match['3']}'";
 $sql .= " AND D.`published`='1' AND D.`published_date`<='" . date('Y-m-d', $mmktime) . "'";
 $sql .= " ORDER BY D.`begin_date` ASC";
 $datas = $cache->get($sql);
 if (!$datas) {
     $datas = $db->customQuery($sql);
     $cache->save($sql, $datas);
 }
 $skin = gcms::loadtemplate($index['module'], 'event', 'dayitem');
 $patt = array('/{COLOR}/', '/{URL}/', '/{TOPIC}/', '/{DESCRIPTION}/', '/{TIME}/');
 foreach ($datas as $item) {
Example #15
0
<?php

// widgets/categories/index.php
if (defined('MAIN_INIT') && preg_match('/^[a-z]{4,}$/', $module) && isset($install_modules[$module])) {
    $index = $install_modules[$module];
    $sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id` DESC";
    $datas = $cache->get($sql);
    if (!$datas) {
        $datas = $db->customQuery($sql);
        $cache->save($sql, $datas);
    }
    foreach ($datas as $item) {
        $widget[] = '<li><a href="' . gcms::getURL($index['module'], '', $item['category_id']) . '">' . gcms::ser2Str($item, 'topic') . '</a></li>';
    }
    if (sizeof($widget) > 0) {
        $widget = '<ul>' . implode("\n", $widget) . '</ul>';
    }
}
Example #16
0
 $categories = array();
 if ($index && $canEdit) {
     // breadcrumbs
     $breadcrumb = gcms::loadtemplate($index['module'], '', 'breadcrumb');
     $breadcrumbs = array();
     // หน้าหลัก
     $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', $canonical, $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
     // โมดูล
     if (isset($install_modules[$index['module']]['menu_text'])) {
         $m = $install_modules[$index['module']]['menu_text'];
         $t = $install_modules[$index['module']]['menu_tooltip'];
     } else {
         $m = ucwords($index['module']);
         $t = $m;
     }
     $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL($index['module']), $t, $m, $breadcrumb);
     if ($rid == 0) {
         $categories[0] = '<option value=0>{LNG_NO_CATEGORY}</option>';
         $sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id`";
         foreach ($db->customQuery($sql) as $item) {
             if ($moderator || $index['category_id'] == $item['category_id']) {
                 $sel = $index['category_id'] == $item['category_id'] ? ' selected' : '';
                 $categories[$item['category_id']] = "<option value={$item['category_id']}{$sel}>" . gcms::ser2Str($item, 'topic') . "</option>";
             }
         }
         if (sizeof($categories) > 1) {
             unset($categories[0]);
         }
     }
     // antispam
     $register_antispamchar = gcms::rndname(32);
Example #17
0
<?php

// modules/member/forgot.php
if (defined('MAIN_INIT')) {
    // title
    $title = $lng['LNG_FORGOT_TITLE'];
    // breadcrumbs
    $breadcrumb = gcms::loadtemplate('', '', 'breadcrumb');
    $breadcrumbs = array();
    // หน้าหลัก
    $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
    // url ของหน้านี้
    $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('forgot'), $lng['LNG_FORGOT_TITLE'], $lng['LNG_FORGOT_TITLE'], $breadcrumb);
    if (isset($config['custom_forgot']) && is_file(ROOT_PATH . $config['custom_forgot'])) {
        // custom register form
        include ROOT_PATH . $config['custom_forgot'];
    } else {
        // แสดงฟอร์ม member/forgotfrm.html
        $patt = array('/{BREADCRUMS}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{WEBURL}/', '/{MODAL}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = WEB_URL;
        $replace[] = gcms::getVars($_POST, 'action', '') == 'modal' ? 'true' : 'false';
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('member', 'member', 'forgotfrm'));
    }
    // เลือกเมนู
    $menu = 'forgot';
}
Example #18
0
<?php

// modules/gallery/feed.php
if (isset($modules)) {
    // ค่าที่ีส่งมา
    $aid = gcms::getVars($_GET, 'album', 0);
    // query
    $sql = "SELECT C.`id`,C.`topic`,C.`detail`,C.`last_update`,G.`image` FROM `" . DB_GALLERY . "` AS G";
    $sql .= " INNER JOIN `" . DB_GALLERY_ALBUM . "` AS C ON C.`module_id`='{$modules['id']}' AND C.`id`=G.`album_id`";
    $sql .= " WHERE G.`module_id`='{$modules['id']}'";
    if ($aid == -1) {
        $sql .= " AND G.`count`='0'";
    } elseif ($aid > 0) {
        $sql .= " AND G.`album_id`={$aid}";
    }
    $sql .= ' ORDER BY ' . (isset($_GET['rnd']) ? 'RAND()' : 'G.`id` DESC');
    $sql .= " LIMIT {$count}";
    foreach ($db->customQuery($sql) as $item) {
        $link = gcms::getURL($modules['module'], '', 0, 0, "id={$item['id']}");
        echo '<item>';
        echo '<title>' . $item['topic'] . '</title>';
        echo '<link>' . $link . '</link>';
        echo '<description><![CDATA[' . gcms::cutstring(gcms::html2txt($item['detail']), 50) . ']]></description>';
        echo '<enclosure url="' . urldecode(DATA_URL . "gallery/{$item['id']}/thumb_{$item['image']}") . '" type="image/jpeg"></enclosure>';
        echo '<guid isPermaLink="true">' . $link . '</guid>';
        echo '<pubDate>' . date("D, d M Y H:M", $item['last_update']) . ':00 +0700</pubDate>';
        echo '</item>';
    }
}
Example #19
0
            $replace[] = number_format($item['visited']);
            $replace[] = number_format($item['comments']);
            if (!empty($item['picture']) && is_file(DATA_PATH . "document/{$item['picture']}")) {
                $replace[] = DATA_URL . "document/{$item['picture']}";
            } elseif (!empty($index['icon']) && is_file(DATA_PATH . "document/{$index['icon']}")) {
                $replace[] = DATA_URL . "document/{$index['icon']}";
            } else {
                $replace[] = WEB_URL . "/{$index['default_icon']}";
            }
            if ($item['create_date'] > $valid_date && $item['comment_date'] == 0) {
                $replace[] = ' new';
            } elseif ($item['last_update'] > $valid_date || $item['comment_date'] > $valid_date) {
                $replace[] = ' update';
            } else {
                $replace[] = '';
            }
            $list[] = preg_replace($patt, $replace, $listitem);
        }
        // URL สำหรับ แบ่งหน้า และ canonical
        $c = $cat_count > 0 ? "&amp;cat={$cat}" : '';
        if (empty($tag)) {
            $url = '<a href="' . gcms::getURL($index['module'], '', 0, 0, "page=%d{$c}") . '">%d</a>';
            $canonical = gcms::getURL($index['module'], '', 0, 0, "page={$page}{$c}");
        } else {
            $url = '<a href="' . gcms::getURL('tag', $tag, 0, 0, "page=%d{$c}") . '">%d</a>';
            $canonical = gcms::getURL('tag', $tag, 0, 0, "page={$page}{$c}");
        }
        // แบ่งหน้า
        $splitpage = gcms::pagination($totalpage, $page, $url);
    }
}
Example #20
0
<?php

// modules/document/feed.php
if (isset($modules)) {
    $sql = "SELECT I.`id`,D.`topic`,I.`alias`,D.`description`,I.`create_date`,I.`picture`,I.`pictureW`,I.`pictureH`";
    $sql .= " FROM `" . DB_INDEX . "` AS I";
    $sql .= " INNER JOIN `" . DB_INDEX_DETAIL . "` AS D ON D.`id`=I.`id` AND D.`module_id`=I.`module_id` AND D.`language` IN ('" . LANGUAGE . "','')";
    $cat = isset($_GET['cat']) ? ' AND I.`category_id`=' . (int) $_GET['cat'] : '';
    $cat .= isset($_GET['user']) ? ' AND I.`member_id`=' . (int) $_GET['user'] : '';
    $sql .= " WHERE I.`module_id`='{$modules['id']}' {$cat} AND I.`index`='0' AND I.`published`='1' AND I.`published_date`<='{$today}'";
    $sql .= " ORDER BY I.`create_date` DESC LIMIT {$count}";
    foreach ($db->customQuery($sql) as $item) {
        if ($config['module_url'] == '1') {
            $link = gcms::getURL($modules['module'], $item['alias']);
        } else {
            $link = gcms::getURL($modules['module'], '', 0, $item['id']);
        }
        echo '<item>';
        echo '<title>' . $item['topic'] . '</title>';
        echo '<link>' . $link . '</link>';
        echo '<description><![CDATA[' . $item['description'] . ']]></description>';
        if ($item['picture'] != '' && is_file(DATA_PATH . "document/{$item['picture']}")) {
            echo '<enclosure url="' . DATA_URL . "document/{$item['picture']}\" width=\"{$item['pictureW']}\" height=\"{$item['pictureH']}\" type=\"image/jpeg\"></enclosure>";
        }
        echo '<guid isPermaLink="true">' . $link . '</guid>';
        echo '<pubDate>' . date("D, d M Y H:i:s +0700", $item['create_date']) . '</pubDate>';
        echo '</item>';
    }
}
Example #21
0
            $_day = $day;
        }
        if ($today == $day && $month == $c_month && $year == $c_year) {
            $c = 'today';
        } else {
            $c = 'curr';
        }
        $data .= '<td class="' . $c . '">' . $_day . '</td>';
        if ($weekday == 7 && $day != $endday) {
            $calendar[] = $data . '</tr>';
            $data = '<tr>';
            $weekday = 0;
        }
        $day++;
        $weekday++;
    }
    $n = 1;
    while ($weekday <= 7) {
        $data .= '<td class="ex">' . $n . '</td>';
        $n++;
        $weekday++;
    }
    $calendar[] = $data . '</tr>';
    $calendar[] = '</tbody>';
    $calendar[] = '<tfoot>';
    $calendar[] = '<tr><td colspan="7"><a href="' . gcms::getURL('calendar') . '" id="calendar-' . $d . '-today">' . (int) $today . ' ' . $lng['MONTH_LONG'][$month - 1] . ' ' . ($year + $lng['YEAR_OFFSET']) . '</a></td></tr>';
    $calendar[] = '</tfoot>';
    $calendar[] = '</table>';
    $calendar[] = '</div>';
    $calendar[] = '</div>';
}
Example #22
0
            $link = gcms::getURL($modules[$item['module_id']], $item['alias']);
        } else {
            $link = gcms::getURL($modules[$item['module_id']], '', 0, $item['id']);
        }
        echo '<url>';
        echo '<loc>' . $link . '</loc>';
        echo '<lastmod>' . date('Y-m-d', $item['create_date']) . '</lastmod>';
        echo '<changefreq>daily</changefreq>';
        echo '<priority>0.5</priority>';
        echo '</url>';
    }
    if ($db->tableExists(DB_TAGS)) {
        // keywords
        $sql = "SELECT `tag` FROM `" . DB_TAGS . "`";
        $datas = $cache->get($sql);
        if (!$datas) {
            $datas = $db->customQuery($sql);
            if (sizeof($datas) > 0) {
                $cache->save($sql, $datas);
            }
        }
        foreach ($datas as $item) {
            echo '<url>';
            echo '<loc>' . gcms::getURL('tag', $item['tag']) . '</loc>';
            echo '<lastmod>' . $cdate . '</lastmod>';
            echo '<changefreq>daily</changefreq>';
            echo '<priority>0.5</priority>';
            echo '</url>';
        }
    }
}
Example #23
0
     $title = $lng['LNG_DATA_NOT_FOUND'];
     $content = '<div class=error>' . $title . '</div>';
 } else {
     $index = $index[0];
     // config
     gcms::r2config($index['config'], $index);
     // login
     $login = gcms::getVars($_SESSION, 'login', array('id' => 0, 'status' => -1, 'email' => '', 'password' => ''));
     // breadcrumbs
     $breadcrumb = gcms::loadtemplate($index['module'], '', 'breadcrumb');
     $breadcrumbs = array();
     // หน้าหลัก
     $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
     // breadcrumb ของ โมดูล
     $m = $install_modules[$index['module']]['menu_text'];
     $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL($index['module']), $install_modules[$index['module']]['menu_tooltip'], $m == '' ? $index['module'] : $m, $breadcrumb);
     // หมวด
     $categories = array();
     $categories[0] = '<option value=0>{LNG_NO_CATEGORY}</option>';
     $sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id`";
     $list = $cache->get($sql);
     if (!$list) {
         $list = $db->customQuery($sql);
         $cache->save($sql, $list);
     }
     foreach ($list as $item) {
         if ($isAdmin || $cat == $item['category_id']) {
             $sel = $cat == $item['category_id'] ? ' selected' : '';
             $categories[$item['category_id']] = "<option value={$item['category_id']}{$sel}>" . gcms::ser2Str($item, 'topic') . "</option>";
         }
     }
Example #24
0
         $sql .= " FROM `" . DB_BOARD_R . "`";
         $sql .= " WHERE `picture` <> '' AND `index_id`='{$qid}' AND `module_id`='{$index['module_id']}'";
         foreach ($db->customQuery($sql) as $item) {
             @unlink(DATA_PATH . "board/{$item['picture']}");
         }
         // ลบคำตอบ
         $sql = "DELETE FROM `" . DB_BOARD_R . "`";
         $sql .= " WHERE `index_id`='{$qid}' AND `module_id`='{$index['module_id']}'";
         $db->query($sql);
         // ลบรูปภาพของคำถาม
         @unlink(DATA_PATH . "board/{$index['picture']}");
         @unlink(DATA_PATH . "board/thumb-{$index['picture']}");
         // ลบคำถาม
         $db->delete(DB_BOARD_Q, $qid);
         // กลับไปหน้าหลักของโมดูลที่เลือก
         $ret['location'] = gcms::getURL($module);
     }
     if ($index['category_id'] > 0) {
         // อัปเดทจำนวนคำตอบและคำถามที่เหลือภายในหมวด
         $sql1 = "SELECT COUNT(*) FROM `" . DB_BOARD_Q . "` WHERE `category_id`=C.`category_id` AND `module_id`='{$index['module_id']}'";
         $sql2 = "SELECT `id` FROM `" . DB_BOARD_Q . "` WHERE `category_id`=C.`category_id` AND `module_id`='{$index['module_id']}'";
         $sql2 = "SELECT COUNT(*) FROM `" . DB_BOARD_R . "` WHERE `index_id` IN ({$sql2}) AND `module_id`='{$index['module_id']}'";
         $sql = "UPDATE `" . DB_CATEGORY . "` AS C SET C.`c1`=({$sql1}),C.`c2`=({$sql2}) WHERE C.`module_id`='{$index['module_id']}'";
         $db->query($sql);
     }
 } elseif ($action == 'edit' && ($moderator || $isMember && $index['member_id'] == $login['id'])) {
     if ($rid > 0) {
         $ret['location'] = WEB_URL . "/index.php?module={$module}-edit&rid={$rid}";
     } else {
         $ret['location'] = WEB_URL . "/index.php?module={$module}-edit&qid={$qid}";
     }
Example #25
0
<?php

// modules/member/register.php
if (defined('MAIN_INIT')) {
    // title
    $title = $lng['LNG_REGISTER_TITLE'];
    // breadcrumbs
    $breadcrumb = gcms::loadtemplate('', '', 'breadcrumb');
    $breadcrumbs = array();
    // หน้าหลัก
    $breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
    // url ของหน้านี้
    $breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('register'), $lng['LNG_REGISTER_TITLE'], $lng['LNG_REGISTER_TITLE'], $breadcrumb);
    if (isset($config['custom_register']) && is_file(ROOT_PATH . $config['custom_register'])) {
        // custom register form
        include ROOT_PATH . $config['custom_register'];
    } else {
        // antispam
        $register_antispamchar = gcms::rndname(32);
        $_SESSION[$register_antispamchar] = gcms::rndname(4);
        // แสดงฟอร์ม registerfrm.html
        $patt = array('/{BREADCRUMS}/', '/<PHONE>(.*)<\\/PHONE>/isu', '/<IDCARD>(.*)<\\/IDCARD>/isu', '/<INVITE>(.*)<\\/INVITE>/isu', '/{(LNG_[A-Z0-9_]+)}/e', '/{ANTISPAM}/', '/{WEBURL}/', '/{MODAL}/', '/{INVITE}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = empty($config['member_phone']) ? '' : '\\1';
        $replace[] = empty($config['member_idcard']) ? '' : '\\1';
        $replace[] = empty($config['member_invitation']) ? '' : '\\1';
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = $register_antispamchar;
        $replace[] = WEB_URL;
        $replace[] = gcms::getVars($_POST, 'action', '') != 'modal' ? 'false' : 'true';
Example #26
0
echo '<atom:link href="' . WEB_URL . '/menu.rss" rel="self" type="application/rss+xml"/>';
echo '<title>' . $lng['LNG_MENU'] . '</title>';
echo '<link>' . WEB_URL . '</link>';
echo '<description>' . $modules['description'] . '</description>';
echo "<pubDate>{$cdate}</pubDate>";
echo "<lastBuildDate>{$cdate}</lastBuildDate>";
// โหลดโมดูลที่ติดตั้ง เรียงตามลำดับเมนู
$sql = "SELECT M.`module`,U.`menu_text`";
$sql .= ",(SELECT `description` FROM `" . DB_INDEX_DETAIL . "` AS D WHERE D.`id`=I.`id` AND D.`module_id`=I.`module_id` AND D.`language`=I.`language`) AS `description`";
$sql .= " FROM `" . DB_MENUS . "` AS U";
$sql .= " INNER JOIN `" . DB_INDEX . "` AS I ON I.`index`='1' AND I.`id`=U.`index_id` AND I.`language`IN('" . LANGUAGE . "','')";
$sql .= " LEFT JOIN `" . DB_MODULES . "` AS M ON M.`id`=I.`module_id`";
$sql .= " WHERE REPLACE(U.`menu_text`,'&nbsp;','')!=''";
$sql .= " ORDER BY U.`menu_order` ASC";
$menus = $cache->get($sql);
if (!$menus) {
    $menus = $db->customQuery($sql);
    $cache->save($sql, $menus);
}
foreach ($menus as $item) {
    $url = gcms::getURL($item['module']);
    echo '<item>';
    echo '<title>' . $item['menu_text'] . '</title>';
    echo '<link>' . $url . '</link>';
    echo '<description>' . $item['description'] . '</description>';
    echo "<pubDate>{$cdate}</pubDate>";
    echo '<guid>' . $url . '</guid>';
    echo '</item>';
}
echo '</channel>';
echo '</rss>';
Example #27
0
     if ($item['member_id'] == 0) {
         $replace[] = '&nbsp;';
         $replace[] = '{LNG_GUEST}';
     } else {
         $sender = trim("{$item['fname']} {$item['lname']}");
         $replace[] = $sender == '' ? $item['email'] : $sender;
         $replace[] = $config['member_status'][$item['status']];
     }
     $replace[] = $item['status'];
     $replace[] = $item['member_id'];
     $list[] = preg_replace($patt, $replace, $listitem);
 }
 // แบ่งหน้า
 $maxlink = 9;
 // query สำหรับ URL
 $url = '<a href="' . gcms::getURL($index['module'], '', 0, 0, 'page=%1') . '">%1</a>';
 if ($totalpage > $maxlink) {
     $start = $page - floor($maxlink / 2);
     if ($start < 1) {
         $start = 1;
     } elseif ($start + $maxlink > $totalpage) {
         $start = $totalpage - $maxlink + 1;
     }
 } else {
     $start = 1;
 }
 $splitpage = $start > 2 ? str_replace('%1', 1, $url) : '';
 for ($i = $start; $i <= $totalpage && $maxlink > 0; $i++) {
     $splitpage .= $i == $page ? '<strong>' . $i . '</strong>' : str_replace('%1', $i, $url);
     $maxlink--;
 }
Example #28
0
     $patt = array('/{ID}/', '/{SRC}/', '/{URL}/', '/{TOPIC(-([0-9]+))?}/e', '/{DETAIL}/', '/{COUNT}/', '/{VISITED}/');
     $skin = gcms::loadtemplate($index['module'], 'gallery', 'albumitem');
     foreach ($list as $i => $item) {
         $replace = array();
         $replace[] = $item['id'];
         $replace[] = is_file(DATA_PATH . "gallery/{$item['id']}/thumb_{$item['image']}") ? DATA_URL . "gallery/{$item['id']}/thumb_{$item['image']}" : WEB_URL . '/modules/gallery/img/nopicture.png';
         $replace[] = gcms::getURL($index['module'], '', 0, 0, "id={$item['id']}");
         $replace[] = create_function('$matches', 'return gcms::cutstring("' . $item['topic'] . '",isset($matches[2]) ? (int)$matches[2] : 0);');
         $replace[] = $item['detail'];
         $replace[] = $item['count'];
         $replace[] = $item['visited'];
         $items[] = gcms::pregReplace($patt, $replace, $skin);
     }
     // URL สำหรับแบ่งหน้า
     $qs[] = 'page=%d';
     $url = '<a href="' . gcms::getURL($index['module'], '', 0, 0, implode('&amp;', $qs)) . '">%d</a>';
     // แสดงผล list รายการ
     $patt = array('/{BREADCRUMS}/', '/{TOPIC}/', '/{DETAIL}/', '/{LIST}/', '/{SPLITPAGE}/', '/{COLS}/');
     $replace = array();
     $replace[] = implode("\n", $breadcrumbs);
     $replace[] = $index['topic'];
     $replace[] = nl2br($index['detail']);
     $replace[] = implode("\n", $items);
     $replace[] = gcms::pagination($totalpage, $page, $url);
     $replace[] = $config['gallery_cols'];
     $content = preg_replace($patt, $replace, gcms::loadtemplate($index['module'], 'gallery', 'album'));
 }
 // title,keywords,description
 $title = $index['topic'];
 $keywords = $index['keywords'];
 $description = $index['description'];
Example #29
0
        $nmax = sizeof($tag_result) - 1;
        $min = isset($tag_result[1]) ? $tag_result[1]['count'] : 0;
        $max = isset($tag_result[$nmax - 1]) ? $tag_result[$nmax - 1]['count'] : 0;
        $step = $max - $min > 0 ? ($max - $min) / 7 : 0.1;
        for ($i = $nmax; $i >= 0; $i--) {
            $value = $tag_result[$i]['count'];
            $key = $tag_result[$i]['tag'];
            $id = $tag_result[$i]['id'];
            if ($i == 0) {
                $classname = 'class0';
            } elseif ($i == $nmax) {
                $classname = 'class9';
            } else {
                $classname = 'class' . (floor(($value - $min) / $step) + 1);
            }
            if (empty($config['tag_owner']) || $config['tag_owner'] == 'document') {
                $url = gcms::getURL('tag', $key);
            } else {
                $url = gcms::getURL($config['tag_owner'], 'tag', 0, 0, 'tag=' . rawurlencode($key));
            }
            $keyword[] = '<a href="' . $url . '" class=' . $classname . ' id=tags-' . $id . '>' . str_replace(' ', '&nbsp;', $key) . '</a>';
        }
    }
    $keyword[] = '</div>';
    $keyword[] = '<script>';
    $content[] = '$G(window).Ready(function(){';
    $keyword[] = "inintTags('{$widget_id}', '" . SKIN . "');";
    $content[] = '});';
    $keyword[] = '</script>';
    $widget = implode("\n", $keyword);
}
Example #30
0
         // อ่าน config
         gcms::r2config($index['config'], $index);
     }
 }
 if (!$index) {
     $title = $lng['LNG_DOCUMENT_NOT_FOUND'];
     $content = '<div class=error>' . $title . '</div>';
 } else {
     if ($cat_count == 1) {
         $index['topic'] = gcms::ser2Str($index, 'topic');
         $index['description'] = gcms::ser2Str($index, 'description');
         $index['icon'] = gcms::ser2Str($index, 'icon');
     }
     // category
     if ($cat_count == 1 && $index['topic'] != '') {
         $breadcrumbs['CATEGORY'] = gcms::breadcrumb('', gcms::getURL($index['module'], '', (int) $index['category_id']), $index['description'], $index['topic'], $breadcrumb);
     }
     $splitpage = '';
     $list = array();
     if ($cat_count > 0 || $index['categories'] == 0 || $index['category_display'] == 0) {
         // เลือกหมวดมา หรือไม่มีหมวด หรือปิดการแสดงผลหมวดหมู่ แสดงรายการเรื่อง
         include ROOT_PATH . 'modules/document/stories.php';
         $template = 'list';
     } else {
         // ลิสต์รายชื่อหมวด
         include ROOT_PATH . 'modules/document/categories.php';
         $template = 'category';
     }
     // แสดงผลหน้าเว็บ
     $patt = array('/{BREADCRUMS}/', '/{LIST}/', '/{NEWTOPIC}/', '/{CATEGORY}/', '/{TOPIC}/', '/{DETAIL}/', '/{SPLITPAGE}/', '/{LANGUAGE}/', '/{MODULE}/');
     $replace = array();