- Timestamp:
- Dec 23, 2013, 9:17:28 PM (10 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/include/subscriptions_page.inc.php
r24342 r26139 1 <?php 2 if (!defined('SUBSCRIBE_TO_PATH'))die('Hacking attempt!');1 <?php 2 defined('SUBSCRIBE_TO_PATH') or die('Hacking attempt!'); 3 3 4 4 global $template, $conf, $page, $user; 5 5 6 6 // check input parameters 7 if ( empty($_GET['action']) or empty($_GET['email']) or empty($_GET['key']))7 if (empty($_GET['action']) or empty($_GET['email']) or empty($_GET['key'])) 8 8 { 9 9 $_GET['action'] = null; … … 11 11 else 12 12 { 13 $ _GET['verif_key']= $_GET['action'].$_GET['email'].(isset($_GET['id'])?$_GET['id']:null);14 15 if ( decrypt_value($_GET['key'], $conf['secret_key']) !== $_GET['verif_key'])13 $verif_key = $_GET['action'].$_GET['email'].(isset($_GET['id'])?$_GET['id']:null); 14 15 if (decrypt_value($_GET['key'], $conf['secret_key']) !== $verif_key) 16 16 { 17 17 $_GET['action'] = null; … … 21 21 22 22 23 if ( !empty($_GET['action']))23 if (!empty($_GET['action'])) 24 24 { 25 25 // unsubscribe all 26 if ( isset($_POST['unsubscribe_all']) and isset($_POST['unsubscribe_all_check']))26 if (isset($_POST['unsubscribe_all']) and isset($_POST['unsubscribe_all_check'])) 27 27 { 28 28 $query = ' … … 32 32 pwg_query($query); 33 33 } 34 34 35 35 // bulk action 36 36 else if (isset($_POST['apply_bulk']) and !empty($_POST['selected'])) 37 37 { 38 foreach ($_POST['selected'] as $id) 39 { 40 switch ($_POST['action']) 41 { 42 case 'unsubscribe': 43 un_subscribe_to_comments($_GET['email'], $id); 44 break; 45 case 'validate': 46 validate_subscriptions($_GET['email'], $id); 47 break; 48 } 49 } 50 } 51 38 switch ($_POST['action']) 39 { 40 case 'unsubscribe': 41 un_subscribe_to_comments($_GET['email'], $_POST['selected']); 42 break; 43 case 'validate': 44 validate_subscriptions($_GET['email'], $_POST['selected']); 45 break; 46 } 47 } 48 52 49 // unsubscribe from manage page 53 50 else if (isset($_GET['unsubscribe'])) … … 55 52 if (un_subscribe_to_comments($_GET['email'], $_GET['unsubscribe'])) 56 53 { 57 array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));58 } 59 else 60 { 61 array_push($page['errors'], l10n('Not found.'));62 } 63 } 64 54 $page['infos'][] = l10n('Successfully unsubscribed your email address from receiving notifications.'); 55 } 56 else 57 { 58 $page['errors'][] = l10n('Not found.'); 59 } 60 } 61 65 62 // validate from manage page 66 63 else if (isset($_GET['validate'])) … … 68 65 if (validate_subscriptions($_GET['email'], $_GET['validate'])) 69 66 { 70 array_push($page['infos'], l10n('Your subscribtion has been validated, thanks you.'));71 } 72 else 73 { 74 array_push($page['infos'], l10n('Already validated.'));75 } 76 } 77 67 $page['infos'][] = l10n('Your subscribtion has been validated, thanks you.'); 68 } 69 else 70 { 71 $page['infos'][] = l10n('Already validated.'); 72 } 73 } 74 78 75 $template->assign('MANAGE_LINK', make_stc_url('manage', $_GET['email'])); 79 76 } … … 89 86 SELECT type, element_id 90 87 FROM '.SUBSCRIBE_TO_TABLE.' 91 WHERE 88 WHERE 92 89 email = "'.$_GET['email'].'" 93 90 AND id = '.$_GET['id'].' 94 91 ;'; 95 92 $result = pwg_query($query); 96 93 97 94 if (!pwg_db_num_rows($result)) 98 95 { 99 array_push($page['errors'], l10n('Not found.'));96 $page['errors'][] = l10n('Not found.'); 100 97 } 101 98 else … … 103 100 if (validate_subscriptions($_GET['email'], $_GET['id'])) 104 101 { 105 array_push($page['infos'], l10n('Your subscribtion has been validated, thanks you.'));102 $page['infos'][] = l10n('Your subscription has been validated, thanks you.'); 106 103 } 107 104 else 108 105 { 109 array_push($page['infos'], l10n('Already validated.'));110 } 111 106 $page['infos'][] = l10n('Already validated.'); 107 } 108 112 109 list($type, $element_id) = pwg_db_fetch_row($result); 113 110 114 111 switch ($type) 115 112 { … … 124 121 $element = null; 125 122 } 126 123 127 124 $template->assign(array( 128 125 'type' => $type, … … 130 127 )); 131 128 } 132 129 133 130 $template->assign('IN_VALIDATE', true); 134 131 break; 135 132 } 136 133 137 134 /* unsubscribe */ 138 135 case 'unsubscribe': … … 143 140 element_id 144 141 FROM '.SUBSCRIBE_TO_TABLE.' 145 WHERE 142 WHERE 146 143 email = "'.$_GET['email'].'" 147 144 AND id = '.$_GET['id'].' 148 145 ;'; 149 146 $result = pwg_query($query); 150 147 151 148 if (!pwg_db_num_rows($result)) 152 149 { 153 array_push($page['errors'], l10n('Not found.'));150 $page['errors'][] = l10n('Not found.'); 154 151 } 155 152 else … … 157 154 if (un_subscribe_to_comments($_GET['email'], $_GET['id'])) 158 155 { 159 array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));156 $page['infos'][] = l10n('Successfully unsubscribed your email address from receiving notifications.'); 160 157 } 161 158 else 162 159 { 163 array_push($page['errors'], l10n('Not found.'));164 } 165 160 $page['errors'][] = l10n('Not found.'); 161 } 162 166 163 list($type, $element_id) = pwg_db_fetch_row($result); 167 164 168 165 switch ($type) 169 166 { … … 178 175 $element = null; 179 176 } 180 177 181 178 $template->assign(array( 182 179 'type' => $type, … … 184 181 )); 185 182 } 186 183 187 184 $template->assign('IN_UNSUBSCRIBE', true); 188 185 break; 189 186 } 190 187 191 188 /* manage */ 192 189 case 'manage': … … 199 196 ;'; 200 197 $result = pwg_query($query); 201 198 202 199 if (pwg_db_num_rows($result)) 203 200 { … … 205 202 { 206 203 $subscription['registration_date'] = format_date($subscription['registration_date'], true); 207 204 208 205 switch ($subscription['type']) 209 206 { … … 220 217 continue(2); 221 218 } 222 219 223 220 $template->append('subscriptions', $subscription); 224 221 } … … 226 223 else 227 224 { 228 array_push($page['infos'], l10n('You are not subscribed to any comment.'));225 $page['infos'][] = l10n('You are not subscribed to any comment.'); 229 226 } 230 227 break; 231 228 } 232 229 233 230 default: 234 231 { 235 232 set_status_header(403); 236 array_push($page['errors'], l10n('Bad query'));233 $page['errors'][] = l10n('Bad query'); 237 234 } 238 235 } … … 244 241 'COA_ACTIVATED' => defined('COA_ID'), 245 242 )); 246 243 247 244 if (!empty($_GET['email'])) 248 245 { 249 $template->assign('TITLE', '<a href="'.get_absolute_root_url().'">'.l10n('Home').'</a>'.$conf['level_separator']. 250 sprintf(l10n('Subscriptions of %s'), '<i>'.$_GET['email'].'</i>')); 251 } 252 253 $template->set_filename('index', realpath(SUBSCRIBE_TO_PATH . 'template/subscribtions_page.tpl')); 254 255 ?> 246 $template->concat('TITLE', $conf['level_separator'] . l10n('Subscriptions of %s', '<i>'.$_GET['email'].'</i>')); 247 } 248 249 $template->set_filename('subscribe_to_comments', realpath(SUBSCRIBE_TO_PATH . 'template/subscriptions_page.tpl')); 250 $template->assign_var_from_handle('CONTENT', 'subscribe_to_comments');
Note: See TracChangeset
for help on using the changeset viewer.