source: extensions/Icy_Picture_Modify/trunk/main.inc.php @ 11608

Revision 11608, 1.6 KB checked in by icy, 9 years ago (diff)

Move all files to trunk

Line 
1<?php
2/*
3Plugin Name: Icy User Modify Picture
4Version: 1.0.0
5Description: Allow users to modify users they uploaded
6Plugin URI: https://github.com/icy/icy_picture_modify
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
20add_event_handler('loc_end_section_init', 'icy_picture_modify_section_init');
21function 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
31add_event_handler('loc_end_index', 'icy_picture_modify_index');
32function 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
43add_event_handler('loc_begin_picture', 'icy_picture_modify_loc_begin_picture');
44function 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      .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
52      .'&amp;image_id='.$page['image_id'];
53
54    $template->assign(
55      array(
56        'U_ADMIN' => $url_admin,
57        )
58      );
59  }
60}
61
62?>
Note: See TracBrowser for help on using the repository browser.