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


PHP can_delete函数代码示例

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


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

示例1: GetFoldersAndFiles

function GetFoldersAndFiles($resourceType, $currentFolder)
{
    if (!isset($_GET)) {
        global $_GET;
    }
    global $Config;
    $isInternalLink = isset($_GET['DWFCK_Browser']) && $_GET['DWFCK_Browser'] == 'local' ? true : false;
    global $_FolderClass;
    global $Config;
    $currentFolder = encode_dir($currentFolder);
    $sess_id = session_id();
    if (!isset($sess_id) || $sess_id != $_COOKIE['FCK_NmSp_acl']) {
        session_id($_COOKIE['FCK_NmSp_acl']);
        session_start();
    }
    $acl_del = isset($_SESSION['dwfck_del']) ? $_SESSION['dwfck_del'] : 0;
    // Map the virtual path to the local server path.
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    if ($Config['osWindows']) {
        $sServerDir = normalizeWIN($sServerDir);
    }
    mkdir_rek($sServerDir);
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    $sFile = '__AAAAAAAA__.AAA';
    $temp_folder = $currentFolder;
    $temp_folder = dwiki_encodeFN(trim($temp_folder, '/'));
    has_permission($temp_folder, $resourceType);
    if ($isInternalLink && $_FolderClass < 16) {
        $sfclass = 'r';
    } else {
        if ($acl_del) {
            $sfclass = $_FolderClass >= 16 ? 'u' : 'r';
        } else {
            $sfclass = $_FolderClass >= 8 || has_open_access() ? 'u' : 'r';
        }
        can_delete($sfclass);
    }
    if (!$_FolderClass) {
        return;
    }
    $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" class="' . $sfclass . '" />';
    $sErrorNumber = 0;
    $sFolderPath = GetResourceTypeDirectory($resourceType, 'GetFoldersAndFiles');
    $absolute_path = $Config['UserFilesAbsolutePath'];
    $oCurrentFolder = @opendir($sServerDir);
    if ($oCurrentFolder !== false) {
        while ($sFile = readdir($oCurrentFolder)) {
            if ($sFile != '.' && $sFile != '..') {
                if (is_dir($sServerDir . $sFile)) {
                    if (has_permission(dwiki_encodeFN($currentFolder) . $sFile, $resourceType) || has_open_access()) {
                        if ($isInternalLink && $_FolderClass < 255) {
                            $class = 'r';
                        } else {
                            $class = $_FolderClass < 8 ? 'r' : 'u';
                            can_delete($class);
                        }
                        if ($_FolderClass) {
                            $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" class="' . $class . '" />';
                        }
                    }
                } else {
                    $iFileSize = @filesize($sServerDir . $sFile);
                    if (!$iFileSize) {
                        $iFileSize = 0;
                    }
                    if ($iFileSize > 0) {
                        $iFileSize = round($iFileSize / 1024);
                        if ($iFileSize < 1) {
                            $iFileSize = 1;
                        }
                    }
                    if ($isInternalLink) {
                        if (!preg_match('/\\.txt$/', $sFile)) {
                            continue;
                        }
                        if (has_permission(dwiki_encodeFN($currentFolder) . $sFile, $resourceType, false)) {
                            $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                        }
                    } else {
                        if ($resourceType == 'Image') {
                            list($width, $height, $type, $attr) = getimagesize($sServerDir . $sFile);
                            if (isset($width) && isset($height)) {
                                $iFileSize .= ";;{$width};;{$height}";
                            }
                        }
                        $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                    }
                }
            }
        }
        closedir($oCurrentFolder);
    }
    // Send the folders
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
//.........这里部分代码省略.........
开发者ID:violetfish,项目名称:ckgedit,代码行数:101,代码来源:commands.php

示例2: canDelete

 /**
  * Check if specific user can delete this contact
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canDelete(User $user)
 {
     return can_manage_contacts($user, true) || can_delete($user, $this);
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:11,代码来源:Contact.class.php

示例3: canDelete

 /**
  * Check if specific user can delete this contact
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canDelete(Contact $user)
 {
     // dont delete account owner
     if ($this->isAccountOwner() || $this->isOwnerCompany()) {
         return false;
     }
     if ($this->getUserType() != 0) {
         return can_manage_security($user) && $this->getUserType() > $user->getUserType();
     } else {
         return can_manage_contacts($user) || can_delete($user, $this->getMembers(), $this->getObjectTypeId());
     }
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:19,代码来源:Contact.class.php

示例4: canDelete

 /**
  * Returns true if $user can delete this email
  *
  * @param User $user
  * @return boolean
  */
 function canDelete(User $user)
 {
     return can_delete($user, $this);
     //		return $this->getAccount()->getUserId() == $user->getId() || $user->isAdministrator();
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:11,代码来源:MailContent.class.php

示例5: display_error

    if ($myrow[0] > 0) {
        display_error(tr('Cannot delete this item record because there are ' . 'existing sales orders for this part.'));
        return false;
    }
    $sql = "SELECT COUNT(*) FROM purch_order_details " . "WHERE item_code='{$stock_id}'";
    $result = db_query($sql, "could not query purchase orders");
    $myrow = db_fetch_row($result);
    if ($myrow[0] > 0) {
        display_error(tr('Cannot delete this item because there are existing ' . 'purchase order items for it.'));
        return false;
    }
    return true;
}
//------------------------------------------------------------------------------------
if (isset($_POST['delete']) && strlen($_POST['delete']) > 1) {
    if (can_delete($_POST['NewStockID'])) {
        $stock_id = $_POST['NewStockID'];
        delete_item($stock_id);
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//------------------------------------------------------------------------------------
start_form(true);
if (db_has_stock_items()) {
    start_table("class='tablestyle_noborder'");
    start_row();
    stock_items_list_cells(tr("Select an item:"), 'stock_id', null, null, null, null, 1);
    submit_cells('SelectStockItem', tr("Edit Item"));
    end_row();
    end_table();
}
开发者ID:ravenii,项目名称:guardocs,代码行数:31,代码来源:items.php

示例6: canDelete

	/**
	 * Returns true if $user can delete this email
	 *
	 * @param Contact $user
	 * @return boolean
	 */
	function canDelete(Contact $user) {
		$account = $this->getAccount();
		if ($account) {
			return ( 
				$account->getContactId() == logged_user()->getId() || 
				can_delete($user,$this->getMembers(), $this->getObjectTypeId())
			);	
		}else{
			return can_delete($user, $this->getMembers(), $this->getObjectTypeId());
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:17,代码来源:MailContent.class.php

示例7: masstrash

 function masstrash($table)
 {
     checklogin();
     if (!can_delete($table)) {
         redirect(base_url() . 'content/' . $table . '/:error:' . urlencode('Sorry. You do not have permissions to delete things from ' . humanizer($table)));
         exit;
     }
     if (!$_POST || !$_POST['ids']) {
         redirect(base_url() . 'content/' . $table);
         exit;
     }
     $table = mysql_real_escape_string($table);
     foreach ($_POST['ids'] as $id) {
         $id = mysql_real_escape_string($id);
         $this->db->query("UPDATE {$table} SET __is_trash=1 WHERE id='{$id}'");
         //$this->memcached_library->flush();
     }
     redirect(base_url() . 'content/' . $table . '/:success:' . urlencode('Items have been moved to trash.'));
 }
开发者ID:reesretuta,项目名称:beauty-mx,代码行数:19,代码来源:content.php

示例8: canDelete

 /**
  * Check if specific user can delete this task
  *
  * @access public
  * @param Contact $user
  * @return boolean
  */
 function canDelete(Contact $user)
 {
     if (can_delete($user, $this->getMembers(), $this->getObjectTypeId())) {
         return true;
     }
     $task_list = $this->getParent();
     return $task_list instanceof TemplateTask ? $task_list->canDelete($user) : false;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:15,代码来源:TemplateTask.class.php

示例9: delete_timeslot

 function delete_timeslot()
 {
     if (!can_delete(logged_user(), active_context(), Timeslots::instance()->getObjectTypeId())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     ajx_current("empty");
     $timeslot = Timeslots::findById(get_id());
     if (!$timeslot instanceof Timeslot) {
         flash_error(lang('timeslot dnx'));
         return;
     }
     if (!$timeslot->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         return;
     }
     try {
         DB::beginWork();
         $timeslot->delete();
         DB::commit();
         ajx_extra_data(array("timeslotId" => get_id()));
     } catch (Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
     }
     // try
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:28,代码来源:TimeController.class.php

示例10: display_error

        display_error(_("Cannot delete this account because it is used by one or more Customer Branches."));
        return false;
    }
    if (gl_account_in_suppliers($selected_account)) {
        display_error(_("Cannot delete this account because it is used by one or more suppliers."));
        return false;
    }
    if (gl_account_in_quick_entry_lines($selected_account)) {
        display_error(_("Cannot delete this account because it is used by one or more Quick Entry Lines."));
        return false;
    }
    return true;
}
//--------------------------------------------------------------------------------------
if (isset($_POST['delete'])) {
    if (can_delete($selected_account)) {
        delete_gl_account($selected_account);
        $selected_account = $_POST['AccountList'] = '';
        delete_tag_associations(TAG_ACCOUNT, $selected_account, true);
        $selected_account = $_POST['AccountList'] = '';
        display_notification(_("Selected account has been deleted"));
        unset($_POST['account_code']);
        $Ajax->activate('_page_body');
    }
}
//-------------------------------------------------------------------------------------
start_form();
if (db_has_gl_accounts()) {
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    gl_all_accounts_list_cells(null, 'AccountList', null, false, false, _('New account'), true, check_value('show_inactive'));
开发者ID:M-Shahbaz,项目名称:FA,代码行数:31,代码来源:gl_accounts.php

示例11: canDelete

 /**
  * Check if specific user can delete this milestone
  *
  * @access public
  * @param Contact $contact
  * @return boolean
  */
 function canDelete(Contact $contact)
 {
     return can_delete($contact, $this->getMembers(), $this->getObjectTypeId());
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:11,代码来源:ProjectMilestone.class.php

示例12: canDelete

 /**
  * Check if specific user can delete this comment
  *
  * @access public
  * @param Contact $user
  * @return boolean
  */
 function canDelete(Contact $user)
 {
     if ($this->isCheckedOut() && $this->getCheckedOutById() != $user->getId()) {
         return false;
     }
     return can_delete($user, $this->getMembers(), $this->getObjectTypeId());
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:14,代码来源:ProjectFile.class.php

示例13: canDelete

	/**
	 * Empty implementation of static method. Update tag permissions are check by the taggable
	 * object, not tag itself
	 *
	 * @param User $user
	 * @return boolean
	 */
	function canDelete(Contact $user) {
		return can_delete($user,$this);
	} // canDelete
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:10,代码来源:BillingCategory.class.php

示例14: canDelete

 /**
  * Returns true if $user can delete this email
  *
  * @param Contact $user
  * @return boolean
  */
 function canDelete(Contact $user)
 {
     $account = $this->getAccount();
     $members = $this->getMembers();
     $persons_dim = Dimensions::findByCode('feng_persons');
     $tmp = array();
     foreach ($members as $m) {
         if (!$persons_dim instanceof Dimension || $m->getDimensionId() != $persons_dim->getId()) {
             $tmp[] = $m;
         }
     }
     $members = $tmp;
     if ($account instanceof MailAccount) {
         // if classified
         if (count($members) > 0) {
             return $account->getContactId() == logged_user()->getId() || can_delete($user, $members, $this->getObjectTypeId());
         } else {
             $macs = MailAccountContacts::instance()->count(array('`account_id` = ? AND `contact_id` = ? AND `can_edit` = 1', $account->getId(), $user->getId()));
             return $account->getContactId() == logged_user()->getId() || $macs > 0;
         }
     } else {
         // if classified
         return can_delete($user, $members, $this->getObjectTypeId());
     }
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:MailContent.class.php

示例15: canDelete

 /**
  * Check if specific user can delete this report
  *
  * @access public
  * @param Contact $user
  * @return boolean
  */
 function canDelete(Contact $user)
 {
     return can_delete($user, $this->getMembers(), $this->manager()->getObjectTypeId());
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:11,代码来源:Report.class.php


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