[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 | |
---|
[5431] | 16 | if(!defined('LMT_DIR')) define('LMT_DIR' , basename(dirname(__FILE__))); |
---|
| 17 | if(!defined('LMT_PATH')) define('LMT_PATH' , PHPWG_PLUGINS_PATH . LMT_DIR . '/'); |
---|
[3396] | 18 | |
---|
| 19 | //ini_set('error_reporting', E_ALL); |
---|
| 20 | //ini_set('display_errors', true); |
---|
| 21 | |
---|
[5548] | 22 | global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility |
---|
[3396] | 23 | |
---|
| 24 | /* ----------------------------------------------------------------------------- |
---|
| 25 | LMT needs the Grum Plugin Classe |
---|
| 26 | ----------------------------------------------------------------------------- */ |
---|
| 27 | $gpc_installed=false; |
---|
[5548] | 28 | $gpcNeeded="3.0.0"; |
---|
| 29 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
[3396] | 30 | { |
---|
[5548] | 31 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
| 32 | // need GPC release greater or equal than 3.0.0 |
---|
| 33 | if(CommonPlugin::checkGPCRelease(3,0,0)) |
---|
[3396] | 34 | { |
---|
| 35 | @include_once('lmt_install.class.inc.php'); |
---|
| 36 | $gpc_installed=true; |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | function gpcMsgError(&$errors) |
---|
| 41 | { |
---|
[5548] | 42 | global $gpcNeeded; |
---|
| 43 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); |
---|
| 44 | if(is_array($errors)) |
---|
| 45 | { |
---|
| 46 | array_push($errors, $msg); |
---|
| 47 | } |
---|
| 48 | else |
---|
| 49 | { |
---|
| 50 | $errors=Array($msg); |
---|
| 51 | } |
---|
[3396] | 52 | } |
---|
| 53 | // ----------------------------------------------------------------------------- |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | load_language('plugin.lang', LMT_PATH); |
---|
| 59 | |
---|
| 60 | |
---|
[5431] | 61 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
[3396] | 62 | { |
---|
[5548] | 63 | global $prefixeTable, $gpc_installed, $gpcNeeded; |
---|
[3396] | 64 | |
---|
| 65 | if($gpc_installed) |
---|
| 66 | { |
---|
| 67 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 68 | $result=$obj->install(); |
---|
| 69 | if(!$result) |
---|
| 70 | { |
---|
| 71 | array_push($errors, "error"); |
---|
| 72 | } |
---|
[5548] | 73 | GPCCore::register($obj->getPluginName(), LMT_VERSION, $gpcNeeded); |
---|
[3396] | 74 | } |
---|
| 75 | else |
---|
| 76 | { |
---|
| 77 | gpcMsgError($errors); |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 82 | { |
---|
| 83 | global $prefixeTable, $gpc_installed; |
---|
| 84 | |
---|
| 85 | if($gpc_installed) |
---|
| 86 | { |
---|
| 87 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 88 | $result=$obj->activate(); |
---|
| 89 | if($result===false or $result!='') |
---|
| 90 | { |
---|
| 91 | if(is_string($result)) |
---|
| 92 | { |
---|
| 93 | array_push($errors, $result); |
---|
| 94 | } |
---|
| 95 | else |
---|
| 96 | { |
---|
| 97 | array_push($errors, ""); |
---|
| 98 | } |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | else |
---|
| 102 | { |
---|
| 103 | gpcMsgError($errors); |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | function plugin_deactivate($plugin_id) |
---|
| 108 | { |
---|
| 109 | /* global $prefixeTable; |
---|
| 110 | $obj = new install_mypolls($prefixeTable, __FILE__); |
---|
| 111 | $obj->deactivate(); */ |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | function plugin_uninstall($plugin_id) |
---|
| 115 | { |
---|
| 116 | global $prefixeTable, $gpc_installed; |
---|
| 117 | |
---|
| 118 | if($gpc_installed) |
---|
| 119 | { |
---|
| 120 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 121 | $obj->uninstall(); |
---|
[5548] | 122 | GPCCore::unregister($obj->getPluginName()); |
---|
[3396] | 123 | } |
---|
| 124 | else |
---|
| 125 | { |
---|
| 126 | gpcMsgError($errors); |
---|
| 127 | } |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | ?> |
---|