source: extensions/Icy_Picture_Modify/main.inc.php @ 15907

Last change on this file since 15907 was 12034, checked in by icy, 13 years ago

Merge branch 'master' into svn

File size: 1.7 KB
Line 
1<?php
2/*
3Plugin Name: Icy Modify Picture
4Version: 1.1.0
5Description: Allow users to modify pictures they uploaded
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=563
7Author: icy
8Author URI: http://metakyanh.sarovar.org/
9*/
10
11if (!defined('PHPWG_ROOT_PATH'))
12{
13  die('Hacking attempt!');
14}
15
16# Should be ./plugins/icy_picture_modify/
17define('ICY_PICTURE_MODIFY_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
18include_once(ICY_PICTURE_MODIFY_PATH.'include/functions_icy_picture_modify.inc.php');
19
20# Hooks declaration
21
22add_event_handler('loc_end_section_init', 'icy_picture_modify_section_init');
23add_event_handler('loc_end_index', 'icy_picture_modify_index');
24add_event_handler('loc_begin_picture', 'icy_picture_modify_loc_begin_picture');
25
26# Hooks definitions
27
28function 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
38function 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
49// FIXME: Why use $page['image_id'] instead of $_GET['image_id']
50function 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      .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
58      .'&amp;image_id='.$page['image_id'];
59
60    $template->assign(
61      array(
62        'U_ADMIN' => $url_admin,
63        )
64      );
65  }
66}
67
68?>
Note: See TracBrowser for help on using the repository browser.