$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; $content = preg_replace($patt, $replace, gcms::loadtemplate($index['module'], '', 'main')); // title,keywords,description $title = $index['topic']; $keywords = $index['keywords']; $description = $index['description']; // เลือกเมนู $menu = empty($install_modules[$index['module']]['alias']) ? $index['module'] : $install_modules[$index['module']]['alias']; } }
$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); $replace[] = LANGUAGE; $replace[] = (int) $index['member_id']; $replace[] = empty($index['displayname']) ? $index['email'] : $index['displayname']; if (is_file(DATA_PATH . "document/{$index['picture']}")) { // รูปภาพของบทความ $image_src = DATA_URL . "document/{$index['picture']}"; $replace[] = '<figure><img src="' . $image_src . '" alt="' . $index['topic'] . '"></figure>'; } else { $image_src = WEB_URL . "/{$index['default_icon']}"; $replace[] = ''; } $replace[] = $index['status']; $replace[] = gcms::mktime2date($index['create_date']); $replace[] = date(DATE_ISO8601, $index['create_date']); $replace[] = $category;
$i++; $row = '<article class=r>'; $row .= '<div class=detail>' . $picture . gcms::showDetail($item['detail'], true) . '</div>'; $row .= '<footer>'; $row .= '<p><strong>{LNG_COMMENT_NO}#' . $i . '</strong></p>'; $row .= '<p><strong>{LNG_BY}</strong>: ' . (empty($item['displayname']) ? $item['email'] : $item['displayname']) . '</p>'; $row .= '<p><strong>{LNG_POSTED}</strong>: ' . gcms::mktime2date($item['last_update']) . '</p>'; $row .= '<p><strong>{LNG_IP}</strong>: ' . gcms::showip($item['ip']) . '</p>'; $row .= '</footer>'; $row .= '</article>'; $comments[] = $row; } $title = $index['topic']; if ($index['picture'] != '' && is_file($imagedir . $index['picture'])) { $picture = '<p class=img><img src="' . $imageurl . $index['picture'] . '" alt=""></p>'; } else { $picture = ''; } $content = '<article>'; $content .= '<header><h1>' . $index['topic'] . '</h1></header>'; $content .= '<div class=detail>' . $picture . gcms::showDetail($index['detail'], true) . '</div>'; $content .= '<footer>'; $content .= '<p><strong>{LNG_BY}</strong> : ' . ($index['displayname'] == '' ? $index['email'] : $index['displayname']) . '</p>'; $content .= '<p><strong>{LNG_POSTED}</strong>: ' . gcms::mktime2date($index['create_date']) . '</p>'; $content .= '<p><strong>{LNG_URL}</strong> : ' . gcms::getURL($modules['module'], '', 0, 0, "wbid={$index['id']}") . '</p>'; $content .= '</footer>'; $content .= '</article>'; $content .= implode("\n", $comments); } } }
$row = '<article class=r>'; $row .= '<div class=detail>' . gcms::showDetail($item['detail'], true) . '</div>'; $row .= '<footer>'; $row .= '<p><strong>{LNG_COMMENT_NO}#' . $i . '</strong></p>'; $row .= '<p><strong>{LNG_BY}</strong>: ' . $index['displayname'] . '</p>'; $row .= '<p><strong>{LNG_POSTED}</strong>: ' . gcms::mktime2date($index['last_update']) . '</p>'; $row .= '<p><strong>{LNG_IP}</strong>: ' . gcms::showip($item['ip']) . '</p>'; $row .= '</footer>'; $row .= '</article>'; $comments[] = $row; } } $title = $index['topic']; if ($config['module_url'] == '1') { $url = gcms::getURL($modules['module'], $index['alias'], 0, 0, '', false); } else { $url = gcms::getURL($modules['module'], '', 0, $index['id'], '', false); } $content = '<article>'; $content .= '<header><h1>' . $index['topic'] . '</h1></header>'; $content .= '<div class=detail>' . gcms::showDetail($index['detail'], true, false) . '</div>'; $content .= '<footer>'; $content .= '<p><strong>{LNG_WRITER}</strong> : ' . ($index['displayname'] == '' ? $index['email'] : $index['displayname']) . '</p>'; $content .= '<p><strong>{LNG_LAST_UPDATE}</strong>: ' . gcms::mktime2date($index['last_update']) . '</p>'; $content .= '<p><strong>{LNG_URL}</strong> : ' . $url . '</p>'; $content .= '</footer>'; $content .= '</article>'; $content .= implode("\n", $comments); } } }
// แก้ไขบอร์ด (mod หรือ ตัวเอง) $canEdit = $moderator || $isMember && $login['id'] == $index['member_id']; // antispam $register_antispamchar = gcms::rndname(32); $_SESSION[$register_antispamchar] = gcms::rndname(4); // แทนที่ลงใน template ของโมดูล $patt = array('/{BREADCRUMS}/', '/{COMMENTLIST}/', '/(edit-{QID}-0-0-{MODULE})/', '/(delete-{QID}-0-0-{MODULE})/', '/(quote-{QID}-([0-9]+)-([0-9]+)-{MODULE})/', '/(pin-{QID}-0-0-{MODULE})/', '/(lock-{QID}-0-0-{MODULE})/', '/{URL}/', '/{TOPIC}/', '/{PIN}/', '/{LOCK}/', '/{PIN_TITLE}/', '/{LOCK_TITLE}/', '/{DETAIL}/', '/{UID}/', '/{DISPLAYNAME}/', '/{STATUS}/', '/{DATE}/', '/{DATEISO}/', '/{VISITED}/', '/{COMMENTS}/', '/{REPLYFORM}/', '/<MEMBER>(.*)<\\/MEMBER>/s', '/<UPLOAD>(.*)<\\/UPLOAD>/s', '/{LOGIN_PASSWORD}/', '/{LOGIN_EMAIL}/', '/{ANTISPAM}/', '/{ANTISPAMVAL}/', '/{QID}/', '/{DELETE}/'); if ($index['picture'] != '' && is_file($imagedir . $index['picture'])) { $image_src = $imageurl . $index['picture']; $picture = '<figure class=center><img src="' . $image_src . '" alt="' . $index['topic'] . '"></figure>'; } else { $picture = ''; $image_src = WEB_URL . "/{$index['default_icon']}"; } // รายละเอียดเนื้อหา $detail = gcms::showDetail($index['detail'], $canView, true, true); $replace = array(); $replace[] = implode("\n", $breadcrumbs); $replace[] = implode("\n", $comments); $replace[] = $canEdit ? '\\1' : 'hidden'; $replace[] = $canDelete ? '\\1' : 'hidden'; $replace[] = !$canReply || $index['locked'] == 1 ? 'hidden' : '\\1'; $replace[] = $moderator ? '\\1' : 'hidden'; $replace[] = $moderator ? '\\1' : 'hidden'; $replace[] = $canonical; $replace[] = $index['topic']; $replace[] = $index['pin'] == 0 ? 'un' : ''; $replace[] = $index['locked'] == 0 ? 'un' : ''; $replace[] = $index['pin'] == 0 ? $lng['LNG_PIN'] : $lng['LNG_UNPIN']; $replace[] = $index['locked'] == 0 ? $lng['LNG_LOCK'] : $lng['LNG_UNLOCK']; $replace[] = $picture . gcms::HighlightSearch($detail, $search);