Changeset 26816


Ignore:
Timestamp:
Jan 16, 2014, 7:30:41 PM (7 years ago)
Author:
mistic100
Message:

add trigger loc_before_subscribe_to_comments

Location:
extensions/Subscribe_to_comments/include
Files:
2 edited

Legend:

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

    r26144 r26816  
    5353        {
    5454          case 'all-images':
    55             subscribe_to_comments(@$_POST['email'], 'all-images');
     55            subscribe_to_comments(@$_POST['email'], 'all-images', null, false);
    5656            break;
    5757          case 'album-images':
    5858            if (!empty($page['category']['id']))
    5959            {
    60               subscribe_to_comments(@$_POST['email'], 'album-images', $page['category']['id']);
     60              subscribe_to_comments(@$_POST['email'], 'album-images', $page['category']['id'], false);
    6161            }
    6262            break;
    6363          case 'image':
    64             subscribe_to_comments(@$_POST['email'], 'image', $comm['image_id']);
     64            subscribe_to_comments(@$_POST['email'], 'image', $comm['image_id'], false);
    6565            break;
    6666        }
     
    7171        {
    7272          case 'all-albums':
    73             subscribe_to_comments(@$_POST['email'], 'all-albums');
     73            subscribe_to_comments(@$_POST['email'], 'all-albums', null, false);
    7474            break;
    7575          case 'album':
    76             subscribe_to_comments(@$_POST['email'], 'album', $comm['category_id']);
     76            subscribe_to_comments(@$_POST['email'], 'album', $comm['category_id'], false);
    7777            break;
    7878        }
  • extensions/Subscribe_to_comments/include/functions.inc.php

    r26144 r26816  
    152152 * @return: bool
    153153 */
    154 function subscribe_to_comments($email, $type, $element_id='NULL')
     154function subscribe_to_comments($email, $type, $element_id=null, $spam_check=true)
    155155{
    156156  if (empty($type))
     
    160160  }
    161161
    162   if (!in_array($type, array('all-images','all-albums')) and $element_id == 'NULL')
     162  if (!in_array($type, array('all-images','all-albums')) and !isset($element_id))
    163163  {
    164164    trigger_error('subscribe_to_comment: missing element_id', E_USER_WARNING);
     
    182182  {
    183183    $email = $user['email'];
     184  }
     185 
     186  // spam check
     187  if ($spam_check)
     188  {
     189    if (!trigger_change('loc_before_subscribe_to_comments', true, $email, $type, $element_id))
     190    {
     191      return false;
     192    }
    184193  }
    185194
     
    190199  WHERE
    191200    type = "'.$type.'"
    192     AND element_id = '.$element_id.'
     201    AND element_id = '. (isset($element_id) ? $element_id : 'NULL') .'
    193202    AND email = "'.pwg_db_real_escape_string($email).'"
    194203;';
     
    211220  VALUES(
    212221    "'.$type.'",
    213     '.$element_id.',
     222    '. (isset($element_id) ? $element_id : 'NULL') .',
    214223    "'.$user['language'].'",
    215224    "'.pwg_db_real_escape_string($email).'",
Note: See TracChangeset for help on using the changeset viewer.