本文整理汇总了PHP中getPermission函数的典型用法代码示例。如果您正苦于以下问题:PHP getPermission函数的具体用法?PHP getPermission怎么用?PHP getPermission使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPermission函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if ($_SESSION['access'] > 2) {
die('Access denied');
}
$this->templates_path = dirname(dirname(dirname(__FILE__))) . ROOT_DIR . 'view';
$this->tpl_file = isset($_GET['file']) ? $this->templates_path . $_GET['file'] : false;
if (isset($_POST['action']) && $_POST['action'] == 'save' && $this->tpl_file != false) {
$this->saveTemplate();
}
if (isset($_SESSION['msg']) && $_SESSION['msg'] == 'success') {
$this->data['text_message'] = $this->language['changes_applied'];
$this->data['class_message'] = 'success';
unset($_SESSION['msg']);
}
if (isset($_SESSION['msg']) && $_SESSION['msg'] == 'denied') {
$this->data['text_message'] = $this->language['perm_denied'] . ' ' . $this->language['cur_perm'] . getPermission($this->tpl_file);
$this->data['class_message'] = 'error';
unset($_SESSION['msg']);
}
$this->engine->document->addHeaderString('<link href="template/css/codemirror.css" rel="stylesheet" media="screen">');
$this->engine->document->addHeaderString('<script src="template/js/codemirror.js"></script>');
if ($this->tpl_file != false) {
$ext = strtolower(pathinfo($this->tpl_file, PATHINFO_EXTENSION));
if (in_array($ext, array('png', 'jpg', 'jpeg', 'gif'))) {
$this->tpl_file = false;
}
switch ($ext) {
case 'css':
$this->engine->document->addHeaderString('<script src="template/js/css.js"></script>');
break;
case 'xml':
$this->engine->document->addHeaderString('<script src="template/js/xml.js"></script>');
break;
case 'js':
$this->engine->document->addHeaderString('<script src="template/js/javascript.js"></script>');
break;
case 'tpl':
$this->engine->document->addHeaderString('<script src="template/js/matchbrackets.js"></script>');
$this->engine->document->addHeaderString('<script src="template/js/htmlmixed.js"></script>');
$this->engine->document->addHeaderString('<script src="template/js/xml.js"></script>');
$this->engine->document->addHeaderString('<script src="template/js/javascript.js"></script>');
$this->engine->document->addHeaderString('<script src="template/js/css.js"></script>');
$this->engine->document->addHeaderString('<script src="template/js/clike.js"></script>');
$this->engine->document->addHeaderString('<script src="template/js/php.js"></script>');
break;
default:
break;
}
}
$this->engine->document->addHeaderString('<script src="template/js/jquery.cookie.js"></script>');
$this->engine->document->addHeaderString('<script src="template/js/jquery.treeview.js"></script>');
$this->engine->document->addHeaderString('<link href="template/css/jquery.treeview.css" rel="stylesheet" media="screen">');
$this->data['templates_path'] = $this->templates_path;
$this->data['tpl_file'] = $this->tpl_file;
$this->data['ext'] = isset($ext) ? $ext : '';
$this->data['breadcrumbs'][] = array('caption' => $this->language['home'], 'link' => ADM_PATH);
$this->data['breadcrumb_cur'] = $this->language['template_manager'];
$this->template = 'template/tpl_manager.tpl';
}
示例2: fetchResults
function fetchResults(&$record_count)
{
global $AppUI;
$results = $this->_searchResults();
if ($results && getPermission($this->table_module, 'access')) {
$record_count += count($results);
$outstring = '<tr><th><b>' . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . '</b></th></tr>' . "\n";
foreach ($results as $records) {
if (getPermission($this->table_module, 'access', $records[$this->table_key])) {
$ii = 0;
$display_val = '';
foreach ($this->display_fields as $fld) {
$ii++;
if (!($this->search_options['display_all_flds'] == 'on') && $ii > 2) {
break;
}
$display_val .= ($display_val ? ' ' : '') . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $fld)];
}
$tmplink = "";
if (isset($this->table_link) && isset($this->table_key)) {
$tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)];
}
if (isset($this->table_link2) && isset($this->table_key2)) {
$tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)] . $this->table_link2 . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key2)];
}
$outstring .= '<tr><td>' . "\n" . '<a href="' . $tmplink . '">' . highlight($display_val, $this->keywords) . '</a>' . "\n" . '</td></tr>' . "\n";
}
}
} else {
if ($this->search_options['show_empty'] == 'on') {
$outstring = '<tr><th><b>' . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . '</b></th></tr>' . "\n" . '<tr><td>' . $AppUI->_('Empty') . '</td></tr>' . "\n";
}
}
return $outstring;
}
示例3: tombolAddItem
function tombolAddItem($kd, $status)
{
if (getPermission()) {
if (getPermission()->BTN_EDIT == 1 and $status != 101) {
$title1 = Yii::t('app', 'AddItem');
$options1 = ['id' => 'add-item', 'data-toggle' => "modal", 'data-target' => "#additem-ro", 'class' => 'btn btn-warning'];
$icon1 = '<span class="fa fa-plus fa-lg"></span>';
$label1 = $icon1 . ' ' . $title1;
$url1 = Url::toRoute(['/purchasing/request-order/additem', 'kd' => $kd]);
$content = Html::a($label1, $url1, $options1);
return $content;
} else {
$title1 = Yii::t('app', 'AddItem');
$options1 = ['id' => 'ro-tambah-detail', 'class' => 'btn btn-warning', 'data-confirm' => 'Permission Failed, The data can not be changed !'];
$icon1 = '<span class="fa fa-plus fa-lg"></span>';
$label1 = $icon1 . ' ' . $title1;
$url1 = Url::toRoute(['#']);
$content = Html::a($label1, $url1, $options1);
return $content;
}
} else {
$title1 = Yii::t('app', 'AddItem');
$options1 = ['id' => 'ro-tambah-detail', 'class' => 'btn btn-warning', 'data-confirm' => 'Permission Failed, The data can not be changed !'];
$icon1 = '<span class="fa fa-plus fa-lg"></span>';
$label1 = $icon1 . ' ' . $title1;
$url1 = Url::toRoute(['#']);
$content = Html::a($label1, $url1, $options1);
return $content;
}
}
示例4: tombolReview
function tombolReview($url, $model)
{
if (getPermission()) {
// if(getPermission()->BTN_REVIEW==1){
$title = Yii::t('app', 'Review');
$options = ['id' => 'term-date-review'];
$icon = '<span class="glyphicon glyphicon-zoom-in"></span>';
$label = $icon . ' ' . $title;
$url = Url::toRoute(['/purchasing/data-term/review', 'id' => $model->TERM_ID, 'cus_kd' => $model->CUST_KD_PARENT]);
$options['tabindex'] = '-1';
return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
// }
}
}
示例5: canDelete
function canDelete(&$msg, $oid = null)
{
// TODO: check if user permissions are considered when deleting a project
global $AppUI;
return getPermission('projects', 'delete', $oid);
// NOTE: I uncommented the dependencies check since it is
// very anoying having to delete all tasks before being able
// to delete a project.
/*
$tables[] = array('label' => 'Tasks', 'name' => 'tasks', 'idfield' => 'task_id',
'joinfield' => 'task_project');
// call the parent class method to assign the oid
return CDpObject::canDelete($msg, $oid, $tables);
*/
}
示例6: htmlspecialchars
</td>
<td width="30%">
<?php
if (getPermission('companies', 'view', $row['project_company'])) {
?>
<a href="?m=companies&a=view&company_id=<?php
echo $row['project_company'];
?>
" title="<?php
echo htmlspecialchars($row['company_description'], ENT_QUOTES);
?>
">
<?php
}
echo htmlspecialchars($row['company_name'], ENT_QUOTES);
if (getPermission('companies', 'view', $row['project_company'])) {
?>
</a>
<?php
}
?>
</td>
<td width="100%">
<a href="?m=projects&a=view&project_id=<?php
echo $row['project_id'];
?>
" onmouseover="return overlib('<?php
echo htmlspecialchars('<div><p>' . str_replace(array("\r\n", "\n", "\r"), '</p><p>', addslashes($row['project_description'])) . '</p></div>', ENT_QUOTES);
?>
', CAPTION, '<?php
echo $AppUI->_('Description');
示例7: CTask
$task = new CTask();
$allowedProjects = $project->getAllowedSQL($AppUI->user_id, 'file_project');
$allowedTasks = $task->getAllowedSQL($AppUI->user_id, 'file_task');
$cfObj = new CFileFolder();
$allowedFolders = $cfObj->getAllowedSQL($AppUI->user_id, 'file_folder');
//get permissions for folder tab
$canAccess_folders = getPermission('file_folders', 'access');
// setup the title block
$titleBlock = new CTitleBlock('Files', 'folder5.png', $m, $m . '.' . $a);
$titleBlock->addCell($AppUI->_('Filter') . ':');
$titleBlock->addCell(arraySelect($projects, 'project_id', 'onchange="javascript:document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=files" method="post">', '</form>');
/*
* override the file module's $canEdit variable passed from the main index.php
* in order to check on file folder permissions
*/
$canAuthor_folders = getPermission('file_folders', 'add');
if ($canAuthor) {
$titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new file') . '" />', '', '<form action="?m=files&a=addedit&folder=' . $folder . '" method="post">', '</form>');
}
if ($canAuthor_folders) {
$titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new folder') . '" />', '', '<form action="?m=files&a=addedit_folder" method="post">', '</form>');
}
$titleBlock->show();
$file_types = dPgetSysVal('FileType');
$fts = $file_types;
if ($tab != -1) {
array_unshift($file_types, 'All Files');
}
$tabBox = new CTabBox('?m=files', DP_BASE_DIR . '/modules/files/', $tab);
$tabbed = $tabBox->isTabbed();
$i = 0;
示例8: die
<?php
/* FORUMS $Id: view_pdf.php 6149 2012-01-09 11:58:40Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
die('You should not call this file directly.');
}
$AppUI->savePlace();
$sort = dPgetCleanParam($_REQUEST, 'sort', 'asc');
$forum_id = (int) dPgetParam($_REQUEST, 'forum_id', 0);
$message_id = (int) dPgetParam($_REQUEST, 'message_id', 0);
if (!getPermission('forums', 'view', $message_id)) {
$AppUI->redirect("m=public&a=access_denied");
}
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('forum_messages', 'msg');
$q->addQuery('msg.*, contact_first_name, contact_last_name, contact_email, user_username,
forum_moderated, visit_user');
$q->addJoin('forum_visits', 'v', "visit_user = {$AppUI->user_id} AND visit_forum = {$forum_id} AND visit_message = msg.message_id");
$q->addJoin('users', 'u', 'message_author = u.user_id');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
$q->addWhere("forum_id = message_forum AND (message_id = {$message_id} OR message_parent = {$message_id})");
if (dPgetConfig('forum_descendent_order') || dPgetCleanParam($_REQUEST, 'sort', 0)) {
$q->addOrder("message_date {$sort}");
}
$messages = $q->loadList();
$x = false;
$date = new CDate();
$pdfdata = array();
$pdfhead = array('Date', 'User', 'Message');
$new_messages = array();
示例9: canUserEditTimeInformation
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 (dPgetConfig('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 (getPermission('admin', 'edit')) {
$can_edit_time_information = true;
}
} else {
if (dPgetConfig('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;
}
示例10: tombolReview
function tombolReview($url, $model)
{
if (getPermission()) {
/* GF_ID>=4 Group Function[Director|GM|M|S] */
$gF = getPermissionEmp()->GF_ID;
$Auth2 = getPermission()->BTN_SIGN2;
// Auth2
$Auth3 = getPermission()->BTN_SIGN3;
// Auth3
$BtnReview = getPermission()->BTN_REVIEW;
if (($Auth2 == 1 or $Auth3 == 1) and $gF <= 4 and $BtnReview = 1 or getPermissionEmp()->EMP_ID == $model->USER_CC) {
$title = Yii::t('app', 'Review');
$options = [];
$icon = '<span class="glyphicon glyphicon-ok"></span>';
$label = $icon . ' ' . $title;
$url = Url::toRoute(['/purchasing/sales-order/review', 'kd' => $model->KD_RO]);
//$url = Url::toRoute(['/purchasing/sales-order/approved']);
//$url = Url::toRoute(['/purchasing/sales-order/approved']);
$options['tabindex'] = '-1';
return '<li>' . Html::a($label, $url, $options) . '</li>' . PHP_EOL;
}
}
}
示例11: die
<?php
/* ADMIN $Id: do_userrole_aed.php 6149 2012-01-09 11:58:40Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
require_once $AppUI->getModuleClass('contacts');
$del = (bool) dPgetParam($_POST, 'del', false);
$role_id = (int) dPgetParam($_POST, 'role_id', 0);
$user_id = (int) dPgetParam($_POST, 'user_id', 0);
$user_role = (int) dPgetParam($_POST, 'user_role', 0);
if (!getPermission($m, 'edit', $user_id)) {
$AppUI->redirect('m=public&a=access_denied');
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Role');
$perms =& $AppUI->acl();
if ($del) {
if ($perms->deleteUserRole($role_id, $user_id)) {
$AppUI->setMsg('deleted', UI_MSG_ALERT, true);
if (dPgetConfig('user_contact_inactivate') && !$perms->checkLogin($user_id)) {
// Mark contact as private
$obj = new CUser();
$contact = new CContact();
$obj->load($user_id);
if ($contact->load($obj->user_contact)) {
$contact->contact_private = 1;
$contact->store();
}
}
} else {
示例12: die
<?php
/* COMPANIES $Id: view.php 6080 2010-12-04 08:39:35Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
$company_id = intval(dPgetParam($_GET, 'company_id', 0));
// check permissions for this record
$canRead = getPermission($m, 'view', $company_id);
$canEdit = getPermission($m, 'edit', $company_id);
if (!$canRead) {
$AppUI->redirect('m=public&a=access_denied');
}
// retrieve any state parameters
if (isset($_GET['tab'])) {
$AppUI->setState('CompVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('CompVwTab') !== NULL ? $AppUI->getState('CompVwTab') : 2;
// check if this record has dependencies to prevent deletion
$msg = '';
$obj = new CCompany();
$canDelete = $obj->canDelete($msg, $company_id);
// load the record data
$q = new DBQuery();
$q->addTable('companies', 'co');
$q->addQuery('co.*');
$q->addQuery('con.contact_first_name');
$q->addQuery('con.contact_last_name');
$q->addJoin('users', 'u', 'u.user_id = co.company_owner');
$q->addJoin('contacts', 'con', 'u.user_contact = con.contact_id');
$q->addWhere('co.company_id = ' . $company_id);
示例13: die
<?php
/* PROJECTS $Id$ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
/**
* Generates a report of the task logs for given dates
*/
if (!getPermission('task_log', 'view')) {
redirect('m=public&a=access_denied');
}
$do_report = dPgetParam($_GET, "do_report", 0);
$log_all = dPgetParam($_GET, 'log_all', 0);
$log_pdf = dPgetParam($_GET, 'log_pdf', 0);
$log_ignore = dPgetParam($_GET, 'log_ignore', 0);
$log_userfilter = dPgetParam($_GET, 'log_userfilter', '0');
$log_start_date = dPgetParam($_GET, "log_start_date", 0);
$log_end_date = dPgetParam($_GET, "log_end_date", 0);
// create Date objects from the datetime fields
$start_date = intval($log_start_date) ? new CDate($log_start_date) : new CDate();
$end_date = intval($log_end_date) ? new CDate($log_end_date) : new CDate();
if (!$log_start_date) {
$start_date->subtractSpan(new Date_Span("14,0,0,0"));
}
$end_date->setTime(23, 59, 59);
?>
<script language="javascript">
var calendarField = '';
function popCalendar(field) {
示例14: die
<?php
/* PROJECTS $Id: reports.php 5874 2009-04-25 13:04:46Z merlinyoda $ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
$project_id = intval(dPgetParam($_REQUEST, 'project_id', 0));
$report_type = dPgetParam($_REQUEST, 'report_type', '');
// check permissions for this record
$canRead = getPermission($m, 'view', $project_id);
if (!$canRead) {
$AppUI->redirect('m=public&a=access_denied');
}
$project_list = array('0' => $AppUI->_('All', UI_OUTPUT_RAW));
$obj = new CProject();
$ptrc = $obj->getAllowedProjectsInRows($AppUI->user_id);
$nums = db_num_rows($ptrc);
echo db_error();
for ($x = 0; $x < $nums; $x++) {
$row = db_fetch_assoc($ptrc);
if ($row['project_id'] == $project_id) {
$display_project_name = '(' . $row['project_short_name'] . ') ' . $row['project_name'];
}
$project_list[$row['project_id']] = '(' . $row['project_short_name'] . ') ' . $row['project_name'];
}
if (!$suppressHeaders) {
?>
<script language="javascript">
function changeIt() {
var f=document.changeMe;
示例15: canDelete
function canDelete($mod, $item_id = 0)
{
return getPermission($mod, 'delete', $item_id);
}