[Phpslash-commit] CVS: phpslash-ft/class Poll.class,1.14,1.15
Brought to you by:
joestewart,
nhruby
From: nathan h. <nh...@us...> - 2002-04-28 19:38:25
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv630/class Modified Files: Poll.class Log Message: Poll Cleanups Index: Poll.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Poll.class,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Poll.class 27 Apr 2002 21:50:12 -0000 1.14 --- Poll.class 28 Apr 2002 01:55:08 -0000 1.15 *************** *** 37,49 **** $this->templ->debug = 0; $this->templ->set_file(array( ! 'editpoll' => "pollEdit.tpl", ! 'listpoll' => "pollList.tpl", ! 'showpoll' => "pollShow.tpl", ! 'resultpage' => "pollResultPage.tpl", ! 'displaypoll' => "pollDisplay.tpl" )); $this->templ->set_var(array( ! 'TITLE' => "Poll Module", ! 'ACTION_URL' => $_PSL['adminurl'] . "/pollAdmin.php3", 'ROOTURL' => $_PSL['rooturl'], 'IMAGEURL' => $_PSL['imageurl'] --- 37,49 ---- $this->templ->debug = 0; $this->templ->set_file(array( ! 'editpoll' => 'pollEdit.tpl', ! 'listpoll' => 'pollList.tpl', ! 'showpoll' => 'pollShow.tpl', ! 'resultpage' => 'pollResultPage.tpl', ! 'displaypoll' => 'pollDisplay.tpl' )); $this->templ->set_var(array( ! 'TITLE' => 'Poll Module', ! 'ACTION_URL' => $_PSL['adminurl'] . '/pollAdmin.php3', 'ROOTURL' => $_PSL['rooturl'], 'IMAGEURL' => $_PSL['imageurl'] *************** *** 60,76 **** function newPoll() { ! titlebar("100%", "Create A New Poll"); $this->templ->set_var(array( ! 'QUESTION_ID' => "", ! 'QUESTION' => "", ! 'NUM_VOTERS' => "0", ! 'CURRENT' => "checked" )); $this->templ->set_block(editpoll, each_choice, choices); for ($i = 1; $i <= $this->psl['poll_max_answers']; $i++) { $this->templ->set_var(array( ! 'CHOICE_VALUE' => "", ! 'NUM_VOTES_VALUE' => "0" )); $this->templ->parse('choices', 'each_choice', true); --- 60,76 ---- function newPoll() { ! titlebar('100%', 'Create A New Poll'); $this->templ->set_var(array( ! 'QUESTION_ID' => '', ! 'QUESTION' => '', ! 'NUM_VOTERS' => '0', ! 'CURRENT' => 'checked' )); $this->templ->set_block(editpoll, each_choice, choices); for ($i = 1; $i <= $this->psl['poll_max_answers']; $i++) { $this->templ->set_var(array( ! 'CHOICE_VALUE' => '', ! 'NUM_VOTES_VALUE' => '0' )); $this->templ->parse('choices', 'each_choice', true); *************** *** 86,91 **** function makeCurrent ($question_id) { ! if ($question_id == "") { ! $this->message = "No Question ID"; return false; } else { --- 86,91 ---- function makeCurrent ($question_id) { ! if ($question_id == '') { ! $this->message = 'No Question ID'; return false; } else { *************** *** 123,127 **** if ($aff == 1) { $this->db->next_record(); ! return $this->db->f("question_id"); } else { $this->message = "Either there were no current polls, or more then one? Affected Rows is: '$aff'"; --- 123,127 ---- if ($aff == 1) { $this->db->next_record(); ! return $this->db->f('question_id'); } else { $this->message = "Either there were no current polls, or more then one? Affected Rows is: '$aff'"; *************** *** 137,141 **** if (!$question_id) { ! $this->message = "No ID to edit"; return false; } --- 137,141 ---- if (!$question_id) { ! $this->message = 'No ID to edit'; return false; } *************** *** 155,169 **** } else { ! titlebar("100%", "Edit An Existing Poll"); ! if ($this->db->f("current")) { ! $current = "checked"; } else { ! $current = ""; }; $this->templ->set_var(array( 'QUESTION_ID' => $question_id, ! 'QUESTION' => $this->db->f("question_text"), 'CURRENT' => $current )); --- 155,169 ---- } else { ! titlebar('100%', 'Edit An Existing Poll'); ! if ($this->db->f('current')) { ! $current = 'checked'; } else { ! $current = ''; }; $this->templ->set_var(array( 'QUESTION_ID' => $question_id, ! 'QUESTION' => $this->db->f('question_text'), 'CURRENT' => $current )); *************** *** 181,186 **** $x++; $this->templ->set_var(array( ! 'CHOICE_VALUE' => $this->db->f("answer_text"), ! 'NUM_VOTES_VALUE' => $this->db->f("votes") )); $this->templ->parse('choices', 'each_choice', true); --- 181,186 ---- $x++; $this->templ->set_var(array( ! 'CHOICE_VALUE' => $this->db->f('answer_text'), ! 'NUM_VOTES_VALUE' => $this->db->f('votes') )); $this->templ->parse('choices', 'each_choice', true); *************** *** 190,195 **** $x++; $this->templ->set_var(array( ! 'CHOICE_VALUE' => "", ! 'NUM_VOTES_VALUE' => "" )); $this->templ->parse('choices', 'each_choice', true); --- 190,195 ---- $x++; $this->templ->set_var(array( ! 'CHOICE_VALUE' => '', ! 'NUM_VOTES_VALUE' => '' )); $this->templ->parse('choices', 'each_choice', true); *************** *** 214,221 **** if (empty($question)) { ! $this->message = "Silly admin! You need to have a question before you can have a poll."; return false; } elseif (empty($ary['choice_ary'][0]) || empty($ary['choice_ary'][1])) { ! $this->message = "You need to have at least 2 possible answers, otherwise it wouldn't be a very effective poll, would it?"; return false; } --- 214,221 ---- if (empty($question)) { ! $this->message = 'Silly admin! You need to have a question before you can have a poll.'; return false; } elseif (empty($ary['choice_ary'][0]) || empty($ary['choice_ary'][1])) { ! $this->message = 'You need to have at least 2 possible answers, otherwise it wouldn't be a very effective poll, would it?'; return false; } *************** *** 230,234 **** * value in question_id */ ! if ($ary['question_id'] != "") { /* existing poll */ --- 230,234 ---- * value in question_id */ ! if ($ary['question_id'] != '') { /* existing poll */ *************** *** 277,282 **** /* if the "current" box is checked, then run the makeCurrent method */ ! if ($ary[currentqid] != "") { ! if (!$this->makeCurrent($ary[question_id])) { $this->message = "There was an error in setting "$question" as the current poll: $this->message\n"; return false; --- 277,282 ---- /* if the "current" box is checked, then run the makeCurrent method */ ! if ($ary['currentqid'] != '') { ! if (!$this->makeCurrent($ary['question_id'])) { $this->message = "There was an error in setting "$question" as the current poll: $this->message\n"; return false; *************** *** 289,296 **** $vote = clean($votes_ary[$x]); ! if ($answer == "") { $msg .= "Choice $x was ignored<BR>\n"; } else { ! if ($vote == "") { $vote = 0; } --- 289,296 ---- $vote = clean($votes_ary[$x]); ! if ($answer == '') { $msg .= "Choice $x was ignored<BR>\n"; } else { ! if ($vote == '') { $vote = 0; } *************** *** 348,353 **** } ! if ($question_id == "") { ! $this->message = "No question_id in Poll::deletePoll"; return false; } --- 348,353 ---- } ! if ($question_id == '') { ! $this->message = 'No question_id in Poll::deletePoll'; return false; } *************** *** 360,364 **** $this->db->query($q); if ($this->db->next_record()) { ! $question_text = $this->db->f("question_text"); } else { $this->message = "I couldn't find your Poll, $question_id??"; --- 360,364 ---- $this->db->query($q); if ($this->db->next_record()) { ! $question_text = $this->db->f('question_text'); } else { $this->message = "I couldn't find your Poll, $question_id??"; *************** *** 372,376 **** WHERE question_id = '$question_id'"; if (!$this->db->query($q)) { ! $this->message = "There was an error deleting your poll answers"; return false; } --- 372,376 ---- WHERE question_id = '$question_id'"; if (!$this->db->query($q)) { ! $this->message = 'There was an error deleting your poll answers'; return false; } *************** *** 380,384 **** WHERE question_id = '$question_id'"; if (!$this->db->query($q)) { ! $this->message = "There was an error deleting your poll question"; return false; } --- 380,384 ---- WHERE question_id = '$question_id'"; if (!$this->db->query($q)) { ! $this->message = 'There was an error deleting your poll question'; return false; } *************** *** 388,397 **** WHERE question_id = '$question_id'"; if (!$this->db->query($q)) { ! $this->message = "THere was an error removing the votes"; return false; } $cmt = new Comment; ! $del = $cmt->delete("0",$question_id); $this->message = "Poll "$question_text" was <em>deleted</em><br>\n"; --- 388,397 ---- WHERE question_id = '$question_id'"; if (!$this->db->query($q)) { ! $this->message = 'THere was an error removing the votes'; return false; } $cmt = new Comment; ! $del = $cmt->delete('0',$question_id); $this->message = "Poll "$question_text" was <em>deleted</em><br>\n"; *************** *** 406,410 **** // Ass-u-me that the vote was successful. ! $this->message = pslgetText("Your vote has been registered"); if (!$remote_addr) { --- 406,410 ---- // Ass-u-me that the vote was successful. ! $this->message = pslgetText('Your vote has been registered'); if (!$remote_addr) { *************** *** 482,490 **** return false; } else { ! $totalvotes = $this->db->f("question_total_votes"); ! $question = $this->db->f("question_text"); ! $maxvotes = $this->db->f("maxvotes"); ! titlebar("100%","$question"); $query = "SELECT answer_text, --- 482,490 ---- return false; } else { ! $totalvotes = $this->db->f('question_total_votes'); ! $question = $this->db->f('question_text'); ! $maxvotes = $this->db->f('maxvotes'); ! titlebar('100%',$question); $query = "SELECT answer_text, *************** *** 514,518 **** $this->templ->set_var(array( ! 'ANSWER' => $this->db->f("answer_text"), 'ROOTDIR' => $this->psl['rooturl'], 'IMAGEWIDTH' => $imagewidth, --- 514,518 ---- $this->templ->set_var(array( ! 'ANSWER' => $this->db->f('answer_text'), 'ROOTDIR' => $this->psl['rooturl'], 'IMAGEWIDTH' => $imagewidth, *************** *** 525,533 **** if ($percent == 0) { ! $this->templ->parse("choices", "zerobar", true); } else { ! $this->templ->parse("choices", "regbar", true); }; ! $this->templ->parse("choices", "each_choice", true); } $this->templ->parse('FORM', 'showpoll'); --- 525,533 ---- if ($percent == 0) { ! $this->templ->parse('choices', 'zerobar', true); } else { ! $this->templ->parse('choices', 'regbar', true); }; ! $this->templ->parse('choices', 'each_choice', true); } $this->templ->parse('FORM', 'showpoll'); *************** *** 552,561 **** $this->db->query($q); ! titlebar("100%", $this->psl[site_name] . " Polls"); ! $this->templ->set_block("listpoll","newpollbutton"); ! $this->templ->set_block("listpoll","morelink"); ! $this->templ->set_block("listpoll","row", "rows"); ! $this->templ->set_block("row","admin"); /* advance the db pointer to $min */ --- 552,561 ---- $this->db->query($q); ! titlebar('100%', $this->psl[site_name] . ' Polls'); ! $this->templ->set_block('listpoll', 'newpollbutton'); ! $this->templ->set_block('listpoll', 'morelink'); ! $this->templ->set_block('listpoll', 'row', 'rows'); ! $this->templ->set_block('row', 'admin'); /* advance the db pointer to $min */ *************** *** 565,588 **** } while ($this->db->next_record() && ($min + 20) > $thisid++) { ! $action = $this->templ->get("ACTION_URL"); $this->templ->set_var(array( ! 'ADMIN_URL' => $this->psl['adminurl'] . "/pollAdmin.php3", ! 'QUESTION_ID' => $this->db->f("question_id"), ! 'QUESTION' => $this->db->f("question_text"), ! 'POLLDATE' => $this->db->f("polldate"), 'ID' => $thisid )); /* if no perms, then clear the admin var */ ! if (!$this->perm->have_perm("poll")) { ! $this->templ->set_var("admin",""); } $this->templ->parse('rows','row',true); } if (!$this->db->next_record()) { ! $this->templ->set_var("morelink",""); } ! if (!$this->perm->have_perm("poll")) { ! $this->templ->set_var("newpollbutton",""); } $this->templ->parse('OUT','listpoll'); --- 565,588 ---- } while ($this->db->next_record() && ($min + 20) > $thisid++) { ! $action = $this->templ->get('ACTION_URL'); $this->templ->set_var(array( ! 'ADMIN_URL' => $this->psl['adminurl'] . '/pollAdmin.php3', ! 'QUESTION_ID' => $this->db->f('question_id'), ! 'QUESTION' => $this->db->f('question_text'), ! 'POLLDATE' => $this->db->f('polldate'), 'ID' => $thisid )); /* if no perms, then clear the admin var */ ! if (!$this->perm->have_perm('poll')) { ! $this->templ->set_var('admin',''); } $this->templ->parse('rows','row',true); } if (!$this->db->next_record()) { ! $this->templ->set_var('morelink',''); } ! if (!$this->perm->have_perm('poll')) { ! $this->templ->set_var('newpollbutton',''); } $this->templ->parse('OUT','listpoll'); *************** *** 602,608 **** * booth that you see on the main page. */ ! function getPollBooth($question_id = "") { ! if ($question_id == "") { $question_id = $this->getCurrent(); } --- 602,608 ---- * booth that you see on the main page. */ ! function getPollBooth($question_id = '') { ! if ($question_id == '') { $question_id = $this->getCurrent(); } *************** *** 622,636 **** $this->db->query($q); ! $this->templ->set_block("displaypoll", "each_choice", "choices"); while ($this->db->next_record()) { $this->templ->set_var(array( 'QUESTION_ID' => $question_id, ! 'QUESTION' => $this->db->f("question_text"), ! 'ANSWER_ID' => $this->db->f("answer_id"), ! 'ANSWER' => $this->db->f("answer_text"), ! 'COMMENT_COUNT' => $this->db->f("count"), ! 'VOTE_COUNT' => $this->db->f("question_total_votes"), ! 'ACTION_URL' => $this->psl['rooturl'] . "/poll.php3" )); $this->templ->parse('choices', 'each_choice', true); --- 622,636 ---- $this->db->query($q); ! $this->templ->set_block('displaypoll', 'each_choice', 'choices'); while ($this->db->next_record()) { $this->templ->set_var(array( 'QUESTION_ID' => $question_id, ! 'QUESTION' => $this->db->f('question_text'), ! 'ANSWER_ID' => $this->db->f('answer_id'), ! 'ANSWER' => $this->db->f('answer_text'), ! 'COMMENT_COUNT' => $this->db->f('count'), ! 'VOTE_COUNT' => $this->db->f('question_total_votes'), ! 'ACTION_URL' => $this->psl['rooturl'] . '/poll.php3' )); $this->templ->parse('choices', 'each_choice', true); |