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

PHP get_mnet_environment函数代码示例

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

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



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

示例1: require_login

<?php

// Allows the admin to configure mnet stuff
require __DIR__ . '/../../config.php';
require_once $CFG->libdir . '/adminlib.php';
include_once $CFG->dirroot . '/mnet/lib.php';
require_login();
admin_externalpage_setup('net');
$context = context_system::instance();
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
$site = get_site();
$mnet = get_mnet_environment();
if (!extension_loaded('openssl')) {
    echo $OUTPUT->header();
    set_config('mnet_dispatcher_mode', 'off');
    print_error('requiresopenssl', 'mnet');
}
if (!function_exists('curl_init')) {
    echo $OUTPUT->header();
    set_config('mnet_dispatcher_mode', 'off');
    print_error('nocurl', 'mnet');
}
if (!isset($CFG->mnet_dispatcher_mode)) {
    set_config('mnet_dispatcher_mode', 'off');
}
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
    if (!empty($form->submit) && $form->submit == get_string('savechanges')) {
        if (in_array($form->mode, array("off", "strict", "dangerous"))) {
            if (set_config('mnet_dispatcher_mode', $form->mode)) {
                redirect('index.php', get_string('changessaved'));
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:index.php


示例2: mnet_keyswap

/**
 * Accepts a public key from a new remote host and returns the public key for
 * this host. If 'register all hosts' is turned on, it will bootstrap a record
 * for the remote host in the mnet_host table (if it's not already there)
 *
 * @param  string  $function      XML-RPC requires this but we don't... discard!
 * @param  array   $params        Array of parameters
 *                                $params[0] is the remote wwwroot
 *                                $params[1] is the remote public key
 * @return string                 The XML-RPC response
 */
function mnet_keyswap($function, $params) {
    global $CFG;
    $return = array();
    $mnet = get_mnet_environment();

    if (!empty($CFG->mnet_register_allhosts)) {
        $mnet_peer = new mnet_peer();
        @list($wwwroot, $pubkey, $application) = each($params);
        $keyok = $mnet_peer->bootstrap($wwwroot, $pubkey, $application);
        if ($keyok) {
            $mnet_peer->commit();
        }
    }
    return $mnet->public_key;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:26,代码来源:serverlib.php


示例3: auth_plugin_mnet

 /**
  * Constructor.
  */
 function auth_plugin_mnet()
 {
     $this->authtype = 'mnet';
     $this->config = get_config('auth_mnet');
     $this->mnet = get_mnet_environment();
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:9,代码来源:auth.php


示例4: mnet_encrypt_message

/**
 * Encrypt a message and return it in an XML-Encrypted document
 *
 * This function can encrypt any content, but it was written to provide a system
 * of encrypting XML-RPC request and response messages. The message will be
 * base64 encoded, so it does not need to be text - binary data should work.
 *
 * We compute the SHA1 digest of the message.
 * We compute a signature on that digest with our private key.
 * We link to the public key that can be used to verify our signature.
 * We base64 the message data.
 * We identify our wwwroot - this must match our certificate's CN
 *
 * The XML-RPC document will be parceled inside an XML-SIG document, which holds
 * the base64_encoded XML as an object, the SHA1 digest of that document, and a
 * signature of that document using the local private key. This signature will
 * uniquely identify the RPC document as having come from this server.
 *
 * See the {@Link http://www.w3.org/TR/xmlenc-core/ XML-ENC spec} at the W3c
 * site
 *
 * @param  string   $message              The data you want to sign
 * @param  string   $remote_certificate   Peer's certificate in PEM format
 * @return string                         An XML-ENC document
 */
function mnet_encrypt_message($message, $remote_certificate) {
    $mnet = get_mnet_environment();

    // Generate a key resource from the remote_certificate text string
    $publickey = openssl_get_publickey($remote_certificate);

    if ( gettype($publickey) != 'resource' ) {
        // Remote certificate is faulty.
        return false;
    }

    // Initialize vars
    $encryptedstring = '';
    $symmetric_keys = array();

    //        passed by ref ->     &$encryptedstring &$symmetric_keys
    $bool = openssl_seal($message, $encryptedstring, $symmetric_keys, array($publickey));
    $message = $encryptedstring;
    $symmetrickey = array_pop($symmetric_keys);

    $message = '<?xml version="1.0" encoding="iso-8859-1"?>
    <encryptedMessage>
        <EncryptedData Id="ED" xmlns="http://www.w3.org/2001/04/xmlenc#">
            <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#arcfour"/>
            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <ds:RetrievalMethod URI="#EK" Type="http://www.w3.org/2001/04/xmlenc#EncryptedKey"/>
                <ds:KeyName>XMLENC</ds:KeyName>
            </ds:KeyInfo>
            <CipherData>
                <CipherValue>'.base64_encode($message).'</CipherValue>
            </CipherData>
        </EncryptedData>
        <EncryptedKey Id="EK" xmlns="http://www.w3.org/2001/04/xmlenc#">
            <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <ds:KeyName>SSLKEY</ds:KeyName>
            </ds:KeyInfo>
            <CipherData>
                <CipherValue>'.base64_encode($symmetrickey).'</CipherValue>
            </CipherData>
            <ReferenceList>
                <DataReference URI="#ED"/>
            </ReferenceList>
            <CarriedKeyName>XMLENC</CarriedKeyName>
        </EncryptedKey>
        <wwwroot>'.$mnet->wwwroot.'</wwwroot>
    </encryptedMessage>';
    return $message;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:74,代码来源:lib.php


示例5: __wakeup

 public function __wakeup() {
     $this->mnet = get_mnet_environment();
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:3,代码来源:lib.php


示例6: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->authtype = 'mnet';
     $this->config = get_config('auth_mnet');
     $this->mnet = get_mnet_environment();
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:9,代码来源:auth.php


示例7: mnet_xmlrpc_client

 /**
  * Constructor returns true
  */
 function mnet_xmlrpc_client()
 {
     // make sure we've got this set up before we try and do anything else
     $this->mnet = get_mnet_environment();
     return true;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:9,代码来源:client.php


示例8: replaceMnetKeys

 public function replaceMnetKeys()
 {
     $mnet = get_mnet_environment();
     $mnet->replace_keys();
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:5,代码来源:GcrCurrentEschool.class.php


示例9: xmldb_local_ent_installer_install

/**
* will provide all ent specific initializers after install
*
*/
function xmldb_local_ent_installer_install()
{
    global $DB, $CFG;
    mtrace("Installing local distribution configurations");
    // initalize MNET and ensure providing a first key
    // Unfortunately, during initial install, a suitable key pair WILL NOT be generated.
    // This will be fixed by further fix_config.php script.
    $mnet = get_mnet_environment();
    $mnet->init();
    // Init mnet auth.
    $authcontrol = new auth_remote_control('auth', 'mnet');
    $authcontrol->action('enable');
    // Disable IMS module.
    $authcontrol = new mod_remote_control('mod', 'imscp');
    $authcontrol->action('disable');
    // ## Publishflow
    // initiate publishflow platform type
    set_config('moodlenodetype', 'factory,catalog');
    // initiate publishflow retrofit mode for common
    set_config('enableretrofit', 1);
    // initiate publishflow files delivery
    set_config('coursedeliveryislocal', 1);
    // initiate publishflow categories
    set_config('coursedelivery_deploycategory', 1);
    // initiate publishflow categories
    set_config('coursedelivery_runningcategory', 1);
    // initiate publishflow categories
    set_config('coursedelivery_closedcategory', 1);
    // initiate publishflow topology prefixes
    set_config('mainhostprefix', 'http://commun');
    // initiate publishflow topology prefixes
    set_config('factoryprefix', 'http://commun');
    // initiate publishflow topology refresh
    set_config('coursedelivery_networkrefreshautomation', 604800);
    // ## sharedresource
    // initiate sharedresource model
    set_config('pluginchoice', 'scolomfr');
    // ## enhanced my
    // enable enhanced my
    set_config('localmyenable', 1);
    // enable my pinting categories
    set_config('localmyprintcategories', 1);
    // initiaing my enhanced module list
    set_config('localmymodules', "my_caption\nme\nleft_edition_column\nmy_courses\nauthored_courses\ncourse_areas\nauthored_courses\navailable_courses\nlatestnews_simple");
    // ## Adjust some fields length
    $dbman = $DB->get_manager();
    $table = new xmldb_table('user');
    $field = new xmldb_field('department');
    $field->set_attributes(XMLDB_TYPE_CHAR, '126', null, null, null, null, 'institution');
    $dbman->change_field_precision($table, $field);
    // ## Adding usertypes categorization
    $categoryrec = new StdClass();
    $categoryrec->name = ent_installer_string('usertypecategoryname');
    $oldcat = $DB->get_record('user_info_category', array('name' => $categoryrec->name));
    if (!$oldcat) {
        $usertypecategoryid = $DB->insert_record('user_info_category', $categoryrec);
    } else {
        $usertypecategoryid = $oldcat->id;
    }
    // ## Adding usertypes for ENT model
    $i = 0;
    $userfield = new StdClass();
    $userfield->name = ent_installer_string('usertypestudent');
    $userfield->shortname = 'eleve';
    $userfield->datatype = 'checkbox';
    $userfield->description = ent_installer_string('usertypestudentdesc');
    $userfield->descriptionformat = FORMAT_MOODLE;
    $userfield->categoryid = $usertypecategoryid;
    $userfield->sortorder = $i;
    $userfield->required = 0;
    $userfield->locked = 1;
    $userfield->visible = 0;
    $userfield->forceunique = 0;
    $userfield->signup = 0;
    if (!$DB->record_exists('user_info_field', array('shortname' => 'eleve'))) {
        $DB->insert_record('user_info_field', $userfield);
    }
    $i++;
    $userfield = new StdClass();
    $userfield->name = ent_installer_string('usertypeteacher');
    $userfield->shortname = 'enseignant';
    $userfield->datatype = 'checkbox';
    $userfield->description = ent_installer_string('usertypeteacherdesc');
    $userfield->descriptionformat = FORMAT_MOODLE;
    $userfield->categoryid = $usertypecategoryid;
    $userfield->sortorder = $i;
    $userfield->required = 0;
    $userfield->locked = 1;
    $userfield->visible = 0;
    $userfield->forceunique = 0;
    $userfield->signup = 0;
    if (!$DB->record_exists('user_info_field', array('shortname' => 'enseignant'))) {
        $DB->insert_record('user_info_field', $userfield);
    }
    $i++;
    $userfield = new StdClass();
//.........这里部分代码省略.........
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:101,代码来源:install.php


示例10: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     // make sure we've got this set up before we try and do anything else
     $this->mnet = get_mnet_environment();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:8,代码来源:client.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_mnet_remote_client函数代码示例发布时间:2022-05-15
下一篇:
PHP get_misc_data函数代码示例发布时间: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