示例#1
0
文件: main.php 项目: phannack/GCMS
    // 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}";
}
示例#2
0
// inint
include '../bin/inint.php';
// โมดูลที่ต้องการ
preg_match('/^([a-z]+)-(.*)$/', $_GET['module'], $match);
$content = array();
if (is_file(ROOT_PATH . "modules/{$match['1']}/print_{$match['2']}.php")) {
    // สถานะของ member และ admin
    $isMember = gcms::isMember();
    $isAdmin = gcms::isAdmin();
    $canAdmin = $_SESSION['login']['admin_access'] == 1;
    // ป้องกันการเรียกหน้าเพจโดยตรง
    DEFINE('MAIN_INIT', 'admin');
    // โหลดโมดูลสำหรับพิมพ์
    include ROOT_PATH . "modules/{$match['1']}/print_{$match['2']}.php";
}
if (sizeof($content) == 0) {
    header("HTTP/1.0 404 Not Found");
    header("Status: 404 Not Found");
} else {
    echo '<!DOCTYPE html>';
    echo '<html lang=' . LANGUAGE . ' dir=ltr>';
    echo '<head>';
    echo '<title>' . $title . '</title>';
    echo '<meta charset=utf-8>';
    echo '<link rel=stylesheet href=' . WEB_URL . '/' . SKIN . '/print.css>';
    echo '</head>';
    echo '<body>';
    echo gcms::pregReplace('/{(LNG_[A-Z0-9_]+)}/e', OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng', implode("\n", $content));
    echo '</body>';
    echo '</html>';
}
示例#3
0
文件: modal.php 项目: phannack/GCMS
<?php

// modal.php
header("content-type: text/html; charset=UTF-8");
// inint
include dirname(__FILE__) . '/bin/inint.php';
// ตรวจสอบ referer
if (gcms::isReferer() && preg_match('/^([a-z]+)$/', $_POST['module'], $match)) {
    if (is_file(ROOT_PATH . SKIN . "{$match['1']}.html")) {
        $patt = array('/{(LNG_[A-Z0-9_]+)}/e', '/{SKIN}/', '/{WEBURL}/', '/{TITLE}/', '/{DESCRIPTION}/', '/{LANGUAGE}/');
        $replace = array(OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng', SKIN, WEB_URL, $config['web_title'], $config['web_description'], LANGUAGE);
        echo gcms::pregReplace($patt, $replace, gcms::loadfile(ROOT_PATH . SKIN . "{$match['1']}.html"));
    } else {
        echo '<div class=error>' . $lng['PAGE_NOT_FOUND'] . '</div>';
    }
}
示例#4
0
文件: forgot.php 项目: phannack/GCMS
<?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';
}
示例#5
0
    // 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';
        $replace[] = gcms::getVars($_COOKIE, PREFIX . '_invite', '');
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('member', 'member', 'registerfrm'));
    }
}
示例#6
0
        $content = '<div class=error>' . $title . '</div>';
    } else {
        // antispam
        $register_antispamchar = gcms::rndname(32);
        $_SESSION[$register_antispamchar] = gcms::rndname(4);
        // title
        $title = $lng['LNG_SENDMAIL_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);
        // แสดงผล member/sendmail.html
        $patt = array('/{BREADCRUMS}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{TITLE}/', '/{SENDER}/', '/{RECIEVER}/', '/{RECIEVERID}/', '/{ANTISPAM}/', '/{ANTISPAMVAL}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = $title;
        $replace[] = $isMember ? $_SESSION['login']['email'] : '';
        $replace[] = implode(',', $emails);
        $replace[] = implode(',', $ids);
        $replace[] = $register_antispamchar;
        $replace[] = $isAdmin ? $_SESSION[$register_antispamchar] : '';
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('member', 'member', 'sendmail'));
        // เลือกเมนู
        $menu = 'sendmail';
    }
} else {
    $title = $lng['LNG_NOT_LOGIN'];
    $content = '<div class=error>' . $title . '</div>';
}
示例#7
0
文件: index.php 项目: phannack/GCMS
    $replace[] = strip_tags($title);
    $replace[] = $config['web_title'];
    if (isset($login_result)) {
        $name = trim("{$login_result['pname']} {$login_result['fname']} {$login_result['lname']}");
        $name = $name == '' ? $login_result['displayname'] : $name;
        $replace[] = $name == '' ? $login_result['email'] : $name;
        $replace[] = $login_result['id'];
    } else {
        $replace[] = '';
        $replace[] = 0;
    }
    $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
    $replace[] = VERSION;
    $replace[] = LANGUAGE;
    $replace[] = $config['admin_skin'];
    $replace[] = WEB_URL;
    if (isset($input)) {
        $replace[] = $input == 'login_email' ? 'autofocus' : '';
        $replace[] = $input == 'login_password' ? 'autofocus' : '';
    } else {
        $replace[] = '';
        $replace[] = '';
    }
    $replace[] = DATA_URL;
    $replace[] = OLD_PHP ? 'gcms::adminURL(array(2 => \'$2\'))' : 'gcms::adminURL';
    $replace[] = gcms::getVars($_GET, 'src', '');
    $replace[] = $login_remember == 1 ? 'checked' : '';
    $replace[] = $login_email;
    $replace[] = $login_password;
    echo gcms::pregReplace($patt, $replace, gcms::loadfile(ROOT_PATH . "admin/skin/{$config['admin_skin']}/index.html"));
}
示例#8
0
文件: write.php 项目: phannack/GCMS
                $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);
        $_SESSION[$register_antispamchar] = gcms::rndname(4);
        // แสดงผล
        $patt = array('/{BREADCRUMS}/', '/<MEMBER>(.*)<\\/MEMBER>/s', '/<UPLOAD>(.*)<\\/UPLOAD>/s', '/{CATEGORIES}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{LOGIN_PASSWORD}/', '/{LOGIN_EMAIL}/', '/{ANTISPAM}/', '/{ANTISPAMVAL}/', '/{SIZE}/', '/{TYPE}/', '/{MODULEID}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = $isMember ? '' : '$1';
        $replace[] = $index['img_upload_type'] == '' ? '' : '$1';
        $replace[] = implode("\n", $categories);
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = $login['password'];
        $replace[] = $login['email'];
        $replace[] = $register_antispamchar;
        $replace[] = $isAdmin ? $_SESSION[$register_antispamchar] : '';
        $replace[] = $index['img_upload_size'];
        $replace[] = empty($index['img_upload_type']) ? '&nbsp;' : $index['img_upload_type'];
        $replace[] = $index['module_id'];
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate($index['module'], 'board', 'write'));
        // title
        $title = $lng['LNG_BOARD_NEW'] . ' ' . $install_modules[$index['module']]['menu_text'];
        // เลือกเมนู
        $menu = empty($install_modules[$index['module']]['alias']) ? $index['module'] : $install_modules[$index['module']]['alias'];
    }
}
示例#9
0
        $db->edit(DB_USER, $user['id'], $newuser);
        $patt = array('/%DISPLAYNAME%/', '/%WEBTITLE%/', '/%WEBURL%/');
        $replace[] = $user['displayname'] == '' ? $user['email'] : $user['displayname'];
        $replace[] = strip_tags($config['web_title']);
        $replace[] = WEB_URL;
        $title = preg_replace($patt, $replace, $lng['ACTIVATE_NEWREGISTER_HEADER']);
        $detail = preg_replace($patt, $replace, $lng['ACTIVATE_NEWREGISTER_DETAIL']);
    }
} else {
    $title = $lng['ACTIVATE_TITLE'];
    $detail = $lng['ACTIVATE_ERROR'];
}
// แสดงผล
$main_patt = array();
$main_replace = array();
$main_patt[] = '/{(LNG_[A-Z0-9_]+)}/e';
$main_replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
$main_patt[] = '/{VERSION}/';
$main_replace[] = VERSION;
$main_patt[] = '/{WEBTITLE}/';
$main_replace[] = strip_tags($config['web_title']);
$main_patt[] = '/{WEBDESCRIPTION}/';
$main_replace[] = strip_tags($config['web_description']);
$main_patt[] = '/{WEBURL}/';
$main_replace[] = WEB_URL;
$main_patt[] = '/{TITLE}/';
$main_replace[] = $title;
$main_patt[] = '/{CONTENT}/';
$main_replace[] = $detail;
echo gcms::pregReplace($main_patt, $main_replace, file_get_contents(ROOT_PATH . SKIN . 'member/activate.html'));
示例#10
0
文件: login.php 项目: phannack/GCMS
            if ($template == '') {
                $template = gcms::loadtemplate('member', 'member', 'loginfrm');
            }
            $content = gcms::pregReplace($patt, $replace, $template);
        }
    } elseif (!empty($config['custom_member']) && is_file(ROOT_PATH . $config['custom_member'])) {
        // custom member form
        include_once ROOT_PATH . $config['custom_member'];
    } else {
        // กรอบข้อมูลสมาชิก
        $patt = array('/{BREADCRUMS}/', '/{WEBTITLE}/', '/{SUBTITLE}/', '/{WEBURL}/', '/{DISPLAYNAME}/', '/{ID}/', '/{STATUS}/', '/{ADMIN}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{FACEBOOK}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = $config['web_title'];
        $replace[] = $error == '' ? $config['web_description'] : '<span class=error>' . $error . '</span>';
        $replace[] = WEB_URL;
        $replace[] = empty($login_result['displayname']) ? $login_result['email'] : $login_result['displayname'];
        $replace[] = $login_result['id'];
        $replace[] = $login_result['status'];
        $replace[] = isset($login_result['admin_access']) && ($login_result['admin_access'] == 1 || $_SESSION['login']['status'] == 1) ? 'admin' : ' hidden';
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = empty($config['facebook']['appId']) ? 'hidden' : 'facebook';
        $template = gcms::loadtemplate('member', 'member', 'member');
        if ($template == '') {
            $template = gcms::loadtemplate('member', 'member', 'memberfrm');
        }
        $content = gcms::pregReplace($patt, $replace, $template);
    }
    // เลือกเมนู
    $menu = 'login';
}
示例#11
0
文件: xhr.php 项目: phannack/GCMS
        // คืนค่าเนื้อหา
        $ret['menu'] = rawurlencode($menu);
        $ret['title'] = rawurlencode(strip_tags($title));
        // เตรียมข้อมูลสำหรับใส่ใน template
        $main_patt = array();
        $main_patt['/{URL}/'] = $canonical;
        $main_patt['/{XURL}/'] = rawurlencode($canonical);
        $main_patt['/{WIDGET_([A-Z]+)(([\\s_])(.*))?}/e'] = OLD_PHP ? 'gcms::getWidgets(array(1=>\'$1\',3=>\'$3\',4=>\'$4\'))' : 'gcms::getWidgets';
        $main_patt['/{(LNG_[A-Z0-9_]+)}/e'] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $main_patt['/{SKIN}/'] = SKIN;
        $main_patt['/{WEBURL}/'] = WEB_URL;
        $main_patt['/{LANGUAGE}/'] = LANGUAGE;
        $main_patt['/{WEBTITLE}/'] = strip_tags($config['web_title']);
        // ตัวแปรหลังจากแสดงผลแล้ว
        $main_patt = array_merge($main_patt, $custom_patt);
        // แสดงผล
        $ret['content'] = rawurlencode(gcms::pregReplace(array_keys($main_patt), array_values($main_patt), $content));
        if (isset($_POST['to'])) {
            $ret['to'] = rawurlencode($_POST['to']);
        }
        // บันทึก useronline
        include ROOT_PATH . 'useronline.php';
        // อัปเดท pagesview
        $db->query("UPDATE `" . DB_COUNTER . "` SET `pages_view`=`pages_view`+1,`time`='{$mmktime}' WHERE `date`='" . date('Y-m-d', $mmktime) . "' LIMIT 1");
        // คืนค่า เวลาที่ใช้ไป
        $ret['db_elapsed'] = sprintf('%.3f', microtime(true) - BEGIN_TIME);
        $ret['db_quries'] = $db->query_count();
    }
    // คืนค่า JSON
    echo gcms::array2json($ret);
}
示例#12
0
文件: main.php 项目: phannack/GCMS
        } elseif ($result['displayname'] != '') {
            $u[] = $result['displayname'];
        } else {
            $u[] = $result['email'];
        }
        $replace[] = implode(' ', $u);
        if (is_file(ROOT_PATH . 'modules/pm/send.php')) {
            $replace[] = '<a class=icon-email-sent title="{LNG_PM_SEND_TITLE}" href="index.php?module=pm-send&amp;to=' . $result['id'] . '">&nbsp;</a>';
        } else {
            $replace[] = '<a class=icon-email-sent title="{LNG_MAIL_TO}" href="index.php?module=sendmail&amp;to=' . $result['id'] . '">&nbsp;</a>';
        }
        $replace[] = in_array($result['sex'], array_keys($lng['SEX'])) ? $result['sex'] : 'u';
        $replace[] = gcms::mktime2date($result['create_date'], 'd M Y');
        $replace[] = $result['website'] == '' ? '-' : "<a href=\"http://{$result['website']}\" target=_blank>{$result['website']}</a>";
        $replace[] = number_format($result['visited']);
        $replace[] = $result['fb'] == 1 ? 'icon-facebook' : '';
        $replace[] = gcms::mktime2date($result['lastvisited'], 'd M Y');
        $replace[] = $result['post'];
        $replace[] = $result['reply'];
        $replace[] = $config['member_status'][(int) $result['status']];
        $replace[] = $result['point'];
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('member', 'member', 'view'));
    } else {
        $title = $lng['LNG_ID_NOT_FOUND'];
        $content = '<div class=error>' . $title . '</div>';
    }
} else {
    $title = $lng['LNG_DATA_NOT_FOUND'];
    $content = '<div class=error>' . $title . '</div>';
}
示例#13
0
文件: day.php 项目: phannack/GCMS
        foreach ($datas as $item) {
            $replace = array();
            $replace[] = $item['color'];
            $replace[] = gcms::getUrl($index['module'], '', 0, 0, "id={$item['id']}");
            $replace[] = $item['topic'];
            $replace[] = $item['description'];
            preg_match('/^(([0-9]+):([0-9]+)):[0-9]+$/', $item['t'], $m);
            $replace[] = $m[1];
            $calendar[] = preg_replace($patt, $replace, $skin);
        }
        // แสดงผล
        $patt = array('/{BREADCRUMS}/', '/{LIST}/', '/{TOPIC}/', '/{(LNG_[A-Z0-9_]+)}/e', '/{YEAR}/', '/{MONTH}/', '/{DATE}/', '/{URL}/');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = implode('', $calendar);
        $replace[] = $index['topic'];
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = (int) $match[1] + $lng['YEAR_OFFSET'];
        $replace[] = $lng['MONTH_SHORT'][(int) $match[2] - 1];
        $replace[] = (int) $match[3];
        $replace[] = $canonical;
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate($index['module'], 'event', 'day'));
        // title,keywords,description
        $title = $index['topic'];
        $keywords = $index['keywords'];
        $description = $index['detail'];
    }
} else {
    $title = $lng['LNG_DATA_NOT_FOUND'];
    $content = '<div class=error>' . $title . '</div>';
}
示例#14
0
文件: load.php 项目: phannack/GCMS
        $meta['og:title'] = '<meta property="og:title" content="' . $title . '">';
        $meta['og:site_name'] = '<meta property="og:site_name" content="' . strip_tags($config['web_title']) . '">';
        $meta['og:type'] = '<meta property="og:type" content="article">';
        $main_patt['/{URL}/'] = $canonical;
        $main_patt['/{XURL}/'] = rawurlencode($canonical);
        $main_patt['/{META}/'] = implode("\n", $meta);
        // javascript
        $main_patt['/{SCRIPT}/'] = implode("\n", $script);
        // เวลาประมวลผล
        $main_patt['/{ELAPSED}/'] = sprintf('%.3f', microtime(true) - BEGIN_TIME);
        // จำนวน query
        $main_patt['/{QURIES}/'] = $db->query_count();
        // path ของ tempalate
        $main_patt['/{SKIN}/'] = SKIN;
        // ภาษาที่เลือก
        $main_patt['/{LANGUAGE}/'] = LANGUAGE;
        // URL ของเว็บไซต์
        $main_patt['/{WEBURL}/'] = WEB_URL;
        // URL ของ datas/
        $main_patt['/{DATAURL}/'] = DATA_URL;
        // ชื่อเว็บ
        $main_patt['/{WEBTITLE}/'] = $config['web_title'];
        $main_patt['/{SITENAME}/'] = strip_tags($config['web_title']);
        // คำอธิบายย่อของเว็บ
        $main_patt['/{WEBDESCRIPTION}/'] = $config['web_description'];
        // ตัวแปรหลังจากแสดงผลแล้ว
        $main_patt = array_merge($main_patt, $custom_patt);
        // แสดงผล
        echo gcms::pregReplace(array_keys($main_patt), array_values($main_patt), gcms::loadtemplate('index', '', 'index'));
    }
}
示例#15
0
文件: view.php 项目: phannack/GCMS
<?php

// widgets/tags/view.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer
if (gcms::isReferer()) {
    list($action, $id) = explode('-', $_POST['id']);
    $tag = $db->getRec(DB_TAGS, $id);
    if ($tag) {
        $patt = array('/{(LNG_[A-Z0-9_]+)}/e', '/{TAG}/', '/{COUNT}/');
        $replace = array();
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $replace[] = $tag['tag'];
        $replace[] = number_format($tag['count']);
        echo gcms::pregReplace($patt, $replace, gcms::loadfile('tags.tpl'));
    }
}
示例#16
0
文件: getnews.php 项目: phannack/GCMS
            $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']}";
            }
            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[] = '';
            }
            $widget[] = preg_replace($patt, $replace, $skin);
        }
        if (sizeof($widget) > 0) {
            $patt = array('/{COLS}/', '/{(LNG_[A-Z0-9_]+)}/e');
            $replace = array();
            $replace[] = $match[2];
            $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
            echo gcms::pregReplace($patt, $replace, '<div class="row ' . $styles . 'view">' . implode('', $widget) . '</div>');
        } else {
            $widget = '';
        }
    }
}
示例#17
0
文件: email.php 项目: phannack/GCMS
    } else {
        // antispam
        $antispam = gcms::rndname(32);
        $_SESSION[$antispam] = gcms::rndname(4);
        // share form
        $widget = array();
        $widget[] = '<form id=share_frm method=post action=index.php>';
        $widget[] = '<h1 class=icon-email-sent>{LNG_SHARE_TITLE}</h1>';
        $widget[] = '<h2>' . $_POST['t'] . '</h2>';
        $widget[] = '<address>' . $_POST['u'] . '</address>';
        $widget[] = '<div><label class="g-input icon-email"><input type=text name=share_reciever id=share_reciever placeholder="{LNG_EMAIL_RECIEVER}" title="{LNG_EMAIL_TO_COMMENT}"></label>';
        $widget[] = '<em class=comment id=result_share_reciever>{LNG_EMAIL_TO_COMMENT}</em></div>';
        $widget[] = '<label class="g-input antispam">';
        $widget[] = '<span><img src="' . WEB_URL . '/antispamimage.php?id=' . $antispam . '" alt=Antispam></span>';
        $widget[] = '<input type=text name=share_antispam id=share_antispam maxlength=4 value="' . (gcms::isAdmin() ? $_SESSION[$antispam] : '') . '" placeholder="{LNG_ANTISPAM_COMMENT}"></label>';
        $widget[] = '</div>';
        $widget[] = '<div class=submit><input type=submit class="button large send" value="{LNG_EMAIL_SEND}">';
        $widget[] = '<input type=hidden name=antispam value=' . $antispam . '>';
        $widget[] = '<input type=hidden name=share_subject value="' . $_POST['t'] . '">';
        $widget[] = '<input type=hidden name=share_address value="' . $_POST['u'] . '">';
        $widget[] = '</div></form>';
        $widget[] = '<script>';
        $widget[] = '$G(window).Ready(function(){';
        $widget[] = 'new GForm("share_frm", "' . WEB_URL . '/widgets/share/sendmail.php").onsubmit(doFormSubmit);';
        $widget[] = '});';
        $widget[] = '</script>';
        $ret['content'] = rawurlencode(gcms::pregReplace('/{(LNG_[A-Z0-9_]+)}/e', OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng', implode('', $widget)));
    }
    // คืนค่า JSON
    echo gcms::array2json($ret);
}
示例#18
0
文件: index.php 项目: phannack/GCMS
<?php

// widgets/search/index.php
if (defined('MAIN_INIT')) {
    $patt = array('/[\\t\\r]/', '/{(LNG_[A-Z0-9_]+)}/e', '/{WEBURL}/', '/{SEARCH}/', '/{ID}/');
    $replace = array();
    $replace[] = '';
    $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
    $replace[] = WEB_URL;
    $replace[] = preg_replace('/[\\+\\s]+/u', ' ', gcms::getVars($_GET, 'q', ''));
    $replace[] = gcms::rndname(10);
    $widget = gcms::pregReplace($patt, $replace, file_get_contents(ROOT_PATH . 'widgets/search/search.html'));
}
示例#19
0
文件: album.php 项目: phannack/GCMS
         $list = $db->customQuery($sql);
         $cache->save($sql, $list);
     }
     $items = array();
     $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'));
 }
示例#20
0
文件: report.php 项目: phannack/GCMS
            } 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--;
        }
        $splitpage .= $i < $totalpage ? str_replace('%1', $totalpage, $url) : '';
        $splitpage = $splitpage == '' ? '<strong>1</strong>' : $splitpage;
        // แสดงผล list รายการ
        $patt = array('/{BREADCRUMS}/', '/{LIST}/', '/{TOPIC}/', '/{SPLITPAGE}/', '/{(LNG_[A-Z0-9_]+)}/e');
        $replace = array();
        $replace[] = implode("\n", $breadcrumbs);
        $replace[] = implode("\n", $list);
        $replace[] = "{$index['topic']}.{$index['ext']}";
        $replace[] = $splitpage;
        $replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
        $content = gcms::pregReplace($patt, $replace, gcms::loadtemplate($index['module'], 'edocument', 'report'));
        // title,keywords,description
        $title = $index['title'];
        $keywords = $index['keywords'];
        $description = $index['description'];
    }
} else {
    $title = $lng['LNG_NOT_LOGIN'];
    $content = '<div class=error>' . $title . '</div>';
}
            } elseif ($key == 'provinceID') {
                // จังหวัด
                $provinces = array();
                $provinces[] = '<option value="">--- ' . $lng['LNG_PLEASE_SELECT'] . ' ---</option>';
                $sql = "SELECT `id`, `name` FROM `" . DB_PROVINCE . "`";
                $datas = $cache->get($sql);
                if (!$datas) {
                    $datas = $db->customQuery($sql);
                    $cache->save($sql, $datas);
                }
                foreach ($datas as $item) {
                    $sel = $user['provinceID'] == $item['id'] ? ' selected' : '';
                    $provinces[] = '<option value=' . $item['id'] . $sel . '>' . $item['name'] . '</option>';
                }
                $replace2[] = implode('', $provinces);
            } else {
                $replace2[] = $value;
            }
        }
        $content[] = gcms::pregReplace($patt2, $replace2, gcms::loadfile(ROOT_PATH . "admin/skin/{$config['admin_skin']}/editprofile.html"));
        // หน้าปัจจุบัน
        $url_query['module'] = 'editprofile';
    } else {
        // ไม่ได้กำหนด id มา หรือ ไม่พบ user ที่เรียก
        $title = $lng['LNG_DATA_NOT_FOUND'];
        $content[] = '<aside class=error>' . $title . '</aside>';
    }
} else {
    $title = $lng['LNG_DATA_NOT_FOUND'];
    $content[] = '<aside class=error>' . $title . '</aside>';
}