Ignore:
Timestamp:
Jan 12, 2013, 3:13:08 PM (11 years ago)
Author:
mistic100
Message:
  • add webservices
  • add mail function
  • add admin list
  • add admin export function
  • try to deal with Gthumb+
  • activate multisize dropdown menu of collection page

TODO : use webservices instead of toggle_image.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/main.inc.php

    r19843 r20090  
    1313global $conf, $prefixeTable;
    1414
    15 define('USER_COLLEC_PATH',       PHPWG_PLUGINS_PATH . 'UserCollections/');
     15defined('USER_COLLEC_ID') or define('USER_COLLEC_ID', basename(dirname(__FILE__)));
     16define('USER_COLLEC_PATH',       PHPWG_PLUGINS_PATH . USER_COLLEC_ID . '/');
    1617define('COLLECTIONS_TABLE',      $prefixeTable.'collections');
    1718define('COLLECTION_IMAGES_TABLE',$prefixeTable.'collection_images');
    18 define('USER_COLLEC_ADMIN',      get_root_url() . 'admin.php?page=plugin-UserCollections');
     19define('USER_COLLEC_ADMIN',      get_root_url() . 'admin.php?page=plugin-' . USER_COLLEC_ID);
    1920define('USER_COLLEC_PUBLIC',     get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/');
    2021define('USER_COLLEC_VERSION',    'auto');
    2122
    22 
    2323add_event_handler('init', 'user_collections_init');
    2424
    25 add_event_handler('loc_end_section_init', 'user_collections_section_init');
    26 add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10);
     25add_event_handler('ws_add_methods', 'user_collections_ws_add_methods');
    2726
    28 add_event_handler('loc_end_index', 'user_collections_index_actions');
    29 add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     27if (defined('IN_ADMIN'))
     28{
     29  add_event_handler('get_admin_plugin_menu_links', 'user_collections_admin_menu');
     30}
     31else
     32{
     33  // collections page
     34  add_event_handler('loc_begin_index', 'user_collections_save_pagination', EVENT_HANDLER_PRIORITY_NEUTRAL-10);
     35  add_event_handler('loc_end_section_init', 'user_collections_section_init');
     36  add_event_handler('loc_end_index', 'user_collections_page', EVENT_HANDLER_PRIORITY_NEUTRAL-10);
    3037
    31 add_event_handler('loc_end_picture', 'user_collections_picture_page');
     38  // thumbnails actions
     39  add_event_handler('loc_end_index', 'user_collections_index_actions');
     40  add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_list', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    3241
    33 add_event_handler('blockmanager_register_blocks', 'user_collections_add_menublock');
    34 add_event_handler('blockmanager_apply', 'user_collections_applymenu');
     42  // picture action
     43  add_event_handler('loc_end_picture', 'user_collections_picture_page');
    3544
     45  // menu
     46  add_event_handler('blockmanager_register_blocks', 'user_collections_add_menublock');
     47  add_event_handler('blockmanager_apply', 'user_collections_applymenu');
     48}
     49
     50require(USER_COLLEC_PATH . 'include/ws_functions.inc.php');
    3651require(USER_COLLEC_PATH . 'include/functions.inc.php');
    3752require(USER_COLLEC_PATH . 'include/UserCollection.class.php');
     
    4459function user_collections_init()
    4560{
    46   global $pwg_loaded_plugins;
     61  global $pwg_loaded_plugins, $conf;
    4762 
    4863  if (
    4964    USER_COLLEC_VERSION == 'auto' or
    50     $pwg_loaded_plugins['UserCollections']['version'] == 'auto' or
    51     version_compare($pwg_loaded_plugins['UserCollections']['version'], USER_COLLEC_VERSION, '<')
     65    $pwg_loaded_plugins[USER_COLLEC_ID]['version'] == 'auto' or
     66    version_compare($pwg_loaded_plugins[USER_COLLEC_ID]['version'], USER_COLLEC_VERSION, '<')
    5267  )
    5368  {
     
    5570    user_collections_install();
    5671   
    57     if ( $pwg_loaded_plugins['UserCollections']['version'] != 'auto' and USER_COLLEC_VERSION != 'auto' )
     72    if ( $pwg_loaded_plugins[USER_COLLEC_ID]['version'] != 'auto' and USER_COLLEC_VERSION != 'auto' )
    5873    {
    5974      $query = '
    6075UPDATE '. PLUGINS_TABLE .'
    6176SET version = "'. USER_COLLEC_VERSION .'"
    62 WHERE id = "UserCollections"';
     77WHERE id = "'. USER_COLLEC_ID .'"';
    6378      pwg_query($query);
    6479     
    65       $pwg_loaded_plugins['UserCollections']['version'] = USER_COLLEC_VERSION;
     80      $pwg_loaded_plugins[USER_COLLEC_ID]['version'] = USER_COLLEC_VERSION;
    6681     
    6782      if (defined('IN_ADMIN'))
     
    7388 
    7489  load_language('plugin.lang', USER_COLLEC_PATH);
     90 
     91  $conf['user_collections'] = unserialize($conf['user_collections']);
     92}
     93
     94/**
     95 * admin plugins menu
     96 */
     97function user_collections_admin_menu($menu)
     98{
     99  array_push($menu, array(
     100    'NAME' => 'User Collections',
     101    'URL' => USER_COLLEC_ADMIN,
     102  ));
     103  return $menu;
    75104}
    76105
Note: See TracChangeset for help on using the changeset viewer.