예제 #1
0
파일: dologin.php 프로젝트: phannack/GCMS
<?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;
예제 #2
0
<?php

// admin/mailto.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../bin/inint.php';
$ret = array();
// ตรวจสอบ referer และ สมาชิก
if (gcms::isReferer() && gcms::isMember()) {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        $ret['error'] = 'EX_MODE_ERROR';
    } else {
        // ค่าที่ส่งมา
        $topic = htmlspecialchars(trim($_POST['email_subject']));
        $detail = gcms::ckClean($_POST['email_detail']);
        $reciever = htmlspecialchars(trim($_POST['email_reciever']));
        if (gcms::isAdmin()) {
            $sender = $db->getRec(DB_USER, $_POST['email_from']);
        } else {
            $sender = $_SESSION['login'];
        }
        // ตรวจสอบค่าที่ส่งมา
        if ($sender['email'] == '') {
            $ret['error'] = 'ACTION_ERROR';
        } elseif ($reciever == '') {
            $ret['error'] = 'RECIEVER_EMPTY';
            $ret['input'] = 'email_reciever';
        } elseif ($sender == $reciever) {
            $ret['error'] = 'ACTION_ERROR';
        } elseif ($topic == '') {
            $ret['error'] = 'TOPIC_EMPTY';
예제 #3
0
파일: load.php 프로젝트: phannack/GCMS
 foreach ($install_owners as $owner => $items) {
     if (is_file(ROOT_PATH . "modules/{$owner}/config.php")) {
         include_once ROOT_PATH . "modules/{$owner}/config.php";
     }
     if (is_file(ROOT_PATH . "modules/{$owner}/inint.php")) {
         include_once ROOT_PATH . "modules/{$owner}/inint.php";
     }
     if ($cron && is_file(ROOT_PATH . "modules/{$owner}/cron.php")) {
         include_once ROOT_PATH . "modules/{$owner}/cron.php";
     }
 }
 // โหลดโมดูล login
 include ROOT_PATH . 'modules/member/login.php';
 $mainlogin = $content;
 // login
 $isMember = gcms::isMember();
 // admin
 $isAdmin = gcms::isAdmin();
 // บันทึก counter และ useronline
 include ROOT_PATH . 'counter.php';
 include ROOT_PATH . 'useronline.php';
 // ค่า title,description และ keyword ของเว็บหลัก
 $title = $config['web_title'];
 $description = $config['web_description'];
 $keywords = $config['web_description'];
 // แสดงผล template หลัก
 $main_patt = array();
 if (!empty($config['google_site_verification'])) {
     $meta['google-site-verification'] = '<meta name=google-site-verification content="' . $config['google_site_verification'] . '">';
 }
 if (!empty($config['google_profile'])) {
예제 #4
0
파일: config.php 프로젝트: phannack/GCMS
 *
 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *  http://www.gnu.org/licenses/lgpl.html
 *
 * - Mozilla Public License Version 1.1 or later (the "MPL")
 *  http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * Configuration file for the File Manager Connector for PHP.
 */
global $config;
// config ของระบบ
include '../../../../bin/load.php';
// ตรวจสอบการ login สำหรับสมาชิกเท่านั้น
$config['Enabled'] = gcms::isAdmin() || gcms::isMember() && isset($_SESSION['CKEDITOR']) && $_SESSION['CKEDITOR'] == $_SESSION['login']['id'];
// กำหนดการอัปโหลดไฟล์โดยใช้ชื่อเดิม หรือเป็นตัวเลข (เวลา)
// true ใช้ชื่อเดิมของไฟล์ (rename ชื่อซ้ำ)
// false ใช้ชื่อไฟล์เป็นเวลา (mktime)
$config['UploadOrginalFilename'] = false;
// โฟลเดอร์ ที่เก็บไฟล์
$config['UserFilesPath'] = DATA_FOLDER;
// path ที่เก็บไฟล์ตั้งแต่ root ของ Server
$config['UserFilesAbsolutePath'] = DATA_PATH;
// Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled.
$config['ForceSingleExtension'] = true;
// Perform additional checks for image files.
// If set to true, validate image size (using getimagesize).
$config['SecureImageUploads'] = true;
// What the user can do with this connector.
예제 #5
0
 /**
  * ฟังก์ชั่น แปลงเป็นรายการเมนู
  *
  * @param array $item แอเรย์ข้อมูลเมนู
  * @param boolean $arrow (optional) true=แสดงลูกศรสำหรับเมนูที่มีเมนูย่อย (default false)
  * @return string คืนค่า HTML ของเมนู
  */
 public static function getMenu($item, $arrow = false)
 {
     $c = array();
     if ($item['alias'] != '') {
         $c[] = $item['alias'];
     } elseif ($item['module'] != '') {
         $c[] = $item['module'];
     }
     if (isset($item['published'])) {
         if ($item['published'] != 1) {
             if (gcms::isMember()) {
                 if ($item['published'] == '3') {
                     $c[] = 'hidden';
                 }
             } else {
                 if ($item['published'] == '2') {
                     $c[] = 'hidden';
                 }
             }
         }
     }
     $c = sizeof($c) == 0 ? '' : ' class="' . implode(' ', $c) . '"';
     if ($item['index_id'] > 0 || $item['menu_url'] != '') {
         $a = $item['menu_target'] == '' ? '' : ' target=' . $item['menu_target'];
         $a .= $item['accesskey'] == '' ? '' : ' accesskey=' . $item['accesskey'];
         if ($item['index_id'] > 0) {
             $a .= ' href="' . gcms::getURL($item['module']) . '"';
         } elseif ($item['menu_url'] != '') {
             $a .= ' href="' . $item['menu_url'] . '"';
         } else {
             $a .= ' tabindex=0';
         }
     } else {
         $a = ' tabindex=0';
     }
     $b = $item['menu_tooltip'] == '' ? $item['menu_text'] : $item['menu_tooltip'];
     if ($b != '') {
         $a .= ' title="' . $b . '"';
     }
     if ($arrow) {
         return '<li' . $c . '><a class=menu-arrow' . $a . '><span>' . ($item['menu_text'] == '' ? '&nbsp;' : htmlspecialchars_decode($item['menu_text'])) . '</span></a>';
     } else {
         return '<li' . $c . '><a' . $a . '><span>' . ($item['menu_text'] == '' ? '&nbsp;' : htmlspecialchars_decode($item['menu_text'])) . '</span></a>';
     }
 }
예제 #6
0
파일: print.php 프로젝트: phannack/GCMS
 $sql = "SELECT I.`id`,I.`alias`,D.`topic`,D.`detail`,I.`last_update`,U.`displayname`,U.`email`";
 $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 . "','')";
 $sql .= " LEFT JOIN `" . DB_USER . "` AS U ON U.`id`=I.`member_id`";
 $sql .= " WHERE I.`id`='{$id}' AND I.`index`='0' AND I.`published`='1' AND I.`module_id`='{$modules['id']}' LIMIT 1";
 $index = $cache->get($sql);
 if (!$index) {
     $index = $db->customQuery($sql);
     $cache->save($sql, $index);
 }
 if (sizeof($index) == 1) {
     $index = $index[0];
     // config
     gcms::r2config($modules['config'], $modules);
     // guest มีสถานะเป็น -1
     $status = gcms::isMember() ? $login['status'] : -1;
     // สถานะสมาชิกที่สามารถเปิดดูกระทู้ได้
     if (in_array($status, explode(',', $modules['can_view']))) {
         // ความคิดเห็น
         $comments = array();
         // แสดงความคิดเห็นได้
         if (!empty($modules['can_reply'])) {
             $sql = "SELECT C.`detail`,C.`last_update`,C.`ip`";
             $sql .= ",(CASE WHEN ISNULL(U.`id`) THEN C.`email` ELSE (CASE WHEN U.`displayname`='' THEN U.`email` ELSE U.`displayname` END) END) AS `displayname`";
             $sql .= " FROM `" . DB_COMMENT . "` AS C";
             $sql .= " LEFT JOIN `" . DB_USER . "` AS U ON U.`id`=C.`member_id`";
             $sql .= " WHERE C.`index_id`='{$index['id']}' AND C.`module_id`='{$modules['id']}'";
             $sql .= " ORDER BY C.`id` ASC";
             $datas = $cache->get($sql);
             if (!$datas) {
                 $datas = $db->customQuery($sql);
예제 #7
0
파일: index.php 프로젝트: phannack/GCMS
 $widget[] = '<div id=gchat_div>';
 $widget[] = '<div id=gchat_body>';
 $widget[] = '<dl id=gchat_content></dl>';
 $widget[] = '<p id=gchat_smile>';
 $f = @opendir(ROOT_PATH . 'widgets/chat/smile/');
 if ($f) {
     while (false !== ($text = readdir($f))) {
         if ($text != '.' && $text != '..') {
             if (preg_match('/(.*).gif/', $text, $match)) {
                 $widget[] = '<img src=' . WEB_URL . '/widgets/chat/smile/' . $match[1] . '.gif alt=' . $match[1] . ' class=nozoom>';
             }
         }
     }
     closedir($f);
 }
 $t = gcms::isMember() ? 'LNG_CHAT_TEXT_TITLE' : 'LNG_CHAT_INVALID_LOGIN';
 $widget[] = '</p>';
 $widget[] = '<form id=gchat_frm class=input-groups method=post action=' . WEB_URL . '/index.php>';
 $widget[] = '<label class="width g-input"><input type=text id=gchat_text maxlength=50 disabled placeholder="{' . $t . '}"></label>';
 $widget[] = '<label class=width><input type=submit class="button wide send" value="Send"></label>';
 $widget[] = '<span class=width><a id=gchat_sound class=icon-vol-up title="{LNG_CHAT_SOUND}"></a></span>';
 $widget[] = '</form>';
 $widget[] = '</div>';
 $widget[] = '</div>';
 $widget[] = '<script>';
 $widget[] = 'new GChat({';
 $widget[] = 'interval:' . max(1, $config['chat_time']) . ',';
 $widget[] = 'lines:' . max(1, $config['chat_lines']);
 $widget[] = '});';
 $widget[] = '</script>';
 $widget = implode("\n", $widget);