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


PHP ConfigHelper::checkPrivilege方法代码示例

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


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

示例1: array

        $args = array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_UICONF] => $id, 'disabled' => $disabled ? 0 : 1);
        $SYSLOG->AddMessage(SYSLOG_RES_UICONF, SYSLOG_OPER_UPDATE, $args, array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_UICONF]));
    }
    $DB->Execute('UPDATE uiconfig SET disabled = CASE disabled WHEN 0 THEN 1 ELSE 0 END WHERE id = ?', array($id));
    $SESSION->redirect('?m=configlist');
}
$config = $DB->GetRow('SELECT * FROM uiconfig WHERE id = ?', array($id));
$option = $config['section'] . '.' . $config['var'];
$config['type'] = $config['type'] == CONFIG_TYPE_AUTO ? $LMS->GetConfigDefaultType($option) : $config['type'];
if (isset($_POST['config'])) {
    $cfg = $_POST['config'];
    $cfg['id'] = $id;
    foreach ($cfg as $key => $val) {
        $cfg[$key] = trim($val);
    }
    if (!ConfigHelper::checkPrivilege('superuser')) {
        $cfg['type'] = $config['type'];
    }
    if ($cfg['var'] == '') {
        $error['var'] = trans('Option name is required!');
    } elseif (strlen($cfg['var']) > 64) {
        $error['var'] = trans('Option name is too long (max.64 characters)!');
    } elseif (!preg_match('/^[a-z0-9_-]+$/', $cfg['var'])) {
        $error['var'] = trans('Option name contains forbidden characters!');
    }
    if (($cfg['var'] != $config['var'] || $cfg['section'] != $config['section']) && $LMS->GetConfigOptionId($cfg['var'], $cfg['section'])) {
        $error['var'] = trans('Option exists!');
    }
    if (!preg_match('/^[a-z0-9_-]+$/', $cfg['section']) && $cfg['section'] != '') {
        $error['section'] = trans('Section name contains forbidden characters!');
    }
开发者ID:itav,项目名称:lms,代码行数:31,代码来源:configedit.php

示例2: isset

 *  it under the terms of the GNU General Public License Version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 *  USA.
 *
 *  $Id$
 */
$permanent = ConfigHelper::checkPrivilege('permanent_customer_removal') && isset($_GET['type']) && $_GET['type'] == 'permanent';
$layout['pagetitle'] = trans($permanent ? 'Permanent Customer Remove: $a' : 'Customer Remove: $a', sprintf("%04d", $_GET['id']));
$SMARTY->assign('customerid', $_GET['id']);
if (!$LMS->CustomerExists($_GET['id'])) {
    $body = '<P>' . trans('Incorrect Customer ID.') . '</P>';
} else {
    if ($_GET['is_sure'] != 1) {
        if ($permanent) {
            $body = '<P>' . trans('Do you want to permanently remove $a customer?', $LMS->GetCustomerName($_GET['id'])) . '</P>';
            $body .= '<P>' . trans('This operation will be irreversible!') . '</P>';
        } else {
            $body = '<P>' . trans('Do you want to remove $a customer?', $LMS->GetCustomerName($_GET['id'])) . '</P>';
            $body .= '<P>' . trans('All customer data and computers bound to this customer will be lost!') . '</P>';
        }
        $body .= '<P><A HREF="?m=customerdel&id=' . $_GET['id'] . ($permanent ? '&type=permanent' : '') . '&is_sure=1">' . trans('Yes, I do.') . '</A></P>';
    } else {
开发者ID:kornelek,项目名称:lms,代码行数:31,代码来源:customerdel.php

示例3: trans

     $error['var'] = trans('Option name is required!');
 } elseif (strlen($config['var']) > 64) {
     $error['var'] = trans('Option name is too long (max.64 characters)!');
 } elseif (!preg_match('/^[a-z0-9_-]+$/', $config['var'])) {
     $error['var'] = trans('Option name contains forbidden characters!');
 } elseif ($LMS->GetConfigOptionId($config['var'], $config['section'])) {
     $error['var'] = trans('Option exists!');
 }
 $section = empty($config['section']) ? $config['newsection'] : $config['section'];
 if (empty($section)) {
     $error['newsection'] = trans('Section name can\'t be empty!');
 } elseif (!preg_match('/^[a-z0-9_-]+$/', $section)) {
     $error[empty($config['section']) ? 'newsection' : 'section'] = trans('Section name contains forbidden characters!');
 }
 $option = $config['section'] . '.' . $config['var'];
 if (!ConfigHelper::checkPrivilege('superuser') || $config['type'] == CONFIG_TYPE_AUTO) {
     $config['type'] = $LMS->GetConfigDefaultType($option);
 }
 if ($msg = $LMS->CheckOption($option, $config['value'], $config['type'])) {
     $error['value'] = $msg;
 }
 if (!isset($config['disabled'])) {
     $config['disabled'] = 0;
 }
 if (!$error) {
     $args = array('section' => $section, 'var' => $config['var'], 'value' => $config['value'], 'description' => $config['description'], 'disabled' => $config['disabled'], 'type' => $config['type']);
     $DB->Execute('INSERT INTO uiconfig (section, var, value, description, disabled, type) VALUES (?, ?, ?, ?, ?, ?)', array_values($args));
     if ($SYSLOG) {
         $args[SYSLOG::RES_UICONF] = $DB->GetLastInsertID('uiconfig');
         $SYSLOG->AddMessage(SYSLOG::RES_UICONF, SYSLOG::OPER_ADD, $args);
     }
开发者ID:prezeskk,项目名称:lms,代码行数:31,代码来源:configadd.php


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