[ Index ]

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

title

Body

[close]

/include/inc_lib/content/ -> cnt7.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 File List
  34  //
  35  $content["file_list"]                = isset($_POST["cfile_list"]) && is_array($_POST["cfile_list"]) ? $_POST["cfile_list"] : array();
  36  $content["file_template"]            = clean_slweg($_POST['cfile_template']);
  37  $content['file']['direct_download']    = empty($_POST['cfile_direct']) ? 0 : 1;
  38  $content["html"]                    = slweg($_POST["chtml"]);
  39  
  40  preg_match_all('/<\/p/is', $content["html"], $matches);
  41  if(isset($matches[0]) && is_array($matches[0]) && count($matches[0]) == 1) {
  42      //$content["html"] = strip_selected_tags($content["html"], array('p'));
  43  }
  44  
  45  //
  46  // first get all file IDs
  47  //
  48  if (count($content["file_list"])) {
  49      foreach($content["file_list"] as $key => $value) {
  50          if (intval($value)) {
  51              $content["file_list"][$key] = intval($value);
  52          } else {
  53              unset($content["file_list"][$key]);
  54          } 
  55      } 
  56      if (count($content["file_list"])) {
  57          $content["file_id_list"] = implode(":", $content["file_list"]);
  58      } else {
  59          $content["file_id_list"] = '';
  60      } 
  61  } 
  62  
  63  $content["file_descr"] = explode("\n", slweg($_POST["cfile_descr"], 0, false));
  64  
  65  //
  66  // now check if there are more settings for each file - explode by |
  67  //
  68  // [0] = normal file description like before
  69  // [1] = name the file (it's not the file name)
  70  // [2] = title
  71  // [3] = target (where to open a new file -> default is _blank even if empty
  72  // [4] = if it is an image try to show a thumbnail instead of the file icon -> here thumbnail WIDTHxHEIGHT
  73  
  74  if(count($content["file_descr"])) {
  75  
  76      foreach($content["file_descr"] as $key => $value) {
  77      
  78          $value = explode('|', $value, 5);
  79          
  80          $value[0] = trim($value[0], ' ');
  81          $value[1] = empty($value[1]) ? '' : trim($value[1]);
  82          $value[2] = empty($value[2]) ? '' : trim($value[2]);
  83          $value[3] = empty($value[3]) ? '' : trim($value[3]);
  84          $value[4] = empty($value[4]) ? '' : strtolower(trim($value[4]));
  85          
  86          $value[4] = explode('x', $value[4]);
  87          $value[4][0] = intval($value[4][0]);
  88          if(empty($value[4][0])) $value[4][0] = '';
  89          
  90          if(empty($value[4][1])) {
  91              $value[4][1] = '';
  92          } else {
  93              $value[4][1] = intval($value[4][1]);
  94              if(empty($value[4][1])) $value[4][1] = '';
  95          }
  96          $value[4][2] = empty($value[4][2]) ? '' : (intval($value[4][2]) ? 'x1' : '');
  97          $value[4] = ($value[4][0].$value[4][1]) == '' ? '' : $value[4][0].'x'.$value[4][1].$value[4][2];
  98  
  99          if(empty($value[4]))
 100          {
 101              unset($value[4]);
 102              if(empty($value[3]))
 103              {
 104                  unset($value[3]);
 105                  if(empty($value[2]))
 106                  {
 107                      unset($value[2]);
 108                      if(empty($value[1]))
 109                      {
 110                          unset($value[1]);
 111                      }
 112                  }
 113              }
 114          }
 115          $content["file_descr"][$key] = implode('|', $value);
 116          $value = '';
 117      } 
 118  
 119      $content["file_descr"] = implode("\n", $content["file_descr"]);
 120  
 121  
 122  } else {
 123  
 124      $content["file_descr"] = '';
 125  
 126  }
 127  
 128  
 129  
 130  
 131  
 132  ?>


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