当前位置: 首页>>代码示例>>PHP>>正文


PHP canDelete函数代码示例

本文整理汇总了PHP中canDelete函数的典型用法代码示例。如果您正苦于以下问题:PHP canDelete函数的具体用法?PHP canDelete怎么用?PHP canDelete使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了canDelete函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  * Delete a role requires deleting all of the ACLs associated with this
  *  role, and all of the group data for the role.
  *
  * @return bool|null|string
  */
 public function delete()
 {
     if (canDelete('roles')) {
         // Delete all the children from this group
         return $this->_perms->deleteRole($this->role_id);
     } else {
         return false;
         //get_class($this) . '::delete failed - You do not have permission to delete this role';
     }
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:16,代码来源:roles.class.php

示例2: setlocale

* 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')) {
    include_once W2P_BASE_DIR . '/modules/' . $m . '/' . $u . '/' . $u . '.class.php';
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:31,代码来源:index.php

示例3: die

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$event_id = (int) w2PgetParam($_GET, 'event_id', 0);
// check permissions for this record
$perms =& $AppUI->acl();
$canRead = $perms->checkModuleItem($m, 'view', $event_id);
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$canEdit = $perms->checkModuleItem($m, 'edit', $event_id);
// check if this record has dependencies to prevent deletion
$msg = '';
$event = new CEvent();
$event->loadFull($event_id);
$canDelete = canDelete($m, $event_id);
// load the record data
if (!$event) {
    $AppUI->setMsg('Event');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    $AppUI->savePlace();
}
//check if the user has view permission over the project
if ($event->event_project && !$perms->checkModuleItem('projects', 'view', $event->event_project)) {
    $AppUI->redirect('m=public&a=access_denied');
}
// load the event types
$types = w2PgetSysVal('EventType');
// load the event recurs types
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:view.php

示例4: elseif

     $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';
 }
 if (!$q->exec()) {
     $AppUI->setMsg(db_error());
 } else {
     $AppUI->setMsg($okMsg);
     if ($action == 'add') {
         $q->clear();
     }
     $q->addTable('history');
     $q->addUpdate('history_item = history_id');
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:addedit.php

示例5: die

<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
//view posts
$forum_id = (int) w2PgetParam($_GET, 'forum_id', 0);
$message_id = (int) w2PgetParam($_GET, 'message_id', 0);
$post_message = (int) w2PgetParam($_GET, 'post_message', 0);
$f = w2PgetParam($_POST, 'f', 0);
// check permissions
$perms =& $AppUI->acl();
$canAuthor = canAdd('forums');
$canDelete = canDelete('forums');
$canRead = $perms->checkModuleItem('forums', 'view', $forum_id);
$canEdit = $perms->checkModuleItem('forums', 'edit', $forum_id);
$canAdminEdit = canEdit('admin');
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$forum = new CForum();
$forum->loadFull($AppUI, $forum_id);
if (!$forum) {
    $AppUI->setMsg('Forum');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    $AppUI->savePlace();
}
$df = $AppUI->getPref('SHDATEFORMAT');
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:viewer.php

示例6: die

<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
//view posts
$forum_id = (int) w2PgetParam($_GET, 'forum_id', 0);
$message_id = (int) w2PgetParam($_GET, 'message_id', 0);
$post_message = (int) w2PgetParam($_GET, 'post_message', 0);
$f = w2PgetParam($_POST, 'f', 0);
// check permissions
$perms =& $AppUI->acl();
$canAuthor = canAdd('forums');
$canDelete = canDelete('forums', $forum_id);
$canRead = $perms->checkModuleItem('forums', 'view', $forum_id);
$canEdit = $perms->checkModuleItem('forums', 'edit', $forum_id);
$canAdminEdit = canEdit('system');
if (!$canRead) {
    $AppUI->redirect(ACCESS_DENIED);
}
$message = new CForum_Message();
$message->load($message_id);
if (0 == $forum_id) {
    $forum_id = $message->message_forum;
}
$forum = new CForum();
$forum->load($forum_id);
$project = new CProject();
$project->load($forum->forum_project);
if (!$forum) {
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:viewer.php

示例7: canDelete

 public function canDelete($notUsed = null, $notUsed2 = null, $notUsed3 = null)
 {
     return canDelete('system');
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:4,代码来源:budgets.class.php

示例8: canDelete

 /**
  * Determines whether the currently logged in user can delete this task log.
  *
  * @global AppUI $AppUI global user permissions
  *
  * @param string by ref $msg error msg to be populated on failure
  * @param int optional $oid key to check
  * @param array $joins optional list of tables to join on
  *
  * @return bool
  */
 public function canDelete(&$msg, $oid = null, $joins = null)
 {
     global $AppUI;
     $q = new w2p_Database_Query();
     // First things first.	Are we allowed to delete?
     $acl =& $AppUI->acl();
     if (!canDelete('task_log')) {
         $msg = $AppUI->_('noDeletePermission');
         return false;
     }
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = (int) $oid;
     }
     if (is_array($joins)) {
         $q->addTable($this->_tbl, 'k');
         $q->addQuery($k);
         $i = 0;
         foreach ($joins as $table) {
             $table_alias = 't' . $i++;
             $q->leftJoin($table['name'], $table_alias, $table_alias . '.' . $table['joinfield'] . ' = ' . 'k' . '.' . $k);
             $q->addQuery('COUNT(DISTINCT ' . $table_alias . '.' . $table['idfield'] . ') AS ' . $table['idfield']);
         }
         $q->addWhere($k . ' = ' . $this->{$k});
         $q->addGroup($k);
         $obj = null;
         $q->loadObject($obj);
         $q->clear();
         if (!$obj) {
             $msg = db_error();
             return false;
         }
         $msg = array();
         foreach ($joins as $table) {
             $k = $table['idfield'];
             if ($obj->{$k}) {
                 $msg[] = $AppUI->_($table['label']);
             }
         }
         if (count($msg)) {
             $msg = $AppUI->_('noDeleteRecord') . ': ' . implode(', ', $msg);
             return false;
         }
     }
     return true;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:57,代码来源:tasklogs.class.php


注:本文中的canDelete函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。