Ejemplo n.º 1
0
	if (!file_exists(ROOT . '/cache/rss/0.xml')) {
		RSSOut::stop();
	}

	$action = $accessInfo['action'];
	$config = new Settings;

	header('Content-Type: text/xml; charset=utf-8');

	if(Validator::getBool($config->useRssOut)===true) {
		switch($action) {
			case 'focus':
				RSSOut::refresh('focus', false);
			break;
			case 'category':
				
				requireComponent('Bloglounge.Data.Category');
				$category = Category::getByName(urldecode($accessInfo['value']));
				RSSOut::refresh('category', false, $category);
			break;
			default: // recent
				RSSOut::refresh('recent',false);
			break;
		}
	} else {
		// error
		$fp = fopen(ROOT . "/cache/rss/0.xml", 'r+');
		$result = fread($fp, filesize(ROOT . "/cache/rss/0.xml"));
		fclose($fp);
	}
?>
		function delete($itemId) {
			global $database, $db;
			list($feedId, $permalink) = FeedItem::gets($itemId, 'feed,permalink');
			if (!$db->execute("INSERT INTO {$database['prefix']}DeleteHistory (feed, permalink) VALUES ('$feedId', '$permalink')"))
				return false;

			requireComponent('LZ.PHP.Media');
			Media::delete($itemId);
			
			

			requireComponent('Bloglounge.Data.Category');
			$result = $db->queryAll('SELECT category FROM '.$database['prefix'].'Categoryrelations WHERE item = ' . $itemId,MYSQL_ASSOC);
			$categoryIds = array();
			foreach($result as $item) {
				array_push($categoryIds, $item['category']);
			}

			$categoryIds = array_unique($categoryIds);
			
			$db->execute("DELETE FROM {$database['prefix']}CategoryRelations WHERE item = {$itemId}"); // clear CategoryRelations
			
			requireComponent('Bloglounge.Data.Groups');

			$db->execute("DELETE FROM {$database['prefix']}TagRelations WHERE item = {$itemId}"); // clear TagRelations
			if ($db->execute('DELETE FROM '.$database['prefix'].'FeedItems WHERE id='.$itemId)) {
				if (Validator::getBool(Settings::get('useRssOut'))) {
					requireComponent('Bloglounge.Data.RSSOut');
					RSSOut::refresh();
				}
				
				foreach($categoryIds as $categoryId) {
					Category::rebuildCount($categoryId);
				}

				return true;
			} else {
				return false;
			}
		}