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


PHP build_picture_comment_counters函数代码示例

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


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

示例1: post_delete

 /**
  * Additional data to update after a delete call (such as denormalized values in other tables).
  *
  * @param	boolean	Do the query?
  */
 function post_delete($doquery = true)
 {
     $pictures = array();
     $picture_sql = $this->registry->db->query_read("\n\t\t\tSELECT albumpicture.pictureid, picture.idhash, picture.extension\n\t\t\tFROM " . TABLE_PREFIX . "albumpicture AS albumpicture\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "picture AS picture ON (albumpicture.pictureid = picture.pictureid)\n\t\t\tWHERE albumpicture.albumid = " . $this->fetch_field('albumid'));
     while ($picture = $this->registry->db->fetch_array($picture_sql)) {
         $pictures["{$picture['pictureid']}"] = $picture;
     }
     if ($pictures) {
         if ($this->registry->options['album_dataloc'] != 'db') {
             // remove from fs
             foreach ($pictures as $picture) {
                 @unlink(fetch_picture_fs_path($picture));
                 @unlink(fetch_picture_fs_path($picture, true));
             }
         }
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         // delete based on picture id as this means that when a picture is deleted,
         // it's removed from all albums automatically
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "albumpicture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         require_once DIR . '/includes/functions_picturecomment.php';
         build_picture_comment_counters($this->fetch_field('userid'));
         $groups = array();
         $groups_sql = $this->registry->db->query_read("\n\t\t\t\tSELECT DISTINCT socialgroup.*\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgrouppicture.groupid)\n\t\t\t\tWHERE socialgrouppicture.pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         while ($group = $this->registry->db->fetch_array($groups_sql)) {
             $groups[] = $group;
         }
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "socialgrouppicture\n\t\t\t\tWHERE pictureid IN (" . implode(',', array_keys($pictures)) . ")\n\t\t\t");
         foreach ($groups as $group) {
             $groupdata =& datamanager_init('SocialGroup', $this->registry, ERRTYPE_SILENT);
             $groupdata->set_existing($group);
             $groupdata->rebuild_picturecount();
             $groupdata->save();
         }
     }
     $this->remove_usercss_background_image();
     ($hook = vBulletinHook::fetch_hook('albumdata_delete')) ? eval($hook) : false;
     return true;
 }
开发者ID:holandacz,项目名称:nb4,代码行数:44,代码来源:class_dm_album.php

示例2: while

    // work out the effective picturebit height/width including any borders and paddings; the +4 works around an IE float issue
    $picturebit_height = $vbulletin->options['album_thumbsize'] + (($usercss ? $stylevar['cellspacing'] : 0) + $stylevar['cellpadding']) * 2 + 4;
    $picturebit_width = $vbulletin->options['album_thumbsize'] + (($usercss ? $stylevar['cellspacing'] : 0) + $stylevar['cellpadding']) * 2;
    $picturebits = '';
    $unread_count = 0;
    while ($picture = $db->fetch_array($pictures)) {
        // $comment contains picture and album info
        $picture = prepare_pictureinfo_thumb($picture, $picture);
        $picture['unreadcomments'] = vb_number_format($picture['unreadcomments']);
        ($hook = vBulletinHook::fetch_hook('album_unread_picturebit')) ? eval($hook) : false;
        eval('$picturebits .= "' . fetch_template('album_picturebit_unread') . '";');
    }
    if ($moderated_count != $vbulletin->userinfo['pcunreadcount']) {
        // back counter -- likely tachy based, rebuild all counters
        require_once DIR . '/includes/functions_picturecomment.php';
        build_picture_comment_counters($vbulletin->userinfo['userid']);
    }
    if (!$picturebits) {
        standard_error(fetch_error('no_unread_picture_comments', 'album.php?' . $vbulletin->session->vars['sessionurl'] . "u={$userinfo['userid']}"), '', false);
    }
    ($hook = vBulletinHook::fetch_hook('album_unread_complete')) ? eval($hook) : false;
    // navbar and final output
    $navbits = construct_navbits(array('member.php?' . $vbulletin->session->vars['sessionurl'] . "u={$userinfo['userid']}" => construct_phrase($vbphrase['xs_profile'], $userinfo['username']), 'album.php?' . $vbulletin->session->vars['sessionurl'] . "u={$userinfo['userid']}" => construct_phrase($vbphrase['xs_albums'], $userinfo['username']), '' => $vbphrase['unread_picture_comments']));
    eval('$navbar = "' . fetch_template('navbar') . '";');
    eval('print_output("' . fetch_template('album_unreadcomments') . '");');
}
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 22:41, Fri Oct 10th 2008
|| # CVS: $RCSfile$ - $Revision: 27273 $
|| ####################################################################
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:album.php

示例3: post_delete

 /**
  * Code to run after deleting
  *
  * @param	boolean	Do the query?
  *
  * @return	boolean	Was this code executed correctly?
  *
  */
 function post_delete($doquery = true)
 {
     $albums = array();
     $albums_sql = $this->registry->db->query_read("\n\t\t\tSELECT album.*\n\t\t\tFROM " . TABLE_PREFIX . "albumpicture AS albumpicture\n\t\t\tINNER JOIN " . TABLE_PREFIX . "album AS album ON (album.albumid = albumpicture.albumid)\n\t\t\tWHERE albumpicture.pictureid = " . $this->fetch_field('pictureid'));
     while ($album = $this->registry->db->fetch_array($albums_sql)) {
         $albums[] = $album;
     }
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "albumpicture\n\t\t\tWHERE pictureid = " . $this->fetch_field('pictureid'));
     if ($this->info['auto_count_update'] and $albums) {
         foreach ($albums as $album) {
             $albumdata =& datamanager_init('Album', $this->registry, ERRTYPE_SILENT);
             $albumdata->set_existing($album);
             $albumdata->rebuild_counts();
             // for a picture to have been set to the cover, it must have been visible
             if ($albumdata->fetch_field('coverpictureid') == $this->fetch_field('pictureid')) {
                 if ($album['visible'] - 1 > 0) {
                     $new_cover = $this->registry->db->query_first("\n\t\t\t\t\t\t\tSELECT albumpicture.pictureid\n\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "albumpicture AS albumpicture\n\t\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "picture AS picture ON (albumpicture.pictureid = picture.pictureid)\n\t\t\t\t\t\t\tWHERE albumpicture.albumid = {$album['albumid']} AND picture.state = 'visible'\n\t\t\t\t\t\t\tORDER BY albumpicture.dateline ASC\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t");
                 }
                 $albumdata->set('coverpictureid', $new_cover['pictureid'] ? $new_cover['pictureid'] : 0);
             }
             $albumdata->save();
         }
     }
     $del_usercss = array();
     foreach ($albums as $album) {
         $del_usercss[] = "'{$album['albumid']}," . $this->fetch_field('pictureid') . "'";
     }
     if ($del_usercss) {
         $this->registry->db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "usercss\n\t\t\t\tWHERE property = 'background_image'\n\t\t\t\t\tAND value IN (" . implode(',', $del_usercss) . ")\n\t\t\t\t\tAND userid = " . intval($this->fetch_field('userid')) . "\n\t\t\t");
         $this->info['have_updated_usercss'] = $this->registry->db->affected_rows() > 0;
     }
     $groups = array();
     $groups_sql = $this->registry->db->query_read("\n\t\t\tSELECT DISTINCT socialgroup.*\n\t\t\tFROM " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture\n\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgrouppicture.groupid)\n\t\t\tWHERE socialgrouppicture.pictureid = " . $this->fetch_field('pictureid'));
     while ($group = $this->registry->db->fetch_array($groups_sql)) {
         $groups[] = $group;
     }
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "socialgrouppicture\n\t\t\tWHERE pictureid = " . $this->fetch_field('pictureid'));
     foreach ($groups as $group) {
         $groupdata =& datamanager_init('SocialGroup', $this->registry, ERRTYPE_SILENT);
         $groupdata->set_existing($group);
         $groupdata->rebuild_picturecount();
         $groupdata->save();
     }
     $this->registry->db->query_write("\n\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment\n\t\t\tWHERE pictureid = " . $this->fetch_field('pictureid'));
     require_once DIR . '/includes/functions_picturecomment.php';
     build_picture_comment_counters($this->fetch_field('userid'));
     ($hook = vBulletinHook::fetch_hook('picturedata_delete')) ? eval($hook) : false;
     return parent::post_delete($doquery);
 }
开发者ID:holandacz,项目名称:nb4,代码行数:57,代码来源:class_dm_picture.php

示例4: delete

 /**
  * Code to run to delete a picture comment
  *
  * @param	boolean Do the query?
  *
  * @return	boolean	Whether this code executed correctly
  *
  */
 function delete()
 {
     if ($commentid = $this->existing['commentid']) {
         $db =& $this->registry->db;
         if ($this->info['hard_delete']) {
             $db->query_write("\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "deletionlog WHERE primaryid = {$commentid} AND type = 'picturecomment'\n\t\t\t\t");
             $db->query_write("\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment WHERE commentid = {$commentid}\n\t\t\t\t");
             $db->query_write("\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "moderation WHERE primaryid = {$commentid} AND type = 'picturecomment'\n\t\t\t\t");
             // Logging?
         } else {
             $this->set('state', 'deleted');
             $this->save();
             $deletionman =& datamanager_init('Deletionlog_PictureComment', $this->registry, ERRTYPE_SILENT, 'deletionlog');
             $deletionman->set('primaryid', $commentid);
             $deletionman->set('type', 'picturecomment');
             $deletionman->set('userid', $this->registry->userinfo['userid']);
             $deletionman->set('username', $this->registry->userinfo['username']);
             $deletionman->set('reason', $this->info['reason']);
             $deletionman->save();
             unset($deletionman);
         }
         if (!$this->info['pictureuser']) {
             $this->info['profileuser'] = fetch_userinfo($this->existing['userid']);
         }
         if ($this->info['pictureuser']) {
             build_picture_comment_counters($this->info['picteuser']['userid']);
         }
         $db->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "moderation WHERE primaryid = {$commentid} AND type = 'picturecomment'\n\t\t\t");
         return true;
     }
     $this->post_delete();
     return false;
 }
开发者ID:holandacz,项目名称:nb4,代码行数:41,代码来源:class_dm_picturecomment.php

示例5: IN

	}

	$db->query_write("
		DELETE FROM " . TABLE_PREFIX . "deletionlog
		WHERE type = 'picturecomment' AND
			primaryid IN(" . implode(',', array_keys($messagearray)) . ")
	");
	$db->query_write("
		UPDATE " . TABLE_PREFIX . "picturecomment
		SET state = 'visible'
		WHERE commentid IN(" . implode(',', array_keys($messagearray)) . ")
	");

	foreach(array_keys($userlist) AS $userid)
	{
		build_picture_comment_counters($userid);
	}

	if (can_moderate(0, 'candeletepicturecomments'))
	{
		foreach ($messagearray AS $message)
		{
			log_moderator_action($message, 'pc_by_x_on_y_undeleted',
				array($message['postusername'], fetch_trimmed_title($message['picture_caption'], 50))
			);
		}
	}

	// empty cookie
	setcookie('vbulletin_inlinepicturecomment', '', TIMENOW - 3600, '/');
开发者ID:hungnv0789,项目名称:vhtm,代码行数:30,代码来源:picture_inlinemod.php

示例6: fetch_picturecommentbits


//.........这里部分代码省略.........
					AND
				picturecomment.userid = $pictureinfo[userid]
					AND (" . implode(" OR ", $state_or) . ")
			" . ($coventry ? "AND picturecomment.postuserid NOT IN (" . $coventry . ")" : '' ) . "
				$hook_query_where
			ORDER BY picturecomment.dateline
			LIMIT $start, $perpage
		");

		list($messagestats['total']) = $vbulletin->db->query_first("SELECT FOUND_ROWS()", DBARRAY_NUM);
		if ($start >= $messagestats['total'])
		{
			$pagenumber = ceil($messagestats['total'] / $perpage);
		}
	}
	while ($start >= $messagestats['total'] AND $messagestats['total']);

	$messagestats['start'] = $start + 1;
	$messagestats['end'] = min($start + $perpage, $messagestats['total']);

	$bbcode = new vB_BbCodeParser($vbulletin, fetch_tag_list());
	$factory = new vB_Picture_CommentFactory($vbulletin, $bbcode, $pictureinfo);

	$messagebits = '';

	$firstrecord = array();
	$read_ids = array();

	if ($vbulletin->userinfo['userid'] AND !$showignored)
	{
		$ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
	}
	else
	{
		$ignorelist = array();
	}

	while ($message = $vbulletin->db->fetch_array($messages))
	{
		if (!$firstrecord)
		{
			$firstrecord = $message;
		}

		if ($ignorelist AND in_array($message['postuserid'], $ignorelist))
		{
			$message['ignored'] = true;
		}

		if (!$showignored AND in_coventry($message['postuserid']))
		{
			$message['ignored'] = true;
		}

		$response_handler =& $factory->create($message);
		$response_handler->cachable = false;
		$messagebits .= $response_handler->construct();

		if (!$message['messageread'] AND $message['state'] == 'visible' AND $pictureinfo['userid'] == $vbulletin->userinfo['userid'])
		{
			$read_ids[] = $message['commentid'];
		}

		$messagestats['lastcomment'] = $message['dateline'];
	}

	if ($pictureinfo['userid'] == $vbulletin->userinfo['userid'])
	{
		$readpcs = 0;

		if (!empty($read_ids))
		{
			$readpcs = sizeof($read_ids);
			$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "picturecomment SET messageread = 1 WHERE commentid IN (" . implode(',', $read_ids) . ")");
		}

		if ($vbulletin->userinfo['pcunreadcount'] - $readpcs > 0 AND $vbulletin->options['globalignore'] != '')
		{
			build_picture_comment_counters($vbulletin->userinfo['userid']);
		}
		else if ($readpcs)
		{
			$vbulletin->db->query_write("
				UPDATE " . TABLE_PREFIX . "user
				SET
					 pcunreadcount = IF(pcunreadcount >= $readpcs, pcunreadcount - $readpcs, 0)
				WHERE
					userid = " . $vbulletin->userinfo['userid']
			);
		}
	}
	$messagestats['perpage'] = $perpage;

	$show['delete'] = fetch_user_picture_message_perm('candeletemessages', $pictureinfo);
	$show['undelete'] = fetch_user_picture_message_perm('canundeletemessages', $pictureinfo);
	$show['approve'] = fetch_user_picture_message_perm('canmoderatemessages', $pictureinfo);
	$show['inlinemod'] = ($show['delete'] OR $show['undelete'] OR $show['approve']);

	return $messagebits;
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:functions_picturecomment.php

示例7: list

        list($invitedgroups) = $vbulletin->db->query_first("\r\n\t\t\tSELECT COUNT(*) FROM " . TABLE_PREFIX . "socialgroupmember WHERE\r\n\t\t\tuserid = " . intval($destinfo['userid']) . "\r\n\t\t\tAND TYPE = 'invited'\r\n\t\t", DBARRAY_NUM);
        $vbulletin->db->query_write("\r\n\t\t\tUPDATE " . TABLE_PREFIX . "user SET\r\n\t\t\tsocgroupinvitecount = " . intval($invitedgroups) . "\r\n\t\t\tWHERE userid = " . intval($destinfo['userid']));
        $groupdm =& datamanager_init("SocialGroup", $vbulletin, ERRTYPE_STANDARD);
        foreach ($groups as $group) {
            $groupdm->set_existing($group);
            $groupdm->rebuild_membercounts();
            $groupdm->rebuild_picturecount();
            $groupdm->save();
            list($pendingcountforowner) = $vbulletin->db->query_first("\r\n\t\t\t\tSELECT SUM(moderatedmembers) FROM " . TABLE_PREFIX . "socialgroup\r\n\t\t\t\tWHERE creatoruserid = " . $group['creatoruserid'], DBARRAY_NUM);
            $vbulletin->db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "user\r\n\t\t\t\tSET socgroupreqcount = " . intval($pendingcountforowner) . "\r\n\t\t\t\tWHERE userid = " . $group['creatoruserid']);
        }
    }
    $db->query_write("\r\n\t\tUPDATE " . TABLE_PREFIX . "album\r\n\t\tSET userid = {$destinfo['userid']}\r\n\t\tWHERE userid = {$sourceinfo['userid']}\r\n\t");
    $db->query_write("\r\n\t\tUPDATE " . TABLE_PREFIX . "picturecomment SET\r\n\t\t\tpostuserid = {$destinfo['userid']},\r\n\t\t\tpostusername = '" . $db->escape_string($destinfo['username']) . "'\r\n\t\tWHERE postuserid = {$sourceinfo['userid']}\r\n\t");
    require_once DIR . '/includes/functions_picturecomment.php';
    build_picture_comment_counters($destinfo['userid']);
    ($hook = vBulletinHook::fetch_hook('useradmin_merge')) ? eval($hook) : false;
    // Remove remnants of source user
    $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
    $userdm->set_existing($sourceinfo);
    $userdm->delete();
    unset($userdm);
    define('CP_BACKURL', '');
    print_stop_message('user_accounts_merged', $sourceinfo['username'], $destinfo['username']);
}
// ###################### Start modify Profile Pic ###########
if ($_REQUEST['do'] == 'profilepic') {
    $userinfo = fetch_userinfo($vbulletin->GPC['userid'], FETCH_USERINFO_PROFILEPIC);
    if (!$userinfo) {
        print_stop_message('invalid_user_specified');
    }
开发者ID:Kheros,项目名称:MMOver,代码行数:31,代码来源:usertools.php

示例8: post_delete

 /**
  * Any code to run after deleting
  *
  * @param	Boolean Do the query?
  */
 function post_delete($doquery = true)
 {
     foreach ($this->lists['content'] as $contenttypeid => $list) {
         if (!($attach =& vB_Attachment_Dm_Library::fetch_library($this->registry, $contenttypeid))) {
             return false;
         }
         $attach->post_delete($this);
         unset($attach);
     }
     // Update the refcount in the filedata table
     if (!empty($this->lists['filedataids'])) {
         $this->registry->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "filedata AS fd\n\t\t\t\tSET fd.refcount = (\n\t\t\t\t\tSELECT COUNT(*)\n\t\t\t\t\tFROM " . TABLE_PREFIX . "attachment AS a\n\t\t\t\t\tWHERE fd.filedataid = a.filedataid\n\t\t\t\t)\n\t\t\t\tWHERE fd.filedataid IN (" . implode(", ", array_keys($this->lists['filedataids'])) . ")\n\t\t\t");
     }
     // Below here only applies to attachments in pictures/groups but I forsee all attachments gaining the ability to have comments
     if ($this->info['type'] == 'filedata') {
         if (!empty($this->lists['filedataids'])) {
             $this->registry->db->query_write("\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment\n\t\t\t\t\tWHERE filedataid IN (" . implode(", ", array_keys($this->lists['filedataids'])) . ")\n\t\t\t\t");
         }
     } else {
         if (!empty($this->lists['picturecomments'])) {
             foreach ($this->lists['picturecomments'] as $sql) {
                 if (!($results = $this->registry->db->query_first("\n\t\t\t\t\tSELECT a.attachmentid\n\t\t\t\t\tFROM " . TABLE_PREFIX . "attachment AS a\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t{$sql}\n\t\t\t\t"))) {
                     $this->registry->db->query_write("\n\t\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "picturecomment\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t{$sql}\n\t\t\t\t\t");
                 }
             }
         }
     }
     require_once DIR . '/includes/functions_picturecomment.php';
     foreach (array_keys($this->lists['userids']) as $userid) {
         build_picture_comment_counters($userid);
     }
     return parent::post_delete($doquery);
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:38,代码来源:class_dm_attachment.php

示例9: post_delete

	/**
	* post_delete function - extend if the contenttype needs to do anything
	*
	* @return	void
	*/
	public function post_delete(&$attachdm)
	{
		$users = array();
		// Update something in the album table...
		if (!empty($this->lists['albumlist']))
		{
			$del_usercss = array();
			$albums = $this->registry->db->query_read("
				SELECT *
				FROM " . TABLE_PREFIX . "album
				WHERE albumid IN (" . implode(",", array_keys($this->lists['albumlist'])) . ")
			");
			while ($album = $this->registry->db->fetch_array($albums))
			{
				$users["$album[userid]"] = 1;
				$albumdata =& datamanager_init('Album', $this->registry, ERRTYPE_SILENT);
				$albumdata->set_existing($album);
				$albumdata->rebuild_counts();

				if (in_array($album['coverattachmentid'], array_keys($this->lists['albumlist']["$album[albumid]"])))
				{
					if ($album['visible'] - 1 > 0)
					{
						$new_cover = $this->registry->db->query_first("
							SELECT
								attachment.attachmentid
							FROM " . TABLE_PREFIX . "attachment AS attachment
							WHERE
								attachment.contentid = $album[albumid]
									AND
								attachment.state = 'visible'
									AND
								contenttypeid = " . intval($attachdm->fetch_field('contenttypeid')) . "
							ORDER BY
								attachment.dateline ASC
							LIMIT 1
						");
					}
					$albumdata->set('coverattachmentid', ($new_cover['attachmentid'] ? $new_cover['attachmentid']: 0));
				}

				$albumdata->save();
			}

			foreach ($this->lists['albumlist'] AS $albumid => $values)
			{
				foreach ($values AS $attachmentid => $foo)
				{
					$del_usercss[] = "$albumid,$attachmentid";
				}
			}

			$this->registry->db->query_write("
				DELETE FROM " . TABLE_PREFIX . "usercss
				WHERE
					property = 'background_image'
						AND
					value IN ('" . implode('\',\'', $del_usercss) . "')
			");
			$attachdm->set_info('have_updated_usercss', ($this->registry->db->affected_rows() > 0));

			require_once(DIR . '/includes/functions_picturecomment.php');
			foreach ($users AS $userid => $foo)
			{
				build_picture_comment_counters($userid);
				($hook = vBulletinHook::fetch_hook('picturedata_delete')) ? eval($hook) : false;
			}
		}
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:74,代码来源:album.php

示例10: post_delete

	/**
	* Any code to run after deleting
	*
	* @param	Boolean Do the query?
	*/
	function post_delete($doquery = true)
	{
		foreach ($this->lists['content'] AS $contenttypeid => $list)
		{
			if (!($attach =& vB_Attachment_Dm_Library::fetch_library($this->registry, $contenttypeid)))
			{
				return false;
			}
			$attach->post_delete($this);
			unset($attach);
		}
		// Update the refcount in the filedata table
		if (!empty($this->lists['filedataids']))
		{
			$this->registry->db->query_write("
				UPDATE " . TABLE_PREFIX . "filedata AS fd
				SET fd.refcount = (
					SELECT COUNT(*)
					FROM " . TABLE_PREFIX . "attachment AS a
					WHERE fd.filedataid = a.filedataid
				)
				WHERE fd.filedataid IN (" . implode(", ", array_keys($this->lists['filedataids'])) . ")
			");
		}
		// Hourly cron job will clean out the FS where refcount = 0 and dateline > 1 hour

		// Below here only applies to attachments in pictures/groups but I forsee all attachments gaining the ability to have comments
		if ($this->info['type'] == 'filedata')
		{
			if (!empty($this->lists['filedataids']))
			{
				$this->registry->db->query_write("
					DELETE FROM " . TABLE_PREFIX . "picturecomment
					WHERE filedataid IN (" . implode(", ", array_keys($this->lists['filedataids'])) . ")
				");
			}
		}
		else if (!empty($this->lists['picturecomments']))	// deletion type is by attachment
		{
			foreach ($this->lists['picturecomments'] AS $sql)
			{
				if (!($results = $this->registry->db->query_first("
					SELECT a.attachmentid
					FROM " . TABLE_PREFIX . "attachment AS a
					WHERE
						$sql
				")))
				{
					$this->registry->db->query_write("
						DELETE FROM " . TABLE_PREFIX . "picturecomment
						WHERE
							$sql
					");
				}
			}
		}

		require_once(DIR . '/includes/functions_picturecomment.php');
		foreach (array_keys($this->lists['userids']) AS $userid)
		{
			build_picture_comment_counters($userid);
		}

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


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