<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : Poll</title>
		<link>https://www.cotonti.com</link>
		<description>Neueste Themenbeiträge</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Sat, 16 May 2026 00:51:32 -0000</pubDate>

		<item>
			<title>Trustmaster</title>
			<description><![CDATA[Great contribution! I eliminated corehacks and made it a new &quot;recentpolls&quot; plugin.]]></description>
			<pubDate>Fr, 29 Aug 2008 19:06:23 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=357&d=0#post665]]></link>
		</item>
		<item>
			<title>Trustmaster</title>
			<description><![CDATA[Thanks <strong>oc</strong>, I will check it, test it and include in N-0.0.1. Probably it will be a &quot;recentpolls&quot; plugin because we want to split recentitems into 3 plugins: recentpages, recenttopics and recentpolls.]]></description>
			<pubDate>Fr, 29 Aug 2008 09:38:22 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=357&d=0#post660]]></link>
		</item>
		<item>
			<title>oc</title>
			<description><![CDATA[(If I posted this in the wrong section, sorry. I didn't know where to post)<br />
<br />
This is the only contribution I made so far for this community, sorry Trustmaster, sorry all.<br />
<br />
This is basically an ajax poll with a core hack and some stupid effects I saw on the other sites and see no reason to not to steal the ideas. Inspired by JQuery plugins, thanks whoever did it, but code belongs to me, I found out it is bullshit to code that much,<br />
<br />
Normal plugins would have create queries and pick up datas one by one, but I tested it, and this is faster.<br />
<br />
--This is a core hack. I will never release another plugin about this, this is 2008  my babies :)<br />
-I know Trustmaster stopped believing me doing something about this, but I simplified the code, I am using this also in my personal site, so I believe this is bug-free. <br />
-Use UTF8 (without bom)<br />
-Also you need JQuery.<br />
<br />
Well, the code is:<br />
<br />
<em>plugins/recentitems/recentsitems.php</em> -- change the whole poll function with:<br />
<pre class="code">/* ------------------ */
function sed_get_latestpolls($limit, $mask)
	{
	global $L, $db_polls, $db_polls_voters, $db_polls_options, $usr, $plu_empty;

	require(&quot;plugins/recentitems/lang/recentitems.en.lang.php&quot;);
	
	$sql_p = sed_sql_query(&quot;SELECT poll_id, poll_text FROM $db_polls WHERE 1 AND poll_state=0  AND poll_type=0 ORDER by poll_creationdate DESC LIMIT $limit&quot;);

	while ($row_p = sed_sql_fetcharray($sql_p))
		{
		unset($res);
		$poll_id = $row_p&#091;'poll_id'&#093;;

		if ($usr&#091;'id'&#093;&gt;0)
	 		{ $sql2 = sed_sql_query(&quot;SELECT pv_id FROM $db_polls_voters WHERE pv_pollid='$poll_id' AND (pv_userid='&quot;.$usr&#091;'id'&#093;.&quot;' OR pv_userip='&quot;.$usr&#091;'ip'&#093;.&quot;') LIMIT 1&quot;); }
	       else
	 		{ $sql2 = sed_sql_query(&quot;SELECT pv_id FROM $db_polls_voters WHERE pv_pollid='$poll_id' AND pv_userip='&quot;.$usr&#091;'ip'&#093;.&quot;' LIMIT 1&quot;); }

		if (sed_sql_numrows($sql2)&gt;0)
			{
			$alreadyvoted =1;
			$sql2 = sed_sql_query(&quot;SELECT SUM(po_count) FROM $db_polls_options WHERE po_pollid='$poll_id'&quot;);
			$totalvotes = sed_sql_result($sql2,0,&quot;SUM(po_count)&quot;);
			}
		else
			{ $alreadyvoted =0; }


		$res .= (!$alreadyvoted) ? &quot;&lt;script type=\&quot;text/javascript\&quot;&gt;

function postp()
	{

		var id = $(\&quot;input&#091;@name='id'&#093;\&quot;).attr(\&quot;value\&quot;);
		var a = $(\&quot;input&#091;@name='a'&#093;\&quot;).attr(\&quot;value\&quot;);
		var vote = $(\&quot;input&#091;@name='vote'&#093;:checked\&quot;).attr(\&quot;value\&quot;);


	$.ajax({
		type: 'GET',
		url: 'polls.php?',
		data: 'id='+id+'&amp;a='+a+'&amp;vote='+vote+'&amp;mode=ajax',

		beforeSend: function(){
			if (!vote) {
			alert('&quot;.$L_idx&#091;'vote_opt'&#093;.&quot;');
			return false;
			}
			$('#poll-container').addClass('loading');
			},

		success: function(msg){
		$('#poll-container').removeClass('loading');
		$('#poll-container').html(msg).hide().stop().fadeIn('slow');
			},
		error: function(msg){
		$('#poll-container').removeClass('loading');
		alert('&quot;.$L_idx&#091;'vote_failed'&#093;.&quot;');
			}

		});

		return false;

	}

	&lt;/script&gt;&quot; : '';


		$res .= &quot;&lt;h5&gt;&quot;.sed_parse(sed_cc($row_p&#091;'poll_text'&#093;), 1, 1, 1).&quot;&lt;/h5&gt;&quot;;
		$res .= &quot;&lt;div id='poll-container'&gt;&quot;;


		$res .= ($alreadyvoted) ? '&lt;table class=&quot;cells&quot;&gt;' : '';

		$sql = sed_sql_query(&quot;SELECT po_id, po_text, po_count FROM $db_polls_options WHERE po_pollid='$poll_id' ORDER by po_id ASC&quot;);

		while ($row = sed_sql_fetcharray($sql))
			{
			if ($alreadyvoted)
				{
				$percentbar = floor(($row&#091;'po_count'&#093; / $totalvotes) * 100);
				$res .= &quot;&lt;tr&gt;&lt;td&gt;&quot;.sed_parse(sed_cc($row&#091;'po_text'&#093;), 1, 1, 1).&quot;&lt;/td&gt;&lt;td width=\&quot;100\&quot;&gt;&lt;div style=\&quot;width:95%;\&quot;&gt;&lt;div class=\&quot;bar_back\&quot;&gt;&lt;div class=\&quot;bar_front\&quot; style=\&quot;width:&quot;.$percentbar.&quot;%;\&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;$percentbar%&lt;/td&gt;&lt;td&gt;(&quot;.$row&#091;'po_count'&#093;.&quot;)&lt;/td&gt;&lt;/tr&gt;&quot;;
				}
			else
				{
				$res .= &quot;&lt;input type='radio' name='vote' id='o&quot;.$row&#091;'po_id'&#093;.&quot;' value='&quot;.$row&#091;'po_id'&#093;.&quot;' /&gt;&lt;label for='o&quot;.$row&#091;'po_id'&#093;.&quot;'&gt; &quot;.stripslashes($row&#091;'po_text'&#093;).&quot;&lt;/label&gt;&lt;br /&gt;&quot;;
				}
			}

if (!$alreadyvoted)
		{ 
        $res .= &quot;&lt;input type=\&quot;hidden\&quot; name=\&quot;id\&quot; value=\&quot;&quot;.$poll_id.&quot;\&quot; /&gt;&quot;;
        $res .= &quot;&lt;input type=\&quot;hidden\&quot; name=\&quot;a\&quot; value=\&quot;send\&quot; /&gt;&quot;;
		}

        if (!$alreadyvoted)
		{ $res .= &quot;&lt;p style=\&quot;text-align: center; \&quot;&gt;&lt;input type=\&quot;submit\&quot; onclick=\&quot;postp();\&quot; class=\&quot;submit\&quot; value=\&quot;&quot;.$L_idx&#091;'voteit'&#093;.&quot;\&quot; /&gt;&lt;/p&gt;&quot;; }

	$res .= ($alreadyvoted) ? '&lt;/table&gt;' : '';

	$res .= &quot;&lt;/div&gt;&quot;;


        $res .= &quot;&lt;p style=\&quot;text-align: center; \&quot;&gt;&lt;a href=https://www.cotonti.com/\&quot;javascript:polls('&quot;.$poll_id.&quot;')\&quot;&gt;&quot;.$L&#091;'polls_viewresults'&#093;.&quot;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=https://www.cotonti.com/\&quot;javascript:polls('viewall')\&quot;&gt;&quot;.$L&#091;'polls_viewarchives'&#093;.&quot;&lt;/a&gt;&lt;/p&gt;&quot;;

		$res_all .= sprintf($mask, $res);
		}

//		{ $res = $plu_empty; }

	return($res_all);
	}

/* ============= */</pre>
<br />
Also, Trustmaster asked me to create an extra file, for words, language file. Please create a file and folder <br />
<em>plugins/recentitems/lang/recentitems.en.lang.php</em>  -- (i couldn't creating a new copyright, thanks riptide!)<br />
<pre class="code">&lt;?PHP
/* ====================
Seditio - Website engine
Copyright Neocrome
http:/www.neocrome.net

&#091;BEGIN_SED&#093;
File=plugins/calendar/lang/calendar.en.lang.php
Version=1.1
Updated=2006-Nov-12
Type=Plugin
Author=riptide &amp; friends (me)
Description=Plugin to display the events in a calendar
&#091;END_SED&#093;

==================== */

$L_idx&#091;'vote_failed'&#093; = 'Vote failed'; //If you have problems with submitting the vote
$L_idx&#091;'vote_opt'&#093; = 'Where is your opinion ?'; //If vote:checked false
$L_idx&#091;'voteit'&#093; = 'Vote it!';

?&gt;</pre>
<br />
<em>system/core/polls/polls.inc.php</em> --the real action<br />
<br />
find:<br />
<pre class="code">$ratings = sed_import('ratings','G','BOL');</pre>
add below:<br />
<pre class="code">$mode = sed_import('mode','G','TXT');</pre>
<br />
(add this code right before):<br />
<pre class="code">$t = new XTemplate(&quot;skins/&quot;.$skin.&quot;/polls.tpl&quot;);</pre>
<pre class="code">if ($mode=='ajax')
	{


	$result .= '
	&lt;script type=&quot;text/javascript&quot;&gt;

	function anim(){
	$(&quot;.bar_front&quot;).each(function(){
	var percentage = $(this).attr(&quot;id&quot;);
	$(this).css({width: &quot;0%&quot;}).animate({width: percentage}, &quot;slow&quot;);
	});}

	$(document).ready(function(){  
	anim();
		});
	&lt;/script&gt;';
	$result .= &quot;&lt;table class=\&quot;cells\&quot;&gt;&quot;;

		$sql2 = sed_sql_query(&quot;SELECT SUM(po_count) FROM $db_polls_options WHERE po_pollid='$id'&quot;);
		$totalvotes = sed_sql_result($sql2,0,&quot;SUM(po_count)&quot;);

		$sql1 = sed_sql_query(&quot;SELECT po_id,po_text,po_count FROM $db_polls_options WHERE po_pollid='$id' ORDER by po_id ASC &quot;);

	while ($row1 = sed_sql_fetcharray($sql1))
		{
		$po_id = $row1&#091;'po_id'&#093;;
		$po_count = $row1&#091;'po_count'&#093;;
		$percent = @round(100 * ($po_count / $totalvotes),1);
		$percentbar = floor($percent * 2.24);

		$row1&#091;'po_text'&#093; = $row1&#091;'po_text'&#093;;

		$result .= &quot;&lt;tr&gt;&lt;td&gt;&quot;;
		$result .= sed_parse(sed_cc($row1&#091;'po_text'&#093;), 1, 1, 1);
		$result .= &quot;&lt;/td&gt;&lt;td&gt;&lt;div style=\&quot;width:100px;\&quot;&gt;&lt;div class=\&quot;bar_back\&quot;&gt;&lt;div class=\&quot;bar_front\&quot; id=\&quot;$percent%\&quot; style=\&quot;width:0%;\&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;$percent%&lt;/td&gt;&lt;td&gt;(&quot;.$po_count.&quot;)&lt;/td&gt;&lt;/tr&gt;&quot;;
		}

	$result .= &quot;&lt;/table&gt;&quot;;

	echo $result;

	exit;

	}</pre>
<br />
<br />
There are also css stuff,<br />
add this to your css file(s):<br />
<pre class="code">#poll-container.loading {
  background: url('img/spinner.gif') no-repeat center center;
}</pre>
<br />
Spinner is something like this: <a href="http://www.scribd.com/spinner_bigger.gif" rel="nofollow">http://www.scribd.com/spinner_bigger.gif</a> -- (to the skins/yourskin/img/)]]></description>
			<pubDate>Fr, 29 Aug 2008 07:57:10 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/de/forums?m=posts&q=357&d=0#post659]]></link>
		</item>
	</channel>
</rss>