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


PHP gcms::r2config方法代码示例

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


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

示例1: isset

<?php

// widgets/document/index.php
$widget = '';
if (defined('MAIN_INIT') && preg_match('/^[a-z0-9]{4,}$/', $module) && isset($install_modules[$module])) {
    // module
    $index = $install_modules[$module];
    // อ่าน config
    gcms::r2config($index['config'], $index);
    // ค่าที่ส่งมา
    $id = $index['module_id'];
    $cat = isset($cat) ? $cat : 0;
    $new_date = (int) $index['new_date'];
    $interval = isset($interval) ? (int) $interval : 0;
    $cols = isset($cols) ? (int) $cols : 1;
    $rows = isset($rows) ? (int) $rows : 0;
    $show = isset($show) && preg_match('/^[a-z0-9]+$/', $show) ? $show : '';
    if ($rows > 0) {
        $count = $rows * $cols;
    } else {
        $count = isset($count) ? (int) $count : 0;
        $count = $count == 0 ? $index['news_count'] : $count;
    }
    $sort = isset($sort) ? (int) $sort : $index['news_sort'];
    if ($count > 0) {
        $styles = isset($styles) && in_array($styles, array('list', 'icon', 'thumb')) ? $styles : 'list';
        // แสดงผล
        $patt = array('/{ID}/', '/{DETAIL}/', '/{MODULE}/');
        $replace = array();
        $replace[0] = "widget_" . (empty($index['module']) ? '' : $index['module']) . "_{$id}_{$cat}_{$count}_{$new_date}_{$sort}_{$cols}_{$styles}_{$show}";
        $replace[1] = "<script>getWidgetNews('{$replace['0']}', 'document', {$interval});</script>";
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:index.php

示例2: array

 $content[] = '<th id=c3 scope=col class="center tablet">{LNG_ICON}</th>';
 $content[] = '<th id=c4 scope=col class=center>{LNG_ID}</th>';
 $content[] = '<th id=c5 scope=col class="center tablet">{LNG_CAN_REPLY}</th>';
 $content[] = '<th id=c6 scope=col class="center tablet">{LNG_PUBLISHED}</th>';
 $content[] = '<th id=c7 scope=col class=mobile>{LNG_DESCRIPTION}</th>';
 $content[] = '<th id=c8 scope=col class="center tablet">{LNG_CATEGORY_COUNT}</th>';
 $content[] = '<th id=c9 scope=col></th>';
 $content[] = '</tr>';
 $content[] = '</thead>';
 $content[] = '<tbody>';
 // เรียกหมวดหมู่ทั้งหมด
 $categories = array();
 $sql = "SELECT * FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['id']}' ORDER BY `category_id`";
 foreach ($db->customQuery($sql) as $item) {
     $save = array();
     gcms::r2config($item['config'], $save);
     $save['category_id'] = $item['category_id'];
     $save['published'] = $item['published'];
     $save['c1'] = $item['c1'];
     $topics = gcms::ser2Array($item, 'topic');
     $details = gcms::ser2Array($item, 'detail');
     $icons = gcms::ser2Array($item, 'icon');
     foreach ($topics as $k => $v) {
         $save['topic'] = empty($topics[$k]) ? isset($topics[LANGUAGE]) ? $topics[LANGUAGE] : '' : $topics[$k];
         $save['detail'] = empty($details[$k]) ? isset($details[LANGUAGE]) ? $details[LANGUAGE] : '' : $details[$k];
         $save['icon'] = empty($icons[$k]) ? isset($icons[LANGUAGE]) ? $icons[LANGUAGE] : '' : $icons[$k];
         $categories[$item['id']][$k] = $save;
     }
     if (sizeof($categories[$item['id']]) == 1) {
         foreach ($categories[$item['id']] as $k => $v) {
             if ($k != '') {
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:admin_category.php

示例3: array

                        $db->edit(DB_CATEGORY, $search['id'], array('category_id' => $value));
                        $ret['categoryid_' . $index['id'] . '_' . $id] = $value;
                    } else {
                        $ret['categoryid_' . $index['id'] . '_' . $id] = $search['category_id'];
                    }
                }
            } elseif ($admin && $action == 'published' && $id != '') {
                // อัปเดท published
                $db->query("UPDATE `" . DB_CATEGORY . "` SET `published`='" . (int) $_POST['value'] . "' WHERE `id` IN ({$id}) AND `module_id`='{$index['id']}'");
            } elseif ($action == 'changecategory') {
                // อ่าน category ขณะเขียน
                if ($value > 0) {
                    $ret = array();
                    // อ่าน category
                    $sql = "SELECT `config` FROM `" . DB_CATEGORY . "` WHERE `category_id`='{$value}' AND `module_id`='{$index['id']}' LIMIT 1";
                    $category = $db->customQuery($sql);
                    if (sizeof($category) == 1) {
                        $category = $category[0];
                        // config
                        gcms::r2config($category['config'], $category);
                        $ret['write_can_reply'] = (int) $category['can_reply'];
                    }
                }
            }
        }
    }
} else {
    $ret['error'] = 'ACTION_ERROR';
}
// คืนค่าเป็น JSON
echo gcms::array2json($ret);
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:admin_category_action.php

示例4: sizeof

     $index = sizeof($index) == 0 ? false : $index[0];
 } else {
     $index = $cache->get($sql);
     if (!$index) {
         $index = $db->customQuery($sql);
         $index = sizeof($index) == 0 ? false : $index[0];
     }
 }
 if (!$index) {
     $title = $lng['PAGE_NOT_FOUND'];
     $content = '<div class=error>' . $title . '</div>';
 } else {
     // login
     $login = gcms::getVars($_SESSION, 'login', array('id' => 0, 'status' => -1, 'email' => '', 'password' => ''));
     // config
     gcms::r2config($index['config'], $index, false);
     // แสดงความคิดเห็นได้
     $canReply = $index['can_reply'] == 1;
     // ผู้ดูแล,เจ้าของเรื่อง (ลบ-แก้ไข บทความ,ความคิดเห็นได้)
     $moderator = gcms::canConfig($index, 'moderator');
     $moderator = $isMember && ($moderator || $index['member_id'] == $login['id']);
     // guest มีสถานะเป็น -1
     $status = $isMember ? $login['status'] : -1;
     // สถานะสมาชิกที่สามารถเปิดดูกระทู้ได้
     $canview = in_array($status, explode(',', $index['can_view']));
     if ($canview || $index['viewing'] == 1) {
         // สามารถลบได้ (mod และ เจ้าของ=ลบ,สมาชิกทั่วไป=แจ้งลบ)
         $canDelete = $moderator || $isMember && defined('DB_PM');
         // อัปเดทการเปิดดู
         if (!isset($_REQUEST['visited'])) {
             $index['visited']++;
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:view.php

示例5: ISNULL

     $sql .= " LIMIT 1";
 } else {
     // ใหม่ ตรวจสอบโมดูล
     $sql = "SELECT M.`id` AS `module_id`,M.`module`,M.`owner`,C.`category_id`,'{$mmktime}' AS `create_date`";
     $sql .= ",(CASE WHEN ISNULL(C.`config`) THEN M.`config` ELSE CONCAT(M.`config`,'\n',C.`config`) END) AS `config`";
     $sql .= " FROM `" . DB_MODULES . "` AS M";
     $sql .= " INNER JOIN `" . DB_INDEX . "` AS I ON I.`module_id`={$module_id} AND I.`index`='1' AND I.`language` IN ('" . LANGUAGE . "','')";
     $sql .= " LEFT JOIN `" . DB_CATEGORY . "` AS C ON C.`category_id`={$cat} AND C.`module_id`={$module_id}";
     $sql .= " WHERE M.`id`={$module_id} AND M.`owner`='document'";
     $sql .= " LIMIT 1";
 }
 $index = $db->customQuery($sql);
 $index = sizeof($index) == 1 ? $index[0] : false;
 if ($index) {
     // config
     gcms::r2config($index['config'], $index, $id == 0);
     // login
     $login = gcms::getVars($_SESSION, 'login', array('id' => 0, 'status' => -1, 'email' => '', 'password' => ''));
     if ($id > 0) {
         // แก้ไข ตรวจสอบเจ้าของหรือ ผู้ดูแล
         $canWrite = $index['member_id'] == $login['id'] || in_array($login['status'], explode(',', $index['moderator']));
     } else {
         // เขียนใหม่ ตรวจสอบคนเขียน
         $canWrite = in_array($login['status'], explode(',', $index['can_write']));
     }
 }
 if (!$index) {
     // ไมพบบทความหรือโมดูล
     $title = $lng['PAGE_NOT_FOUND'];
     $content[] = '<aside class=error>' . $title . '</aside>';
 } elseif (!$canWrite) {
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:admin_write.php

示例6: IN

 $id = gcms::getVars($_GET, 'id', 0);
 // query ข้อมูล
 $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);
开发者ID:phannack,项目名称:GCMS,代码行数:31,代码来源:print.php


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