disable comments';
$comments=str_replace('value="'.$ds[comments].'"', 'value="'.$ds[comments].'" selected', $comments);
if($ds[intern]) $intern = "checked";
$bg1=BG_1;
eval ("\$polls_edit = \"".gettemplate("polls_edit")."\";");
echo $polls_edit;
}
else redirect('index.php?site=polls', 'no access!');
}
elseif(isset($_GET['pollID'])) {
$pollID = $_GET['pollID'];
if(ispollsadmin($userID)) echo'
';
$ergebnis = safe_query("SELECT * FROM ".PREFIX."poll WHERE pollID='$pollID' AND intern<=".isclanmember($userID));
$ds = mysql_fetch_array($ergebnis);
$bg1=BG_1;
$title=stripslashes($ds[titel]);
if($ds[laufzeit] < time() OR $ds[aktiv] == "0") $timeleft = "poll already ended"; else $timeleft = floor(($ds[laufzeit]-time())/(60*60*24))." days";
for ($n=1; $n<=10; $n++) {
if($ds[o.$n]) $options[]=$ds[o.$n];
}
if(ispollsadmin($userID)) {
if($ds[aktiv]) {
$stop=' ';
$edit=' ';
}
else {
$stop=' stopped Poll';
$edit='';
}
$adminactions=$edit.''.$stop;
}
$votes = safe_query("SELECT * FROM ".PREFIX."poll_votes WHERE pollID='$pollID' ");
$dv = mysql_fetch_array($votes);
$gesamtstimmen = $dv[o1] + $dv[o2] + $dv[o3] + $dv[o4] + $dv[o5] + $dv[o6] + $dv[o7] + $dv[o8] + $dv[o9] + $dv[o10];
$n=1;
eval ("\$polls_head = \"".gettemplate("polls_head")."\";");
echo $polls_head;
foreach ($options as $option) {
$stimmen = $dv[o.$n];
if ($gesamtstimmen) {
$perc = $stimmen / $gesamtstimmen * 10000;
settype($perc, "integer");
$perc = $perc/100;
}
else $perc = 0;
$picwidth = $perc;
settype($picwidth, "integer");
if($picwidth) $pic='
';
else $pic='';
eval ("\$polls_content = \"".gettemplate("polls_content")."\";");
echo $polls_content;
$n++;
}
eval ("\$polls_foot = \"".gettemplate("polls_foot")."\";");
echo $polls_foot;
$comments_allowed = $ds[comments];
$parentID = $pollID;
$type = "po";
$referer = "index.php?site=polls&pollID=$pollID";
include("comments.php");
}
elseif(isset($_GET['vote'])) {
$pagebg=PAGEBG;
$border=BORDER;
$bghead=BGHEAD;
$bgcat=BGCAT;
$poll = $_GET['vote'];
$lastpoll = safe_query("SELECT * FROM ".PREFIX."poll WHERE aktiv='1' AND laufzeit>".time()." AND intern<=".isclanmember($userID)." and pollID='".$poll."' LIMIT 0,1");
$anz = mysql_num_rows($lastpoll);
$ds = mysql_fetch_array($lastpoll);
if($anz) {
$anz=mysql_num_rows(safe_query("SELECT pollID FROM `".PREFIX."poll` WHERE pollID='".$ds[pollID]."' AND hosts LIKE '%".$_SERVER[REMOTE_ADDR]."%' AND intern<=".isclanmember($userID).""));
if($_COOKIE['poll'] == $ds[pollID] OR $anz) redirect('index.php?site=polls&pollID='.$ds[pollID],'You have already voted.');
else {
echo'';
}
} else redirect('index.php?site=polls&pollID='.$ds[pollID],'Poll already ended.');
}
else {
if(ispollsadmin($userID)) echo'
';
$ergebnis = safe_query("SELECT * FROM ".PREFIX."poll WHERE intern<=".isclanmember($userID)." ORDER BY pollID DESC");
$anz = mysql_num_rows($ergebnis);
if($anz) {
$i=1;
while ($ds = mysql_fetch_array($ergebnis)) {
if($i%2) $bg1=BG_1;
else $bg1=BG_2;
$title=stripslashes($ds[titel]);
if($ds[laufzeit] < time() OR $ds[aktiv] == "0") $timeleft = "poll already ended"; else $timeleft = floor(($ds[laufzeit]-time())/(60*60*24))." days (".date("d.m.Y H:i",$ds[laufzeit]).")
[vote now]";
for ($n=1; $n<=10; $n++) {
if($ds[o.$n]) $options[]=$ds[o.$n];
}
if(ispollsadmin($userID)) {
if($ds[aktiv]) {
$stop=' ';
$edit=' ';
}
else {
$stop=' stopped Poll';
$edit='';
}
$adminactions=$edit.''.$stop;
}
$votes = safe_query("SELECT * FROM ".PREFIX."poll_votes WHERE pollID='$ds[pollID]' ");
$dv = mysql_fetch_array($votes);
$gesamtstimmen = $dv[o1] + $dv[o2] + $dv[o3] + $dv[o4] + $dv[o5] + $dv[o6] + $dv[o7] + $dv[o8] + $dv[o9] + $dv[o10];
$n=1;
eval ("\$polls_head = \"".gettemplate("polls_head")."\";");
echo $polls_head;
foreach ($options as $option) {
$stimmen = $dv[o.$n];
if ($gesamtstimmen) {
$perc = $stimmen / $gesamtstimmen * 10000;
settype($perc, "integer");
$perc = $perc/100;
}
else $perc = 0;
$picwidth = $perc;
settype($picwidth, "integer");
if($picwidth) $pic='';
else $pic='';
$anzcomments = getanzcomments($ds[pollID], 'po');
if($anzcomments) $comments='['.$anzcomments.'] comments latest by '.getlastcommentposter($ds[pollID], 'po').' - '.date("d.m.Y - H:i", getlastcommentdate($ds[pollID], 'po'));
else $comments='[0] comments';
eval ("\$polls_content = \"".gettemplate("polls_content")."\";");
echo $polls_content;
$n++;
}
eval ("\$polls_foot = \"".gettemplate("polls_foot")."\";");
echo $polls_foot;
$i++;
unset($options);
}
}
else echo'no entries!';
}
?>