source: extensions/see_photos_by_user/main.inc.php @ 27391

Last change on this file since 27391 was 27391, checked in by ddtddt, 10 years ago

[extensions] - see_photos_by_user - new options

File size: 1.7 KB
Line 
1<?php
2/*
3Plugin Name: See photos by user
4Version: auto
5Description: See photos by user
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=723
7Author: ddtddt
8Author URI:
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('SPBA_DIR' , basename(dirname(__FILE__)));
14define('SPBA_PATH' , PHPWG_PLUGINS_PATH . SPBA_DIR . '/');
15load_language('plugin.lang', SPBA_PATH);
16
17add_event_handler('blockmanager_apply' , 'add_link_SPBA');
18function 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
40add_event_handler('loc_end_section_init', 'section_init_SPBA');
41function section_init_SPBA()
42{
43 global $tokens;
44$testd = explode('user-', $_SERVER['REQUEST_URI']); 
45if (!empty ($testd[1]))
46{$me = 'user-'.$testd[1];}
47else
48{$me = 'user-';}
49
50 if (in_array($me, $tokens))
51 include(SPBA_PATH . 'pagespba.php');
52}
53
54
55add_event_handler('get_admin_plugin_menu_links', 'SPBA_admin_menu');
56function 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?>
Note: See TracBrowser for help on using the repository browser.