Ignore:
Timestamp:
Aug 23, 2014, 1:03:08 PM (10 years ago)
Author:
mistic100
Message:

update for 2.7

File:
1 edited

Legend:

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

    r23177 r29253  
    44Version: auto
    55Description: Add a link on picture's page to show a alternative version of the pic (for postcards for example)
    6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=533
     6Plugin URI: auto
    77Author: Mistic
    88Author URI: http://www.strangeplanet.fr
    99*/
    1010
    11 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     11defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
     12
    1213global $prefixeTable;
    1314
    14 defined('B2F_ID') or define('B2F_ID', basename(dirname(__FILE__)));
    15 define('B2F_PATH', PHPWG_PLUGINS_PATH . B2F_ID . '/');
     15define('B2F_ID',    basename(dirname(__FILE__)));
     16define('B2F_PATH',  PHPWG_PLUGINS_PATH . B2F_ID . '/');
    1617define('B2F_TABLE', $prefixeTable . 'image_verso');
    17 define('B2F_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . B2F_ID);
    18 define('B2F_VERSION', 'auto');
     18define('B2F_ADMIN', get_root_url() . 'admin.php?page=plugin-' . B2F_ID);
    1919
    2020include_once(B2F_PATH . 'include/Back2Front.php');
    2121
     22
    2223add_event_handler('init', 'back2front_init');
     24
    2325
    2426function back2front_init()
    2527{
    26   global $conf, $pwg_loaded_plugins;
     28  global $conf;
    2729 
    28   if (
    29     B2F_VERSION == 'auto' or
    30     $pwg_loaded_plugins[B2F_ID]['version'] == 'auto' or
    31     version_compare($pwg_loaded_plugins[B2F_ID]['version'], B2F_VERSION, '<')
    32   )
    33   {
    34     include_once(B2F_PATH . 'include/install.inc.php');
    35     back2front_install();
    36    
    37     if ( $pwg_loaded_plugins[B2F_ID]['version'] != 'auto' and B2F_VERSION != 'auto' )
    38     {
    39       $query = '
    40 UPDATE '. PLUGINS_TABLE .'
    41 SET version = "'. B2F_VERSION .'"
    42 WHERE id = "'. B2F_ID .'"';
    43       pwg_query($query);
    44      
    45       $pwg_loaded_plugins[B2F_ID]['version'] = B2F_VERSION;
    46      
    47       if (defined('IN_ADMIN'))
    48       {
    49         $_SESSION['page_infos'][] = 'Back2Front updated to version '. B2F_VERSION;
    50       }
    51     }
    52   }
    53  
    54   $conf['back2front'] = unserialize($conf['back2front']);
     30  $conf['back2front'] = safe_unserialize($conf['back2front']);
     31
    5532  load_language('plugin.lang', B2F_PATH);
    5633}
     34
    5735
    5836if (script_basename() == 'picture')
     
    8058  }
    8159}
    82 
    83 ?>
Note: See TracChangeset for help on using the changeset viewer.