Beispiel #1
0
     $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;
Beispiel #2
0
    // 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);
    // หน้าค้นหา
    $canonical = WEB_URL . '/index.php?module=search&q=' . urlencode($search);
    $breadcrumbs['MODULE'] = gcms::breadcrumb('', $canonical, '{LNG_SEARCH}', '{LNG_SEARCH}', $breadcrumb);
    // แสดงผล
    $patt = array('/{BREADCRUMS}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{WEBURL}/', '/{MODULE}/', '/{SEARCH}/', '/{RESULT}/', '/{LIST}/', '/{SPLITPAGE}/');
    $replace = array();
    $replace[] = implode("\n", $breadcrumbs);
    $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
    $replace[] = WEB_URL;
    $replace[] = $module;
    $replace[] = $search;
    $replace[] = sizeof($list) == 0 ? '' : sprintf($lng['ALL_SEARCH'], $start + 1, $end, $rows, $search, number_format($time_end - $time_start, 4));
    if ($search == '') {
        $replace[] = $lng['LNG_SEARCH_TIP'];
    } elseif (sizeof($list) == 0) {
        $replace[] = sprintf($lng['LNG_SEARCH_NOT_FOUND'], $search) . $lng['LNG_SEARCH_TIP'];
    } else {
        $replace[] = gcms::HighlightSearch(implode("\n", $list), $search);
    }
    $replace[] = $splitpage;
    $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('search', 'search', 'search'));
    // title, keywords, description
    $title = ($search == '' ? "" : "{$search} - ") . $lng['LNG_SEARCH'];
    $keywords = "{$title} {$keywords}";
    $description = "{$title} {$description}";
}
Beispiel #3
0
 $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);
 $replace[] = (int) $index['member_id'];
 $replace[] = $index['displayname'];
 $replace[] = $index['status'];
 $replace[] = gcms::mktime2date($index['create_date']);
 $replace[] = date(DATE_ISO8601, $index['create_date']);
 $replace[] = number_format($index['visited']);
 $replace[] = number_format($index['comments']);
 $replace[] = !$canReply || $index['locked'] == 1 ? '' : gcms::loadtemplate($index['module'], 'board', 'reply');
 $replace[] = $isMember ? '' : '$1';
 $replace[] = $index['img_upload_type'] == '' ? '' : '$1';
 $replace[] = $login['password'];
 $replace[] = $login['email'];
 $replace[] = $register_antispamchar;
 $replace[] = $isAdmin ? $_SESSION[$register_antispamchar] : '';
 $replace[] = $index['id'];