[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_lib/content/ -> cnt89.readform.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 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  // ----------------------------------------------------------------
  25  // obligate check for phpwcms constants
  26  if (!defined('PHPWCMS_ROOT')) {
  27     die("You Cannot Access This Script Directly, Have a Nice Day.");
  28  }
  29  // ----------------------------------------------------------------
  30  
  31  
  32  
  33  // Content Type 89: Poll            jens
  34  
  35  $content["poll_list"]         = isset($_POST["cimage_list"]) ? $_POST["cimage_list"] : array();
  36  
  37  $content["img_width"]        = intval($_POST["cpoll_width"]) ? intval($_POST["cpoll_width"]) : "";
  38  $temp_width                    = $content["img_width"];
  39  
  40  $content["img_height"]         = intval($_POST["cpoll_height"]) ? intval($_POST["cpoll_height"]) : "";
  41  $temp_height                 = $content["img_height"];
  42  
  43  $content["poll_caption"]     = clean_slweg($_POST["cpoll_caption"], 65000);
  44  $content["poll_zoom"]         = isset($_POST["cpoll_zoom"]) ? 1 : 0;
  45  $content["poll_cctext"]     = explode("\n", $content["poll_caption"]);
  46  
  47  $content["poll_buttontext"]     = clean_slweg($_POST["cpoll_buttontext"]);
  48  $content["poll_buttonstyle"]     = clean_slweg($_POST["cpoll_buttonstyle"]);
  49  /* not really neccessary, if empty default submit text is used
  50  if(empty($content["poll_buttontext"])) {
  51      $content["poll_buttontext"] = "";
  52  }
  53  */
  54  
  55  $content['tmp_images']        = array();
  56  $imgx = 0;
  57  
  58  if (is_array($content["poll_list"]) && sizeof($content["poll_list"])) 
  59  {
  60      $img_sql = "SELECT * FROM " . DB_PREPEND . "phpwcms_file WHERE (";
  61      $img_sort = array();
  62  
  63      foreach($content["poll_list"] as $key => $value) 
  64      {
  65          if ($imgx) $img_sql .= " OR ";
  66          $img_sql .= "f_id=" . intval($value);
  67          $imgx++; 
  68      }
  69      if(!$imgx) 
  70      {
  71          $img_sql .= "0";
  72      }
  73      $img_sql .= ")";
  74  
  75      if ($img_result = mysql_query($img_sql, $db) or die("error while getting content image only info")) 
  76      {
  77      
  78          $temp_count_img = $imgx;
  79          
  80          $temp_img_maxwidth = $phpwcms["content_width"];
  81  
  82          if (($content["img_width"] > $temp_img_maxwidth) || ($content["img_width"] == "")) 
  83          {
  84              $content["img_width"] = $temp_img_maxwidth;
  85              $temp_width = $content["img_width"];
  86          }
  87          
  88          $imgx = 0;
  89          
  90          $temp_img_row = array();
  91          while ($img_row = mysql_fetch_assoc($img_result)) 
  92          {
  93              $temp_img_row[$img_row['f_id']] = $img_row;
  94          }
  95          mysql_free_result($img_result);
  96          
  97          foreach($content["poll_list"] as $key => $value) 
  98          {
  99              if(isset($temp_img_row[$value])) 
 100              {
 101                  $content['tmp_images'][$key][0]    = $temp_img_row[$value]['f_id'];
 102                  $content['tmp_images'][$key][1]    = $temp_img_row[$value]['f_name'];
 103                  $content['tmp_images'][$key][2]    = $temp_img_row[$value]['f_hash'];
 104                  $content['tmp_images'][$key][3]    = $temp_img_row[$value]['f_ext'];
 105                  $content['tmp_images'][$key][4]    = $temp_width;
 106                  $content['tmp_images'][$key][5]    = $temp_height;
 107              }
 108          }        
 109      }
 110  }
 111  
 112  
 113  $content['poll_list']                 = array();
 114  $content['poll_list']['images']    = $content['tmp_images'];
 115  $content['poll_list']['width']        = $temp_width;
 116  $content['poll_list']['height']    = $temp_height;
 117  $content['poll_list']['zoom']        = $content["poll_zoom"];
 118  
 119  $content['poll_form']['choice']    = $content['poll_cctext'];
 120  $content['poll_form']['count'] = array();
 121  $content['poll_form']['ip'] = array();
 122  foreach($content['poll_cctext'] as $key => $value)
 123  {
 124      $content['poll_form']['count'][$key] = 0; // initialize count to zero
 125  }
 126  
 127  $content['poll_text']['poll_buttontext']    = $content['poll_buttontext'];
 128  $content['poll_text']['poll_buttonstyle']    = $content['poll_buttonstyle'];
 129  
 130  
 131  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7