本文整理汇总了PHP中Lookup::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Lookup::get_instance方法的具体用法?PHP Lookup::get_instance怎么用?PHP Lookup::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lookup
的用法示例。
在下文中一共展示了Lookup::get_instance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stdClass
body {font-size:90%}
th {background-color:#295AAD; color:white; text-align:left; font-weight:normal}
</style>
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script>
$(function () {
$('.l').click(function() {
window.location = 'ldaplookup.php?LOOKUP=' + $(this).attr('id');
})
});
</script>
</head>
<body>
<?php
if (isset($_POST['submit'])) {
$lookup = Lookup::get_instance($configObject, $mysqli);
$data = new stdClass();
$data->lookupdata = new stdClass();
if ($_REQUEST['username'] != '') {
$data->lookupdata->username = $_REQUEST['username'];
$data->searchorder = array('username');
}
if ($_REQUEST['surname'] != '') {
$data->lookupdata->surname = $_REQUEST['surname'];
$data->searchorder = array('surname');
}
$data->settings = new stdClass();
$output = $lookup->userlookup($data);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('xdebug.remote_autostart', 1);
示例2: do_authentication
/**
* @param string $string - Language strings.
* @return bool if authentication was successful
*/
function do_authentication($string)
{
$this->success = false;
$this->debug[] = 'Starting authentication';
$preauthobj = new stdClass();
if (isset($this->callbackregister['preauth'])) {
foreach ($this->callbackregister['preauth'] as $number => $callback) {
$preauthobj = call_user_func_array($callback, array($preauthobj));
$objid = key($this->callbackregisterdata['preauth'][$number]);
$this->append_auth_object_debug($objid);
}
}
$authobj = new authobjreturn();
if (isset($this->callbackregister['auth'])) {
foreach ($this->callbackregister['auth'] as $number => $callback) {
$authobj = call_user_func_array($callback, array($authobj));
$objid = key($this->callbackregisterdata['auth'][$number]);
$this->append_auth_object_debug($objid);
if ($authobj->returned === ROGO_AUTH_OBJ_SUCCESS) {
$this->success = true;
$this->userid = $authobj->rogoid;
if (isset($authobj->username) and $authobj->username != '') {
$this->username = $authobj->username;
}
$this->debug[] = '******* Rogo ID is:: ' . $this->userid . " from object {$objid}:" . $this->callbackregisterdata['auth'][$number][$objid] . ' *******';
$this->successfullauthmodule[] = $objid;
} elseif ($authobj->returned === ROGO_AUTH_OBJ_LOOKUPONLY) {
$this->debug[] = '* User authenticated but no matching rogo id found, attempting to lookup the user with info supplied from module *';
//lookupuser
$lookup = Lookup::get_instance($this->configObj, $this->db);
//$authobj->data contains lookup info;
$data = new stdClass();
$data->lookupdata = clone $authobj->data;
$info = $lookup->userlookup($data);
$lookupdebug = $lookup->debug_as_array();
foreach ($lookupdebug as $line) {
$this->debug[] = 'Lookup Debug: ' . $line;
}
//minimum fields to create an new user username
$createuser = true;
$authentication_fields_required_to_create_user = $this->configObj->get('authentication_fields_required_to_create_user');
if (!is_null($authentication_fields_required_to_create_user)) {
foreach ($authentication_fields_required_to_create_user as $value) {
if (!isset($info->lookupdata->{$value}) or isset($info->lookupdata->{$value}) and $info->lookupdata->{$value} == '') {
$createuser = false;
$this->debug[] = 'Not creating user as the ' . $value . ' field is missing';
}
}
}
if (isset($info->lookupdata->disabled) and $info->lookupdata->disabled == true) {
$createuser = false;
}
if (isset($info->lookupdata->multiple) and $info->lookupdata->multiple == true) {
$createuser = false;
}
if ($createuser == true) {
$this->debug[] = 'Going to try and create new user';
$arraycheck = array('username', 'title', 'firstname', 'surname', 'email', 'coursecode', 'gender', 'yearofstudy', 'role', 'studentID', 'school', 'coursetitle', 'initials');
foreach ($arraycheck as $itemcheck) {
if (!isset($info->lookupdata->{$itemcheck})) {
$info->lookupdata->{$itemcheck} = '';
}
}
$newuserid = UserUtils::create_extended_user($info->lookupdata->username, $info->lookupdata->title, $info->lookupdata->firstname, $info->lookupdata->surname, $info->lookupdata->email, $info->lookupdata->coursecode, $info->lookupdata->gender, $info->lookupdata->yearofstudy, $info->lookupdata->role, $info->lookupdata->studentID, $this->db, $info->lookupdata->school, $info->lookupdata->coursetitle, $info->lookupdata->initials, $this->form['std']->password);
if ($newuserid !== false) {
//new account created
$authobj->success($objid, $newuserid);
$this->success = true;
$this->userid = $authobj->rogoid;
$this->debug[] = '******* Rogo ID is:: ' . $this->userid . " after a user lookup from object {$objid}:" . $this->callbackregisterdata['auth'][$number][$objid] . ' *******';
}
} else {
// Log not creating user and why
$username = 'UNKNOWN';
if (isset($this->form['std']->username)) {
$username = $this->form['std']->username;
}
$userid = 0;
$errfile = 'Authentication';
$errline = 0;
$errstr = 'Couldnt create user see variables for more info';
$variables = array('lookup' => &$lookup, 'info' => &$info, 'authentication' => &$this);
log_error($userid, $username, 'Application Warning', $errstr, $errfile, $errline, '', null, $variables, null);
}
}
if ($this->success and ($this->authPluginObj[$objid]->get_settings('dont_break_on_success') === false or $this->authPluginObj[$objid]->get_settings('dont_break_on_success') !== false and !$this->authPluginObj[$objid]->get_settings('dont_break_on_success'))) {
break;
}
}
}
$postauthobj = new stdClass();
$postauthobj->authobj = $authobj;
if (isset($this->callbackregister['postauth'])) {
foreach ($this->callbackregister['postauth'] as $number => $callback) {
$postauthobj = call_user_func_array($callback, array($postauthobj));
$objid = key($this->callbackregisterdata['postauth'][$number]);
//.........这里部分代码省略.........