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

PHP mnet_environment类代码示例

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

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



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

示例1: mnet_get_externalprofilefields

function mnet_get_externalprofilefields($hostid)
{
    /// Setup MNET environment
    global $MNET, $CFG;
    if (empty($MNET)) {
        $MNET = new mnet_environment();
        $MNET->init();
    }
    /// Setup the server
    $host = get_record('mnet_host', 'id', $hostid);
    //we retrieve the server(host) from the 'mnet_host' table
    if (empty($host)) {
        error('Invalid Hostid');
    }
    $mnet_peer = new mnet_peer();
    //we create a new mnet_peer (server/host)
    $mnet_peer->set_wwwroot($host->wwwroot);
    //we set this mnet_peer with the host http address
    $client = new mnet_xmlrpc_client();
    //create a new client
    $client->set_method('auth/mnet/auth.php/get_user_profile_fields');
    //tell it which method we're going to call
    $client->send($mnet_peer);
    //Call the server
    if (!empty($client->response['faultString'])) {
        error("Mnet error:" . $client->response['faultString']);
    }
    return $client->response;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:29,代码来源:mnet_userprofile.php


示例2: taoview_call_mnet

function taoview_call_mnet($viewtype)
{
    /// Setup MNET environment
    global $MNET, $CFG;
    if (empty($MNET)) {
        $MNET = new mnet_environment();
        $MNET->init();
    }
    /// Setup the server
    $host = get_record('mnet_host', 'name', 'localmahara');
    //we retrieve the server(host) from the 'mnet_host' table
    if (empty($host)) {
        error('Mahara not configured');
    }
    $a = new stdclass();
    $a->link = $CFG->wwwroot . '/auth/mnet/jump.php?hostid=' . $host->id . '&wantsurl=local/taoview.php?view=' . $viewtype;
    echo '<div class="taoviwdesc">';
    print_string('toaddartefacts', 'local', $a);
    echo '</div>';
    $mnet_peer = new mnet_peer();
    //we create a new mnet_peer (server/host)
    $mnet_peer->set_wwwroot($host->wwwroot);
    //we set this mnet_peer with the host http address
    $client = new mnet_xmlrpc_client();
    //create a new client
    $client->set_method('local/mahara/rpclib.php/get_artefacts_by_viewtype');
    //tell it which method we're going to call
    $client->add_param($viewtype);
    $client->send($mnet_peer);
    //Call the server
    if (!empty($client->response['faultString'])) {
        error("Mahara error:" . $artefacts['faultString']);
    }
    return $client->response;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:35,代码来源:taoviewlib.php


示例3: define

 * @version 0.0.1
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package mnet
 */
require_once $CFG->dirroot . '/mnet/xmlrpc/xmlparser.php';
require_once $CFG->dirroot . '/mnet/peer.php';
require_once $CFG->dirroot . '/mnet/environment.php';
/// CONSTANTS ///////////////////////////////////////////////////////////
define('RPC_OK', 0);
define('RPC_NOSUCHFILE', 1);
define('RPC_NOSUCHCLASS', 2);
define('RPC_NOSUCHFUNCTION', 3);
define('RPC_FORBIDDENFUNCTION', 4);
define('RPC_NOSUCHMETHOD', 5);
define('RPC_FORBIDDENMETHOD', 6);
$MNET = new mnet_environment();
$MNET->init();
/**
 * Strip extraneous detail from a URL or URI and return the hostname
 *
 * @param  string  $uri  The URI of a file on the remote computer, optionally
 *                       including its http:// prefix like
 *                       http://www.example.com/index.html
 * @return string        Just the hostname
 */
function mnet_get_hostname_from_uri($uri = null)
{
    $count = preg_match("@^(?:http[s]?://)?([A-Z0-9\\-\\.]+).*@i", $uri, $matches);
    if ($count > 0) {
        return $matches[1];
    }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:lib.php


示例4: get_mnet_environment

/**
 * helper function to load up and initialise the mnet environment
 * this must be called before you use mnet functions.
 *
 * @return mnet_environment the equivalent of old $MNET global
 */
function get_mnet_environment()
{
    global $CFG;
    require_once $CFG->dirroot . '/mnet/lib.php';
    static $instance = null;
    if (empty($instance)) {
        $instance = new mnet_environment();
        $instance->init();
    }
    return $instance;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:17,代码来源:moodlelib.php


示例5: xmldb_main_upgrade


//.........这里部分代码省略.........
        $f = $table->addFieldInfo('profile', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, NULL, null, null, null);
        // PK and indexes
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->addIndexInfo('enabled_xpath', XMLDB_INDEX_NOTUNIQUE, array('enabled', 'xmlrpc_path'));
        // Create the table
        $result = $result && create_table($table);
        $table = new XMLDBTable('mnet_service');
        $table->comment = 'A service is a group of functions';
        // fields
        $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
        $f = $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, NULL, null, null, null);
        $f = $table->addFieldInfo('description', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, NULL, null, null, null);
        $f = $table->addFieldInfo('apiversion', XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, NULL, null, null, null);
        $f = $table->addFieldInfo('offer', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, null, null, 0);
        // PK and indexes
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        // Create the table
        $result = $result && create_table($table);
        $table = new XMLDBTable('mnet_service2rpc');
        $table->comment = 'Group functions or methods under a service';
        // fields
        $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
        $f = $table->addFieldInfo('serviceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, null, null, 0);
        $f = $table->addFieldInfo('rpcid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, null, null, 0);
        // PK and indexes
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->addIndexInfo('unique', XMLDB_INDEX_UNIQUE, array('rpcid', 'serviceid'));
        // Create the table
        $result = $result && create_table($table);
        //
        // Prime MNET configuration entries -- will be needed later by auth/mnet
        //
        include_once $CFG->dirroot . '/mnet/lib.php';
        $env = new mnet_environment();
        $env->init();
        unset($env);
        // add mnethostid to user-
        $table = new XMLDBTable('user');
        $field = new XMLDBField('mnethostid');
        $field->setType(XMLDB_TYPE_INTEGER);
        $field->setLength(10);
        $field->setNotNull(true);
        $field->setSequence(null);
        $field->setEnum(null);
        $field->setDefault('0');
        $field->setPrevious("deleted");
        $field->setNext("username");
        $result = $result && add_field($table, $field);
        // The default mnethostid is zero... we need to update this for all
        // users of the local IdP service.
        set_field('user', 'mnethostid', $CFG->mnet_localhost_id, 'mnethostid', '0');
        $index = new XMLDBIndex('username');
        $index->setUnique(true);
        $index->setFields(array('username'));
        drop_index($table, $index);
        $index->setFields(array('mnethostid', 'username'));
        if (!add_index($table, $index)) {
            notify(get_string('duplicate_usernames', 'mnet', 'http://docs.moodle.org/en/DuplicateUsernames'));
        }
        unset($table, $field, $index);
        /**
         ** auth/mnet tables
         **/
        $table = new XMLDBTable('mnet_session');
        $table->comment = 'Store session data from users migrating to other sites';
        // fields
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:67,代码来源:upgrade.php


示例6: is_mnet_remote_user

/**
 * Returns whether or not the user object is a remote MNET user. This function
 * is in moodlelib because it does not rely on loading any of the MNET code.
 *
 * @param object $user A valid user object
 * @return bool        True if the user is from a remote Moodle.
 */
function is_mnet_remote_user($user)
{
    global $CFG;
    if (!isset($CFG->mnet_localhost_id)) {
        include_once $CFG->dirroot . '/mnet/lib.php';
        $env = new mnet_environment();
        $env->init();
        unset($env);
    }
    return !empty($user->mnethostid) && $user->mnethostid != $CFG->mnet_localhost_id;
}
开发者ID:nadavkav,项目名称:rtlMoodle,代码行数:18,代码来源:moodlelib.php


示例7: ensure_environment

 /**
  * Set the MNET environment
  * @global <type> $MNET
  */
 private function ensure_environment()
 {
     global $MNET;
     if (empty($MNET)) {
         $MNET = new mnet_environment();
         $MNET->init();
     }
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:12,代码来源:repository.class.php


示例8: local_mahara_mnet_call

function local_mahara_mnet_call()
{
    global $CFG, $MNET;
    if ($CFG->mnet_dispatcher_mode != 'strict') {
        return;
    }
    if (!($host = get_record('mnet_host', 'name', 'localmahara'))) {
        return;
    }
    require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
    if (empty($MNET)) {
        $MNET = new mnet_environment();
        $MNET->init();
    }
    $args = func_get_args();
    $method = array_shift($args);
    $mnet_peer = new mnet_peer();
    $mnet_peer->set_wwwroot($host->wwwroot);
    $client = new mnet_xmlrpc_client();
    $client->set_method($method);
    foreach ($args as $a) {
        $client->add_param($a);
    }
    $client->send($mnet_peer);
    return $client->response;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:26,代码来源:lib.php


示例9: ensure_environment

 private function ensure_environment()
 {
     global $MNET;
     if (empty($MNET)) {
         $MNET = new mnet_environment();
         $MNET->init();
     }
     // no idea why this happens :(
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:9,代码来源:lib.php


示例10: xmldb_main_upgrade


//.........这里部分代码省略.........
        $f = $table->addFieldInfo('profile', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, NULL, null, null, null);
        // PK and indexes
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->addIndexInfo('enabled_xpath', XMLDB_INDEX_NOTUNIQUE, array('enabled', 'xmlrpc_path'));
        // Create the table
        $result = $result && create_table($table);
        $table = new XMLDBTable('mnet_service');
        $table->comment = 'A service is a group of functions';
        // fields
        $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
        $f = $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, NULL, null, null, null);
        $f = $table->addFieldInfo('description', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, NULL, null, null, null);
        $f = $table->addFieldInfo('apiversion', XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, NULL, null, null, null);
        $f = $table->addFieldInfo('offer', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, null, null, 0);
        // PK and indexes
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        // Create the table
        $result = $result && create_table($table);
        $table = new XMLDBTable('mnet_service2rpc');
        $table->comment = 'Group functions or methods under a service';
        // fields
        $f = $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', false, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
        $f = $table->addFieldInfo('serviceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, null, null, 0);
        $f = $table->addFieldInfo('rpcid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, NULL, null, null, 0);
        // PK and indexes
        $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->addIndexInfo('unique', XMLDB_INDEX_UNIQUE, array('rpcid', 'serviceid'));
        // Create the table
        $result = $result && create_table($table);
        //
        // Prime MNET configuration entries -- will be needed later by auth/mnet
        //
        include_once $CFG->dirroot . '/mnet/lib.php';
        $env = new mnet_environment();
        $env->init();
        unset($env);
        // add mnethostid to user-
        $table = new XMLDBTable('user');
        $field = new XMLDBField('mnethostid');
        $field->setType(XMLDB_TYPE_INTEGER);
        $field->setLength(10);
        $field->setNotNull(true);
        $field->setSequence(null);
        $field->setEnum(null);
        $field->setDefault('0');
        $field->setPrevious("deleted");
        $field->setNext("username");
        $result = $result && add_field($table, $field);
        // The default mnethostid is zero... we need to update this for all
        // users of the local IdP service.
        set_field('user', 'mnethostid', $CFG->mnet_localhost_id, 'mnethostid', '0');
        $index = new XMLDBIndex('username');
        $index->setUnique(true);
        $index->setFields(array('username'));
        drop_index($table, $index);
        $index->setFields(array('mnethostid', 'username'));
        if (!add_index($table, $index)) {
            notify(get_string('duplicate_usernames', 'mnet', 'http://docs.moodle.org/en/DuplicateUsernames'));
        }
        unset($table, $field, $index);
        /**
         ** auth/mnet tables
         **/
        $table = new XMLDBTable('mnet_session');
        $table->comment = 'Store session data from users migrating to other sites';
        // fields
开发者ID:veritech,项目名称:pare-project,代码行数:67,代码来源:upgrade.php


示例11: TRIM

    }
}
// avoid shooting in yourself (@see locallib.php§vmoodle_fix_database() )
// VMoodle Master identity has been forced in remote database with its current public key, so we should find it.
// whatever the case, the master record is always added as an "extra" mnet_host record, after "self", and "all Hosts".
$remotehost = $DB->get_record_select('mnet_host', " TRIM(REPLACE(public_key, '\r', '')) = TRIM(REPLACE('{$masterpk}', '\r', '')) AND id > 1 ");
if ($remotehost || $test) {
    // $CFG->bootstrap_init is a key that has been added by master when postprocessing the deployment template
    // We check that the public key given matches the identity of the master who initiated the platform restoring.
    // get it hard !!
    $initroot = $DB->get_field('config', array('name' => 'bootstrap_init'));
    if ($test || $initroot == $remotehost->wwwroot) {
        // at this time, the local platform may not have self key, or may inherit
        // an obsolete key from the template SQL backup.
        // we must fix that forcing a local key replacement
        $MNET = new mnet_environment();
        $MNET->init();
        $MNET->name = '';
        $oldkey = $MNET->public_key;
        $MNET->replace_keys();
        // debug_trace("REMOTE : Replaced keys from \n$oldkey\nto\n{$MNET->public_key}\n");
        // Finally we disable the keyboot script locking definitively the door.
        set_config('bootstrap_init', null);
        echo "SUCCESS";
    } else {
        echo "ERROR : Calling net booting host {$remotehost->wwwroot} don't match with master : {$initroot}";
    }
} else {
    echo "ERROR : Master host not found or master host key is empty";
}
function getRealPOST()
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:31,代码来源:keyboot.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP mnet_peer类代码示例发布时间:2022-05-23
下一篇:
PHP misc类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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