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


PHP get_moodle_cookie函数代码示例

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


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

示例1: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION;
     $wwwroot = '';
     $signup = '';
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (empty($CFG->loginhttps)) {
         $wwwroot = $CFG->wwwroot;
     } else {
         // This actually is not so secure ;-), 'cause we're
         // in unencrypted connection...
         $wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
     }
     if (!empty($CFG->registerauth)) {
         $authplugin = get_auth_plugin($CFG->registerauth);
         if ($authplugin->can_signup()) {
             $signup = $wwwroot . '/login/signup.php';
         }
     }
     // TODO: now that we have multiauth it is hard to find out if there is a way to change password
     $forgot = $wwwroot . '/login/forgot_password.php';
     if (!empty($CFG->loginpasswordautocomplete)) {
         $autocomplete = 'autocomplete="off"';
     } else {
         $autocomplete = '';
     }
     $username = get_moodle_cookie();
     $this->content = new stdClass();
     $this->content->footer = '';
     $this->content->text = '';
     if (!isloggedin() or isguestuser()) {
         // Show the block
         if (empty($CFG->authloginviaemail)) {
             $strusername = get_string('username');
         } else {
             $strusername = get_string('usernameemail');
         }
         $this->content->text .= "\n" . '<form class="loginform" id="login" method="post" action="' . get_login_url() . '" ' . $autocomplete . '>';
         $this->content->text .= '<div class="c1 fld username"><label for="login_username">' . $strusername . '</label>';
         $this->content->text .= '<input type="text" name="username" id="login_username" value="' . s($username) . '" /></div>';
         $this->content->text .= '<div class="c1 fld password"><label for="login_password">' . get_string('password') . '</label>';
         $this->content->text .= '<input type="password" name="password" id="login_password" value="" ' . $autocomplete . ' /></div>';
         if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
             $checked = $username ? 'checked="checked"' : '';
             $this->content->text .= '<div class="c1 rememberusername"><input type="checkbox" name="rememberusername" id="rememberusername" value="1" ' . $checked . '/>';
             $this->content->text .= ' <label for="rememberusername">' . get_string('rememberusername', 'admin') . '</label></div>';
         }
         $this->content->text .= '<div class="c1 btn"><input type="submit" value="' . get_string('login') . '" /></div>';
         $this->content->text .= "</form>\n";
         if (!empty($signup)) {
             $this->content->footer .= '<div><a href="' . $signup . '">' . get_string('startsignup') . '</a></div>';
         }
         if (!empty($forgot)) {
             $this->content->footer .= '<div><a href="' . $forgot . '">' . get_string('forgotaccount') . '</a></div>';
         }
     }
     return $this->content;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:60,代码来源:block_login.php

示例2: get_content

 function get_content()
 {
     global $USER, $CFG;
     $wwwroot = '';
     $signup = '';
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (empty($CFG->loginhttps)) {
         $wwwroot = $CFG->wwwroot;
     } else {
         // This actually is not so secure ;-), 'cause we're
         // in unencrypted connection...
         $wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
     }
     if (!empty($CFG->registerauth)) {
         $authplugin = get_auth_plugin($CFG->registerauth);
         if ($authplugin->can_signup()) {
             $signup = $wwwroot . '/login/signup.php';
         }
     }
     // TODO: now that we have multiauth it is hard to find out if there is a way to change password
     $forgot = $wwwroot . '/login/forgot_password.php';
     $username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
     $this->content->footer = '';
     $this->content->text = '';
     if (!isloggedin() or isguestuser()) {
         // Show the block
         $this->content->text .= "\n" . '<form class="loginform" id="login" method="post" action="' . $wwwroot . '/login/index.php">';
         $this->content->text .= '<div class="c1 fld username"><label for="login_username">' . get_string('username') . '</label>';
         $this->content->text .= '<input type="text" name="username" id="login_username" value="' . s($username) . '" /></div>';
         $this->content->text .= '<div class="c1 fld password"><label for="login_password">' . get_string('password') . '</label>';
         $this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>';
         $this->content->text .= '<div class="c1 btn"><input type="submit" value="' . get_string('login') . '" /></div>';
         $this->content->text .= "</form>\n";
         if (!empty($signup)) {
             $this->content->footer .= '<div><a href="' . $signup . '">' . get_string('startsignup') . '</a></div>';
         }
         if (!empty($forgot)) {
             $this->content->footer .= '<div><a href="' . $forgot . '">' . get_string('forgotaccount') . '</a></div>';
         }
     }
     return $this->content;
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:44,代码来源:block_login.php

示例3: redirect

        }
    } else {
        if (!empty($CFG->mymoodleredirect)) {
            // Redirect logged-in users to My Moodle overview if required
            if (isloggedin() && $USER->username != 'guest') {
                redirect($CFG->wwwroot . '/my/index.php');
            }
        }
    }
} else {
    // if upgrading from 1.6 or below
    if (isadmin() && moodle_needs_upgrading()) {
        redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
    }
}
if (get_moodle_cookie() == '') {
    set_moodle_cookie('nobody');
    // To help search for cookies on login page
}
if (!empty($USER->id)) {
    add_to_log(SITEID, 'course', 'view', 'view.php?id=' . SITEID, SITEID);
}
if (empty($CFG->langmenu)) {
    $langmenu = '';
} else {
    $currlang = current_language();
    $langs = get_list_of_languages();
    $langlabel = get_accesshide(get_string('language'));
    $langmenu = popup_form($CFG->wwwroot . '/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID);
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:index.php

示例4: redirect

    }
    redirect($loginurl);
}
// make sure we really are on the https page when https login required
$PAGE->verify_https_required();
/// Generate the login page with forms
if (!isset($frm) or !is_object($frm)) {
    $frm = new stdClass();
}
if (empty($frm->username) && $authsequence[0] != 'shibboleth') {
    // See bug 5184
    if (!empty($_GET["username"])) {
        $frm->username = clean_param($_GET["username"], PARAM_RAW);
        // we do not want data from _POST here
    } else {
        $frm->username = get_moodle_cookie();
    }
    $frm->password = "";
}
if (!empty($frm->username)) {
    $focus = "password";
} else {
    $focus = "username";
}
if (!empty($CFG->registerauth) or is_enabled_auth('none') or !empty($CFG->auth_instructions)) {
    $show_instructions = true;
} else {
    $show_instructions = false;
}
$potentialidps = array();
foreach ($authsequence as $authname) {
开发者ID:educakanchay,项目名称:campus,代码行数:31,代码来源:index.php

示例5: redirect

}
if (!empty($loginurl)) {
    // We don't want the standard forms, go elsewhere
    redirect($loginurl);
}
/// Generate the login page with forms
if ($session_has_timed_out) {
    $errormsg = get_string('sessionerroruser', 'error');
}
if (get_moodle_cookie() == '') {
    set_moodle_cookie('nobody');
    // To help search for cookies
}
if (empty($frm->username) && $authsequence[0] != 'shibboleth') {
    // See bug 5184
    $frm->username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
    $frm->password = "";
}
if (!empty($frm->username)) {
    $focus = "password";
} else {
    $focus = "username";
}
if (!empty($CFG->registerauth) or is_enabled_auth('none') or !empty($CFG->auth_instructions)) {
    $show_instructions = true;
} else {
    $show_instructions = false;
}
print_header("{$site->fullname}: {$loginsite}", $site->fullname, $loginsite, $focus, '', true, '<div class="langmenu">' . $langmenu . '</div>');
include "index_form.html";
print_footer();
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:index.php

示例6: colms_theme_login_form

function colms_theme_login_form() {
    global $CFG;
    if (empty($CFG->loginhttps)) {
        $wwwroot = $CFG->wwwroot;
    } else {
        // This actually is not so secure ;-), 'cause we're
        // in unencrypted connection...
        $wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
    }

    //  if (!empty($CFG->registerauth)) {
    //   $authplugin = get_auth_plugin($CFG->registerauth);
    //    if ($authplugin->can_signup()) {
    //$signup = $wwwroot . '/login/signup.php';
    //   }
    //}
    // TODO: now that we have multiauth it is hard to find out if there is a way to change password
    $forgot = $wwwroot . '/login/forgot_password.php';

    if (!empty($CFG->loginpasswordautocomplete)) {
        $autocomplete = 'autocomplete="off"';
    } else {
        $autocomplete = '';
    }

    $username = get_moodle_cookie();
    $content = '<div id="front-login"><form class="loginform" id="login" method="post" action="' . get_login_url() . '" ' . $autocomplete . ' >';

    //  $content .= '<label for="login_username">'.get_string('username').'</label>';
    $content .= '<div class="c1 fld username"><input type="text" name="username" id="login_username" placeholder="Username" value="' . s($username) . '" /></div>';

    //    $content .= '<label for="login_password">'.get_string('password').'</label>';

    $content .= '<div class="c1 fld password"><input type="password" name="password" id="login_password" placeholder="Password" value="" ' . $autocomplete . ' /></div>';

    if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
        $checked = $username ? 'checked="checked"' : '';
        $content .= '<div class="c1 rememberusername"><input type="checkbox" name="rememberusername" id="rememberusername" value="1" />';
        $content .= ' <label for="rememberusername">' . get_string('rememberusername', 'admin') . '</label></div>';
    }

    $content .= '<div class="c1 btn"><input type="submit" value="' . get_string('login') . '" id="loginsubmit" /></div>';

    $content .= "</form>";
    if (!empty($forgot)) {
        $content .= '<div><a href="' . $forgot . '">' . get_string('forgotaccount') . '</a></div>';
    }
    $content .='</div>';
    return $content;
}
开发者ID:anilch,项目名称:Personel,代码行数:50,代码来源:lib.php

示例7: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION, $OUTPUT;
     require_once $CFG->libdir . '/authlib.php';
     $wwwroot = '';
     $signup = '';
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (empty($CFG->loginhttps)) {
         $wwwroot = $CFG->wwwroot;
     } else {
         // This actually is not so secure ;-), 'cause we're
         // in unencrypted connection...
         $wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
     }
     if (signup_is_enabled()) {
         $signup = $wwwroot . '/login/signup.php';
     }
     // TODO: now that we have multiauth it is hard to find out if there is a way to change password
     $forgot = $wwwroot . '/login/forgot_password.php';
     if (!empty($CFG->loginpasswordautocomplete)) {
         $autocomplete = 'autocomplete="off"';
     } else {
         $autocomplete = '';
     }
     $username = get_moodle_cookie();
     $this->content = new stdClass();
     $this->content->footer = '';
     $this->content->text = '';
     if (!isloggedin() or isguestuser()) {
         // Show the block
         if (empty($CFG->authloginviaemail)) {
             $strusername = get_string('username');
         } else {
             $strusername = get_string('usernameemail');
         }
         $this->content->text .= "\n" . '<form class="loginform" id="login" method="post" action="' . get_login_url() . '" ' . $autocomplete . '>';
         $this->content->text .= '<div class="form-group"><label for="login_username">' . $strusername . '</label>';
         $this->content->text .= '<input type="text" name="username" id="login_username" class="form-control" value="' . s($username) . '" /></div>';
         $this->content->text .= '<div class="form-group"><label for="login_password">' . get_string('password') . '</label>';
         $this->content->text .= '<input type="password" name="password" id="login_password" class="form-control" value="" ' . $autocomplete . ' /></div>';
         if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
             $checked = $username ? 'checked="checked"' : '';
             $this->content->text .= '<div class="form-check">';
             $this->content->text .= '<label class="form-check-label">';
             $this->content->text .= '<input type="checkbox" name="rememberusername" id="rememberusername"
                     class="form-check-input" value="1" ' . $checked . '/> ';
             $this->content->text .= get_string('rememberusername', 'admin') . '</label>';
             $this->content->text .= '</div>';
         }
         $this->content->text .= '<div class="form-group">';
         $this->content->text .= '<input type="submit" class="btn btn-primary btn-block" value="' . get_string('login') . '" />';
         $this->content->text .= '</div>';
         $this->content->text .= "</form>\n";
         if (!empty($signup)) {
             $this->content->text .= '<div><a href="' . $signup . '">' . get_string('startsignup') . '</a></div>';
         }
         if (!empty($forgot)) {
             $this->content->text .= '<div><a href="' . $forgot . '">' . get_string('forgotaccount') . '</a></div>';
         }
         $authsequence = get_enabled_auth_plugins(true);
         // Get all auths, in sequence.
         $potentialidps = array();
         foreach ($authsequence as $authname) {
             $authplugin = get_auth_plugin($authname);
             $potentialidps = array_merge($potentialidps, $authplugin->loginpage_idp_list($this->page->url->out(false)));
         }
         if (!empty($potentialidps)) {
             $this->content->text .= '<div class="potentialidps">';
             $this->content->text .= '<h6>' . get_string('potentialidps', 'auth') . '</h6>';
             $this->content->text .= '<div class="potentialidplist">';
             foreach ($potentialidps as $idp) {
                 $this->content->text .= '<div class="potentialidp"><a href="' . $idp['url']->out() . '" title="' . s($idp['name']) . '">';
                 $this->content->text .= $OUTPUT->render($idp['icon'], $idp['name']) . s($idp['name']) . '</a></div>';
             }
             $this->content->text .= '</div>';
             $this->content->text .= '</div>';
         }
     }
     return $this->content;
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:82,代码来源:block_login.php

示例8: get_content

 function get_content()
 {
     global $USER, $CFG;
     // We don't want to show this block if OpenID auth isn't enabled
     if (!is_enabled_auth('openid')) {
         return '';
     }
     $config = get_config('auth/openid');
     $user_is_openid = isset($USER->auth) && $USER->auth == 'openid';
     $user_loggedin = !user_not_loggedin();
     // Check to see if the box should be displayed to a logged in user
     if ($user_loggedin) {
         // We don't want to allow admin users to be changed
         if (is_siteadmin($USER->id)) {
             return '';
         }
         if (!isset($config->auth_openid_allow_account_change)) {
             $config->auth_openid_allow_account_change = 'true';
         }
         if (!isset($config->auth_openid_allow_muliple)) {
             $config->auth_openid_allow_muliple = 'true';
         }
         $allow_change = $config->auth_openid_allow_account_change == 'true';
         $allow_append = $config->auth_openid_allow_muliple == 'true';
         if ($user_is_openid && !$allow_append || !$user_is_openid && !$allow_change) {
             return '';
         }
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content->footer = '';
     $this->content->text = '';
     $username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
     $user = get_complete_user_data('username', $username);
     // BJB101119: added check below "if (empty($user) ||" to fix error
     if (empty($user) || $user->auth != 'openid' || $user_loggedin) {
         $username = '';
     }
     if ($user_loggedin) {
         $endpoint = $CFG->wwwroot . '/auth/openid/actions.php';
     } else {
         $endpoint = $CFG->wwwroot . '/login/index.php';
     }
     $this->content->text .= '
         <style type="text/css">
         input.openid_login {
             background: url(' . $CFG->wwwroot . '/auth/openid/icon.gif) no-repeat;
             background-color: #fff;
             background-position: 0 50%;
             color: #000;
             padding-left: 18px;
         }
         </style>
         <form class="loginform" name="login" method="post" action="' . $endpoint . '" onsubmit="if (document.login.openid_url.value == \'\') return false;" >
             <table align="center" cellpadding="2" cellspacing="0" class="logintable">
     ';
     if ($user_loggedin) {
         $this->content->text .= '<tr><td class="c0 r0" colspan="2"><small>';
         if ($user_is_openid) {
             $this->content->text .= '<input type="hidden" name="openid_action" value="append" />';
             $this->content->text .= get_string('append_text', 'auth_openid');
         } else {
             $this->content->text .= '<input type="hidden" name="openid_action" value="change" />';
             $this->content->text .= get_string('change_text', 'auth_openid');
         }
         $this->content->text .= ':</small></td></tr>';
     }
     $this->content->text .= '
             <tr>
                 <td class="c0 r1" colspan="2">
                     <input class="openid_login" type="text" name="openid_url" size="18" value="" />
                 </td>
             </tr>
            ';
     $this->content->text .= '
             <tr>
                 <td class="c0 r2" align="left">
                     <a href="http://openid.net/" target="newWindow"><small>' . get_string('whats_this', 'auth_openid') . '</small></a>
                 </td>
                 <td class="c1 r2" align="center">
                     <input type="submit" value="' . get_string('login') . '" />
                 </td>
             </tr>
            ';
     $authplugin = get_auth_plugin('openid');
     if (!$user_loggedin || $authplugin->can_change_password()) {
         $this->content->text .= '<tr>
                 <td colspan="2" class="c1 r3" align="center">';
         if (!$user_loggedin) {
             $this->content->text .= '<a href="' . $CFG->wwwroot . '/auth/openid/fallback.php"><small>' . get_string('provider_offline', 'auth_openid') . "</small></a>\n";
         }
         if ($authplugin->can_change_password()) {
             $this->content->text .= '<a href="' . $authplugin->change_password_url() . '"><small>' . get_string('openid_manage', 'auth_openid') . "</small></a>\n";
         }
         $this->content->text .= '</td>
             </tr>
            ';
     }
     $this->content->text .= '</table>
//.........这里部分代码省略.........
开发者ID:remotelearner,项目名称:elis.openid,代码行数:101,代码来源:block_openid.php

示例9: get_content

 function get_content()
 {
     global $USER, $CFG;
     // We don't want to show this block if OpenID auth isn't enabled
     if (!is_enabled_auth('openid')) {
         return '';
     }
     $config = get_config('auth/openid');
     $user_is_openid = $USER->auth == 'openid';
     // Check to see if the box should be displayed to a logged in user
     if ($USER->id > 0) {
         // We don't want to allow admin or guest users to be changed
         if ($USER->username == 'admin' || $USER->username == 'guest') {
             return '';
         }
         if (!isset($config->auth_openid_allow_account_change)) {
             $config->auth_openid_allow_account_change = 'true';
         }
         if (!isset($config->auth_openid_allow_muliple)) {
             $config->auth_openid_allow_muliple = 'true';
         }
         $allow_change = $config->auth_openid_allow_account_change == 'true';
         $allow_append = $config->auth_openid_allow_muliple == 'true';
         if ($user_is_openid && !$allow_append || !$user_is_openid && !$allow_change) {
             return '';
         }
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content->footer = '';
     $this->content->text = '';
     $username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
     $user = get_complete_user_data('username', $username);
     if ($user->auth != 'openid' || $USER->id > 0) {
         $username = '';
     }
     if ($USER->id > 0) {
         $endpoint = $CFG->wwwroot . '/auth/openid/actions.php';
     } else {
         $endpoint = $CFG->wwwroot . '/login/index.php';
     }
     $this->content->text .= '
         <style type="text/css">
         input.openid_login {
             background: url(' . $CFG->wwwroot . '/auth/openid/icon.gif) no-repeat;
             background-color: #fff;
             background-position: 0 50%;
             color: #000;
             padding-left: 18px;
         }
         </style>
         <form class="loginform" name="login" method="post" action="' . $endpoint . '">
             <table align="center" cellpadding="2" cellspacing="0" class="logintable">
     ';
     if ($USER->id > 0) {
         $this->content->text .= '<tr><td class="c0 r0" colspan="2"><small>';
         if ($user_is_openid) {
             $this->content->text .= '<input type="hidden" name="openid_action" value="append" />';
             $this->content->text .= get_string('append_text', 'auth_openid');
         } else {
             $this->content->text .= '<input type="hidden" name="openid_action" value="change" />';
             $this->content->text .= get_string('change_text', 'auth_openid');
         }
         $this->content->text .= '</small></td></tr>';
     }
     $this->content->text .= '
             <tr>
                 <td class="c0 r1" colspan="2">
                     <input class="openid_login" type="text" name="openid_url" size="18" value="" />
                 </td>
             </tr>
             <tr>
                 <td colspan="2" class="c1 r2" align="right">
                     <a href="http://openid.net/"><small>' . get_string('whats_this', 'auth_openid') . '</small></a>
                     <input type="submit" value="' . get_string('login') . '" />
                 </td>
             </tr>
             <tr>
                 <td colspan="2" class="c1 r2" align="right">
                     <a href="' . $CFG->wwwroot . '/auth/openid/fallback.php"><small>' . get_string('provider_offline', 'auth_openid') . '</small></a>
                 </td>
         </table>
     </form>
     ';
     return $this->content;
 }
开发者ID:ejucovy,项目名称:moodle-openid,代码行数:87,代码来源:block_openid.php


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