- Timestamp:
- Nov 11, 2011, 7:11:38 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php
r12600 r12607 173 173 function stc_on_picture_prefilter($template, &$smarty) 174 174 { 175 global $user, $picture; 176 177 ## subscribe at any moment ## 178 $search[1] = '{if isset($comment_add)}'; 179 180 $replace[1] = $search[1].' 181 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone"> 182 <fieldset>'; 175 global $user, $picture; 183 176 184 177 // if registered user we check if already subscribed 178 $subscribed = false; 185 179 if (!is_a_guest()) 186 180 { … … 195 189 if (pwg_db_num_rows(pwg_query($query))) 196 190 { 197 $replace[1].= ' 191 $subscribed = true; 192 } 193 } 194 195 ## subscribe at any moment ## 196 $search[1] = '{if isset($comment_add)}'; 197 198 $replace[1] = $search[1].' 199 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone"> 200 <fieldset>'; 201 202 if ($subscribed) 203 { 204 $replace[1].= ' 198 205 {\'You are currently subscribed to comments of this picture.\'|@translate} 199 206 <a href="'.add_url_params($picture['current']['url'], array('stc_unsubscribe'=>'1')).'">{\'Unsubscribe\'|@translate}'; 200 $no_form = true; 201 } 202 } 203 204 if (!isset($no_form)) 207 } 208 else 205 209 { 206 210 $replace[1].= ' … … 212 216 $replace[1].= ' 213 217 <label style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label> 214 <label style="display:none;"><input type="submit" value="{\'Submit\'|@translate}"></label>218 <label style="display:none;"><input type="submit" id="stc_submit" value="{\'Submit\'|@translate}"></label> 215 219 {footer_script require="jquery"}{literal} 216 220 jQuery(document).ready(function() { … … 248 252 $replace[0] = null; 249 253 250 if (! isset($no_form))254 if (!$subscribed) 251 255 { 252 256 $replace[0].= ' … … 335 339 function stc_on_album_prefilter($template, &$smarty) 336 340 { 337 global $user, $page; 338 339 ## subscribe at any moment ## 340 $search[1] = '{if isset($comment_add)}'; 341 342 $replace[1] = $search[1].' 343 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone"> 344 <fieldset>'; 341 global $user, $page; 345 342 346 343 // if registered user we check if already subscribed 344 $subscribed = false; 347 345 if (!is_a_guest()) 348 346 { … … 357 355 if (pwg_db_num_rows(pwg_query($query))) 358 356 { 359 $url_params['section'] = 'categories'; 360 $url_params['category'] = $page['category']; 361 362 $element_url = make_index_url($url_params); 357 $subscribed = true; 358 } 359 } 360 361 ## subscribe at any moment ## 362 $search[1] = '{if isset($comment_add)}'; 363 364 $replace[1] = $search[1].' 365 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone"> 366 <fieldset>'; 367 368 // if registered user we check if already subscribed 369 if ($subscribed) 370 { 371 $url_params['section'] = 'categories'; 372 $url_params['category'] = $page['category']; 363 373 364 $replace[1].= ' 374 $element_url = make_index_url($url_params); 375 376 $replace[1].= ' 365 377 {\'You are currently subscribed to comments of this album.\'|@translate} 366 378 <a href="'.add_url_params($element_url, array('stc_unsubscribe'=>'1')).'">{\'Unsubscribe\'|@translate}'; 367 $no_form = true; 368 } 369 } 370 371 if (!isset($no_form)) 379 } 380 else 372 381 { 373 382 $replace[1].= ' … … 379 388 $replace[1].= ' 380 389 <label style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label> 381 <label style="display:none;"><input type="submit" value="{\'Submit\'|@translate}"></label>390 <label style="display:none;"><input type="submit" id="stc_submit" value="{\'Submit\'|@translate}"></label> 382 391 {footer_script require="jquery"}{literal} 383 392 jQuery(document).ready(function() { … … 415 424 $replace[0] = null; 416 425 417 if (! isset($no_form))426 if (!$subscribed) 418 427 { 419 428 $replace[0].= ' … … 442 451 * add link to management page for registered users 443 452 */ 444 function stc_ menubar_apply($menu_ref_arr)453 function stc_profile_link() 445 454 { 446 455 global $template; 447 $menu = &$menu_ref_arr[0]; 448 449 if ( !is_a_guest() and ($block = $menu->get_block('mbIdentification')) != null ) 450 { 451 $template->set_prefilter('menubar', 'stc_menubar_apply_prefilter'); 452 } 453 } 454 455 function stc_menubar_apply_prefilter($content, &$smarty) 456 457 $template->set_prefilter('profile_content', 'stc_profile_link_prefilter'); 458 } 459 460 function stc_profile_link_prefilter($content, &$smarty) 456 461 { 457 462 global $user; 458 463 459 $search = '{if isset($U_REGISTER)}'; 460 $replace = '<li><a href="'.make_stc_url('manage', $user['email']).'" title="{\'Manage my subscriptions\'|@translate}" rel="nofollow">{\'Manage my subscriptions\'|@translate}</a></li>'; 461 return str_replace($search, $replace.$search, $content); 464 $search = '<p class="bottomButtons">'; 465 $replace = '<a href="'.make_stc_url('manage', $user['email']).'" title="{\'Manage my subscriptions to comments\'|@translate}" rel="nofollow">{\'Manage my subscriptions to comments\'|@translate}</a><br>'; 466 467 return str_replace($search, $search.$replace, $content); 462 468 } 463 469 ?>
Note: See TracChangeset
for help on using the changeset viewer.