Ignore:
Timestamp:
01/16/14 19:30:41 (6 years ago)
Author:
mistic100
Message:

add trigger loc_before_subscribe_to_comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.