Ejemplo n.º 1
0
		function upReturn($itemId) {
			global $database, $db, $session;
			
			$userid = $session['id'];
			$ip = $_SERVER['REMOTE_ADDR'];

			if (isLoggedIn()) {
				if(Boom::isBoomedUp($itemId, 'userid', $userid)) {  
				$db->execute('DELETE FROM '.$database['prefix'].'Booms WHERE feeditem = '.$itemId.' AND type="up" AND userid="'.$userid.'"');
				} else return false;
			} else {
				if(Boom::isBoomedUp($itemId, 'ip', $ip)) {  
					$db->execute('DELETE FROM '.$database['prefix'].'Booms WHERE feeditem = '.$itemId.' AND type="up" AND ip="'.$ip.'"');
				} else return false;
			}			

			$db->execute('UPDATE '.$database['prefix'].'FeedItems SET boomUp=boomUp-1 WHERE id="'.$itemId.'"');
			if ($db->affectedRows() == 0)
				return false;

			return true;
		}
Ejemplo n.º 2
0
	}

	if (!Validator::is_digit($_POST['itemId'])) {
		$response['error'] = 1;
		$response['message'] = 'illegal id';
	}
	$itemId = $_POST['itemId'];

	switch($_POST['direction']) {
		case 'up':				
			if (isLoggedIn()) {
				$userid = $session['id'];
				$boomedUp = Boom::isBoomedUp($itemId, 'userid', $userid);	
			} else {
				$ip = $_SERVER['REMOTE_ADDR'];
				$boomedUp = Boom::isBoomedUp($itemId, 'ip', $ip);	
			}			

			if ($boomedUp ) {
				Boom::upReturn($itemId);
				$response['message'] = 'isntBoomedUp';	

				$response['rank'] = Boom::getRank($itemId);		
				list($boomUp,$boomDown,$boomCount) = Boom::getBoomCount($itemId);
				$response['boom_up_count'] = $boomUp;
				$response['boom_down_count'] = $boomDown;
				$response['boom_count'] = $boomCount;
			} else {

				if (!Boom::up($itemId)) {
					$response['error'] = 1;
Ejemplo n.º 3
0
		$skin->replace('description', $event->on('Text.linker.description', $post_description));
		$skin->replace('blogname', UTF8::clear(Feed::get($linker_post['feed'], 'title')));
		$skin->replace('blogurl', htmlspecialchars(Feed::get($linker_post['feed'], 'blogURL')));
	
		$skin->replace('boom_rank', Boom::getRank($linker_post['id']));				
		$skin->replace('boom_rank_id', 'boomRank'.$linker_post['id']);
		$skin->replace('boomup_count', $linker_post['boomUp']);		
		$skin->replace('boomdown_count', $linker_post['boomDown']);		

		$skin->replace('boomup_onclick', 'javascript: boom(\''.$linker_post['id'].'\',\'up\');');
		$skin->replace('boomdown_onclick', 'javascript: boom(\''.$linker_post['id'].'\',\'down\');');

		$skin->replace('boomup_id', 'boomUp'.$linker_post['id']);
		$skin->replace('boomdown_id', 'boomDown'.$linker_post['id']);

		$boomedUp = Boom::isBoomedUp($linker_post['id']);
		$boomedDown = Boom::isBoomedDown($linker_post['id']);

		$skin->replace('boomup_class', (($boomedUp)?'isBoomedUp':'isntBoomedUp'));
		$skin->replace('boomdown_class', (($boomedDown)?'isBoomedDown':'isntBoomedDown'));

		$tags = $event->on('Data.linker.tags', func::array_trim(explode(',', $linker_post['tags'])));
		if (count($tags) > 1) {
			$s_tags = '';
			$src_tags = $skin->cutSkinTag('tags_rep');
			foreach ($tags as $tag) {
				if ($tag == $category) continue;
				$sp_tags = $skin->replace('tag_link', htmlspecialchars($service['path'].'/?tag='.urlencode(trim($tag))), $src_tags);
				$sp_tags = $skin->replace('tag_name', UTF8::clear($tag), $sp_tags);
				$s_tags .= $sp_tags;
				$sp_tags = '';
Ejemplo n.º 4
0
			$sp_post = $skin->parseTag('boomdown_onclick', 'boom(\''.$post['id'].'\',\'down\');', $sp_post);

			$sp_post = $skin->parseTag('boomup_id', 'boomUp'.$post['id'], $sp_post);
			$sp_post = $skin->parseTag('boomdown_id', 'boomDown'.$post['id'], $sp_post);

			$boomedUp = Boom::isBoomedUp($post['id']);
			$boomedDown = Boom::isBoomedDown($post['id']);
			
			$userid = $session['id'];
			$ip = $_SERVER['REMOTE_ADDR'];

			if (isLoggedIn()) {
				$boomedUp = Boom::isBoomedUp($post['id'], 'userid', $userid);	
				$boomedDown = Boom::isBoomedDown($post['id'], 'userid', $userid);
			} else {
				$boomedUp = Boom::isBoomedUp($post['id'], 'ip', $ip);	
				$boomedDown = Boom::isBoomedDown($post['id'], 'ip', $ip);
			}			

			$sp_post = $skin->parseTag('boomup_class', (($boomedUp)?'isBoomedUp':'isntBoomedUp'), $sp_post);
			$sp_post = $skin->parseTag('boomdown_class', (($boomedDown)?'isBoomedDown':'isntBoomedDown'), $sp_post);

			$tags = $event->on('Data.postTags', func::array_trim(explode(',', $post['tags'])));
			if (count($tags) > 1) {
				$s_tags = '';
				$src_tags = $skin->cutSkinTag('tags_rep');
				foreach ($tags as $tag) {
					if ($tag == $post_category) continue;
					$sp_tags = $skin->parseTag('tag_link', htmlspecialchars($service['path'].'/?tag='.urlencode(trim($tag))), $src_tags);
					$sp_tags = $skin->parseTag('tag_name', UTF8::clear(trim($tag)), $sp_tags);
					$s_tags .= $sp_tags;
Ejemplo n.º 5
0
					$sp_posts = $skin->parseTag('boomdown_onclick', 'boom(\''.$item['id'].'\',\'down\');', $sp_posts);

					$sp_posts = $skin->parseTag('boomup_id', 'boomUp'.$item['id'], $sp_posts);
					$sp_posts = $skin->parseTag('boomdown_id', 'boomDown'.$item['id'], $sp_posts);

					$boomedUp = Boom::isBoomedUp($item['id']);
					$boomedDown = Boom::isBoomedDown($item['id']);
					
					$userid = $session['id'];
					$ip = $_SERVER['REMOTE_ADDR'];

					if (isLoggedIn()) {
						$boomedUp = Boom::isBoomedUp($item['id'], 'userid', $userid);	
						$boomedDown = Boom::isBoomedDown($item['id'], 'userid', $userid);
					} else {
						$boomedUp = Boom::isBoomedUp($item['id'], 'ip', $ip);	
						$boomedDown = Boom::isBoomedDown($item['id'], 'ip', $ip);
					}			

					$sp_posts = $skin->parseTag('boomup_class', (($boomedUp)?'isBoomedUp':'isntBoomedUp'), $sp_posts);
					$sp_posts = $skin->parseTag('boomdown_class', (($boomedDown)?'isBoomedDown':'isntBoomedDown'), $sp_posts);

					$tags = $event->on('Data.postTags', func::array_trim(explode(',', $item['tags'])));
					if (count($tags) > 1) {
						$s_tags = '';
						$src_tags = $skin->cutSkinTag('tags_rep');
						foreach ($tags as $tag) {
							if ($tag == $post_category) continue;
							$sp_tags = $skin->parseTag('tag_link', $event->on('Text.postTagLink',htmlspecialchars($service['path'].'/?tag='.urlencode(trim($tag)))), $src_tags);
							$sp_tags = $skin->parseTag('tag_name', UTF8::clear(trim($tag)), $sp_tags);
							$s_tags .= $sp_tags;