[ Index ]

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

title

Body

[close]

/include/inc_module/mod_ads/inc/ -> processing.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['adcampaign_title'])) {
  42  
  43      $plugin['data'] = array(
  44      
  45                  'adcampaign_id'            => intval($_POST['adcampaign_id']),
  46                  'adcampaign_title'        => clean_slweg($_POST['adcampaign_title']),
  47                  'adcampaign_created'    => date('Y-m-d H:i:s'),
  48                  'adcampaign_changed'    => date('Y-m-d H:i:s'),
  49                  'adcampaign_comment'    => clean_slweg($_POST['adcampaign_comment']),
  50                  'adcampaign_data'        => array(
  51                  
  52                      'max_views'            => intval($_POST['adcampaign_max_views']),
  53                      'max_click'            => intval($_POST['adcampaign_max_click']),
  54                      'width'                => intval($_POST['adcampaign_width']),
  55                      'height'            => intval($_POST['adcampaign_height']),
  56                      'unique'            => empty($_POST['adcampaign_unique']) ? 0 : 1,
  57                      'url'                => clean_slweg($_POST['adcampaign_url']),
  58                      'target'            => clean_slweg($_POST['adcampaign_target'])
  59                  
  60                  ),
  61                  'adcampaign_status'        => empty($_POST['adcampaign_status']) ? 0 : 1,
  62                  'adcampaign_date_start'    => clean_slweg($_POST['adcampaign_date_start']),
  63                  'adcampaign_date_end'    => clean_slweg($_POST['adcampaign_date_end']),
  64                  'adcampaign_time_start'    => clean_slweg($_POST['adcampaign_time_start']),
  65                  'adcampaign_time_end'    => clean_slweg($_POST['adcampaign_time_end']),
  66                  'adcampaign_format'        => intval($_POST['adcampaign_format'])
  67                                  );
  68                                  
  69                                  
  70      if(empty($plugin['data']['adcampaign_title'])) {
  71      
  72          $plugin['error']['adcampaign_title'] = 1;
  73      
  74      }
  75      
  76      $plugin['error'] = 1;
  77      
  78      
  79      if(false && !isset($plugin['error'])) {
  80      
  81          if($plugin['data']['glossary_id']) {
  82          
  83              // UPDATE
  84              $sql  = 'UPDATE '.DB_PREPEND.'phpwcms_glossary SET ';
  85              
  86              $sql .= "glossary_title='".aporeplace($plugin['data']['glossary_title'])."', ";
  87              $sql .= "glossary_tag='".aporeplace($plugin['data']['glossary_tag'])."', ";
  88              $sql .= "glossary_keyword='".aporeplace($plugin['data']['glossary_keyword'])."', ";
  89              $sql .= "glossary_text='".aporeplace($plugin['data']['glossary_text'])."', ";
  90              $sql .= "glossary_object='".aporeplace(serialize($plugin['data']['glossary_object']))."', ";
  91              $sql .= "glossary_changed='".aporeplace($plugin['data']['glossary_changed'])."', ";
  92              $sql .= "glossary_status=".$plugin['data']['glossary_status'].", ";
  93              $sql .= "glossary_highlight=".$plugin['data']['glossary_highlight']." ";
  94              
  95              $sql .= "WHERE glossary_id=".$plugin['data']['glossary_id'];
  96              
  97              if(@_dbQuery($sql, 'UPDATE')) {
  98              
  99                  if(isset($_POST['save'])) {
 100                      
 101                      headerRedirect(decode_entities(MODULE_HREF));
 102                      
 103                  }
 104              
 105              } else {
 106              
 107                  $plugin['error']['update'] = mysql_error();
 108              
 109              }
 110              
 111          
 112          } else {
 113          
 114              // INSERT
 115              $sql  = 'INSERT INTO '.DB_PREPEND.'phpwcms_glossary (';
 116              $sql .= 'glossary_created, glossary_changed, glossary_title, glossary_tag, ';
 117              $sql .= 'glossary_keyword, glossary_text, glossary_highlight, glossary_object, glossary_status';        
 118              $sql .= ') VALUES (';
 119              $sql .= "'".aporeplace($plugin['data']['glossary_created'])."', ";
 120              $sql .= "'".aporeplace($plugin['data']['glossary_changed'])."', ";
 121              $sql .= "'".aporeplace($plugin['data']['glossary_title'])."', ";
 122              $sql .= "'".aporeplace($plugin['data']['glossary_tag'])."', ";
 123              $sql .= "'".aporeplace($plugin['data']['glossary_keyword'])."', ";
 124              $sql .= "'".aporeplace($plugin['data']['glossary_text'])."', ";
 125              $sql .= aporeplace($plugin['data']['glossary_highlight']).', ';
 126              $sql .= "'".aporeplace(serialize($plugin['data']['glossary_object']))."', ";
 127              $sql .= aporeplace($plugin['data']['glossary_status']);
 128              $sql .= ')';
 129              
 130              if(@_dbQuery($sql, 'INSERT')) {
 131              
 132                  if(isset($_POST['save'])) {
 133                      
 134                      headerRedirect(decode_entities(MODULE_HREF));
 135                      
 136                  }
 137              
 138              } else {
 139              
 140                  $plugin['error']['update'] = mysql_error();
 141              
 142              }
 143          
 144          
 145          }
 146      }
 147  
 148  }
 149  
 150  // try to read entry from database
 151  if($plugin['id'] && !isset($plugin['error'])) {
 152  
 153      $sql  = 'SELECT *,';
 154      $sql .= "DATE_FORMAT(adcampaign_datestart, '%d".$BLM['date_delimiter']."%m".$BLM['date_delimiter']."%Y') AS adcampaign_date_start, ";
 155      $sql .= "DATE_FORMAT(adcampaign_dateend,   '%d".$BLM['date_delimiter']."%m".$BLM['date_delimiter']."%Y') AS adcampaign_date_end, ";
 156      $sql .= "DATE_FORMAT(adcampaign_datestart, '%H:%i') AS adcampaign_time_start, ";
 157      $sql .= "DATE_FORMAT(adcampaign_dateend,   '%H:%i') AS adcampaign_time_end ";
 158      $sql .= 'FROM '.DB_PREPEND.'phpwcms_ads_campaign WHERE adcampaign_id='.$plugin['id'];
 159      $plugin['data'] = _dbQuery($sql);
 160      $plugin['data'] = $plugin['data'][0];
 161      $plugin['data']['adcampaign_data'] = @unserialize($plugin['data']['adcampaign_data']);
 162      if(!is_array($plugin['data']['adcampaign_data'])) {
 163          $plugin['data']['adcampaign_data'] = array(
 164                  
 165                      'max_views'            => 0,
 166                      'max_click'            => 0,
 167                      'unique'            => 0,
 168                      'width'                => '',
 169                      'height'            => '',
 170                      'url'                => '',
 171                      'target'            => ''
 172                  
 173                  );
 174      }
 175      
 176  }
 177  
 178  // default values
 179  if(empty($plugin['data'])) {
 180  
 181      $plugin['data'] = array(
 182      
 183                  'adcampaign_id'            => 0,
 184                  'adcampaign_title'        => '',
 185                  'adcampaign_created'    => '',
 186                  'adcampaign_changed'    => date('Y-m-d H:i:s'),
 187                  'adcampaign_comment'    => '',
 188                  'adcampaign_data'        => array(
 189                  
 190                      'max_views'            => 0,
 191                      'max_click'            => 0,
 192                      'unique'            => 0,
 193                      'width'                => '',
 194                      'height'            => '',
 195                      'url'                => '',
 196                      'target'            => ''
 197                  
 198                  ),
 199                  'adcampaign_status'        => 0,
 200                  'adcampaign_date_start'    => '',
 201                  'adcampaign_date_end'    => '',
 202                  'adcampaign_time_start'    => '00:00',
 203                  'adcampaign_time_end'    => '23:59',
 204                  'adcampaign_format'        => 0
 205      
 206                                  );
 207  
 208  }
 209  
 210  
 211  
 212  ?>


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