Update of /cvsroot/devil-linux/web/poll/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20723/poll/admin Modified Files: admin_comment.php admin_edit.php admin_embed.php admin_help.php admin_license.php admin_logout.php admin_password.php admin_preview.php admin_settings.php admin_stats.php admin_templates.php admin_templates_misc.php admin_tpl_misc_new.php admin_tpl_new.php common.inc.php index.php Log Message: updated advanced poll to v2.03 didn't go through the dos2unix hassle this time, it seems to work just fine Index: admin_stats.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/admin_stats.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- admin_stats.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ admin_stats.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,74 +1,74 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; - -if (!isset($action)) { - $action=''; -} -if ($action=="reset" and isset($poll_id)) { - $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_log] where (poll_id = '$poll_id')"); -} - -$row = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); -$logging = $row["logging"]; -$CLASS["db"]->free_result($CLASS["db"]->result); -$time_offset = $pollvars["time_offset"]*3600; -$poll_sum = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT SUM(votes) AS total FROM $POLLTBL[poll_data] WHERE (poll_id = '$poll_id')")); -$CLASS["db"]->free_result($CLASS["db"]->result); -list($wday,$mday,$month,$year,$hour,$minutes) = split("( )",date("w j n Y H i",$row['timestamp']+$time_offset)); -$newdate = "$weekday[$wday], $mday ".$months[$month-1]." $year $hour:$minutes"; - -$CLASS["template"]->set_templatefiles(array( - "admin_stats" => "admin_stats.html" -)); -$poll_stats = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">"; -$hours = (int) ((time()-$row['timestamp']+$time_offset)/3600); -$days = (int) ($hours/24); -$remain = $hours%24; -$question = htmlspecialchars($row['question']); -$poll_sum_total = $poll_sum["total"]; -$result = $CLASS["db"]->query("select * from $POLLTBL[poll_data] where (poll_id = '$poll_id') order by option_id asc"); -while ($data = $CLASS["db"]->fetch_array($result)) { - $percent = ($poll_sum['total'] == 0) ? "0%" : sprintf("%.2f",($data['votes']*100/$poll_sum['total']))."%"; - $perday = ($days>0) ? sprintf("%.1f",($data["votes"]/$days)) : $data["votes"]; - $poll_stats .= "<tr> - <td colspan=\"4\" class=\"td2\"><b>$lang[NewOption] $data[option_id]: $data[option_text]</b></td> - </tr> - <tr> - <td colspan=\"2\" class=\"td2\">- $lang[SetVotes]: <font color=\"#CC0000\">$data[votes]</font> ($percent)</td> - <td colspan=\"2\" class=\"td2\">- <font color=\"#0000FF\">$perday</font> $lang[StatDay]</td> - </tr>\n"; - if ($logging == 1) { - $log_result = $CLASS["db"]->query("select * from $POLLTBL[poll_log] where (poll_id = '$poll_id' and option_id = '$data[option_id]')"); - $row = $CLASS["db"]->num_rows($log_result); - if ($row != 0) { - $poll_stats .= " <tr bgcolor=\"#CC9999\" class=\"td2\"> - <td width=\"15%\" class=\"td2\">$lang[IndexDate]</td> - <td width=\"13%\" class=\"td2\">IP</td> - <td width=\"22%\" class=\"td2\">Host</td> - <td width=\"50%\" class=\"td2\">Browser</td> - </tr>\n"; - while ($log_data = $CLASS["db"]->fetch_array($log_result)) { - $poll_stats .= " <tr> - <td width=\"15%\" class=\"td2\">".date("j-M-Y H:i",$log_data['timestamp']+$time_offset)."</td> - <td width=\"13%\" class=\"td2\">$log_data[ip_addr]</td> - <td width=\"22%\" class=\"td2\">$log_data[host]</td> - <td width=\"50%\" class=\"td2\">$log_data[agent]</td> - </tr>\n"; - } - } - } -} -$poll_stats .= "</table>\n"; -$admin_stats = $CLASS["template"]->pre_parse("admin_stats"); -no_cache_header(); -eval("echo \"$admin_stats\";"); - +<?php +/** + * ---------------------------------------------- + * Advanced Poll 2.0.3 (PHP/MySQL) + * Copyright (c)2001 Chi Kien Uong + * URL: http://www.proxy2.de + * ---------------------------------------------- + */ + +require "./common.inc.php"; + +if (!isset($action)) { + $action=''; +} +if ($action=="reset" and isset($poll_id)) { + $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_log] where (poll_id = '$poll_id')"); +} + +$row = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); +$logging = $row["logging"]; +$CLASS["db"]->free_result($CLASS["db"]->result); +$time_offset = $pollvars["time_offset"]*3600; +$poll_sum = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT SUM(votes) AS total FROM $POLLTBL[poll_data] WHERE (poll_id = '$poll_id')")); +$CLASS["db"]->free_result($CLASS["db"]->result); +list($wday,$mday,$month,$year,$hour,$minutes) = split("( )",date("w j n Y H i",$row['timestamp']+$time_offset)); +$newdate = "$weekday[$wday], $mday ".$months[$month-1]." $year $hour:$minutes"; + +$CLASS["template"]->set_templatefiles(array( + "admin_stats" => "admin_stats.html" +)); +$poll_stats = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">"; +$hours = (int) ((time()-$row['timestamp']+$time_offset)/3600); +$days = (int) ($hours/24); +$remain = $hours%24; +$question = htmlspecialchars($row['question']); +$poll_sum_total = $poll_sum["total"]; +$result = $CLASS["db"]->query("select * from $POLLTBL[poll_data] where (poll_id = '$poll_id') order by option_id asc"); +while ($data = $CLASS["db"]->fetch_array($result)) { + $percent = ($poll_sum['total'] == 0) ? "0%" : sprintf("%.2f",($data['votes']*100/$poll_sum['total']))."%"; + $perday = ($days>0) ? sprintf("%.1f",($data["votes"]/$days)) : $data["votes"]; + $poll_stats .= "<tr> + <td colspan=\"4\" class=\"td2\"><b>$lang[NewOption] $data[option_id]: $data[option_text]</b></td> + </tr> + <tr> + <td colspan=\"2\" class=\"td2\">- $lang[SetVotes]: <font color=\"#CC0000\">$data[votes]</font> ($percent)</td> + <td colspan=\"2\" class=\"td2\">- <font color=\"#0000FF\">$perday</font> $lang[StatDay]</td> + </tr>\n"; + if ($logging == 1) { + $log_result = $CLASS["db"]->query("select * from $POLLTBL[poll_log] where (poll_id = '$poll_id' and option_id = '$data[option_id]')"); + $row = $CLASS["db"]->num_rows($log_result); + if ($row != 0) { + $poll_stats .= " <tr bgcolor=\"#CC9999\" class=\"td2\"> + <td width=\"15%\" class=\"td2\">$lang[IndexDate]</td> + <td width=\"13%\" class=\"td2\">IP</td> + <td width=\"22%\" class=\"td2\">Host</td> + <td width=\"50%\" class=\"td2\">Browser</td> + </tr>\n"; + while ($log_data = $CLASS["db"]->fetch_array($log_result)) { + $poll_stats .= " <tr> + <td width=\"15%\" class=\"td2\">".date("j-M-Y H:i",$log_data['timestamp']+$time_offset)."</td> + <td width=\"13%\" class=\"td2\">$log_data[ip_addr]</td> + <td width=\"22%\" class=\"td2\">$log_data[host]</td> + <td width=\"50%\" class=\"td2\">$log_data[agent]</td> + </tr>\n"; + } + } + } +} +$poll_stats .= "</table>\n"; +$admin_stats = $CLASS["template"]->pre_parse("admin_stats"); +no_cache_header(); +eval("echo \"$admin_stats\";"); + ?> \ No newline at end of file Index: admin_settings.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/admin_settings.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- admin_settings.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ admin_settings.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,92 +1,92 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; -require "../include/class_input2db.php"; - -function get_lang_list($dir) { - $lang_list = ''; - chdir("$dir"); - $hnd = opendir("."); - while ($file = readdir($hnd)) { - if(is_file($file)) { - $langlist[] = $file; - } - } - closedir($hnd); - if ($langlist) { - asort($langlist); - while (list ($key, $file) = each ($langlist)) { - if (ereg(".php|.php3",$file,$regs)) { - $lang_list .= "<option value=\"".$file."\">".str_replace("$regs[0]","","$file")."</option>\n"; - } - } - } - return $lang_list; -} - -function addspecialchars($input='') { - if(is_array($input)) { - reset($input); - while (list($var,$value) = each($input)) { - $input[$var] = htmlspecialchars($value); - } - return $input; - } else { - return false; - } -} - - -if (!isset($action)) { - $action=''; -} - -$message = $lang["SetText"]; - -if ($action == "update") { - if (!eregi(".php|.php3", $cfg["lang"])) { - $cfg["lang"] = "english.php"; - } - if (!eregi("^[0-9]+$", $cfg["entry_pp"]) || $cfg["entry_pp"]==0) { - $cfg["entry_pp"] = 1; - } - $CLASS["db_input"] = new input2db(); - $result = $CLASS["db_input"]->update_db_row($POLLTBL["poll_config"],$cfg,"config_id",1); - if ($result) { - $pollvars = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_config]")); - $pollvars['SELF'] = basename($PHP_SELF); - $CLASS["db"]->free_result($CLASS["db"]->result); - unset($lang); - include ("../lang/$pollvars[lang]"); - $message = $lang["Updated"]; - } else { - $message = $lang["NoUpdate"]; - } -} - -$CLASS["template"]->set_templatefiles(array( - "admin_settings" => "admin_settings.html" -)); - -$pollvars = addspecialchars($pollvars); -$langlist = get_lang_list("../lang"); -$check_ip = ($pollvars["check_ip"] == 0) ? "selected" : ""; -$no_ip_check = ($pollvars["check_ip"] == 2) ? "selected" : ""; -$votes = ($pollvars["type"] == "votes") ? "checked" : ""; -$percent = ($pollvars["type"] == "percent") ? "checked" : ""; -$order_usort = ($pollvars["result_order"] == "usort") ? "selected" : ""; -$order_asc = ($pollvars["result_order"] == "asc") ? "selected" : ""; -$order_desc = ($pollvars["result_order"] == "desc") ? "selected" : ""; - -$admin_settings = $CLASS["template"]->pre_parse("admin_settings"); -no_cache_header(); -eval("echo \"$admin_settings\";"); - +<?php +/** + * ---------------------------------------------- + * Advanced Poll 2.0.3 (PHP/MySQL) + * Copyright (c)2001 Chi Kien Uong + * URL: http://www.proxy2.de + * ---------------------------------------------- + */ + +require "./common.inc.php"; +require "../include/class_input2db.php"; + +function get_lang_list($dir) { + $lang_list = ''; + chdir("$dir"); + $hnd = opendir("."); + while ($file = readdir($hnd)) { + if(is_file($file)) { + $langlist[] = $file; + } + } + closedir($hnd); + if ($langlist) { + asort($langlist); + while (list ($key, $file) = each ($langlist)) { + if (ereg(".php|.php3",$file,$regs)) { + $lang_list .= "<option value=\"".$file."\">".str_replace("$regs[0]","","$file")."</option>\n"; + } + } + } + return $lang_list; +} + +function addspecialchars($input='') { + if(is_array($input)) { + reset($input); + while (list($var,$value) = each($input)) { + $input[$var] = htmlspecialchars($value); + } + return $input; + } else { + return false; + } +} + + +if (!isset($action)) { + $action=''; +} + +$message = $lang["SetText"]; + +if ($action == "update") { + if (!eregi(".php|.php3", $cfg["lang"])) { + $cfg["lang"] = "english.php"; + } + if (!eregi("^[0-9]+$", $cfg["entry_pp"]) || $cfg["entry_pp"]==0) { + $cfg["entry_pp"] = 1; + } + $CLASS["db_input"] = new input2db(); + $result = $CLASS["db_input"]->update_db_row($POLLTBL["poll_config"],$cfg,"config_id",1); + if ($result) { + $pollvars = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_config]")); + $pollvars['SELF'] = basename($PHP_SELF); + $CLASS["db"]->free_result($CLASS["db"]->result); + unset($lang); + include ("../lang/$pollvars[lang]"); + $message = $lang["Updated"]; + } else { + $message = $lang["NoUpdate"]; + } +} + +$CLASS["template"]->set_templatefiles(array( + "admin_settings" => "admin_settings.html" +)); + +$pollvars = addspecialchars($pollvars); +$langlist = get_lang_list("../lang"); +$check_ip = ($pollvars["check_ip"] == 0) ? "selected" : ""; +$no_ip_check = ($pollvars["check_ip"] == 2) ? "selected" : ""; +$votes = ($pollvars["type"] == "votes") ? "checked" : ""; +$percent = ($pollvars["type"] == "percent") ? "checked" : ""; +$order_usort = ($pollvars["result_order"] == "usort") ? "selected" : ""; +$order_asc = ($pollvars["result_order"] == "asc") ? "selected" : ""; +$order_desc = ($pollvars["result_order"] == "desc") ? "selected" : ""; + +$admin_settings = $CLASS["template"]->pre_parse("admin_settings"); +no_cache_header(); +eval("echo \"$admin_settings\";"); + ?> \ No newline at end of file Index: admin_comment.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/admin_comment.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- admin_comment.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ admin_comment.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,70 +1,70 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; - -if (!isset($action)) { - $action=''; -} -if ($action=="delete" and isset($mess_id) and isset($poll_id)) { - $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_comment] where (com_id = '$mess_id' and poll_id='$poll_id')"); -} - -if(!isset($entry)) { - $entry = 0; -} -$record = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT question FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); -$question = htmlspecialchars($record['question']); -$CLASS["db"]->free_result($CLASS["db"]->result); -$time_offset = $pollvars["time_offset"]*3600; -$CLASS["db"]->fetch_array($CLASS["db"]->query("select count(*) as total from $POLLTBL[poll_comment] WHERE (poll_id = '$poll_id')")); -$total = $CLASS["db"]->record['total']; -$next_page = $entry+$pollvars["entry_pp"]; -$prev_page = $entry-$pollvars["entry_pp"]; -$navigation =''; -if ($prev_page >= 0) { - $navigation = " <img src=\"$pollvars[base_gif]/back.gif\" width=\"16\" height=\"14\"> <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&poll_id=$poll_id&entry=$prev_page\">$lang[NavPrev]</a>\n"; -} -if ($next_page < $total) { - $navigation = $navigation. " <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&poll_id=$poll_id&entry=$next_page\">$lang[NavNext]</a> <img src=\"$pollvars[base_gif]/next.gif\" width=\"16\" height=\"14\">\n"; -} -$CLASS["template"]->set_templatefiles(array( - "admin_comment" => "admin_comment.html", - "admin_comment_tr" => "admin_comment_tr.html" -)); -$CLASS["template"]->register_vars("admin_comment_tr",array( - "message" => "\$row[message]", - "browser" => "\$row[browser]", - "name" => "\$row[name]", - "host" => "\$row[host]", - "com_id" => "\$row[com_id]" -)); -$admin_comment_tr = ''; -$comment_tr = $CLASS["template"]->pre_parse("admin_comment_tr"); -$results = $CLASS["db"]->query("select * from $POLLTBL[poll_comment] WHERE (poll_id = '$poll_id') order by com_id desc limit $entry, $pollvars[entry_pp]"); -while ($row = $CLASS["db"]->fetch_array($results)) { - $date = date("j-M-Y H:i",$row['time']+$time_offset); - $row['message'] = nl2br($row['message']); - $email = ($row['email']) ? "<a href=\"mailto:$row[email]\"><img src=\"$pollvars[base_gif]/email.gif\" width=\"15\" height=\"15\" border=\"0\" alt=\"$row[email]\"></a>\n" : ""; - if (eregi("Opera",$row['browser'])) { - $image = "$pollvars[base_gif]/opera.gif"; - } elseif (eregi("MSIE",$row['browser'])) { - $image = "$pollvars[base_gif]/msie.gif"; - } elseif (eregi("Mozilla",$row['browser'])) { - $image = "$pollvars[base_gif]/netscape.gif"; - } else { - $image = "$pollvars[base_gif]/unknown.gif"; - } - eval("\$admin_comment_tr .= \"$comment_tr\";"); -} -$comments = $CLASS["template"]->pre_parse("admin_comment"); -no_cache_header(); -eval("echo \"$comments\";"); - +<?php +/** + * ---------------------------------------------- + * Advanced Poll 2.0.3 (PHP/MySQL) + * Copyright (c)2001 Chi Kien Uong + * URL: http://www.proxy2.de + * ---------------------------------------------- + */ + +require "./common.inc.php"; + +if (!isset($action)) { + $action=''; +} +if ($action=="delete" and isset($mess_id) and isset($poll_id)) { + $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_comment] where (com_id = '$mess_id' and poll_id='$poll_id')"); +} + +if(!isset($entry)) { + $entry = 0; +} +$record = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT question FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); +$question = htmlspecialchars($record['question']); +$CLASS["db"]->free_result($CLASS["db"]->result); +$time_offset = $pollvars["time_offset"]*3600; +$CLASS["db"]->fetch_array($CLASS["db"]->query("select count(*) as total from $POLLTBL[poll_comment] WHERE (poll_id = '$poll_id')")); +$total = $CLASS["db"]->record['total']; +$next_page = $entry+$pollvars["entry_pp"]; +$prev_page = $entry-$pollvars["entry_pp"]; +$navigation =''; +if ($prev_page >= 0) { + $navigation = " <img src=\"$pollvars[base_gif]/back.gif\" width=\"16\" height=\"14\"> <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&poll_id=$poll_id&entry=$prev_page\">$lang[NavPrev]</a>\n"; +} +if ($next_page < $total) { + $navigation = $navigation. " <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&poll_id=$poll_id&entry=$next_page\">$lang[NavNext]</a> <img src=\"$pollvars[base_gif]/next.gif\" width=\"16\" height=\"14\">\n"; +} +$CLASS["template"]->set_templatefiles(array( + "admin_comment" => "admin_comment.html", + "admin_comment_tr" => "admin_comment_tr.html" +)); +$CLASS["template"]->register_vars("admin_comment_tr",array( + "message" => "\$row[message]", + "browser" => "\$row[browser]", + "name" => "\$row[name]", + "host" => "\$row[host]", + "com_id" => "\$row[com_id]" +)); +$admin_comment_tr = ''; +$comment_tr = $CLASS["template"]->pre_parse("admin_comment_tr"); +$results = $CLASS["db"]->query("select * from $POLLTBL[poll_comment] WHERE (poll_id = '$poll_id') order by com_id desc limit $entry, $pollvars[entry_pp]"); +while ($row = $CLASS["db"]->fetch_array($results)) { + $date = date("j-M-Y H:i",$row['time']+$time_offset); + $row['message'] = nl2br($row['message']); + $email = ($row['email']) ? "<a href=\"mailto:$row[email]\"><img src=\"$pollvars[base_gif]/email.gif\" width=\"15\" height=\"15\" border=\"0\" alt=\"$row[email]\"></a>\n" : ""; + if (eregi("Opera",$row['browser'])) { + $image = "$pollvars[base_gif]/opera.gif"; + } elseif (eregi("MSIE",$row['browser'])) { + $image = "$pollvars[base_gif]/msie.gif"; + } elseif (eregi("Mozilla",$row['browser'])) { + $image = "$pollvars[base_gif]/netscape.gif"; + } else { + $image = "$pollvars[base_gif]/unknown.gif"; + } + eval("\$admin_comment_tr .= \"$comment_tr\";"); +} +$comments = $CLASS["template"]->pre_parse("admin_comment"); +no_cache_header(); +eval("echo \"$comments\";"); + ?> \ No newline at end of file Index: index.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/index.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- index.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ index.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,187 +1,187 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; - -function delete_poll($poll_id) { - global $CLASS, $POLLTBL; - $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_data] where (poll_id = '$poll_id')"); - $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_index] where (poll_id = '$poll_id')"); - $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_log] where (poll_id = '$poll_id')"); - $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_comment] where (poll_id = '$poll_id')"); -} - -function poll_index() { - global $CLASS, $auth, $pollvars, $entry, $lang, $weekday, $months, $POLLTBL; - if(!isset($entry)) { - $entry = 0; - } - $CLASS["db"]->fetch_array($CLASS["db"]->query("select count(*) as total from $POLLTBL[poll_index]")); - $total = $CLASS["db"]->record['total']; - $time_offset = $pollvars["time_offset"]*3600; - list($wday,$mday,$month,$year,$hour,$minutes) = split("( )",date("w j n Y H i",time()+$time_offset)); - $newdate = "$weekday[$wday], $mday ".$months[$month-1]." $year $hour:$minutes"; - $next_page = $entry+$pollvars['polls_pp']; - $prev_page = $entry-$pollvars['polls_pp']; - $navigation =''; - if ($prev_page >= 0) { - $navigation = " <img src=\"$pollvars[base_gif]/back.gif\" width=\"16\" height=\"14\"> <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&entry=$prev_page\">$lang[NavPrev]</a>\n"; - } - if ($next_page < $total) { - $navigation = $navigation. " <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&entry=$next_page\">$lang[NavNext]</a> <img src=\"$pollvars[base_gif]/next.gif\" width=\"16\" height=\"14\">\n"; - } - $CLASS["template"]->set_templatefiles(array( - "index" => "admin_index.html", - "index_tr" => "admin_index_tr.html" - )); - $CLASS["template"]->register_vars("index_tr",array( - "poll_id" => "\$row[poll_id]" - )); - $index_tr = $CLASS["template"]->pre_parse("index_tr"); - $results = $CLASS["db"]->query("select * from $POLLTBL[poll_index] order by poll_id desc limit $entry, $pollvars[polls_pp]"); - $admin_index_tr = ''; - while ($row = $CLASS["db"]->fetch_array($results)) { - $question = htmlspecialchars($row['question']); - $date = date("j-M-Y",$row['timestamp']+$time_offset); - if ($row['expire']==0) { - $exp_date = "<font color=\"#0000FF\">$lang[IndexNever]</font>"; - } else { - $exp_date = (time()>$row['exp_time']) ? "<font color=\"#FF6600\">$lang[IndexExpire]</font>" : date("j-M-Y",$row['exp_time']+$time_offset)." (<font color=\"#FF0000\">".round(($row["exp_time"]-time())/86400)."</font>)"; - } - $days = (int) ((time()-$row['timestamp']+$time_offset)/86400); - if ($row['status'] == 1) { - $image = "$pollvars[base_gif]/folder.gif"; - $alt = "$lang[EditOn]"; - } elseif ($row['status'] == 2) { - $image = "$pollvars[base_gif]/hidden.gif"; - $alt = "$lang[EditHide]"; - } else { - $image = "$pollvars[base_gif]/lock.gif"; - $alt = "$lang[EditOff]"; - } - $alt = htmlspecialchars($alt); - $image2 = ($row['logging'] == 1) ? "$pollvars[base_gif]/log.gif" : "$pollvars[base_gif]/log_off.gif"; - $image3 = ($row['comments'] == 1) ? "$pollvars[base_gif]/reply.gif" : "$pollvars[base_gif]/co_dis.gif"; - $image4 = ($row['status'] == 2) ? "$pollvars[base_gif]/text_off.gif" : "$pollvars[base_gif]/text.gif"; - eval("\$admin_index_tr .= \"$index_tr\";"); - } - $CLASS["template"]->register_vars("index", array( - "poll_user" => $CLASS["db"]->db['user'], - "poll_host" => $CLASS["db"]->db['host'] - )); - $admin_index = $CLASS["template"]->pre_parse("index"); - eval("echo \"$admin_index\";"); -} - -function poll_new($message) { - global $CLASS, $auth, $pollvars, $lang, $color_array; - $source_array = array( - "aqua","blue","brown","darkgreen","gold","green","grey","orange","pink","purple","red","yellow" - ); - for ($i=0,$java_script='';$i<sizeof($source_array); $i++) { - $java_script .= "$source_array[$i] = new Image(); $source_array[$i].src = \"$pollvars[base_gif]/$source_array[$i].gif\";\n"; - } - for ($i=1,$poll_options=''; $i < $pollvars['def_options']+1; $i++) { - $poll_options .= " <tr> - <td width=\"25%\" class=\"td1\">$lang[NewOption] $i</td> - <td width=\"40%\"> - <input type=\"text\" name=\"option_id[$i]\" size=\"38\" class=\"input\" maxlength=\"100\"> - </td> - <td class=\"td2\" width=\"10%\"> - <select class=\"select\" name=\"color[$i]\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$i)\"> - <option value=\"blank\">---</option>\n"; - for ($j=0; $j <sizeof($source_array); $j++) { - $poll_options .= "<option value=\"$source_array[$j]\">$color_array[$j]</option>\n"; - } - $poll_options .= " </select></td> - <td width=\"25%\" align=\"left\"><img src=\"$pollvars[base_gif]/blank.gif\" name=\"bar$i\" width=\"35\" height=\"12\"></td> - </tr>\n"; - } - $CLASS["template"]->set_templatefiles(array( - "admin_new" => "admin_new.html" - )); - $admin_new = $poll_login = $CLASS["template"]->pre_parse("admin_new"); - eval("echo \"$admin_new\";"); -} - -function create_poll() { - global $CLASS, $POLLTBL; - global $logging, $expire, $exp_time, $status, $comments; - global $option_id, $question, $color; - $timestamp = time(); - if (!isset($expire)) { - $expire=1; - } - if (!isset($comments)) { - $comments=0; - } - if (!isset($exp_time)) { - $exp_time=$timestamp; - } else { - $exp_time=$timestamp+$exp_time*86400; - } - if (!get_magic_quotes_gpc()) { - $question = addslashes($question); - } - $CLASS["db"]->query("INSERT INTO $POLLTBL[poll_index] (question,timestamp,status,logging,exp_time,expire,comments) VALUES ('$question','$timestamp','$status','$logging','$exp_time','$expire','$comments')"); - $sql_result = $CLASS["db"]->query("SELECT poll_id FROM $POLLTBL[poll_index] WHERE timestamp=$timestamp"); - $CLASS["db"]->fetch_array($sql_result); - $poll_id = $CLASS["db"]->record['poll_id']; - for($i=1; $i <= sizeof($option_id); $i++) { - $option_id[$i] = trim($option_id[$i]); - if (!empty($option_id[$i])) { - if (!get_magic_quotes_gpc()) { - $option_id[$i] = addslashes($option_id[$i]); - } - $CLASS["db"]->query("INSERT INTO $POLLTBL[poll_data] (poll_id, option_id, option_text, color, votes) VALUES('$poll_id', '$i', '$option_id[$i]','$color[$i]',0)"); - } - } -} - -if (!isset($action)) { - $action=''; -} - -no_cache_header(); - -switch ($action) { - - case "new": - $message = $lang["NewTitle"]; - poll_new("$message"); - break; - - case "show": - poll_index(); - break; - - case "delete": - if (isset($id)) { - delete_poll($id); - } - poll_index(); - break; - - case "create": - $question = trim($question); - if (!empty($question)) { - create_poll(); - poll_index(); - } else { - $message = $lang["EditMis"]; - poll_new("$message"); - } - break; - - default: - poll_index(); - break; -} - +<?php +/** + * ---------------------------------------------- + * Advanced Poll 2.0.3 (PHP/MySQL) + * Copyright (c)2001 Chi Kien Uong + * URL: http://www.proxy2.de + * ---------------------------------------------- + */ + +require "./common.inc.php"; + +function delete_poll($poll_id) { + global $CLASS, $POLLTBL; + $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_data] where (poll_id = '$poll_id')"); + $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_index] where (poll_id = '$poll_id')"); + $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_log] where (poll_id = '$poll_id')"); + $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_comment] where (poll_id = '$poll_id')"); +} + +function poll_index() { + global $CLASS, $auth, $pollvars, $entry, $lang, $weekday, $months, $POLLTBL; + if(!isset($entry)) { + $entry = 0; + } + $CLASS["db"]->fetch_array($CLASS["db"]->query("select count(*) as total from $POLLTBL[poll_index]")); + $total = $CLASS["db"]->record['total']; + $time_offset = $pollvars["time_offset"]*3600; + list($wday,$mday,$month,$year,$hour,$minutes) = split("( )",date("w j n Y H i",time()+$time_offset)); + $newdate = "$weekday[$wday], $mday ".$months[$month-1]." $year $hour:$minutes"; + $next_page = $entry+$pollvars['polls_pp']; + $prev_page = $entry-$pollvars['polls_pp']; + $navigation =''; + if ($prev_page >= 0) { + $navigation = " <img src=\"$pollvars[base_gif]/back.gif\" width=\"16\" height=\"14\"> <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&entry=$prev_page\">$lang[NavPrev]</a>\n"; + } + if ($next_page < $total) { + $navigation = $navigation. " <a href=\"$pollvars[SELF]?session=$auth[session]&uid=$auth[uid]&entry=$next_page\">$lang[NavNext]</a> <img src=\"$pollvars[base_gif]/next.gif\" width=\"16\" height=\"14\">\n"; + } + $CLASS["template"]->set_templatefiles(array( + "index" => "admin_index.html", + "index_tr" => "admin_index_tr.html" + )); + $CLASS["template"]->register_vars("index_tr",array( + "poll_id" => "\$row[poll_id]" + )); + $index_tr = $CLASS["template"]->pre_parse("index_tr"); + $results = $CLASS["db"]->query("select * from $POLLTBL[poll_index] order by poll_id desc limit $entry, $pollvars[polls_pp]"); + $admin_index_tr = ''; + while ($row = $CLASS["db"]->fetch_array($results)) { + $question = htmlspecialchars($row['question']); + $date = date("j-M-Y",$row['timestamp']+$time_offset); + if ($row['expire']==0) { + $exp_date = "<font color=\"#0000FF\">$lang[IndexNever]</font>"; + } else { + $exp_date = (time()>$row['exp_time']) ? "<font color=\"#FF6600\">$lang[IndexExpire]</font>" : date("j-M-Y",$row['exp_time']+$time_offset)." (<font color=\"#FF0000\">".round(($row["exp_time"]-time())/86400)."</font>)"; + } + $days = (int) ((time()-$row['timestamp']+$time_offset)/86400); + if ($row['status'] == 1) { + $image = "$pollvars[base_gif]/folder.gif"; + $alt = "$lang[EditOn]"; + } elseif ($row['status'] == 2) { + $image = "$pollvars[base_gif]/hidden.gif"; + $alt = "$lang[EditHide]"; + } else { + $image = "$pollvars[base_gif]/lock.gif"; + $alt = "$lang[EditOff]"; + } + $alt = htmlspecialchars($alt); + $image2 = ($row['logging'] == 1) ? "$pollvars[base_gif]/log.gif" : "$pollvars[base_gif]/log_off.gif"; + $image3 = ($row['comments'] == 1) ? "$pollvars[base_gif]/reply.gif" : "$pollvars[base_gif]/co_dis.gif"; + $image4 = ($row['status'] == 2) ? "$pollvars[base_gif]/text_off.gif" : "$pollvars[base_gif]/text.gif"; + eval("\$admin_index_tr .= \"$index_tr\";"); + } + $CLASS["template"]->register_vars("index", array( + "poll_user" => $CLASS["db"]->db['user'], + "poll_host" => $CLASS["db"]->db['host'] + )); + $admin_index = $CLASS["template"]->pre_parse("index"); + eval("echo \"$admin_index\";"); +} + +function poll_new($message) { + global $CLASS, $auth, $pollvars, $lang, $color_array; + $source_array = array( + "aqua","blue","brown","darkgreen","gold","green","grey","orange","pink","purple","red","yellow" + ); + for ($i=0,$java_script='';$i<sizeof($source_array); $i++) { + $java_script .= "$source_array[$i] = new Image(); $source_array[$i].src = \"$pollvars[base_gif]/$source_array[$i].gif\";\n"; + } + for ($i=1,$poll_options=''; $i < $pollvars['def_options']+1; $i++) { + $poll_options .= " <tr> + <td width=\"25%\" class=\"td1\">$lang[NewOption] $i</td> + <td width=\"40%\"> + <input type=\"text\" name=\"option_id[$i]\" size=\"38\" class=\"input\" maxlength=\"100\"> + </td> + <td class=\"td2\" width=\"10%\"> + <select class=\"select\" name=\"color[$i]\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$i)\"> + <option value=\"blank\">---</option>\n"; + for ($j=0; $j <sizeof($source_array); $j++) { + $poll_options .= "<option value=\"$source_array[$j]\">$color_array[$j]</option>\n"; + } + $poll_options .= " </select></td> + <td width=\"25%\" align=\"left\"><img src=\"$pollvars[base_gif]/blank.gif\" name=\"bar$i\" width=\"35\" height=\"12\"></td> + </tr>\n"; + } + $CLASS["template"]->set_templatefiles(array( + "admin_new" => "admin_new.html" + )); + $admin_new = $poll_login = $CLASS["template"]->pre_parse("admin_new"); + eval("echo \"$admin_new\";"); +} + +function create_poll() { + global $CLASS, $POLLTBL; + global $logging, $expire, $exp_time, $status, $comments; + global $option_id, $question, $color; + $timestamp = time(); + if (!isset($expire)) { + $expire=1; + } + if (!isset($comments)) { + $comments=0; + } + if (!isset($exp_time)) { + $exp_time=$timestamp; + } else { + $exp_time=$timestamp+$exp_time*86400; + } + if (!get_magic_quotes_gpc()) { + $question = addslashes($question); + } + $CLASS["db"]->query("INSERT INTO $POLLTBL[poll_index] (question,timestamp,status,logging,exp_time,expire,comments) VALUES ('$question','$timestamp','$status','$logging','$exp_time','$expire','$comments')"); + $sql_result = $CLASS["db"]->query("SELECT poll_id FROM $POLLTBL[poll_index] WHERE timestamp=$timestamp"); + $CLASS["db"]->fetch_array($sql_result); + $poll_id = $CLASS["db"]->record['poll_id']; + for($i=1; $i <= sizeof($option_id); $i++) { + $option_id[$i] = trim($option_id[$i]); + if (!empty($option_id[$i])) { + if (!get_magic_quotes_gpc()) { + $option_id[$i] = addslashes($option_id[$i]); + } + $CLASS["db"]->query("INSERT INTO $POLLTBL[poll_data] (poll_id, option_id, option_text, color, votes) VALUES('$poll_id', '$i', '$option_id[$i]','$color[$i]',0)"); + } + } +} + +if (!isset($action)) { + $action=''; +} + +no_cache_header(); + +switch ($action) { + + case "new": + $message = $lang["NewTitle"]; + poll_new("$message"); + break; + + case "show": + poll_index(); + break; + + case "delete": + if (isset($id)) { + delete_poll($id); + } + poll_index(); + break; + + case "create": + $question = trim($question); + if (!empty($question)) { + create_poll(); + poll_index(); + } else { + $message = $lang["EditMis"]; + poll_new("$message"); + } + break; + + default: + poll_index(); + break; +} + ?> \ No newline at end of file Index: admin_logout.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/admin_logout.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- admin_logout.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ admin_logout.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,23 +1,23 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; - -srand((double)microtime()*1000000); -$new_session = md5 (uniqid (rand())); -$CLASS["db"]->query("UPDATE $POLLTBL[poll_user] SET session='$new_session' WHERE session='$session'"); -$CLASS["template"]->set_templatefiles(array( - "login" => "admin_login.html" -)); -$message = $lang['FormEnter']; -$poll_login = $CLASS["template"]->pre_parse("login"); -no_cache_header(); -eval("echo \"$poll_login\";"); - +<?php +/** + * ---------------------------------------------- + * Advanced Poll 2.0.3 (PHP/MySQL) + * Copyright (c)2001 Chi Kien Uong + * URL: http://www.proxy2.de + * ---------------------------------------------- + */ + +require "./common.inc.php"; + +srand((double)microtime()*1000000); +$new_session = md5 (uniqid (rand())); +$CLASS["db"]->query("UPDATE $POLLTBL[poll_user] SET session='$new_session' WHERE session='$session'"); +$CLASS["template"]->set_templatefiles(array( + "login" => "admin_login.html" +)); +$message = $lang['FormEnter']; +$poll_login = $CLASS["template"]->pre_parse("login"); +no_cache_header(); +eval("echo \"$poll_login\";"); + ?> \ No newline at end of file Index: admin_edit.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/admin_edit.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- admin_edit.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ admin_edit.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,220 +1,220 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; - -$source_array = array( - "aqua","blue","brown","darkgreen","gold","green","grey","orange","pink","purple","red","yellow" -); - -function add_options($poll_id,$last_id) { - global $CLASS, $POLLTBL; - global $option_id, $color; - for($i=$last_id; $i < $last_id+10; $i++) { - $option_id["$i"] = trim($option_id["$i"]); - if (!empty($option_id["$i"])) { - if (!get_magic_quotes_gpc()) { - $option_id["$i"] = addslashes($option_id["$i"]); - } - $CLASS["db"]->query("INSERT INTO $POLLTBL[poll_data] (poll_id, option_id, option_text, color, votes) VALUES('$poll_id', '$i', '$option_id[$i]','$color[$i]',0)"); - $added = 1; - } - } - return (isset($added)) ? "EditOk" : "EditNo"; -} - -function save($poll_id) { - global $CLASS, $POLLTBL; - global $option_id, $votes, $color, $status, $logging, $question, $exp_time, $expire, $comments; - if (!isset($expire)) { - $expire=1; - } - if (!isset($comments)) { - $comments=0; - } - $exp_time=time()+$exp_time*86400; - $question = trim($question); - if (!empty($question)) { - if (!get_magic_quotes_gpc()) { - $question = addslashes($question); - } - $CLASS["db"]->query("UPDATE $POLLTBL[poll_index] set question='$question', status='$status', logging='$logging', exp_time='$exp_time', expire='$expire', comments='$comments' where (poll_id = '$poll_id')"); - $CLASS["db"]->query("select max(option_id) as max_option from $POLLTBL[poll_data] where (poll_id = '$poll_id')"); - $data = $CLASS["db"]->fetch_array($CLASS["db"]->result); - for($i=1; $i <= $data["max_option"]; $i++) { - if (!isset($option_id["$i"])) { - continue; - } - $option_id["$i"] = trim($option_id["$i"]); - if (!empty($option_id[$i])) { - if (!eregi("^[0-9]+$", $votes[$i])) { - $votes[$i] = 0; - } - if (!get_magic_quotes_gpc()) { - $option_id[$i] = addslashes($option_id[$i]); - } - $CLASS["db"]->query("UPDATE $POLLTBL[poll_data] set option_text='$option_id[$i]', color='$color[$i]', votes='$votes[$i]' where (poll_id = '$poll_id' and option_id = '$i')"); - } elseif (sizeof($option_id) > 2) { - $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_data] where (poll_id = '$poll_id' and option_id = '$i')"); - } else { - $message = "EditOp"; - } - } - $message = "Updated"; - } else { - $message = "NewNoQue"; - } - return $message; -} - -function create_javascript_array() { - global $pollvars, $source_array; - for ($i=0, $java_script=''; $i<sizeof($source_array); $i++) { - $java_script .= "$source_array[$i] = new Image(); $source_array[$i].src = \"$pollvars[base_gif]/$source_array[$i].gif\";\n"; - } - return $java_script; -} - -function poll_extend($poll_id) { - global $CLASS, $POLLTBL, $source_array, $color_array, $lang, $pollvars, $auth; - $row = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT question as question FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); - $question = htmlspecialchars($row['question']); - $CLASS["db"]->free_result($CLASS["db"]->result); - $data = $CLASS["db"]->fetch_array($CLASS["db"]->query("select max(option_id) as option_id from $POLLTBL[poll_data] where (poll_id = '$poll_id')")); - $CLASS["db"]->free_result($CLASS["db"]->result); - $CLASS["template"]->set_templatefiles(array( - "admin_options" => "admin_options.html" - )); - $java_script = create_javascript_array(); - $poll_options = ''; - $data["option_id"] += 1; - $i = $data["option_id"]; - $end = $i+$pollvars['def_options']; - for ($i; $i < $end; $i++) { - $poll_options .= " <tr> - <td width=\"15%\" class=\"td1\">$lang[NewOption] $i</td> - <td width=\"48%\"> - <input type=\"text\" name=\"option_id[$i]\" size=\"38\" class=\"input\" maxlength=\"100\"> - </td> - <td width=\"12%\" class=\"td2\"> - <select class=\"select\" name=\"color[$i]\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$i)\"> - <option value=\"blank\">---</option>\n"; - for ($j=0; $j <sizeof($source_array); $j++) { - $poll_options .= "<option value=\"$source_array[$j]\">$color_array[$j]</option>\n"; - } - $poll_options .= " </select></td> - <td width=\"20%\"><img src=\"$pollvars[base_gif]/blank.gif\" name=\"bar$i\" width=35 height=12></td> - </tr>\n"; - } - $last_option_id = $data["option_id"]; - $admin_options = $CLASS["template"]->pre_parse("admin_options"); - eval("echo \"$admin_options\";"); -} - -function poll_edit($poll_id,$message) { - global $CLASS, $auth, $pollvars, $color_array, $source_array, $lang, $POLLTBL; - $row = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); - $question = htmlspecialchars($row['question']); - $CLASS["db"]->free_result($CLASS["db"]->result); - $java_script = create_javascript_array(); - $CLASS["db"]->query("select * from $POLLTBL[poll_data] where (poll_id = '$poll_id') order by option_id asc"); - $i=1; - $poll_options = ''; - $status_0 = ($row['status'] == 0) ? "selected" : ""; - $status_1 = ($row['status'] == 1) ? "selected" : ""; - $status_2 = ($row['status'] == 2) ? "selected" : ""; - $logging_0 = ($row['logging'] == 0) ? "selected" : ""; - $logging_1 = ($row['logging'] == 1) ? "selected" : ""; - $poll_comments = ($row['comments'] == 1) ? "checked" : ""; - $poll_expire = ($row['expire'] == 0) ? "checked" : ""; - while ($data = $CLASS["db"]->fetch_array($CLASS["db"]->result)) { - $i++; - $data["option_text"] = htmlspecialchars($data["option_text"]); - $poll_options .= " <tr> - <td width=\"20%\" class=\"td1\">$lang[NewOption] $data[option_id]</td> - <td width=\"49%\"> - <input type=\"text\" name=\"option_id[$data[option_id]]\" size=\"35\" class=\"input\" value=\"$data[option_text]\"> - </td> - <td width=\"11%\" class=\"td2\"> - <input type=\"text\" name=\"votes[$data[option_id]]\" class=\"input2\" size=\"10\" value=\"$data[votes]\"> - </td> - <td width=\"11%\" class=\"td2\"> - <select name=\"color[$data[option_id]]\" class=\"select\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$data[option_id])\"> - <option value=\"blank\">---</option>\n"; - for ($j=0; $j<sizeof($source_array); $j++) { - if ($data["color"] == $source_array["$j"]) { - $poll_options .= "<option value=\"$source_array[$j]\" selected>$color_array[$j]</option>\n"; - } else { - $poll_options .= "<option value=\"$source_array[$j]\">$color_array[$j]</option>\n"; - } - } - $poll_options .= " </select> - </td> - <td width=\"9%\"><img src=\"$pollvars[base_gif]/$data[color].gif\" name=\"bar$data[option_id]\" width=35 height=12></td> - </tr>\n"; - } - $expiration = round (($row['exp_time']-time())/86400); - if ($expiration<=0) { - $expiration = 0; - } - $timestamp = ''; - $CLASS["template"]->set_templatefiles(array( - "admin_edit" => "admin_edit.html" - )); - $admin_edit = $CLASS["template"]->pre_parse("admin_edit"); - eval("echo \"$admin_edit\";"); -} - -function is_valid_poll_id($poll_id) { - global $CLASS, $POLLTBL; - if ($poll_id>0) { - $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT poll_id FROM $POLLTBL[poll_index] WHERE poll_id=$poll_id")); - return ($CLASS["db"]->record['poll_id']) ? true : false; - } else { - return false; - } -} - -if (!isset($poll_id) || !is_valid_poll_id($poll_id)) { - $redirect = "index.php?session=$auth[session]&uid=$auth[uid]"; - header ("Location: $redirect"); - exit(); -} - -if (!isset($action)) { - $action=''; -} - -no_cache_header(); - -switch ($action) { - - case "save": - $message = save($poll_id); - $message = $lang[$message]; - poll_edit($poll_id,"$message"); - break; - - case "extend": - poll_extend($poll_id); - break; - - case "add": - $message = add_options($poll_id,$last_id); - $message = $lang[$message]; - poll_edit($poll_id,"$message"); - break; - - default: - $message = $lang["EditText"]; - poll_edit($poll_id,"$message"); -} - - +<?php +/** + * ---------------------------------------------- + * Advanced Poll 2.0.3 (PHP/MySQL) + * Copyright (c)2001 Chi Kien Uong + * URL: http://www.proxy2.de + * ---------------------------------------------- + */ + +require "./common.inc.php"; + +$source_array = array( + "aqua","blue","brown","darkgreen","gold","green","grey","orange","pink","purple","red","yellow" +); + +function add_options($poll_id,$last_id) { + global $CLASS, $POLLTBL; + global $option_id, $color; + for($i=$last_id; $i < $last_id+10; $i++) { + $option_id["$i"] = trim($option_id["$i"]); + if (!empty($option_id["$i"])) { + if (!get_magic_quotes_gpc()) { + $option_id["$i"] = addslashes($option_id["$i"]); + } + $CLASS["db"]->query("INSERT INTO $POLLTBL[poll_data] (poll_id, option_id, option_text, color, votes) VALUES('$poll_id', '$i', '$option_id[$i]','$color[$i]',0)"); + $added = 1; + } + } + return (isset($added)) ? "EditOk" : "EditNo"; +} + +function save($poll_id) { + global $CLASS, $POLLTBL; + global $option_id, $votes, $color, $status, $logging, $question, $exp_time, $expire, $comments; + if (!isset($expire)) { + $expire=1; + } + if (!isset($comments)) { + $comments=0; + } + $exp_time=time()+$exp_time*86400; + $question = trim($question); + if (!empty($question)) { + if (!get_magic_quotes_gpc()) { + $question = addslashes($question); + } + $CLASS["db"]->query("UPDATE $POLLTBL[poll_index] set question='$question', status='$status', logging='$logging', exp_time='$exp_time', expire='$expire', comments='$comments' where (poll_id = '$poll_id')"); + $CLASS["db"]->query("select max(option_id) as max_option from $POLLTBL[poll_data] where (poll_id = '$poll_id')"); + $data = $CLASS["db"]->fetch_array($CLASS["db"]->result); + for($i=1; $i <= $data["max_option"]; $i++) { + if (!isset($option_id["$i"])) { + continue; + } + $option_id["$i"] = trim($option_id["$i"]); + if (!empty($option_id[$i])) { + if (!eregi("^[0-9]+$", $votes[$i])) { + $votes[$i] = 0; + } + if (!get_magic_quotes_gpc()) { + $option_id[$i] = addslashes($option_id[$i]); + } + $CLASS["db"]->query("UPDATE $POLLTBL[poll_data] set option_text='$option_id[$i]', color='$color[$i]', votes='$votes[$i]' where (poll_id = '$poll_id' and option_id = '$i')"); + } elseif (sizeof($option_id) > 2) { + $CLASS["db"]->query("DELETE FROM $POLLTBL[poll_data] where (poll_id = '$poll_id' and option_id = '$i')"); + } else { + $message = "EditOp"; + } + } + $message = "Updated"; + } else { + $message = "NewNoQue"; + } + return $message; +} + +function create_javascript_array() { + global $pollvars, $source_array; + for ($i=0, $java_script=''; $i<sizeof($source_array); $i++) { + $java_script .= "$source_array[$i] = new Image(); $source_array[$i].src = \"$pollvars[base_gif]/$source_array[$i].gif\";\n"; + } + return $java_script; +} + +function poll_extend($poll_id) { + global $CLASS, $POLLTBL, $source_array, $color_array, $lang, $pollvars, $auth; + $row = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT question as question FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); + $question = htmlspecialchars($row['question']); + $CLASS["db"]->free_result($CLASS["db"]->result); + $data = $CLASS["db"]->fetch_array($CLASS["db"]->query("select max(option_id) as option_id from $POLLTBL[poll_data] where (poll_id = '$poll_id')")); + $CLASS["db"]->free_result($CLASS["db"]->result); + $CLASS["template"]->set_templatefiles(array( + "admin_options" => "admin_options.html" + )); + $java_script = create_javascript_array(); + $poll_options = ''; + $data["option_id"] += 1; + $i = $data["option_id"]; + $end = $i+$pollvars['def_options']; + for ($i; $i < $end; $i++) { + $poll_options .= " <tr> + <td width=\"15%\" class=\"td1\">$lang[NewOption] $i</td> + <td width=\"48%\"> + <input type=\"text\" name=\"option_id[$i]\" size=\"38\" class=\"input\" maxlength=\"100\"> + </td> + <td width=\"12%\" class=\"td2\"> + <select class=\"select\" name=\"color[$i]\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$i)\"> + <option value=\"blank\">---</option>\n"; + for ($j=0; $j <sizeof($source_array); $j++) { + $poll_options .= "<option value=\"$source_array[$j]\">$color_array[$j]</option>\n"; + } + $poll_options .= " </select></td> + <td width=\"20%\"><img src=\"$pollvars[base_gif]/blank.gif\" name=\"bar$i\" width=35 height=12></td> + </tr>\n"; + } + $last_option_id = $data["option_id"]; + $admin_options = $CLASS["template"]->pre_parse("admin_options"); + eval("echo \"$admin_options\";"); +} + +function poll_edit($poll_id,$message) { + global $CLASS, $auth, $pollvars, $color_array, $source_array, $lang, $POLLTBL; + $row = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); + $question = htmlspecialchars($row['question']); + $CLASS["db"]->free_result($CLASS["db"]->result); + $java_script = create_javascript_array(); + $CLASS["db"]->query("select * from $POLLTBL[poll_data] where (poll_id = '$poll_id') order by option_id asc"); + $i=1; + $poll_options = ''; + $status_0 = ($row['status'] == 0) ? "selected" : ""; + $status_1 = ($row['status'] == 1) ? "selected" : ""; + $status_2 = ($row['status'] == 2) ? "selected" : ""; + $logging_0 = ($row['logging'] == 0) ? "selected" : ""; + $logging_1 = ($row['logging'] == 1) ? "selected" : ""; + $poll_comments = ($row['comments'] == 1) ? "checked" : ""; + $poll_expire = ($row['expire'] == 0) ? "checked" : ""; + while ($data = $CLASS["db"]->fetch_array($CLASS["db"]->result)) { + $i++; + $data["option_text"] = htmlspecialchars($data["option_text"]); + $poll_options .= " <tr> + <td width=\"20%\" class=\"td1\">$lang[NewOption] $data[option_id]</td> + <td width=\"49%\"> + <input type=\"text\" name=\"option_id[$data[option_id]]\" size=\"35\" class=\"input\" value=\"$data[option_text]\"> + </td> + <td width=\"11%\" class=\"td2\"> + <input type=\"text\" name=\"votes[$data[option_id]]\" class=\"input2\" size=\"10\" value=\"$data[votes]\"> + </td> + <td width=\"11%\" class=\"td2\"> + <select name=\"color[$data[option_id]]\" class=\"select\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$data[option_id])\"> + <option value=\"blank\">---</option>\n"; + for ($j=0; $j<sizeof($source_array); $j++) { + if ($data["color"] == $source_array["$j"]) { + $poll_options .= "<option value=\"$source_array[$j]\" selected>$color_array[$j]</option>\n"; + } else { + $poll_options .= "<option value=\"$source_array[$j]\">$color_array[$j]</option>\n"; + } + } + $poll_options .= " </select> + </td> + <td width=\"9%\"><img src=\"$pollvars[base_gif]/$data[color].gif\" name=\"bar$data[option_id]\" width=35 height=12></td> + </tr>\n"; + } + $expiration = round (($row['exp_time']-time())/86400); + if ($expiration<=0) { + $expiration = 0; + } + $timestamp = ''; + $CLASS["template"]->set_templatefiles(array( + "admin_edit" => "admin_edit.html" + )); + $admin_edit = $CLASS["template"]->pre_parse("admin_edit"); + eval("echo \"$admin_edit\";"); +} + +function is_valid_poll_id($poll_id) { + global $CLASS, $POLLTBL; + if ($poll_id>0) { + $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT poll_id FROM $POLLTBL[poll_index] WHERE poll_id=$poll_id")); + return ($CLASS["db"]->record['poll_id']) ? true : false; + } else { + return false; + } +} + +if (!isset($poll_id) || !is_valid_poll_id($poll_id)) { + $redirect = "index.php?session=$auth[session]&uid=$auth[uid]"; + header ("Location: $redirect"); + exit(); +} + +if (!isset($action)) { + $action=''; +} + +no_cache_header(); + +switch ($action) { + + case "save": + $message = save($poll_id); + $message = $lang[$message]; + poll_edit($poll_id,"$message"); + break; + + case "extend": + poll_extend($poll_id); + break; + + case "add": + $message = add_options($poll_id,$last_id); + $message = $lang[$message]; + poll_edit($poll_id,"$message"); + break; + + default: + $message = $lang["EditText"]; + poll_edit($poll_id,"$message"); +} + + ?> \ No newline at end of file Index: admin_embed.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/admin_embed.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- admin_embed.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ admin_embed.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,39 +1,39 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; - -$record = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); -if (!isset($poll_id) || ($record['status']==2)) { - $redirect = "index.php?session=$auth[session]&uid=$auth[uid]"; - header ("Location: $redirect"); - exit(); -} -$path = dirname(__file__); -$path = dirname("$path"); -if (eregi("WIN",PHP_OS)) { - $path = str_replace("\\","/",$path); -} -if (ereg("^3.",PHP_VERSION)) { - $include_statement = "include"; -} else { - $version = ereg_replace("([^0-9])", "", PHP_VERSION); - $version = $version / pow (10, strlen($version) - 1); - $include_statement = ($version >= 4.02) ? "include_once" : "include"; -} -$question = htmlspecialchars($record['question']); -$CLASS["db"]->free_result($CLASS["db"]->result); -$CLASS["template"]->set_templatefiles(array( - "admin_embed" => "admin_embed.html" -)); -$admin_embed = $CLASS["template"]->pre_parse("admin_embed"); -no_cache_header(); -eval("echo \"$admin_embed\";"); - +<?php +/** + * ---------------------------------------------- + * Advanced Poll 2.0.3 (PHP/MySQL) + * Copyright (c)2001 Chi Kien Uong + * URL: http://www.proxy2.de + * ---------------------------------------------- + */ + +require "./common.inc.php"; + +$record = $CLASS["db"]->fetch_array($CLASS["db"]->query("SELECT * FROM $POLLTBL[poll_index] WHERE (poll_id = '$poll_id')")); +if (!isset($poll_id) || ($record['status']==2)) { + $redirect = "index.php?session=$auth[session]&uid=$auth[uid]"; + header ("Location: $redirect"); + exit(); +} +$path = dirname(__file__); +$path = dirname("$path"); +if (eregi("WIN",PHP_OS)) { + $path = str_replace("\\","/",$path); +} +if (ereg("^3.",PHP_VERSION)) { + $include_statement = "include"; +} else { + $version = ereg_replace("([^0-9])", "", PHP_VERSION); + $version = $version / pow (10, strlen($version) - 1); + $include_statement = ($version >= 4.02) ? "include_once" : "include"; +} +$question = htmlspecialchars($record['question']); +$CLASS["db"]->free_result($CLASS["db"]->result); +$CLASS["template"]->set_templatefiles(array( + "admin_embed" => "admin_embed.html" +)); +$admin_embed = $CLASS["template"]->pre_parse("admin_embed"); +no_cache_header(); +eval("echo \"$admin_embed\";"); + ?> \ No newline at end of file Index: admin_templates_misc.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/admin/admin_templates_misc.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- admin_templates_misc.php 2 Jun 2004 13:05:50 -0000 1.1.1.1 +++ admin_templates_misc.php 18 Sep 2004 16:00:40 -0000 1.2 @@ -1,84 +1,84 @@ -<?php -/** - * ---------------------------------------------- - * Advanced Poll 2.0.3 (PHP/MySQL) - * Copyright (c)2001 Chi Kien Uong - * URL: http://www.proxy2.de - * ---------------------------------------------- - */ - -require "./common.inc.php"; - -fun... [truncated message content] |