[ Index ] |
PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2010 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 // redirect verify to correct newsletter action 24 25 $phpwcms = array(); 26 require_once ('config/phpwcms/conf.inc.php'); 27 require_once ('include/inc_lib/default.inc.php'); 28 29 $type = ''; 30 $email = 'n.a.'; 31 32 if(!empty($_GET['s']) || !empty($_GET['u'])) { 33 34 require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php'); 35 require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php'); 36 require_once (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php'); 37 38 if(isset($_GET['s'])) { 39 40 $hash = clean_slweg($_GET['s']); 41 $type = 'subscribe'; 42 43 } else { 44 45 $hash = clean_slweg($_GET['u']); 46 $type = 'unsubscribe'; 47 48 } 49 50 $data = _dbQuery('SELECT * FROM '.DB_PREPEND."phpwcms_address WHERE address_key='".aporeplace($hash)."' LIMIT 1"); 51 52 if(isset($data[0])) { 53 54 // fix old hash where containing "+" char might result in an invalid hash key 55 $hash = str_replace(' ', '+', $hash); 56 57 $email = $data[0]['address_email']; 58 switch($type) { 59 60 case 'subscribe': $sql = 'UPDATE '.DB_PREPEND.'phpwcms_address '; 61 $sql .= 'SET address_verified=1 '; 62 $sql .= "WHERE address_key='".aporeplace($hash)."'"; 63 if(empty($data[0]['address_verified'])) { 64 $result = _dbQuery($sql, 'UPDATE'); 65 } 66 if(!empty($data[0]['address_url1'])) { 67 headerRedirect($data[0]['address_url1']); 68 } 69 70 if(!($page = file_get_contents(PHPWCMS_TEMPLATE.'inc_default/subscribe.tmpl'))) { 71 72 $page = "The email address <strong>{EMAIL}</strong> was verified."; 73 74 } 75 break; 76 77 78 case 'unsubscribe': $sql = 'DELETE FROM '.DB_PREPEND.'phpwcms_address '; 79 $sql .= "WHERE address_key='".aporeplace($hash)."'"; 80 $result = _dbQuery($sql, 'DELETE'); 81 if(!empty($data[0]['address_url2'])) { 82 headerRedirect($data[0]['address_url2']); 83 } 84 85 if(!($page = file_get_contents(PHPWCMS_TEMPLATE.'inc_default/unsubscribe.tmpl'))) { 86 87 $page = "All Subscriptions for <strong>{EMAIL}</strong> canceled."; 88 89 } 90 91 break; 92 93 } 94 95 96 } else { 97 98 headerRedirect(PHPWCMS_URL); 99 100 } 101 102 } else { 103 104 headerRedirect(PHPWCMS_URL); 105 106 } 107 108 // some replacements 109 $page = replaceGlobalRT($page); 110 $page = str_replace('{EMAIL}', $email, $page); 111 112 // send non caching page header 113 headerAvoidPageCaching(); 114 echo $page; 115 116 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Nov 16 22:51:00 2010 | Cross-referenced by PHPXref 0.7 |