source: extensions/see_my_photos/main.inc.php @ 26641

Revision 26641, 1.4 KB checked in by ddtddt, 6 years ago (diff)

[extensions] - see_my_photos

Line 
1<?php
2/*
3Plugin Name: See My Photos
4Version: auto
5Description: See photos I've added
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=722
7Author: ddtddt
8Author URI:
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13
14define('SMP_DIR' , basename(dirname(__FILE__)));
15define('SMP_PATH' , PHPWG_PLUGINS_PATH . SMP_DIR . '/');
16
17add_event_handler('blockmanager_apply' , 'add_link_SMP');
18add_event_handler('loc_end_section_init', 'section_init_SMP');
19
20
21function add_link_SMP($menu_ref_arr)
22 {
23  global $conf, $user;
24   $query = '
25  SELECT DISTINCT(id)
26  FROM '.IMAGES_TABLE.'
27  INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
28  WHERE added_by = \''.$user['id'].'\'
29;';
30  $result = pwg_query($query);
31  $row = pwg_db_fetch_assoc($result);
32 if (!is_a_guest() and !empty($row))
33  { 
34  $menu = & $menu_ref_arr[0];
35  if (($block = $menu->get_block('mbSpecials')) != null)
36   {
37   load_language('plugin.lang', SMP_PATH);
38   $position = (isset($conf['SMP_position']) and is_numeric($conf['SMP_position'])) ? $conf['SMP_position'] : count($block->data)+1;
39   array_splice($block->data, $position-1, 0, array('see_my_photos' =>
40      array(
41        'URL' => make_index_url(array('section' => 'see_my_photos')),
42        'TITLE' => l10n('My photos'),
43        'NAME' => l10n('My photos')
44        )
45      )
46    );
47   }
48        }
49}
50
51function section_init_SMP()
52 {
53 global $tokens;
54  if (in_array('see_my_photos', $tokens))
55  include(SMP_PATH . 'pagessmp.php');
56 }
57
58
59?>
Note: See TracBrowser for help on using the repository browser.