From: Heiko Z. <smi...@us...> - 2004-09-18 16:01:24
|
Update of /cvsroot/devil-linux/web/poll In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20723/poll Modified Files: comments.php png.php poll_cookie.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: comments.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/comments.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- comments.php 2 Jun 2004 13:05:48 -0000 1.1.1.1 +++ comments.php 18 Sep 2004 16:00:35 -0000 1.2 @@ -1,73 +1,73 @@ -<?php -global $HTTP_SERVER_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS; -$include_path = dirname(__FILE__); -if ($include_path == "/") { - $include_path = "."; -} - -$id = (isset($HTTP_POST_VARS['id'])) ? intval($HTTP_POST_VARS['id']) : ""; -if ($id == "") { - if (isset($HTTP_GET_VARS['id'])) { - $id = intval($HTTP_GET_VARS['id']); - } -} - -$template_set = (isset($HTTP_POST_VARS['template_set'])) ? trim($HTTP_POST_VARS['template_set']) : ""; -if ($template_set == "") { - if (isset($HTTP_GET_VARS['template_set'])) { - $template_set = trim($HTTP_GET_VARS['template_set']); - } -} - -$action = (isset($HTTP_POST_VARS['action'])) ? trim($HTTP_POST_VARS['action']) : ""; -if ($action == "") { - if (isset($HTTP_GET_VARS['action'])) { - $action = trim($HTTP_GET_VARS['action']); - } -} - -require $include_path."/include/config.inc.php"; -require $include_path."/include/$POLLDB[class]"; -require $include_path."/include/class_poll.php"; -require $include_path."/include/class_pollcomment.php"; -$CLASS["db"] = new polldb_sql; -$CLASS["db"]->connect(); - -$my_comment = new pollcomment(); - -if (!empty($template_set)) { - $my_comment->set_template_set("$template_set"); -} -if (empty($id)) { - echo $my_comment->print_message("Poll ID <b>".$id."</b> does not exist or is disabled!"); -} elseif ($my_comment->is_comment_allowed($id)) { - if ($action == "add") { - $poll_input = array("message","name","email"); - for($i=0;$i<sizeof($poll_input);$i++) { - if (isset($HTTP_POST_VARS[$poll_input[$i]])) { - $HTTP_POST_VARS[$poll_input[$i]] = trim($HTTP_POST_VARS[$poll_input[$i]]); - } else { - $HTTP_POST_VARS[$poll_input[$i]] = ''; - } - } - if (empty($HTTP_POST_VARS['name'])) { - echo $my_comment->print_message("Please enter your name.<br><a href=\"javascript:history.back()\">Go back</a>"); - } - elseif (empty($HTTP_POST_VARS['message'])) { - echo $my_comment->print_message("You forgot to fill in the message field!<br><a href=\"javascript:history.back()\">Go back</a>"); - } - /* - elseif (empty($HTTP_POST_VARS['email'])) { - echo $my_comment->print_message("You must specify your e-mail address.!<br><a href=\"javascript:history.back()\">Go back</a>"); - } - */ - else { - $my_comment->add_comment($id); - echo $my_comment->print_message("Your message has been sent!",1); - } - } else { - echo $my_comment->poll_form($id); - } -} - +<?php +global $HTTP_SERVER_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS; +$include_path = dirname(__FILE__); +if ($include_path == "/") { + $include_path = "."; +} + +$id = (isset($HTTP_POST_VARS['id'])) ? intval($HTTP_POST_VARS['id']) : ""; +if ($id == "") { + if (isset($HTTP_GET_VARS['id'])) { + $id = intval($HTTP_GET_VARS['id']); + } +} + +$template_set = (isset($HTTP_POST_VARS['template_set'])) ? trim($HTTP_POST_VARS['template_set']) : ""; +if ($template_set == "") { + if (isset($HTTP_GET_VARS['template_set'])) { + $template_set = trim($HTTP_GET_VARS['template_set']); + } +} + +$action = (isset($HTTP_POST_VARS['action'])) ? trim($HTTP_POST_VARS['action']) : ""; +if ($action == "") { + if (isset($HTTP_GET_VARS['action'])) { + $action = trim($HTTP_GET_VARS['action']); + } +} + +require $include_path."/include/config.inc.php"; +require $include_path."/include/$POLLDB[class]"; +require $include_path."/include/class_poll.php"; +require $include_path."/include/class_pollcomment.php"; +$CLASS["db"] = new polldb_sql; +$CLASS["db"]->connect(); + +$my_comment = new pollcomment(); + +if (!empty($template_set)) { + $my_comment->set_template_set("$template_set"); +} +if (empty($id)) { + echo $my_comment->print_message("Poll ID <b>".$id."</b> does not exist or is disabled!"); +} elseif ($my_comment->is_comment_allowed($id)) { + if ($action == "add") { + $poll_input = array("message","name","email"); + for($i=0;$i<sizeof($poll_input);$i++) { + if (isset($HTTP_POST_VARS[$poll_input[$i]])) { + $HTTP_POST_VARS[$poll_input[$i]] = trim($HTTP_POST_VARS[$poll_input[$i]]); + } else { + $HTTP_POST_VARS[$poll_input[$i]] = ''; + } + } + if (empty($HTTP_POST_VARS['name'])) { + echo $my_comment->print_message("Please enter your name.<br><a href=\"javascript:history.back()\">Go back</a>"); + } + elseif (empty($HTTP_POST_VARS['message'])) { + echo $my_comment->print_message("You forgot to fill in the message field!<br><a href=\"javascript:history.back()\">Go back</a>"); + } + /* + elseif (empty($HTTP_POST_VARS['email'])) { + echo $my_comment->print_message("You must specify your e-mail address.!<br><a href=\"javascript:history.back()\">Go back</a>"); + } + */ + else { + $my_comment->add_comment($id); + echo $my_comment->print_message("Your message has been sent!",1); + } + } else { + echo $my_comment->poll_form($id); + } +} + ?> \ No newline at end of file Index: poll_cookie.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/poll_cookie.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- poll_cookie.php 2 Jun 2004 13:05:48 -0000 1.1.1.1 +++ poll_cookie.php 18 Sep 2004 16:00:36 -0000 1.2 @@ -1,25 +1,25 @@ -<?php -/** - * ---------------------------------------------- - * this code is optional - * Important! You have to include it - * before your html code - * ---------------------------------------------- - */ - -$cookie_expire = 96; // hours - -$action = (isset($HTTP_GET_VARS['action'])) ? $HTTP_GET_VARS['action'] : ''; -$action = (isset($HTTP_POST_VARS['action'])) ? $HTTP_POST_VARS['action'] : $action; -$poll_ident = (isset($HTTP_GET_VARS['poll_ident'])) ? $HTTP_GET_VARS['poll_ident'] : ''; -$poll_ident = (isset($HTTP_POST_VARS['poll_ident'])) ? $HTTP_POST_VARS['poll_ident'] : $poll_ident; - -if ($action=="vote" && (isset($HTTP_POST_VARS['option_id']) || isset($HTTP_GET_VARS['option_id']))) { - $cookie_name = "AdvancedPoll".$poll_ident; - if (!isset($HTTP_COOKIE_VARS[$cookie_name])) { - $endtime = time()+3600*$cookie_expire; - setcookie($cookie_name, "1", $endtime); - } -} - +<?php +/** + * ---------------------------------------------- + * this code is optional + * Important! You have to include it + * before your html code + * ---------------------------------------------- + */ + +$cookie_expire = 96; // hours + +$action = (isset($HTTP_GET_VARS['action'])) ? $HTTP_GET_VARS['action'] : ''; +$action = (isset($HTTP_POST_VARS['action'])) ? $HTTP_POST_VARS['action'] : $action; +$poll_ident = (isset($HTTP_GET_VARS['poll_ident'])) ? $HTTP_GET_VARS['poll_ident'] : ''; +$poll_ident = (isset($HTTP_POST_VARS['poll_ident'])) ? $HTTP_POST_VARS['poll_ident'] : $poll_ident; + +if ($action=="vote" && (isset($HTTP_POST_VARS['option_id']) || isset($HTTP_GET_VARS['option_id']))) { + $cookie_name = "AdvancedPoll".$poll_ident; + if (!isset($HTTP_COOKIE_VARS[$cookie_name])) { + $endtime = time()+3600*$cookie_expire; + setcookie($cookie_name, "1", $endtime); + } +} + ?> \ No newline at end of file Index: png.php =================================================================== RCS file: /cvsroot/devil-linux/web/poll/png.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- png.php 2 Jun 2004 13:05:48 -0000 1.1.1.1 +++ png.php 18 Sep 2004 16:00:36 -0000 1.2 @@ -1,34 +1,34 @@ -<?php -$include_path = dirname(__FILE__); - -if (!isset($PHP_SELF)) { - $PHP_SELF = $HTTP_SERVER_VARS["PHP_SELF"]; - if (isset($HTTP_GET_VARS)) { - while (list($name, $value)=each($HTTP_GET_VARS)) { - $$name=$value; - } - } - if (isset($HTTP_POST_VARS)) { - while (list($name, $value)=each($HTTP_POST_VARS)) { - $$name=$value; - } - } - if(isset($HTTP_COOKIE_VARS)){ - while (list($name, $value)=each($HTTP_COOKIE_VARS)){ - $$name=$value; - } - } -} - -require $include_path."/include/config.inc.php"; -require $include_path."/include/$POLLDB[class]"; -require $include_path."/include/class_poll.php"; -require $include_path."/include/class_pgfx.php"; - -$CLASS["db"] = new polldb_sql; -$CLASS["db"]->connect(); -$php_poll = new pgfx(); -if (isset($poll_id)) { - $php_poll->output_png($poll_id,100); -} +<?php +$include_path = dirname(__FILE__); + +if (!isset($PHP_SELF)) { + $PHP_SELF = $HTTP_SERVER_VARS["PHP_SELF"]; + if (isset($HTTP_GET_VARS)) { + while (list($name, $value)=each($HTTP_GET_VARS)) { + $$name=$value; + } + } + if (isset($HTTP_POST_VARS)) { + while (list($name, $value)=each($HTTP_POST_VARS)) { + $$name=$value; + } + } + if(isset($HTTP_COOKIE_VARS)){ + while (list($name, $value)=each($HTTP_COOKIE_VARS)){ + $$name=$value; + } + } +} + +require $include_path."/include/config.inc.php"; +require $include_path."/include/$POLLDB[class]"; +require $include_path."/include/class_poll.php"; +require $include_path."/include/class_pgfx.php"; + +$CLASS["db"] = new polldb_sql; +$CLASS["db"]->connect(); +$php_poll = new pgfx(); +if (isset($poll_id)) { + $php_poll->output_png($poll_id,100); +} ?> \ No newline at end of file |