Page 1 of 9

[RC] Portalview v1.0.0RC2

Posted: 6. December 2008 17:21
by Christian_N
Addon: Portalview
Addon-Version: [REL] 1.0.0RC2
Addon-Description:
Portalview like Board3 for your phpBB3.
Addon-Requirements: board3 Portal v1.0.4 (to download)

Addon-Authors: Christian_N
Addon-Download: Download Block v1.0.0RC2

phpBB-Version: 3.0.5
phpBB-Styles: prosilver, subsilver2

BugTracker: http://www.phpbb-projekt.de/tracker.php?p=3

Please don't upload the mod anywhere (to offer it as a download), without asking me before, thanks.

Re: MOD Portalview RC1

Posted: 6. December 2008 17:44
by Kevin
Demo: ** Link entfernt **

Re: MOD Portalview RC1

Posted: 13. December 2008 08:29
by dragz
Thanks. I need this so bad :D

Re: MOD Portalview RC1

Posted: 26. December 2008 15:15
by Jemme
I just installed this mod and it works nicely with one exception. On the portal page I don't have the blocks on the right anymore... How do I get those back?

FYI, the board is here: http://www.mx-5club.be/forum

Re: MOD Portalview RC1

Posted: 26. December 2008 20:43
by Dyo
You have an error relatet to the poll-block.
Have a look at all changes made relatet to this block and the scripts, maybe a copypaste-error or so mething else.

regards

dyo

Re: MOD Portalview RC1

Posted: 8. January 2009 16:26
by Fieke
Hi,

I do have the same error, no right blocks and I have checked several times if I have copied and pasted right, cannot find mistakes regarding that.

Parse error: syntax error, unexpected $end in /home/dscrapping/domains/digitalscrapping.eu/public_html/forum2/cache/tpl_prosilver_portal.block.poll.html.php on line 64

When I delete the file tpl_prosilver_portal.block.poll.html.php through FTP and I refresh the portal page, I DO have the right blocks...but when I then refresh again, they are gone again.

So somehow it works OK - but there is a flaw somewhere. How else can it be possible for me to sometimes have the blocks show up, and after refreshing I see they're gone again. I doubt this could be a copy/paste error, because in that case they would NEVER show up.

Could you please help me figuring out how to solve this? Thanks in advance for your time!

Kind regards,

Fieke

Re: MOD Portalview RC1

Posted: 8. January 2009 17:21
by Fieke
I have found the "problem" - in your install.xml there is a small mistake. See the post below,

viewtopic.php?f=31&t=1355

where you state the following:

Code: Select all

open portal/block/poll.php

find:
Code: Select all
          'S_HAS_POLL' => $has_poll,


replace with:
Code: Select all
          'S_PORTAL_HAS_POLL' => $has_poll,


open styles/prosilver/template/portal/block/poll.html

find:
Code: Select all
       <!-- IF S_HAS_POLL -->

***replace with:***
Code: Select all
       <!-- IF S_PORTAL_HAS_POLL -->
whereas in your actual install.xml that is in the download, you state the following:

Code: Select all

Open: styles/prosilver/template/portal/block/poll.html

Find
Tip: This may be a partial find and not the whole line.
Code:Select All

   <!-- IF S_HAS_POLL -->

***Add after***

Tip: Add these lines on a new blank line after the preceding line(s) to find.
Code:Select All

   <!-- IF S_PORTAL_HAS_POLL -->
I have now used replace instead of add after, and my blocks are back again and don't go away anymore after I refresh the page.

Hopefully this helps others who have bumped into the same problem. You might want to change that line in the install.xml ;)

Kind regards,

Fieke

Re: MOD Portalview RC1

Posted: 8. January 2009 17:34
by Dyo
Many Thanks, to figure out the error.
It will be changed in the release 1.0.0.

The release will come online the next few weeks.

Regards

Dyo

Re: MOD Portalview RC1

Posted: 12. January 2009 02:34
by everton1995
I still get the same problem after replacing the lines instead of adding....

Can someone post a working poll.php & a working poll.html please...........

Re: MOD Portalview RC1

Posted: 12. January 2009 14:01
by Dyo
Sorry, but I don't have these files without a lot of other changes at the moment.

Please have a look at poll.php if there is the same error as described in poll.html
Tomoroow I'll set up a new board with this MOD so than I can tell you if there is a bug.

Regards

Dyo

Re: MOD Portalview RC1

Posted: 12. January 2009 14:39
by everton1995
This is my poll.php

Code: Select all

<?php
/*
*
* @package - Board3portal
* @version $Id: poll.php 358 2008-08-31 18:22:03Z kevin74 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
{
	die('Hacking attempt');
	exit;
}

/**
* @ignore
*/

$user->add_lang('viewtopic');

$view = request_var('view', '');
$update = request_var('update', false);
$poll_view = request_var('polls', '');

$poll_view_ar = ( strpos(urldecode($poll_view), ',') !== FALSE ) ? explode(',', urldecode($poll_view)) : (($poll_view != '') ? array($poll_view) : array());

if ($update && $portal_config['portal_poll_allow_vote'])
{
	$up_topic_id = request_var('t', 0);
	$up_forum_id = request_var('f', 0);
	$voted_id = request_var('vote_id', array('' => 0));

	$cur_voted_id = array();
	if ($user->data['is_registered'])
	{
		$sql = 'SELECT poll_option_id
			FROM ' . POLL_VOTES_TABLE . '
			WHERE topic_id = ' . $up_topic_id . '
				AND vote_user_id = ' . $user->data['user_id'];
		$result = $db->sql_query($sql);

		while ($row = $db->sql_fetchrow($result))
		{
			$cur_voted_id[] = $row['poll_option_id'];
		}
		$db->sql_freeresult($result);
	}
	else
	{
		// Cookie based guest tracking ... I don't like this but hum ho
		// it's oft requested. This relies on "nice" users who don't feel
		// the need to delete cookies to mess with results.
		if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $up_topic_id]))
		{
			$cur_voted_id = explode(',', $_COOKIE[$config['cookie_name'] . '_poll_' . $up_topic_id]);
			$cur_voted_id = array_map('intval', $cur_voted_id);
		}
	}

	$sql = 'SELECT t.poll_length, t.poll_start, t.poll_vote_change, t.topic_status, f.forum_status, t.poll_max_options
			FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
			WHERE t.forum_id = f.forum_id AND t.topic_id = " . (int) $up_topic_id . " AND t.forum_id = " . (int) $up_forum_id;
	$result = $db->sql_query_limit($sql, 1);
	$topic_data = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	$s_can_up_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $up_forum_id)) ||
		($auth->acl_get('f_votechg', $up_forum_id) && $topic_data['poll_vote_change'])) &&
		(($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
		$topic_data['topic_status'] != ITEM_LOCKED &&
		$topic_data['forum_status'] != ITEM_LOCKED) ? true : false;

	if( $s_can_up_vote )
	{
		if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id))
		{
			$redirect_url = append_sid("./portal.$phpEx");
	
			meta_refresh(5, $redirect_url);
			if (!sizeof($voted_id))
			{
				$message = 'NO_VOTE_OPTION';
			}
			else if (sizeof($voted_id) > $topic_data['poll_max_options'])
			{
				$message = 'TOO_MANY_VOTE_OPTIONS';
			}
			else
			{
				$message = 'VOTE_CONVERTED';
			}
	
			$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_PORTAL'], '<a href="' . $redirect_url . '">', '</a>');
			trigger_error($message);
		}
	
		foreach ($voted_id as $option)
		{
			if (in_array($option, $cur_voted_id))
			{
				continue;
			}
	
			$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
				SET poll_option_total = poll_option_total + 1
				WHERE poll_option_id = ' . (int) $option . '
					AND topic_id = ' . (int) $up_topic_id;
			$db->sql_query($sql);
	
			if ($user->data['is_registered'])
			{
				$sql_ary = array(
					'topic_id'			=> (int) $up_topic_id,
					'poll_option_id'	=> (int) $option,
					'vote_user_id'		=> (int) $user->data['user_id'],
					'vote_user_ip'		=> (string) $user->ip,
				);
	
				$sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
				$db->sql_query($sql);
			}
		}
	
		foreach ($cur_voted_id as $option)
		{
			if (!in_array($option, $voted_id))
			{
				$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
					SET poll_option_total = poll_option_total - 1
					WHERE poll_option_id = ' . (int) $option . '
						AND topic_id = ' . (int) $up_topic_id;
				$db->sql_query($sql);
	
				if ($user->data['is_registered'])
				{
					$sql = 'DELETE FROM ' . POLL_VOTES_TABLE . '
						WHERE topic_id = ' . (int) $up_topic_id . '
							AND poll_option_id = ' . (int) $option . '
							AND vote_user_id = ' . (int) $user->data['user_id'];
					$db->sql_query($sql);
				}
			}
		}
	
		if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot'])
		{
			$user->set_cookie('poll_' . $up_topic_id, implode(',', $voted_id), time() + 31536000);
		}
	
		$sql = 'UPDATE ' . TOPICS_TABLE . '
			SET poll_last_vote = ' . time() . "
			WHERE topic_id = $up_topic_id";
		//, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now
		$db->sql_query($sql);
	
		$redirect_url = append_sid("./portal.$phpEx");
	
		meta_refresh(5, $redirect_url);
		trigger_error($user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf($user->lang['RETURN_PORTAL'], '<a href="' . $redirect_url . '">', '</a>'));
	}
}

$where = '';
$poll_forums = false;

if( $portal_config['portal_poll_topic_id'] !== '' )
{
	$poll_forums_config  = explode(',' ,$portal_config['portal_poll_topic_id']);
	foreach($poll_forums_config as $poll_forum )
	{
		if ( is_numeric(trim($poll_forum)) === TRUE )
		{
			$poll_forum = (int) trim($poll_forum);
			if( $auth->acl_get('f_read', $poll_forum) )
			{
				$poll_forums = true;
				$where .= ($where == "") ? "t.forum_id = '{$poll_forum}'" : " OR t.forum_id = '{$poll_forum}'";
			}
		}
	}
}
else
{
	$forum_list = $auth->acl_getf('f_read', true);

	foreach($forum_list as $pf => $pf_data )
	{
		$pf = (int) trim($pf);
		$poll_forums = true;
		$where .= ($where == "") ? "t.forum_id = '{$pf}'" : " OR t.forum_id = '{$pf}'";
	}
}

$where = ($where !== '') ? "AND ({$where})" : '';

if( $poll_forums === TRUE )
{
	
	$sql = 'SELECT t.poll_title, t.poll_start, t.topic_id,  t.topic_first_post_id, t.forum_id, t.poll_length, t.poll_vote_change, t.poll_max_options, t.topic_status, f.forum_status, p.bbcode_bitfield, p.bbcode_uid
			FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
			WHERE t.forum_id = f.forum_id AND t.topic_approved = 1 AND t.poll_start > 0
			{$where}
			AND t.topic_moved_id = 0
			AND p.post_id = t.topic_first_post_id
			ORDER BY t.poll_start DESC";

	$limit = ( isset($portal_config['portal_poll_limit']) ) ? $portal_config['portal_poll_limit'] : 3;

	$result = $db->sql_query_limit($sql, $limit);
	
	$has_poll = false;

	if ($result)
	{
		
		while( $data = $db->sql_fetchrow($result) )
		{
			$has_poll = true;
			$poll_has_options = false;

			$topic_id = (int) $data['topic_id'];
			$forum_id = (int) $data['forum_id'];

			$cur_voted_id = array();
			if( $portal_config['portal_poll_allow_vote'] )
			{
				if ($user->data['is_registered'])
				{
					$vote_sql = 'SELECT poll_option_id
						FROM ' . POLL_VOTES_TABLE . '
						WHERE topic_id = ' . $topic_id . '
							AND vote_user_id = ' . $user->data['user_id'];
					$vote_result = $db->sql_query($vote_sql);
				
					while ($row = $db->sql_fetchrow($vote_result))
					{
						$cur_voted_id[] = $row['poll_option_id'];
					}
					$db->sql_freeresult($vote_result);
				}
				else
				{
					// Cookie based guest tracking ... I don't like this but hum ho
					// it's oft requested. This relies on "nice" users who don't feel
					// the need to delete cookies to mess with results.
					if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]))
					{
						$cur_voted_id = explode(',', $_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]);
						$cur_voted_id = array_map('intval', $cur_voted_id);
					}
				}
	
				$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
					($auth->acl_get('f_votechg', $forum_id) && $data['poll_vote_change'])) &&
					(($data['poll_length'] != 0 && $data['poll_start'] + $data['poll_length'] > time()) || $data['poll_length'] == 0) &&
					$data['topic_status'] != ITEM_LOCKED &&
					$data['forum_status'] != ITEM_LOCKED) ? true : false;
			} else {
				$s_can_vote = false;
			}

			$s_display_results = ( !$s_can_vote || ( $s_can_vote && sizeof($cur_voted_id) ) || ( $view == 'viewpoll' && in_array($topic_id, $poll_view_ar) ) ) ? true : false;

			$poll_sql = 'SELECT po.poll_option_id, po.poll_option_text, po.poll_option_total
				FROM ' . POLL_OPTIONS_TABLE . " po
				WHERE po.topic_id = {$topic_id}
				ORDER BY po.poll_option_id";

			$poll_result = $db->sql_query($poll_sql);
			
			$poll_total_votes = 0;

			$poll_data = array();

			if ($poll_result)
			{
				while( $polls_data = $db->sql_fetchrow($poll_result) )
				{
					$poll_has_options = true;
					$poll_data[] = $polls_data;
					$poll_total_votes += $polls_data['poll_option_total'];
				}
			}

			$db->sql_freeresult($poll_result);
			
			$make_poll_view = array();
			
			if( in_array($topic_id, $poll_view_ar) === FALSE )
			{
				$make_poll_view[] = $topic_id;
				$make_poll_view = array_merge($poll_view_ar, $make_poll_view);
			}
			
			$poll_view_str = urlencode( implode(',', $make_poll_view) );

			$portalpoll_url= append_sid("./portal.$phpEx", "polls=$poll_view_str");
			$portalvote_url= append_sid("./portal.$phpEx", "f=$forum_id&t=$topic_id");
			$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id");

			$poll_end = $data['poll_length'] + $data['poll_start'];
			
// Parse BBCode title

			if ($data['bbcode_bitfield'])
			{
				$poll_bbcode = new bbcode();
			}
			else
			{
				$poll_bbcode = false;
			}

			$data['poll_title'] = censor_text($data['poll_title']);

			if ($poll_bbcode !== false)
			{
				$poll_bbcode->bbcode_second_pass($data['poll_title'], $data['bbcode_uid'], $data['bbcode_bitfield']);
			}

			$data['poll_title'] = bbcode_nl2br($data['poll_title']);
			$data['poll_title'] = smiley_text($data['poll_title']);
			unset($poll_bbcode);			

			$template->assign_block_vars('poll', array(
				'S_POLL_HAS_OPTIONS' => $poll_has_options,
				'POLL_QUESTION' => $data['poll_title'],
				'U_POLL_TOPIC' => append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $topic_id . '&f=' . $forum_id),
				'POLL_LENGTH' => $data['poll_length'],
				'TOPIC_ID' => $topic_id,

				'TOTAL_VOTES' 		=> $poll_total_votes,
		
				'L_MAX_VOTES'		=> ($data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $data['poll_max_options']),
				'L_POLL_LENGTH'		=> ($data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '',
		
				'S_CAN_VOTE'		=> $s_can_vote,
				'S_DISPLAY_RESULTS'	=> $s_display_results,
				'S_IS_MULTI_CHOICE'	=> ($data['poll_max_options'] > 1) ? true : false,
				'S_POLL_ACTION'		=> $portalvote_url,
		
				'U_VIEW_RESULTS'   => $portalpoll_url . '&view=viewpoll#viewpoll',
				'U_VIEW_TOPIC'		=> $viewtopic_url
			));

			foreach($poll_data as $pd)
			{
				$option_pct = ($poll_total_votes > 0) ? $pd['poll_option_total'] / $poll_total_votes : 0;
				$option_pct_txt = sprintf("%.1d%%", ($option_pct * 100));
				
			// Parse BBCode option text

			if ($data['bbcode_bitfield'])
			{
				$poll_bbcode = new bbcode();
			}
			else
			{
				$poll_bbcode = false;
			}

			$pd['poll_option_text'] = censor_text($pd['poll_option_text']);

			if ($poll_bbcode !== false)
			{
				$poll_bbcode->bbcode_second_pass($pd['poll_option_text'], $data['bbcode_uid'], $data['bbcode_bitfield']);
			}

			$pd['poll_option_text'] = bbcode_nl2br($pd['poll_option_text']);
			$pd['poll_option_text'] = smiley_text($pd['poll_option_text']);
			unset($poll_bbcode);				

				$template->assign_block_vars('poll.poll_option', array(
					'POLL_OPTION_ID' 		=> $pd['poll_option_id'],
					'POLL_OPTION_CAPTION' 	=> $pd['poll_option_text'],
					'POLL_OPTION_RESULT' 	=> $pd['poll_option_total'],
					'POLL_OPTION_PERCENT' 	=> $option_pct_txt,
					'POLL_OPTION_PCT'		=> round($option_pct * 100),
					'POLL_OPTION_IMG' 		=> $user->img('poll_center', $option_pct_txt, round($option_pct * 250)),
					'POLL_OPTION_VOTED'		=> (in_array($pd['poll_option_id'], $cur_voted_id)) ? true : false
				));
			}
		}
	}		

	$db->sql_freeresult($result);

	$template->assign_vars(array(
		'S_DISPLAY_POLL' => true,
                'S_PORTAL_HAS_POLL' => $has_poll,
		'POLL_LEFT_CAP_IMG'	=> $user->img('poll_left'),
		'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
	));
}

?>
As you can see 'S_PORTAL_HAS_POLL' => $has_poll, has replaced <!-- IF S_HAS_POLL -->


...........and this is my poll.html which also has the edit.

(SECTION)

Code: Select all

<!--version $Id: poll.html 358 2008-08-31 18:22:03Z kevin74 $ //-->
<a name="viewpoll"></a>
<div class="forabg"><span class="corners-top"><span></span></span>
	<ul class="topiclist">
		<li class="header"><dl><dt>{L_POLL}</dt></dl></li>
	</ul>
<!-- IF S_PORTAL_HAS_POLL -->

	<div class="panel">
		<div class="inner">
		<!-- BEGIN poll -->
Im not sure whats happening but I still nave no right side blocks, and only 1 or two on the left...........any ideas?

Re: MOD Portalview RC1

Posted: 23. January 2009 20:04
by Silkdream
Hallo
Mod eingebaut aber sieht grausig aus wie bekommt man den Forumsteil wieder auf Normale Größe, zur Zeit wird das Forum gestaucht wenn die Boxen Links und Rechts sind?

Re: MOD Portalview RC1

Posted: 23. January 2009 20:17
by everton1995
Silkdream wrote:Hallo
Mod eingebaut aber sieht grausig aus wie bekommt man den Forumsteil wieder auf Normale Größe, zur Zeit wird das Forum gestaucht wenn die Boxen Links und Rechts sind?

?????????????????????????????????

Re: MOD Portalview RC1

Posted: 23. January 2009 22:52
by amroth
Funzt diese Mod auch bei WoWMoonclaw ?

Oder wie kann ich sie bei WoWMoonclaw einbinden?

Re: MOD Portalview RC1

Posted: 8. February 2009 00:37
by derkubi
Habe auch einen Fehler in einem neuen Testboard :

Im Portal sieht alles normal aus , klicke ich aber z.B. auf ein Forum dann fehlen Blocks teilweise wie Calendarblock On Portal
oder ganz wie Custom Small Block (das Youtubevideo )

Im Portal
http://derkubi.de.funpic.de/bilder/fehlerpv1.gif
Anzeige von Beiträgen
http://derkubi.de.funpic.de/bilder/fehlerpv2.gif