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


PHP admin_write_settings函数代码示例

本文整理汇总了PHP中admin_write_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP admin_write_settings函数的具体用法?PHP admin_write_settings怎么用?PHP admin_write_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: admin_get_root

$adminroot = admin_get_root();
// need all settings
$settingspage = $adminroot->locate($section, true);
if (empty($settingspage) or !$settingspage instanceof admin_settingpage) {
    print_error('sectionerror', 'admin', "{$CFG->wwwroot}/{$CFG->admin}/");
    die;
}
if (!$settingspage->check_access()) {
    print_error('accessdenied', 'admin');
    die;
}
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
$statusmsg = '';
$errormsg = '';
if ($data = data_submitted() and confirm_sesskey()) {
    if (admin_write_settings($data)) {
        $statusmsg = get_string('changessaved');
    }
    if (empty($adminroot->errors)) {
        switch ($return) {
            case 'site':
                redirect("{$CFG->wwwroot}/");
            case 'admin':
                redirect("{$CFG->wwwroot}/{$CFG->admin}/");
        }
    } else {
        $errormsg = get_string('errorwithsettings', 'admin');
        $firsterror = reset($adminroot->errors);
    }
    $adminroot = admin_get_root(true);
    //reload tree
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:31,代码来源:settings.php

示例2: process_config

 function process_config($config)
 {
     if ($data = data_submitted() and confirm_sesskey()) {
         if (admin_write_settings($data)) {
             $statusmsg = get_string('changessaved');
         }
     }
     return true;
     // set to defaults if undefined
     if (!isset($config->hostname)) {
         $config->hostname = 'http://';
     } else {
         // remove trailing slash
         $config->hostname = rtrim($config->hostname, '/');
     }
     if (!isset($config->endpoint)) {
         $config->endpoint = '';
     } else {
         if (substr($config->endpoint, 0, 1) != '/') {
             //no preceding slash! Add one!
             $config->endpoint = '/' . $config->endpoint;
         }
         // remove trailing slash
         $config->endpoint = rtrim($config->endpoint, '/');
     }
     if (!isset($config->remote_user)) {
         $config->remote_user = '';
     }
     if (!isset($config->remote_pw)) {
         $config->remote_pw = '';
     }
     if (!isset($config->removeuser)) {
         $config->removeuser = AUTH_REMOVEUSER_KEEP;
     }
     if (!isset($config->cohorts)) {
         $config->cohorts = 0;
     }
     if (!isset($config->cohort_view)) {
         $config->cohort_view = '';
     }
     // Lock the idnumber as this is the drupal uid number
     // NOT WORKING!
     $config->field_lock_idnumber = 'locked';
     // save settings
     set_config('hostname', $config->hostname, 'auth_drupalservices');
     set_config('cookiedomain', $config->cookiedomain, 'auth_drupalservices');
     set_config('endpoint', $config->endpoint, 'auth_drupalservices');
     set_config('remote_user', $config->remote_user, 'auth_drupalservices');
     set_config('remote_pw', $config->remote_pw, 'auth_drupalservices');
     set_config('cohorts', $config->cohorts, 'auth_drupalservices');
     set_config('cohort_view', $config->cohort_view, 'auth_drupalservices');
     set_config('removeuser', $config->removeuser, 'auth_drupalservices');
     set_config('field_lock_idnumber', $config->field_lock_idnumber, 'auth_drupalservices');
     return true;
 }
开发者ID:kiklop74,项目名称:moodle-drupalservices,代码行数:55,代码来源:auth.php

示例3: optional_param

// $Id$
// detects settings that were added during an upgrade, displays a screen for the admin to
// modify them, and then processes modifications
require_once '../config.php';
require_once $CFG->libdir . '/adminlib.php';
$return = optional_param('return', '', PARAM_ALPHA);
/// no guest autologin
require_login(0, false);
$adminroot = admin_get_root();
// need all settings
admin_externalpage_setup('upgradesettings');
// now hidden page
// now we'll deal with the case that the admin has submitted the form with new settings
if ($data = data_submitted() and confirm_sesskey()) {
    $count = admin_write_settings($data);
    $adminroot = admin_get_root(true);
    //reload tree
}
$newsettings = admin_output_new_settings_by_page($adminroot);
if (isset($newsettings['frontpagesettings'])) {
    $frontpage = $newsettings['frontpagesettings'];
    unset($newsettings['frontpagesettings']);
    array_unshift($newsettings, $frontpage);
}
$newsettingshtml = implode($newsettings);
unset($newsettings);
$focus = '';
if (empty($adminroot->errors) and $newsettingshtml === '') {
    // there must be either redirect without message or continue button or else upgrade would be sometimes broken
    if ($return == 'site') {
开发者ID:ajv,项目名称:Offline-Caching,代码行数:30,代码来源:upgradesettings.php

示例4: admin_write_settings

    $json_output["version"] = $server_files_version;
}
if (isset($_GET['admin'])) {
    //if(is_siteadmin($USER->id)) {
    require_once $CFG->libdir . '/adminlib.php';
    if (isset($_POST['s__lang'])) {
        admin_write_settings((object) array("s__lang" => $_POST['s__lang']));
    } else {
        if (isset($_POST['s__fullname'])) {
            admin_write_settings((object) array("s__fullname" => $_POST['s__fullname']));
        } else {
            if (isset($_POST['s__shortname'])) {
                admin_write_settings((object) array("s__shortname" => $_POST['s__shortname']));
            } else {
                if (isset($_POST['s__summary'])) {
                    admin_write_settings((object) array("s__summary" => $_POST['s__summary']));
                }
            }
        }
    }
    //}
}
if (isset($_GET['server_info']) || $update_all) {
    $register_users_enabled = TRUE;
    if ((int) $CFG->version < 2007092000) {
        if ($CFG->auth == "none") {
            $register_users_enabled = FALSE;
        } else {
            if ($CFG->auth != "email") {
                if (!function_exists('auth_user_login')) {
                    require_once "../auth/{$CFG->auth}/lib.php";
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:main.php


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