[3396] | 1 | <?php |
---|
| 2 | /* ----------------------------------------------------------------------------- |
---|
| 3 | Plugin : LMT |
---|
| 4 | Author : Grum |
---|
| 5 | email : grum@piwigo.org |
---|
| 6 | website : http://photos.grum.fr |
---|
| 7 | |
---|
| 8 | << May the Little SpaceFrog be with you ! >> |
---|
| 9 | ------------------------------------------------------------------------------ |
---|
| 10 | See main.inc.php for release information |
---|
| 11 | |
---|
| 12 | --------------------------------------------------------------------------- */ |
---|
| 13 | |
---|
| 14 | if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } |
---|
| 15 | |
---|
[7560] | 16 | include_once('lmt_version.inc.php'); // => Don't forget to update this file !! |
---|
| 17 | |
---|
[5431] | 18 | if(!defined('LMT_DIR')) define('LMT_DIR' , basename(dirname(__FILE__))); |
---|
| 19 | if(!defined('LMT_PATH')) define('LMT_PATH' , PHPWG_PLUGINS_PATH . LMT_DIR . '/'); |
---|
[3396] | 20 | |
---|
| 21 | //ini_set('error_reporting', E_ALL); |
---|
| 22 | //ini_set('display_errors', true); |
---|
| 23 | |
---|
[7560] | 24 | global $gpcInstalled, $lang; //needed for plugin manager compatibility |
---|
[3396] | 25 | |
---|
| 26 | /* ----------------------------------------------------------------------------- |
---|
[7560] | 27 | LMT needs the Grum Plugin Classes |
---|
[3396] | 28 | ----------------------------------------------------------------------------- */ |
---|
[7560] | 29 | $gpcInstalled=false; |
---|
[5548] | 30 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
[3396] | 31 | { |
---|
[5548] | 32 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
[7560] | 33 | // need GPC release greater or equal than ... |
---|
| 34 | if(CommonPlugin::checkGPCRelease(LMT_GPC_NEEDED)) |
---|
[3396] | 35 | { |
---|
| 36 | @include_once('lmt_install.class.inc.php'); |
---|
[7560] | 37 | $gpcInstalled=true; |
---|
[3396] | 38 | } |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | function gpcMsgError(&$errors) |
---|
| 42 | { |
---|
[5548] | 43 | global $gpcNeeded; |
---|
| 44 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); |
---|
| 45 | if(is_array($errors)) |
---|
| 46 | { |
---|
| 47 | array_push($errors, $msg); |
---|
| 48 | } |
---|
| 49 | else |
---|
| 50 | { |
---|
| 51 | $errors=Array($msg); |
---|
| 52 | } |
---|
[3396] | 53 | } |
---|
| 54 | // ----------------------------------------------------------------------------- |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | load_language('plugin.lang', LMT_PATH); |
---|
| 60 | |
---|
| 61 | |
---|
[5431] | 62 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
[3396] | 63 | { |
---|
[7560] | 64 | global $prefixeTable, $gpcInstalled; |
---|
| 65 | if(!$gpcInstalled) |
---|
[3396] | 66 | { |
---|
[7560] | 67 | gpcMsgError($errors, 'gpc'); |
---|
| 68 | return(false); |
---|
[3396] | 69 | } |
---|
[7560] | 70 | |
---|
| 71 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 72 | $result=$obj->install(); |
---|
[3396] | 73 | } |
---|
| 74 | |
---|
| 75 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 76 | { |
---|
[7560] | 77 | global $prefixeTable, $gpcInstalled; |
---|
[3396] | 78 | |
---|
[7560] | 79 | if($gpcInstalled) |
---|
[3396] | 80 | { |
---|
| 81 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 82 | $result=$obj->activate(); |
---|
| 83 | } |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | function plugin_deactivate($plugin_id) |
---|
| 87 | { |
---|
[7560] | 88 | global $prefixeTable, $gpcInstalled; |
---|
| 89 | |
---|
| 90 | if($gpcInstalled) |
---|
| 91 | { |
---|
| 92 | $obj=new LMT_Install($prefixeTable, __FILE__); |
---|
| 93 | $obj->deactivate(); |
---|
| 94 | } |
---|
[3396] | 95 | } |
---|
| 96 | |
---|
| 97 | function plugin_uninstall($plugin_id) |
---|
| 98 | { |
---|
[7560] | 99 | global $prefixeTable, $gpcInstalled; |
---|
[3396] | 100 | |
---|
[7560] | 101 | if($gpcInstalled) |
---|
[3396] | 102 | { |
---|
| 103 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 104 | $obj->uninstall(); |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | ?> |
---|