• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP set_config函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: announces_prune

function announces_prune($force_prune = false)
{
    global $db, $board_config;
    // do we prune the announces ?
    $today_time = time();
    $today = mktime(0, 0, 0, date('m', $today_time), date('d', $today_time) + 1, date('Y', $today_time)) - 1;
    $do_prune = false;
    // last prune date
    if (intval($board_config['announcement_last_prune']) < $today || $force_prune) {
        $do_prune = true;
        if ($sql = set_config('announcement_last_prune', $today, TRUE)) {
            message_die(GENERAL_ERROR, 'Could not update key announcement_last_prune in the config table', '', __LINE__, __FILE__, $sql);
        }
    }
    // is the prune function activated ?
    $default_duration = isset($board_config['announcement_duration']) ? intval($board_config['announcement_duration']) : 7;
    if ($default_duration <= 0) {
        $do_prune = false;
    }
    // process fix and prune
    if ($do_prune) {
        // fix announces duration
        $default_duration = isset($board_config['announcement_duration']) ? intval($board_config['announcement_duration']) : 7;
        $sql = "UPDATE " . TOPICS_TABLE . "\n\t\t\t\tSET topic_announce_duration = {$default_duration}\n\t\t\t\tWHERE topic_announce_duration = 0\n\t\t\t\t\tAND (topic_type=" . POST_ANNOUNCE . " OR topic_type=" . POST_GLOBAL_ANNOUNCE . ")";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not update topic duration list', '', __LINE__, __FILE__, $sql);
        }
        // prune announces
        $prune_strategy = isset($board_config['announcement_prune_strategy']) ? intval($board_config['announcement_prune_strategy']) : POST_NORMAL;
        $sql = "UPDATE " . TOPICS_TABLE . "\n\t\t\t\tSET topic_type = {$prune_strategy}\n\t\t\t\tWHERE (topic_announce_duration > -1)\n\t\t\t\t\tAND ( (topic_time + topic_announce_duration * 86400) <= {$today} )\n\t\t\t\t\tAND (topic_type=" . POST_ANNOUNCE . " OR topic_type=" . POST_GLOBAL_ANNOUNCE . ")";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not update topic type to prune announcements', '', __LINE__, __FILE__, $sql);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:35,代码来源:functions_announces.php


示例2: xmldb_filter_mediaplugin_upgrade

/**
 * @param int $oldversion the version we are upgrading from
 * @return bool result
 */
function xmldb_filter_mediaplugin_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2011121200) {
        // Move all the media enable setttings that are now handled by core media renderer.
        foreach (array('html5video', 'html5audio', 'mp3', 'flv', 'wmp', 'qt', 'rm', 'youtube', 'vimeo', 'swf') as $type) {
            $existingkey = 'filter_mediaplugin_enable_' . $type;
            if (array_key_exists($existingkey, $CFG)) {
                set_config('core_media_enable_' . $type, $CFG->{$existingkey});
                unset_config($existingkey);
            }
        }
        // Override setting for html5 to turn it on (previous default was off; because
        // of changes in the way fallbacks are handled, this is now unlikely to cause
        // a problem, and is required for mobile a/v support on non-Flash devices, so
        // this change is basically needed in order to maintain existing behaviour).
        set_config('core_media_enable_html5video', 1);
        set_config('core_media_enable_html5audio', 1);
        upgrade_plugin_savepoint(true, 2011121200, 'filter', 'mediaplugin');
    }
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    return true;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:upgrade.php


示例3: xmldb_theme_formal_white_upgrade

function xmldb_theme_formal_white_upgrade($oldversion)
{
    // Moodle v2.2.0 release upgrade line
    // Put any upgrade step following this
    if ($oldversion < 2012051503) {
        $currentsetting = get_config('theme_formal_white');
        if (isset($currentsetting->displaylogo)) {
            // useless but safer
            // Create a new config setting called headercontent and give it the current displaylogo value.
            set_config('headercontent', $currentsetting->displaylogo, 'theme_formal_white');
            unset_config('displaylogo', 'theme_formal_white');
        }
        if (isset($currentsetting->logo)) {
            // useless but safer
            // Create a new config setting called headercontent and give it the current displaylogo value.
            set_config('customlogourl', $currentsetting->logo, 'theme_formal_white');
            unset_config('logo', 'theme_formal_white');
        }
        if (isset($currentsetting->frontpagelogo)) {
            // useless but safer
            // Create a new config setting called headercontent and give it the current displaylogo value.
            set_config('frontpagelogourl', $currentsetting->frontpagelogo, 'theme_formal_white');
            unset_config('frontpagelogo', 'theme_formal_white');
        }
        upgrade_plugin_savepoint(true, 2012051503, 'theme', 'formal_white');
    }
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:eamador,项目名称:moodle-course-custom-fields,代码行数:34,代码来源:upgrade.php


示例4: as_cron

/**
 * Runs the cron functions
 */
function as_cron()
{
    global $db, $config;
    set_config('last_as_run', time(), true);
    if (!function_exists('add_log')) {
        include $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
    }
    if ($config['as_max_posts'] > 0) {
        $sql = 'SELECT COUNT(shout_id) as total FROM ' . SHOUTBOX_TABLE;
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchfield('total', $result);
        $db->sql_freeresult($result);
        if ($row > $config['as_max_posts']) {
            $sql = 'SELECT shout_id FROM ' . SHOUTBOX_TABLE . ' ORDER BY shout_time DESC';
            $result = $db->sql_query_limit($sql, $config['as_max_posts']);
            $delete = array();
            while ($row = $db->sql_fetchrow($result)) {
                $delete[] = $row['shout_id'];
            }
            $sql = 'DELETE FROM ' . SHOUTBOX_TABLE . ' WHERE ' . $db->sql_in_set('shout_id', $delete, true);
            $db->sql_query($sql);
            add_log('admin', 'LOG_AS_REMOVED', $db->sql_affectedrows($result));
        }
    } else {
        if ($config['as_prune'] > 0) {
            $time = time() - $config['as_prune'] * 3600;
            $sql = 'DELETE FROM  ' . SHOUTBOX_TABLE . " WHERE shout_time < {$time}";
            $db->sql_query($sql);
            $deleted = $db->sql_affectedrows($result);
            if ($deleted > 0) {
                add_log('admin', 'LOG_AS_PURGED', $deleted);
            }
        }
    }
}
开发者ID:paul999,项目名称:ajax-shoutbox,代码行数:38,代码来源:functions_shoutbox.php


示例5: disable_plugin

 protected function disable_plugin()
 {
     $enabled = enrol_get_plugins(true);
     unset($enabled['cohort']);
     $enabled = array_keys($enabled);
     set_config('enrol_plugins_enabled', implode(',', $enabled));
 }
开发者ID:stronk7,项目名称:moodle,代码行数:7,代码来源:sync_test.php


示例6: xmldb_filter_texwjax_upgrade

/**
 * @param int $oldversion the version we are upgrading from
 * @return bool result
 */
function xmldb_filter_texwjax_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    if ($oldversion < 2013120300) {
        $settings = array('density', 'latexbackground', 'convertformat', 'pathlatex', 'convertformat', 'pathconvert', 'pathdvips', 'latexpreamble');
        // Move tex settings to config_pluins and delete entries from the config table.
        foreach ($settings as $setting) {
            $existingkey = 'filter_texwjax_' . $setting;
            if (array_key_exists($existingkey, $CFG)) {
                set_config($setting, $CFG->{$existingkey}, 'filter_texwjax');
                unset_config($existingkey);
            }
        }
        upgrade_plugin_savepoint(true, 2013120300, 'filter', 'texwjax');
    }
    // Moodle v2.7.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:papillon326,项目名称:moodle-filter_texwjax,代码行数:34,代码来源:upgrade.php


示例7: setUp

 function setUp()
 {
     global $DB, $CFG;
     $this->realDB = $DB;
     $dbclass = get_class($this->realDB);
     $DB = new $dbclass();
     $DB->connect($CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->unittestprefix);
     if ($DB->get_manager()->table_exists('onlinejudge_tasks')) {
         $DB->get_manager()->delete_tables_from_xmldb_file($CFG->dirroot . '/local/onlinejudge/db/install.xml');
     }
     $DB->get_manager()->install_from_xmldb_file($CFG->dirroot . '/local/onlinejudge/db/install.xml');
     if ($DB->get_manager()->table_exists('files')) {
         $table = new xmldb_table('files');
         $DB->get_manager()->drop_table($table);
         $table = new xmldb_table('config_plugins');
         $DB->get_manager()->drop_table($table);
         $table = new xmldb_table('events_handlers');
         $DB->get_manager()->drop_table($table);
     }
     $DB->get_manager()->install_one_table_from_xmldb_file($CFG->dirroot . '/lib/db/install.xml', 'files');
     $DB->get_manager()->install_one_table_from_xmldb_file($CFG->dirroot . '/lib/db/install.xml', 'config_plugins');
     $DB->get_manager()->install_one_table_from_xmldb_file($CFG->dirroot . '/lib/db/install.xml', 'events_handlers');
     set_config('maxmemlimit', 64, 'local_onlinejudge');
     set_config('maxcpulimit', 10, 'local_onlinejudge');
     set_config('ideonedelay', 10, 'local_onlinejudge');
 }
开发者ID:boychunli,项目名称:moodle-local_onlinejudge,代码行数:26,代码来源:testjudgelib.php


示例8: test_mymoodleredirectreturnsfalseforadmin

 /**
  * Validate that redirection from My Moodle does not happen for admins
  */
 public function test_mymoodleredirectreturnsfalseforadmin()
 {
     global $CFG, $USER, $DB;
     require_once $CFG->dirroot . '/user/lib.php';
     // Make sure we're not a guest.
     set_config('siteguest', '');
     // Obtain the system context.
     $syscontext = context_system::instance();
     // Set up the current user global.
     $user = new stdClass();
     $user->username = "testuser";
     $userid = user_create_user($user);
     $USER = $DB->get_record('user', array('id' => $userid));
     // Enable functionaltiy.
     pm_set_config('mymoodle_redirect', 1);
     elis::$config = new elis_config();
     // Give the admin sufficient permissions.
     $roleid = create_role('adminrole', 'adminrole', 'adminrole');
     assign_capability('moodle/site:config', CAP_ALLOW, $roleid, $syscontext->id);
     role_assign($roleid, $USER->id, $syscontext->id);
     // Validate that redirection does not happen for admins.
     $result = pm_mymoodle_redirect();
     // Clear out cached permissions data so we don't affect other tests.
     accesslib_clear_all_caches(true);
     $this->assertFalse($result);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:29,代码来源:programsettings_test.php


示例9: xmldb_editor_tinymce_upgrade

function xmldb_editor_tinymce_upgrade($oldversion)
{
    global $CFG, $DB;
    if ($oldversion < 2014062900) {
        // We only want to delete DragMath from the customtoolbar setting if the directory no longer exists. If
        // the directory is present then it means it has been restored, so do not remove any settings.
        if (!check_dir_exists($CFG->libdir . '/editor/tinymce/plugins/dragmath', false)) {
            // Remove the DragMath plugin from the 'customtoolbar' setting (if it exists) as it has been removed.
            $currentorder = get_config('editor_tinymce', 'customtoolbar');
            $newtoolbarrows = array();
            $currenttoolbarrows = explode("\n", $currentorder);
            foreach ($currenttoolbarrows as $currenttoolbarrow) {
                $currenttoolbarrow = implode(',', array_diff(str_getcsv($currenttoolbarrow), array('dragmath')));
                $newtoolbarrows[] = $currenttoolbarrow;
            }
            $neworder = implode("\n", $newtoolbarrows);
            unset_config('customtoolbar', 'editor_tinymce');
            set_config('customtoolbar', $neworder, 'editor_tinymce');
        }
        upgrade_plugin_savepoint(true, 2014062900, 'editor', 'tinymce');
    }
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.9.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v3.0.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v3.1.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:upgrade.php


示例10: cron

 /**
  * Automatically update the registration on all hubs
  */
 public function cron()
 {
     global $CFG;
     if (extension_loaded('xmlrpc')) {
         //check if the last registration cron update was less than a week ago
         $lastcron = get_config('registration', 'crontime');
         if ($lastcron === false or $lastcron < strtotime("-7 day")) {
             //set to a week, see MDL-23704
             $function = 'hub_update_site_info';
             require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
             //update all hub where the site is registered on
             $hubs = $this->get_registered_on_hubs();
             foreach ($hubs as $hub) {
                 //update the registration
                 $siteinfo = $this->get_site_info($hub->huburl);
                 $params = array('siteinfo' => $siteinfo);
                 $serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
                 $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
                 try {
                     $result = $xmlrpcclient->call($function, $params);
                     mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
                 } catch (Exception $e) {
                     $errorparam = new stdClass();
                     $errorparam->errormessage = $e->getMessage();
                     $errorparam->hubname = $hub->hubname;
                     mtrace(get_string('errorcron', 'hub', $errorparam));
                 }
             }
             set_config('crontime', time(), 'registration');
         }
     } else {
         mtrace(get_string('errorcronnoxmlrpc', 'hub'));
     }
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:37,代码来源:lib.php


示例11: test_get_site_info

    public function test_get_site_info() {
        global $DB, $USER, $CFG;

        $this->resetAfterTest(true);

        // This is the info we are going to check
        set_config('release', '2.4dev (Build: 20120823)');
        set_config('version', '2012083100.00');

        // Set current user
        $user = array();
        $user['username'] = 'johnd';
        $user['firstname'] = 'John';
        $user['lastname'] = 'Doe';
        self::setUser(self::getDataGenerator()->create_user($user));

        // Add a web service and token.
        $webservice = new stdClass();
        $webservice->name = 'Test web service';
        $webservice->enabled = true;
        $webservice->restrictedusers = false;
        $webservice->component = 'moodle';
        $webservice->timecreated = time();
        $webservice->downloadfiles = true;
        $externalserviceid = $DB->insert_record('external_services', $webservice);

        // Add a function to the service
        $DB->insert_record('external_services_functions', array('externalserviceid' => $externalserviceid,
            'functionname' => 'core_course_get_contents'));

        $_POST['wstoken'] = 'testtoken';
        $externaltoken = new stdClass();
        $externaltoken->token = 'testtoken';
        $externaltoken->tokentype = 0;
        $externaltoken->userid = $USER->id;
        $externaltoken->externalserviceid = $externalserviceid;
        $externaltoken->contextid = 1;
        $externaltoken->creatorid = $USER->id;
        $externaltoken->timecreated = time();
        $DB->insert_record('external_tokens', $externaltoken);

        $siteinfo = core_webservice_external::get_site_info();

        // We need to execute the return values cleaning process to simulate the web service server.
        $siteinfo = external_api::clean_returnvalue(core_webservice_external::get_site_info_returns(), $siteinfo);

        $this->assertEquals('johnd', $siteinfo['username']);
        $this->assertEquals('John', $siteinfo['firstname']);
        $this->assertEquals('Doe', $siteinfo['lastname']);
        $this->assertEquals(current_language(), $siteinfo['lang']);
        $this->assertEquals($USER->id, $siteinfo['userid']);
        $this->assertEquals(true, $siteinfo['downloadfiles']);
        $this->assertEquals($CFG->release, $siteinfo['release']);
        $this->assertEquals($CFG->version, $siteinfo['version']);
        $this->assertEquals($CFG->mobilecssurl, $siteinfo['mobilecssurl']);
        $this->assertEquals(count($siteinfo['functions']), 1);
        $function = array_pop($siteinfo['functions']);
        $this->assertEquals($function['name'], 'core_course_get_contents');
        $this->assertEquals($function['version'], $siteinfo['version']);
    }
开发者ID:verbazend,项目名称:AWFA,代码行数:60,代码来源:externallib_test.php


示例12: __construct

 public function __construct()
 {
     // Use this context for filtering.
     $this->context = context_system::instance();
     // Define FORMAT_HTML as only one filtering in DB.
     set_config('formats', implode(',', array(FORMAT_HTML)), get_class($this));
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:7,代码来源:filter_test.php


示例13: networkingform_submit

function networkingform_submit(Pieform $form, $values)
{
    $reply = '';
    if ($form->get_submitvalue() === 'deletekey') {
        global $SESSION;
        $openssl = OpenSslRepo::singleton();
        $openssl->get_keypair(true);
        $SESSION->add_info_msg(get_string('keydeleted', 'admin'));
        // Using cancel here as a hack to get it to redirect so it shows the new keys
        $form->reply(PIEFORM_CANCEL, array('location' => get_config('wwwroot') . 'admin/site/networking.php'));
    }
    if (get_config('enablenetworking') != $values['enablenetworking']) {
        if (!set_config('enablenetworking', $values['enablenetworking'])) {
            networkingform_fail($form);
        } else {
            if (empty($values['enablenetworking'])) {
                $reply .= get_string('networkingdisabled', 'admin');
            } else {
                $reply .= get_string('networkingenabled', 'admin');
            }
        }
    }
    if (get_config('promiscuousmode') != $values['promiscuousmode']) {
        if (!set_config('promiscuousmode', $values['promiscuousmode'])) {
            networkingform_fail($form);
        } else {
            if (empty($values['promiscuousmode'])) {
                $reply .= get_string('promiscuousmodedisabled', 'admin');
            } else {
                $reply .= get_string('promiscuousmodeenabled', 'admin');
            }
        }
    }
    $form->reply(PIEFORM_OK, array('message' => $reply == '' ? get_string('networkingunchanged', 'admin') : $reply, 'goto' => '/admin/site/networking.php'));
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:35,代码来源:networking.php


示例14: setUp

 public function setUp()
 {
     $this->resetAfterTest();
     set_config('enableglobalsearch', true);
     // Set \core_search::instance to the mock_search_engine as we don't require the search engine to be working to test this.
     $search = testable_core_search::instance();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:7,代码来源:engine_test.php


示例15: process_config

 /**
  * Processes and stores configuration data for this authentication plugin.
  * $this->config->somefield
  */
 function process_config($config)
 {
     // set to defaults if undefined
     if (!isset($config->mainrule_fld)) {
         $config->mainrule_fld = '';
     }
     if (!isset($config->secondrule_fld)) {
         $config->secondrule_fld = 'n/a';
     }
     if (!isset($config->replace_arr)) {
         $config->replace_arr = '';
     }
     if (!isset($config->delim)) {
         $config->delim = 'CR+LF';
     }
     if (!isset($config->donttouchusers)) {
         $config->donttouchusers = '';
     }
     if (!isset($config->enableunenrol)) {
         $config->enableunenrol = 0;
     }
     // save settings
     set_config('mainrule_fld', $config->mainrule_fld, self::COMPONENT_NAME);
     set_config('secondrule_fld', $config->secondrule_fld, self::COMPONENT_NAME);
     set_config('replace_arr', $config->replace_arr, self::COMPONENT_NAME);
     set_config('delim', $config->delim, self::COMPONENT_NAME);
     set_config('donttouchusers', $config->donttouchusers, self::COMPONENT_NAME);
     set_config('enableunenrol', $config->enableunenrol, self::COMPONENT_NAME);
     return true;
 }
开发者ID:gagathos,项目名称:mcae,代码行数:34,代码来源:auth.php


示例16: execute

 public function execute()
 {
     global $USER;
     // Check to make sure external communications hasn't been disabled
     $extcom = !!get_config('mod_hvp', 'external_communication');
     $extcomnotify = !!get_config('mod_hvp', 'external_communication_notify');
     if ($extcom || !$extcomnotify) {
         $core = \mod_hvp\framework::instance();
         $core->fetchLibrariesMetadata(!$extcom);
         set_config('external_communication_notify', $extcom ? false : time(), 'mod_hvp');
         // Notify admin if there are updates available!
         $update_available = \get_config('mod_hvp', 'update_available');
         $current_update = \get_config('mod_hvp', 'current_update');
         $admin_notified = \get_config('mod_hvp', 'admin_notified');
         if ($admin_notified !== $update_available && $update_available !== false && $current_update !== false && $current_update < $update_available) {
             // New update is available
             // Send message
             $updatesurl = new \moodle_url('/mod/hvp/library_list.php');
             $message = new \stdClass();
             $message->component = 'mod_hvp';
             $message->name = 'updates';
             $message->userfrom = $USER;
             $message->userto = get_admin();
             $message->subject = get_string('updatesavailabletitle', 'mod_hvp');
             $message->fullmessage = get_string('updatesavailablemsgpt1', 'mod_hvp') . ' ' . get_string('updatesavailablemsgpt2', 'mod_hvp') . "\n\n" . get_string('updatesavailablemsgpt3', 'mod_hvp', date('Y-m-d', $update_available)) . "\n" . get_string('updatesavailablemsgpt4', 'mod_hvp', date('Y-m-d', $current_update)) . "\n\n" . $updatesurl;
             $message->fullmessageformat = FORMAT_PLAIN;
             $message->fullmessagehtml = '<p>' . get_string('updatesavailablemsgpt1', 'mod_hvp') . '<br/>' . get_string('updatesavailablemsgpt2', 'mod_hvp') . '</p>' . '<p>' . get_string('updatesavailablemsgpt3', 'mod_hvp', '<b>' . date('Y-m-d', $update_available) . '</b>') . '<br/>' . get_string('updatesavailablemsgpt4', 'mod_hvp', '<b>' . date('Y-m-d', $current_update) . '</b>') . '</p>' . '<a href="' . $updatesurl . '" target="_blank">' . $updatesurl . '</a>';
             $message->smallmessage = '';
             $message->notification = 1;
             message_send($message);
             // Keep track of which version we've notfied about
             \set_config('admin_notified', $update_available, 'mod_hvp');
         }
     }
 }
开发者ID:nadavkav,项目名称:h5p-moodle-plugin,代码行数:35,代码来源:look_for_updates.php


示例17: createSchema

 public function createSchema()
 {
     $data = $this->_data;
     if (isset($data['cancel'])) {
         $this->view->set('info_message', 'Database creation cancelled');
         sendTo($this->name, 'index', $this->_modules);
     }
     if (isset($data['createdb']) && isset($data['Schema'])) {
         set_config('DB_TYPE', $data['Schema']['database_type']);
         set_config('DB_USER', $data['Schema']['database_admin_username']);
         set_config('DB_HOST', $data['Schema']['database_host']);
         set_config('DB_PASSWORD', $data['Schema']['database_admin_password']);
         set_config('DB_CREATE', true);
         $db = DB::Instance();
         if ($db === null) {
             echo 'Unable to connect to database<br>';
         }
         $dict = NewDataDictionary($db);
         $sql = $dict->CreateDatabase($data['Schema']['database_name']);
         $result = $dict->ExecuteSQLArray($sql);
         if ($result != 2) {
             $this->view->set('message', $db->ErrorMsg());
             $this->setTemplateName('systemerror');
             $this->view->set('page_title', $this->getPageName('Creation Error', 'Database'));
         } else {
             $this->view->set('message', 'Database created');
             $this->setTemplateName('systemerror');
             $this->view->set('page_title', $this->getPageName('Created', 'Database'));
         }
     }
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:31,代码来源:SystemsController.php


示例18: xmldb_theme_formal_white_install

function xmldb_theme_formal_white_install()
{
    // We need here to check whether or not the theme has been installed.
    // If it has been installed then we need to change the name of the settings to the new names.
    // If it is not installed it won't have any settings yet and we won't need to worry about this.
    $currentsetting = get_config('theme_formal_white');
    if (!empty($currentsetting)) {
        // Remove the settings that are no longer used by this theme
        // Remove regionwidth
        unset_config('regionwidth', 'theme_formal_white');
        // Remove alwayslangmenu
        unset_config('alwayslangmenu', 'theme_formal_white');
        // previous releases of formal_white them were not equipped with version number
        // so I can not know if a theme specific variable exists or not.
        // This is the reason why I try to use them both.
        if (!empty($currentsetting->backgroundcolor)) {
            // Create a new config setting called lblockcolumnbgc and give it backgroundcolor's value.
            set_config('lblockcolumnbgc', $currentsetting->backgroundcolor, 'theme_formal_white');
            // Remove backgroundcolor
            unset_config('backgroundcolor', 'theme_formal_white');
        } elseif (!empty($currentsetting->blockcolumnbgc)) {
            // Create a new config setting called lblockcolumnbgc and give it blockcolumnbgc's value.
            set_config('lblockcolumnbgc', $currentsetting->blockcolumnbgc, 'theme_formal_white');
            // Remove blockcolumnbgc
            unset_config('blockcolumnbgc', 'theme_formal_white');
        }
    }
    return true;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:29,代码来源:install.php


示例19: save

 /**
  * 保存配置信息
  */
 public function save()
 {
     $setting = array();
     $setting['admin_email'] = is_email($_POST['setting']['admin_email']) ? trim($_POST['setting']['admin_email']) : showmessage(L('email_illegal'), HTTP_REFERER);
     $setting['maxloginfailedtimes'] = intval($_POST['setting']['maxloginfailedtimes']);
     $setting['minrefreshtime'] = intval($_POST['setting']['minrefreshtime']);
     $setting['mail_type'] = intval($_POST['setting']['mail_type']);
     $setting['mail_server'] = trim($_POST['setting']['mail_server']);
     $setting['mail_port'] = intval($_POST['setting']['mail_port']);
     $setting['category_ajax'] = intval(abs($_POST['setting']['category_ajax']));
     $setting['mail_user'] = trim($_POST['setting']['mail_user']);
     $setting['mail_auth'] = intval($_POST['setting']['mail_auth']);
     $setting['mail_from'] = trim($_POST['setting']['mail_from']);
     $setting['mail_password'] = trim($_POST['setting']['mail_password']);
     $setting['errorlog_size'] = trim($_POST['setting']['errorlog_size']);
     $setting = array2string($setting);
     $this->db->update(array('setting' => $setting), array('module' => 'admin'));
     //存入admin模块setting字段
     //如果开始盛大通行证接入,判断服务器是否支持curl
     $snda_error = '';
     if ($_POST['setconfig']['snda_akey'] || $_POST['setconfig']['snda_skey']) {
         if (function_exists('curl_init') == FALSE) {
             $snda_error = L('snda_need_curl_init');
             $_POST['setconfig']['snda_enable'] = 0;
         }
     }
     set_config($_POST['setconfig']);
     //保存进config文件
     $this->setcache();
     showmessage(L('setting_succ') . $snda_error, HTTP_REFERER);
 }
开发者ID:klj123wan,项目名称:czsz,代码行数:34,代码来源:setting.php


示例20: xmldb_block_section_links_upgrade

/**
 * Upgrade code for the section links block.
 *
 * @global moodle_database $DB
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_section_links_upgrade($oldversion, $block)
{
    global $DB;
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    if ($oldversion < 2013012200.0) {
        // The section links block used to use its own crazy plugin name.
        // Here we are converting it to the proper component name.
        $oldplugin = 'blocks/section_links';
        $newplugin = 'block_section_links';
        // Use the proper API here... thats what we should be doing as it ensures any caches etc are cleared
        // along the way!
        // It may be quicker to just write an SQL statement but that would be reckless.
        $config = get_config($oldplugin);
        if (!empty($config)) {
            foreach ($config as $name => $value) {
                set_config($name, $value, $newplugin);
                unset_config($name, $oldplugin);
            }
        }
        // Main savepoint reached.
        upgrade_block_savepoint(true, 2013012200.0, 'section_links');
    }
    // Moodle v2.5.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.7.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:42,代码来源:upgrade.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP set_config_count函数代码示例发布时间:2022-05-15
下一篇:
PHP set_checkbox函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap