[11610] | 1 | <?php |
---|
| 2 | /* |
---|
[11611] | 3 | Plugin Name: Icy Modify Picture |
---|
[11614] | 4 | Version: 1.0.2 |
---|
| 5 | Description: Allow users to modify pictures they uploaded |
---|
[11612] | 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=563 |
---|
[11610] | 7 | Author: icy |
---|
| 8 | Author URI: http://metakyanh.sarovar.org/ |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 12 | { |
---|
| 13 | die('Hacking attempt!'); |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | # Should be ./plugins/icy_picture_modify/ |
---|
| 17 | define('ICY_PICTURE_MODIFY_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
| 18 | include_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php'); |
---|
| 19 | |
---|
[11612] | 20 | # Hooks declaration |
---|
| 21 | |
---|
[11610] | 22 | add_event_handler('loc_end_section_init', 'icy_picture_modify_section_init'); |
---|
[11612] | 23 | add_event_handler('loc_end_index', 'icy_picture_modify_index'); |
---|
| 24 | add_event_handler('loc_begin_picture', 'icy_picture_modify_loc_begin_picture'); |
---|
| 25 | |
---|
| 26 | # Hooks definitions |
---|
| 27 | |
---|
[11610] | 28 | function icy_picture_modify_section_init() |
---|
| 29 | { |
---|
| 30 | global $tokens, $page; |
---|
| 31 | |
---|
| 32 | if ($tokens[0] == 'icy_picture_modify') |
---|
| 33 | { |
---|
| 34 | $page['section'] = 'icy_picture_modify'; |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | function icy_picture_modify_index() |
---|
| 39 | { |
---|
| 40 | global $page; |
---|
| 41 | |
---|
| 42 | if (isset($page['section']) and $page['section'] == 'icy_picture_modify') |
---|
| 43 | { |
---|
| 44 | include(ICY_PICTURE_MODIFY_PATH.'icy_picture_modify.php'); |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | // provide the link to modify the picture |
---|
[11612] | 49 | // FIXME: Why use $page['image_id'] instead of $_GET['image_id'] |
---|
[11610] | 50 | function icy_picture_modify_loc_begin_picture() |
---|
| 51 | { |
---|
| 52 | global $conf, $template, $page, $user; |
---|
| 53 | if ((!is_admin()) and icy_check_image_owner($page['image_id'], $user['id'])) |
---|
| 54 | { |
---|
| 55 | $url_admin = |
---|
| 56 | get_root_url().'index.php?/icy_picture_modify' |
---|
| 57 | .'&cat_id='.(isset($page['category']) ? $page['category']['id'] : '') |
---|
| 58 | .'&image_id='.$page['image_id']; |
---|
| 59 | |
---|
| 60 | $template->assign( |
---|
| 61 | array( |
---|
| 62 | 'U_ADMIN' => $url_admin, |
---|
| 63 | ) |
---|
| 64 | ); |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | ?> |
---|