CoreFiles by mySites.guru
helper.php59 lines, 1,462 bytes, from Joomla_1.5.2-Stable-Full_Package.zip
Raw History Compare with 1.5.1
md5
11b5ff7f0b5c60a6a356de3645f35d5d
sha1
04633339dc0455c8b704fe914472bc3e8cc42f14
sha256
dfe8e086b3991c3e1c3752a9c3e4dd3b0552f2ff5b6e137521f760221ea09963
<?php
/**
* @version		$Id: helper.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package		Joomla
* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

class modPollHelper
{
	function getPoll($id)
	{
		$db		=& JFactory::getDBO();
		$result	= null;

		$query = 'SELECT id, title,'
			.' CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug '
			.' FROM #__polls'
			.' WHERE id = '.(int) $id
			.' AND published = 1'
			;
		$db->setQuery($query);
		$result = $db->loadObject();

		if ($db->getErrorNum()) {
			JError::raiseWarning( 500, $db->stderr() );
		}

		return $result;
	}

	function getPollOptions($id)
	{
		$db	=& JFactory::getDBO();

		$query = 'SELECT id, text' .
			' FROM #__poll_data' .
			' WHERE pollid = ' . (int) $id .
			' AND text <> ""' .
			' ORDER BY id';
		$db->setQuery($query);

		if (!($options = $db->loadObjectList())) {
			echo "MD ".$db->stderr();
			return;
		}

		return $options;
	}
}
?>

The same content is in 4 releases, Joomla 1.5.0 to 1.5.3. See them all, or every version of this file.