Skip to content

Commit

Permalink
some polls fixes
Browse files Browse the repository at this point in the history
and comments/ratings enable function optimized
  • Loading branch information
esclkm committed Jan 7, 2012
1 parent c15cf34 commit f0b31bf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
5 changes: 3 additions & 2 deletions modules/polls/inc/polls.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,14 @@ function cot_poll_vote()
{
$where = "pv_userid = '".$usr['id']."'";
}
elseif ($cfg['polls']['ip_id_polls'] == 'ip')
else
{
$where = ($usr['id'] > 0) ? "(pv_userid = '".$usr['id']."' OR pv_userip = '".$usr['ip']."')" : "pv_userip = '".$usr['ip']."'";
}
$sql2 = $db->query("SELECT pv_id FROM $db_polls_voters WHERE pv_pollid = $id AND $where LIMIT 1");
$alreadyvoted = ($sql2->rowCount() == 1) ? 1 : 0;
if ($alreadyvoted != 1)

if ($alreadyvoted != 1 && !($cfg['polls']['ip_id_polls'] == 'id' && $usr['id'] == 0))
{
foreach ($vote as $val)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/polls/polls.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}
else
{
$poll_type = 'poll_type='.$filter;
$poll_type = 'poll_type="'.$filter.'"';
$poll_filter = '"&filter='.$filter;
}

Expand Down
21 changes: 13 additions & 8 deletions plugins/comments/inc/comments.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,21 @@ function cot_comments_display($ext_name, $code, $cat = '', $force_admin = false)
function cot_comments_enabled($ext_name, $cat = '', $item = '')
{
global $cfg, $cot_modules;

if (isset($cot_modules[$ext_name]))
{
return (bool) (isset($cfg[$ext_name][$cat]['enable_comments']) ? $cfg[$ext_name][$cat]['enable_comments']
: $cfg[$ext_name]['enable_comments']);
}
else
if (isset($cfg[$ext_name][$cat]['enable_comments'])
|| isset($cfg[$ext_name]['enable_comments'])
|| isset($cfg['plugin'][$ext_name]['enable_comments']))
{
return (bool) $cfg['plugin'][$ext_name]['enable_comments'];
if (isset($cot_modules[$ext_name]))
{
return (bool) (isset($cfg[$ext_name][$cat]['enable_comments']) ? $cfg[$ext_name][$cat]['enable_comments']
: $cfg[$ext_name]['enable_comments']);
}
else
{
return (bool) $cfg['plugin'][$ext_name]['enable_comments'];
}
}
return true;
}

/**
Expand Down
21 changes: 13 additions & 8 deletions plugins/ratings/inc/ratings.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,21 @@ function cot_ratings_display($ext_name, $code, $cat = '', $readonly = false)
function cot_ratings_enabled($ext_name, $cat = '', $item = '')
{
global $cfg, $cot_modules;

if (isset($cot_modules[$ext_name]))
{
return (bool) (isset($cfg[$ext_name][$cat]['enable_ratings']) ? $cfg[$ext_name][$cat]['enable_ratings']
: $cfg[$ext_name]['enable_ratings']);
}
else
if (isset($cfg[$ext_name][$cat]['enable_ratings'])
|| isset($cfg[$ext_name]['enable_ratings'])
|| isset($cfg['plugin'][$ext_name]['enable_ratings']))
{
return (bool) $cfg['plugin'][$ext_name]['enable_ratings'];
if (isset($cot_modules[$ext_name]))
{
return (bool) (isset($cfg[$ext_name][$cat]['enable_ratings']) ? $cfg[$ext_name][$cat]['enable_ratings']
: $cfg[$ext_name]['enable_ratings']);
}
else
{
return (bool) $cfg['plugin'][$ext_name]['enable_ratings'];
}
}
return true;
}

/**
Expand Down

0 comments on commit f0b31bf

Please sign in to comment.