本文整理汇总了PHP中canEdit函数的典型用法代码示例。如果您正苦于以下问题:PHP canEdit函数的具体用法?PHP canEdit怎么用?PHP canEdit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了canEdit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->field_id && canEdit('system')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if (0 == $this->field_id && canEdit('system')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
return $stored;
}
示例2: listACLsByPath
function listACLsByPath($pathname)
{
$me = $_SERVER["PHP_SELF"];
if (!canEdit($pathname)) {
echo "Ihnen fehlt leider die Berechtigung, das Verzeichnis {$pathname} zu bearbeiten";
return false;
}
// Verzeichnisobjekt holen
$path = new Path();
if (!$path->selectByName($pathname)) {
fehlerausgabe("Das Verzeichnis {$pathname} konnte nicht aus der DB gewählt werden");
return false;
}
// ACLs fuer das Verzeichnis holen
$acllist = new ACLList();
if (!$acllist->selectByPath($pathname)) {
fehlerausgabe("Die zum Verzeichnis {$pathname} gehörigen ACLs konnten nicht aus der DB gewählt werden");
return false;
}
echo "ACLs für Pfad {$pathname}:";
echo <<<EOF
<form name="acleditor" method="post" action="{$me}">
<select name="cmd">
<option value="edit">Eine ACL bearbeiten</option>
<option value="del">Löschen</option>
</select>
<input type="hidden" name="pathname" value="{$pathname}" />
<input type="submit" value="Los" />
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed">
<tr>
<td>User</td>
<td>Löschen</td>
<td>Schreiben</td>
<td>Lesen</td>
<td>Umbenennen</td>
</tr>
EOF;
$user = new User();
for ($i = 0; $i < count($acllist->list); $i++) {
$acl = $acllist->list[$i];
$user->selectByID($acl->user_id);
echo <<<EOF
<tr>
<td><input type="checkbox" name="aclid[]" value="{$acl->acl_id}" />{$user->loginname}</td>
<td>{$acl->delete_path}</td>
<td>{$acl->write_path}</td>
<td>{$acl->read_path}</td>
<td>{$acl->rename_path}</td>
</tr>
EOF;
}
echo <<<EOF
</table>
</form>
EOF;
return true;
}
示例3: process
public function process(\w2p_Core_CAppUI $AppUI, array $myArray)
{
if (!canEdit('users')) {
$this->resultPath = ACCESS_DENIED;
return $AppUI;
}
$action = $this->delete ? 'deleted' : 'stored';
$this->success = $this->delete ? $this->object->del_acl((int) $myArray['permission_id']) : $this->object->addUserPermission();
if ($this->success) {
$AppUI->setMsg($this->prefix . ' ' . $action, UI_MSG_OK, true);
$this->resultPath = $this->successPath;
$this->object->recalcPermissions(null, (int) $myArray['permission_user']);
} else {
$AppUI->setMsg($this->object->getError(), UI_MSG_ERROR);
$this->resultPath = $this->errorPath;
$AppUI->holdObject($this->object);
}
return $AppUI;
}
示例4: array
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
if (!canEdit('System')) {
$view = "error";
return;
}
$options = array("go" => $SLANG['DonateYes'], "hour" => $SLANG['DonateRemindHour'], "day" => $SLANG['DonateRemindDay'], "week" => $SLANG['DonateRemindWeek'], "month" => $SLANG['DonateRemindMonth'], "never" => $SLANG['DonateRemindNever'], "already" => $SLANG['DonateAlready']);
$focusWindow = true;
xhtmlHeaders(__FILE__, $SLANG['Donate']);
?>
<body>
<div id="page">
<div id="header">
<h2><?php
echo $SLANG['Donate'];
?>
</h2>
<h1>ZoneMinder - <?php
示例5: canUserEditTimeInformation
public function canUserEditTimeInformation()
{
global $AppUI;
$project = new CProject();
$project->load($this->task_project);
// Code to see if the current user is
// enabled to change time information related to task
$can_edit_time_information = false;
// Let's see if all users are able to edit task time information
if (w2PgetConfig('restrict_task_time_editing') == true && $this->task_id > 0) {
// Am I the task owner?
if ($this->task_owner == $AppUI->user_id) {
$can_edit_time_information = true;
}
// Am I the project owner?
if ($project->project_owner == $AppUI->user_id) {
$can_edit_time_information = true;
}
// Am I sys admin?
if (canEdit('admin')) {
$can_edit_time_information = true;
}
} else {
if (w2PgetConfig('restrict_task_time_editing') == false || $this->task_id == 0) {
// If all users are able, then don't check anything
$can_edit_time_information = true;
}
}
return $can_edit_time_information;
}
示例6: die
<?php
/* $Id: billingcode.php 2016 2011-08-07 07:08:46Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/system/billingcode.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
##
## add or edit a user preferences
##
$company_id = 0;
$company_id = isset($_REQUEST['company_id']) ? w2PgetParam($_REQUEST, 'company_id', 0) : 0;
// Check permissions
$perms =& $AppUI->acl();
if (!canEdit('system')) {
$AppUI->redirect('m=public&a=access_denied');
}
$q = new w2p_Database_Query();
$q->addTable('billingcode', 'bc');
$q->addQuery('billingcode_id, billingcode_name, billingcode_value, billingcode_desc, billingcode_status');
$q->addOrder('billingcode_name ASC');
$q->addWhere('company_id = ' . (int) $company_id);
$billingcodes = $q->loadList();
$q->clear();
$q = new w2p_Database_Query();
$q->addTable('companies', 'c');
$q->addQuery('company_id, company_name');
$q->addOrder('company_name ASC');
$company_list = $q->loadHashList();
$company_list[0] = $AppUI->_('Select Company');
$q->clear();
$company_name = $company_list[$company_id];
示例7: sprintf
$dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $frame['FrameId']);
$rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $frame['FrameId']);
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Frame') . " - " . $event['Id'] . " - " . $frame['FrameId']);
?>
<body>
<div id="page">
<div id="header">
<div id="headerButtons">
<?php
if (ZM_RECORD_EVENT_STATS && $alarmFrame) {
echo makePopupLink('?view=stats&eid=' . $event['Id'] . '&fid=' . $frame['FrameId'], 'zmStats', 'stats', translate('Stats'));
}
?>
<?php
if (canEdit('Events')) {
?>
<a href="?view=none&action=delete&markEid=<?php
echo $event['Id'];
?>
"><?php
echo translate('Delete');
?>
</a><?php
}
?>
<a href="#" onclick="closeWindow(); return( false );"><?php
echo translate('Close');
?>
</a>
</div>
示例8: die
<?php
/* $Id: chpwd.php 1971 2011-07-04 04:31:39Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/public/chpwd.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
if (!($user_id = w2PgetParam($_REQUEST, 'user_id', 0))) {
$user_id = $AppUI->user_id;
}
// check for a non-zero user id
if ($user_id) {
$old_pwd = db_escape(trim(w2PgetParam($_POST, 'old_pwd', null)));
$new_pwd1 = db_escape(trim(w2PgetParam($_POST, 'new_pwd1', null)));
$new_pwd2 = db_escape(trim(w2PgetParam($_POST, 'new_pwd2', null)));
$perms =& $AppUI->acl();
$canAdminEdit = canEdit('admin');
// has the change form been posted
if ($new_pwd1 && $new_pwd2 && $new_pwd1 == $new_pwd2) {
$user = new CUser();
if ($canAdminEdit || $user->validatePassword($user_id, $old_pwd)) {
$user->user_id = $user_id;
$user->user_password = $new_pwd1;
if ($msg = $user->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
?>
<script language="javascript" type="text/javascript">
window.onload = function() {
window.close();
}
</script>
<?php
示例9: GetVarClass
<?php
include "../include/config.php";
$post_get = new GetVarClass();
$email = $post_get->getemail("email");
if (!$email) {
die("Редактирование заявки невозможно: введите корректный e-mail. ");
}
$editorid = loginbycookie();
if (!canEdit($editorid, $email)) {
die("У вас недостаточно прав доступа, чтобы редактировать заявку {$email}. ");
}
$userid = emailToId($email);
$name = $post_get->getvar("name");
$nick = $post_get->getvar("nick");
$city = $post_get->getvar("city");
$age = $post_get->getadate("age");
$contacts = $post_get->getvar("contacts");
$contraindication = $post_get->getvar("contraindication");
$chronicdesease = $post_get->getvar("chronicdesease");
$wishes = $post_get->getvar("wishes");
$publicity = $post_get->getenumkeys("publicity", $langPublicities);
$character_name = $post_get->getvar("character_name");
$character_age = $post_get->getadate("character_age");
$country = $post_get->getenumkeys("country", $langCountries);
$birth = $post_get->getenumkeys("birth", $langBirthes);
$rank = $post_get->getenumkeys("rank", $langRanks);
$quota = $post_get->getenumkeys("quota", $langQuotas);
$quenta = $post_get->getvar("quenta");
$wishes2 = $post_get->getvar("wishes2");
$go_royal_wedding = $post_get->getvar("go_royal_wedding", "0|1", "0");
示例10: translate
</option>
<?php
}
}
?>
</select>
</td>
</tr>
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?php
echo translate('Save');
?>
"<?php
if (!canEdit('Groups')) {
?>
disabled="disabled"<?php
}
?>
/>
<input type="button" value="<?php
echo translate('Cancel');
?>
" onclick="closeWindow()"/>
</div>
</form>
</div>
</div>
</body>
</html>
示例11: translate
echo translate('Submit');
?>
" onclick="submitToEvents( this );"/>
<input type="button" name="executeButton" id="executeButton" value="<?php
echo translate('Execute');
?>
" onclick="executeFilter( this );"/>
<?php
if (canEdit('Events')) {
?>
<input type="button" value="<?php
echo translate('Save');
?>
" onclick="saveFilter( this );"/><?php
}
if (canEdit('Events') && isset($dbFilter)) {
?>
<input type="button" value="<?php
echo translate('Delete');
?>
" onclick="deleteFilter( this, '<?php
echo $dbFilter['Name'];
?>
' );"/><?php
}
?>
<input type="button" value="<?php
echo translate('Reset');
?>
" onclick="submitToFilter( this, 1 );"/>
</div>
示例12: elseif
$userid = $AppUI->user_id;
$perms =& $AppUI->acl();
if ($action == 'add') {
if (!canAdd('history')) {
$AppUI->redirect('m=public&a=access_denied');
}
$q->addTable('history');
$q->addInsert('history_table', "history");
$q->addInsert('history_action', "add");
$q->addInsert('history_date', "'" . $q->dbfnNowWithTZ() . "'");
$q->addInsert('history_description', $history_description);
$q->addInsert('history_user', $userid);
$q->addInsert('history_project', $history_project);
$okMsg = 'History added';
} elseif ($action == 'update') {
if (!canEdit('history')) {
$AppUI->redirect('m=public&a=access_denied');
}
$q->addTable('history');
$q->addUpdate('history_description', $history_description);
$q->addUpdate('history_project', $history_project);
$q->addWhere('history_id =' . $history_id);
$okMsg = 'History updated';
} elseif ($action == 'del') {
if (!canDelete('history')) {
$AppUI->redirect('m=public&a=access_denied');
}
$q->setDelete('history');
$q->addWhere('history_id =' . $history_id);
$okMsg = 'History deleted';
}
示例13: die
<?php
/* $Id: view.php 1923 2011-05-10 06:02:37Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/departments/view.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $department, $min_view;
$dept_id = (int) w2PgetParam($_GET, 'dept_id', 0);
$tab = $AppUI->processIntState('DeptVwTab', $_GET, 'tab', 0);
// check permissions
$canRead = canView($m, $dept_id);
$canEdit = canEdit($m, $dept_id);
if (!$canRead) {
$AppUI->redirect('m=public&a=access_denied');
}
$department = new CDepartment();
$department->loadFull($AppUI, $dept_id);
if (!$department) {
$AppUI->setMsg('Department');
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
$AppUI->redirect();
} else {
$AppUI->savePlace();
}
$countries = w2PgetSysVal('GlobalCountries');
$types = w2PgetSysVal('DepartmentType');
$titleBlock = new CTitleBlock('View Department', 'departments.png', $m, $m . '.' . $a);
if ($canEdit) {
$titleBlock->addCell();
$titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new department') . '">', '', '<form action="?m=departments&a=addedit&company_id=' . $department->dept_company . '&dept_parent=' . $dept_id . '" method="post" accept-charset="utf-8">', '</form>');
}
示例14: array
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
if (!canEdit('Monitors')) {
$view = "error";
return;
}
$cameras = array();
$cameras[0] = translate('ChooseDetectedCamera');
if (ZM_HAS_V4L2) {
// Probe Local Cameras
//
$command = getZmuCommand(" --query --device");
if (!empty($_REQUEST['device'])) {
$command .= "=" . escapeshellarg($_REQUEST['device']);
}
$result = exec(escapeshellcmd($command), $output, $status);
if ($status) {
Fatal("Unable to probe local cameras, status is '{$status}'");
示例15: setlocale
* run for example the file module/directory1/directory2/file.php
* Also it won't be possible to run modules/module/abc.zyz.class.php for that dots are
* not allowed in the request parameters.
*/
$u = $AppUI->checkFileName(w2PgetCleanParam($_GET, 'u', ''));
// load module based locale settings
@(include_once W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/locales.php');
include_once W2P_BASE_DIR . '/locales/core.php';
setlocale(LC_TIME, $AppUI->user_lang);
$m_config = w2PgetConfig($m);
// TODO: canRead/Edit assignements should be moved into each file
// check overall module permissions
// these can be further modified by the included action files
$canAccess = canAccess($m);
$canRead = canView($m);
$canEdit = canEdit($m);
$canAuthor = canAdd($m);
$canDelete = canDelete($m);
if (!$suppressHeaders) {
// output the character set header
if (isset($locale_char_set)) {
header('Content-type: text/html;charset=' . $locale_char_set);
}
}
// include the module class file - we use file_exists instead of @ so
// that any parse errors in the file are reported, rather than errors
// further down the track.
$modclass = $AppUI->getModuleClass($m);
if (file_exists($modclass)) {
include_once $modclass;
}