Changeset 26144 for extensions/Subscribe_to_comments/include/events.inc.php
- Timestamp:
- Dec 24, 2013, 1:25:03 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/include/events.inc.php
r26139 r26144 78 78 } 79 79 } 80 } 81 else 82 { 83 $template->assign('STC_MODE', $_POST['stc_mode']); 80 81 unset($_POST['stc_mode']); 84 82 } 85 83 } … … 160 158 break; 161 159 } 160 unset($_POST['stc_mode']); 162 161 } 163 162 else if (isset($_GET['stc_unsubscribe'])) … … 167 166 $page['infos'][] = l10n('Successfully unsubscribed your email address from receiving notifications.'); 168 167 } 168 } 169 170 $tpl_vars = array( 171 'ASK_MAIL' => is_a_guest() or empty($user['email']), 172 'ON_PICTURE' => true, 173 'ALLOW_ALBUM_IMAGES' => !empty($page['category']['id']), 174 'ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(), 175 ); 176 177 if (!empty($_POST['stc_mode'])) 178 { 179 $tpl_vars['MODE'] = $_POST['stc_mode']; 169 180 } 170 181 … … 220 231 if ($subscribed) 221 232 { 222 $template->assign(array( 223 'SUBSCRIBED' => $subscribed, 224 'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)), 225 )); 226 } 227 } 228 else 229 { 230 $template->assign('STC_ASK_MAIL', true); 233 $tpl_vars['SUBSCRIBED'] = $subscribed; 234 $tpl_vars['U_UNSUB'] = add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)); 235 } 231 236 } 232 237 233 238 $template->assign(array( 234 'STC_ON_PICTURE' => true,235 'STC_ALLOW_ALBUM_IMAGES' => !empty($page['category']['id']),236 'STC_ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(),237 239 'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH, 240 'STC' => $tpl_vars, 238 241 )); 239 242 … … 249 252 global $page, $template, $user, $conf; 250 253 251 if ( 252 !defined('COA_ID') or script_basename() != 'index' or 253 @$page['section'] != 'categories' or !isset($page['category']) 254 ) 255 { 256 return; 257 } 258 259 // standalone subscription 254 // standalone subscription 260 255 if (isset($_POST['stc_submit'])) 261 256 { … … 269 264 break; 270 265 } 266 unset($_POST['stc_mode']); 271 267 } 272 268 else if (isset($_GET['stc_unsubscribe'])) … … 278 274 } 279 275 276 $tpl_vars = array( 277 'ASK_MAIL' => is_a_guest() or empty($user['email']), 278 'ON_ALBUM' => true, 279 'ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(), 280 ); 281 282 if (!empty($_POST['stc_mode'])) 283 { 284 $tpl_vars['MODE'] = $_POST['stc_mode']; 285 } 286 280 287 // if registered user we check if already subscribed 281 if ( !is_a_guest() and !empty($user['email']) ) 282 { 283 $element_url = make_index_url(array( 284 'section' => 'categories', 285 'category' => $page['category'], 286 )); 287 288 if (!is_a_guest() and !empty($user['email'])) 289 { 288 290 $subscribed = false; 289 291 … … 322 324 if ($subscribed) 323 325 { 324 $ template->assign(array(325 ' SUBSCRIBED' => $subscribed,326 ' UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)),326 $element_url = make_index_url(array( 327 'section' => 'categories', 328 'category' => $page['category'], 327 329 )); 328 } 329 } 330 else 331 { 332 $template->assign('STC_ASK_MAIL', true); 330 331 $tpl_vars['SUBSCRIBED'] = $subscribed; 332 $tpl_vars['U_UNSUB'] = add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)); 333 } 333 334 } 334 335 335 336 $template->assign(array( 336 'STC_ON_ALBUM' => true, 337 'STC_ALLOW_GLOBAL' => $conf['Subscribe_to_Comments']['allow_global_subscriptions'] || is_admin(), 337 'STC' => $tpl_vars, 338 338 'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH, 339 339 )); … … 346 346 * main prefilter 347 347 */ 348 function stc_main_prefilter($content , &$smarty)348 function stc_main_prefilter($content) 349 349 { 350 350 ## subscribe at any moment ## 351 $search = '{if isset($comment s)}';352 $ replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_standalone.tpl');353 $content = str_replace($search, $ replace.$search, $content);351 $search = '{if isset($comment_add)}'; 352 $add = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_outside.tpl'); 353 $content = str_replace($search, $search.$add, $content); 354 354 355 355 ## subscribe while add a comment ## 356 356 $search = '{$comment_add.CONTENT}</textarea></p>'; 357 $ replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_comment.tpl');358 $content = str_replace($search, $search.$ replace, $content);357 $add = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_inside.tpl'); 358 $content = str_replace($search, $search.$add, $content); 359 359 360 360 return $content;
Note: See TracChangeset
for help on using the changeset viewer.