[26635] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: See photos by user |
---|
| 4 | Version: auto |
---|
| 5 | Description: See photos by user |
---|
[26636] | 6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=723 |
---|
[26635] | 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 . '/'); |
---|
[27391] | 15 | load_language('plugin.lang', SPBA_PATH); |
---|
[26635] | 16 | |
---|
[27391] | 17 | add_event_handler('blockmanager_apply' , 'add_link_SPBA'); |
---|
[26635] | 18 | function add_link_SPBA($menu_ref_arr) |
---|
[26643] | 19 | { |
---|
[26635] | 20 | global $conf, $user; |
---|
| 21 | $menu = & $menu_ref_arr[0]; |
---|
| 22 | if (($block = $menu->get_block('mbSpecials')) != null) |
---|
[26643] | 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 |
---|
[27391] | 28 | ('user-' => |
---|
[26643] | 29 | array |
---|
| 30 | ( |
---|
[27391] | 31 | 'URL' => make_index_url(array('section' => 'user-')), |
---|
[26643] | 32 | 'TITLE' => l10n('See photos by user'), |
---|
| 33 | 'NAME' => l10n('See photos by user') |
---|
| 34 | ) |
---|
| 35 | ) |
---|
| 36 | ); |
---|
| 37 | } |
---|
| 38 | } |
---|
[26635] | 39 | |
---|
[27391] | 40 | add_event_handler('loc_end_section_init', 'section_init_SPBA'); |
---|
[26635] | 41 | function section_init_SPBA() |
---|
| 42 | { |
---|
[27391] | 43 | global $tokens; |
---|
[27392] | 44 | $testa = explode('user-', $_SERVER['REQUEST_URI']); |
---|
| 45 | if (!empty ($testa[1])) |
---|
| 46 | { |
---|
| 47 | $testd= explode('/', $testa[1]); |
---|
| 48 | $me = 'user-'.$testd[0]; |
---|
| 49 | } |
---|
[27391] | 50 | else |
---|
| 51 | {$me = 'user-';} |
---|
| 52 | |
---|
| 53 | if (in_array($me, $tokens)) |
---|
| 54 | include(SPBA_PATH . 'pagespba.php'); |
---|
[26635] | 55 | } |
---|
| 56 | |
---|
| 57 | |
---|
[27391] | 58 | add_event_handler('get_admin_plugin_menu_links', 'SPBA_admin_menu'); |
---|
| 59 | function SPBA_admin_menu($menu) |
---|
| 60 | { |
---|
| 61 | array_push( |
---|
| 62 | $menu, |
---|
| 63 | array( |
---|
| 64 | 'NAME' => l10n('See photos by user'), |
---|
| 65 | 'URL' => get_admin_plugin_menu_link(SPBA_PATH . 'admin.php') |
---|
| 66 | //'URL' => get_root_url().'admin.php?page=plugin-See_photos_by_user' |
---|
| 67 | ) |
---|
| 68 | ); |
---|
| 69 | |
---|
| 70 | return $menu; |
---|
| 71 | } |
---|
[26635] | 72 | |
---|
| 73 | ?> |
---|