gen($query))
			{
				$pl = new poll;
				$row = $sql->fetch();
				$start_datestamp = $tp->toDate($row['poll_datestamp'], "long");
				$end_datestamp = $tp->toDate($row['poll_end_datestamp'], "long");
				$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
				$link = e107::getUrl()->create('user/profile/view', $uparams);
				$userlink = "" . $row['user_name'] . "";
				$text = $pl->render_poll($row, 'forum', 'oldpolls', true);
				$text .= "
		
		" . LAN_POSTED_BY . " " . $userlink . "
 " . $tp->lanVars(POLLAN_50, array('x' => $start_datestamp, 'y' => $end_datestamp)) . "
		";
				/*	$count = 0;
					$barl = (file_exists(THEME."images/barl.png") ? THEME."images/barl.png" : e_PLUGIN."poll/images/barl.png");
					$barr = (file_exists(THEME."images/barr.png") ? THEME."images/barr.png" : e_PLUGIN."poll/images/barr.png");
					$bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_PLUGIN."poll/images/bar.png");
					foreach($optionArray as $option)
					{
						$text .= "
						
						| ".$tp -> toHTML($option, TRUE, 'TITLE')." | 
						 
						 
						".$percentage[$count]."% [".POL
						LAN_31.": ".$voteArray[$count]."] | 
\n";
						$count++;
					}
			*/
				$text .= e107::getComment()->compose_comment('poll', 'comment', intval($row['poll_id']), null, '', false, 'html');
				$ns->tablerender(LAN_PLUGIN_POLL_NAME . " #" . $row['poll_id'], $text);
				echo "
";
			}
		}
		// Render List of Polls.
		$query = "SELECT p.*, u.user_name FROM #polls AS p
		LEFT JOIN #user AS u ON p.poll_admin_id = u.user_id
		WHERE p.poll_type=1
		ORDER BY p.poll_datestamp DESC";
		if(!$array = $sql->retrieve($query, true))
		{
			$ns->tablerender(POLLAN_28, "" . LAN_NO_RECORDS_FOUND . "
");
			return null;
		}
		$array = array_slice($array, 1);
		if(empty($array))
		{
			$ns->tablerender(POLLAN_28, "" . LAN_NO_RECORDS_FOUND . "
");
			return null;
		}
		$text = "
		
			
			
			
		
		
		| " . LAN_TITLE . " | " . LAN_POSTED_BY . " | " . LAN_ACTIVE . " | 
\n";
		foreach($array as $row)
		{
			$from = $tp->toDate($row['poll_datestamp'], "short");
			$to = $tp->toDate($row['poll_end_datestamp'], "short");
			$poll_title = $tp->toHTML($row['poll_title'], true, 'TITLE');
			$uparams = array('id' => $row['poll_admin_id'], 'name' => $row['user_name']);
			$link = e107::getUrl()->create('user/profile/view', $uparams);
			$userlink = "" . $row['user_name'] . "";
			$text .= "
		
		
		
		
\n";
		}
		$text .= "
";
		e107::getRender()->tablerender(POLLAN_28, $text);
	}
}
require_once(HEADERF);
oldpolls_front::init();
require_once(FOOTERF);