[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/include/inc_act/ -> act_newsletter.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 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  if(empty($phpwcms)) $phpwcms = array();
  25  require_once ('../../config/phpwcms/conf.inc.php');
  26  require_once ('../inc_lib/default.inc.php');
  27  require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
  28  
  29  require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php');
  30  require_once (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php');
  31  
  32  
  33  $type    = '';
  34  $email    = 'n.a.';
  35  $target = '';
  36  
  37  / *
  38  if(!empty($_GET['i'])) {
  39      
  40      $verify        = explode(':', base64_decode(clean_slweg($_GET["i"])));
  41      $email        = empty($verify[2]) ? '?' : $verify[2];
  42      $email        = @html_entities(strip_tags($email));
  43  
  44      if(isset($verify[1]) && ($verify[0] == 'V' || $verify[0] == 'D')) {
  45      
  46          $hash = clean_slweg($verify[1]);
  47          $data = _dbQuery('SELECT * FROM '.DB_PREPEND."phpwcms_address WHERE address_key='".aporeplace($hash)."' LIMIT 1");
  48  
  49          switch($verify[0]) {
  50      
  51              case "V":    $sql  = "UPDATE ".DB_PREPEND."phpwcms_address SET ".
  52                                  "address_verified=1 ".
  53                                  "WHERE address_key='".aporeplace($hash)."' LIMIT 1;";
  54                          
  55                          $type = 'subscribe';
  56  
  57                          break;
  58      
  59              case "D":    $sql  = "DELETE FROM ".DB_PREPEND."phpwcms_address ".
  60                                  "WHERE address_key='".aporeplace($hash)."' LIMIT 1;";
  61                          
  62                          $type = 'unsubscribe'; 
  63                          
  64                          break;
  65  
  66          }
  67          @mysql_query($sql, $db);
  68  
  69      }
  70      
  71  
  72  } else
  73  * /
  74  if(!empty($_GET['s']) || !empty($_GET['u'])) {
  75      
  76      if(isset($_GET['s'])) {
  77      
  78          $hash = clean_slweg($_GET['s']);
  79          $type = 'subscribe';
  80      
  81      } else {
  82      
  83          $hash = clean_slweg($_GET['u']);
  84          $type = 'unsubscribe';
  85          
  86      }
  87  
  88      $data = _dbQuery('SELECT * FROM '.DB_PREPEND."phpwcms_address WHERE address_key='".aporeplace($hash)."' LIMIT 1");
  89  
  90      if(isset($data[0])) {
  91      
  92          $email = $data[0]['address_email'];
  93          switch($type) {
  94          
  95              case 'subscribe':        $sql  = 'UPDATE '.DB_PREPEND.'phpwcms_address ';
  96                                      $sql .= 'SET address_verified=1 ';
  97                                      $sql .= "WHERE address_key='".aporeplace($hash)."'";
  98                                      if(empty($data[0]['address_verified'])) {
  99                                          $result = _dbQuery($sql, 'UPDATE');
 100                                      }
 101                                      if(!empty($data[0]['address_url1'])) {
 102                                          $target = $data[0]['address_url1'];
 103                                      }
 104                                      
 105                                      break;
 106                                      
 107              
 108              case 'unsubscribe':        $sql  = 'DELETE FROM '.DB_PREPEND.'phpwcms_address ';
 109                                      $sql .= "WHERE address_key='".aporeplace($hash)."'";
 110                                      $result = _dbQuery($sql, 'DELETE');
 111                                      
 112                                      if(!empty($data[0]['address_url2'])) {
 113                                          $target = $data[0]['address_url2'];
 114                                      }
 115                                      
 116                                      break;
 117                                      
 118          }
 119          
 120      
 121      }
 122      
 123      //redirect
 124      if($target) {
 125          headerRedirect($target);
 126      }
 127      
 128  }
 129  
 130  
 131  switch($type) {
 132  
 133      case 'subscribe':    
 134                          if(!($page = file_get_contents(PHPWCMS_TEMPLATE.'inc_default/subscribe.tmpl'))) {
 135                          
 136                              $page = "The email address <strong>{EMAIL}</strong> was verified.";
 137                          
 138                          }
 139                          break;
 140  
 141  
 142      case 'unsubscribe':
 143                          if(!($page = file_get_contents(PHPWCMS_TEMPLATE.'inc_default/unsubscribe.tmpl'))) {
 144                              
 145                              $page = "All Subscriptions for <strong>{EMAIL}</strong> canceled.";
 146                          
 147                          }
 148                          break;
 149                          
 150      default:
 151      
 152                          headerRedirect(PHPWCMS_URL);
 153  
 154  }
 155  
 156  
 157  // some replacements
 158  $page = replaceGlobalRT($page);
 159  $page = str_replace('{EMAIL}', $email, $page);
 160  
 161  // send non caching page header
 162  headerAvoidPageCaching();
 163  echo $page;
 164  
 165  */
 166  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1