Ignore:
Timestamp:
Jun 11, 2012, 10:10:56 PM (12 years ago)
Author:
mistic100
Message:

HUGE update, main features : global subscriptions (all images in an album, all images, all albums), beautyful (!) mails

Location:
extensions/Subscribe_to_comments
Files:
19 added
33 edited
2 moved

Legend:

Unmodified
Added
Removed
  • extensions/Subscribe_to_comments/include/functions.inc.php

    r12702 r15641  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 include_once(PHPWG_ROOT_PATH .'include/functions_tag.inc.php');
     4include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    55
    66/**
    77 * Send comment to subscribers
    8  * @param array comm
     8 * @param: array comment (author, content, image_id|category_id)
    99 */
    1010function send_comment_to_subscribers($comm)
    1111{
    12   global $conf, $page, $user;
    13  
    1412  if ( empty($comm) or !is_array($comm) )
    1513  {
    16     trigger_error('send_comment_to_subscribers: undefinided comm', E_USER_WARNING);
    17     return false;
    18   }
    19  
    20   $type= isset($comm['category_id']) ? 'category' : 'image';
     14    trigger_error('send_comment_to_subscribers: undefineded comm', E_USER_WARNING);
     15    return false;
     16  }
     17 
     18  global $conf, $page, $user, $template;
     19 
     20  // create search clauses
     21  $where_clauses = array();
     22  if (isset($comm['image_id']))
     23  {
     24    $element_id = $comm['image_id'];
     25    $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"');
     30  }
     31  else if (isset($comm['category_id']))
     32  {
     33    $element_id = $comm['category_id'];
     34    $element_type = 'category';
     35   
     36    array_push($where_clauses, 'type = "album" AND element_id = '.$element_id.'');
     37    array_push($where_clauses, 'type = "all-albums"');
     38  }
     39  else
     40  {
     41    return;
     42  }
    2143 
    2244  // exclude current user
    2345  $exclude = null;
    24   if (!empty($_POST['stc_mail'])) $exclude = pwg_db_real_escape_string($_POST['stc_mail']);
    25   else if (!is_a_guest()) $exclude = $user['email'];
    26  
    27   // get subscribers emails
     46  if (!empty($_POST['stc_mail']))
     47  {
     48    $exclude = pwg_db_real_escape_string($_POST['stc_mail']);
     49  }
     50  else if (!is_a_guest())
     51  {
     52    $exclude = $user['email'];
     53  }
     54 
     55  // get subscribers datas
    2856  $query = '
    29 SELECT
    30     email
     57SELECT
     58    id,
     59    email,
     60    language
    3161  FROM '.SUBSCRIBE_TO_TABLE.'
    32   WHERE
    33     '.$type.'_id = '.$comm[$type.'_id'].'
     62  WHERE (
     63      ('.implode(")\n      OR (", $where_clauses).')
     64    )
    3465    AND validated = true
    3566    AND email != "'.$exclude.'"
    3667';
    37   $emails = array_from_query($query, 'email');
     68  $subscriptions = hash_from_query($query, 'email');
    3869 
    3970  set_make_full_url();
    40   if ($type == 'image')
     71 
     72  // get element infos
     73  if ($element_type == 'image')
    4174  {
    4275    $element = get_picture_infos($comm['image_id']);
    4376  }
    44   else if ($type == 'category')
     77  else
    4578  {
    4679    $element = get_category_infos($comm['category_id']);
    4780  }
    4881 
    49   // get author name
    50   if ($comm['author'] == 'guest')
    51   {
    52     $comm['author'] = l10n('guest');
    53   }
     82  // format comment
     83  if ($comm['author'] == 'guest') $comm['author'] = l10n('guest');
     84  $comm['author'] = trigger_event('render_comment_author', $comm['author']);
     85  $comm['content'] = trigger_event('render_comment_content', $comm['content']);
    5486 
    5587  // mail content
    56   $mail_args = array(
    57     'subject' => '['.strip_tags($conf['gallery_title']).'] Re:'.$element['name'],
    58     'content_format' => 'text/html',
    59     );
    60    
    61   $generic_content = '
    62 <a href="'.$element['url'].'"><img src="'.$element['thumbnail'].'" alt="'.$element['name'].'"></a>
    63 <br>
    64 <b>.'.trigger_event('render_comment_author', $comm['author']).'</b> wrote :
    65 
    66 <blockquote>'.trigger_event('render_comment_content', $comm['content']).'</blockquote>
    67 
    68 <a href="'.$element['url'].'#comment-'.$comm['id'].'">Link to comment</a>
    69 <br><br>
    70 ================================
    71 <br><br>';
    72 
    73   foreach ($emails as $email)
    74   {
    75     $mail_args['content'] = $generic_content.'
    76 <a href="'.make_stc_url('unsubscribe-'.$type, $email, $element['id']).'">Stop receiving notifications</a><br>
    77 <a href="'.make_stc_url('manage', $email).'">Manage my subscribtions</a>';
    78     pwg_mail($email, $mail_args);
    79   }
    80  
     88  $subject = '['.strip_tags($conf['gallery_title']).'] Re:'.$element['name'];
     89   
     90  $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/notification.tpl');
     91
     92  foreach ($subscriptions as $row)
     93  {
     94    // get subscriber id
     95    if ( ($uid = get_userid_by_email($row['email'])) !== false )
     96    {
     97      $row['user_id'] = $uid;
     98    }
     99    else
     100    {
     101      $row['user_id'] = $conf['guest_id'];
     102    }
     103   
     104    // check permissions
     105    if (!user_can_view_element($row['user_id'], $element_id, $element_type))
     106    {
     107      continue;
     108    }
     109   
     110    // send mail
     111    switch_lang_to($row['language']);
     112    load_language('plugin.lang', SUBSCRIBE_TO_PATH);
     113   
     114    $comm['caption'] = sprintf('<b>%s</b> wrote on <i>%s</i>', $comm['author'], format_date(date('Y-d-m H:i:s')));
     115   
     116    $template->assign('STC', array(
     117      'element' => $element,
     118      'comment' => $comm,
     119      'UNSUB_URL' => make_stc_url('unsubscribe', $row['email'], $row['id']),
     120      'MANAGE_URL' => make_stc_url('manage', $row['email']),
     121      'GALLERY_TITLE' => $conf['gallery_title'],
     122      ));
     123   
     124    $content = $template->parse('stc_mail', true);
     125
     126    stc_send_mail($row['email'], $content, $subject);
     127    switch_lang_back();
     128  }
     129 
     130  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
    81131  unset_make_full_url();
    82132}
     
    85135/**
    86136 * add an email to subscribers list
    87  * @param int (image|category)_id
    88  * @param string email
    89  * @param string type (image|category)
    90  */
    91 function subscribe_to_comments($element_id, $email, $type='image')
    92 {
     137 * @param: string email
     138 * @param: string type (image|album-images|all-images|album|all-albums)
     139 * @param: int element_id
     140 * @return: bool
     141 */
     142function subscribe_to_comments($email, $type, $element_id='NULL')
     143{
     144  if (empty($type))
     145  {
     146    trigger_error('subscribe_to_comment: missing type', E_USER_WARNING);
     147    return false;
     148  }
     149 
     150  if ( !in_array($type, array('all-images','all-albums')) and $element_id == 'NULL' )
     151  {
     152    trigger_error('subscribe_to_comment: missing element_id', E_USER_WARNING);
     153    return false;
     154  }
     155 
    93156  global $page, $conf, $user, $template, $picture;
    94  
    95   if ( empty($element_id) or empty($type) )
    96   {
    97     trigger_error('subscribe_to_comment: missing element_id and/or type', E_USER_WARNING);
    98     return false;
    99   }
    100157 
    101158  // check email
    102159  if ( ( is_a_guest() or empty($user['email']) ) and empty($email) )
    103160  {
    104     return false;
    105   }
    106   else if (!is_a_guest())
     161    array_push($page['errors'], l10n('Invalid email adress, your are not subscribed to comments.'));
     162    return false;
     163  }
     164  else if ( !is_a_guest() and empty($email) )
    107165  {
    108166    $email = $user['email'];
    109167  }
    110168 
    111   // don't care if already registered
     169  // search if already registered (can use ODKU because we want to get the id of inserted OR updated row)
    112170  $query = '
     171SELECT id
     172  FROM '.SUBSCRIBE_TO_TABLE.'
     173  WHERE
     174    type = "'.$type.'"
     175    AND element_id = '.$element_id.'
     176    AND email = "'.pwg_db_real_escape_string($email).'"
     177;';
     178  $result = pwg_query($query);
     179 
     180  if (pwg_db_num_rows($result))
     181  {
     182    list($inserted_id) = pwg_db_fetch_row($result);
     183  }
     184  else
     185  {
     186    $query = '
    113187INSERT INTO '.SUBSCRIBE_TO_TABLE.'(
     188    type,
     189    element_id,
     190    language,
    114191    email,
    115     '.$type.'_id,
    116192    registration_date,
    117193    validated
    118194  )
    119195  VALUES(
     196    "'.$type.'",
     197    '.$element_id.',
     198    "'.$user['language'].'",
    120199    "'.pwg_db_real_escape_string($email).'",
    121     '.$element_id.',
    122200    NOW(),
    123201    "'.(is_a_guest() ? "false" : "true").'"
    124202  )
    125   ON DUPLICATE KEY UPDATE
    126     registration_date = IF(validated="true", registration_date, NOW()),
    127     validated = IF(validated="true", validated, "'.(is_a_guest() ? "false" : "true").'")
    128203;';
    129   pwg_query($query);
     204    pwg_query($query);
     205   
     206    $inserted_id = pwg_db_insert_id();
     207  }
     208 
     209  // notify admins
     210  if ( pwg_db_changes(null) != 0 and $conf['Subscribe_to_Comments']['notify_admin_on_subscribe'] )
     211  {
     212    stc_mail_notification_admins($email, $type, $element_id, $inserted_id);
     213  }
    130214 
    131215  // send validation mail
    132216  if ( is_a_guest() and pwg_db_changes(null) != 0 )
    133217  {
    134     $element_name = ($type == 'image') ? $picture['current']['name'] : $page['category']['name'];
    135    
    136     $mail_args = array(
    137       'subject' => '['.strip_tags($conf['gallery_title']).'] Please confirm your subscribtion to comments',
    138       'content_format' => 'text/html',
    139       );
     218    set_make_full_url();
     219   
     220    $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/confirm.tpl');
     221   
     222    $subject = '['.strip_tags($conf['gallery_title']).'] '.l10n('Confirm your subscribtion to comments');
    140223     
    141     $mail_args['content'] = '
    142 You requested to subscribe by email to comments on <b>'.$element_name.'</b>.<br>
    143 <br>
    144 We care about your inbox, so we want to confirm this request. Please click the confirm link to activate the subscription.<br>
    145 <br>
    146 <a href="'.make_stc_url('validate-'.$type, $email, $element_id).'">Confirm subscription</a><br>
    147 <br>
    148 If you did not request this action please disregard this message.
    149 ';
    150 
    151     pwg_mail($email, $mail_args);
    152     return 'confirm_mail';
     224    switch ($type)
     225    {
     226      case 'image':
     227        $element = get_picture_infos($element_id);
     228        $element['on'] = sprintf(l10n('the picture <a href="%s">%s</a>'), $element['url'], $element['name']);
     229        break;
     230      case 'album-images':
     231        $element = get_category_infos($element_id);
     232        $element['on'] = sprintf(l10n('all pictures of the album <a href="%s">%s</a>'), $element['url'], $element['name']);
     233        break;
     234      case 'all-images':
     235        $element['thumbnail'] = null;
     236        $element['on'] = l10n('all pictures of the gallery');
     237        break;
     238      case 'album':
     239        $element = get_category_infos($element_id);
     240        $element['on'] = sprintf(l10n('the album <a href="%s">%s</a>'), $element['url'], $element['name']);
     241        break;
     242      case 'all-albums':
     243        $element['thumbnail'] = null;
     244        $element['on'] = l10n('all albums of the gallery');
     245        break;
     246    }
     247   
     248    $template->assign('STC', array(
     249      'element' => $element,
     250      'VALIDATE_URL' => make_stc_url('validate', $email, $inserted_id),
     251      'MANAGE_URL' => make_stc_url('manage', $email),
     252      'GALLERY_TITLE' => $conf['gallery_title'],
     253      ));
     254   
     255    $content = $template->parse('stc_mail', true);
     256
     257    stc_send_mail($email, $content, $subject);
     258    unset_make_full_url();
     259   
     260    array_push($page['infos'], l10n('Please check your email inbox to confirm your subscription.'));
     261    return true;
    153262  }
    154263  // just display confirmation message
    155264  else if (pwg_db_changes(null) != 0)
    156265  {
     266    array_push($page['infos'], l10n('You have been added to the list of subscribers.'));
    157267    return true;
    158268  }
     269 
     270  return false;
    159271}
    160272
     
    162274/**
    163275 * remove an email from subscribers list
    164  * @param int (image|category)_id
    165  * @param string email
    166  * @param string type (image|category)
    167  */
    168 function un_subscribe_to_comments($element_id, $email, $type='image')
    169 {
     276 * @param: string email
     277 * @param: int subscription id
     278 * @return: bool
     279 */
     280function un_subscribe_to_comments($email, $id)
     281
     282  if (empty($id))
     283  {
     284    trigger_error('un_subscribe_to_comment: missing id', E_USER_WARNING);
     285    return false;
     286  }
     287 
    170288  global $template, $user;
    171  
    172   if ( empty($element_id) or empty($type) )
    173   {
    174     trigger_error('un_subscribe_to_comment: missing element_id and/or type', E_USER_WARNING);
    175     return false;
    176   }
    177289 
    178290  // check email
     
    181293    return false;
    182294  }
    183   else if (!is_a_guest())
     295  else if ( !is_a_guest() and empty($email) )
    184296  {
    185297    $email = $user['email'];
     
    187299 
    188300  // delete subscription
    189   switch ($type)
    190   {
    191     case 'image' :
    192     case 'category' :
    193       $where_clause = $type.'_id = '.pwg_db_real_escape_string($element_id);
    194     case 'all' :
    195     {
    196       $query = '
     301  $query = '
    197302DELETE FROM '.SUBSCRIBE_TO_TABLE.'
    198303  WHERE
    199304    email = "'.pwg_db_real_escape_string($email).'"
    200     '.(!empty($where_clause) ? 'AND '.$where_clause : null).'
     305    AND id = "'.pwg_db_real_escape_string($id).'"
    201306;';
    202       pwg_query($query);
     307  pwg_query($query);
    203308     
    204       return true;
    205       break;
    206     }
    207   }
    208  
     309  if (pwg_db_changes(null) != 0) return true;
    209310  return false;
    210311}
     
    213314/**
    214315 * validate a subscription
    215  * @param int (image|category)_id
    216  * @param string email
    217  * @param string type (image|category)
    218  */
    219 function validate_subscriptions($element_id, $email, $type='image')
    220 {
    221   if ( empty($element_id) or empty($email) or empty($type) )
    222   {
    223     trigger_error('validate_subscriptions: missing element_id and/or email and/or type', E_USER_WARNING);
    224     return false;
    225   }
    226  
    227   switch ($type)
    228   {
    229     case 'image' :
    230     case 'category':
    231       $where_clause = $type.'_id = '.pwg_db_real_escape_string($element_id);
    232     case 'all' :
    233     {
    234        $query = '
     316 * @param: string email
     317 * @param: int subscription id
     318 * @return: bool
     319 */
     320function validate_subscriptions($email, $id)
     321{
     322  if (empty($email))
     323  {
     324    trigger_error('validate_subscriptions: missing email', E_USER_WARNING);
     325    return false;
     326  }
     327 
     328  if (empty($id))
     329  {
     330    trigger_error('validate_subscriptions: missing id', E_USER_WARNING);
     331    return false;
     332  }
     333 
     334  $query = '
    235335UPDATE '.SUBSCRIBE_TO_TABLE.'
    236336  SET validated = "true"
    237337  WHERE
    238338    email = "'.pwg_db_real_escape_string($email).'"
    239     '.(!empty($where_clause) ? 'AND '.$where_clause : null).'
     339    AND id = '.pwg_db_real_escape_string($id).'
    240340;';
    241       pwg_query($query);
     341  pwg_query($query);
    242342     
    243       if (pwg_db_changes(null) != 0) return true;
     343  if (pwg_db_changes(null) != 0) return true;
     344  return false;
     345}
     346
     347
     348/**
     349 * send notification to admins
     350 * @param: string email
     351 * @param: string type (image|album-images|all-images|album|all-albums)
     352 * @param: int element_id
     353 * @param: int subscription id
     354 */
     355function stc_mail_notification_admins($email, $type, $element_id, $inserted_id)
     356{
     357  global $user, $conf, $template;
     358 
     359  $admins = get_admins_email();
     360  if (empty($admins)) return;
     361 
     362  set_make_full_url();
     363  switch_lang_to(get_default_language());
     364  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
     365 
     366  $template->set_filename('stc_mail', dirname(__FILE__).'/../template/mail/admin.tpl');
     367   
     368  $subject = '['.strip_tags($conf['gallery_title']).'] '.sprintf(l10n('%s has subscribed to comments on'), is_a_guest()?$email:$user['username']);
     369   
     370  switch ($type)
     371  {
     372    case 'image':
     373      $element = get_picture_infos($element_id, false);
     374      $element['on'] = sprintf(l10n('the picture <a href="%s">%s</a>'), $element['url'], $element['name']);
    244375      break;
    245     }
    246   }
    247  
    248   return false;
     376    case 'album-images':
     377      $element = get_category_infos($element_id, false);
     378      $element['on'] = sprintf(l10n('all pictures of the album <a href="%s">%s</a>'), $element['url'], $element['name']);
     379      break;
     380    case 'all-images':
     381      $element['on'] = l10n('all pictures of the gallery');
     382      break;
     383    case 'album':
     384      $element = get_category_infos($element_id, false);
     385      $element['on'] = sprintf(l10n('the album <a href="%s">%s</a>'), $element['url'], $element['name']);
     386      break;
     387    case 'all-albums':
     388      $element['on'] = l10n('all albums of the gallery');
     389      break;
     390  }
     391 
     392  $technical_infos[] = sprintf(l10n('Connected user: %s'), stripslashes($user['username']));
     393  $technical_infos[] = sprintf(l10n('IP: %s'), $_SERVER['REMOTE_ADDR']);
     394  $technical_infos[] = sprintf(l10n('Browser: %s'), $_SERVER['HTTP_USER_AGENT']);
     395 
     396  $template->assign('STC', array(
     397    'ELEMENT' => $element['on'],
     398    'USER' => sprintf(l10n('%s has subscribed to comments on'), is_a_guest() ? '<b>'.$email.'</b>' : '<b>'.$user['username'].'</b> ('.$email.')'),
     399    'GALLERY_TITLE' => $conf['gallery_title'],
     400    'TECHNICAL' => implode('<br>', $technical_infos),
     401    ));
     402 
     403  $content = $template->parse('stc_mail', true);
     404
     405  stc_send_mail($admins, $content, $subject);
     406 
     407  unset_make_full_url();
     408  switch_lang_back();
     409  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
    249410}
    250411
     
    252413/**
    253414 * create absolute url to subscriptions section
    254  * @param string action
    255  * @param string email
    256  * @return string
    257  */
    258 function make_stc_url($action, $email)
     415 * @param: string action
     416 * @param: string email
     417 * @param: int optional
     418 * @return: string
     419 */
     420function make_stc_url($action, $email, $id=null)
    259421{
    260422  if ( empty($action) or empty($email) )
     
    272434    );
    273435 
    274   if (func_num_args() > 2)
    275   {
    276     $url_params['id'] = func_get_arg(2);
     436  if (!empty($id))
     437  {
     438    $url_params['id'] = $id;
    277439  }
    278440 
     
    293455
    294456/**
    295  * get name and url of a picture
    296  * @param int image_id
    297  * @return array
    298  */
    299 function get_picture_infos($image_id, $absolute=false)
    300 {
    301   global $page;
    302  
     457 * send mail with STC style
     458 * @param: string to
     459 * @param: string content
     460 * @param: string subject
     461 * @return: bool
     462 */
     463function stc_send_mail($to, $content, $subject)
     464{
     465  global $conf, $conf_mail, $page, $template;
     466 
     467  // inputs
     468  if (empty($to))
     469  {
     470    return false;
     471  }
     472
     473  if (empty($content))
     474  {
     475    return false;
     476  }
     477 
     478  if (empty($subject))
     479  {
     480    $subject = 'Piwigo';
     481  }
     482  else
     483  {
     484    $subject = trim(preg_replace('#[\n\r]+#s', '', $subject));
     485    $subject = encode_mime_header($subject);
     486  }
     487 
     488  if (!isset($conf_mail))
     489  {
     490    $conf_mail = get_mail_configuration();
     491  }
     492
     493  $args['from'] = $conf_mail['formated_email_webmaster'];
     494 
     495  set_make_full_url();
     496 
     497  // hearders
     498  $headers = 'From: '.$args['from']."\n"; 
     499  $headers.= 'Content-Type: text/html; charset="'.get_pwg_charset().'";'."\n";
     500  $headers.= 'Content-Transfer-Encoding: 8bit'."\n";
     501  $headers.= 'MIME-Version: 1.0'."\n";
     502  $headers.= 'X-Mailer: Piwigo Mailer'."\n";
     503 
     504  // template
     505  $template->set_filenames(array(
     506    'stc_mail_header' => dirname(__FILE__).'/../template/mail/header.tpl',
     507    'stc_mail_footer' => dirname(__FILE__).'/../template/mail/footer.tpl',
     508    ));
     509  $stc_mail_css = file_get_contents(dirname(__FILE__).'/../template/mail/style.css');
     510   
     511  $template->assign(array(
     512    'GALLERY_URL' => get_gallery_home_url(),
     513    'PHPWG_URL' => PHPWG_URL,
     514    'STC_MAIL_CSS' => str_replace("\n", null, $stc_mail_css),
     515    ));
     516 
     517  $content = $template->parse('stc_mail_header', true) . $content . $template->parse('stc_mail_footer', true);
     518  $content = wordwrap($content, 70, "\n", true);
     519
     520  unset_make_full_url();
     521 
     522  // send mail
     523  return
     524    trigger_event('send_mail',
     525      false, /* Result */
     526      trigger_event('send_mail_to', get_strict_email_list($to)),
     527      trigger_event('send_mail_subject', $subject),
     528      trigger_event('send_mail_content', $content),
     529      trigger_event('send_mail_headers', $headers),
     530      $args
     531    );
     532}
     533
     534
     535/**
     536 * get name, url and thumbnail of a picture
     537 * @param: int image_id
     538 * @param: bool return thumbnail
     539 * @return: array (id, name, url, thumbnail)
     540 */
     541function get_picture_infos($image_id, $with_thumb=true)
     542{
    303543  $query = '
    304544SELECT
    305545    id,
     546    file,
    306547    name,
    307     file,
    308     path,
    309     tn_ext
     548    path
    310549  FROM '.IMAGES_TABLE.'
    311550  WHERE id = '.$image_id.'
     
    319558 
    320559  $url_params = array('image_id' => $element['id']);
    321   if ( !empty($page['category']) and !$absolute )
    322   {
    323     $url_params['section'] = 'categories';
    324     $url_params['category'] = $page['category'];
    325   }
    326560  $element['url'] = make_picture_url($url_params);
    327561 
    328   $element['thumbnail'] = get_thumbnail_url($element);
     562  if ($with_thumb)
     563  {
     564    $element['thumbnail'] = DerivativeImage::thumb_url($element);
     565  }
    329566 
    330567  return $element;
     
    332569
    333570/**
    334  * get name and url of a category
    335  * @param int cat_id
    336  * @return array
    337  */
    338 function get_category_infos($cat_id)
     571 * get name, url and thumbnail of a category
     572 * @param: int cat_id
     573 * @param: int return thumbnail
     574 * @return: array (id, name, url, thumbnail)
     575 */
     576function get_category_infos($cat_id, $with_thumb=true)
    339577{
    340578  global $conf;
     
    346584    cat.permalink,
    347585    img.id AS image_id,
    348     img.path,
    349     img.tn_ext
     586    img.path
    350587  FROM '.CATEGORIES_TABLE.' AS cat
    351588    LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc
     
    356593;';
    357594  $element = pwg_db_fetch_assoc(pwg_query($query));
    358   // we use guest_id for user_cache beacause we don't know the status of recipient
    359  
    360   $url_params['section'] = 'categories';
    361   $url_params['category'] = $element;
    362   $element['url'] = make_index_url($url_params);
    363  
    364   $element['thumbnail'] = get_thumbnail_url(array(
    365     'id' => $element['image_id'],
    366     'path' => $element['path'],
    367     'tn_ext' => $element['tn_ext'],
     595  // we use guest_id for user_cache because we don't know the status of recipient
     596 
     597  $element['url'] = make_index_url(array(
     598    'section'=>'categories',
     599    'category'=>$element,
    368600    ));
    369601 
     602  if ($with_thumb)
     603  {
     604    $element['thumbnail'] = DerivativeImage::thumb_url(array(
     605      'id'=>$element['image_id'],
     606      'path'=>$element['path'],
     607      ));
     608  }
     609 
    370610  return $element;
     611}
     612
     613/**
     614 * get list of admins email
     615 * @return: string
     616 */
     617function get_admins_email()
     618{
     619  global $conf, $user;
     620 
     621  $admins = array();
     622 
     623  $query = '
     624SELECT
     625    u.'.$conf['user_fields']['username'].' AS username,
     626    u.'.$conf['user_fields']['email'].' AS email
     627  FROM '.USERS_TABLE.' AS u
     628    JOIN '.USER_INFOS_TABLE.' AS i
     629      ON i.user_id =  u.'.$conf['user_fields']['id'].'
     630  WHERE i.status IN ("webmaster", "admin")
     631    AND '.$conf['user_fields']['email'].' IS NOT NULL
     632    AND i.user_id != '.$user['id'].'
     633  ORDER BY username
     634;';
     635
     636  $datas = pwg_query($query);
     637  if (!empty($datas))
     638  {
     639    while ($admin = pwg_db_fetch_assoc($datas))
     640    {
     641      array_push($admins, format_email($admin['username'], $admin['email']));
     642    }
     643  }
     644
     645  return implode(',', $admins);
     646}
     647
     648
     649/**
     650 * check if the given user can view the category/image
     651 * @param: int user_id
     652 * @param: int element_id
     653 * @param: string type (image|category)
     654 * @return: bool
     655 */
     656function user_can_view_element($user_id, $element_id, $type)
     657{
     658  global $conf;
     659 
     660  $old_conf = $conf['external_authentification'];
     661  $conf['external_authentification'] = false;
     662  $user = getuserdata($user_id, true);
     663  $conf['external_authentification'] = $old_conf;
     664 
     665  if ($type == 'image')
     666  {
     667    return !in_array($element_id, explode(',', $user['image_access_list']));
     668  }
     669  else if ($type == 'category')
     670  {
     671    return !in_array($element_id, explode(',', $user['forbidden_categories']));
     672  }
     673  else
     674  {
     675    return false;
     676  }
    371677}
    372678
     
    375681 * crypt a string using mcrypt extension or
    376682 * http://stackoverflow.com/questions/800922/how-to-encrypt-string-without-mcrypt-library-in-php/802957#802957
    377  * @param string value to crypt
    378  * @param string key
    379  * @return string
     683 * @param: string value to crypt
     684 * @param: string key
     685 * @return: string
    380686 */
    381687function crypt_value($value, $key)
     
    405711/**
    406712 * decrypt a string crypted with previous function
    407  * @param string value to decrypt
    408  * @param string key
    409  * @return string
     713 * @param: string value to decrypt
     714 * @param: string key
     715 * @return: string
    410716 */
    411717function decrypt_value($value, $key)
     
    436742/**
    437743 * variant of base64 functions usable into url
    438  * http://fr.php.net/manual/fr/function.base64-encode.php#103849
     744 * http://php.net/manual/en/function.base64-encode.php#103849
    439745 */
    440746function base64url_encode($data)
  • extensions/Subscribe_to_comments/include/index.php

    r12560 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php

    r12709 r15641  
    33
    44/**
    5  * detect 'subscriptions' section and load page
     5 * detect 'subscriptions' section and load the page
    66 */
    77function stc_detect_section()
     
    1212  {
    1313    $page['section'] = 'subscriptions';
     14    $page['title'] = l10n('Comments notifications');
    1415  }
    1516}
     
    2728
    2829/**
    29  * send notifications and/or add subscriber
     30 * send notifications and/or add subscriber on comment insertion
     31 * @param: array comment
    3032 */
    3133function stc_comment_insertion($comm)
     
    3335  global $page, $template;
    3436 
    35   $infos = $errors = array();
    36  
    3737  if ($comm['action'] == 'validate')
    3838  {
     
    4040  }
    4141 
    42   if ( !empty($_POST['stc_check']) and ( $comm['action'] == 'validate' or $comm['action'] == 'moderate' ) )
    43   {
    44     if (isset($comm['image_id']))
    45     {
    46       $return = subscribe_to_comments($comm['image_id'], @$_POST['stc_mail'], 'image');
    47     }
    48     else if (isset($comm['category_id']))
    49     {
    50       $return = subscribe_to_comments($comm['category_id'], @$_POST['stc_mail'], 'category');
    51      
    52     }
    53    
    54     if (isset($return))
    55     {
    56       if ($return === 'confirm_mail')
    57       {
    58         array_push($infos, l10n('Please check your email inbox to confirm your subscription.'));
    59       }
    60       else if ($return === true)
    61       {
    62         array_push($infos, l10n('You have been added to the list of subscribers for this '.(isset($comm['image_id'])?'picture':'album').'.'));
    63       }
    64       else
    65       {
    66         array_push($errors, l10n('Invalid email adress, your are not subscribed to comments.'));
    67       }
    68      
    69       // messages management
    70       stc_add_messages($errors, $infos, true);
    71     }
    72   }
    73 }
    74 
     42  if ( !empty($_POST['stc_mode']) and $_POST['stc_mode'] != -1 )
     43  {
     44    if ($comm['action'] != 'reject')
     45    {
     46      if (isset($comm['image_id']))
     47      {
     48        switch ($_POST['stc_mode'])
     49        {
     50          case 'all-images':
     51            subscribe_to_comments(@$_POST['stc_mail'], 'all-images');
     52            break;
     53          case 'album-images':
     54            if (empty($page['category']['id'])) break;
     55            subscribe_to_comments(@$_POST['stc_mail'], 'album-images', $page['category']['id']);
     56            break;
     57          case 'image':
     58            subscribe_to_comments(@$_POST['stc_mail'], 'image', $comm['image_id']);
     59            break;
     60        }
     61      }
     62      else if (isset($comm['category_id']))
     63      {
     64        switch ($_POST['stc_mode'])
     65        {
     66          case 'all-albums':
     67            subscribe_to_comments(@$_POST['stc_mail'], 'all-albums');
     68            break;
     69          case 'album':
     70            subscribe_to_comments(@$_POST['stc_mail'], 'album', $comm['category_id']);
     71            break;
     72        }
     73      }
     74    }
     75    else
     76    {
     77      $template->assign('STC_MODE', $_POST['stc_mode']);
     78      $template->assign('STC_MAIL', @$_POST['stc_mail']);
     79    }
     80  }
     81}
     82
     83
     84/**
     85 * send notifications on comment validation
     86 * @param: array|int comment_id
     87 * @param: string type (image|category)
     88 */
    7589function stc_comment_validation($comm_ids, $type='image')
    7690{
    7791  if (!is_array($comm_ids)) $comm_ids = array($comm_ids);
    7892 
    79   foreach($comm_ids as $comm_id)
    80   {
    81     if ($type == 'image')
    82     {
    83       $query = '
     93  if ($type == 'image')
     94  {
     95    $query = '
    8496SELECT
    8597    id,
     
    88100    content
    89101  FROM '.COMMENTS_TABLE.'
    90   WHERE id = '.$comm_id.'
    91 ;';
    92     }
    93     else if ($type == 'category')
    94     {
    95       $query = '
     102  WHERE id IN('.implode(',', $comm_ids).')
     103;';
     104  }
     105  else if ($type == 'category')
     106  {
     107    $query = '
    96108SELECT
    97109    id,
     
    100112    content
    101113  FROM '.COA_TABLE.'
    102   WHERE id = '.$comm_id.'
    103 ;';
    104     }
    105    
    106     $comm = pwg_db_fetch_assoc(pwg_query($query));
     114  WHERE id IN('.implode(',', $comm_ids).')
     115;';
     116  }
     117 
     118  $comms = hash_from_query($query, 'id');
     119  foreach ($comms as $comm)
     120  {
    107121    send_comment_to_subscribers($comm);
    108122  }
     
    115129function stc_on_picture()
    116130{
    117   global $template, $picture, $page, $user;
    118  
    119   $infos = $errors = array();
    120  
     131  global $template, $picture, $page, $user, $conf;
     132 
     133  // standalone subscription
    121134  if (isset($_POST['stc_submit']))
    122135  {
    123     $return = subscribe_to_comments($picture['current']['id'], @$_POST['stc_mail_stdl'], 'image');
    124     if ($return === 'confirm_mail')
    125     {
    126       array_push($infos, l10n('Please check your email inbox to confirm your subscription.'));
    127     }
    128     else if ($return === true)
    129     {
    130       array_push($infos, l10n('You have been added to the list of subscribers for this picture.'));
    131     }
    132     else
    133     {
    134       array_push($errors, l10n('Invalid email adress, your are not subscribed to comments.'));
     136    switch ($_POST['stc_mode'])
     137    {
     138      case 'all-images':
     139        subscribe_to_comments(@$_POST['stc_mail'], 'all-images');
     140        break;
     141      case 'album-images':
     142        if (empty($page['category']['id'])) break;
     143        subscribe_to_comments(@$_POST['stc_mail'], 'album-images', $page['category']['id']);
     144        break;
     145      case 'image':
     146        subscribe_to_comments(@$_POST['stc_mail'], 'image', $picture['current']['id']);
     147        break;
    135148    }
    136149  }
    137150  else if (isset($_GET['stc_unsubscribe']))
    138   {
    139     if (un_subscribe_to_comments($picture['current']['id'], null, 'image'))
    140     {
    141       array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
    142     }
    143   }
    144  
    145   // messages management
    146   stc_add_messages($errors, $infos);
     151  {   
     152    if (un_subscribe_to_comments(null, $_GET['stc_unsubscribe']))
     153    {
     154      array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
     155    }
     156  }
    147157 
    148158  // if registered user with mail we check if already subscribed
    149159  if ( !is_a_guest() and !empty($user['email']) )
    150160  {
    151     $query = '
    152 SELECT id
    153   FROM '.SUBSCRIBE_TO_TABLE.'
    154   WHERE
    155     email = "'.$user['email'].'"
    156     AND image_id = '.$picture['current']['id'].'
    157     AND validated = "true"
    158 ;';
    159     if (pwg_db_num_rows(pwg_query($query)))
    160     {
    161       $template->assign(array(
    162         'SUBSCRIBED' => true,
    163         'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>'1')),
    164         ));
     161    $subscribed = false;
     162   
     163    // registered to all pictures
     164    if (!$subscribed)
     165    {
     166      $query = '
     167SELECT id
     168  FROM '.SUBSCRIBE_TO_TABLE.'
     169  WHERE
     170    email = "'.$user['email'].'"
     171    AND type = "all-images"
     172    AND validated = "true"
     173;';
     174      $result = pwg_query($query);
     175     
     176      if (pwg_db_num_rows($result))
     177      {
     178        $template->assign(array(
     179          'SUBSCRIBED_ALL_IMAGES' => true,
     180          'MANAGE_LINK' => make_stc_url('manage', $user['email']),
     181          ));
     182        $subscribed = true;
     183      }
     184    }
     185
     186    // registered to pictures in this album
     187    if ( !$subscribed and !empty($page['category']['id']) )
     188    {
     189      $query = '
     190SELECT id
     191  FROM '.SUBSCRIBE_TO_TABLE.'
     192  WHERE
     193    email = "'.$user['email'].'"
     194    AND element_id = '.$page['category']['id'].'
     195    AND type = "album-images"
     196    AND validated = "true"
     197;';
     198      $result = pwg_query($query);
     199     
     200      if (pwg_db_num_rows($result))
     201      {
     202        list($stc_id) = pwg_db_fetch_row($result);
     203        $template->assign(array(
     204          'SUBSCRIBED_ALBUM_IMAGES' => true,
     205          'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)),
     206          ));
     207        $subscribed = true;
     208      }
     209    }
     210   
     211    // registered to this picture
     212    if (!$subscribed)
     213    {
     214      $query = '
     215SELECT id
     216  FROM '.SUBSCRIBE_TO_TABLE.'
     217  WHERE
     218    email = "'.$user['email'].'"
     219    AND element_id = '.$picture['current']['id'].'
     220    AND type = "image"
     221    AND validated = "true"
     222;';
     223      $result = pwg_query($query);
     224     
     225      if (pwg_db_num_rows($result))
     226      {
     227        list($stc_id) = pwg_db_fetch_row($result);
     228        $template->assign(array(
     229          'SUBSCRIBED_IMAGE' => true,
     230          'UNSUB_LINK' => add_url_params($picture['current']['url'], array('stc_unsubscribe'=>$stc_id)),
     231          ));
     232        $subscribed = true;
     233      }
    165234    }
    166235  }
    167236  else
    168237  {
    169     $template->assign('ASK_MAIL', true);
    170   }
    171  
    172   if ( $is_simple = strstr($user['theme'], 'simple') !== false or strstr($user['theme'], 'stripped') !== false )
    173     $template->set_prefilter('picture', 'stc_simple_prefilter');
    174   else
    175     $template->set_prefilter('picture', 'stc_main_prefilter');
    176 }
    177 
    178 /**
    179  * add field and on album page
     238    $template->assign('STC_ASK_MAIL', true);
     239  }
     240 
     241  $template->assign('STC_ON_PICTURE', true);
     242  if ( !empty($page['category']['id']) ) $template->assign('STC_ALLOW_ALBUM_IMAGES', true);
     243  if ( $conf['Subscribe_to_Comments']['allow_global_subscriptions'] or is_admin() ) $template->assign('STC_ALLOW_GLOBAL', true);
     244 
     245  $template->set_prefilter('picture', 'stc_main_prefilter');
     246}
     247
     248
     249/**
     250 * add field and link on album page
    180251 */
    181252function stc_on_album()
    182253{
    183   global $page, $template, $pwg_loaded_plugins, $user;
    184  
    185   $infos = $errors = array();
     254  global $page, $template, $pwg_loaded_plugins, $user, $conf;
    186255 
    187256  if (
     
    196265  if (isset($_POST['stc_submit']))
    197266  {
    198     $return = subscribe_to_comments($page['category']['id'], @$_POST['stc_mail_stdl'], 'category');
    199     if ($return === 'confirm_mail')
    200     {
    201       array_push($infos, l10n('Please check your email inbox to confirm your subscription.'));
    202     }
    203     else if ($return === true)
    204     {
    205       array_push($infos, l10n('You have been added to the list of subscribers for this album.'));
    206     }
    207     else
    208     {
    209       array_push($errors, l10n('Invalid email adress, your are not subscribed to comments.'));
     267    switch ($_POST['stc_mode'])
     268    {
     269      case 'all-albums':
     270        subscribe_to_comments(@$_POST['stc_mail'], 'all-albums');
     271        break;
     272      case 'album':
     273        subscribe_to_comments(@$_POST['stc_mail'], 'album', $page['category']['id']);
     274        break;
    210275    }
    211276  }
    212277  else if (isset($_GET['stc_unsubscribe']))
    213278  {
    214     if (un_subscribe_to_comments($page['category']['id'], null, 'category'))
    215     {
    216       array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
    217     }
    218   }
    219  
    220   // messages management
    221   stc_add_messages($errors, $infos, true);
     279    if (un_subscribe_to_comments(null, $_GET['stc_unsubscribe']))
     280    {
     281      array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
     282    }
     283  }
    222284 
    223285  // if registered user we check if already subscribed
    224286  if ( !is_a_guest() and !empty($user['email']) )
    225287  {
    226     $query = '
    227 SELECT id
    228   FROM '.SUBSCRIBE_TO_TABLE.'
    229   WHERE
    230     email = "'.$user['email'].'"
    231     AND category_id = '.$page['category']['id'].'
    232     AND validated = "true"
    233 ;';
    234     if (pwg_db_num_rows(pwg_query($query)))
    235     {
    236       $url_params['section'] = 'categories';
    237       $url_params['category'] = $page['category'];
    238       $element_url = make_index_url($url_params);
    239      
    240       $template->assign(array(
    241         'SUBSCRIBED' => true,
    242         'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>'1')),
    243         ));
     288    $subscribed = false;
     289   
     290    // registered to all albums
     291    if (!$subscribed)
     292    {
     293      $query = '
     294SELECT id
     295  FROM '.SUBSCRIBE_TO_TABLE.'
     296  WHERE
     297    email = "'.$user['email'].'"
     298    AND type = "all-albums"
     299    AND validated = "true"
     300;';
     301      $result = pwg_query($query);
     302     
     303      if (pwg_db_num_rows($result))
     304      {
     305        $template->assign(array(
     306          'SUBSCRIBED_ALL_ALBUMS' => true,
     307          'MANAGE_LINK' => make_stc_url('manage', $user['email']),
     308          ));
     309        $subscribed = true;
     310      }
     311    }
     312   
     313    // registered to this album
     314    if (!$subscribed)
     315    {
     316      $query = '
     317SELECT id
     318  FROM '.SUBSCRIBE_TO_TABLE.'
     319  WHERE
     320    email = "'.$user['email'].'"
     321    AND element_id = '.$page['category']['id'].'
     322    AND type = "album"
     323    AND validated = "true"
     324;';
     325      $result = pwg_query($query);
     326     
     327      if (pwg_db_num_rows($result))
     328      {
     329        list($stc_id) = pwg_db_fetch_row($result);
     330        $element_url = make_index_url(array(
     331          'section' => 'categories',
     332          'category' => $page['category'],
     333          ));
     334       
     335        $template->assign(array(
     336          'SUBSCRIBED_ALBUM' => true,
     337          'UNSUB_LINK' => add_url_params($element_url, array('stc_unsubscribe'=>$stc_id)),
     338          ));
     339        $subscribed = true;
     340      }
    244341    }
    245342  }
    246343  else
    247344  {
    248     $template->assign('ASK_MAIL', true);
    249   }
    250  
    251   if ( $is_simple = strstr($user['theme'], 'simple') !== false or strstr($user['theme'], 'stripped') !== false )
    252     $template->set_prefilter('comments_on_albums', 'stc_simple_prefilter');
    253   else
    254     $template->set_prefilter('comments_on_albums', 'stc_main_prefilter');
    255 }
    256 
    257 
    258 /**
    259  * prefilter for common themes
     345    $template->assign('STC_ASK_MAIL', true);
     346  }
     347 
     348  $template->assign('STC_ON_ALBUM', true);
     349  if ( $conf['Subscribe_to_Comments']['allow_global_subscriptions'] or is_admin() ) $template->assign('STC_ALLOW_GLOBAL', true);
     350
     351  $template->set_prefilter('comments_on_albums', 'stc_main_prefilter');
     352}
     353
     354
     355/**
     356 * main prefilter
    260357 */
    261358function stc_main_prefilter($content, &$smarty)
    262 { 
     359{
    263360  ## subscribe at any moment ##
    264   $search = '#\<\/div\>(.{0,10})\{\/if\}(.{0,10})\{\*comments\*\}#is';
    265  
    266   $replace = '
    267 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
    268   <fieldset>
    269   {if $SUBSCRIBED}
    270     {\'You are currently subscribed to comments of this picture.\'|@translate}
    271     <a href="{$UNSUB_LINK}">{\'Unsubscribe\'|@translate}
    272   {else}
    273     <legend>{\'Subscribe without commenting\'|@translate}</legend>
    274     {if $ASK_MAIL}
    275       <label>{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label>
    276       <label><input type="submit" name="stc_submit" value="{\'Submit\'|@translate}"></label>
    277     {else}
    278       <label><input type="submit" name="stc_submit" value="{\'Subscribe\'|@translate}"></label>
    279     {/if}
    280   {/if}
    281   </fieldset>
    282 </form>
    283 </div>$1{/if}$2{*comments*}';
    284 
    285   $content = preg_replace($search, $replace, $content);
     361  $search = '{if isset($comments)}';
     362  $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_standalone.tpl');
     363  $content = str_replace($search, $replace.$search, $content);
    286364 
    287365  ## subscribe while add a comment ##
    288   $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#';
    289  
    290   $replace = '
    291 <input type="hidden" name="key" value="{$comment_add.KEY}"$1>
    292 {if !$SUBSCRIBED}
    293   <label>{\'Notify me of followup comments\'|@translate} <input type="checkbox" name="stc_check" value="1"></label><br>
    294 
    295   {if $ASK_MAIL}
    296     <label id="stc_mail" style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail"></label><br>
    297     {footer_script require="jquery"}{literal}
    298     jQuery(document).ready(function() {
    299       $("input[name=stc_check]").change(function() {
    300         if ($(this).is(":checked")) $("#stc_mail").css("display", "");
    301         else $("#stc_mail").css("display", "none");
    302       });
    303     });
    304     {/literal}{/footer_script}
    305   {/if}
    306 {/if}';
    307  
    308   $content = preg_replace($search, $replace, $content);
     366  $search = '<p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p>';
     367  $replace = file_get_contents(SUBSCRIBE_TO_PATH.'template/form_comment.tpl');
     368  $content = str_replace($search, $search.$replace, $content);
    309369 
    310370  return $content;
    311371}
    312372
    313 /**
    314  * prefilter for simple/stripped themes
    315  */
    316 function stc_simple_prefilter($content, &$smarty)
    317 
    318   ## subscribe at any moment ##
    319   $search = '#\<\/div\>(.{0,10})\{\/if\}(.{0,10})\{if \!empty\(\$navbar\) \}\{include file\=\'navigation_bar.tpl\'\|\@get_extent:\'navbar\'\}\{\/if\}#is';
    320  
    321   $replace = '
    322 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="stc_standalone">
    323   <fieldset>
    324   {if $SUBSCRIBED}
    325     {\'You are currently subscribed to comments of this album.\'|@translate}
    326     <a href="{$UNSUB_LINK}">{\'Unsubscribe\'|@translate}
    327   {else}
    328     <legend>{\'Subscribe without commenting\'|@translate}</legend>
    329     {if $ASK_MAIL}
    330       <label>{\'Email address\'|@translate} <input type="text" name="stc_mail_stdl"></label>
    331       <label><input type="submit" name="stc_submit" value="{\'Submit\'|@translate}"></label>
    332     {else}
    333       <label><input type="submit" name="stc_submit" value="{\'Subscribe\'|@translate}"></label>
    334     {/if}
    335   {/if}
    336   </fieldset>
    337 </form>
    338 </div>$1{/if}$2{if !empty($navbar) }{include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'}{/if}';
    339 
    340   $content = preg_replace($search, $replace, $content);
    341  
    342   ## subscribe while add a comment ##
    343   $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#';
    344  
    345   $replace = '
    346 <input type="hidden" name="key" value="{$comment_add.KEY}"$1>
    347 {if !$SUBSCRIBED}
    348   <label>{\'Notify me of followup comments\'|@translate} <input type="checkbox" name="stc_check" value="1"></label><br>
    349 
    350   {if $ASK_MAIL}
    351     <label id="stc_mail" style="display:none;">{\'Email address\'|@translate} <input type="text" name="stc_mail"></label><br>
    352     {footer_script require="jquery"}{literal}
    353     jQuery(document).ready(function() {
    354       $("input[name=stc_check]").change(function() {
    355         if ($(this).is(":checked")) $("#stc_mail").css("display", "");
    356         else $("#stc_mail").css("display", "none");
    357       });
    358     });
    359     {/literal}{/footer_script}
    360   {/if}
    361 {/if}';
    362  
    363   $content = preg_replace($search, $replace, $content);
    364  
    365   return $content;
    366 }
    367373
    368374/**
     
    375381  if (!empty($user['email']))
    376382  {
     383    $template->assign('MANAGE_LINK', make_stc_url('manage', $user['email']) );
    377384    $template->set_prefilter('profile_content', 'stc_profile_link_prefilter');
    378385  }
    379386}
    380 
    381387function stc_profile_link_prefilter($content, &$smarty)
    382388{
    383   global $user;
    384  
    385389  $search = '<p class="bottomButtons">';
    386   $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>';
    387  
    388   return str_replace($search, $search.$replace, $content);
    389 }
    390 
    391 /**
    392  * must overload messages because Piwigo is weird
    393  */
    394 function stc_add_messages($errors, $infos, $prefilter=false)
    395 {
    396   global $template;
    397  
    398   if (!empty($errors))
    399   {
    400     $errors_bak = $template->get_template_vars('errors');
    401     if (empty($errors_bak)) $errors_bak = array();
    402     $template->assign('errors', array_merge($errors_bak, $errors));
    403     if ($prefilter) $template->set_prefilter('index', 'coa_messages'); // here we use a prefilter existing in COA
    404   }
    405   if (!empty($infos))
    406   {
    407     $infos_bak = $template->get_template_vars('infos');
    408     if (empty($infos_bak)) $infos_bak = array();
    409     $template->assign('infos', array_merge($infos_bak, $infos));
    410     if ($prefilter) $template->set_prefilter('index', 'coa_messages');
    411   }
    412 }
     390  $replace = '<p style="font-size:1.1em;text-decoration:underline;"><a href="{$MANAGE_LINK}" rel="nofollow">{\'Manage my subscriptions to comments\'|@translate}</a></p>';
     391 
     392  return str_replace($search, $replace.$search, $content);
     393}
     394
    413395?>
  • extensions/Subscribe_to_comments/include/subscribtions_page.inc.php

    r12600 r15641  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 global $template, $conf;
    5 
    6 $infos = $errors = array();
     4global $template, $conf, $page, $pwg_loaded_plugins;
    75
    86// check input parameters
    97$_GET['verif_key'] = $_GET['action'].$_GET['email'].(isset($_GET['id'])?$_GET['id']:null);
     8
    109if (
    1110  empty($_GET['action']) or empty($_GET['email']) or empty($_GET['key'])
     
    1312  )
    1413{
    15   $_GET['action'] = 'hacker';
     14  $_GET['action'] = null;
    1615}
    1716else
    1817{
    19   // sanitize inputs
    20   if (isset($_GET['id'])) $_GET['id'] = pwg_db_real_escape_string($_GET['id']);
    21   $_GET['email'] = pwg_db_real_escape_string($_GET['email']);
    22 
    23   // unsubscribe
    24   if (isset($_POST['unsubscribe']))
    25   {
    26     if (un_subscribe_to_comments(!empty($_GET['id'])?$_GET['id']:'N/A', $_GET['email'], $_POST['unsubscribe']))
    27     {
    28       array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
    29     }
    30     else
    31     {
    32       array_push($errors, l10n('Invalid email adress.'));
    33     }
    34    
    35     $_GET['action'] = 'manage';
    36   }
     18  // unsubscribe all
     19  if ( isset($_POST['unsubscribe_all']) and isset($_POST['unsubscribe_all_check']) )
     20  {
     21    $query = '
     22DELETE FROM '.SUBSCRIBE_TO_TABLE.'
     23  WHERE email = "'.$_GET['email'].'"
     24;';
     25    pwg_query($query);
     26  }
     27 
     28  // bulk action
     29  if (isset($_POST['apply_bulk']))
     30  {
     31    foreach ($_POST['selected'] as $id)
     32    {
     33      switch ($_POST['action'])
     34      {
     35        case 'unsubscribe':
     36          un_subscribe_to_comments($_GET['email'], $id);
     37          break;
     38        case 'validate':
     39          validate_subscriptions($_GET['email'], $id);
     40          break;
     41      }
     42    }
     43  }
     44 
     45  // unsubscribe from manage page
    3746  if (isset($_GET['unsubscribe']))
    3847  {
    39     $query = '
    40   DELETE FROM '.SUBSCRIBE_TO_TABLE.'
    41     WHERE
    42       id = '.pwg_db_real_escape_string($_GET['unsubscribe']).'
    43       AND email = "'.$_GET['email'].'"
    44   ;';
    45     pwg_query($query);
    46    
    47     if (pwg_db_changes(null) != 0)
    48     {
    49       array_push($infos, l10n('Successfully unsubscribed your email address from receiving notifications.'));
    50     }
    51     else
    52     {
    53       array_push($errors, l10n('Invalid email adress.'));
     48    if (un_subscribe_to_comments($_GET['email'], $_GET['unsubscribe']))
     49    {
     50      array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
     51    }
     52    else
     53    {
     54     array_push($page['errors'], l10n('Not found.'));
     55    }
     56  }
     57 
     58  // validate from manage page
     59  if (isset($_GET['validate']))
     60  {
     61    if (validate_subscriptions($_GET['email'], $_GET['validate']))
     62    {
     63      array_push($page['infos'], l10n('Your subscribtion has been validated, thanks you.'));
     64    }
     65    else
     66    {
     67      array_push($page['infos'], l10n('Already validated.'));
    5468    }
    5569  }
     
    5872}
    5973
     74
    6075switch ($_GET['action'])
    6176{
    6277  /* validate */
    63   case 'validate-image' :
    64   {
    65     if (validate_subscriptions($_GET['id'], $_GET['email'], 'image'))
    66     {
    67       array_push($infos, l10n('Your subscribtion has been validated, thanks you.'));
    68     }
    69     else
    70     {
    71       array_push($errors, l10n('Nothing to validate.'));
    72     }
    73    
    74     $element = get_picture_infos($_GET['id']);
    75    
    76     $template->assign(array(
    77       'validate' => 'image',
    78       'element' => $element,
    79       ));
    80      
    81     break;
    82   }
    83   case 'validate-category':
    84   {
    85     if (validate_subscriptions($_GET['id'], $_GET['email'], 'category'))
    86     {
    87       array_push($infos, l10n('Your subscribtion has been validated, thanks you.'));
    88     }
    89     else
    90     {
    91       array_push($errors, l10n('Nothing to validate.'));
    92     }
    93    
    94     $element = get_category_infos($_GET['id']);
    95    
    96     $template->assign(array(
    97       'validate' => 'category',
    98       'element' => $element,
    99       ));
    100     break;
    101   }
    102  
    103   /* unsubscribe */
    104   case 'unsubscribe-image' :
    105   { 
    106     $element = get_picture_infos($_GET['id']);
    107    
    108     $template->assign(array(
    109       'unsubscribe_form' => 'image',
    110       'element' => $element,
    111       ));
    112    
    113     break;
    114   }
    115   case 'unsubscribe-category':
    116   { 
    117     $element = get_category_infos($_GET['id']);
    118    
    119     $template->assign(array(
    120       'unsubscribe_form' => 'category',
    121       'element' => $element,
    122       ));
    123    
    124     break;
    125   }
    126  
    127   /* manage */
    128   case 'manage' :
    129   {
    130     $query = '
    131 SELECT *
     78  case 'validate':
     79  {
     80    $query = '
     81SELECT
     82    type,
     83    element_id
    13284  FROM '.SUBSCRIBE_TO_TABLE.'
    13385  WHERE
    13486    email = "'.$_GET['email'].'"
    135     AND validated = "true"
     87    AND id = '.$_GET['id'].'
     88;';
     89    $result = pwg_query($query);
     90   
     91    if (!pwg_db_num_rows($result))
     92    {
     93      array_push($page['errors'], l10n('Not found.'));
     94    }
     95    else
     96    {
     97      if (validate_subscriptions($_GET['email'], $_GET['id']))
     98      {
     99        array_push($page['infos'], l10n('Your subscribtion has been validated, thanks you.'));
     100      }
     101      else
     102      {
     103        array_push($page['infos'], l10n('Already validated.'));
     104      }
     105     
     106      list($type, $element_id) = pwg_db_fetch_row($result);
     107     
     108      switch ($type)
     109      {
     110        case 'image':
     111          $element = get_picture_infos($element_id, false);
     112          break;
     113        case 'album-images':
     114        case 'album':
     115          $element = get_category_infos($element_id, false);
     116          break;
     117        default:
     118          $element = null;
     119      }
     120     
     121      $template->assign(array(
     122        'type' => $type,
     123        'element' => $element,
     124        ));
     125    }
     126   
     127    $template->assign('IN_VALIDATE', true);
     128    break;
     129  }
     130 
     131  /* unsubscribe */
     132  case 'unsubscribe':
     133  {
     134    $query = '
     135SELECT
     136    type,
     137    element_id
     138  FROM '.SUBSCRIBE_TO_TABLE.'
     139  WHERE
     140    email = "'.$_GET['email'].'"
     141    AND id = '.$_GET['id'].'
     142;';
     143    $result = pwg_query($query);
     144   
     145    if (!pwg_db_num_rows($result))
     146    {
     147      array_push($page['errors'], l10n('Not found.'));
     148    }
     149    else
     150    {
     151      if (un_subscribe_to_comments($_GET['email'], $_GET['id']))
     152      {
     153        array_push($page['infos'], l10n('Successfully unsubscribed your email address from receiving notifications.'));
     154      }
     155      else
     156      {
     157        array_push($page['errors'], l10n('Not found.'));
     158      }
     159     
     160      list($type, $element_id) = pwg_db_fetch_row($result);
     161     
     162      switch ($type)
     163      {
     164        case 'image':
     165          $element = get_picture_infos($element_id);
     166          break;
     167        case 'album-images':
     168        case 'album':
     169          $element = get_category_infos($element_id);
     170          break;
     171        default:
     172          $element = null;
     173      }
     174     
     175      $template->assign(array(
     176        'type' => $type,
     177        'element' => $element,
     178        ));
     179    }
     180   
     181    $template->assign('IN_UNSUBSCRIBE', true);
     182    break;
     183  }
     184 
     185  /* manage */
     186  case 'manage':
     187  {
     188    $query = '
     189SELECT *
     190  FROM '.SUBSCRIBE_TO_TABLE.'
     191  WHERE email = "'.$_GET['email'].'"
    136192  ORDER BY registration_date DESC
    137193;';
    138194    $result = pwg_query($query);
    139195   
    140     if (pwg_db_num_rows($result) !== 0)
     196    if (pwg_db_num_rows($result))
    141197    {
    142198      while ($subscription = pwg_db_fetch_assoc($result))
    143199      {
    144         if (!empty($subscription['image_id']))
     200        $subscription['registration_date'] = format_date($subscription['registration_date'], true);
     201       
     202        switch ($subscription['type'])
    145203        {
    146           $subscription['infos'] = get_picture_infos($subscription['image_id']);
    147           $subscription['type'] = 'image';
     204          case 'image':
     205            $subscription['infos'] = get_picture_infos($subscription['element_id']);
     206            break;
     207          case 'album-images':
     208          case 'album':
     209            $subscription['infos'] = get_category_infos($subscription['element_id']);
     210            break;
     211          default:
     212            $subscription['infos'] = null;
     213            $template->append('global_subscriptions', $subscription);
     214            continue(2);
    148215        }
    149         else if (!empty($subscription['category_id']))
    150         {
    151           $subscription['infos'] = get_category_infos($subscription['category_id']);
    152           $subscription['type'] = 'category';
    153         }
    154         $subscription['registration_date'] = format_date($subscription['registration_date'], true);
     216       
    155217        $template->append('subscriptions', $subscription);
    156218      }
     
    158220    else
    159221    {
    160       $template->assign('subscriptions', 'none');
     222      array_push($page['infos'], l10n('You are not subscribed to any comment.'));
    161223    }
    162224    break;
    163225  }
    164226 
    165   case 'hacker' :
     227  default:
    166228  {
    167229    set_status_header(403);
    168     array_push($errors, l10n('Bad query'));
    169   }
     230    array_push($page['errors'], l10n('Bad query'));
     231  }
     232}
     233
     234if (isset($pwg_loaded_plugins['Comments_on_Albums']))
     235{
     236  $template->assign('COA_ACTIVATED', true);
    170237}
    171238
     
    175242  ));
    176243
    177 $template->assign(array(
    178   'infos' => $infos,
    179   'errors' => $errors,
    180   ));
    181 
    182244$template->set_filenames(array('index'=> dirname(__FILE__).'/../template/subscribtions_page.tpl'));
     245
    183246?>
  • extensions/Subscribe_to_comments/index.php

    r12560 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/ca_ES/plugin.lang.php

    r15376 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Date'] = 'Data';
    2423$lang['Invalid email adress, your are not subscribed to comments.'] = 'Adreça de correu electrònic no vàlida. No està inscrit als comentaris.';
    25 $lang['Invalid email adress.'] = 'Adreça de correu electrònic no vàlida';
    26 $lang['Item'] = 'Objecte';
    27 $lang['Manage my subscriptions to comments'] = 'Gestionar les meves inscripcions als comentaris';
    28 $lang['Nothing to validate.'] = 'No hi ha res per validar';
    2924$lang['Notify me of followup comments'] = 'Notificar-me en cas d\'haver-hi nous comentaris';
    30 $lang['Only unsubscribe notifications for comments from:'] = 'Només donar de baixa les notificacions per comentaris de:';
    3125$lang['Please check your email inbox to confirm your subscription.'] = 'Revisi el seu correu electrònic per confirmar la seva inscripció.';
    3226$lang['Return to item page'] = 'Tornar a la pàgina anterior';
    33 $lang['Subscribe without commenting'] = 'Instriure\'s sense comentar';
    3427$lang['Subscribe'] = 'Instriure\'s';
    3528$lang['Subscriptions of'] = 'Incripcions de';
    3629$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'La seva adreça de correu electrònic ha estat donat de baixa correctament. No rebrà més notificacions.';
    3730$lang['Unsubscribe from all email notifications'] = 'Donar-se de baixa de totes les notificacions per correu electrònic';
    38 $lang['Unsubscribe from email notification'] = 'Donar-se de baixa de les notificacions per correu electrònic';
    3931$lang['Unsubscribe'] = 'Donar de baixa';
    40 $lang['You are currently subscribed to comments.'] = 'Actualment ja està inscrit als comentaris.';
    4132$lang['You are not subscribed to any comment.'] = 'No està inscrit a cap comentari';
    42 $lang['You have been added to the list of subscribers for this album.'] = 'Se l\'ha afegit a la llista d\'usuaris inscrits per a aquest àlbum.';
    43 $lang['You have been added to the list of subscribers for this picture.'] = 'Se l\'ha afegit a la llista d\'usuaris inscrits per a aquesta imatge.';
    4433$lang['Your subscribtion has been validated, thanks you.'] = 'La seva inscripció ha estat validada. Gràcies.';
    4534?>
  • extensions/Subscribe_to_comments/language/cs_CZ/index.php

    r13606 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/cs_CZ/plugin.lang.php

    r13612 r15641  
    11<?php
    22$lang['Please check your email inbox to confirm your subscription.'] = 'Prosím nyní zkontrolujte vaši email schránku a odsouhlaste vaše přihlášení k odběru.';
    3 $lang['You have been added to the list of subscribers for this album.'] = 'Byl jste přidán do seznamu účastníků diskuze pro toto album.';
    4 $lang['You have been added to the list of subscribers for this picture.'] = 'Byl jste přidán do seznamu účastníků diskuze pro tento obrázek.';
    53$lang['Invalid email adress, your are not subscribed to comments.'] = 'Byla zadána neplatná email adresa, nebyl jste zařazen k odběru komentářů.';
    64$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Vaše email adresa byla úspěšně odstraněna ze seznamu odběratelů pro upozorňující zprávy.';
    7 $lang['You are currently subscribed to comments.'] = 'Nyní jste přihlášen k odběru komentářů.';
    85$lang['Unsubscribe'] = 'Odhlásit';
    96$lang['Subscribe'] = 'Přihlásit';
    10 $lang['Subscribe without commenting'] = 'Přihlášení bez zadání komentáře';
    117$lang['Notify me of followup comments'] = 'Upozorni mě na následující komentáře';
    12 $lang['Invalid email adress.'] = 'Neplatný email.';
    138$lang['Your subscribtion has been validated, thanks you.'] = 'Vaše přihlášení k odběru bylo potvrzeno, děkujeme vám.';
    14 $lang['Nothing to validate.'] = 'Nic k ověření.';
    159$lang['Subscriptions of'] = 'Odběr z';
    16 $lang['Unsubscribe from email notification'] = 'Odhlásit se z odběru upozorňujících zpráv o nových komentářích';
    17 $lang['Only unsubscribe notifications for comments from:'] = 'Odhlásit se z odběru upozornění jen z těchto komentářů:';
    1810$lang['Unsubscribe from all email notifications'] = 'Odhlásit se z odběru upozornění ze všech komentářů';
    19 $lang['Manage my subscriptions to comments'] = 'Spravovat moje přihlášení k odběrům komentářů';
    20 $lang['Item'] = 'Zpráva';
    21 $lang['Date'] = 'Datum';
    2211$lang['You are not subscribed to any comment.'] = 'Nejste nyní přihlášen k oběru upozornění u žádného komentáře.';
    2312$lang['Return to item page'] = 'Zpět na stránku zprávy';
  • extensions/Subscribe_to_comments/language/de_DE/index.php

    r13067 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/de_DE/plugin.lang.php

    r13067 r15641  
    22
    33$lang['Please check your email inbox to confirm your subscription.'] = 'Bitte überprüfen Sie Ihren Posteingang, um Ihre Abonnementanfrage zu bestätigen.';
    4 $lang['You have been added to the list of subscribers for this album.'] = 'Sie wurden zur Abonnentenliste dieses Albums hinzugefügt.';
    5 $lang['You have been added to the list of subscribers for this picture.'] = 'Sie wurden zur Abonnentenliste dieses Bildes hinzugefügt.';
    64$lang['Invalid email adress, your are not subscribed to comments.'] = 'Ungültige E-mailadresse, Sie haben Kommentare nicht abonniert.';
    75$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Ihr Abonnement wurde erfolgreich deaktiviert. Sie erhalten keine weiteren Benachrichtigungen.';
    8 $lang['You are currently subscribed to comments.'] = 'Sie werden derzeit bei neuen Kommentaren benachrichtigt.';
    96$lang['Unsubscribe'] = 'Abmelden';
    107$lang['Subscribe'] = 'Anmelden';
    11 $lang['Subscribe without commenting'] = 'Anmelden ohne zu Kommentieren';
    128$lang['Notify me of followup comments'] = 'Bei weiteren Kommentaren benachrichtigen';
    13 $lang['Invalid email adress.'] = 'Ungültige E-mailadresse.';
    149$lang['Your subscribtion has been validated, thanks you.'] = 'Danke, ihr Abonnement wurde bestätigt.';
    15 $lang['Nothing to validate.'] = 'Nichts zu Bestätigen.';
    1610$lang['Subscriptions of'] = 'Abonnements von';
    17 $lang['Unsubscribe from email notification'] = 'Von E-mailbenachrichtigungen abmelden';
    18 $lang['Only unsubscribe notifications for comments from:'] = 'Nur die folgenden Benachrichtigungen deaktivieren:';
    1911$lang['Unsubscribe from all email notifications'] = 'Alle E-mailbenachrichtigungen deaktivieren';
    20 $lang['Manage my subscriptions to comments'] = 'Meine Abonnements verwalten';
    21 $lang['Item'] = 'Eintrag';
    22 $lang['Date'] = 'Datum';
    2312$lang['You are not subscribed to any comment.'] = 'Sie haben im Moment keine Benachrichtigungen abonniert.';
    2413$lang['Return to item page'] = 'Zurück zur Übersichtsseite der Einträge';
  • extensions/Subscribe_to_comments/language/en_UK/description.txt

    r12600 r15641  
    1 This plugin allows you to subscribe to comments by email.
     1This plugin allows to subscribe to comments by email.
  • extensions/Subscribe_to_comments/language/en_UK/index.php

    r12560 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/en_UK/plugin.lang.php

    r12708 r15641  
    11<?php
    22
     3$lang['Comments notifications'] = 'Comments notifications';
     4
     5/* messages */
     6$lang['Invalid email adress, your are not subscribed to comments.'] = 'Invalid email adress, your are not subscribed to comments.';
     7$lang['Confirm your subscribtion to comments'] = 'Confirm your subscribtion to comments';
     8$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Successfully unsubscribed your email address from receiving notifications.';
     9$lang['Not found.'] = 'Not found.';
     10$lang['Your subscribtion has been validated, thanks you.'] = 'Your subscribtion has been validated, thanks you.';
     11$lang['Already validated.'] = 'Already validated.';
     12$lang['You are not subscribed to any comment.'] = 'You are not subscribed to any comment.';
    313$lang['Please check your email inbox to confirm your subscription.'] = 'Please check your email inbox to confirm your subscription.';
    4 $lang['You have been added to the list of subscribers for this album.'] = 'You have been added to the list of subscribers for this album.';
    5 $lang['You have been added to the list of subscribers for this picture.'] = 'You have been added to the list of subscribers for this picture.';
    6 $lang['Invalid email adress, your are not subscribed to comments.'] = 'Invalid email adress, your are not subscribed to comments.';
    7 $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Successfully unsubscribed your email address from receiving notifications.';
    8 $lang['You are currently subscribed to comments.'] = 'You are currently subscribed to comments.';
     14$lang['You have been added to the list of subscribers.'] = 'You have been added to the list of subscribers.';
     15
     16/* sprintf */
     17$lang['the picture <a href="%s">%s</a>'] = 'the picture <a href="%s">%s</a>';
     18$lang['all pictures of the album <a href="%s">%s</a>'] = 'all pictures of the album <a href="%s">%s</a>';
     19$lang['all pictures of the gallery'] = 'all pictures of the gallery';
     20$lang['the album <a href="%s">%s</a>'] = 'the album <a href="%s">%s</a>';
     21$lang['all albums of the gallery'] = 'all albums of the gallery';
     22$lang['%s has subscribed to comments on'] = '%s has subscribed to comments on';
     23
     24/* config */
     25$lang['Notify administrators when a user take a new subscription'] = 'Notify administrators when a user take a new subscription';
     26$lang['Allow users to subscribe to global notifications'] = 'Allow users to subscribe to global notifications';
     27
     28/* comment form */
     29$lang['Subscribe to mail notifications'] = 'Subscribe to mail notifications';
     30$lang['Notify me of followup comments'] = 'Notify me of followup comments';
     31$lang['You are currently subscribed to comments on'] =  'You are currently subscribed to comments on';
     32$lang['on this picture'] = 'on this picture';
     33$lang['on all pictures of this album'] = 'on all pictures of this album';
     34$lang['on all pictures of the gallery'] = 'on all pictures of the gallery';
     35$lang['on this album'] = 'on this album';
     36$lang['on all albums of the gallery'] = 'on all albums of the gallery';
     37
     38/* buttons */
     39$lang['Manage my subscribtions'] = 'Manage my subscribtions';
     40$lang['Subscribe'] = 'Subscribe';
    941$lang['Unsubscribe'] = 'Unsubscribe';
    10 $lang['Subscribe'] = 'Subscribe';
    11 $lang['Subscribe without commenting'] = 'Subscribe without commenting';
    12 $lang['Notify me of followup comments'] = 'Notify me of followup comments';
    13 $lang['Invalid email adress.'] = 'Invalid email adress.';
    14 $lang['Your subscribtion has been validated, thanks you.'] = 'Your subscribtion has been validated, thanks you.';
    15 $lang['Nothing to validate.'] = 'Nothing to validate.';
     42$lang['Validate'] = 'Validate';
     43$lang['Confirm subscription'] = 'Confirm subscription';
     44
     45/* email */
     46$lang['New subscription on'] = 'New subscription on';
     47$lang['Subscribe to comments on'] = 'Subscribe to comments on';
     48$lang['You requested to subscribe by email to comments on'] = 'You requested to subscribe by email to comments on';
     49$lang['To activate, click the confirm button. If you believe this is an error, please just ignore this message.'] = 'To activate, click the confirm button. If you believe this is an error, please just ignore this message.';
     50$lang['Want to edit your notifications options?'] = 'Want to edit your notifications options?';
     51$lang['New comment on'] = 'New comment on';
     52
     53/* manage page */
    1654$lang['Subscriptions of'] = 'Subscriptions of';
    17 $lang['Unsubscribe from email notification'] = 'Unsubscribe from email notification';
    18 $lang['Only unsubscribe notifications for comments from:'] = 'Only unsubscribe notifications for comments from:';
     55$lang['Return to item page'] = 'Return to item page';
     56$lang['Manage my subscriptions to comments'] = 'Manage my subscriptions to comments';
     57$lang['Subject'] = 'Subject';
     58$lang['Followed on'] = 'Followed on';
    1959$lang['Unsubscribe from all email notifications'] = 'Unsubscribe from all email notifications';
    20 $lang['Manage my subscriptions to comments'] = 'Manage my subscriptions to comments';
    21 $lang['Item'] = 'Item';
    22 $lang['Date'] = 'Date';
    23 $lang['You are not subscribed to any comment.'] = 'You are not subscribed to any comment.';
    24 $lang['Return to item page'] = 'Return to item page';
     60$lang['comments on a picture'] = 'comments on a picture';
     61$lang['comments on all pictures of an album'] = 'comments on all pictures of an album';
     62$lang['comments on an album'] = 'comments on an album';
    2563
    2664?>
  • extensions/Subscribe_to_comments/language/es_ES/index.php

    r13164 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/es_ES/plugin.lang.php

    r12944 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Date'] = 'Fecha';
    2423$lang['Invalid email adress, your are not subscribed to comments.'] = 'Email incorrecto, no se ha suscrito a los comentarios.';
    25 $lang['Invalid email adress.'] = 'Dirección de email incorrecta.';
    26 $lang['Item'] = 'Objeto';
    27 $lang['Manage my subscriptions to comments'] = 'Administrar mis suscripciones de los comentarios.';
    28 $lang['Nothing to validate.'] = 'Nada que validar.';
    2924$lang['Notify me of followup comments'] = 'Notificarme de próximos comentarios.';
    30 $lang['Only unsubscribe notifications for comments from:'] = 'Cancelar suscripción de los comentarios de:';
    3125$lang['Please check your email inbox to confirm your subscription.'] = 'Por favor, revisa tu buzón de correo electrónico para confirmar la suscripción.';
    3226$lang['Return to item page'] = 'Volver a la página anterior';
    3327$lang['Subscribe'] = 'Suscribir';
    34 $lang['Subscribe without commenting'] = 'Suscribirse sin comentar.';
    3528$lang['Subscriptions of'] = 'Suscripciones de';
    3629$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Suscripción cancelada correctamente.';
    3730$lang['Unsubscribe'] = 'Cancelar suscripción';
    3831$lang['Unsubscribe from all email notifications'] = 'Cancelar todas las suscripciones por email ';
    39 $lang['Unsubscribe from email notification'] = 'Cancelar suscripción de notificaciones por email';
    40 $lang['You are currently subscribed to comments.'] = 'Estas suscrito a los comentarios.';
    4132$lang['You are not subscribed to any comment.'] = 'No estas suscrito a ningún comentarios';
    42 $lang['You have been added to the list of subscribers for this album.'] = 'Se ha añadido tu dirección a la lista de suscriptores del álbum.';
    43 $lang['You have been added to the list of subscribers for this picture.'] = 'Se ha añadido tu dirección a la lista de suscriptores de la foto.';
    4433$lang['Your subscribtion has been validated, thanks you.'] = 'Tu suscripción se ha validado, gracias.';
    4534?>
  • extensions/Subscribe_to_comments/language/fr_FR/index.php

    r12560 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/fr_FR/plugin.lang.php

    r12708 r15641  
    22
    33$lang['Please check your email inbox to confirm your subscription.'] = 'Veillez consulter votre boite mail pour confirmer votre inscription.';
    4 $lang['You have been added to the list of subscribers for this album.'] = 'Vous avez été ajouté à la liste des abonnés pour cet album.';
    5 $lang['You have been added to the list of subscribers for this picture.'] = 'Vous avez été ajouté à la liste des abonnés pour cette photo.';
    64$lang['Invalid email adress, your are not subscribed to comments.'] = 'Addresse email invalide, vous n\'avez pas été inscrit.';
    75$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Inscription aux commentaires annulée avec succès.';
    8 $lang['You are currently subscribed to comments.'] = 'Vous êtes actuellement inscrit aux commentaires.';
    96$lang['Unsubscribe'] = 'Se désinscrire';
    107$lang['Subscribe'] = 'S\'inscrire';
    11 $lang['Subscribe without commenting'] = 'S\'inscrire sans commenter';
    128$lang['Notify me of followup comments'] = 'Me notifier des nouveaux commentaires';
    13 $lang['Invalid email adress.'] = 'Adress email invalide.';
    149$lang['Your subscribtion has been validated, thanks you.'] = 'Votre inscription a été validée, merci.';
    15 $lang['Nothing to validate.'] = 'Rien à valider.';
    1610$lang['Subscriptions of'] = 'Abonnements de';
    17 $lang['Unsubscribe from email notification'] = 'Se désinscrire de la notification par mail';
    18 $lang['Only unsubscribe notifications for comments from:'] = 'Uniquement se désinscrire de :';
    1911$lang['Unsubscribe from all email notifications'] = 'Ne plus recevoir aucune notification';
    20 $lang['Manage my subscriptions to comments'] = 'Gérer mes abonnements aux commentaires';
    21 $lang['Item'] = 'Objet';
    22 $lang['Date'] = 'Date';
    2312$lang['You are not subscribed to any comment.'] = 'Vous n\'êtes inscrit à aucun commentaire.';
    2413$lang['Return to item page'] = 'Retourner à la page de l\'élément';
     14$lang['New comment on'] = 'Nouveau commentaire sur';
    2515
    2616?>
  • extensions/Subscribe_to_comments/language/index.php

    r12560 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/it_IT/plugin.lang.php

    r13359 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Date'] = 'Data';
    2423$lang['Invalid email adress, your are not subscribed to comments.'] = 'Indirizzo mail errato, non sei sottoscritto ai commenti';
    25 $lang['Invalid email adress.'] = 'Indirizzo mail errato';
    26 $lang['Item'] = 'Oggetto';
    27 $lang['Manage my subscriptions to comments'] = 'Gestisci le mie sottoscrizioni ai commenti';
    28 $lang['Nothing to validate.'] = 'Niente da confermare.';
    2924$lang['Notify me of followup comments'] = 'Notificami sui commenti successivi';
    30 $lang['Only unsubscribe notifications for comments from:'] = 'Rimuovi la sottoscrizione delle notifiche solo per i commenti di:';
    3125$lang['Please check your email inbox to confirm your subscription.'] = 'Controlla la tua posta in arrivo per confermare la sottoscrizione';
    3226$lang['Return to item page'] = 'Ritorna alla pagina degli argomenti';
    3327$lang['Subscribe'] = 'Sottoscrivi';
    34 $lang['Subscribe without commenting'] = 'Sottoscrivi senza commentare';
    3528$lang['Subscriptions of'] = 'Sottoscrizione di';
    3629$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'La sottoscrizione del tuo account email alle notifiche è stata disattivata con successo';
    3730$lang['Unsubscribe'] = 'Non sottoscrivere';
    3831$lang['Unsubscribe from all email notifications'] = 'Rimuovi la sottoscrizione da tutte le notifiche mail';
    39 $lang['Unsubscribe from email notification'] = 'Rimuovi la sottoscrizione delle notifiche mail';
    40 $lang['You are currently subscribed to comments.'] = 'La sottoscrizione ai commenti è attualmente attiva';
    4132$lang['You are not subscribed to any comment.'] = 'Non hai sottoscritto alcun commento';
    42 $lang['You have been added to the list of subscribers for this album.'] = 'Sei stato aggiunto alla lista delle sottoscrizioni per questo album';
    43 $lang['You have been added to the list of subscribers for this picture.'] = 'Sei stato aggiunto alla lista delle sottoscrizioni per questa immagine';
    4433$lang['Your subscribtion has been validated, thanks you.'] = 'La tua sottoscrizione è stata confermata, grazie.';
    4534?>
  • extensions/Subscribe_to_comments/language/lv_LV/index.php

    r13326 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/lv_LV/plugin.lang.php

    r13326 r15641  
    2222// +-----------------------------------------------------------------------+
    2323$lang['Please check your email inbox to confirm your subscription.'] = 'Lūdzu pārbaudiet savu e-pastu, lai apstiprinātu savu pierakstu.';
    24 $lang['You have been added to the list of subscribers for this album.'] = 'Jūs esat pievienots šā albūma parakstītāju sarakstam.';
    25 $lang['You have been added to the list of subscribers for this picture.'] = 'Jūs esat pievienots šā foto parakstītāju sarakstam.';
    2624$lang['Invalid email adress, your are not subscribed to comments.'] = 'Nekorekta e-pasta adrese, jūs neesat pierakstījies komentāriem.';
    2725$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Jūsu e-pasta adrese sekmīgi izņemta no paziņojumu saņēmēju saraksta.';
    28 $lang['You are currently subscribed to comments.'] = 'Jūs patlaban esat pierakstījies komentāriem.';
    2926$lang['Unsubscribe'] = 'Atsacīties no pieraksta';
    3027$lang['Subscribe'] = 'Pierakstīties';
    31 $lang['Subscribe without commenting'] = 'Pierakstīties nekomentējot';
    3228$lang['Notify me of followup comments'] = 'Paziņot man par tekošajiem komentāriem';
    33 $lang['Invalid email adress.'] = 'Nekorekta e-pasta adrese.';
    3429$lang['Your subscribtion has been validated, thanks you.'] = 'Paldies. Jūsu pieraksts ir validēts.';
    35 $lang['Nothing to validate.'] = 'Nav ko validēt.';
    3630$lang['Subscriptions of'] = 'Pierakstīšanās';
    37 $lang['Unsubscribe from email notification'] = 'Atsacītiess no e-pasta paziņojumiem';
    38 $lang['Only unsubscribe notifications for comments from:'] = 'Atsacīties tikai no paziņojumiem par komentāriem no:';
    3931$lang['Unsubscribe from all email notifications'] = 'Atsacīties no visiem epasta paziņojumiem';
    40 $lang['Manage my subscriptions to comments'] = 'Pārvaldīt manus paziņojumus par komentāriem';
    41 $lang['Item'] = 'Vienums';
    42 $lang['Date'] = 'Datums';
    4332$lang['You are not subscribed to any comment.'] = 'Jūs neesat pierakstījies jebkādu komentāru veikšanai.';
    4433$lang['Return to item page'] = 'Atgriezties vienuma lapā';
  • extensions/Subscribe_to_comments/language/nl_NL/plugin.lang.php

    r15031 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Date'] = 'datum';
    2423$lang['Invalid email adress, your are not subscribed to comments.'] = 'Ongeldig emailadres, je bent niet ingeschreven op commentaar.';
    25 $lang['Invalid email adress.'] = 'Ongeldig emailadres.';
    26 $lang['Item'] = 'item';
    27 $lang['Manage my subscriptions to comments'] = 'Beheer mijn inschrijvingen voor commentaar';
    28 $lang['Nothing to validate.'] = 'Niets om goed te keuren.';
    2924$lang['Notify me of followup comments'] = 'Notificeer mij over opvolgend commentaar';
    30 $lang['Only unsubscribe notifications for comments from:'] = 'Schrijf alleen uit van commentaar van:';
    3125$lang['Please check your email inbox to confirm your subscription.'] = 'Bekijk je inbox om je inschrijving te bevestigen.';
    3226$lang['Return to item page'] = 'Keer terug naar de itempagina';
    33 $lang['Subscribe without commenting'] = 'Inschrijven zonder commentaar te schrijven';
    3427$lang['Subscribe'] = 'Inschrijven';
    3528$lang['Subscriptions of'] = 'Inschrijvingen van';
    3629$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Je emailadres is uitgeschreven van het ontvangen van notificaties.';
    3730$lang['Unsubscribe from all email notifications'] = 'Schrijf uit van alle emailnotificaties';
    38 $lang['Unsubscribe from email notification'] = 'Schrijf uit van emailnotificatie';
    3931$lang['Unsubscribe'] = 'Uitschrijven';
    40 $lang['You are currently subscribed to comments.'] = 'Je bent nu ingeschreven op het commentaar.';
    4132$lang['You are not subscribed to any comment.'] = 'Je bent niet ingeschreven voor enig commentaar.';
    42 $lang['You have been added to the list of subscribers for this album.'] = 'Je bent toegevoegd aan de lijst van mensen die zich op dit album hebben ingeschreven.';
    43 $lang['You have been added to the list of subscribers for this picture.'] = 'Je bent toegevoegd aan de lijst van mensen die zich op deze afbeelding hebben ingescreven.';
    4433$lang['Your subscribtion has been validated, thanks you.'] = 'Je inschrijving is goedgekeurd, dank je.';
    4534?>
  • extensions/Subscribe_to_comments/language/pl_PL/plugin.lang.php

    r13141 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23  $lang['Please check your email inbox to confirm your subscription.'] = 'Sprawdź skrzynką pocztową aby potwierdzić subskrypcje.';
    24  $lang['You have been added to the list of subscribers for this album.'] = 'Zostałeś dodany do listy subskrybentów tego albumu.';
    25  $lang['You have been added to the list of subscribers for this picture.'] = 'Zostałeś dodany do listy subskrybentów tego zdjęcia.';
    26  $lang['Invalid email adress, your are not subscribed to comments.'] = 'Niewłaściwy adres e-mail, nie zostałeś subskrybowany.';
    27  $lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Usunąłeś ten adres e-mail z listy subskrybentów.';
    28  $lang['You are currently subscribed to comments.'] = 'Jesteś obecnie zasubskrybowany do komentarzy.';
    29  $lang['Unsubscribe'] = 'Nie subskrybuj';
    30  $lang['Subscribe'] = 'Subskrybuj';
    31  $lang['Subscribe without commenting'] = 'Subskrybuj bez komentowania.';
    32  $lang['Notify me of followup comments'] = 'Powiadamiaj o odpowiedziach.';
    33  $lang['Invalid email adress.'] = 'Nieprawidłowy adres e-mail.';
    34  $lang['Your subscribtion has been validated, thanks you.'] = 'Twoja subskrypcja została potwierdzona, dziękujemy.';
    35  $lang['Nothing to validate.'] = 'Nie ma czego potwierdzać.';
    36  $lang['Subscriptions of'] = 'Subskrypcje';
    37  $lang['Unsubscribe from email notification'] = 'Zakończ subskrypcję powiadomień e-mail';
    38  $lang['Only unsubscribe notifications for comments from:'] = 'Zakończ tylko subskrypcję powiadomień komentarzy od:';
    39  $lang['Unsubscribe from all email notifications'] = 'Zakończ subskrypcję wszystkich powiadomień';
    40  $lang['Manage my subscriptions to comments'] = 'Zarządzaj moimi subskrypcjami komentarzy';
    41  $lang['Item'] = 'Element';
    42  $lang['Date'] = 'Data';
    43  $lang['You are not subscribed to any comment.'] = 'Nie subskrybowałeś żadnych komentarzy.';
    44  $lang['Return to item page'] = 'Powróć do listy elementów';
     23$lang['Please check your email inbox to confirm your subscription.'] = 'Sprawdź skrzynką pocztową aby potwierdzić subskrypcje.';
     24$lang['Invalid email adress, your are not subscribed to comments.'] = 'Niewłaściwy adres e-mail, nie zostałeś subskrybowany.';
     25$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Usunąłeś ten adres e-mail z listy subskrybentów.';
     26$lang['Unsubscribe'] = 'Nie subskrybuj';
     27$lang['Subscribe'] = 'Subskrybuj';
     28$lang['Notify me of followup comments'] = 'Powiadamiaj o odpowiedziach.';
     29$lang['Your subscribtion has been validated, thanks you.'] = 'Twoja subskrypcja została potwierdzona, dziękujemy.';
     30$lang['Subscriptions of'] = 'Subskrypcje';
     31$lang['Unsubscribe from all email notifications'] = 'Zakończ subskrypcję wszystkich powiadomień';
     32$lang['You are not subscribed to any comment.'] = 'Nie subskrybowałeś żadnych komentarzy.';
     33$lang['Return to item page'] = 'Powróć do listy elementów';
    4534?>
  • extensions/Subscribe_to_comments/language/pt_PT/plugin.lang.php

    r14013 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Date'] = 'Data';
    2423$lang['Invalid email adress, your are not subscribed to comments.'] = 'Endereço de correio electrónico inválido, não foi subscrito aos comentários.';
    25 $lang['Invalid email adress.'] = 'Endereço de correio electrónico inválido.';
    26 $lang['Item'] = 'Item';
    27 $lang['Manage my subscriptions to comments'] = 'Gerir as minhas subscrições de comentários';
    28 $lang['Nothing to validate.'] = 'Nada para validar.';
    2924$lang['Notify me of followup comments'] = 'Notifique-me de futuros comentários';
    30 $lang['Only unsubscribe notifications for comments from:'] = 'Apenas cancelar subscrição de comentários de:';
    3125$lang['Please check your email inbox to confirm your subscription.'] = 'Por favor consulte a sua caixa de correio electrónico para confirmar a sua subscrição.';
    3226$lang['Return to item page'] = 'Regressar à página do item';
    33 $lang['Subscribe without commenting'] = 'Subscrever sem comentar';
    3427$lang['Subscribe'] = 'Subscrever';
    3528$lang['Subscriptions of'] = 'Subscrições de';
    3629$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Cancelou a subscrição para receber notificações por correio electrónico.';
    3730$lang['Unsubscribe from all email notifications'] = 'Cancelar todas as notificações por correio electrónico';
    38 $lang['Unsubscribe from email notification'] = 'Cancelar subscrição de notificação por correio electrónico';
    3931$lang['Unsubscribe'] = 'Cancelar subscrição';
    40 $lang['You are currently subscribed to comments.'] = 'Está subscrito aos comentários.';
    4132$lang['You are not subscribed to any comment.'] = 'Não está subscrito a nenhum comentário.';
    42 $lang['You have been added to the list of subscribers for this album.'] = 'Foi adicionado à lista de subscritores deste álbum.';
    43 $lang['You have been added to the list of subscribers for this picture.'] = 'Foi adicionado à lista de subscritores desta foto.';
    4433$lang['Your subscribtion has been validated, thanks you.'] = 'A sua subscrição foi validada, obrigado.';
    4534?>
  • extensions/Subscribe_to_comments/language/ru_RU/plugin.lang.php

    r14210 r15641  
    2222// +-----------------------------------------------------------------------+
    2323$lang['Please check your email inbox to confirm your subscription.'] = 'Пожалуйста, проверьте ваш электронный почтовый ящик, чтобы подтвердить подписку.';
    24 $lang['You have been added to the list of subscribers for this album.'] = 'Вы были добавлены в список абонентов для этого альбома.';
    25 $lang['Date'] = 'Дата';
    2624$lang['Invalid email adress, your are not subscribed to comments.'] = 'Неправильный электронный адрес, вы не подписаны на комментарии.';
    27 $lang['Invalid email adress.'] = 'Неправильный электронный адрес.';
    28 $lang['Item'] = 'Элемент';
    29 $lang['Manage my subscriptions to comments'] = 'Управление подпиской на комментарии';
    30 $lang['Nothing to validate.'] = 'Ничего нет для проверки.';
    3125$lang['Notify me of followup comments'] = 'Сообщите мне о новых комментариях';
    32 $lang['Only unsubscribe notifications for comments from:'] = 'Отказаться только от уведомлений о комментариях:';
    3326$lang['Return to item page'] = 'Вернуться к списку';
    34 $lang['Subscribe without commenting'] = 'Подписаться без комментариев';
    3527$lang['Subscribe'] = 'Подписаться';
    3628$lang['Subscriptions of'] = 'Подписки на';
    3729$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Вы успешно отписали Ваш адрес электронной почты и не получите больше уведомлений.';
    3830$lang['Unsubscribe from all email notifications'] = 'Отказаться от всех уведомлений по электронной почте';
    39 $lang['Unsubscribe from email notification'] = 'Отказаться от уведомлений по электронной почте';
    4031$lang['Unsubscribe'] = 'Отказаться от подписки';
    41 $lang['You are currently subscribed to comments.'] = 'Сейчас Вы подписаны на комментарии.';
    4232$lang['You are not subscribed to any comment.'] = 'Вы не подписаны на комментарии.';
    43 $lang['You have been added to the list of subscribers for this picture.'] = 'Вы были добавлены в список абонентов для этой фотографии.';
    4433$lang['Your subscribtion has been validated, thanks you.'] = 'Ваша подписка была подтверждена, спасибо.';
    4534?>
  • extensions/Subscribe_to_comments/language/sk_SK/index.php

    r13164 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/language/sk_SK/plugin.lang.php

    r13164 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 
    2423$lang['Please check your email inbox to confirm your subscription.'] = 'Prosím skontrolujte si svoj mail na potvrdenie odberu.';
    25 $lang['You have been added to the list of subscribers for this album.'] = 'Boli ste pridaný do zoznamu odberov tohto albumu.';
    26 $lang['You have been added to the list of subscribers for this picture.'] = 'Boli ste pridaný do zoznamu odberov tejto fotky.';
    2724$lang['Invalid email adress, your are not subscribed to comments.'] = 'Neplatná emailová adresa, neboli ste zapísaný do odberu komentárov.';
    2825$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Úspešné odhlásenie Vašej emailovej adresy z prijímania upozornení.';
    29 $lang['You are currently subscribed to comments.'] = 'Práve ste zapísaný do odberu komentárov.';
    3026$lang['Unsubscribe'] = 'Odhlásiť';
    3127$lang['Subscribe'] = 'Prihlásiť';
    32 $lang['Subscribe without commenting'] = 'Prihlásiť bez komentovania';
    3328$lang['Notify me of followup comments'] = 'Upozorniť ma na nasledovné komentáre';
    34 $lang['Invalid email adress.'] = 'Neplatná emailová adresa.';
    3529$lang['Your subscribtion has been validated, thanks you.'] = 'Vaše prihlásenie bolo potvrdené, ďakujeme.';
    36 $lang['Nothing to validate.'] = 'Nepotvrdené.';
    3730$lang['Subscriptions of'] = 'Prihlásený';
    38 $lang['Unsubscribe from email notification'] = 'Odhlásiť z emailovej notifikácie';
    39 $lang['Only unsubscribe notifications for comments from:'] = 'Len odhlásenie notifikácií pre komentére z:';
    4031$lang['Unsubscribe from all email notifications'] = 'Odhlásenie zo všetkých emailových notofikácií';
    41 $lang['Manage my subscriptions to comments'] = 'Ovládanie mojich prihlásení na odber komentárov';
    42 $lang['Item'] = 'Položka';
    43 $lang['Date'] = 'Dátum';
    4432$lang['You are not subscribed to any comment.'] = 'Nie ste prihlásený na odber žiadneho komentára.';
    4533$lang['Return to item page'] = 'Návrat na stránku položiek';
  • extensions/Subscribe_to_comments/language/uk_UA/plugin.lang.php

    r13379 r15641  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['Date'] = 'Дата';
    2423$lang['Invalid email adress, your are not subscribed to comments.'] = 'Невірна електронна адреса, Ви не підписані на коментарі.';
    25 $lang['Invalid email adress.'] = 'Недійсна адреса електронної пошти.';
    26 $lang['Item'] = 'Елемент';
    27 $lang['Manage my subscriptions to comments'] = 'Управління моєю підпискою на коментарі';
    28 $lang['Nothing to validate.'] = 'Нічого для підтвердження.';
    2924$lang['Notify me of followup comments'] = 'Повідомити мене про нові коментарі';
    30 $lang['Only unsubscribe notifications for comments from:'] = 'Лише відписатись від сповіщення про коментарі від:';
    3125$lang['Please check your email inbox to confirm your subscription.'] = 'Будь ласка, перевірте вашу поштову скриньку, щоб підтвердити підписку.';
    3226$lang['Return to item page'] = 'Повернутися на сторінку елемента';
    3327$lang['Subscribe'] = 'Підписатися';
    34 $lang['Subscribe without commenting'] = 'Підписатися не коментуючи';
    3528$lang['Subscriptions of'] = 'Підписка на';
    3629$lang['Successfully unsubscribed your email address from receiving notifications.'] = 'Ви успішно відписалися від отримання сповіщень.';
    3730$lang['Unsubscribe'] = 'Відписатися від підписки';
    3831$lang['Unsubscribe from all email notifications'] = 'Відписатись від усіх повідомлень по електронній пошті';
    39 $lang['Unsubscribe from email notification'] = 'Відписатись від повідомлень по електронній пошті';
    40 $lang['You are currently subscribed to comments.'] = 'Ви підписані на коментарі.';
    4132$lang['You are not subscribed to any comment.'] = 'Ви не підписані на жоден коментар.';
    42 $lang['You have been added to the list of subscribers for this album.'] = 'Ви були додані до списку передплатників для цього альбому.';
    43 $lang['You have been added to the list of subscribers for this picture.'] = 'Ви були додані до списку передплатників для цього зображення.';
    4433$lang['Your subscribtion has been validated, thanks you.'] = 'Ваша підписка була підтверджена, спасибі вам.';
    4534?>
  • extensions/Subscribe_to_comments/main.inc.php

    r12702 r15641  
    33Plugin Name: Subscribe To Comments
    44Version: auto
    5 Description: This plugin allows you to subscribe to comments by email.
     5Description: This plugin allows to subscribe to comments by email.
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=587
    77Author: Mistic
     
    1313global $prefixeTable;
    1414
    15 define('SUBSCRIBE_TO_DIR' , basename(dirname(__FILE__)));
    16 define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . SUBSCRIBE_TO_DIR . '/');
     15define('SUBSCRIBE_TO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
    1716define('SUBSCRIBE_TO_TABLE', $prefixeTable . 'subscribe_to_comments');
    1817
     
    2120function stc_init()
    2221{
     22  global $conf, $user;
     23 
     24  // no comments on luciano
     25  if ($user['theme'] == 'luciano') return;
     26 
     27  load_language('plugin.lang', SUBSCRIBE_TO_PATH);
     28  $conf['Subscribe_to_Comments'] = unserialize($conf['Subscribe_to_Comments']);
     29 
    2330  include_once(SUBSCRIBE_TO_PATH.'include/functions.inc.php');
    2431  include_once(SUBSCRIBE_TO_PATH.'include/subscribe_to_comments.inc.php');
    25 
    26   load_language('plugin.lang', SUBSCRIBE_TO_PATH);
    2732
    2833  // send mails
     
    3237  // subscribe
    3338  add_event_handler('loc_end_picture', 'stc_on_picture');
    34   add_event_handler('loc_begin_index', 'stc_on_album');
     39  add_event_handler('loc_begin_coa', 'stc_on_album');
    3540
    3641  // management
    3742  add_event_handler('loc_end_section_init', 'stc_detect_section');
    38   add_event_handler('loc_end_index', 'stc_load_section');
     43  add_event_handler('loc_begin_page_header', 'stc_load_section');
    3944
    4045  // profile link
    4146  add_event_handler('loc_begin_profile', 'stc_profile_link');
     47 
     48  // config page
     49  add_event_handler('get_admin_plugin_menu_links', 'stc_admin_menu');
     50}
     51
     52function stc_admin_menu($menu)
     53{
     54  array_push($menu, array(
     55    'NAME' => 'Subscribe to Comments',
     56    'URL' => get_root_url().'admin.php?page=plugin-' . basename(dirname(__FILE__))
     57  ));
     58  return $menu;
    4259}
    4360?>
  • extensions/Subscribe_to_comments/maintain.inc.php

    r12600 r15641  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
     4global $prefixeTable;
     5
     6define('STC_TABLE', $prefixeTable . 'subscribe_to_comments');
     7
     8define(
     9  'stc_default_config',
     10  serialize(array(
     11    'notify_admin_on_subscribe' => false,
     12    'allow_global_subscriptions' => true,
     13    ))
     14  );
     15 
     16
    417function plugin_install()
    518{
    6         global $prefixeTable;
    7 
    819  /* create table to store subscribtions */
    920        pwg_query('
    10 CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'subscribe_to_comments` (
    11   `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    12   `email` VARCHAR( 255 ) NOT NULL ,
    13   `image_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT "0",
    14   `category_id` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT "0",
    15   `registration_date` DATETIME NOT NULL,
    16   `validated` ENUM( "true", "false" ) NOT NULL DEFAULT "false",
    17   UNIQUE KEY `UNIQUE` (`email`, `image_id`, `category_id`)
     21CREATE TABLE IF NOT EXISTS '.STC_TABLE.' (
     22  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
     23  `type` enum("image","album-images","album","all-images","all-albums") NOT NULL DEFAULT "image",
     24  `element_id` mediumint(8) DEFAULT NULL,
     25  `language` varchar(64) NOT NULL,
     26  `email` varchar(255) NOT NULL,
     27  `registration_date` datetime NOT NULL,
     28  `validated` enum("true","false") NOT NULL DEFAULT "false",
     29  PRIMARY KEY (`id`),
     30  UNIQUE KEY `UNIQUE` (`email` , `type` , `element_id`)
    1831) DEFAULT CHARSET=utf8
    1932;');
     33
     34  /* config parameter */
     35  conf_update_param('Subscribe_to_Comments', stc_default_config);
     36
     37}
     38
     39function plugin_activate()
     40{
     41  global $conf;
     42 
     43  // new config in 1.1
     44  if (empty($conf['Subscribe_to_Comments']))
     45  {
     46    conf_update_param('Subscribe_to_Comments', stc_default_config);
     47  }
     48 
     49  // table structure upgrade in 1.1
     50  $result = pwg_query('SHOW COLUMNS FROM '.STC_TABLE.' LIKE "element_id";');
     51  if (!pwg_db_num_rows($result))
     52  {
     53    // backup subscriptions
     54    $query = 'SELECT * FROM '.STC_TABLE.' ORDER BY registration_date;';
     55    $subscriptions = hash_from_query($query, 'id');
     56   
     57    // upgrade the table
     58    pwg_query('TRUNCATE TABLE '.STC_TABLE.';');
     59    pwg_query('ALTER TABLE '.STC_TABLE.' DROP `image_id`, DROP `category_id`;');
     60    pwg_query('ALTER TABLE '.STC_TABLE.' AUTO_INCREMENT = 1;');
     61   
     62    $query = '
     63ALTER TABLE '.STC_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 '.STC_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      }
    2091     
    21   /* config parameter */
    22   // pwg_query('
    23 // INSERT INTO `' . CONFIG_TABLE . '`
    24   // VALUES (
    25     // "Subscribe_to_Comments",
    26     // "'.serialize(array()).'",
    27     // "Configuration for Subscribe_to_Comments plugin"
    28   // )
    29 // ;');
    30 
     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(STC_TABLE, $dbfields, $inserts);
     102    }
     103  }
    31104}
    32105
    33106function plugin_uninstall()
    34107{
    35         global $prefixeTable;
    36  
    37108  /* delete table and config */
    38   pwg_query('DROP TABLE `' . $prefixeTable . 'subscribe_to_comments`;');
    39   // pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = "Subscribe_to_Comments";');
     109  pwg_query('DROP TABLE '.STC_TABLE.';');
     110  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "Subscribe_to_Comments" LIMIT 1;');
    40111}
    41112?>
  • extensions/Subscribe_to_comments/template/index.php

    r12560 r15641  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/Subscribe_to_comments/template/style.css

    r12607 r15641  
    11.subscriptions_list {
    2   width:600px;
    3         border: 1px solid #111;
     2  width:700px;
     3        border-left: 1px solid #444;
     4        border-right: 1px solid #444;
    45        margin: 1em auto;
    56        padding: 0;
    67  background-color:#222;
    7   border-collapse:collapse;
     8  border-spacing:0;
     9  text-align: left;
    810}
    911
    10 .subscriptions_list TD {
     12.subscriptions_list td, .subscriptions_list th {
    1113        padding:5px 5px 2px 5px;
    1214  vertical-align:center;
     15  border-top: 1px solid #444;
     16  border-bottom: 1px solid #111;
     17}
     18  .subscriptions_list .chkb {
     19    text-align:center;
     20  }
     21  .subscriptions_list td.info {
     22    width:200px;
     23    padding-top:2em;
     24    vertical-align:top;
     25  }
     26    .subscriptions_list tr .actions {
     27      display:none;
     28    }
     29    .subscriptions_list tr:hover .actions {
     30      display:block;
     31    }
     32  .subscriptions_list td.date {
     33    width:250px;
     34    padding-top:2em;
     35    vertical-align:top;
     36  }
     37 
     38.subscriptions_list tr.row2 { background-color:#222; }
     39.subscriptions_list tr.row1 { background-color:#333; }
     40
     41.subscriptions_list tr.not-validated { background-color:#433; }
     42
     43.subscriptions_list tr.header th, .subscriptions_list tr.footer td
     44{
     45  height:30px;
     46}
     47.subscriptions_list tr.header th, .subscriptions_list tr.footer.row1 td {
     48 
     49  background: #333333;
     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  background: -webkit-linear-gradient(top,  #333333 0%,#222222 100%);
     53  background: -o-linear-gradient(top,  #333333 0%,#222222 100%);
     54  background: -ms-linear-gradient(top,  #333333 0%,#222222 100%);
     55  background: linear-gradient(top,  #333333 0%,#222222 100%);
     56  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#333333', endColorstr='#222222',GradientType=0 );
     57}
     58.subscriptions_list tr.footer.row2 td {
     59  background: #222222;
     60  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  background: -webkit-linear-gradient(top,  #222222 0%,#333333 100%);
     63  background: -o-linear-gradient(top,  #222222 0%,#333333 100%);
     64  background: -ms-linear-gradient(top,  #222222 0%,#333333 100%);
     65  background: linear-gradient(top,  #222222 0%,#333333 100%);
     66  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222222', endColorstr='#333333',GradientType=0 );
    1367}
    1468
    15 .subscriptions_list TR {
    16         text-align: left;
    17 }
    1869
    19 .row2 { background-color:#222; }
    20 .row1 { background-color:#333; }
    2170
    2271.stc p {
     
    3281  max-height:90px;
    3382}
     83
  • extensions/Subscribe_to_comments/template/subscribtions_page.tpl

    r12607 r15641  
    11{combine_css path=$SUBSCRIBE_TO_PATH|@cat:'template/style.css'}
    22
    3 {$MENUBAR}
     3{if $themeconf.name != "stripped" and $themeconf.parent != "stripped" and $themeconf.name != "simple-grey" and $themeconf.parent != "simple"}
     4  {$MENUBAR}
     5{else}
     6  {assign var="intern_menu" value="true"}
     7{/if}
     8<div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">
     9{if $intern_menu}{$MENUBAR}{/if}
    410
    5 {if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if}
     11<div class="titrePage">
     12  <h2>{'Subscriptions of'|@translate} <i>{$EMAIL}</i></h2>
     13</div>
    614
    7 <div id="content" class="content stc">
    8   <div class="titrePage">
    9     <ul class="categoryActions">
    10       {if !empty($PLUGIN_INDEX_ACTIONS)}{$PLUGIN_INDEX_ACTIONS}{/if}
    11     </ul>
    12     <h2>{'Subscriptions of'|@translate} <i>{$EMAIL}</i></h2>
    13   </div> <!-- titrePage -->
     15{include file='infos_errors.tpl'}
     16 
     17{if $IN_VALIDATE or $IN_UNSUBSCRIBE}
     18<p>
     19  {if !empty($element)}<a href="{$element.url}" title="{$element.name}">{'Return to item page'|@translate}</a><br>{/if}
     20  <a href="{$MANAGE_LINK}">{'Manage my subscriptions to comments'|@translate}</a>
     21</p>
     22{/if}
    1423 
    15   {if !empty($errors)}
    16   <div class="errors">
    17     <ul>
    18       {foreach from=$errors item=error}
    19       <li>{$error}</li>
     24<form action="{$MANAGE_LINK}" method="post">
     25  {if !empty($global_subscriptions)}
     26  <fieldset>
     27    <legend>{'Global subscriptions'|@translate}</legend>
     28    <table class="subscriptions_list">
     29      {foreach from=$global_subscriptions item=sub name=subs_loop}
     30      <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}">
     31        <td>
     32          {if $sub.type == 'all-images'}
     33            <img src="{$SUBSCRIBE_TO_PATH}template/image.png"> {'You are currently subscribed to comments on all pictures of the gallery.'|@translate}
     34          {else $sub.type == 'all-albums'}
     35            <img src="{$SUBSCRIBE_TO_PATH}template/album.png"> {'You are currently subscribed to comments on all albums of the gallery.'|@translate}
     36          {/if}
     37        </td>
     38        <td style="white-space:nowrap;">
     39          <a href="{$MANAGE_LINK}&amp;unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a>
     40          {if $sub.validated == 'false'}<br> <a href="{$MANAGE_LINK}&amp;validate={$sub.id}">{'Validate'|@translate}</a>{/if}
     41        </td>
     42        <td style="white-space:nowrap;">
     43          <i>{$sub.registration_date}</i>
     44        </td>
     45      </tr>
    2046      {/foreach}
    21     </ul>
    22   </div>
    23   {/if}
    24   {if !empty($infos)}
    25   <div class="infos">
    26     <ul>
    27       {foreach from=$infos item=info}
    28       <li>{$info}</li>
    29       {/foreach}
    30     </ul>
    31   </div>
     47    </table>
     48  </fieldset>
    3249  {/if}
    3350 
    34   {if !empty($unsubscribe_form)}
    35   <form action="" method="post">
    36   <fieldset>
    37     <legend>{'Unsubscribe from email notification'|@translate}</legend>
    38    
    39     <p>
    40       <label><input type="radio" name="unsubscribe" value="{$unsubscribe_form}" checked="checked"> {'Only unsubscribe notifications for comments from:'|@translate} <a href="{$element.url}" target="_blank">{$element.name}</a></label>
    41       <label><input type="radio" name="unsubscribe" value="all"> {'Unsubscribe from all email notifications'|@translate}</label>
    42       <br>
    43       <label><input type="submit" value="Unsubscribe notifications for {$EMAIL}"></label>
    44       <a href="{$MANAGE_LINK}">{'Manage my subscriptions'|@translate}</a>
    45     </p>
    46   </fieldset>
    47   </form>
    48   {/if}
    49  
    50   {if !empty($validate)}
    51   <p>
    52     {if empty($errors)}<a href="{$element.url}">{'Return to item page'|@translate}</a><br>{/if}
    53     <a href="{$MANAGE_LINK}">{'Manage my subscriptions'|@translate}</a>
    54   </p>
    55   {/if}
    56  
    57   {if !empty($subscriptions) and $subscriptions != 'none'}
    58   <form action="{$MANAGE_LINK}" method="post">
     51  {if !empty($subscriptions)}
    5952  <fieldset>
    6053    <legend>{'Manage my subscriptions to comments'|@translate}</legend>
    6154    <table class="subscriptions_list">
     55      <tr class="header">
     56        <th class="chkb"><input type="checkbox" id="check_all"></th>
     57        <th colspan="2" class="info">{'Subject'|@translate}</th>
     58        <th class="date">{'Followed on'|@translate}</th>
     59      </tr>
     60     
    6261      {foreach from=$subscriptions item=sub name=subs_loop}
    63       <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}">
    64         <td><img src="{$sub.infos.thumbnail}" alt="{$sub.infos.name}" class="thumbnail"></td>
    65         <td>
    66           {if $sub.type == 'image'}
    67           <img src="{$SUBSCRIBE_TO_PATH}template/picture.png" alt="(P)">
    68           {else}
    69           <img src="{$SUBSCRIBE_TO_PATH}template/folder_picture.png" alt="(A)">
    70           {/if}
     62      <tr class="{if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if} {if $sub.validated == 'false'}not-validated{/if}">
     63        <td class="chkb"><input type="checkbox" name="selected[]" value="{$sub.id}"></td>
     64        <td class="thumb"><img src="{$sub.infos.thumbnail}" alt="{$sub.infos.name}" class="thumbnail"></td>
     65        <td class="info">
     66          <img src="{$SUBSCRIBE_TO_PATH}template/{$sub.type}.png">
    7167          <a href="{$sub.infos.url}">{$sub.infos.name}</a>
    72           <br>{$sub.registration_date}
     68
     69          <div class="actions">
     70            <a href="{$MANAGE_LINK}&amp;unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a>
     71            {if $sub.validated == 'false'}| <a href="{$MANAGE_LINK}&amp;validate={$sub.id}">{'Validate'|@translate}</a>{/if}
     72          </div>
    7373        </td>
    74         <td><a href="{$MANAGE_LINK}&amp;unsubscribe={$sub.id}">{'Unsubscribe'|@translate}</a></td>
     74        <td class="date">
     75          <i>{$sub.registration_date}</i>
     76        </td>
    7577      </tr>
    7678      {/foreach}
     79     
     80      <tr class="footer {if $smarty.foreach.subs_loop.index is odd}row1{else}row2{/if}"><td colspan="4">
     81        <select name="action">
     82          <option value="-1">{'Choose an action'|@translate}</option>
     83          <option value="unsubscribe">{'Unsubscribe'|@translate}</option>
     84          <option value="validate">{'Validate'|@translate}</option>
     85        </select>
     86        <input type="submit" name="apply_bulk" value="{'Apply action'|@translate}">
     87      </td></tr>
    7788    </table>
    7889   
    7990    <p>
    80       <input type="hidden" name="unsubscribe" value="all">
    81       <input type="submit" value="{'Unsubscribe from all email notifications'|@translate}">
     91      <b>Legend :</b>
     92      <img src="{$SUBSCRIBE_TO_PATH}template/image.png"> {'comments on a picture'|@translate}.
     93      <img src="{$SUBSCRIBE_TO_PATH}template/album-images.png"> {'comments on all pictures of an album'|@translate}.
     94      {if $COA_ACTIVATED}<img src="{$SUBSCRIBE_TO_PATH}template/album.png"> {'comments on an album'|@translate}.{/if}
    8295    </p>
    8396  </fieldset>
    84   {elseif !empty($subscriptions) and $subscriptions == 'none'}
    85   <p>
    86     {'You are not subscribed to any comment.'|@translate}
    87   </p>
    8897  {/if}
     98 
     99  {if !empty($global_subscriptions) or !empty($subscriptions)}
     100    <p>
     101      <label><input type="checkbox" name="unsubscribe_all_check" value="1"> {'Unsubscribe from all email notifications'|@translate}</label>
     102      <input type="submit" name="unsubscribe_all" value="{'Submit'|@translate}">
     103  {/if}
     104</form>
     105
     106{footer_script require="jquery"}{literal}
     107jQuery("#check_all").change(function() {
     108  if ($(this).is(":checked"))
     109    $("input[name^='selected']").attr('checked', 'checked');
     110  else
     111    $("input[name^='selected']").removeAttr('checked');
     112});
     113{/literal}{/footer_script}
    89114
    90115</div> <!-- content -->
    91 
    92 {if !empty($PLUGIN_INDEX_CONTENT_AFTER)}{$PLUGIN_INDEX_CONTENT_AFTER}{/if}
Note: See TracChangeset for help on using the changeset viewer.