Changeset 28714


Ignore:
Timestamp:
Jun 18, 2014, 9:51:42 PM (10 years ago)
Author:
rvelices
Message:

since number of accepted args not required for add_event_handler, simplify calls

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/add_core_tabs.inc.php

    r26461 r28714  
    2222// +-----------------------------------------------------------------------+
    2323
    24 add_event_handler('tabsheet_before_select', 'add_core_tabs', 0, 2);
     24add_event_handler('tabsheet_before_select', 'add_core_tabs', 0);
    2525
    2626function add_core_tabs($sheets, $tab_id)
     
    3535      $sheets['notification'] = array('caption' => '<span class="icon-mail-alt"></span>'.l10n('Notification'), 'url' => $admin_album_base_url.'-notification');
    3636      break;
    37      
     37
    3838    case 'albums':
    3939      global $my_base_url;
     
    4242      $sheets['permalinks'] = array('caption' => '<span class="icon-link"></span>'.l10n('Permalinks'), 'url' => $my_base_url.'permalinks');
    4343      break;
    44      
     44
    4545    case 'batch_manager':
    4646      global $manager_link;
     
    4848      $sheets['unit'] = array('caption' => l10n('unit mode'), 'url' => $manager_link.'unit');
    4949      break;
    50      
     50
    5151    case 'cat_options':
    5252      global $link_start, $conf;
     
    5858        $sheets['representative'] = array('caption' => l10n('Representative'), 'url' => $link_start.'cat_options&amp;section=representative');
    5959      break;
    60      
     60
    6161    case 'comments':
    6262      $sheets[''] = array('caption' => l10n('User comments'), 'url' => '');
     
    8080      $sheets['default'] = array('caption' => l10n('Guest Settings'), 'url' => $conf_link.'default');
    8181      break;
    82      
     82
    8383    case 'help':
    8484      global $help_link;
     
    8989      $sheets['misc'] = array('caption' => l10n('Miscellaneous'), 'url' => $help_link.'misc');
    9090      break;
    91      
     91
    9292    case 'history':
    9393      global $link_start;
     
    9595      $sheets['history'] = array('caption' => '<span class="icon-search"></span>'.l10n('Search'), 'url' => $link_start.'history');
    9696      break;
    97      
     97
    9898    case 'languages':
    9999      global $my_base_url;
     
    102102      $sheets['new'] = array('caption' => '<span class="icon-plus-circled"></span>'.l10n('Add New Language'), 'url' => $my_base_url.'&amp;tab=new');
    103103      break;
    104      
     104
    105105    case 'nbm':
    106106      global $base_url;
     
    109109      $sheets['send'] = array('caption' => l10n('Send'), 'url' => $base_url.'?page=notification_by_mail&amp;mode=send');
    110110      break;
    111      
     111
    112112    case 'photo':
    113113      global $admin_photo_base_url;
     
    115115      $sheets['coi'] = array('caption' => '<span class="icon-crop"></span>'.l10n('Center of interest'), 'url' => $admin_photo_base_url.'-coi');
    116116      break;
    117      
     117
    118118    case 'photos_add':
    119119      global $conf;
     
    123123        $sheets['ftp'] = array('caption' => '<span class="icon-exchange"></span>'.l10n('FTP + Synchronization'), 'url' => PHOTOS_ADD_BASE_URL.'&amp;section=ftp');
    124124      break;
    125      
     125
    126126    case 'plugins':
    127127      global $my_base_url;
     
    130130      $sheets['new'] = array('caption' => '<span class="icon-plus-circled"></span>'.l10n('Other plugins'), 'url' => $my_base_url.'&amp;tab=new');
    131131      break;
    132      
     132
    133133    case 'rating':
    134134      $sheets['rating'] = array('caption' => l10n('Photos'), 'url' => get_root_url().'admin.php?page=rating');
    135135      $sheets['rating_user'] = array('caption' => l10n('Users'), 'url' => get_root_url().'admin.php?page=rating_user');
    136136      break;
    137      
     137
    138138    case 'themes':
    139139      global $my_base_url;
     
    142142      $sheets['new'] = array('caption' => '<span class="icon-plus-circled"></span>'.l10n('Add New Theme'), 'url' => $my_base_url.'&amp;tab=new');
    143143      break;
    144      
     144
    145145    case 'updates':
    146146      global $my_base_url;
     
    149149      break;
    150150  }
    151  
     151
    152152  return $sheets;
    153153}
  • trunk/admin/include/functions_history.inc.php

    r28587 r28714  
    7272    $search['image_ids'] = array_from_query($query, 'id');
    7373  }
    74  
     74
    7575  // echo '<pre>'; print_r($search); echo '</pre>';
    76  
     76
    7777  $clauses = array();
    7878
     
    9090  {
    9191    $local_clauses = array();
    92    
     92
    9393    foreach ($types as $type) {
    9494      if (in_array($type, $search['fields']['types'])) {
     
    102102          $clause.= "= '".$type."'";
    103103        }
    104        
     104
    105105        $local_clauses[] = $clause;
    106106      }
    107107    }
    108    
     108
    109109    if (count($local_clauses) > 0)
    110110    {
     
    123123    $clauses[] = 'image_id = '.$search['fields']['image_id'];
    124124  }
    125  
     125
    126126  if (isset($search['fields']['filename']))
    127127  {
     
    141141    $clauses[] = 'IP LIKE "'.$search['fields']['ip'].'"';
    142142  }
    143  
     143
    144144  $clauses = prepend_append_array_items($clauses, '(', ')');
    145145
     
    149149      $clauses
    150150      );
    151  
     151
    152152  $query = '
    153153SELECT
     
    177177}
    178178
    179 add_event_handler('get_history', 'get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
     179add_event_handler('get_history', 'get_history');
    180180trigger_notify('functions_history_included');
    181181
  • trunk/admin/include/functions_upload.inc.php

    r26461 r28714  
    2626
    2727// add default event handler for image and thumbnail resize
    28 add_event_handler('upload_image_resize', 'pwg_image_resize', EVENT_HANDLER_PRIORITY_NEUTRAL, 7);
    29 add_event_handler('upload_thumbnail_resize', 'pwg_image_resize', EVENT_HANDLER_PRIORITY_NEUTRAL, 9);
     28add_event_handler('upload_image_resize', 'pwg_image_resize');
     29add_event_handler('upload_thumbnail_resize', 'pwg_image_resize');
    3030
    3131function get_upload_form_config()
     
    127127          $min, $max
    128128          );
    129        
     129
    130130        $form_errors[$field] = '['.$min.' .. '.$max.']';
    131131      }
     
    261261
    262262    prepare_directory(dirname($representative_file_path));
    263    
     263
    264264    $exec = $conf['ext_imagick_dir'].'convert';
    265265
     
    268268      $exec .= ' -quality 98';
    269269    }
    270    
     270
    271271    $exec .= ' "'.realpath($file_path).'"';
    272272
    273273    $dest = pathinfo($representative_file_path);
    274274    $exec .= ' "'.realpath($dest['dirname']).'/'.$dest['basename'].'"';
    275    
     275
    276276    $exec .= ' 2>&1';
    277277    @exec($exec, $returnarray);
     
    287287        $representative_file_abspath
    288288        );
    289      
     289
    290290      if (file_exists($first_file_abspath))
    291291      {
     
    323323  $rotation_angle = pwg_image::get_rotation_angle($file_path);
    324324  $rotation = pwg_image::get_rotation_code_from_angle($rotation_angle);
    325  
     325
    326326  $file_infos = pwg_image_infos($file_path);
    327327
     
    412412  $thumb_url = preg_replace('#admin/include/i#', 'i', DerivativeImage::thumb_url($image_infos));
    413413  unset_make_full_url();
    414  
     414
    415415  fetchRemote($thumb_url, $dest);
    416  
     416
    417417
    418418  return $image_id;
  • trunk/include/common.inc.php

    r28587 r28714  
    270270if ( !empty($conf['original_url_protection']) )
    271271{
    272   add_event_handler('get_element_url', 'get_element_url_protection_handler', EVENT_HANDLER_PRIORITY_NEUTRAL, 2 );
    273   add_event_handler('get_src_image_url', 'get_src_image_url_protection_handler', EVENT_HANDLER_PRIORITY_NEUTRAL, 2 );
     272  add_event_handler('get_element_url', 'get_element_url_protection_handler');
     273  add_event_handler('get_src_image_url', 'get_src_image_url_protection_handler');
    274274}
    275275trigger_notify('init');
  • trunk/include/functions_comment.inc.php

    r28587 r28714  
    2525 * @package functions\comment
    2626 */
    27  
    28 
    29 add_event_handler('user_comment_check', 'user_comment_check',
    30   EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     27
     28
     29add_event_handler('user_comment_check', 'user_comment_check');
    3130
    3231/**
     
    144143    $_POST['cr'][] = 'key'; // rvelices: I use this outside to see how spam robots work
    145144  }
    146  
     145
    147146  // website
    148147  if (!empty($comm['website_url']))
     
    159158    }
    160159  }
    161  
     160
    162161  // email
    163162  if (empty($comm['email']))
     
    178177    $comment_action='reject';
    179178  }
    180  
     179
    181180  // anonymous id = ip address
    182181  $ip_components = explode('.', $comm['ip']);
     
    284283    $user_where_clause = '   AND author_id = \''.$GLOBALS['user']['id'].'\'';
    285284  }
    286  
     285
    287286  if (is_array($comment_id))
    288287    $where_clause = 'id IN('.implode(',', $comment_id).')';
    289288  else
    290289    $where_clause = 'id = '.$comment_id;
    291    
     290
    292291  $query = '
    293292DELETE FROM '.COMMENTS_TABLE.'
     
    295294$user_where_clause.'
    296295;';
    297  
     296
    298297  if ( pwg_db_changes(pwg_query($query)) )
    299298  {
    300299    invalidate_user_cache_nb_comments();
    301300
    302     email_admin('delete', 
     301    email_admin('delete',
    303302                array('author' => $GLOBALS['user']['username'],
    304303                      'comment_id' => $comment_id
     
    384383;';
    385384    $result = pwg_query($query);
    386    
     385
    387386    // mail admin and ask to validate the comment
    388     if ($result and $conf['email_admin_on_comment_validation'] and 'moderate' == $comment_action) 
     387    if ($result and $conf['email_admin_on_comment_validation'] and 'moderate' == $comment_action)
    389388    {
    390389      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     
    412411    }
    413412  }
    414  
     413
    415414  return $comment_action;
    416415}
     
    483482    }
    484483  }
    485  
     484
    486485  list($author_id) = pwg_db_fetch_row($result);
    487486
     
    500499  else
    501500    $where_clause = 'id = '.$comment_id;
    502    
     501
    503502  $query = '
    504503UPDATE '.COMMENTS_TABLE.'
     
    508507;';
    509508  pwg_query($query);
    510  
     509
    511510  invalidate_user_cache_nb_comments();
    512511  trigger_notify('user_comment_validation', $comment_id);
  • trunk/include/functions_user.inc.php

    r28587 r28714  
    251251    {
    252252      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    253            
     253
    254254      $keyargs_content = array(
    255255        get_l10n_args('Hello %s,', stripslashes($login)),
     
    263263        get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()),
    264264        );
    265        
     265
    266266      pwg_mail(
    267267        $mail_address,
     
    282282        )
    283283      );
    284      
     284
    285285    return $user_id;
    286286  }
     
    10511051        return true;
    10521052      }
    1053      
     1053
    10541054      // Rehash using new hash.
    10551055      $hash = pwg_password_hash($password);
     
    10891089}
    10901090
    1091 add_event_handler('try_log_user', 'pwg_login', EVENT_HANDLER_PRIORITY_NEUTRAL, 4);
     1091add_event_handler('try_log_user', 'pwg_login');
    10921092
    10931093/**
     
    14481448}
    14491449
    1450 /** 
     1450/**
    14511451 * Returns sql WHERE condition for recent photos/albums for current user.
    14521452 *
  • trunk/picture.php

    r28640 r28714  
    136136
    137137// add default event handler for rendering element content
    138 add_event_handler(
    139   'render_element_content',
    140   'default_picture_content',
    141   EVENT_HANDLER_PRIORITY_NEUTRAL,
    142   2
    143   );
     138add_event_handler('render_element_content', 'default_picture_content');
    144139// add default event handler for rendering element description
    145140add_event_handler('render_element_description', 'nl2br');
Note: See TracChangeset for help on using the changeset viewer.