Ignore:
Timestamp:
Jul 8, 2012, 5:02:01 PM (12 years ago)
Author:
icy
Message:

Version 2.0.0, advance ACL . Code copied from git/master.

I could not use merging with git svn . Stupidly copy-&-paste ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Icy_Picture_Modify/main.inc.php

    r16356 r16495  
    22/*
    33Plugin Name: Icy Modify Picture
    4 Version: 1.1.2
     4Version: 2.0.0
    55Description: Allow users to modify pictures they uploaded
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=563
     
    1414}
    1515
    16 # Should be ./plugins/icy_picture_modify/
    1716define('ICY_PICTURE_MODIFY_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    18 include_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php');
     17require_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php');
    1918
    20 # Hooks declaration
     19# Variable declarations ################################################
     20
     21global $ICY_ACL;
     22
     23# Hooks declarations ###################################################
    2124
    2225add_event_handler('loc_end_section_init', 'icy_picture_modify_section_init');
    23 add_event_handler('loc_end_index', 'icy_picture_modify_index');
     26remove_event_handler('loc_end_index', 'community_index');
     27add_event_handler('loc_end_index', 'icy_picture_modify_index', 40);
     28
    2429add_event_handler('loc_begin_picture', 'icy_picture_modify_loc_begin_picture');
     30add_event_handler('init','icy_picture_modify_fix_community_acl', 40);
     31# add_event_handler('login_success', );
    2532
    26 # Hooks definitions
     33add_event_handler('blockmanager_apply', 'icy_picture_modify_fix_community_acl', 40);
     34add_event_handler('ws_invoke_allowed', 'icy_picture_modify_fix_community_acl', 40);
     35add_event_handler('ws_add_methods', 'icy_picture_modify_fix_community_acl', 40);
     36add_event_handler('community_ws_categories_getList', 'icy_picture_modify_fix_community_acl', 40);
     37add_event_handler('sendResponse', 'icy_picture_modify_fix_community_acl', 40);
     38
     39# Hooks definitions ####################################################
     40
     41function icy_picture_modify_fix_community_acl()
     42{
     43  icy_acl_fix_community(icy_acl_load_configuration());
     44}
    2745
    2846function icy_picture_modify_section_init()
     
    4058  global $page;
    4159
    42   if (isset($page['section']) and $page['section'] == 'icy_picture_modify')
     60  if (! isset($page['section'])) {
     61    return TRUE;
     62  }
     63
     64  if ($page['section'] == 'icy_picture_modify')
    4365  {
    4466    include(ICY_PICTURE_MODIFY_PATH.'icy_picture_modify.php');
     67  }
     68  elseif ($page['section'] == 'add_photos') {
     69    icy_picture_modify_fix_community_acl(TRUE);
     70    include(ICY_PICTURE_MODIFY_PATH.'add_photos.php');
    4571  }
    4672}
     
    5177{
    5278  global $conf, $template, $page, $user;
    53   if ((!is_admin()) and icy_check_image_owner($page['image_id'], $user['id']))
     79
     80  icy_acl_load_configuration();
     81
     82  if (icy_image_editable($page['image_id']))
    5483  {
    5584    $url_admin =
Note: See TracChangeset for help on using the changeset viewer.