Ignore:
Timestamp:
Aug 29, 2012, 5:23:25 PM (12 years ago)
Author:
mistic100
Message:

consolidate upgrade process, remote filter_var function (PHP 5.2)

File:
1 edited

Legend:

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

    r17519 r17657  
    1313global $conf, $prefixeTable;
    1414
    15 define('USER_COLLEC_PATH',       PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
     15define('USER_COLLEC_PATH',       PHPWG_PLUGINS_PATH . 'UserCollections/');
    1616define('COLLECTIONS_TABLE',      $prefixeTable.'collections');
    1717define('COLLECTION_IMAGES_TABLE',$prefixeTable.'collection_images');
    18 define('USER_COLLEC_ADMIN',      get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__)));
     18define('USER_COLLEC_ADMIN',      get_root_url() . 'admin.php?page=plugin-UserCollections');
    1919define('USER_COLLEC_PUBLIC',     get_absolute_root_url() . make_index_url(array('section' => 'collections')) . '/');
     20define('USER_COLLEC_VERSION',    '1.0.3');
     21
    2022
    2123add_event_handler('init', 'user_collections_init');
     
    3638require(USER_COLLEC_PATH . 'include/events.inc.php');
    3739
     40
     41/**
     42 * update plugin & load language
     43 */
     44function user_collections_init()
     45{
     46  global $pwg_loaded_plugins;
     47 
     48  if (
     49    $pwg_loaded_plugins['UserCollections']['version'] == 'auto' or
     50    version_compare($pwg_loaded_plugins['UserCollections']['version'], USER_COLLEC_VERSION, '<')
     51  )
     52  {
     53    include_once(USER_COLLEC_PATH . 'include/install.inc.php');
     54    user_collections_install();
     55   
     56    if ($pwg_loaded_plugins['UserCollections']['version'] != 'auto')
     57    {
     58      $query = '
     59UPDATE '. PLUGINS_TABLE .'
     60SET version = "'. USER_COLLEC_VERSION .'"
     61WHERE id = "UserCollections"';
     62      pwg_query($query);
     63     
     64      $pwg_loaded_plugins['UserCollections']['version'] = USER_COLLEC_VERSION;
     65     
     66      if (defined('IN_ADMIN'))
     67      {
     68        $_SESSION['page_infos'][] = 'UserCollections updated to version '. USER_COLLEC_VERSION;
     69      }
     70    }
     71  }
     72 
     73  load_language('plugin.lang', USER_COLLEC_PATH);
     74}
     75
    3876?>
Note: See TracChangeset for help on using the changeset viewer.