1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: See photos by user |
---|
4 | Version: auto |
---|
5 | Description: See photos by user |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=723 |
---|
7 | Author: ddtddt |
---|
8 | Author URI: |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
12 | |
---|
13 | define('SPBA_DIR' , basename(dirname(__FILE__))); |
---|
14 | define('SPBA_PATH' , PHPWG_PLUGINS_PATH . SPBA_DIR . '/'); |
---|
15 | load_language('plugin.lang', SPBA_PATH); |
---|
16 | |
---|
17 | add_event_handler('blockmanager_apply' , 'add_link_SPBA'); |
---|
18 | function add_link_SPBA($menu_ref_arr) |
---|
19 | { |
---|
20 | global $conf, $user; |
---|
21 | $menu = & $menu_ref_arr[0]; |
---|
22 | if (($block = $menu->get_block('mbSpecials')) != null) |
---|
23 | { |
---|
24 | load_language('plugin.lang', SPBA_PATH); |
---|
25 | $position = (isset($conf['SPBA_position']) and is_numeric($conf['SPBA_position'])) ? $conf['SPBA_position'] : count($block->data)+1; |
---|
26 | array_splice |
---|
27 | ($block->data, $position-1, 0, array |
---|
28 | ('user-' => |
---|
29 | array |
---|
30 | ( |
---|
31 | 'URL' => make_index_url(array('section' => 'user-')), |
---|
32 | 'TITLE' => l10n('See photos by user'), |
---|
33 | 'NAME' => l10n('See photos by user') |
---|
34 | ) |
---|
35 | ) |
---|
36 | ); |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | add_event_handler('loc_end_section_init', 'section_init_SPBA'); |
---|
41 | function section_init_SPBA() |
---|
42 | { |
---|
43 | global $tokens; |
---|
44 | $testd = explode('user-', $_SERVER['REQUEST_URI']); |
---|
45 | if (!empty ($testd[1])) |
---|
46 | {$me = 'user-'.$testd[1];} |
---|
47 | else |
---|
48 | {$me = 'user-';} |
---|
49 | |
---|
50 | if (in_array($me, $tokens)) |
---|
51 | include(SPBA_PATH . 'pagespba.php'); |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | add_event_handler('get_admin_plugin_menu_links', 'SPBA_admin_menu'); |
---|
56 | function SPBA_admin_menu($menu) |
---|
57 | { |
---|
58 | array_push( |
---|
59 | $menu, |
---|
60 | array( |
---|
61 | 'NAME' => l10n('See photos by user'), |
---|
62 | 'URL' => get_admin_plugin_menu_link(SPBA_PATH . 'admin.php') |
---|
63 | //'URL' => get_root_url().'admin.php?page=plugin-See_photos_by_user' |
---|
64 | ) |
---|
65 | ); |
---|
66 | |
---|
67 | return $menu; |
---|
68 | } |
---|
69 | |
---|
70 | ?> |
---|