本文整理汇总了PHP中canAdd函数的典型用法代码示例。如果您正苦于以下问题:PHP canAdd函数的具体用法?PHP canAdd怎么用?PHP canAdd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了canAdd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canCreate
public function canCreate()
{
return canAdd('system');
}
示例2: arraySelect
if (canAdd('companies')) {
$newItem['companies'] = 'Company';
}
if (canAdd('contacts')) {
$newItem['contacts'] = 'Contact';
}
if (canAdd('calendar')) {
$newItem['calendar'] = 'Event';
}
if (canAdd('files')) {
$newItem['files'] = 'File';
}
if (canAdd('projects')) {
$newItem['projects'] = 'Project';
}
if (canAdd('admin')) {
$newItem['admin'] = 'User';
}
echo arraySelect($newItem, 'm', 'style="font-size:10px" onchange="f=document.frm_new;mod=f.m.options[f.m.selectedIndex].value;if (mod == \'admin\') document.frm_new.a.value=\'addedituser\';if(mod) f.submit();"', '', true);
}
?>
</td>
</tr>
<tr>
<td colspan="2" valign="top" style="background: url(style/<?php
echo $uistyle;
?>
/images/nav_shadow.jpg);" align="left">
<img width="1" height="13" border="0" src="./style/<?php
echo $uistyle;
?>
示例3: setlocale
* 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;
}
if ($u && file_exists(W2P_BASE_DIR . '/modules/' . $m . '/' . $u . '/' . $u . '.class.php')) {
示例4: CContact
$contact = new CContact();
if (!$contact->bind($_POST)) {
$AppUI->setMsg($contact->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
$action = $del ? 'deleted' : 'stored';
$contact_id = (int) w2PgetParam($_POST, 'contact_id', 0);
$user_id = (int) w2PgetParam($_POST, 'user_id', 0);
$isNewUser = !$user_id;
$perms =& $AppUI->acl();
if ($del) {
} elseif ($isNewUser) {
if (!canAdd('admin')) {
$AppUI->redirect('m=public&a=access_denied');
}
if (!canAdd('users')) {
$AppUI->redirect('m=public&a=access_denied');
}
} else {
if ($user_id != $AppUI->user_id) {
if (!canEdit('admin')) {
$AppUI->redirect('m=public&a=access_denied');
}
if (!canEdit('users')) {
$AppUI->redirect('m=public&a=access_denied');
}
}
}
$obj->user_username = strtolower($obj->user_username);
// !User's contact information not deleted - left for history.
if ($del) {
示例5: die
<?php
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
// Add / Edit Company
$dept_id = (int) w2PgetParam($_GET, 'dept_id', 0);
$company_id = (int) w2PgetParam($_GET, 'company_id', 0);
// check permissions for this record
$perms =& $AppUI->acl();
$canAuthor = canAdd('departments');
$canEdit = $perms->checkModuleItem('departments', 'edit', $dept_id);
// check permissions
if (!$canAuthor && !$dept_id) {
$AppUI->redirect('m=public&a=access_denied');
}
if (!$canEdit && $dept_id) {
$AppUI->redirect('m=public&a=access_denied');
}
// load the department types
$types = w2PgetSysVal('DepartmentType');
$countries = array('' => $AppUI->_('(Select a Country)')) + w2PgetSysVal('GlobalCountriesPreferred') + array('-' => '----') + w2PgetSysVal('GlobalCountries');
// load the record data
$department = new CDepartment();
$obj = $AppUI->restoreObject();
if ($obj) {
$department = $obj;
$dept_id = $department->dept_id;
} else {
$department->loadFull($AppUI, $dept_id);
示例6: die
<?php
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$obj = new CResource();
$resource_id = w2PgetParam($_GET, 'resource_id', 0);
$perms =& $AppUI->acl();
$canView = $perms->checkModuleItem('resources', 'view', $resource_id);
$canEdit = $perms->checkModuleItem('resources', 'edit', $resource_id);
$canDelete = $perms->checkModuleItem('resources', 'delete', $resource_id);
$canAdd = canAdd('resources');
if (!$canView) {
$AppUI->redirect('m=public&a=access_denied');
}
if (!$resource_id) {
$AppUI->setMsg('invalid ID', UI_MSG_ERROR);
$AppUI->redirect();
}
// TODO: tab stuff
$obj = new CResource();
if (!$obj->load($resource_id)) {
$AppUI->setMsg('Resource');
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
$AppUI->redirect();
} else {
$AppUI->savePlace();
}
$titleBlock = new CTitleBlock('View Resource', 'resources.png', $m, $m . '.' . $a);
if ($canAdd) {
示例7: die
<?php
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$canAuthor = canAdd('projects');
if (!$canAuthor) {
$AppUI->redirect("m=public&a=access_denied");
}
$AppUI->savePlace();
$tab = 0;
$AppUI->setState("msimportIdxTab", $tab);
$titleBlock = new CTitleBlock('importers', 'projectimporter.png', $m, "{$m}.{$a}");
$titleBlock->show();
echo $AppUI->_('msinfo');
$tabBox = new CTabBox("?m={$m}", W2P_BASE_DIR . "/modules/{$m}/", $tab);
$tabBox->add('vw_idx_import', $AppUI->_('Import'));
$tabBox->show();
示例8: elseif
$notifyContacts = $notifyContacts != '0' ? '1' : '0';
$perms =& $AppUI->acl();
if ($del) {
if (!$perms->checkModuleItem('files', 'delete', $file_id)) {
$AppUI->redirect(ACCESS_DENIED);
}
} elseif ($cancel) {
if (!$perms->checkModuleItem('files', 'delete', $file_id)) {
$AppUI->redirect(ACCESS_DENIED);
}
} elseif ($isNotNew) {
if (!$perms->checkModuleItem('files', 'edit', $file_id)) {
$AppUI->redirect(ACCESS_DENIED);
}
} else {
if (!canAdd('files')) {
$AppUI->redirect(ACCESS_DENIED);
}
}
if ($file_id) {
$obj->_message = 'updated';
$oldObj = new CFile();
$oldObj->load($file_id);
} else {
$obj->_message = 'added';
}
$obj->file_category = (int) w2PgetParam($_POST, 'file_category', 0);
$version = w2PgetParam($_POST, 'file_version', 0);
$revision_type = w2PgetParam($_POST, 'revision_type', 0);
if (strcasecmp('major', $revision_type) == 0) {
$major_num = strtok($version, '.') + 1;
示例9: die
/* $Id: addedit.php 1926 2011-05-10 06:03:08Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/contacts/addedit.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$contact_id = (int) w2PgetParam($_GET, 'contact_id', 0);
$company_id = (int) w2PgetParam($_GET, 'company_id', $AppUI->user_company);
$dept_id = (int) w2PgetParam($_GET, 'dept_id', 0);
$company = new CCompany();
$company->load($company_id);
$company_name = $company->company_name;
$dept = new CDepartment();
$dept->load($dept_id);
$dept_name = $dept->dept_name;
// check permissions for this record
$perms =& $AppUI->acl();
$canAuthor = canAdd('contacts');
$canEdit = $perms->checkModuleItem('contacts', 'edit', $contact_id);
// check permissions
if (!$canAuthor && !$contact_id) {
$AppUI->redirect('m=public&a=access_denied');
}
if (!$canEdit && $contact_id) {
$AppUI->redirect('m=public&a=access_denied');
}
if ($msg == $AppUI->_('contactsDeleteUserError', UI_OUTPUT_JS)) {
$userDeleteProtect = true;
}
// load the record data
$row = new CContact();
$obj = $AppUI->restoreObject();
if ($obj) {
示例10: die
<?php
/* $Id: do_addtasks_aed.php 2016 2011-08-07 07:08:46Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/projectdesigner/do_addtasks_aed.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $AppUI;
$perms =& $AppUI->acl();
if (!canAdd('tasks')) {
$AppUI->redirect('m=public&a=access_denied');
}
//Lets store the panels view options of the user:
$pdo = new CProjectDesignerOptions();
$pdo->pd_option_user = $AppUI->user_id;
$pdo->pd_option_view_project = w2PgetParam($_POST, 'opt_view_project', 0);
$pdo->pd_option_view_gantt = w2PgetParam($_POST, 'opt_view_gantt', 0);
$pdo->pd_option_view_tasks = w2PgetParam($_POST, 'opt_view_tasks', 0);
$pdo->pd_option_view_actions = w2PgetParam($_POST, 'opt_view_actions', 0);
$pdo->pd_option_view_addtasks = w2PgetParam($_POST, 'opt_view_addtsks', 0);
$pdo->pd_option_view_files = w2PgetParam($_POST, 'opt_view_files', 0);
$pdo->store();
//Lets store the task lines
$elements = $_POST;
$project_id = (int) w2PgetParam($_POST, 'project', 0);
$taskErrors = array();
foreach ($elements as $element => $on) {
if (substr($element, 0, 14) == 'add_task_line_' && $on != '') {
$tline = new CTask();
//TODO: clean this whole thing up..
$tline->task_id = 0;
$tline->task_name = $elements['add_task_name_' . $on];
示例11: die
<?php
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $AppUI, $obj, $percent, $can_edit_time_information, $cal_sdf;
$AppUI->loadCalendarJS();
$perms =& $AppUI->acl();
// check permissions
$canEditTask = $perms->checkModuleItem('tasks', 'edit', $obj->task_id);
$canViewTask = $perms->checkModuleItem('tasks', 'view', $obj->task_id);
$canEdit = canEdit('task_log');
$canAdd = canAdd('task_log');
$task_log_id = (int) w2PgetParam($_GET, 'task_log_id', 0);
$log = new CTaskLog();
if ($task_log_id) {
if (!$canEdit || !$canViewTask) {
$AppUI->redirect('m=public&a=access_denied');
}
$log->load($task_log_id);
} else {
if (!$canAdd || !$canViewTask) {
$AppUI->redirect('m=public&a=access_denied');
}
$log->task_log_task = $obj->task_id;
$log->task_log_name = $obj->task_name;
}
$proj = new CProject();
$proj->load($obj->task_project);
$q = new w2p_Database_Query();
示例12: w2PgetParam
$task_project = (int) w2PgetParam($_REQUEST, 'task_project', 0);
if (!$task_project) {
$AppUI->setMsg('badTaskProject', UI_MSG_ERROR);
$AppUI->redirect();
}
}
// check permissions
if ($task_id) {
// we are editing an existing task
$canEdit = $perms->checkModuleItem('tasks', 'edit', $task_id);
} else {
// do we have access on this project?
$canEdit = $perms->checkModuleItem('projects', 'view', $task_project);
// And do we have add permission to tasks?
if ($canEdit) {
$canEdit = canAdd('tasks');
}
}
if (!$canEdit) {
$AppUI->redirect('m=public&a=access_denied&err=noedit');
}
if ($task->task_represents_project) {
$AppUI->setMsg('The selected task represents a subproject. Please view/edit this project instead.', UI_MSG_ERROR);
$AppUI->redirect('m=projects&a=view&project_id=' . $task->task_represents_project);
}
//check permissions for the associated project
$canReadProject = $perms->checkModuleItem('projects', 'view', $task->task_project);
$durnTypes = w2PgetSysVal('TaskDurationType');
// check the document access (public, participant, private)
if (!$task->canAccess($AppUI->user_id)) {
$AppUI->redirect('m=public&a=access_denied&err=noaccess');
示例13: die
die('You should not access this file directly.');
}
$resource_id = (int) w2PgetParam($_POST, 'resource_id', 0);
$del = (int) w2PgetParam($_POST, 'del', 0);
$isNotNew = $resource_id;
$perms =& $AppUI->acl();
if ($del) {
if (!$perms->checkModuleItem('resources', 'delete', $resource_id)) {
$AppUI->redirect('m=public&a=access_denied');
}
} elseif ($isNotNew) {
if (!$perms->checkModuleItem('resources', 'edit', $resource_id)) {
$AppUI->redirect('m=public&a=access_denied');
}
} else {
if (!canAdd('resources')) {
$AppUI->redirect('m=public&a=access_denied');
}
}
$obj = new CResource();
$msg = '';
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
$AppUI->setMsg('Resource');
if ($del) {
if (!$obj->canDelete($msg)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect('m=resources');
}
示例14: die
<?php
/* $Id: addedit_folder.php 2016 2011-08-07 07:08:46Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/files/addedit_folder.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$file_folder_parent = intval(w2PgetParam($_GET, 'file_folder_parent', 0));
$folder = intval(w2PgetParam($_GET, 'folder', 0));
// add to allow for returning to other modules besides Files
$referrerArray = parse_url($_SERVER['HTTP_REFERER']);
$referrer = $referrerArray['query'] . $referrerArray['fragment'];
// check permissions for this record
$perms =& $AppUI->acl();
$canAuthor = canAdd('files');
$canEdit = canEdit('files');
// check permissions
if (!$canAuthor && !$folder) {
$AppUI->redirect('m=public&a=access_denied');
}
if (!$canEdit && $folder) {
$AppUI->redirect('m=public&a=access_denied');
}
// check permissions for this record
if ($folder == 0) {
$canEdit = $canAuthor;
}
if (!$canEdit) {
$AppUI->redirect('m=public&a=access_denied');
}
// check if this record has dependancies to prevent deletion
$msg = '';
示例15: die
<?php
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $AppUI, $m, $obj, $task_id, $w2Pconfig;
if (canView('files')) {
if (canAdd('files')) {
echo '<a href="./index.php?m=files&a=addedit&project_id=' . $obj->task_project . '&file_task=' . $task_id . '">' . $AppUI->_('Attach a file') . '</a>';
}
echo w2PshowImage('stock_attach-16.png', 16, 16, '');
$showProject = false;
$project_id = $obj->task_project;
include W2P_BASE_DIR . '/modules/files/index_table.php';
}