当前位置: 首页>>代码示例>>PHP>>正文


PHP gcms::isReferer方法代码示例

本文整理汇总了PHP中gcms::isReferer方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::isReferer方法的具体用法?PHP gcms::isReferer怎么用?PHP gcms::isReferer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gcms的用法示例。


在下文中一共展示了gcms::isReferer方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: header

<?php

// widgets/textlink/admin_action.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer, admin
if (gcms::isReferer() && gcms::isAdmin() && (empty($_SESSION['login']['account']) || $_SESSION['login']['account'] != 'demo')) {
    // ค่าที่ส่งมา
    $action = gcms::getVars($_POST, 'action', '');
    $id = gcms::getVars($_POST, 'id', '');
    $value = gcms::getVars($_POST, 'value', 0);
    if ($action == 'delete') {
        $sql = "SELECT `logo` FROM `" . DB_TEXTLINK . "` WHERE `id` IN({$id}) AND logo != ''";
        foreach ($db->customQuery($sql) as $item) {
            @unlink(DATA_PATH . 'image/' . $item['logo']);
        }
        $db->query("DELETE FROM `" . DB_TEXTLINK . "` WHERE `id` IN({$id})");
    } elseif ($action == 'published') {
        $db->query("UPDATE `" . DB_TEXTLINK . "` SET `published`='{$value}' WHERE `id` IN({$id})");
    } elseif ($action == 'move') {
        // move menu
        $max = 1;
        foreach (explode(',', str_replace('user-', '', $_POST['data'])) as $i) {
            $db->query("UPDATE `" . DB_TEXTLINK . "` SET `link_order`=" . $max . " WHERE `id`=" . (int) $i . " LIMIT 1");
            $max++;
        }
    } elseif ($action == 'styles') {
        // styles
        include ROOT_PATH . 'widgets/textlink/styles.php';
        // template
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:admin_action.php

示例2: header

<?php

// admin/import.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../bin/inint.php';
// ไฟล์ที่ส่งมา
$file = $_FILES['import_file'];
// แอดมินเท่านั้น
if (gcms::isReferer() && gcms::isAdmin() && $file['tmp_name'] != '') {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        echo gcms::array2json(array('error' => 'EX_MODE_ERROR'));
    } else {
        // long time
        set_time_limit(0);
        // อัปโหลด
        $fr = file($file['tmp_name']);
        // query ทีละบรรทัด
        foreach ($fr as $value) {
            $sql = str_replace(array('\\r', '\\n', '{prefix}', '/{WEBMASTER}/', '/{WEBURL}/'), array("\r", "\n", PREFIX, $_SESSION['login']['email'], WEB_URL), trim($value));
            if ($sql != '') {
                $db->query($sql);
            }
        }
    }
}
开发者ID:goragod,项目名称:php-framework-benchmark,代码行数:26,代码来源:import.php

示例3: header

<?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>';
    }
}
开发者ID:phannack,项目名称:GCMS,代码行数:16,代码来源:modal.php

示例4: header

<?php

// widgets/relate/getnews.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// ตรวจสอบ referer
if (gcms::isReferer() && preg_match('/^widget_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_(list|icon|thumb)$/', $_POST['id'], $match)) {
    // วันนี้
    $c_date = date('Y-m-d', $mmktime);
    // อ่านโมดูล
    $sql = "SELECT M.`config`,M.`module`,D.`relate`,Q.`id`,Q.`module_id`";
    $sql .= " FROM `" . DB_INDEX . "` AS Q";
    $sql .= " INNER JOIN `" . DB_INDEX_DETAIL . "` AS D ON D.`id`=Q.`id` AND D.`module_id`=Q.`module_id` AND D.`language` IN ('" . LANGUAGE . "','')";
    $sql .= " INNER JOIN " . DB_MODULES . " AS M ON M.`id`=D.`module_id`";
    $sql .= " WHERE D.`id`=" . (int) $match[1] . " AND M.`owner`='document' AND Q.`published`='1' AND Q.`published_date`<='{$c_date}' AND Q.`index` = '0' LIMIT 1";
    $index = $cache->get($sql);
    if (!$index) {
        $index = $db->customQuery($sql);
        if (sizeof($index) == 1) {
            $index = $index[0];
            // อ่าน config
            gcms::r2config($index['config'], $index);
            unset($index['config']);
            // save cached
            $cache->save($sql, $index);
        } else {
            $index = false;
        }
    }
    if ($index && $index['relate'] != '') {
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:getnews.php

示例5: header

<?php

// modules/personnel/admin_write_save.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
$ret = array();
// referer, member
if (gcms::isReferer() && gcms::canConfig($config, 'personnel_can_write')) {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        $ret['error'] = 'EX_MODE_ERROR';
    } else {
        $error = false;
        // ค่าที่ส่งมา
        $save = array();
        $save['name'] = $db->sql_trim_str($_POST, 'write_name');
        $save['email'] = $db->sql_trim_str($_POST, 'write_email');
        $save['position'] = $db->sql_trim_str($_POST, 'write_position');
        $save['phone'] = $db->sql_trim_str($_POST, 'write_phone');
        $save['address'] = $db->sql_trim_str($_POST, 'write_address');
        $save['detail'] = $db->sql_trim_str($_POST, 'write_detail');
        $save['category_id'] = gcms::getVars($_POST, 'write_category', 0);
        $save['order'] = min(99, max(0, (int) $_POST['write_order']));
        $icon = $_FILES['write_picture'];
        $id = gcms::getVars($_POST, 'write_id', 0);
        // ตรวจสอบค่าที่ส่งมา
        if ($id > 0) {
            $sql = "SELECT C.*,M.`module` FROM `" . DB_MODULES . "` AS M";
            $sql .= " INNER JOIN `" . DB_PERSONNEL . "` AS C ON C.`module_id`=M.`id` AND C.`id`={$id}";
        } else {
            $sql1 = "SELECT MAX(`id`)+1 FROM `" . DB_PERSONNEL . "` WHERE `module_id`=M.`id`";
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:admin_write_save.php

示例6: header

<?php

// modules/member/action.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer
if (gcms::isReferer() && $db->sql_trim_str($_POST, 'value') != $_SESSION[$_POST['antispam']]) {
    echo 'ANTISPAM_INCORRECT';
}
开发者ID:phannack,项目名称:GCMS,代码行数:10,代码来源:checkantispam.php

示例7: array

// inint
include '../bin/inint.php';
// action
$action = gcms::getVars($_POST, 'action', '');
// ตรวจสอบ id
$ids = array();
foreach (explode(',', $_POST['id']) as $id) {
    // ไม่สามารถแก้ไขตัวเองได้
    if ($_SESSION['login']['id'] != $id) {
        $ids[] = (int) $id;
    }
}
// id ของ สมาชิกทั้งหมดที่ส่งมา
$ids = implode(',', $ids);
// ตรวจสอบ referer และ admin
if (gcms::isReferer() && gcms::isAdmin() && $ids != '') {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        echo $lng['ACTION_FORBIDDEN'];
    } else {
        if ($action == 'delete') {
            // ลบสมาชิกที่เลือก
            $sql = "SELECT `icon` FROM `" . DB_USER . "` WHERE `id` IN ({$ids}) AND `id`!=1 AND `icon`!=''";
            foreach ($db->customQuery($sql) as $item) {
                // ลบรูปภาพสมาชิก
                @unlink(USERICON_FULLPATH . $item['icon']);
            }
            // ลบสมาชิก
            $db->query("DELETE FROM `" . DB_USER . "` WHERE `id` IN ({$ids}) AND `id`!=1");
        } elseif ($action == 'activate' || $action == 'sendpassword') {
            // ส่งอีเมล์ยืนยันสมาชิก อีกครั้ง
            $sql = "SELECT `id`,`email`,`activatecode` FROM `" . DB_USER . "` WHERE `id` IN ({$ids}) AND `fb`='0'";
开发者ID:goragod,项目名称:php-framework-benchmark,代码行数:31,代码来源:memberaction.php

示例8: header

<?php

// modules/gallery/admin_action.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
$ret = array();
// referer, member
if (gcms::isReferer() && gcms::canConfig($config, 'gallery_can_write')) {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        $ret['error'] = 'EX_MODE_ERROR';
    } else {
        $action = gcms::getVars($_POST, 'action', '');
        $ids = array();
        foreach (explode(',', $_POST['id']) as $id) {
            $ids[] = (int) $id;
        }
        if (sizeof($ids) > 0) {
            $ids = implode(',', $ids);
            if ($action == 'delete') {
                // ลบอัลบัม, ตรวจสอบ id
                $sql = "SELECT `id` FROM `" . DB_GALLERY_ALBUM . "` WHERE `id` IN ({$ids}) AND `module_id`=(SELECT `id` FROM `" . DB_MODULES . "` WHERE `owner`='gallery')";
                $ids = array();
                foreach ($db->customQuery($sql) as $item) {
                    // ลบโฟลเดอร์และรูป
                    gcms::rm_dir(DATA_PATH . "gallery/{$item['id']}/");
                    // id ที่ลบ
                    $ids[] = $item['id'];
                }
                if (sizeof($ids) > 0) {
                    $ids = implode(',', $ids);
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:admin_action.php

示例9: header

<?php

// admin/savewrite.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../bin/inint.php';
$ret = array();
// ตรวจสอบ referer และ แอดมิน
if (gcms::isReferer() && gcms::isAdmin() && (isset($_POST['intro']) || isset($_POST['maintenance']))) {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        $ret['error'] = 'EX_MODE_ERROR';
    } else {
        // ภาษาทีต้องการบันทึก
        $lang = gcms::getVars($_POST, 'write_language', '');
        $lang = in_array($lang, $config['languages']) ? $lang : LANGUAGE;
        $patt = array();
        $replace = array();
        // ตัด /r/n
        $patt[] = '/[\\r\\n]{1,}/su';
        $replace[] = '';
        // หน้าว่างๆ
        $patt[] = '/^(&nbsp;|\\s){0,}<br[\\s\\/]+?>(&nbsp;|\\s){0,}$/iu';
        $replace[] = '';
        // ตัด PHP
        $patt[] = '/<\\?(.*?)\\?>/su';
        $replace[] = '';
        $save = array();
        $detail = $db->sql_quote(preg_replace($patt, $replace, $_POST['write_detail']));
        // ตรวจสอบ ข้อความเดิม
        $key = isset($_POST['intro']) && $_POST['intro'] == 1 ? 'INTRO_PAGE_DETAIL' : 'MAINTENANCE_DETAIL';
        $search = $db->basicSearch(DB_LANGUAGE, 'key', $key);
开发者ID:goragod,项目名称:php-framework-benchmark,代码行数:31,代码来源:savewrite.php

示例10: header

<?php

// modules/video/admin_config_save.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
$ret = array();
// referer, admin
if (gcms::isReferer() && gcms::canConfig($config, 'video_can_config')) {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        $ret['error'] = 'EX_MODE_ERROR';
    } else {
        // โหลด config ใหม่
        $config = array();
        if (is_file(CONFIG)) {
            include CONFIG;
        }
        // ค่าที่ส่งมา
        $config['google_api_key'] = gcms::getVars($_POST, 'google_api_key', '');
        $config['video_cols'] = gcms::getVars($_POST, 'config_cols', 0);
        $config['video_rows'] = gcms::getVars($_POST, 'config_rows', 0);
        $config['video_can_write'] = isset($_POST['config_can_write']) ? $_POST['config_can_write'] : array();
        $config['video_can_write'][] = 1;
        $config['video_can_config'] = isset($_POST['config_can_config']) ? $_POST['config_can_config'] : array();
        $config['video_can_config'][] = 1;
        // บันทึก config.php
        if (gcms::saveconfig(CONFIG, $config)) {
            $ret['error'] = 'SAVE_COMPLETE';
            $ret['location'] = 'reload';
        } else {
            $ret['error'] = 'DO_NOT_SAVE';
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:admin_config_save.php

示例11: header

<?php

// modules/edocument/action.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer
if (gcms::isReferer() && preg_match('/^(icon\\-)?(download|downloading|delete)\\s([0-9]+)$/', $_POST['id'], $match)) {
    // ค่าที่ส่งมา
    $action = $match[2];
    $id = $match[3];
    // login
    $login = gcms::getVars($_SESSION, 'login', array('id' => 0, 'status' => -1, 'email' => '', 'password' => ''));
    // guest = -1
    $status = isset($login['status']) ? $login['status'] : -1;
    if ($action == 'download' || $action == 'downloading') {
        // ไฟล์ดาวน์โหลด
        $sql = "SELECT D.*,N.`id` AS `download_id`,N.`downloads` FROM `" . DB_EDOCUMENT . "` AS D";
        $sql .= " LEFT JOIN `" . DB_EDOCUMENT_DOWNLOAD . "` AS N ON N.`document_id`=D.`id` AND N.`member_id`=" . (int) $login['id'];
        $sql .= " WHERE D.`id`=" . (int) $id . " LIMIT 1";
        $download = $db->customQuery($sql);
        $download = sizeof($download) == 1 ? $download[0] : false;
        $file_path = DATA_PATH . "edocument/{$download['file']}";
        // ตรวจสอบสถานะการดาวน์โหลด
        if (!$download || !is_file($file_path)) {
            $ret['error'] = 'DOWNLOAD_FILE_NOT_FOUND';
        } elseif (!in_array($status, explode(',', $download['reciever']))) {
            $ret['error'] = 'DO_NOT_DOWNLOAD';
        } elseif ($action == 'download') {
            $ret['confirm'] = 'CONFIRM_DOWNLOAD';
        } elseif ($action == 'downloading') {
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:action.php

示例12: header

<?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';
开发者ID:goragod,项目名称:php-framework-benchmark,代码行数:31,代码来源:mailto.php

示例13: header

<?php

// admin/savestatus.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../bin/inint.php';
$ret = array();
// referer, admin
if (gcms::isReferer() && gcms::isAdmin()) {
    if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
        $ret['error'] = 'EX_MODE_ERROR';
    } else {
        // action
        $action = gcms::getVars($_POST, 'action', '');
        // โหลด config ใหม่
        $config = array();
        if (is_file(CONFIG)) {
            include CONFIG;
        }
        if ($action == 'config_status_add') {
            if (!isset($config['member_status'][0])) {
                $config['member_status'][0] = 'สมาชิก';
                $config['color_status'][0] = '#006600';
            }
            if (!isset($config['member_status'][1])) {
                $config['member_status'][1] = 'ผู้ดูแลระบบ';
                $config['color_status'][1] = '#FF0000';
            }
            // เพิ่มสถานะสมาชิกใหม่
            $config['member_status'][] = "{$lng['LNG_CLICK_TO']} {$lng['LNG_EDIT']}";
            $config['color_status'][] = '#000000';
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:savestatus.php

示例14: header

<?php

// widgets/tags/action.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer
if (gcms::isReferer()) {
    // อัปเดทการคลิก
    list($action, $id) = explode('-', $_POST['id']);
    if ($action == 'tags') {
        $sql = "UPDATE `" . DB_TAGS . "` SET `count`=`count`+1 WHERE `id`=" . (int) $id . " LIMIT 1";
        $db->query($sql);
    }
}
开发者ID:phannack,项目名称:GCMS,代码行数:15,代码来源:action.php


注:本文中的gcms::isReferer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。