[ Index ]

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

title

Body

[close]

/include/inc_lib/content/ -> cnt50.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 Reference
  34  $content['reference']["list"]         = isset($_POST["cimage_list"]) ? $_POST["cimage_list"] : array();
  35  $content['reference']["width"]        = (intval($_POST["creference_width"]))  ? intval($_POST["creference_width"])  : '';
  36  $content['reference']["height"]        = (intval($_POST["creference_height"])) ? intval($_POST["creference_height"]) : '';
  37  $content['reference']["blockwidth"]    = (intval($_POST["creference_blockwidth"]))  ? intval($_POST["creference_blockwidth"])  : '';
  38  $content['reference']["blockheight"]= (intval($_POST["creference_blockheight"])) ? intval($_POST["creference_blockheight"]) : '';
  39  $temp_width                            = $content['reference']["width"];
  40  $temp_height                        = $content['reference']["height"];
  41  $content['reference']["space"]        = intval($_POST["creference_space"]);
  42  $content['reference']["pos"]        = intval($_POST["creference_pos"]);
  43  $content['reference']["border"]        = intval($_POST["creference_border"]);
  44  $content['reference']["listborder"] = intval($_POST["creference_listborder"]);
  45  $content['reference']["basis"]        = intval($_POST["creference_basis"]);
  46  $content['reference']["caption"]    = clean_slweg($_POST["creference_caption"]);
  47  $content['reference']["zoom"]        = isset($_POST["creference_zoom"]) ? intval($_POST["creference_zoom"]) : 0;
  48  $content['reference']["text"]         = html_specialchars(slweg($_POST["creference_text"]));
  49  $content['reference']["tmpl"]         = clean_slweg($_POST["creference_tmpl"]);
  50  
  51  $content['reference']['showlist']    = 0;
  52  
  53  
  54  if (is_array($content['reference']["list"]) && count($content['reference']["list"])) {
  55      
  56      $img_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE (";
  57      $imgx = 0;
  58      
  59      foreach($content['reference']["list"] as $key => $value) {
  60          unset ($content['reference']["list"][$key]);
  61          $content['reference']["list"][$key]['img_id'] = intval($value);
  62          if ($imgx) $img_sql .= " OR ";
  63          $img_sql .= "f_id=" . $content['reference']["list"][$key]['img_id'];
  64          $imgx++;
  65      }
  66      $img_sql .= ");";
  67  
  68      // check for image information and get alle infos from file
  69      if ($img_result = mysql_query($img_sql, $db) or die("error while getting content image only info")) {
  70          // count images
  71          $content['reference']["col"] = mysql_num_rows($img_result);
  72  
  73          if ($content['reference']["width"] > $phpwcms["content_width"] || $content['reference']["width"] == '') {
  74              $content['reference']["width"] = $phpwcms["content_width"];
  75          }
  76              
  77          $temp_width = $content['reference']["width"] - (2 * $content['reference']["border"]);
  78          $temp_height = $content['reference']["height"] - (2 * $content['reference']["border"]);
  79              
  80          while ($img_row = mysql_fetch_assoc($img_result)) {
  81              foreach($content['reference']["list"] as $key => $value) {
  82                  if ($content['reference']["list"][$key]['img_id'] == $img_row['f_id']) {
  83      
  84                      $content['reference']["list"][$key][0]    = $img_row['f_id'];
  85                      $content['reference']["list"][$key][1]    = $img_row['f_name'];
  86                      $content['reference']["list"][$key][2]    = $img_row['f_hash'];
  87                      $content['reference']["list"][$key][3]    = $img_row['f_ext'];
  88                      $content['reference']["list"][$key][4]    = $temp_width;
  89                      $content['reference']["list"][$key][5]    = $temp_height;
  90  
  91                  }
  92              }
  93          }
  94      }
  95          
  96      // check if more than 1 reference image available
  97      $temp_list_count = count($content['reference']["list"]);
  98      if($temp_list_count > 1) {
  99  
 100          if(!$content['reference']["blockwidth"]) {
 101              $content['reference']["blockwidth"]  = $phpwcms["content_width"];
 102          }
 103          if(!$content['reference']["blockheight"]) {
 104              $content['reference']["blockheight"] = $phpwcms["img_prev_height"];
 105          }
 106                  
 107          $content['reference']['showlist'] = 1;
 108  
 109          // alignment: 0 = horizontal
 110          //            1 = vertical
 111  
 112          if(!$content['reference']["basis"]) {
 113  
 114              $temp_list_width = $content['reference']["blockwidth"] - (($temp_list_count - 1) * $content['reference']["space"]);
 115              $temp_list_width = $temp_list_width / $temp_list_count;
 116              $temp_list_width = $temp_list_width - (2 * $content['reference']["listborder"]);
 117              $temp_list_width = intval($temp_list_width);
 118              if($temp_list_width <= 0) $temp_list_width = 10;
 119              $content['reference']["temp_list_width"]  = $temp_list_width;
 120              $content['reference']["temp_list_height"] = '';
 121                  
 122          } else {
 123              
 124              $temp_list_height = $content['reference']["blockheight"] - (($temp_list_count - 1) * $content['reference']["space"]);
 125              $temp_list_height = $temp_list_height / $temp_list_count;
 126              $temp_list_height = $temp_list_height - (2 * $content['reference']["listborder"]);
 127              $temp_list_height = intval($temp_list_height);
 128              if($temp_list_height <= 0) $temp_list_height = 10;
 129              $content['reference']["temp_list_height"] = $temp_list_height;
 130              $content['reference']["temp_list_width"]  = '';
 131                              
 132          }
 133      }
 134          
 135  
 136  }
 137  
 138  
 139  ?>


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