本文整理汇总了PHP中exit_permission_denied函数的典型用法代码示例。如果您正苦于以下问题:PHP exit_permission_denied函数的具体用法?PHP exit_permission_denied怎么用?PHP exit_permission_denied使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exit_permission_denied函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: frs_admin_header
function frs_admin_header($params)
{
global $group_id;
/*
Are they logged in?
*/
if (!session_loggedin()) {
exit_not_logged_in();
}
$project =& group_get_object($group_id);
if (!$project || !is_object($project)) {
return;
}
$perm =& $project->getPermission(session_get_user());
if (!$perm || !is_object($perm)) {
return;
}
/*
Are they a release technician?
*/
if (!$perm->isReleaseTechnician()) {
exit_permission_denied();
}
frs_header($params);
}
示例2: PHPWikiServiceAdmin
function PHPWikiServiceAdmin($id)
{
global $LANG, $is_wiki_page;
//used so the search box will add the necessary element to the pop-up box
$is_wiki_page = 1;
$this->gid = (int) $id;
if (empty($this->gid)) {
exit_no_group();
}
if (!user_ismember($this->gid, 'W2')) {
exit_permission_denied();
}
$this->wiki = new PHPWiki($this->gid);
// If Wiki for project doesn't exist, propose creation...
if (!$this->wiki->exist()) {
header('Location: ' . PHPWIKI_PLUGIN_BASE_URL . '/index.php?group_id=' . $this->gid . '&view=install');
}
// Set language for phpWiki
if ($this->wiki->getLanguage_id()) {
define('DEFAULT_LANGUAGE', $this->wiki->getLanguage_id());
$LANG = $this->wiki->getLanguage_id();
}
}
示例3: snippet_header
function snippet_header($params)
{
global $is_snippet_page, $HTML, $feedback, $Language;
if ($GLOBALS['sys_use_snippet'] == 0) {
exit_permission_denied();
}
// LJ used so the search box will add the necessary element to the pop-up box
// Codendi Specific
$is_snippet_page = 1;
$HTML->header($params);
/*
Show horizontal links
*/
echo '<H2>' . $params['title'] . '</H2>';
echo '<P><B>';
echo '<A HREF="/snippet/">' . $Language->getText('snippet_utils', 'browse') . '</A>
| <A HREF="/snippet/submit.php">' . $Language->getText('snippet_utils', 'create_s') . '</A>
| <A HREF="/snippet/package.php">' . $Language->getText('snippet_utils', 'create_p') . '</A></B>';
if (isset($params['help']) && $params['help']) {
echo ' | ' . help_button($params['help'], false, $Language->getText('global', 'help'));
}
echo '<P>';
html_feedback_top($feedback);
}
示例4: session_require
/**
* session_require() - Convenience function to easily enforce permissions
*
* Calling page will terminate with error message if current user
* fails checks.
*
* @param array Associative array specifying criteria
* @return does not return if check is failed
*
*/
function session_require($req)
{
if (!user_isloggedin()) {
exit_not_logged_in();
//exit_permission_denied();
}
if ($req['group']) {
$group =& group_get_object($req['group']);
if (!$group || !is_object($group)) {
exit_error(_('Error'), _('Error creating group object'));
} else {
if ($group->isError()) {
exit_error(_('Error'), $group->getErrorMessage());
}
}
$perm =& $group->getPermission(session_get_user());
if (!$perm || !is_object($perm)) {
exit_error(_('Error'), _('Error creating permission object'));
} else {
if ($perm->isError()) {
exit_error(_('Error'), $perm->getErrorMessage());
}
}
if ($req['admin_flags']) {
//$query .= " AND admin_flags = '$req[admin_flags]'";
if (!$perm->isAdmin()) {
exit_permission_denied();
}
} else {
if (!$perm->isMember()) {
exit_permission_denied();
}
}
} else {
if ($req['isloggedin']) {
//no need to check as long as the check is present at top of function
} else {
exit_permission_denied();
}
}
}
示例5: checkPermissions
/**
* Check access permissions for wiki and wiki pages.
*
* Check restriction for:
* wiki: whole wiki can be restricted.
* wikipage: each page of the wiki can be restricted.
*/
function checkPermissions()
{
// Check if user can access to whole wiki
if (!$this->wiki->isAutorized(user_getid())) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_phpwiki_wikiservice', 'acces_denied_whole', session_make_url("/project/memberlist.php?group_id=" . $this->gid)), CODENDI_PURIFIER_DISABLED);
exit_permission_denied();
}
// Check if user can access to selected page
if (!empty($_REQUEST['pagename'])) {
$wp = new PHPWikiPage($this->gid, $_REQUEST['pagename']);
if (!$wp->isAutorized(user_getid())) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_phpwiki_wikiservice', 'acces_denied_page', session_make_url("/project/memberlist.php?group_id=" . $this->gid)), CODENDI_PURIFIER_DISABLED);
exit_permission_denied();
}
}
}
示例6: getIntFromRequest
return "Next {$minutetime} Minutes";
}
return "Next {$timedifference} Seconds";
}
}
//
// get the Group object
//
$group_id = getIntFromRequest('group_id');
$group =& group_get_object($group_id);
if (!$group || !is_object($group)) {
exit_no_group();
}
if ($group->isError()) {
if ($group->isPermissionDeniedError()) {
exit_permission_denied($group->getErrorMessage());
} else {
exit_error(_('Error'), $group->getErrorMessage());
}
}
if (!$group_id && $form_grp) {
$group_id = $form_grp;
}
site_project_header(array('title' => _('Project Member List'), 'group' => $group_id, 'toptab' => 'memberlist'));
echo _('<p>If you would like to contribute to this project by becoming a developer, contact one of the project admins, designated in bold text below.</p>');
$title_arr = array();
$title_arr[] = _('Developer');
$title_arr[] = _('Summary');
$title_arr[] = _('Open Date');
$title_arr[] = _('Last Modified');
echo $GLOBALS['HTML']->listTableTop($title_arr);
示例7: cancelChangeAndUserLdap
/**
* Hook
*/
function cancelChangeAndUserLdap($params)
{
$um = UserManager::instance();
$user = $um->getCurrentUser();
if ($GLOBALS['sys_auth_type'] == 'ldap' && $user->getLdapId() != '') {
if (!$this->hasLDAPWrite()) {
exit_permission_denied();
}
}
}
示例8: ExecuteAction
/**
* ExecuteAction - Executes the action passed as parameter
*
* @param string action to execute.
*/
function ExecuteAction($action)
{
global $HTML;
if ($action == "change_status") {
//change a forum
$forum_name = getStringFromRequest('forum_name');
$description = getStringFromRequest('description');
$send_all_posts_to = getStringFromRequest('send_all_posts_to');
$allow_anonymous = getIntFromRequest('allow_anonymous');
$is_public = getIntFromRequest('is_public');
$moderation_level = getIntFromRequest('moderation_level');
$group_forum_id = getIntFromRequest('group_forum_id');
/*
Change a forum
*/
$f = new Forum($this->g, $group_forum_id);
if (!$f || !is_object($f)) {
exit_error(_('Error'), _('Error getting Forum'));
} elseif ($f->isError()) {
exit_error(_('Error'), $f->getErrorMessage());
}
if (!$f->userIsAdmin()) {
exit_permission_denied();
}
if (!$f->update($forum_name, $description, $allow_anonymous, $is_public, $send_all_posts_to, $moderation_level)) {
exit_error(_('Error'), $f->getErrorMessage());
} else {
$feedback = _('Forum Info Updated Successfully');
}
return $feedback;
}
if ($action == "add_forum") {
//add forum
$forum_name = getStringFromRequest('forum_name');
$description = getStringFromRequest('description');
$is_public = getStringFromRequest('is_public');
$send_all_posts_to = getStringFromRequest('send_all_posts_to');
$allow_anonymous = getStringFromRequest('allow_anonymous');
$moderation_level = getIntFromRequest('moderation_level');
/*
Adding forums to this group
*/
if (!$this->p->isForumAdmin()) {
form_release_key(getStringFromRequest("form_key"));
exit_permission_denied();
}
$f = new Forum($this->g);
if (!$f || !is_object($f)) {
form_release_key(getStringFromRequest("form_key"));
exit_error(_('Error'), _('Error getting Forum'));
} elseif ($f->isError()) {
form_release_key(getStringFromRequest("form_key"));
exit_error(_('Error'), $f->getErrorMessage());
}
if (!$f->create($forum_name, $description, $is_public, $send_all_posts_to, 1, $allow_anonymous, $moderation_level)) {
form_release_key(getStringFromRequest("form_key"));
exit_error(_('Error'), $f->getErrorMessage());
} else {
$feedback = _('Forum created successfully');
}
return $feedback;
}
if ($action == "delete") {
//Deleting messages or threads
$msg_id = getStringFromRequest('deletemsg');
$forum_id = getIntFromRequest('forum_id');
$f = new Forum($this->g, $forum_id);
if (!$f || !is_object($f)) {
exit_error(_('Error'), _('Error getting Forum'));
} elseif ($f->isError()) {
exit_error(_('Error'), $f->getErrorMessage());
}
if (!$f->userIsAdmin()) {
exit_permission_denied();
}
$fm = new ForumMessage($f, $msg_id);
if (!$fm || !is_object($fm)) {
exit_error(_('Error'), _('Error Getting ForumMessage'));
} elseif ($fm->isError()) {
exit_error(_('Error'), $fm->getErrorMessage());
}
$count = $fm->delete();
if (!$count || $fm->isError()) {
exit_error(_('Error'), $fm->getErrorMessage());
} else {
$feedback = sprintf(ngettext('%1$s message deleted', '%1$s messages deleted', $count), $count);
}
return $feedback;
}
if ($action == "delete_forum") {
//delete the forum
/*
Deleting entire forum
*/
$group_forum_id = getIntFromRequest('group_forum_id');
//.........这里部分代码省略.........
示例9: session_require
/**
*
* Method of easily enforcing permissions
* Page will terminate with error message if you fail checks
*
*/
function session_require($req)
{
if (!user_isloggedin()) {
exit_permission_denied();
}
/*
SF Admins always have permission
*/
if (user_is_super_user()) {
return true;
}
if ($req['group']) {
$group =& group_get_object($req['group']);
if (!$group) {
exit_no_group();
}
if ($req['admin_flags']) {
//$query .= " AND admin_flags = '$req[admin_flags]'";
if (!$group->userIsAdmin()) {
exit_permission_denied();
}
} else {
if (!$group->userIsMember()) {
exit_permission_denied();
}
}
} else {
if ($req['isloggedin']) {
//no need to check as long as the check is present at top of function
} else {
exit_permission_denied();
}
}
}
示例10: session_require
/**
* session_require() - Convenience function to easily enforce permissions
*
* Calling page will terminate with error message if current user
* fails checks.
*
* @param array Associative array specifying criteria
* @return does not return if check is failed
*
*/
function session_require($req)
{
if (!session_loggedin()) {
exit_not_logged_in();
}
if ($req['group']) {
$group =& group_get_object($req['group']);
if (!$group || !is_object($group)) {
exit_error('Error', 'Could Not Get Group');
} elseif ($group->isError()) {
exit_error('Error', $group->getErrorMessage());
}
$perm =& $group->getPermission(session_get_user());
if (!$perm || !is_object($perm) || $perm->isError()) {
exit_permission_denied();
}
//don't really like this, but as admin_flags is not mandatory
//I add @ to remove the warning
if (@$req['admin_flags']) {
if (!$perm->isAdmin()) {
exit_permission_denied();
}
} else {
if (!$perm->isMember()) {
exit_permission_denied();
}
}
} else {
if ($req['isloggedin']) {
//no need to check as long as the check is present at top of function
} else {
exit_permission_denied();
}
}
}
示例11: exit_no_group
//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
// $Id: submit.php,v 1.3 2004/01/13 13:15:24 helix Exp $
require 'pre.php';
require '../forum/forum_utils.php';
if (user_isloggedin()) {
//news must now be submitted from a project page -
if (!$group_id) {
exit_no_group();
}
if (!user_ismember($group_id, 'A')) {
exit_permission_denied('You cannot submit news ' . 'for a project unless you are an admin on that project');
}
if ($post_changes) {
//check to make sure both fields are there
if ($summary && $details) {
/*
Insert the row into the db if it's a generic message
OR this person is an admin for the group involved
*/
/*
create a new discussion forum without a default msg
if one isn't already there
*/
$new_id = forum_create_forum($sys_news_group, $summary, 1, 0);
$sql = "INSERT INTO news_bytes (group_id,submitted_by,is_approved,date,forum_id,summary,details) " . " VALUES ('{$group_id}','" . user_getid() . "','0','" . time() . "','{$new_id}','" . htmlspecialchars($summary) . "','" . htmlspecialchars($details) . "')";
$result = db_query($sql);
示例12: getIntFromRequest
*/
require_once '../env.inc.php';
require_once $gfwww . 'include/pre.php';
require_once $gfwww . 'include/note.php';
require_once $gfwww . 'news/news_utils.php';
require_once $gfcommon . 'forum/Forum.class.php';
require_once $gfcommon . 'include/TextSanitizer.class.php';
// to make the HTML input by the user safe to store
$group_id = getIntFromRequest('group_id');
if (session_loggedin()) {
if (!user_ismember($group_id, 'A')) {
exit_permission_denied(_('You cannot submit news for a project unless you are an admin on that project'));
}
$group_id = getIntFromRequest('group_id');
if ($group_id == $sys_news_group) {
exit_permission_denied(_('Submitting news from the news group is not allowed.'));
}
if (getStringFromRequest('post_changes')) {
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
exit_form_double_submit();
}
$summary = getStringFromRequest('summary');
$details = getStringFromRequest('details');
//check to make sure both fields are there
if ($summary && $details) {
/*
Insert the row into the db if it's a generic message
OR this person is an admin for the group involved
*/
/*
create a new discussion forum without a default msg
示例13: project_admin_header
function project_admin_header($params)
{
global $group_id, $feedback, $HTML;
$params['toptab'] = 'admin';
$params['group'] = $group_id;
$project =& group_get_object($group_id);
if (!$project || !is_object($project)) {
return;
}
$perm =& $project->getPermission(session_get_user());
if (!$perm || !is_object($perm)) {
return;
}
/*
Enforce Project Admin Perms
*/
if (!$perm->isAdmin()) {
exit_permission_denied();
}
site_project_header($params);
$labels = array();
$links = array();
//$labels[] = _('Admin');
$labels[] = _('Edit Public Info');
$labels[] = _('Project History');
if ($GLOBALS['sys_use_people']) {
$labels[] = _('Post Jobs');
$labels[] = _('Edit Jobs');
}
if ($GLOBALS['sys_use_project_multimedia']) {
$labels[] = _('Edit Multimedia Data');
}
if ($GLOBALS['sys_use_project_vhost']) {
$labels[] = _('VHOSTs');
}
if ($GLOBALS['sys_use_project_database']) {
$labels[] = _('Database Admin');
}
$labels[] = _('Stats');
plugin_hook("quota_label_project_admin");
//$links[] = '/project/admin/?group_id='.$group_id;
$links[] = '/project/admin/editgroupinfo.php?group_id=' . $group_id;
$links[] = '/project/admin/history.php?group_id=' . $group_id;
if ($GLOBALS['sys_use_people']) {
$links[] = '/people/createjob.php?group_id=' . $group_id;
$links[] = '/people/?group_id=' . $group_id;
}
if ($GLOBALS['sys_use_project_multimedia']) {
$links[] = '/project/admin/editimages.php?group_id=' . $group_id;
}
if ($GLOBALS['sys_use_project_vhost']) {
$links[] = '/project/admin/vhost.php?group_id=' . $group_id;
}
if ($GLOBALS['sys_use_project_database']) {
$links[] = '/project/admin/database.php?group_id=' . $group_id;
}
$links[] = '/project/stats/?group_id=' . $group_id;
plugin_hook("quota_link_project_admin");
echo $HTML->beginSubMenu();
echo $HTML->printSubMenu($labels, $links);
plugin_hook("groupadminmenu", $params);
echo $HTML->endSubMenu();
}
示例14: updateArtifact
function updateArtifact($row, $data, $aid, &$errors, $notify = false)
{
global $Language;
$ah = new Tracker_Html($this->ath, $aid);
if (!$ah || !is_object($ah)) {
exit_error($Language->getText('global', 'error'), $Language->getText('plugin_tracker_index', 'not_create_art'));
} else {
if ($ah->isError()) {
exit_error($Language->getText('global', 'error'), $ah->getErrorMessage());
} else {
// Check if users can update anonymously
if (!user_isloggedin() && !$this->ath->allowsAnon()) {
exit_not_logged_in();
}
if (!$ah->Tracker->userIsAdmin()) {
exit_permission_denied();
return;
}
$vfl = $this->prepareVfl($data, $artifact_depend_id, $add_cc, $cc_comment, $comments);
//data control layer
if (!$ah->handleUpdate($artifact_depend_id, 100, $changes, false, $vfl, true)) {
exit_error($Language->getText('global', 'error'), '');
}
if ($add_cc) {
if (!$ah->updateCC($add_cc, $cc_comment)) {
$errors .= $Language->getText('plugin_tracker_import_utils', 'problem_add_cc', $ah->getID()) . " ";
}
}
$comments_ok = false;
if ($comments) {
if ($this->parseFollowUpComments($comments, $parsed_comments, $aid) && $parsed_comments && !empty($parsed_comments)) {
$comments_ok = true;
if (!$ah->addFollowUpComments($parsed_comments)) {
$errors .= $Language->getText('plugin_tracker_import_utils', 'problem_insert_followup', $ah->getID()) . " ";
$comments_ok = false;
return false;
}
} else {
return false;
}
}
if ($notify && (count($changes) > 0 || $add_cc || $comments_ok)) {
$agnf = new Tracker_NotificationsManager($this->ath);
$ah->mailFollowupWithPermissions($agnf->getAllAddresses($this->ath->getID(), $update = true), $changes);
}
if (count($changes) > 0 || $add_cc || $comments_ok) {
// Update the 'last_update_date' artifact field
$res_last_up = $ah->update_last_update_date();
}
}
}
return true;
}
示例15: handleUpdate
/**
* Update an artifact. Rk: vfl is an variable list of fields, Vary from one project to another
* return true if artifact updated, false if nothing changed or DB update failed
*
* @param artifact_id_dependent: artifact dependencies
* @param canned_response: canned responses
* @param changes (OUT): array of changes (for notifications)
*
* @return boolean
*/
function handleUpdate($artifact_id_dependent, $canned_response, &$changes, $masschange = false, $vfl = false, $import = false)
{
global $art_field_fact, $HTTP_POST_VARS, $Language;
if ($masschange && !$this->ArtifactType->userIsAdmin()) {
exit_permission_denied();
}
if (!$import) {
// Retrieve HTTP GET variables and store them in $vfl array
$vfl = $art_field_fact->extractFieldList();
// make sure required fields are not empty
if ($art_field_fact->checkEmptyFields($vfl) == false) {
exit_missing_param();
}
}
//get this artifact from the db
$result = $this->getFieldsValues();
//
// See which fields changed during the modification
// and if we must keep history then do it. Also add them to the update
// statement
//
$reference_manager =& ReferenceManager::instance();
$text_value_list = array();
$changes = array();
$upd_list = '';
reset($vfl);
while (list($field_name, $value) = each($vfl)) {
$field = $art_field_fact->getFieldFromName($field_name);
// skip over special fields except for details which in this
// particular case can be processed normally
if ($field->isSpecial()) {
continue;
}
if ($field->isInt() && $value == '' && $field->getRequired() == 0) {
$value = 0;
}
// we check if the given value is authorized for this field (for select box fields only)
// we don't check here the none value, we have already check it before (we can't check here the none value because the function checkValueInPredefinedValues don't take the none value into account)
// if the value did not change, we don't do the check (because of stored values that can be deleted now)
if (!$masschange && $result[$field_name] != $value && $field->isSelectBox() && $value != 100 && !$field->checkValueInPredefinedValues($this->ArtifactType->getID(), $value)) {
$this->setError($Language->getText('tracker_common_artifact', 'bad_field_value', array($field->getLabel(), $value)));
return false;
}
if (!$masschange && $field->isMultiSelectBox()) {
if (is_array($value)) {
foreach ($value as $a_value) {
if ($a_value != 100 && !$field->checkValueInPredefinedValues($this->ArtifactType->getID(), $a_value)) {
$this->setError($Language->getText('tracker_common_artifact', 'bad_field_value', array($field->getLabel(), $value)));
return false;
}
}
}
}
$is_text = $field->isTextField() || $field->isTextArea();
if ($field->isMultiSelectBox() && is_array($value)) {
if ($masschange && in_array($Language->getText('global', 'unchanged'), $value)) {
continue;
}
// The field is a multi values field and it has multi assigned values
$values = $value;
// check if the user can update the field or not
if (!$field->userCanUpdate($this->ArtifactType->getGroupID(), $this->ArtifactType->getID(), user_getid())) {
// we only throw an error if the values has changed
$old_values = $field->getValues($this->getID());
list($deleted_values, $added_values) = util_double_diff_array($old_values, $values);
if (count($deleted_values) > 0 || count($added_values) > 0) {
// The user does not have the permissions to update the current field,
// we exit the function with an error message
$this->setError($Language->getText('tracker_common_artifact', 'bad_field_permission_update', $field->getLabel()));
return false;
}
}
//don't take into account the none value if there are several values selected
if (count($values) > 1) {
$temp = array();
while (list($i, $v) = each($values)) {
if ($v == 100) {
unset($values[$i]);
$unset = true;
} else {
$temp[] = $v;
}
}
if (isset($unset) && $unset) {
$values = $temp;
}
}
$old_values = $field->getValues($this->getID());
list($deleted_values, $added_values) = util_double_diff_array($old_values, $values);
// Check if there are some differences
//.........这里部分代码省略.........