[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 | |
---|
[7560] | 41 | |
---|
[3396] | 42 | function gpcMsgError(&$errors) |
---|
| 43 | { |
---|
[5548] | 44 | global $gpcNeeded; |
---|
| 45 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); |
---|
| 46 | if(is_array($errors)) |
---|
| 47 | { |
---|
| 48 | array_push($errors, $msg); |
---|
| 49 | } |
---|
| 50 | else |
---|
| 51 | { |
---|
| 52 | $errors=Array($msg); |
---|
| 53 | } |
---|
[3396] | 54 | } |
---|
| 55 | // ----------------------------------------------------------------------------- |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | load_language('plugin.lang', LMT_PATH); |
---|
| 61 | |
---|
| 62 | |
---|
[5431] | 63 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
[3396] | 64 | { |
---|
[7560] | 65 | global $prefixeTable, $gpcInstalled; |
---|
| 66 | if(!$gpcInstalled) |
---|
[3396] | 67 | { |
---|
[7560] | 68 | gpcMsgError($errors, 'gpc'); |
---|
| 69 | return(false); |
---|
[3396] | 70 | } |
---|
[7560] | 71 | |
---|
| 72 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 73 | $result=$obj->install(); |
---|
[3396] | 74 | } |
---|
| 75 | |
---|
[7560] | 76 | |
---|
| 77 | |
---|
[3396] | 78 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 79 | { |
---|
[7560] | 80 | global $prefixeTable, $gpcInstalled; |
---|
[3396] | 81 | |
---|
[7560] | 82 | if($gpcInstalled) |
---|
[3396] | 83 | { |
---|
| 84 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 85 | $result=$obj->activate(); |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | |
---|
[7560] | 89 | |
---|
[3396] | 90 | function plugin_deactivate($plugin_id) |
---|
| 91 | { |
---|
[7560] | 92 | global $prefixeTable, $gpcInstalled; |
---|
| 93 | |
---|
| 94 | if($gpcInstalled) |
---|
| 95 | { |
---|
| 96 | $obj=new LMT_Install($prefixeTable, __FILE__); |
---|
| 97 | $obj->deactivate(); |
---|
| 98 | } |
---|
[3396] | 99 | } |
---|
| 100 | |
---|
| 101 | function plugin_uninstall($plugin_id) |
---|
| 102 | { |
---|
[7560] | 103 | global $prefixeTable, $gpcInstalled; |
---|
[3396] | 104 | |
---|
[7560] | 105 | if($gpcInstalled) |
---|
[3396] | 106 | { |
---|
| 107 | $obj = new LMT_Install($prefixeTable, __FILE__); |
---|
| 108 | $obj->uninstall(); |
---|
| 109 | } |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | ?> |
---|