1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-15 03:56:20 +02:00

Fixes #376 - Poll cookie was not set

This commit is contained in:
Moc
2013-07-15 13:31:49 +02:00
parent 8f03110a16
commit a669804a89
2 changed files with 11 additions and 16 deletions

View File

@ -272,16 +272,18 @@ class poll
} }
$votep = implode(chr(1), $votes); $votep = implode(chr(1), $votes);
$pollArray['poll_votes'] = $votep; $pollArray['poll_votes'] = $votep;
$sql->db_Update("polls", "poll_votes = '$votep'".($pollArray['poll_storage_method'] != POLL_MODE_COOKIE ? ", poll_ip='".$poll_ip.$userid."^'" : '')." WHERE poll_id=".$poll_id); $sql->update("polls", "poll_votes = '$votep'".($pollArray['poll_storage_method'] != POLL_MODE_COOKIE ? ", poll_ip='".$poll_ip.$userid."^'" : '')." WHERE poll_id=".$poll_id);
echo " /*echo "
<script type='text/javascript'> <script type='text/javascript'>
<!-- <!--
setcook({$poll_id}); setcook({$poll_id});
//--> //-->
</script> </script>
"; ";
*/
$poll_cookie_expire = time() + (3600 * 24 * 356 * 15); // FIXME cannot be used after 2023 (this year is the maxium unixstamp on 32 bit system)
cookie('poll_'.$poll_id.'', $poll_id, $poll_cookie_expire);
$POLLMODE = 'voted'; $POLLMODE = 'voted';
} }
} }
$this->pollRow = $pollArray; $this->pollRow = $pollArray;
@ -884,9 +886,7 @@ class poll_shortcodes extends e_shortcode
/*
e107::js('inline', ' e107::js('inline', '
function setcook(pollid){ function setcook(pollid){
@ -897,7 +897,7 @@ e107::js('inline', '
var expires = "; expires="+date.toGMTString(); var expires = "; expires="+date.toGMTString();
document.cookie = name+"="+value+expires+"; path=/"; document.cookie = name+"="+value+expires+"; path=/";
} }
'); ');*/
?> ?>

View File

@ -2,16 +2,10 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2009 e107 Inc (e107.org) * Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_menu.php,v $
* $Revision$
* $Date$
* $Author$
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@ -22,9 +16,10 @@ if(defined("POLLRENDERED"))
{ {
// return; // return;
} }
if (!plugInstalled('poll'))
if (!e107::isInstalled('poll'))
{ {
return ''; header("location:".e_BASE."index.php");
} }
if(!defined("POLLCLASS")) if(!defined("POLLCLASS"))