Changeset 26139
- Timestamp:
- Dec 23, 2013, 9:17:28 PM (10 years ago)
- Location:
- extensions/Subscribe_to_comments
- Files:
-
- 5 added
- 3 deleted
- 11 edited
- 2 copied
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/admin.php
r21608 r26139 1 1 <?php 2 if (!defined('SUBSCRIBE_TO_PATH'))die('Hacking attempt!');2 defined('SUBSCRIBE_TO_PATH') or die('Hacking attempt!'); 3 3 4 4 global $template, $page, $conf; … … 8 8 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 9 9 $page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : 'subscriptions'; 10 10 11 11 $tabsheet = new tabsheet(); 12 12 $tabsheet->add('subscriptions', l10n('Manage'), SUBSCRIBE_TO_ADMIN . '-subscriptions'); … … 24 24 'SUBSCRIBE_TO_ADMIN' => SUBSCRIBE_TO_ADMIN, 25 25 )); 26 26 27 27 $template->assign_var_from_handle('ADMIN_CONTENT', 'stc_admin'); 28 29 ?> -
extensions/Subscribe_to_comments/admin/config.php
r21608 r26139 1 1 <?php 2 if (!defined('SUBSCRIBE_TO_PATH'))die('Hacking attempt!');2 defined('SUBSCRIBE_TO_PATH') or die('Hacking attempt!'); 3 3 4 // +-----------------------------------------------------------------------+ 5 // Save configuration | 6 // +-----------------------------------------------------------------------+ 7 if (isset($_POST['config_submit'])) 4 if (isset($_POST['config_submit'])) 8 5 { 9 6 $conf['Subscribe_to_Comments'] = array( … … 11 8 'allow_global_subscriptions' => isset($_POST['allow_global_subscriptions']), 12 9 ); 13 10 14 11 conf_update_param('Subscribe_to_Comments', serialize($conf['Subscribe_to_Comments'])); 15 array_push($page['infos'], l10n('Information data registered in database'));16 } 12 $page['infos'][] = l10n('Information data registered in database'); 13 } 17 14 18 15 19 // +-----------------------------------------------------------------------+20 // Template |21 // +-----------------------------------------------------------------------+22 16 $template->assign($conf['Subscribe_to_Comments']); 23 17 24 18 $template->set_filename('stc_admin', realpath(SUBSCRIBE_TO_PATH . 'admin/template/config.tpl')); 25 26 ?> -
extensions/Subscribe_to_comments/admin/subscriptions.php
r21608 r26139 1 1 <?php 2 if (!defined('SUBSCRIBE_TO_PATH'))die('Hacking attempt!');2 defined('SUBSCRIBE_TO_PATH') or die('Hacking attempt!'); 3 3 4 4 if (isset($_GET['delete'])) … … 64 64 ); 65 65 } 66 66 67 67 $row['type'] = str_replace('-', '_', $row['type']); // fields are accessed in Smarty, incompatible with keys containing a '-' 68 68 $users[ $row['email'] ]['subs'][ $row['type'] ]++; … … 76 76 { 77 77 uasort($users, 'stc_sort_'.$_POST['order_by']); 78 78 79 79 if ($_POST['direction'] == 'DESC') 80 80 { … … 156 156 return strcasecmp($a['username'].$a['email'], $b['username'].$b['email']); 157 157 } 158 159 ?> -
extensions/Subscribe_to_comments/admin/template/config.tpl
r21608 r26139 5 5 <form method="post" action="" class="properties"> 6 6 <fieldset> 7 <legend>{'Configuration'| @translate}</legend>7 <legend>{'Configuration'|translate}</legend> 8 8 <ul> 9 9 <li> 10 10 <label> 11 <span class="property">{'Notify administrators when a user take a new subscription'|@translate}</span>12 11 <input type="checkbox" name="notify_admin_on_subscribe" value="1" {if $notify_admin_on_subscribe}checked="checked"{/if}> 12 <b>{'Notify administrators when a user take a new subscription'|translate}</b> 13 13 </label> 14 14 </li> 15 15 <li> 16 16 <label> 17 <span class="property">{'Allow users to subscribe to global notifications'|@translate}</span>18 17 <input type="checkbox" name="allow_global_subscriptions" value="1" {if $allow_global_subscriptions}checked="checked"{/if}> 18 <b>{'Allow users to subscribe to global notifications'|translate}</b> 19 19 </label> 20 </li> 20 </li> 21 21 </ul> 22 22 </fieldset> 23 23 24 <p><input class="submit" type="submit" value="{'Submit'| @translate}" name="config_submit"/></p>24 <p><input class="submit" type="submit" value="{'Submit'|translate}" name="config_submit"/></p> 25 25 </form> -
extensions/Subscribe_to_comments/admin/template/subscriptions.tpl
r21608 r26139 1 {combine_css path=$SUBSCRIBE_TO_PATH| @cat:"admin/template/style.css"}1 {combine_css path=$SUBSCRIBE_TO_PATH|cat:'admin/template/style.css'} 2 2 3 3 <div class="titrePage"> … … 7 7 <form class="filter" method="post" name="filter" action="{$F_FILTER_ACTION}"> 8 8 <fieldset> 9 <legend>{'Filter'| @translate}</legend>9 <legend>{'Filter'|translate}</legend> 10 10 11 11 <label> 12 {'User'| @translate}12 {'User'|translate} 13 13 <input type="text" name="username" value="{$F_USERNAME}" size="30"> 14 14 </label> 15 15 16 16 <label> 17 {'Sort by'| @translate}17 {'Sort by'|translate} 18 18 {html_options name=order_by options=$order_options selected=$order_selected} 19 19 </label> 20 20 21 21 <label> 22 {'Sort order'| @translate}22 {'Sort order'|translate} 23 23 {html_options name=direction options=$direction_options selected=$direction_selected} 24 24 </label> … … 26 26 <label> 27 27 28 <span><input class="submit" type="submit" name="filter" value="{'Submit'| @translate}"> <a href="{$F_FILTER_ACTION}">{'Reset'|@translate}</a></span>28 <span><input class="submit" type="submit" name="filter" value="{'Submit'|translate}"> <a href="{$F_FILTER_ACTION}">{'Reset'|translate}</a></span> 29 29 </label> 30 30 … … 36 36 <thead> 37 37 <tr class="throw"> 38 <td class="user">{'User'| @translate}</td>39 <td class="date">{'First subscription'| @translate}</td>40 <td class="date">{'Last subscription'| @translate}</td>41 <td class="total">{'Photos'| @translate}</td>42 <td class="total" style="font-size:0.7em;">{'All album photos'| @translate}</td>43 {if $COA_ACTIVATED}<td class="total">{'Albums'| @translate}</td>{/if}38 <td class="user">{'User'|translate}</td> 39 <td class="date">{'First subscription'|translate}</td> 40 <td class="date">{'Last subscription'|translate}</td> 41 <td class="total">{'Photos'|translate}</td> 42 <td class="total" style="font-size:0.7em;">{'All album photos'|translate}</td> 43 {if $COA_ACTIVATED}<td class="total">{'Albums'|translate}</td>{/if} 44 44 <td class="action"> </td> 45 45 </tr> … … 52 52 <td style="text-align:center;">{$user.nice_max_date}</td> 53 53 {if $user.subs.all_images} 54 <td colspan="2" class="all">{'All'| @translate}54 <td colspan="2" class="all">{'All'|translate} 55 55 {else} 56 56 <td>{$user.subs.image}</td> … … 58 58 {/if} 59 59 {if $user.subs.all_albums && $COA_ACTIVATED} 60 <td class="all">{'All'| @translate}61 {else if $COA_ACTIVATED}60 <td class="all">{'All'|translate} 61 {else if $COA_ACTIVATED} 62 62 <td>{$user.subs.album}</td> 63 63 {/if} 64 <td><a href="{$user.u_delete}" title="{'delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'delete'|@translate}"></a> 64 <td><a href="{$user.u_delete}" title="{'delete'|translate}" onclick="return confirm('{'Are you sure?'|translate}');"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'delete'|translate}"></a> 65 </tr> 66 {foreachelse} 67 <tr class="row2"> 68 <td colspan="6" style="text-align:center;font-style:italic;">{'No result'|translate}</td> 65 69 </tr> 66 70 {/foreach} 67 68 {if not $USERS}69 <tr class="row2">70 <td colspan="6" style="text-align:center;font-style:italic;">{'No result'|@translate}</td>71 </tr>72 {/if}73 71 </table> 74 72 75 <p>{'★ : registered users'| @translate}</p>73 <p>{'★ : registered users'|translate}</p> -
extensions/Subscribe_to_comments/include/events.inc.php
r24342 r26139 1 1 <?php 2 if (!defined('SUBSCRIBE_TO_PATH'))die('Hacking attempt!');2 defined('SUBSCRIBE_TO_PATH') or die('Hacking attempt!'); 3 3 4 4 /** … … 8 8 { 9 9 global $tokens, $page, $conf; 10 10 11 11 if ($tokens[0] == 'subscriptions') 12 12 { 13 add_event_handler('loc_begin_page_header', 'stc_page_header');14 15 13 $page['section'] = 'subscriptions'; 14 $page['body_id'] = 'theSubscriptionsPage'; 15 $page['is_homepage'] = false; 16 $page['is_external'] = true; 17 16 18 $page['title'] = l10n('Comments notifications'); 17 $page['section_title'] = '<a href="'.get_absolute_root_url().'">'.l10n('Home').'</a>'.$conf['level_separator'].l10n('Comments notifications'); 18 } 19 } 20 21 function stc_page_header() 19 } 20 } 21 22 function stc_load_section() 22 23 { 23 24 global $page; 24 $page['body_id'] = 'theSubscriptionsPage';25 }26 27 function stc_load_section()28 {29 global $page;30 25 31 26 if (isset($page['section']) and $page['section'] == 'subscriptions') 32 27 { 33 include(SUBSCRIBE_TO_PATH.'include/subscri btions_page.inc.php');28 include(SUBSCRIBE_TO_PATH.'include/subscriptions_page.inc.php'); 34 29 } 35 30 } … … 43 38 { 44 39 global $page, $template; 45 40 46 41 if ($comm['action'] == 'validate') 47 42 { 48 43 send_comment_to_subscribers($comm); 49 44 } 50 51 if ( !empty($_POST['stc_mode']) and $_POST['stc_mode'] != -1)45 46 if (!empty($_POST['stc_mode']) and $_POST['stc_mode'] != -1) 52 47 { 53 48 if ($comm['action'] != 'reject') … … 61 56 break; 62 57 case 'album-images': 63 if (empty($page['category']['id'])) break; 64 subscribe_to_comments(@$_POST['email'], 'album-images', $page['category']['id']); 58 if (!empty($page['category']['id'])) 59 { 60 subscribe_to_comments(@$_POST['email'], 'album-images', $page['category']['id']); 61 } 65 62 break; 66 63 case 'image': … … 97 94 function stc_comment_validation($comm_ids, $type='image') 98 95 { 99 if (!is_array($comm_ids)) $comm_ids = array($comm_ids); 100 96 if (!is_array($comm_ids)) 97 { 98 $comm_ids = array($comm_ids); 99 } 100 101 101 if ($type == 'image') 102 102 { … … 111 111 ;'; 112 112 } 113 else if ($type == ' category')113 else if ($type == 'album' && defined('COA_TABLE')) 114 114 { 115 115 $query = ' … … 123 123 ;'; 124 124 } 125 126 $comms = hash_from_query($query, 'id'); 127 foreach ($comms as $comm) 128 { 129 send_comment_to_subscribers($comm); 125 126 if (isset($query)) 127 { 128 $comms = query2array($query); 129 foreach ($comms as $comm) 130 { 131 send_comment_to_subscribers($comm); 132 } 130 133 } 131 134 } … … 138 141 { 139 142 global $template, $picture, $page, $user, $conf; 140 143 141 144 // standalone subscription 142 145 if (isset($_POST['stc_submit'])) … … 148 151 break; 149 152 case 'album-images': 150 if (empty($page['category']['id'])) break; 151 subscribe_to_comments(@$_POST['stc_mail'], 'album-images', $page['category']['id']); 153 if (!empty($page['category']['id'])) 154 { 155 subscribe_to_comments(@$_POST['stc_mail'], 'album-images', $page['category']['id']); 156 } 152 157 break; 153 158 case 'image': … … 157 162 } 158 163 else if (isset($_GET['stc_unsubscribe'])) 159 { 164 { 160 165 if (un_subscribe_to_comments(null, $_GET['stc_unsubscribe'])) 161 166 { 162 array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));163 } 164 } 165 167 $page['infos'][] = l10n('Successfully unsubscribed your email address from receiving notifications.'); 168 } 169 } 170 166 171 // if registered user with mail we check if already subscribed 167 if ( !is_a_guest() and !empty($user['email']))172 if (!is_a_guest() and !empty($user['email'])) 168 173 { 169 174 $subscribed = false; 170 171 // registered to all pictures 172 if (!$subscribed) 173 { 174 $query = ' 175 176 $base_query = ' 175 177 SELECT id 176 178 FROM '.SUBSCRIBE_TO_TABLE.' 177 179 WHERE 178 180 email = "'.$user['email'].'" 179 AND type = "all-images"180 181 AND validated = "true" 181 ;'; 182 $result = pwg_query($query); 183 182 '; 183 184 // registered to all pictures 185 if (!$subscribed) 186 { 187 $result = pwg_query($base_query . 'AND type = "all-images";'); 188 184 189 if (pwg_db_num_rows($result)) 185 190 { 186 191 list($stc_id) = pwg_db_fetch_row($result); 187 $template->assign(array( 188 'SUBSCRIBED' => 'all-images', 189 'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)), 190 )); 191 $subscribed = true; 192 $subscribed = 'all-images'; 192 193 } 193 194 } 194 195 195 196 // registered to pictures in this album 196 if ( !$subscribed and !empty($page['category']['id']) ) 197 { 198 $query = ' 199 SELECT id 200 FROM '.SUBSCRIBE_TO_TABLE.' 201 WHERE 202 email = "'.$user['email'].'" 203 AND element_id = '.$page['category']['id'].' 204 AND type = "album-images" 205 AND validated = "true" 206 ;'; 207 $result = pwg_query($query); 208 197 if (!$subscribed and !empty($page['category']['id'])) 198 { 199 $result = pwg_query($base_query . 'AND type = "album-images" AND element_id = '.$page['category']['id'].';'); 200 209 201 if (pwg_db_num_rows($result)) 210 202 { 211 203 list($stc_id) = pwg_db_fetch_row($result); 212 $template->assign(array( 213 'SUBSCRIBED' => 'album-images', 214 'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)), 215 )); 216 $subscribed = true; 217 } 218 } 219 204 $subscribed = 'album-images'; 205 } 206 } 207 220 208 // registered to this picture 221 209 if (!$subscribed) 222 210 { 223 $query = ' 224 SELECT id 225 FROM '.SUBSCRIBE_TO_TABLE.' 226 WHERE 227 email = "'.$user['email'].'" 228 AND element_id = '.$picture['current']['id'].' 229 AND type = "image" 230 AND validated = "true" 231 ;'; 232 $result = pwg_query($query); 233 211 $result = pwg_query($base_query . 'AND type = "image" AND element_id = '.$picture['current']['id'].';'); 212 234 213 if (pwg_db_num_rows($result)) 235 214 { 236 215 list($stc_id) = pwg_db_fetch_row($result); 237 $template->assign(array( 238 'SUBSCRIBED' => 'image', 239 'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)), 240 )); 241 $subscribed = true; 242 } 216 $subscribed = 'image'; 217 } 218 } 219 220 if ($subscribed) 221 { 222 $template->assign(array( 223 'SUBSCRIBED' => $subscribed, 224 'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)), 225 )); 243 226 } 244 227 } … … 247 230 $template->assign('STC_ASK_MAIL', true); 248 231 } 249 232 250 233 $template->assign(array( 251 234 'STC_ON_PICTURE' => true, … … 254 237 'SUBSCRIBE_TO_PATH' => SUBSCRIBE_TO_PATH, 255 238 )); 256 239 257 240 $template->set_prefilter('picture', 'stc_main_prefilter'); 258 241 } … … 265 248 { 266 249 global $page, $template, $user, $conf; 267 250 268 251 if ( 269 252 !defined('COA_ID') or script_basename() != 'index' or … … 273 256 return; 274 257 } 275 258 276 259 // standalone subscription 277 260 if (isset($_POST['stc_submit'])) … … 291 274 if (un_subscribe_to_comments(null, $_GET['stc_unsubscribe'])) 292 275 { 293 array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));294 } 295 } 296 276 $page['infos'][] = l10n('Successfully unsubscribed your email address from receiving notifications.'); 277 } 278 } 279 297 280 // if registered user we check if already subscribed 298 281 if ( !is_a_guest() and !empty($user['email']) ) … … 302 285 'category' => $page['category'], 303 286 )); 304 287 305 288 $subscribed = false; 306 307 // registered to all albums 308 if (!$subscribed) 309 { 310 $query = ' 289 290 $base_query = ' 311 291 SELECT id 312 292 FROM '.SUBSCRIBE_TO_TABLE.' 313 293 WHERE 314 294 email = "'.$user['email'].'" 315 AND type = "all-albums"316 295 AND validated = "true" 317 ;'; 318 $result = pwg_query($query); 319 296 '; 297 298 // registered to all albums 299 if (!$subscribed) 300 { 301 $result = pwg_query($base_query . 'AND type = "all-albums"'); 302 320 303 if (pwg_db_num_rows($result)) 321 304 { 322 305 list($stc_id) = pwg_db_fetch_row($result); 323 $template->assign(array( 324 'SUBSCRIBED' => 'all-albums', 325 'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)), 326 )); 327 $subscribed = true; 328 } 329 } 330 306 $subscribed = 'all-albums'; 307 } 308 } 309 331 310 // registered to this album 332 311 if (!$subscribed) 333 312 { 334 $query = ' 335 SELECT id 336 FROM '.SUBSCRIBE_TO_TABLE.' 337 WHERE 338 email = "'.$user['email'].'" 339 AND element_id = '.$page['category']['id'].' 340 AND type = "album" 341 AND validated = "true" 342 ;'; 343 $result = pwg_query($query); 344 313 $result = pwg_query($base_query . 'AND type = "album" AND element_id = '.$page['category']['id'].';'); 314 345 315 if (pwg_db_num_rows($result)) 346 316 { 347 317 list($stc_id) = pwg_db_fetch_row($result); 348 $template->assign(array( 349 'SUBSCRIBED' => 'album', 350 'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)), 351 )); 352 $subscribed = true; 353 } 318 $subscribed = 'album'; 319 } 320 } 321 322 if ($subscribed) 323 { 324 $template->assign(array( 325 'SUBSCRIBED' => $subscribed, 326 'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)), 327 )); 354 328 } 355 329 } … … 358 332 $template->assign('STC_ASK_MAIL', true); 359 333 } 360 334 361 335 $template->assign(array( 362 336 'STC_ON_ALBUM' => true, … … 378 352 $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_standalone.tpl'); 379 353 $content = str_replace($search, $replace.$search, $content); 380 354 381 355 ## subscribe while add a comment ## 382 356 $search = '{$comment_add.CONTENT}</textarea></p>'; 383 357 $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_comment.tpl'); 384 358 $content = str_replace($search, $search.$replace, $content); 385 359 386 360 return $content; 387 361 } … … 395 369 $query = ' 396 370 DELETE FROM '.SUBSCRIBE_TO_TABLE.' 397 WHERE 371 WHERE 398 372 element_id IN ('.implode(',', $ids).') 399 373 AND type = "image" … … 405 379 $query = ' 406 380 DELETE FROM '.SUBSCRIBE_TO_TABLE.' 407 WHERE 381 WHERE 408 382 element_id IN ('.implode(',', $ids).') 409 383 AND (type = "album" OR type = "album-images") … … 419 393 { 420 394 global $template, $user; 421 395 422 396 if (!empty($user['email'])) 423 397 { … … 430 404 $search = '<p class="bottomButtons">'; 431 405 $replace = '<p style="font-size:1.1em;text-decoration:underline;"><a href="{$MANAGE_LINK}" rel="nofollow">{\'Manage my subscriptions\'|@translate}</a></p>'; 432 406 433 407 return str_replace($search, $replace.$search, $content); 434 408 } 435 436 ?> -
extensions/Subscribe_to_comments/include/functions.inc.php
r21608 r26139 1 1 <?php 2 if (!defined('SUBSCRIBE_TO_PATH')) die('Hacking attempt!'); 3 4 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 2 defined('SUBSCRIBE_TO_PATH') or die('Hacking attempt!'); 5 3 6 4 /** … … 10 8 function send_comment_to_subscribers($comm) 11 9 { 12 if ( empty($comm) or !is_array($comm))13 { 14 trigger_error('send_comment_to_subscribers: undefined edcomm', E_USER_WARNING);15 return false; 16 } 17 10 if (empty($comm) or !is_array($comm)) 11 { 12 trigger_error('send_comment_to_subscribers: undefined comm', E_USER_WARNING); 13 return false; 14 } 15 18 16 global $conf, $page, $user, $template; 19 17 20 18 // create search clauses 21 19 $where_clauses = array(); … … 24 22 $element_id = $comm['image_id']; 25 23 $element_type = 'image'; 26 27 array_push($where_clauses, 'type = "image" AND element_id = '.$element_id.''); 28 if (!empty($page['category']['id'])) array_push($where_clauses, 'type = "album-images" AND element_id = '.$page['category']['id'].''); 29 array_push($where_clauses, 'type = "all-images"'); 24 25 $where_clauses[] = '(type = "image" AND element_id = '.$element_id.')'; 26 $where_clauses[] = 'type = "all-images"'; 27 if (!empty($page['category']['id'])) 28 { 29 $where_clauses[] = '(type = "album-images" AND element_id = '.$page['category']['id'].')'; 30 } 30 31 } 31 32 else if (isset($comm['category_id'])) … … 33 34 $element_id = $comm['category_id']; 34 35 $element_type = 'category'; 35 36 array_push($where_clauses, 'type = "album" AND element_id = '.$element_id.'');37 array_push($where_clauses, 'type = "all-albums"');36 37 $where_clauses[] = '(type = "album" AND element_id = '.$element_id.')'; 38 $where_clauses[] = 'type = "all-albums"'; 38 39 } 39 40 else … … 41 42 return; 42 43 } 43 44 44 45 // exclude current user 45 46 $exclude = null; … … 52 53 $exclude = $user['email']; 53 54 } 54 55 55 56 // get subscribers datas 56 57 $query = ' … … 61 62 FROM '.SUBSCRIBE_TO_TABLE.' 62 63 WHERE ( 63 ('.implode(")\n OR (", $where_clauses).')64 '.implode("\n OR ", $where_clauses).' 64 65 ) 65 66 AND validated = true 66 67 AND email != "'.$exclude.'" 68 GROUP BY email 67 69 '; 68 $subscriptions = hash_from_query($query, 'id'); 69 70 if (count($subscriptions)==0) return; 71 70 $subscriptions = query2array($query); 71 72 if (count($subscriptions)==0) 73 { 74 return; 75 } 76 72 77 set_make_full_url(); 73 78 74 79 // get element infos 75 80 if ($element_type == 'image') … … 81 86 $element = get_category_infos($comm['category_id']); 82 87 } 83 88 84 89 // format comment 85 if ($comm['author'] == 'guest') $comm['author'] = l10n('guest'); 90 if ($comm['author'] == 'guest') 91 { 92 $comm['author'] = l10n('guest'); 93 } 94 86 95 $comm['author'] = trigger_event('render_comment_author', $comm['author']); 87 96 $comm['content'] = trigger_event('render_comment_content', $comm['content']); 88 89 // mail content 90 $subject = '['.strip_tags($conf['gallery_title']).'] Re:'.$element['name']; 91 92 $template->set_filename('stc_mail', realpath(SUBSCRIBE_TO_PATH . 'template/mail/notification.tpl')); 97 98 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 93 99 94 100 foreach ($subscriptions as $row) … … 103 109 $row['user_id'] = $conf['guest_id']; 104 110 } 105 111 106 112 // check permissions 107 113 if (!user_can_view_element($row['user_id'], $element_id, $element_type)) … … 109 115 continue; 110 116 } 111 112 // send mail 113 switch_lang_to($row['language']); 114 load_language('plugin.lang', SUBSCRIBE_TO_PATH); 115 116 $comm['caption'] = sprintf('<b>%s</b> wrote on <i>%s</i>', $comm['author'], format_date(date('Y-m-d H:i:s'))); 117 118 $template->assign('STC', array( 119 'element' => $element, 120 'comment' => $comm, 121 'UNSUB_URL' => make_stc_url('unsubscribe', $row['email'], $row['id']), 122 'MANAGE_URL' => make_stc_url('manage', $row['email']), 123 'GALLERY_TITLE' => $conf['gallery_title'], 124 )); 125 126 $content = $template->parse('stc_mail', true); 127 128 stc_send_mail($row['email'], $content, $subject); 117 118 switch_lang_to($language); 119 120 $comm['date'] = format_date(date('Y-m-d H:i:s')); 121 122 pwg_mail( 123 $row['email'], 124 array( 125 'subject' => '['.strip_tags($conf['gallery_title']).'] Re:'.$element['name'], 126 ), 127 array( 128 'filename' => 'notification', 129 'dirname' => SUBSCRIBE_TO_PATH . 'template', 130 'assign' => array( 131 'ELEMENT' => $element, 132 'COMMENT' => $comm, 133 'UNSUB_URL' => make_stc_url('unsubscribe', $row['email'], $row['id']), 134 'MANAGE_URL' => make_stc_url('manage', $row['email']), 135 ), 136 ) 137 ); 138 129 139 switch_lang_back(); 130 140 } 131 141 132 142 load_language('plugin.lang', SUBSCRIBE_TO_PATH); 133 143 unset_make_full_url(); … … 149 159 return false; 150 160 } 151 152 if ( !in_array($type, array('all-images','all-albums')) and $element_id == 'NULL')161 162 if (!in_array($type, array('all-images','all-albums')) and $element_id == 'NULL') 153 163 { 154 164 trigger_error('subscribe_to_comment: missing element_id', E_USER_WARNING); 155 165 return false; 156 166 } 157 167 158 168 global $page, $conf, $user, $template, $picture; 159 169 160 170 // check email 161 if ( !empty($email) and !email_check_format($email))162 { 163 array_push($page['errors'], l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'));164 return false; 165 } 166 if ( ( is_a_guest() or empty($user['email'])) and empty($email) )167 { 168 array_push($page['errors'], l10n('Invalid email adress, your are not subscribed to comments.'));169 return false; 170 } 171 else if ( !is_a_guest() and empty($email))171 if (!empty($email) and !email_check_format($email)) 172 { 173 $page['errors'][] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); 174 return false; 175 } 176 if ( (is_a_guest() or empty($user['email'])) and empty($email) ) 177 { 178 $page['errors'][] = l10n('Invalid email address, your are not subscribed to comments.'); 179 return false; 180 } 181 else if (!is_a_guest() and empty($email)) 172 182 { 173 183 $email = $user['email']; 174 184 } 175 176 // search if already registered (can't use ODKU because we want to get the id of inserted OR updated row)185 186 // search if already registered 177 187 $query = ' 178 188 SELECT id … … 184 194 ;'; 185 195 $result = pwg_query($query); 186 196 187 197 if (pwg_db_num_rows($result)) 188 198 { 189 list($inserted_id) = pwg_db_fetch_row($result); 190 } 191 else 192 { 193 $query = ' 199 return false; 200 } 201 202 $query = ' 194 203 INSERT INTO '.SUBSCRIBE_TO_TABLE.'( 195 204 type, … … 209 218 ) 210 219 ;'; 211 pwg_query($query); 212 213 $inserted_id = pwg_db_insert_id(); 214 } 215 216 // notify admins 217 if ( pwg_db_changes() != 0 and $conf['Subscribe_to_Comments']['notify_admin_on_subscribe'] ) 218 { 219 stc_mail_notification_admins($email, $type, $element_id, $inserted_id); 220 } 221 222 // send validation mail 223 if ( is_a_guest() and pwg_db_changes() != 0 ) 224 { 225 set_make_full_url(); 226 227 $template->set_filename('stc_mail', realpath(SUBSCRIBE_TO_PATH . 'template/mail/confirm.tpl')); 228 229 $subject = '['.strip_tags($conf['gallery_title']).'] '.l10n('Confirm your subscribtion to comments'); 230 220 pwg_query($query); 221 222 $stc_id = pwg_db_insert_id(); 223 224 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 225 226 set_make_full_url(); 227 228 if (!is_a_guest() or $conf['Subscribe_to_Comments']['notify_admin_on_subscribe']) 229 { 231 230 switch ($type) 232 231 { 233 232 case 'image': 234 233 $element = get_picture_infos($element_id); 235 $element['on'] = sprintf(l10n('the picture <a href="%s">%s</a>'), $element['url'], $element['name']);234 $element['on'] = l10n('the picture <a href="%s">%s</a>', $element['url'], $element['name']); 236 235 break; 237 236 case 'album-images': 238 237 $element = get_category_infos($element_id); 239 $element['on'] = sprintf(l10n('all pictures of the album <a href="%s">%s</a>'), $element['url'], $element['name']);238 $element['on'] = l10n('all pictures of the album <a href="%s">%s</a>', $element['url'], $element['name']); 240 239 break; 241 240 case 'all-images': … … 245 244 case 'album': 246 245 $element = get_category_infos($element_id); 247 $element['on'] = sprintf(l10n('the album <a href="%s">%s</a>'), $element['url'], $element['name']);246 $element['on'] = l10n('the album <a href="%s">%s</a>', $element['url'], $element['name']); 248 247 break; 249 248 case 'all-albums': … … 252 251 break; 253 252 } 254 255 $template->assign('STC', array( 256 'element' => $element, 257 'VALIDATE_URL' => make_stc_url('validate', $email, $inserted_id), 258 'MANAGE_URL' => make_stc_url('manage', $email), 259 'GALLERY_TITLE' => $conf['gallery_title'], 260 )); 261 262 $content = $template->parse('stc_mail', true); 263 264 stc_send_mail($email, $content, $subject); 265 unset_make_full_url(); 266 267 array_push($page['infos'], l10n('Please check your email inbox to confirm your subscription.')); 268 return true; 253 } 254 255 // send validation mail 256 if (is_a_guest()) 257 { 258 pwg_mail( 259 $email, 260 array( 261 'subject' => '['.strip_tags($conf['gallery_title']).'] '.l10n('Confirm your subscription to comments'), 262 ), 263 array( 264 'filename' => 'confirm', 265 'dirname' => SUBSCRIBE_TO_PATH . 'template', 266 'assign' => array( 267 'ELEMENT' => $element, 268 'VALIDATE_URL' => make_stc_url('validate', $email, $stc_id), 269 'MANAGE_URL' => make_stc_url('manage', $email), 270 ), 271 ) 272 ); 273 274 $page['infos'][] = l10n('Please check your email in-box to confirm your subscription.'); 269 275 } 270 276 // just display confirmation message 271 else if (pwg_db_changes() != 0) 272 { 273 array_push($page['infos'], l10n('You have been added to the list of subscribers.')); 274 return true; 275 } 276 277 return false; 277 else 278 { 279 $page['infos'][] = l10n('You have been added to the list of subscribers.'); 280 } 281 282 // notify admins 283 if ($conf['Subscribe_to_Comments']['notify_admin_on_subscribe']) 284 { 285 $keyargs_content = array( 286 get_l10n_args('Hi administrators,'), 287 get_l10n_args(''), 288 get_l10n_args('%s has subscribed to comments on %s.', array($email, $element['on'])), 289 get_l10n_args('', ''), 290 get_l10n_args('Connected user: %s', stripslashes($user['username'])), 291 get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']), 292 get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT']), 293 ); 294 295 pwg_mail_notification_admins( 296 get_l10n_args('%s has subscribed to comments on %s.', array($email, '')), 297 $keyargs_content 298 ); 299 } 300 301 unset_make_full_url(); 302 303 return true; 278 304 } 279 305 … … 285 311 * @return: bool 286 312 */ 287 function un_subscribe_to_comments($email, $id )288 { 289 if ( !empty($email) and !email_check_format($email))313 function un_subscribe_to_comments($email, $ids) 314 { 315 if (!empty($email) and !email_check_format($email)) 290 316 { 291 317 trigger_error('un_subscribe_to_comment: bad email', E_USER_WARNING); 292 318 return false; 293 319 } 294 295 if (!preg_match('#^[0-9]+$#', $id)) 320 if (empty($ids)) 296 321 { 297 322 trigger_error('un_subscribe_to_comment: bad id', E_USER_WARNING); 298 323 return false; 299 324 } 300 301 global $ template, $user;302 325 326 global $user; 327 303 328 // check email 304 if ( ( is_a_guest() or empty($user['email'])) and empty($email) )305 { 306 return false; 307 } 308 else if ( !is_a_guest() and empty($email))329 if ( (is_a_guest() or empty($user['email'])) and empty($email) ) 330 { 331 return false; 332 } 333 else if (!is_a_guest() and empty($email)) 309 334 { 310 335 $email = $user['email']; 311 336 } 312 337 338 if (!is_array($ids)) 339 { 340 $ids = array($ids); 341 } 342 $ids = array_map('intval', $ids); 343 313 344 // delete subscription 314 345 $query = ' 315 346 DELETE FROM '.SUBSCRIBE_TO_TABLE.' 316 WHERE 347 WHERE 317 348 email = "'.pwg_db_real_escape_string($email).'" 318 AND id = '.$id.'349 AND id IN('. implode(',', $ids) .') 319 350 ;'; 320 351 pwg_query($query); 321 352 322 353 return (pwg_db_changes() != 0); 323 354 } … … 330 361 * @return: bool 331 362 */ 332 function validate_subscriptions($email, $id )363 function validate_subscriptions($email, $ids) 333 364 { 334 365 if (!email_check_format($email)) … … 337 368 return false; 338 369 } 339 340 if (!preg_match('#^[0-9]+$#', $id)) 370 if (empty($ids)) 341 371 { 342 372 trigger_error('validate_subscriptions: bad id', E_USER_WARNING); 343 373 return false; 344 374 } 345 375 376 if (!is_array($ids)) 377 { 378 $ids = array($ids); 379 } 380 $ids = array_map('intval', $ids); 381 346 382 $query = ' 347 383 UPDATE '.SUBSCRIBE_TO_TABLE.' 348 384 SET validated = "true" 349 WHERE 385 WHERE 350 386 email = "'.pwg_db_real_escape_string($email).'" 351 AND id = '.$id.'387 AND id IN('. implode(',', $ids) .') 352 388 ;'; 353 389 pwg_query($query); 354 390 355 391 return (pwg_db_changes() != 0); 356 }357 358 359 /**360 * send notification to admins361 * @param: string email362 * @param: string type (image|album-images|all-images|album|all-albums)363 * @param: int element_id364 * @param: int subscription id365 */366 function stc_mail_notification_admins($email, $type, $element_id, $inserted_id)367 {368 global $user, $conf, $template;369 370 $admins = get_admins_email();371 if (empty($admins)) return;372 373 set_make_full_url();374 switch_lang_to(get_default_language());375 load_language('plugin.lang', SUBSCRIBE_TO_PATH);376 377 $template->set_filename('stc_mail', realpath(SUBSCRIBE_TO_PATH . 'template/mail/admin.tpl'));378 379 $subject = '['.strip_tags($conf['gallery_title']).'] '.sprintf(l10n('%s has subscribed to comments on %s.'), is_a_guest()?$email:$user['username'], null);380 381 switch ($type)382 {383 case 'image':384 $element = get_picture_infos($element_id, false);385 $element['on'] = sprintf(l10n('the picture <a href="%s">%s</a>'), $element['url'], $element['name']);386 break;387 case 'album-images':388 $element = get_category_infos($element_id, false);389 $element['on'] = sprintf(l10n('all pictures of the album <a href="%s">%s</a>'), $element['url'], $element['name']);390 break;391 case 'all-images':392 $element['on'] = l10n('all pictures of the gallery');393 break;394 case 'album':395 $element = get_category_infos($element_id, false);396 $element['on'] = sprintf(l10n('the album <a href="%s">%s</a>'), $element['url'], $element['name']);397 break;398 case 'all-albums':399 $element['on'] = l10n('all albums of the gallery');400 break;401 }402 403 $technical_infos[] = sprintf(l10n('Connected user: %s'), stripslashes($user['username']));404 $technical_infos[] = sprintf(l10n('IP: %s'), $_SERVER['REMOTE_ADDR']);405 $technical_infos[] = sprintf(l10n('Browser: %s'), $_SERVER['HTTP_USER_AGENT']);406 407 $template->assign('STC', array(408 'ELEMENT' => $element['on'],409 'USER' => is_a_guest() ? '<b>'.$email.'</b>' : '<b>'.$user['username'].'</b> ('.$email.')',410 'GALLERY_TITLE' => $conf['gallery_title'],411 'TECHNICAL' => implode('<br>', $technical_infos),412 ));413 414 $content = $template->parse('stc_mail', true);415 416 stc_send_mail($admins, $content, $subject);417 418 unset_make_full_url();419 switch_lang_back();420 load_language('plugin.lang', SUBSCRIBE_TO_PATH);421 392 } 422 393 … … 431 402 function make_stc_url($action, $email, $id=null) 432 403 { 433 if ( empty($action) or empty($email))404 if (empty($action) or empty($email)) 434 405 { 435 406 trigger_error('make_stc_url: missing action and/or mail', E_USER_WARNING); 436 407 return null; 437 408 } 438 409 439 410 global $conf; 440 411 set_make_full_url(); 441 442 $url_params = array( 443 'action' => $action, 444 'email' => $email, 445 ); 446 412 413 $url_params = compact('action', 'email'); 447 414 if (!empty($id)) 448 415 { 449 416 $url_params['id'] = $id; 450 417 } 451 418 452 419 $url_params['key'] = crypt_value( 453 $action.$email. (isset($url_params['id'])?$url_params['id']:null),420 $action.$email.$id, 454 421 $conf['secret_key'] 455 422 ); 456 423 457 424 $url = add_url_params( 458 make_index_url( array('section' => 'subscriptions')),425 make_index_url(array('section' => 'subscriptions')), 459 426 $url_params 460 427 ); 461 428 462 429 unset_make_full_url(); 463 430 return $url; 464 }465 466 467 /**468 * send mail with STC style469 * @param: string to470 * @param: string content471 * @param: string subject472 * @return: bool473 */474 function stc_send_mail($to, $content, $subject)475 {476 global $conf, $conf_mail, $page, $template;477 478 // inputs479 if (empty($to))480 {481 return false;482 }483 484 if (empty($content))485 {486 return false;487 }488 489 if (empty($subject))490 {491 $subject = 'Piwigo';492 }493 else494 {495 $subject = trim(preg_replace('#[\n\r]+#s', '', $subject));496 $subject = encode_mime_header($subject);497 }498 499 if (!isset($conf_mail))500 {501 $conf_mail = get_mail_configuration();502 }503 504 $args['from'] = $conf_mail['formated_email_webmaster'];505 506 set_make_full_url();507 508 // hearders509 $headers = 'From: '.$args['from']."\n";510 $headers.= 'MIME-Version: 1.0'."\n";511 $headers.= 'X-Mailer: Piwigo Mailer'."\n";512 $headers.= 'Content-Transfer-Encoding: 8bit'."\n";513 $headers.= 'Content-Type: text/html; charset="'.get_pwg_charset().'";'."\n";514 515 // template516 $template->set_filenames(array(517 'stc_mail_header' => realpath(SUBSCRIBE_TO_PATH . 'template/mail/header.tpl'),518 'stc_mail_footer' => realpath(SUBSCRIBE_TO_PATH . 'template/mail/footer.tpl'),519 ));520 $stc_mail_css = file_get_contents(realpath(SUBSCRIBE_TO_PATH . 'template/mail/style.css'));521 522 $template->assign(array(523 'GALLERY_URL' => get_gallery_home_url(),524 'PHPWG_URL' => PHPWG_URL,525 'STC_MAIL_CSS' => str_replace("\n", null, $stc_mail_css),526 ));527 528 $content = $template->parse('stc_mail_header', true) . $content . $template->parse('stc_mail_footer', true);529 530 $content = wordwrap($content, 70, "\n", false);531 532 unset_make_full_url();533 534 // send mail535 return536 trigger_event('send_mail',537 false, /* Result */538 trigger_event('send_mail_to', get_strict_email_list($to)),539 trigger_event('send_mail_subject', $subject),540 trigger_event('send_mail_content', $content),541 trigger_event('send_mail_headers', $headers),542 $args543 );544 431 } 545 432 … … 553 440 function get_picture_infos($image_id, $with_thumb=true) 554 441 { 555 if (empty($image_id)) return array(); 556 442 if (empty($image_id)) 443 { 444 return array(); 445 } 446 557 447 $query = ' 558 448 SELECT … … 565 455 ;'; 566 456 $element = pwg_db_fetch_assoc(pwg_query($query)); 567 457 568 458 if (empty($element['name'])) 569 459 { … … 571 461 } 572 462 $element['name'] = trigger_event('render_element_name', $element['name']); 573 463 574 464 $element['url'] = make_picture_url(array( 575 465 'image_id'=>$element['id'] 576 466 )); 577 467 578 468 if ($with_thumb) 579 469 { 580 470 $element['thumbnail'] = DerivativeImage::thumb_url($element); 581 471 } 582 472 583 473 return $element; 584 474 } … … 593 483 { 594 484 global $conf; 595 596 if ($user_id===null) $user_id = $conf['guest_id']; 597 485 486 if ($user_id===null) 487 { 488 $user_id = $conf['guest_id']; 489 } 490 598 491 $query = ' 599 492 SELECT … … 606 499 img.path 607 500 FROM '.CATEGORIES_TABLE.' AS cat 608 LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 501 LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 609 502 ON ucc.cat_id = cat.id AND ucc.user_id = '.$user_id.' 610 503 LEFT JOIN '.IMAGES_TABLE.' AS img … … 613 506 ;'; 614 507 $element = pwg_db_fetch_assoc(pwg_query($query)); 615 508 616 509 $element['url'] = make_index_url(array( 617 510 'section'=>'categories', 618 511 'category'=>$element, 619 512 )); 620 513 621 514 $element['name'] = trigger_event('render_category_name', $element['name']); 622 515 623 516 if ($with_thumb) 624 517 { … … 636 529 } 637 530 } 638 531 639 532 return $element; 640 533 } … … 647 540 { 648 541 global $conf, $user; 649 542 650 543 $admins = array(); 651 544 652 545 $query = ' 653 546 SELECT … … 655 548 u.'.$conf['user_fields']['email'].' AS email 656 549 FROM '.USERS_TABLE.' AS u 657 JOIN '.USER_INFOS_TABLE.' AS i 550 JOIN '.USER_INFOS_TABLE.' AS i 658 551 ON i.user_id = u.'.$conf['user_fields']['id'].' 659 552 WHERE i.status IN ("webmaster", "admin") … … 686 579 { 687 580 global $conf; 688 581 689 582 $old_conf = $conf['external_authentification']; 690 583 $conf['external_authentification'] = false; 691 584 $user = getuserdata($user_id, true); 692 585 $conf['external_authentification'] = $old_conf; 693 586 694 587 if ($type == 'image') 695 588 { … … 715 608 */ 716 609 function crypt_value($value, $key) 717 { 610 { 718 611 if (extension_loaded('mcrypt')) 719 612 { … … 733 626 } 734 627 } 735 628 736 629 $result = base64url_encode($result); 737 return trim($result); 630 return trim($result); 738 631 } 739 632 … … 746 639 function decrypt_value($value, $key) 747 640 { 748 $value = base64url_decode($value); 749 641 $value = base64url_decode($value); 642 750 643 if (extension_loaded('mcrypt')) 751 644 { … … 765 658 } 766 659 } 767 660 768 661 return trim($result); 769 662 } … … 773 666 * http://php.net/manual/en/function.base64-encode.php#103849 774 667 */ 775 function base64url_encode($data) 776 { 777 return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); 778 } 779 function base64url_decode($data) 780 { 781 return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); 782 } 783 784 ?> 668 if (!function_exists('base64url_encode')) 669 { 670 function base64url_encode($data) 671 { 672 return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); 673 } 674 function base64url_decode($data) 675 { 676 return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT)); 677 } 678 } -
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'); -
extensions/Subscribe_to_comments/main.inc.php
r21608 r26139 1 <?php 1 <?php 2 2 /* 3 3 Plugin Name: Subscribe To Comments 4 4 Version: auto 5 5 Description: This plugin allows to subscribe to comments by email. 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=5876 Plugin URI: auto 7 7 Author: Mistic 8 8 Author URI: http://www.strangeplanet.fr 9 9 */ 10 10 11 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');11 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 12 12 13 13 global $prefixeTable; 14 14 15 define d('SUBSCRIBE_TO_ID') or define('SUBSCRIBE_TO_ID',basename(dirname(__FILE__)));15 define('SUBSCRIBE_TO_ID', basename(dirname(__FILE__))); 16 16 define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/'); 17 17 define('SUBSCRIBE_TO_TABLE', $prefixeTable . 'subscribe_to_comments'); … … 25 25 function stc_init() 26 26 { 27 global $conf, $user , $pwg_loaded_plugins;28 27 global $conf, $user; 28 29 29 // no comments on luciano 30 if ($user['theme'] == 'luciano') return; 31 32 // apply upgrade if needed 33 if ( 34 SUBSCRIBE_TO_VERSION == 'auto' or 35 $pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'] == 'auto' or 36 version_compare($pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'], SUBSCRIBE_TO_VERSION, '<') 37 ) 30 if ($user['theme'] == 'luciano') 38 31 { 39 include_once(SUBSCRIBE_TO_PATH . 'include/install.inc.php'); 40 stc_install(); 41 42 if ( $pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'] != 'auto' and SUBSCRIBE_TO_VERSION != 'auto' ) 43 { 44 $query = ' 45 UPDATE '. PLUGINS_TABLE .' 46 SET version = "'. SUBSCRIBE_TO_VERSION .'" 47 WHERE id = "'. SUBSCRIBE_TO_ID .'"'; 48 pwg_query($query); 49 50 $pwg_loaded_plugins[SUBSCRIBE_TO_ID]['version'] = SUBSCRIBE_TO_VERSION; 51 52 if (defined('IN_ADMIN')) 53 { 54 $_SESSION['page_infos'][] = 'Subscribe to comments updated to version '. SUBSCRIBE_TO_VERSION; 55 } 56 } 32 return; 57 33 } 58 59 // load language and conf 34 35 include_once(SUBSCRIBE_TO_PATH . 'maintain.inc.php'); 36 $maintain = new Subscribe_to_Comments_maintain(SUBSCRIBE_TO_ID); 37 $maintain->autoUpdate(SUBSCRIBE_TO_VERSION, 'install'); 38 39 60 40 load_language('plugin.lang', SUBSCRIBE_TO_PATH); 61 41 $conf['Subscribe_to_Comments'] = unserialize($conf['Subscribe_to_Comments']); 62 63 42 43 64 44 include_once(SUBSCRIBE_TO_PATH.'include/functions.inc.php'); 65 include_once(SUBSCRIBE_TO_PATH.'include/ subscribe_to_comments.inc.php');45 include_once(SUBSCRIBE_TO_PATH.'include/events.inc.php'); 66 46 67 47 48 if (!defined('IN_ADMIN')) 49 { 50 // subscribe 51 add_event_handler('loc_end_picture', 'stc_on_picture'); 52 add_event_handler('loc_begin_coa', 'stc_on_album'); 53 54 // management 55 add_event_handler('loc_end_section_init', 'stc_detect_section'); 56 add_event_handler('loc_begin_page_header', 'stc_load_section'); 57 58 // profile link 59 add_event_handler('loc_begin_profile', 'stc_profile_link'); 60 } 61 else 62 { 63 // config page 64 add_event_handler('get_admin_plugin_menu_links', 'stc_admin_menu'); 65 } 66 68 67 // send mails 69 68 add_event_handler('user_comment_insertion', 'stc_comment_insertion'); 70 69 add_event_handler('user_comment_validation', 'stc_comment_validation', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 71 70 72 // subscribe73 add_event_handler('loc_end_picture', 'stc_on_picture');74 add_event_handler('loc_begin_coa', 'stc_on_album');75 76 // management77 add_event_handler('loc_end_section_init', 'stc_detect_section');78 add_event_handler('loc_begin_page_header', 'stc_load_section');79 80 71 // items deletion 81 72 add_event_handler('begin_delete_elements', 'stc_delete_elements'); 82 73 add_event_handler('delete_categories', 'stc_delete_categories'); 83 84 // profile link85 add_event_handler('loc_begin_profile', 'stc_profile_link');86 87 // config page88 add_event_handler('get_admin_plugin_menu_links', 'stc_admin_menu');89 74 } 90 75 91 76 92 function stc_admin_menu($menu) 77 function stc_admin_menu($menu) 93 78 { 94 array_push($menu,array(79 $menu[] = array( 95 80 'NAME' => 'Subscribe to Comments', 96 81 'URL' => SUBSCRIBE_TO_ADMIN, 97 ));82 ); 98 83 return $menu; 99 84 } 100 101 ?> -
extensions/Subscribe_to_comments/maintain.inc.php
r21441 r26139 1 1 <?php 2 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 3 4 defined('SUBSCRIBE_TO_ID') or define('SUBSCRIBE_TO_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_ID . '/include/install.inc.php'); 6 4 class Subscribe_to_Comments_maintain extends PluginMaintain 5 { 6 private $installed = false; 7 7 8 function plugin_install() 9 { 10 stc_install(); 11 define('stc_installed', true); 12 } 8 private $default_conf = array( 9 'notify_admin_on_subscribe' => false, 10 'allow_global_subscriptions' => true, 11 ); 13 12 14 function plugin_activate() 15 { 16 if (!defined('stc_installed'))13 private $table; 14 15 function __construct($plugin_id) 17 16 { 18 stc_install(); 17 parent::__construct($plugin_id); 18 19 global $prefixeTable; 20 $this->table = $prefixeTable . 'subscribe_to_comments'; 21 } 22 23 function install($plugin_version, &$errors=array()) 24 { 25 global $conf; 26 27 // config parameter 28 if (empty($conf['Subscribe_to_Comments'])) 29 { 30 $conf['Subscribe_to_Comments'] = serialize($this->default_config); 31 conf_update_param('Subscribe_to_Comments', $conf['Subscribe_to_Comments']); 32 } 33 34 // subscriptions table 35 pwg_query(' 36 CREATE TABLE IF NOT EXISTS `'. $this->table .'` ( 37 `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 38 `type` enum("image","album-images","album","all-images","all-albums") NOT NULL DEFAULT "image", 39 `element_id` mediumint(8) DEFAULT NULL, 40 `language` varchar(64) NOT NULL, 41 `email` varchar(255) NOT NULL, 42 `registration_date` datetime NOT NULL, 43 `validated` enum("true","false") NOT NULL DEFAULT "false", 44 PRIMARY KEY (`id`), 45 UNIQUE KEY `UNIQUE` (`email` , `type` , `element_id`) 46 ) DEFAULT CHARSET=utf8 47 ;'); 48 49 // table structure upgrade in 1.1 50 $result = pwg_query('SHOW COLUMNS FROM `'. $this->table .'` LIKE "element_id";'); 51 if (!pwg_db_num_rows($result)) 52 { 53 // backup subscriptions 54 $query = 'SELECT * FROM `'. $this->table .'` ORDER BY registration_date;'; 55 $subscriptions = query2array($query, 'id'); 56 57 // upgrade the table 58 pwg_query('TRUNCATE TABLE `'. $this->table .'`;'); 59 pwg_query('ALTER TABLE `'. $this->table .'` DROP `image_id`, DROP `category_id`;'); 60 pwg_query('ALTER TABLE `'. $this->table .'` AUTO_INCREMENT = 1;'); 61 62 $query = ' 63 ALTER TABLE `'. $this->table .'` 64 ADD `type` enum("image", "album-images", "album", "all-images", "all-albums") NOT NULL DEFAULT "image" AFTER `id`, 65 ADD `element_id` mediumint(8) NULL AFTER `type`, 66 ADD `language` varchar(64) NOT NULL AFTER `element_id` 67 ;'; 68 pwg_query($query); 69 70 pwg_query('ALTER TABLE `'. $this->table .'` DROP INDEX `UNIQUE`, ADD UNIQUE `UNIQUE` (`email`, `type`, `element_id`);'); 71 72 // convert datas and fill the table 73 $inserts = array(); 74 75 foreach ($subscriptions as $row) 76 { 77 if (!empty($row['category_id'])) 78 { 79 $row['type'] = 'album'; 80 $row['element_id'] = $row['category_id']; 81 } 82 else if (!empty($row['image_id'])) 83 { 84 $row['type'] = 'image'; 85 $row['element_id'] = $row['image_id']; 86 } 87 else 88 { 89 continue; 90 } 91 92 unset($row['id'], $row['image_id'], $row['category_id']); 93 $row['language'] = 'en_UK'; 94 95 array_push($inserts, $row); 96 } 97 98 if (count($inserts) > 0) 99 { 100 $dbfields = array('type', 'element_id', 'language', 'email', 'registration_date', 'validated'); 101 mass_inserts($this->table, $dbfields, $inserts); 102 } 103 } 104 105 $this->installed = true; 106 } 107 108 function activate($plugin_version, &$errors=array()) 109 { 110 if (!$this->installed) 111 { 112 $this->install($plugin_version, $errors); 113 } 114 } 115 116 function deactivate() 117 { 118 } 119 120 function uninstall() 121 { 122 conf_delete_param('Subscribe_to_Comments'); 123 124 pwg_query('DROP TABLE `'. $this->table .'`;'); 19 125 } 20 126 } 21 22 function plugin_uninstall()23 {24 global $prefixeTable;25 26 pwg_query('DROP TABLE `'. $prefixeTable . 'subscribe_to_comments`;');27 pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "Subscribe_to_Comments" LIMIT 1;');28 }29 ?> -
extensions/Subscribe_to_comments/template/form_comment.tpl
r21439 r26139 2 2 3 3 <p> 4 {'Notify me of followup comments'| @translate} :<br>5 <label><input type="radio" name="stc_mode" value="-1" {if !$STC_MODE}checked ="checked"{/if}> {'No'|@translate}</label>4 {'Notify me of followup comments'|translate} :<br> 5 <label><input type="radio" name="stc_mode" value="-1" {if !$STC_MODE}checked{/if}> {'No'|translate}</label> 6 6 {if $STC_ON_PICTURE} 7 {if $STC_ALLOW_GLOBAL} 8 <label><input type="radio" name="stc_mode" value="image" {if $STC_MODE=="image"}checked ="checked"{/if}> {'this picture'|@translate}</label>9 {if $STC_ALLOW_ALBUM_IMAGES}<label><input type="radio" name="stc_mode" value="album-images" {if $STC_MODE=="album-images"}checked ="checked"{/if}> {'all pictures of this album'|@translate}</label>{/if}10 <label><input type="radio" name="stc_mode" value="all-images" {if $STC_MODE=="all-images"}checked ="checked"{/if}> {'all pictures of the gallery'|@translate}</label>7 {if $STC_ALLOW_GLOBAL} 8 <label><input type="radio" name="stc_mode" value="image" {if $STC_MODE=="image"}checked{/if}> {'this picture'|translate}</label> 9 {if $STC_ALLOW_ALBUM_IMAGES}<label><input type="radio" name="stc_mode" value="album-images" {if $STC_MODE=="album-images"}checked{/if}> {'all pictures of this album'|translate}</label>{/if} 10 <label><input type="radio" name="stc_mode" value="all-images" {if $STC_MODE=="all-images"}checked{/if}> {'all pictures of the gallery'|translate}</label> 11 11 {else} 12 <label><input type="radio" name="stc_mode" value="image" {if $STC_MODE=="image"}checked ="checked"{/if}> {'Yes'|@translate}</label>12 <label><input type="radio" name="stc_mode" value="image" {if $STC_MODE=="image"}checked{/if}> {'Yes'|translate}</label> 13 13 {/if} 14 14 {elseif $STC_ON_ALBUM} 15 15 {if $STC_ALLOW_GLOBAL} 16 <label><input type="radio" name="stc_mode" value="album" {if $STC_MODE=="album"}checked ="checked"{/if}> {'this album'|@translate}</label>17 <label><input type="radio" name="stc_mode" value="all-albums" {if $STC_MODE=="all-albums"}checked ="checked"{/if}> {'all albums of the gallery'|@translate}</label>16 <label><input type="radio" name="stc_mode" value="album" {if $STC_MODE=="album"}checked{/if}> {'this album'|translate}</label> 17 <label><input type="radio" name="stc_mode" value="all-albums" {if $STC_MODE=="all-albums"}checked{/if}> {'all albums of the gallery'|translate}</label> 18 18 {else} 19 <label><input type="radio" name="stc_mode" value="album" {if $STC_MODE=="album"}checked ="checked"{/if}> {'Yes'|@translate}</label>19 <label><input type="radio" name="stc_mode" value="album" {if $STC_MODE=="album"}checked{/if}> {'Yes'|translate}</label> 20 20 {/if} 21 21 {/if} … … 23 23 24 24 {if $STC_ASK_MAIL} 25 {footer_script require="jquery"}{literal} 25 {footer_script require='jquery'} 26 (function($){ 26 27 var $stc_email_input = $("#addComment input[name='email']"); 27 28 var stc_bordercolor = $stc_email_input.css('border-color'); 28 29 29 30 $("#addComment input[name='stc_mode']").change(function() { 30 31 if ($(this).val() != "-1") { … … 40 41 $(this).css('border-color', stc_bordercolor); 41 42 }); 42 {/literal}{/footer_script} 43 }(jQuery)); 44 {/footer_script} 43 45 {/if} 44 46 -
extensions/Subscribe_to_comments/template/form_standalone.tpl
r21439 r26139 1 {combine_css path=$SUBSCRIBE_TO_PATH| @cat:'template/style_form.css'}1 {combine_css path=$SUBSCRIBE_TO_PATH|cat:'template/style_form.css'} 2 2 3 3 {if $STC_ALLOW_GLOBAL} 4 {footer_script require="jquery"}{literal}4 {footer_script require='jquery'} 5 5 jQuery("#stc_submit").hide(); 6 6 jQuery("#stc_standalone input[name='stc_mode']").change(function() { 7 7 jQuery("#stc_submit").show(); 8 8 }); 9 {/literal}{/footer_script}9 {/footer_script} 10 10 {/if} 11 11 … … 16 16 {if $SUBSCRIBED} 17 17 {if $SUBSCRIBED=='all-images'} 18 {assign var=str value='all pictures of the gallery'| @translate}18 {assign var=str value='all pictures of the gallery'|translate} 19 19 {elseif $SUBSCRIBED=='album-images'} 20 {assign var=str value='all pictures of this album'| @translate}20 {assign var=str value='all pictures of this album'|translate} 21 21 {elseif $SUBSCRIBED=='image'} 22 {assign var=str value='this picture'| @translate}22 {assign var=str value='this picture'|translate} 23 23 {elseif $SUBSCRIBED=='all-albums'} 24 {assign var=str value='all albums of the gallery'| @translate}24 {assign var=str value='all albums of the gallery'|translate} 25 25 {elseif $SUBSCRIBED=='album'} 26 {assign var=str value='this album'| @translate}26 {assign var=str value='this album'|translate} 27 27 {/if} 28 29 {'You are currently subscribed to comments on %s.'| @translate|sprintf:$str}30 <a href="{$UNSUB_LINK}">{'Unsubscribe'| @translate}</a>28 29 {'You are currently subscribed to comments on %s.'|translate|sprintf:$str} 30 <a href="{$UNSUB_LINK}">{'Unsubscribe'|translate}</a> 31 31 {else} 32 <legend>{'Subscribe to mail notifications'| @translate}</legend>32 <legend>{'Subscribe to mail notifications'|translate}</legend> 33 33 {if $STC_ON_PICTURE} 34 34 {if $STC_ALLOW_GLOBAL} 35 <label><input type="radio" name="stc_mode" value="image"> {'this picture'| @translate}</label>36 {if $STC_ALLOW_ALBUM_IMAGES}<label><input type="radio" name="stc_mode" value="album-images"> {'all pictures of this album'| @translate}</label>{/if}37 <label><input type="radio" name="stc_mode" value="all-images"> {'all pictures of the gallery'| @translate}</label>35 <label><input type="radio" name="stc_mode" value="image"> {'this picture'|translate}</label> 36 {if $STC_ALLOW_ALBUM_IMAGES}<label><input type="radio" name="stc_mode" value="album-images"> {'all pictures of this album'|translate}</label>{/if} 37 <label><input type="radio" name="stc_mode" value="all-images"> {'all pictures of the gallery'|translate}</label> 38 38 {else} 39 39 <input type="hidden" name="stc_mode" value="image"> … … 41 41 {elseif $STC_ON_ALBUM} 42 42 {if $STC_ALLOW_GLOBAL} 43 <label><input type="radio" name="stc_mode" value="album"> {'this album'| @translate}</label>44 <label><input type="radio" name="stc_mode" value="all-albums"> {'all albums of the gallery'| @translate}</label>43 <label><input type="radio" name="stc_mode" value="album"> {'this album'|translate}</label> 44 <label><input type="radio" name="stc_mode" value="all-albums"> {'all albums of the gallery'|translate}</label> 45 45 {else} 46 46 <input type="hidden" name="stc_mode" value="album"> … … 50 50 <span id="stc_submit"> 51 51 {if $STC_ASK_MAIL} 52 <label>{'Email'| @translate} <input type="text" name="stc_mail" size="30"></label>52 <label>{'Email'|translate} <input type="text" name="stc_mail" size="30"></label> 53 53 {/if} 54 <label><input type="submit" name="stc_submit" value="{'Subscribe'| @translate}"></label>54 <label><input type="submit" name="stc_submit" value="{'Subscribe'|translate}"></label> 55 55 </span> 56 56 {/if} -
extensions/Subscribe_to_comments/template/style.css
r21340 r26139 35 35 vertical-align:top; 36 36 } 37 37 38 38 .subscriptions_list tr.row2 { background-color:#222; } 39 39 .subscriptions_list tr.row1 { background-color:#333; } … … 46 46 } 47 47 .subscriptions_list tr.header th, .subscriptions_list tr.footer.row1 td { 48 48 49 49 background: #333333; 50 50 background: -moz-linear-gradient(top, #333333 0%, #222222 100%); 51 background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#333333), color-stop(100%,#222222));52 51 background: -webkit-linear-gradient(top, #333333 0%,#222222 100%); 53 52 background: -o-linear-gradient(top, #333333 0%,#222222 100%); … … 59 58 background: #222222; 60 59 background: -moz-linear-gradient(top, #222222 0%, #333333 100%); 61 background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#222222), color-stop(100%,#333333));62 60 background: -webkit-linear-gradient(top, #222222 0%,#333333 100%); 63 61 background: -o-linear-gradient(top, #222222 0%,#333333 100%); … … 67 65 } 68 66 69 70 .stc p { 71 text-align:center; 72 } 73 74 .stc label { 75 display:block; 76 } 77 78 img.thumbnail { 67 .subscriptions_list img.thumbnail { 79 68 max-width:120px; 80 69 max-height:90px; 81 70 } 82 71 72 .subscriptions_list a.unsub { 73 color:#f66; 74 } 75 .subscriptions_list a.unsub:hover { 76 color:#f11; 77 } -
extensions/Subscribe_to_comments/template/subscriptions_page.tpl
r24342 r26139 1 {combine_css path=$SUBSCRIBE_TO_PATH| @cat:'template/style.css'}1 {combine_css path=$SUBSCRIBE_TO_PATH|cat:'template/style.css'} 2 2 3 {* <!-- Menubar & titrePage --> *}4 {if $themeconf.name == "stripped" or $themeconf.parent == "stripped"}5 {include file=$SUBSCRIBE_TO_ABS_PATH|@cat:'template/themes/stripped.tpl'}6 {assign var="clear" value="true"}7 {elseif $themeconf.name == "simple-grey" or $themeconf.parent == "simple"}8 {include file=$SUBSCRIBE_TO_ABS_PATH|@cat:'template/themes/simple.tpl'}9 {assign var="clear" value="true"}10 {else}11 {include file=$SUBSCRIBE_TO_ABS_PATH|@cat:'template/themes/default.tpl'}12 {/if}13 3 14 {include file='infos_errors.tpl'}15 16 17 4 {if $IN_VALIDATE or $IN_UNSUBSCRIBE} 18 5 <p> … … 20 7 <a href="{$MANAGE_LINK}">{'Manage my subscriptions'|@translate}</a> 21 8 </p> 22 {/if} 23 9 10 {else} 24 11 <form action="{$MANAGE_LINK}" method="post"> 25 12 {if !empty($global_subscriptions)} … … 32 19 {if $sub.type == 'all-images'} 33 20 {assign var=str value='all pictures of the gallery'|@translate} 34 <img src="{$ROOT_URL}{$SUBSCRIBE_TO_PATH}template/image.png"> 21 <img src="{$ROOT_URL}{$SUBSCRIBE_TO_PATH}template/image.png"> 35 22 {else $sub.type == 'all-albums'} 36 23 {assign var=str value='all albums of the gallery'|@translate} … … 41 28 <td style="white-space:nowrap;"> 42 29 <div class="actions"> 43 <a href="{$MANAGE_LINK}&unsubscribe={$sub.id}" >{'Unsubscribe'|@translate}</a>30 <a href="{$MANAGE_LINK}&unsubscribe={$sub.id}" class="unsub">{'Unsubscribe'|@translate}</a> 44 31 {if $sub.validated == 'false'}<br> <a href="{$MANAGE_LINK}&validate={$sub.id}">{'Validate'|@translate}</a>{/if} 45 32 </div> … … 53 40 </fieldset> 54 41 {/if} 55 42 56 43 {if !empty($subscriptions)} 57 44 <fieldset> … … 63 50 <th class="date">{'Followed on'|@translate}</th> 64 51 </tr> 65 52 66 53 {foreach from=$subscriptions item=sub name=subs_loop} 67 54 <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if} {if $sub.validated == 'false'}not-validated{/if}"> … … 73 60 74 61 <div class="actions"> 75 <a href="{$MANAGE_LINK}&unsubscribe={$sub.id}" >{'Unsubscribe'|@translate}</a>62 <a href="{$MANAGE_LINK}&unsubscribe={$sub.id}" class="unsub">{'Unsubscribe'|@translate}</a> 76 63 {if $sub.validated == 'false'}| <a href="{$MANAGE_LINK}&validate={$sub.id}">{'Validate'|@translate}</a>{/if} 77 64 </div> … … 82 69 </tr> 83 70 {/foreach} 84 71 85 72 <tr class="footer {if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}"><td colspan="4"> 86 73 <select name="action"> … … 92 79 </td></tr> 93 80 </table> 94 81 95 82 <p> 96 <img src="{$ROOT_URL}{$SUBSCRIBE_TO_PATH}template/image.png"> {'comments on a picture'|@translate}. 83 <img src="{$ROOT_URL}{$SUBSCRIBE_TO_PATH}template/image.png"> {'comments on a picture'|@translate}. 97 84 <img src="{$ROOT_URL}{$SUBSCRIBE_TO_PATH}template/album-images.png"> {'comments on all pictures of an album'|@translate}. 98 85 {if $COA_ACTIVATED}<img src="{$ROOT_URL}{$SUBSCRIBE_TO_PATH}template/album.png"> {'comments on an album'|@translate}.{/if} … … 100 87 </fieldset> 101 88 {/if} 102 89 103 90 {if !empty($global_subscriptions) or !empty($subscriptions)} 104 91 <p> … … 109 96 </form> 110 97 111 {footer_script require="jquery"} {literal}98 {footer_script require="jquery"} 112 99 jQuery("#check_all").change(function() { 113 if ($(this).is(":checked")) 114 $("input[name^='selected']").attr('checked', 'checked'); 115 else 116 $("input[name^='selected']").removeAttr('checked'); 100 if (jQuery(this).is(":checked")) { 101 jQuery("input[name^='selected']").attr('checked', 'checked'); 102 } 103 else { 104 jQuery("input[name^='selected']").removeAttr('checked'); 105 } 117 106 }); 118 {/ literal}{/footer_script}107 {/footer_script} 119 108 120 {if $clear}<div style="clear: both;"></div> 121 </div>{/if} 122 </div> <!-- content --> 109 {/if} -
extensions/Subscribe_to_comments/template/text/html/confirm.tpl
r24342 r26139 1 <div id="the_header"> 2 {'Subscribe to comments on %s'|@translate|sprintf:$STC.GALLERY_TITLE}</b> 3 </div> 1 <style> 2 .button { 3 padding:8px 15px; 4 background:#A80D24; 5 color:#bbb; 6 border:1px solid #CE2E5A; 7 text-decoration:none; 8 font-size:14px; 9 font-weight:bold; 10 } 11 </style> 4 12 5 < div id="the_content">13 <p>{'You requested to subscribe by email to comments on %s'|translate:$ELEMENT.on}.</p> 6 14 7 <p>{'You requested to subscribe by email to comments on %s'|@translate|sprintf:$STC.element.on}.</p> 8 9 {if not empty($STC.element.thumbnail)} 10 <p id="the_image"><img src="{$STC.element.thumbnail}" alt="{$STC.element.name}"></p> 15 {if not empty($ELEMENT.thumbnail)} 16 <p><img src="{$ELEMENT.thumbnail}" alt="{$ELEMENT.name}" class="photo"></p> 11 17 {/if} 12 18 13 <p>{'To activate, click the confirm button. If you believe this is an error, please just ignore this message.'| @translate}</p>19 <p>{'To activate, click the confirm button. If you believe this is an error, please just ignore this message.'|translate}</p> 14 20 15 <p><a href="{$ STC.VALIDATE_URL}" class="button">{'Confirm subscription'|@translate}</a></p>21 <p><a href="{$VALIDATE_URL}" class="button">{'Confirm subscription'|translate}</a></p> 16 22 17 <p>{'Want to edit your notifications options?'|@translate} <a href="{$STC.MANAGE_URL}">{'Manage my subscriptions'|@translate}</a>.</p> 18 19 </div> 23 <p>{'Want to edit your notifications options?'|translate} <a href="{$MANAGE_URL}">{'Manage my subscriptions'|translate}</a>.</p> -
extensions/Subscribe_to_comments/template/text/html/notification.tpl
r24342 r26139 1 <div id="the_header"> 2 {'New comment on %s'|@translate|sprintf:$STC.GALLERY_TITLE}</b> 3 </div> 4 5 <div id="the_content"> 6 7 <p id="the_image"> 8 <a href="{$STC.element.url}">{$STC.element.name}<br> 9 <img src="{$STC.element.thumbnail}" alt="{$STC.element.name}"></a> 1 <p> 2 <a href="{$ELEMENT.url}">{$ELEMENT.name}<br> 3 <img src="{$ELEMENT.thumbnail}" alt="{$ELEMENT.name}" class="photo"></a> 10 4 </p> 11 5 12 6 <p> 13 { $STC.comment.caption}:14 <blockquote>{$ STC.comment.content}</blockquote>7 {'<b>%s</b> wrote on <i>%s</i>'|translate:$COMMENT.author:$COMMENT.date} : 8 <blockquote>{$COMMENT.content}</blockquote> 15 9 </p> 16 10 17 11 <p> 18 <a href="{$ STC.UNSUB_URL}">{'Stop receiving notifications'|@translate}</a><br>19 <a href="{$ STC.MANAGE_URL}">{'Manage my subscriptions'|@translate}</a>12 <a href="{$UNSUB_URL}">{'Stop receiving notifications'|translate}</a><br> 13 <a href="{$MANAGE_URL}">{'Manage my subscriptions'|translate}</a> 20 14 </p> 21 22 </div>
Note: See TracChangeset
for help on using the changeset viewer.