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


PHP httpsrequired函数代码示例

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


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

示例1: print_entry

 /**
  * Presents registration forms.
  *
  * @param object $course Course info
  * @access public
  */
 function print_entry($course)
 {
     global $CFG, $USER, $form;
     $zerocost = zero_cost($course);
     if ($zerocost) {
         $manual = enrolment_factory::factory('manual');
         if (!empty($this->errormsg)) {
             $manual->errormsg = $this->errormsg;
         }
         $manual->print_entry($course);
         return;
     }
     prevent_double_paid($course);
     httpsrequired();
     if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 443) {
         // MDL-9836
         if (empty($CFG->loginhttps)) {
             print_error('httpsrequired', 'enrol_authorize');
         } else {
             $wwwsroot = str_replace('http:', 'https:', $CFG->wwwroot);
             redirect("{$wwwsroot}/course/enrol.php?id={$course->id}");
             exit;
         }
     }
     $strcourses = get_string('courses');
     $strloginto = get_string('loginto', '', $course->shortname);
     $navlinks = array();
     $navlinks[] = array('name' => $strcourses, 'link' => "{$CFG->wwwroot}/course/", 'type' => 'misc');
     $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
     $navigation = build_navigation($navlinks);
     print_header($strloginto, $course->fullname, $navigation);
     print_course($course, '80%');
     if ($course->password) {
         print_heading(get_string('choosemethod', 'enrol_authorize'), 'center');
     }
     print_simple_box_start('center', '80%');
     if ($USER->username == 'guest') {
         // only real guest user, not for users with guest role
         $curcost = get_course_cost($course);
         echo '<div class="mdl-align">';
         echo '<p>' . get_string('paymentrequired') . '</p>';
         echo '<p><b>' . get_string('cost') . ": {$curcost['currency']} {$curcost['cost']}" . '</b></p>';
         echo '<p><a href="' . $CFG->httpswwwroot . '/login/">' . get_string('loginsite') . '</a></p>';
         echo '</div>';
     } else {
         require_once $CFG->dirroot . '/enrol/authorize/enrol_form.php';
         $frmenrol = new enrol_authorize_form('enrol.php', compact('course'));
         if ($frmenrol->get_data()) {
             $authorizeerror = '';
             switch ($form->paymentmethod) {
                 case AN_METHOD_CC:
                     $authorizeerror = $this->cc_submit($form, $course);
                     break;
                 case AN_METHOD_ECHECK:
                     $authorizeerror = $this->echeck_submit($form, $course);
                     break;
             }
             if (!empty($authorizeerror)) {
                 error($authorizeerror);
             }
         }
         $frmenrol->display();
     }
     print_simple_box_end();
     if ($course->password) {
         $password = '';
         include $CFG->dirroot . '/enrol/manual/enrol.html';
     }
     print_footer();
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:76,代码来源:enrol.php

示例2: email_print_tabs_options

/**
 * This functions prints tabs options
 *
 * @uses $CFG
 * @param int $courseid Course Id
 * @param int $folderid Folder Id
 * @param string $action  Actual action
 * @return boolean Success/Fail
 * @todo Finish documenting this function
 */
function email_print_tabs_options($courseid, $folderid, $action = NULL)
{
    global $CFG;
    // SSL encription
    if ($CFG->email_enable_ssl) {
        httpsrequired();
        $wwwroot = str_replace('http:', 'https:', $CFG->wwwroot);
    } else {
        $wwwroot = $CFG->wwwroot;
    }
    if ($courseid == SITEID) {
        $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
        // SYSTEM context
    } else {
        $context = get_context_instance(CONTEXT_COURSE, $courseid);
        // Course context
    }
    // Declare tab array
    $tabrow = array();
    // Tab for writting new email
    if (has_capability('block/email_list:sendmessage', $context)) {
        $tabrow[] = new email_tabobject('newmail', $wwwroot . '/blocks/email_list/email/sendmail.php?course=' . $courseid . '&amp;folderid=' . $folderid, get_string('newmail', 'block_email_list'), '<img alt="' . get_string('edit') . '" width="15" height="13" src="' . $CFG->pixpath . '/i/edit.gif" />');
    }
    if (has_capability('block/email_list:createfolder', $context)) {
        $tabrow[] = new email_tabobject('newfolderform', $CFG->wwwroot . '/blocks/email_list/email/folder.php?course=' . $courseid . '&amp;folderid=' . $folderid, get_string('newfolderform', 'block_email_list'), '<img alt="' . get_string('edit') . '" width="15" height="15" src="' . $CFG->wwwroot . '/blocks/email_list/email/images/folder_add.png" />');
    }
    /// FUTURE: Implement filters
    //$tabrow[] = new tabobject('newfilter', $CFG->wwwroot.'/blocks/email_list/email/view.php?'.$url .'&amp;action=\'newfilter\'', get_string('newfilter', 'email') );
    // If empty tabrow, add vspace. Only apply on Site Course.
    if (empty($tabrow)) {
        print_spacer(50, 1);
    }
    $tabrows = array($tabrow);
    // Print tabs, and if it's in case, selected this
    switch ($action) {
        case 'newmail':
            print_email_tabs($tabrows, 'newmail');
            break;
        case 'newfolderform':
            print_email_tabs($tabrows, 'newfolderform');
            break;
        case 'newfilter':
            print_email_tabs($tabrows, 'filter');
            break;
        default:
            print_email_tabs($tabrows);
    }
    return true;
}
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:59,代码来源:lib.php

示例3: signup_captcha_enabled

 */
function signup_captcha_enabled()
{
    global $CFG;
    return !empty($CFG->recaptchapublickey) && !empty($CFG->recaptchaprivatekey) && get_config('auth/email', 'recaptcha');
}
require_once 'signup_form.php';
if (empty($CFG->registerauth)) {
    print_error("Sorry, you may not use this page.");
}
$authplugin = get_auth_plugin($CFG->registerauth);
if (!$authplugin->can_signup()) {
    print_error("Sorry, you may not use this page.");
}
//HTTPS is potentially required in this page
httpsrequired();
$mform_signup = new login_signup_form();
if ($mform_signup->is_cancelled()) {
    redirect(get_login_url());
} else {
    if ($user = $mform_signup->get_data()) {
        $user->confirmed = 0;
        $user->lang = current_language();
        $user->firstaccess = time();
        $user->mnethostid = $CFG->mnet_localhost_id;
        $user->secret = random_string(15);
        $user->auth = $CFG->registerauth;
        $authplugin->user_signup($user, true);
        // prints notice and link to login/index.php
        exit;
        //never reached
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:signup.php

示例4: loginpage_hook

 /**
  * Will get called before the login page is shown, if NTLM SSO
  * is enabled, and the user is in the right network, we'll redirect
  * to the magic NTLM page for SSO...
  *
  */
 function loginpage_hook()
 {
     global $CFG, $SESSION;
     // HTTPS is potentially required
     httpsrequired();
     if (($_SERVER['REQUEST_METHOD'] === 'GET' || $_SERVER['REQUEST_METHOD'] === 'POST' && get_referer() != strip_querystring(qualified_me())) && !empty($this->config->ntlmsso_enabled) && !empty($this->config->ntlmsso_subnet) && empty($_GET['authldap_skipntlmsso']) && (isguestuser() || !isloggedin()) && address_in_subnet(getremoteaddr(), $this->config->ntlmsso_subnet)) {
         // First, let's remember where we were trying to get to before we got here
         if (empty($SESSION->wantsurl)) {
             $SESSION->wantsurl = array_key_exists('HTTP_REFERER', $_SERVER) && $_SERVER['HTTP_REFERER'] != $CFG->wwwroot && $_SERVER['HTTP_REFERER'] != $CFG->wwwroot . '/' && $_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot . '/login/' && $_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot . '/login/index.php' ? $_SERVER['HTTP_REFERER'] : NULL;
         }
         // Now start the whole NTLM machinery.
         if (!empty($this->config->ntlmsso_ie_fastpath)) {
             // Shortcut for IE browsers: skip the attempt page at all
             if (check_browser_version('MSIE')) {
                 $sesskey = sesskey();
                 redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey=' . $sesskey);
             } else {
                 redirect($CFG->httpswwwroot . '/login/index.php?authldap_skipntlmsso=1');
             }
         } else {
             redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_attempt.php');
         }
     }
     // No NTLM SSO, Use the normal login page instead.
     // If $SESSION->wantsurl is empty and we have a 'Referer:' header, the login
     // page insists on redirecting us to that page after user validation. If
     // we clicked on the redirect link at the ntlmsso_finish.php page instead
     // of waiting for the redirection to happen, then we have a 'Referer:' header
     // we don't want to use at all. As we can't get rid of it, just point
     // $SESSION->wantsurl to $CFG->wwwroot (after all, we came from there).
     if (empty($SESSION->wantsurl) && get_referer() == $CFG->httpswwwroot . '/auth/ldap/ntlmsso_finish.php') {
         $SESSION->wantsurl = $CFG->wwwroot;
     }
 }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:40,代码来源:auth.php


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