本文整理汇总了PHP中error::createAccessDeniedError方法的典型用法代码示例。如果您正苦于以下问题:PHP error::createAccessDeniedError方法的具体用法?PHP error::createAccessDeniedError怎么用?PHP error::createAccessDeniedError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类error
的用法示例。
在下文中一共展示了error::createAccessDeniedError方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: access_denied_error
/**
* Create access denied error message
*
* @return Error object
*/
function access_denied_error()
{
global $ERROR;
$ERROR = new error();
$ERROR->createAccessDeniedError();
return $ERROR;
}
示例2: userLogin
/**
* Log into the site
*
* @uses $CFG
* @param string $email
* @param string $password
* @return User object if successful else Error object
*/
function userLogin($email, $password)
{
global $CFG, $ERROR;
clearSession();
/** Just in case **/
if ($password == "" || $email == "") {
$ERROR = new error();
$ERROR->createLoginFailedError();
return $ERROR;
}
$user = new User();
$user->setEmail($email);
$user = $user->getByEmail();
if ($user instanceof User) {
// make sure this user is an active user
$status = $user->getStatus();
if ($status == $CFG->USER_STATUS_ACTIVE || $status == $CFG->USER_STATUS_REPORTED) {
if (strcmp($user->getAuthType(), $CFG->AUTH_TYPE_EVHUB) == 0) {
$passwordCheck = $user->validPassword($password);
if ($passwordCheck) {
createSession($user);
$user->resetInvitationCode();
// hang over from Cohere groups code
$user->load();
return $user;
} else {
$ERROR = new error();
$ERROR->createLoginFailedError();
return $ERROR;
}
} else {
$ERROR = new error();
$provider = ucfirst($user->getAuthType());
$ERROR->createLoginFailedExternalError($provider);
return $ERROR;
}
} else {
$ERROR = new error();
if ($status == $CFG->USER_STATUS_UNAUTHORIZED) {
$ERROR->createLoginFailedUnauthorizedError();
} else {
if ($status == $CFG->USER_STATUS_SUSPENDED) {
$ERROR->createLoginFailedSuspendedError();
} else {
if ($status == $CFG->USER_STATUS_UNVALIDATED) {
$ERROR->createLoginFailedUnvalidatedError();
} else {
$ERROR->createAccessDeniedError();
}
}
}
return $ERROR;
}
} else {
$ERROR = new error();
$ERROR->createLoginFailedError();
return $ERROR;
}
}
示例3: addNodesAndConnectionsFromJsonld
/**
* Import nodes and connections from the given CIF url for the selected nodeids into the given map.
* The node import limit is set by '$CFG->ImportLimit'.
* @param url the url for the CIF data to load
* @param mapid the id of the map to get alerts for
* @param selectedids an array of the CIF node ides to import
* @param poses an array of the positions of the nodes in the map each array item is in
* the format 'x:y' and the position in the array should correspond ot the position of
* its node in the selectednodeids array.
* before it is considered out of date and should be refetched and recalculated.
* Defaults to 60 seconds.
* @param private true if the data should be created as private, else false.
* @return View object of the map or Error.
*
*/
function addNodesAndConnectionsFromJsonld($url, $mapid, $selectedids, $poses, $private)
{
global $USER, $HUB_FLM, $CFG, $ERROR;
require_once $HUB_FLM->getCodeDirPath("core/io/catalyst/catalyst_jsonld_reader.class.php");
require_once $HUB_FLM->getCodeDirPath("core/lib/url-validation.class.php");
//error_log(print_r($selectedids, true));
if (count($selectedids) > $CFG->ImportLimit) {
$ERROR = new error();
$ERROR->createAccessDeniedError();
return $ERROR;
}
//error_log(print_r($poses, true));
// Check if the map is in a group and if so get the group id.
$groupid = "";
$v = new View($mapid);
$view = $v->load();
if (!$view instanceof Error) {
if (isset($view->viewnode->groups)) {
$groups = $view->viewnode->groups;
if (count($groups) > 0) {
$groupid = $groups[0]->groupid;
}
}
} else {
return $view;
}
// make sure current user in group, if group set.
if ($groupid != "") {
$group = new Group($groupid);
if (!$group instanceof Error) {
if (!$group->ismember($USER->userid)) {
$error = new Error();
return $error->createNotInGroup($group->name);
}
}
}
$withhistory = false;
$withvotes = false;
$reader = new catalyst_jsonld_reader();
$reader = $reader->load($url, $withhistory, $withvotes);
if (!$reader instanceof Error) {
$nodeset = $reader->nodeSet;
$nodes = $nodeset->nodes;
$count = count($nodes);
$newnodeSet = new NodeSet();
$newNodeCheck = array();
for ($i = 0; $i < $count; $i++) {
$node = $nodes[$i];
$position = array_search($node->nodeid, $selectedids);
//error_log("position:".$position);
if ($position !== FALSE) {
$position = intval($position);
$positem = $poses[$position];
$positemArray = explode(":", $positem);
$xpos = "";
$ypos = "";
if (count($positemArray) == 2) {
$xpos = $positemArray[0];
$ypos = $positemArray[1];
}
//error_log("xpos:".$xpos.":ypos:".$ypos);
$role = getRoleByName($node->rolename);
$description = "";
if (isset($node->description)) {
$description = $node->description;
}
$newnode = addNode($node->name, $description, $private, $role->roleid);
//error_log(print_r($newnode, true));
if (!$newnode instanceof Error) {
$newNodeCheck[$node->nodeid] = $newnode;
//error_log($node->nodeid);
// if we have positioning information add the node to the map.
if ($xpos != "" && $ypos != "") {
$viewnode = $view->addNode($newnode->nodeid, $xpos, $ypos);
//if (!$viewnode instanceof Error) {
}
if (isset($node->homepage) && $node->homepage != "") {
$URLValidator = new mrsnk_URL_validation($node->homepage, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL);
if ($URLValidator->isValid()) {
$urlObj = addURL($node->homepage, $node->homepage, "", $private, "", "", "", "cohere", "");
$newnode->addURL($urlObj->urlid, "");
// Add url to group? - not done on forms at present
} else {
error_log('Invalid node homepage: ' . $node->homepage . ': for ' . $node->nodeid);
}
//.........这里部分代码省略.........
示例4: getConversationData
die;
}
$group = getConversationData($id);
$group->cipher = $cipher;
if (isset($unobfuscationid) && $unobfuscationid != "") {
$group->unobfuscationid = $unobfuscationid;
}
if ($len == 4) {
$subtype = check_param($parts[3], PARAM_ALPHA);
$group->filter = $subtype;
}
$response = $group;
} else {
global $ERROR;
$ERROR = new error();
$ERROR->createAccessDeniedError();
include $HUB_FLM->getCodeDirPath("core/formaterror.php");
die;
}
}
break;
default:
//error as method not defined.
global $ERROR;
$ERROR = new error();
$ERROR->createInvalidMethodError();
include $HUB_FLM->getCodeDirPath("core/formaterror.php");
die;
}
//error_log("ENDING Initial data gathering");
// finally format the output
示例5: getUsersByStatus
/**
* Get the users with the given status. For admin area.
*
* @param integer $status
* <br>$CFG->USER_STATUS_ACTIVE = live and active account
* <br>$CFG->USER_STATUS_REPORTED = user has been reported as spammer (not used at present)
* <br>$CFG->USER_STATUS_UNVALIDATED = new user account that has not had the email address verified yet.
* <br>$CFG->USER_STATUS_UNAUTHORIZED = new user account that has not been authorized yet.
* <br>$CFG->USER_STATUS_SUSPENDED = user account that has been suspended.
*
* @param integer $start (optional - default: 0)
* @param integer $max (optional - default: 20)
* @param string $orderby (optional, either 'date', 'nodeid', 'name', 'connectedness' or 'moddate' - default: 'date')
* @param string $sort (optional, either 'ASC' or 'DESC' - default: 'DESC')
* @param String $style (optional - default 'long') may be 'short' or 'long' - how much of a nodes details to load (long includes: description, tags, groups and urls).
* @return NodeSet or Error
*/
function getUsersByStatus($status = 0, $start = 0, $max = 20, $orderby = 'date', $sort = 'DESC', $style = 'long')
{
global $CFG, $USER, $HUB_SQL;
if ($USER->getIsAdmin() == "Y") {
$params = array();
$params[0] = $status;
$sql = $HUB_SQL->UTILLIB_USERS_BY_STATUS;
$us = new UserSet();
return $us->load($sql, $params, $start, $max, $orderby, $sort, $style);
} else {
$ERROR = new error();
return $ERROR->createAccessDeniedError();
}
}