[ Index ] |
PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 // content type 89: poll jens 31 $poll_html = ""; 32 $poll_image = @unserialize($crow["acontent_image"]); 33 $poll_text = @unserialize($crow["acontent_text"]); 34 $poll_form = @unserialize($crow["acontent_form"]); 35 $poll_choice_count = 0; 36 $remoteIP = getRemoteIP(); 37 38 if(!isset($poll_form["ip"])) { 39 $poll_form["ip"] = array(); 40 } 41 42 $poll_id = isset($_POST["hidden_acontent_id"]) ? intval($_POST["hidden_acontent_id"]) : 0; 43 $poll_count = max(count($poll_form["choice"]), count($poll_image["images"])); 44 45 if($poll_id == $crow['acontent_id'] && isset($_POST["poll"]) && !in_array($remoteIP, $poll_form["ip"])) { 46 $poll_choosen = intval($_POST["poll"]); 47 $poll_form["count"][$poll_choosen] += 1; 48 $poll_form["ip"][] = $remoteIP; 49 $poll_choice_count = $poll_form["count"][$poll_choosen]; 50 51 $sql = "UPDATE ".DB_PREPEND."phpwcms_articlecontent "; 52 $sql .= "SET acontent_form ='".aporeplace(serialize($poll_form))."' "; 53 $sql .= "WHERE acontent_id = ".$poll_id." LIMIT 1"; 54 @mysql_query($sql, $db); 55 } 56 57 58 59 $CNT_TMP .= '<div class="'; 60 $CNT_TMP .= empty($poll_text['poll_buttonstyle']) ? 'defaultPollClass' : $poll_text['poll_buttonstyle']; 61 $CNT_TMP .= "\">\n"; 62 $CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]); 63 64 65 66 if(in_array($remoteIP, $poll_form["ip"])) { 67 $poll_total_votes = 0; 68 foreach($poll_form["count"] as $key => $value) { 69 $poll_total_votes += $value; 70 } 71 if($poll_total_votes > 0) { 72 $poll_html .= '<table cellpadding="0" cellspacing="0" border="0">'; 73 74 for($key = 0; $key < $poll_count; $key++) 75 { 76 $poll_html .= "\n<tr>\n\t<td>"; 77 $poll_do_br = ''; 78 $poll_form["choice"][$key] = isset($poll_form["choice"][$key]) ? trim($poll_form["choice"][$key]) : ''; 79 if(!empty($poll_form["choice"][$key])) { 80 $poll_html .= html_specialchars($poll_form["choice"][$key]); 81 $poll_do_br = '<br />'; 82 } 83 if(is_array($poll_image["images"][$key]) && count($poll_image["images"][$key])) 84 { 85 $poll_html .= $poll_do_br; 86 $poll_html .= showPollImage($poll_image["images"][$key]); 87 } 88 $barWidth = round(($poll_form["count"][$key] / $poll_total_votes * 100), 0); 89 $poll_html .= "</td>\n\t".'<td class="pollBarCell">'; 90 $poll_html .= '<span class="pollBarBegin"><!-- --></span>'; 91 $poll_html .= '<span class="pollBarMain" style="width:'.$barWidth.'px;"><!-- --></span>'; 92 $poll_html .= '<span class="pollBarPercent">'.$barWidth."%</span></td>\n</tr>\n"; 93 } 94 $poll_html .= "</table>"; 95 } 96 } elseif((is_array($poll_form["choice"]) && count($poll_form["choice"])) || (is_array($poll_image["images"]) && count($poll_image["images"]))) { 97 98 $form_name = "form_".randpassword(6); 99 $poll_html .= '<form action="'.FE_CURRENT_URL.'" method="post" name="'.$form_name.'" id="'.$form_name.'">'; 100 $poll_html .= '<table cellpadding="0" cellspacing="0" border="0">'; 101 102 for($key = 0; $key < $poll_count; $key++) { 103 104 $poll_html .= "\n<tr>\n\t".'<td class="pollRadioCell">'; 105 $poll_html .= '<input type="radio" name="poll" value="'.$key.'" />'; 106 $poll_html .= "</td>\n\t"; 107 $poll_html .= '<td class="pollInfo">'; 108 109 $poll_do_br = ''; 110 111 $poll_form["choice"][$key] = isset($poll_form["choice"][$key]) ? trim($poll_form["choice"][$key]) : ''; 112 if(!empty($poll_form["choice"][$key])) { 113 $poll_html .= $poll_form["choice"][$key]; 114 $poll_do_br = '<br />'; 115 } 116 if(is_array($poll_image["images"][$key]) && count($poll_image["images"][$key])) { 117 $poll_html .= $poll_do_br; 118 $poll_html .= showPollImage($poll_image["images"][$key]); 119 } 120 $poll_html .= "</td>\n</tr>"; 121 } 122 $poll_html .= "</table>\n"; 123 $poll_html .= '<input type="submit"'; 124 $poll_html .= empty($poll_text['poll_buttontext']) ? '' : ' value="'.html_specialchars($poll_text['poll_buttontext']).'"'; 125 $poll_html .= ' class="pollSubmitButton" />'; 126 $poll_html .= '<input type="hidden" value="'.$crow['acontent_id'].'" name="hidden_acontent_id" />'; 127 $poll_html .= "</form>"; 128 } 129 130 $CNT_TMP .= $poll_html; 131 $CNT_TMP .= "\n</div>\n"; 132 133 unset($poll_image); 134 unset($poll_text); 135 unset($poll_form); 136 137 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jan 29 16:31:14 2012 | Cross-referenced by PHPXref 0.7.1 |