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

PHP get_mnet_remote_client函数代码示例

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

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



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

示例1: kill_child

 /**
  * When the IdP requests that child sessions are terminated,
  * this function will be called on each of the child hosts. The machine that
  * calls the function (over xmlrpc) provides us with the mnethostid we need.
  *
  * @param   string  $username       Username for session to kill
  * @param   string  $useragent      SHA1 hash of user agent to look for
  * @return  bool                    True on success
  */
 function kill_child($username, $useragent)
 {
     global $CFG, $DB;
     $remoteclient = get_mnet_remote_client();
     $session = $DB->get_record('mnet_session', array('username' => $username, 'mnethostid' => $remoteclient->id, 'useragent' => $useragent));
     $DB->delete_records('mnet_session', array('username' => $username, 'mnethostid' => $remoteclient->id, 'useragent' => $useragent));
     if (false != $session) {
         session_kill($session->session_id);
         return true;
     }
     return false;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:21,代码来源:auth.php


示例2: mnet_server_dummy_method

/**
 * Dummy function for the XML-RPC dispatcher - use to call a method on an object
 * or to call a function
 *
 * Translate XML-RPC's strange function call syntax into a more straightforward
 * PHP-friendly alternative. This dummy function will be called by the
 * dispatcher, and can be used to call a method on an object, or just a function
 *
 * The methodName argument (eg. mnet/testlib/mnet_concatenate_strings)
 * is ignored.
 *
 * @throws mnet_server_exception
 *
 * @param  string  $methodname     We discard this - see 'functionname'
 * @param  array   $argsarray      Each element is an argument to the real
 *                                 function
 * @param  string  $functionname   The name of the PHP function you want to call
 * @return mixed                   The return value will be that of the real
 *                                 function, whatever it may be.
 */
function mnet_server_dummy_method($methodname, $argsarray, $functionname) {
    $remoteclient = get_mnet_remote_client();
    try {
        if (is_object($remoteclient->object_to_call)) {
            return @call_user_func_array(array($remoteclient->object_to_call,$functionname), $argsarray);
        } else if (!empty($remoteclient->static_location)) {
            return @call_user_func_array(array($remoteclient->static_location, $functionname), $argsarray);
        } else {
            return @call_user_func_array($functionname, $argsarray);
        }
    } catch (Exception $e) {
        exit(mnet_server_fault($e->getCode(), $e->getMessage()));
    }
}
开发者ID:JP-Git,项目名称:moodle,代码行数:34,代码来源:serverlib.php


示例3: course_enrolments

 /**
  * Returns a list of users from the client server who are enrolled in our course
  *
  * Suitable instance of enrol_mnet must be created in the course. This method will not
  * return any information about the enrolments in courses that are not available for
  * remote enrolment, even if their users are enrolled into them via other plugin
  * (note the difference from {@link self::user_enrolments()}).
  *
  * This method will return enrolment information for users from hosts regardless
  * the enrolment plugin. It does not matter if the user was enrolled remotely by
  * their admin or locally. Once the course is available for remote enrolments, we
  * will tell them everything about their users.
  *
  * In Moodle 1.x the returned array used to be indexed by username. The side effect
  * of MDL-19219 fix is that we do not need to use such index and therefore we can
  * return all enrolment records. MNet clients 1.x will only use the last record for
  * the student, if she is enrolled via multiple plugins.
  *
  * @uses mnet_remote_client Callable via XML-RPC only
  * @param int $courseid ID of our course
  * @param string|array $roles comma separated list of role shortnames (or array of them)
  * @return array
  */
 public function course_enrolments($courseid, $roles = null)
 {
     global $DB, $CFG;
     if (!($client = get_mnet_remote_client())) {
         die('Callable via XML-RPC only');
     }
     $sql = "SELECT u.username, r.shortname, r.name, e.enrol, ue.timemodified\n                  FROM {user_enrolments} ue\n                  JOIN {user} u ON ue.userid = u.id\n                  JOIN {enrol} e ON ue.enrolid = e.id\n                  JOIN {role} r ON e.roleid = r.id\n                 WHERE u.mnethostid = :mnethostid\n                       AND e.courseid = :courseid\n                       AND u.id <> :guestid\n                       AND u.confirmed = 1\n                       AND u.deleted = 0";
     $params['mnethostid'] = $client->id;
     $params['courseid'] = $courseid;
     $params['guestid'] = $CFG->siteguest;
     if (!is_null($roles)) {
         if (!is_array($roles)) {
             $roles = explode(',', $roles);
         }
         $roles = array_map('trim', $roles);
         list($rsql, $rparams) = $DB->get_in_or_equal($roles, SQL_PARAMS_NAMED);
         $sql .= " AND r.shortname {$rsql}";
         $params = array_merge($params, $rparams);
     }
     $sql .= " ORDER BY u.lastname, u.firstname";
     $rs = $DB->get_recordset_sql($sql, $params);
     $list = array();
     foreach ($rs as $record) {
         $list[] = $record;
     }
     $rs->close();
     return $list;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:51,代码来源:enrol.php


示例4: fetch_file

 /**
 * xmlrpc (mnet) function to get the file.
 * reads in the file and returns it base_64 encoded
 * so that it can be enrypted by mnet.
 *
 * @param string $token the token recieved previously during send_content_intent
 */
 public static function fetch_file($token) {
     global $DB;
     $remoteclient = get_mnet_remote_client();
     try {
         if (!$transferid = $DB->get_field('portfolio_mahara_queue', 'transferid', array('token' => $token))) {
             throw new mnet_server_exception(8009, 'mnet_notoken', 'portfolio_mahara');
         }
         $exporter = portfolio_exporter::rewaken_object($transferid);
     } catch (portfolio_exception $e) {
         throw new mnet_server_exception(8010, 'mnet_noid', 'portfolio_mahara');
     }
     if ($exporter->get('instance')->get_config('mnethostid') != $remoteclient->id) {
         throw new mnet_server_exception(8011, 'mnet_wronghost', 'portfolio_mahara');
     }
     global $CFG;
     try {
         $i = $exporter->get('instance');
         $f = $i->get('file');
         if (empty($f) || !($f instanceof stored_file)) {
             throw new mnet_server_exception(8012, 'mnet_nofile', 'portfolio_mahara');
         }
         try {
             $c = $f->get_content();
         } catch (file_exception $e) {
             throw new mnet_server_exception(8013, 'mnet_nofilecontents', 'portfolio_mahara', $e->getMessage());
         }
         $contents = base64_encode($c);
     } catch (Exception $e) {
         throw new mnet_server_exception(8013, 'mnet_nofile', 'portfolio_mahara');
     }
     $exporter->log_transfer();
     $exporter->process_stage_cleanup(true);
     return $contents;
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:41,代码来源:lib.php


示例5: mnet_debug

/**
 * Output debug information about mnet.  this will go to the <b>error_log</b>.
 *
 * @param mixed $debugdata this can be a string, or array or object.
 * @param int   $debuglevel optional , defaults to 1. bump up for very noisy debug info
 */
function mnet_debug($debugdata, $debuglevel=1) {
    global $CFG;
    $setlevel = get_config('', 'mnet_rpcdebug');
    if (empty($setlevel) || $setlevel < $debuglevel) {
        return;
    }
    if (is_object($debugdata)) {
        $debugdata = (array)$debugdata;
    }
    if (is_array($debugdata)) {
        mnet_debug('DUMPING ARRAY');
        foreach ($debugdata as $key => $value) {
            mnet_debug("$key: $value");
        }
        mnet_debug('END DUMPING ARRAY');
        return;
    }
    $prefix = 'MNET DEBUG ';
    if (defined('MNET_SERVER')) {
        $prefix .= " (server $CFG->wwwroot";
        if ($peer = get_mnet_remote_client() && !empty($peer->wwwroot)) {
            $prefix .= ", remote peer " . $peer->wwwroot;
        }
        $prefix .= ')';
    } else {
        $prefix .= " (client $CFG->wwwroot) ";
    }
    error_log("$prefix $debugdata");
}
开发者ID:JP-Git,项目名称:moodle,代码行数:35,代码来源:lib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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