[ Index ]

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

title

Body

[close]

/include/inc_module/mod_ads/inc/ -> processing.adplace.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  // 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  
  31  // try
  32  
  33  if(isset($_GET['edit'])) {
  34      $plugin['id']        = intval($_GET['edit']);
  35  } else {
  36      $plugin['id']        = 0;
  37  }
  38  
  39  
  40  // process post form
  41  if(isset($_POST['adplace_title'])) {
  42  
  43      $plugin['data'] = array(
  44                  
  45                  'adplace_id'            => intval($_POST['adplace_id']),
  46                  'adplace_title'            => clean_slweg($_POST['adplace_title']),
  47                  'adplace_created'        => date('Y-m-d H:i:s'),
  48                  'adplace_changed'        => date('Y-m-d H:i:s'),
  49                  'adplace_status'        => empty($_POST['adplace_status']) ? 0 : 1,
  50                  'adplace_format'        => intval($_POST['adplace_format']),
  51                  'adplace_width'            => intval($_POST['adplace_width']),
  52                  'adplace_height'        => intval($_POST['adplace_height']),
  53                  'adplace_prefix'        => slweg($_POST['adplace_prefix']),
  54                  'adplace_suffix'        => slweg($_POST['adplace_suffix'])
  55                  
  56                              );
  57                                  
  58                                  
  59      if(empty($plugin['data']['adplace_title'])) {
  60      
  61          $plugin['error']['adplace_title'] = 1;
  62      
  63      }
  64      
  65      if(empty($plugin['data']['adplace_format'])) {
  66      
  67          $plugin['error']['adplace_format'] = 1;
  68      
  69      }    
  70      
  71      if(!isset($plugin['error'])) {
  72      
  73          if($plugin['data']['adplace_id']) {
  74          
  75              // UPDATE
  76              $sql  = 'UPDATE '.DB_PREPEND.'phpwcms_ads_place SET ';
  77              
  78              $sql .= "adplace_changed='".    aporeplace($plugin['data']['adplace_changed'])    ."', ";
  79              $sql .= "adplace_status=".        $plugin['data']['adplace_status']                .", ";
  80              $sql .= "adplace_title='".        aporeplace($plugin['data']['adplace_title'])    ."', ";
  81              $sql .= "adplace_format=".        $plugin['data']['adplace_format']                .", ";
  82              $sql .= "adplace_width=".        $plugin['data']['adplace_width']                .", ";
  83              $sql .= "adplace_height=".        $plugin['data']['adplace_height']                .", ";
  84              $sql .= "adplace_prefix='".        aporeplace($plugin['data']['adplace_prefix'])    ."', ";
  85              $sql .= "adplace_suffix='".        aporeplace($plugin['data']['adplace_suffix'])    ."' ";
  86              
  87              $sql .= "WHERE adplace_id=".$plugin['data']['adplace_id'];
  88              
  89              if(@_dbQuery($sql, 'UPDATE')) {
  90              
  91                  if(isset($_POST['save'])) {
  92                      
  93                      headerRedirect(decode_entities(MODULE_HREF).'&listadplace=1');
  94                      
  95                  }
  96              
  97              } else {
  98              
  99                  $plugin['error']['update'] = mysql_error();
 100              
 101              }
 102              
 103          
 104          } else {
 105          
 106              // INSERT
 107              $sql  = 'INSERT INTO '.DB_PREPEND.'phpwcms_ads_place (';
 108              $sql .= 'adplace_created, adplace_changed, adplace_status, adplace_title, ';
 109              $sql .= 'adplace_format, adplace_width, adplace_height, adplace_prefix, adplace_suffix';        
 110              $sql .= ') VALUES (';
 111              $sql .= "'".aporeplace($plugin['data']['adplace_created'])    ."', ";
 112              $sql .= "'".aporeplace($plugin['data']['adplace_changed'])    ."', ";
 113              $sql .=     $plugin['data']['adplace_status']                .", ";
 114              $sql .= "'".aporeplace($plugin['data']['adplace_title'])    ."', ";
 115              $sql .=     $plugin['data']['adplace_format']                .", ";
 116              $sql .=     $plugin['data']['adplace_width']                .", ";
 117              $sql .=     $plugin['data']['adplace_height']                .", ";
 118              $sql .= "'".aporeplace($plugin['data']['adplace_prefix'])    ."', ";
 119              $sql .= "'".aporeplace($plugin['data']['adplace_suffix'])    ."'";
 120              $sql .= ')';
 121              
 122              if(@_dbQuery($sql, 'INSERT')) {
 123              
 124                  if(isset($_POST['save'])) {
 125                      
 126                      headerRedirect(decode_entities(MODULE_HREF).'&listadplace=1');
 127                      
 128                  }
 129              
 130              } else {
 131              
 132                  $plugin['error']['update'] = mysql_error();
 133              
 134              }
 135          
 136          
 137          }
 138      }
 139  
 140  }
 141  
 142  // try to read entry from database
 143  if($plugin['id'] && !isset($plugin['error'])) {
 144  
 145      $sql  = 'SELECT * FROM '.DB_PREPEND.'phpwcms_ads_place WHERE adplace_id='.$plugin['id'];
 146      $plugin['data'] = _dbQuery($sql);
 147      $plugin['data'] = $plugin['data'][0];
 148          
 149  }
 150  
 151  // default values
 152  if(empty($plugin['data'])) {
 153  
 154      $plugin['data'] = array(
 155      
 156                  'adplace_id'            => 0,
 157                  'adplace_title'            => '',
 158                  'adplace_created'        => '',
 159                  'adplace_changed'        => date('Y-m-d H:i:s'),
 160                  'adplace_status'        => 0,
 161                  'adplace_format'        => 0,
 162                  'adplace_width'            => 0,
 163                  'adplace_height'        => 0,
 164                  'adplace_prefix'        => '',
 165                  'adplace_suffix'        => ''
 166      
 167                              );
 168  
 169  }
 170  
 171  
 172  
 173  ?>


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