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


PHP vB_DataManager::pre_delete方法代码示例

本文整理汇总了PHP中vB_DataManager::pre_delete方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_DataManager::pre_delete方法的具体用法?PHP vB_DataManager::pre_delete怎么用?PHP vB_DataManager::pre_delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vB_DataManager的用法示例。


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

示例1: array

 /**
  * Any code to run before deleting.
  *
  * @param	string	What are we deleteing?
  */
 function pre_delete($type = 'attachment', $doquery = true, $checkperms = true)
 {
     $this->lists['content'] = array();
     $this->lists['filedataids'] = array();
     $this->lists['attachmentids'] = array();
     $this->lists['picturecomments'] = array();
     $this->lists['userids'] = array();
     $this->set_info('type', $type);
     if ($type == 'filedata') {
         $ids = $this->registry->db->query_read("\n\t\t\t\tSELECT a.attachmentid, fd.userid, fd.filedataid, a.userid AS auserid, a.contenttypeid\n\t\t\t\tFROM " . TABLE_PREFIX . "filedata AS fd\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "attachment AS a ON (a.filedataid = fd.filedataid)\n\t\t\t\tWHERE " . $this->condition);
     } else {
         $ids = $this->registry->db->query_read("\n\t\t\t\tSELECT a.attachmentid, fd.userid, fd.filedataid, a.userid AS auserid, a.contenttypeid\n\t\t\t\tFROM " . TABLE_PREFIX . "attachment AS a\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "filedata AS fd ON (a.filedataid = fd.filedataid)\n\t\t\t\tWHERE " . $this->condition);
     }
     while ($id = $this->registry->db->fetch_array($ids)) {
         if ($id['attachmentid']) {
             $this->lists['content']["{$id['contenttypeid']}"][] = $id['attachmentid'];
             $this->lists['attachmentids'][] = $id['attachmentid'];
             $this->lists['userids']["{$id['auserid']}"] = 1;
             if ($id['filedataid'] and $id['auserid']) {
                 $this->lists['picturecomments'][] = "(filedataid = {$id['filedataid']} AND userid = {$id['auserid']})";
             }
         }
         if ($id['filedataid']) {
             $this->lists['filedataids']["{$id['filedataid']}"] = $id['userid'];
         }
     }
     require_once DIR . '/packages/vbattach/attach.php';
     if ($this->registry->db->num_rows($ids) == 0) {
         // nothing to delete
         return false;
     } else {
         foreach ($this->lists['content'] as $contenttypeid => $list) {
             if ($attach =& vB_Attachment_Dm_Library::fetch_library($this->registry, $contenttypeid)) {
                 if (!$attach->pre_delete($list, $checkperms, $this)) {
                     return false;
                 }
             } else {
                 // This means we have an unrecognized contenttypeid, just delete the attachments..
             }
             unset($attach);
         }
     }
     return parent::pre_delete($doquery);
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:49,代码来源:class_dm_attachment.php

示例2: array

	/**
	* Any code to run before deleting.
	*
	* @param	string	What are we deleteing?
	*/
	function pre_delete($type = 'attachment', $doquery = true, $checkperms = true)
	{
		$this->lists['content'] = array();
		$this->lists['filedataids'] = array();
		$this->lists['attachmentids'] = array();
		$this->lists['picturecomments'] = array();
		$this->lists['userids'] = array();
		$this->set_info('type', $type);

		if ($type == 'filedata')
		{
			$ids = $this->registry->db->query_read("
				SELECT a.attachmentid, fd.userid, fd.filedataid, a.userid AS auserid, a.contenttypeid
				FROM " . TABLE_PREFIX . "filedata AS fd
				LEFT JOIN " . TABLE_PREFIX . "attachment AS a ON (a.filedataid = fd.filedataid)
				WHERE " . $this->condition
			);
		}
		else
		{
			$ids = $this->registry->db->query_read("
				SELECT a.attachmentid, fd.userid, fd.filedataid, a.userid AS auserid, a.contenttypeid
				FROM " . TABLE_PREFIX . "attachment AS a
				LEFT JOIN " . TABLE_PREFIX . "filedata AS fd ON (a.filedataid = fd.filedataid)
				WHERE " . $this->condition
			);
		}
		while ($id = $this->registry->db->fetch_array($ids))
		{
			if ($id['attachmentid'])
			{
				$this->lists['content']["$id[contenttypeid]"][] = $id['attachmentid'];
				$this->lists['attachmentids'][] = $id['attachmentid'];
				$this->lists['picturecomments'][] = "(filedataid = $id[filedataid] AND userid = $id[auserid])";
				$this->lists['userids']["$id[auserid]"] = 1;
			}
			if ($id['filedataid'])
			{
				$this->lists['filedataids']["$id[filedataid]"] = $id['userid'];
			}
		}

		require_once(DIR . '/packages/vbattach/attach.php');
		if ($this->registry->db->num_rows($ids) == 0)
		{	// nothing to delete
			return false;
		}
		else
		{
			foreach ($this->lists['content'] AS $contenttypeid => $list)
			{
				if (!($attach =& vB_Attachment_Dm_Library::fetch_library($this->registry, $contenttypeid)))
				{
					return false;
				}
				if (!$attach->pre_delete($list, $checkperms, $this))
				{
					return false;
				}
				unset($attach);
			}
		}

		return parent::pre_delete($doquery);
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:70,代码来源:class_dm_attachment.php


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