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