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


PHP mnet_peer::check_common_name方法代码示例

本文整理汇总了PHP中mnet_peer::check_common_name方法的典型用法代码示例。如果您正苦于以下问题:PHP mnet_peer::check_common_name方法的具体用法?PHP mnet_peer::check_common_name怎么用?PHP mnet_peer::check_common_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mnet_peer的用法示例。


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

示例1: mnetadmin_keyswap

/**
 * NOT WORKING
 * reimplementation of system.keyswapcall with capability of forcing the local renew
 *
 */
function mnetadmin_keyswap($function, $params)
{
    global $CFG, $MNET;
    $return = array();
    $wwwroot = $params[0];
    $pubkey = $params[1];
    $application = $params[2];
    $forcerenew = $params[3];
    if ($forcerenew == 0) {
        // standard keyswap for first key recording
        if (!empty($CFG->mnet_register_allhosts)) {
            $mnet_peer = new mnet_peer();
            $keyok = $mnet_peer->bootstrap($wwwroot, $pubkey, $application);
            if ($keyok) {
                $mnet_peer->commit();
            }
        }
    } else {
        $mnet_peer = new mnet_peer();
        // we can only renew hosts that we know something about.
        if ($mnet_peer->set_wwwroot($wwwroot)) {
            $mnet_peer->public_key = clean_param($pubkey, PARAM_PEM);
            $mnet_peer->public_key_expires = $mnet_peer->check_common_name($pubkey);
            $mnet_peer->updateparams->public_key = clean_param($pubkey, PARAM_PEM);
            $mnet_peer->updateparams->public_key_expires = $mnet_peer->check_common_name($pubkey);
            $mnet_peer->commit();
        } else {
            return false;
            // avoid giving our key to unkown hosts.
        }
    }
    return $MNET->public_key;
}
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:38,代码来源:rpclib.php

示例2: foreach

 if ($mnet_peers) {
     foreach ($mnet_peers as $peer) {
         if ($peer->id == $CFG->mnet_all_hosts_id || $peer->id == $CFG->mnet_localhost_id) {
             continue;
         }
         $application = $DB->get_record('mnet_application', array('id' => $peer->applicationid));
         $mnet_peer = new mnet_peer();
         $mnet_peer->set_wwwroot($peer->wwwroot);
         // get the sessions for each vmoodle that have same ID Number
         // we use a force parameter to force fetching the key remotely anyway
         $currentkey = mnet_get_public_key($mnet_peer->wwwroot, $application, 1);
         if ($currentkey) {
             $mnet_peer->public_key = clean_param($currentkey, PARAM_PEM);
             $mnet_peer->updateparams = new StdClass();
             $mnet_peer->updateparams->public_key = clean_param($currentkey, PARAM_PEM);
             $mnet_peer->public_key_expires = $mnet_peer->check_common_name($currentkey);
             $mnet_peer->updateparams->public_key_expires = $mnet_peer->check_common_name($currentkey);
             $mnet_peer->commit();
             mtrace('My key renewed at ' . $peer->wwwroot . ' till ' . userdate($mnet_peer->public_key_expires));
             $trace .= userdate(time()) . ' KEY RENEW from ' . $CFG->wwwroot . ' to ' . $peer->wwwroot . " suceeded\n";
         } else {
             mtrace('Failed renewing key with ' . $peer->wwwroot . "\n");
             $trace .= userdate(time()) . ' KEY RENEW from ' . $CFG->wwwroot . ' to ' . $peer->wwwroot . " failed\n";
         }
     }
 }
 set_config('mnet_autorenew_haveto', 0);
 $trace .= userdate(time()) . ' RESET KEY RENEW on ' . $CFG->wwwroot . "\n";
 /// record trace in trace file
 if ($CFG->tracevmoodlekeyrenew) {
     if ($TRACE = fopen($CFG->dataroot . '/vmoodle_renew.log', 'w+')) {
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:31,代码来源:mnetcron.php

示例3: error

 if (isset($form->name) && $form->name != $mnet_peer->name) {
     $form->name = clean_param($form->name, PARAM_NOTAGS);
     $mnet_peer->set_name($form->name);
 }
 if (isset($form->deleted) && ($form->deleted == '0' || $form->deleted == '1')) {
     $mnet_peer->deleted = $form->deleted;
 }
 if (isset($form->public_key)) {
     $form->public_key = clean_param($form->public_key, PARAM_PEM);
     if (empty($form->public_key)) {
         error(get_string("invalidpubkey", 'mnet'), 'peers.php?step=update&hostid=' . $mnet_peer->id);
         exit;
     } else {
         $oldkey = $mnet_peer->public_key;
         $mnet_peer->public_key = $form->public_key;
         $mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
         if ($mnet_peer->public_key_expires == false) {
             $mnet_peer->public_key == $oldkey;
             $errmsg = '<br />';
             foreach ($mnet_peer->error as $err) {
                 $errmsg .= $err['code'] . ': ' . $err['text'] . '<br />';
             }
             error(get_string("invalidpubkey", 'mnet') . $errmsg, 'peers.php?step=update&amp;hostid=' . $mnet_peer->id);
             exit;
         }
     }
 }
 // PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
 if ('input' == $form->step) {
     if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
         error(get_string("hostexists", 'mnet', $mnet_peer->id), 'peers.php?step=update&amp;hostid=' . $mnet_peer->id);
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:peers.php


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