Пример #1
0
// 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;
            $replace[] = $login_remember == 1 ? 'checked' : '';