[11607] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Icy User Modify Picture |
---|
| 4 | Version: 1.0.0 |
---|
| 5 | Description: Allow users to modify users they uploaded |
---|
| 6 | Plugin URI: https://github.com/icy/icy_picture_modify |
---|
| 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 | |
---|
| 20 | add_event_handler('loc_end_section_init', 'icy_picture_modify_section_init'); |
---|
| 21 | function icy_picture_modify_section_init() |
---|
| 22 | { |
---|
| 23 | global $tokens, $page; |
---|
| 24 | |
---|
| 25 | if ($tokens[0] == 'icy_picture_modify') |
---|
| 26 | { |
---|
| 27 | $page['section'] = 'icy_picture_modify'; |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | add_event_handler('loc_end_index', 'icy_picture_modify_index'); |
---|
| 32 | function icy_picture_modify_index() |
---|
| 33 | { |
---|
| 34 | global $page; |
---|
| 35 | |
---|
| 36 | if (isset($page['section']) and $page['section'] == 'icy_picture_modify') |
---|
| 37 | { |
---|
| 38 | include(ICY_PICTURE_MODIFY_PATH.'icy_picture_modify.php'); |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | // provide the link to modify the picture |
---|
| 43 | add_event_handler('loc_begin_picture', 'icy_picture_modify_loc_begin_picture'); |
---|
| 44 | function icy_picture_modify_loc_begin_picture() |
---|
| 45 | { |
---|
| 46 | global $conf, $template, $page, $user; |
---|
| 47 | if ((!is_admin()) and icy_check_image_owner($page['image_id'], $user['id'])) |
---|
| 48 | { |
---|
| 49 | $url_admin = |
---|
| 50 | get_root_url().'index.php?/icy_picture_modify' |
---|
| 51 | .'&cat_id='.(isset($page['category']) ? $page['category']['id'] : '') |
---|
| 52 | .'&image_id='.$page['image_id']; |
---|
| 53 | |
---|
| 54 | $template->assign( |
---|
| 55 | array( |
---|
| 56 | 'U_ADMIN' => $url_admin, |
---|
| 57 | ) |
---|
| 58 | ); |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | ?> |
---|