[7196] | 1 | <?php |
---|
| 2 | /* ----------------------------------------------------------------------------- |
---|
| 3 | Plugin : Advanced Search Engine |
---|
| 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 | |
---|
| 16 | include_once('ase_version.inc.php'); // => Don't forget to update this file !! |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | if(!defined('ASE_DIR')) define('ASE_DIR' , basename(dirname(__FILE__))); |
---|
| 20 | if(!defined('ASE_PATH')) define('ASE_PATH' , PHPWG_PLUGINS_PATH . ASE_DIR . '/'); |
---|
| 21 | |
---|
| 22 | //ini_set('error_reporting', E_ALL); |
---|
| 23 | //ini_set('display_errors', true); |
---|
| 24 | |
---|
| 25 | global $gpcInstalled, $lang; //needed for plugin manager compatibility |
---|
| 26 | |
---|
| 27 | /* ----------------------------------------------------------------------------- |
---|
| 28 | ASE needs the Grum Plugin Classes |
---|
| 29 | ----------------------------------------------------------------------------- */ |
---|
| 30 | $gpcInstalled=false; |
---|
| 31 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
| 32 | { |
---|
| 33 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
| 34 | if(CommonPlugin::checkGPCRelease(ASE_GPC_NEEDED)) |
---|
| 35 | { |
---|
| 36 | @include_once('ase_install.class.inc.php'); |
---|
| 37 | $gpcInstalled=true; |
---|
| 38 | } |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | function gpcMsgError(&$errors) |
---|
| 42 | { |
---|
| 43 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), ASE_GPC_NEEDED); |
---|
| 44 | if(is_array($errors)) |
---|
| 45 | { |
---|
| 46 | array_push($errors, $msg); |
---|
| 47 | } |
---|
| 48 | else |
---|
| 49 | { |
---|
| 50 | $errors=Array($msg); |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | // ----------------------------------------------------------------------------- |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | load_language('plugin.lang', ASE_PATH); |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
| 62 | { |
---|
| 63 | global $prefixeTable, $gpcInstalled; |
---|
| 64 | if(!$gpcInstalled) |
---|
| 65 | { |
---|
| 66 | gpcMsgError($errors, 'gpc'); |
---|
| 67 | return(false); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | $ase=new ASE_Install($prefixeTable, __FILE__); |
---|
| 71 | $result=$ase->install(); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 75 | { |
---|
| 76 | global $prefixeTable, $gpcInstalled; |
---|
| 77 | if($gpcInstalled) |
---|
| 78 | { |
---|
| 79 | $ase = new ASE_Install($prefixeTable, __FILE__); |
---|
| 80 | $result=$ase->activate(); |
---|
| 81 | } |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | function plugin_deactivate($plugin_id) |
---|
| 85 | { |
---|
| 86 | global $prefixeTable, $gpcInstalled; |
---|
| 87 | |
---|
| 88 | if($gpcInstalled) |
---|
| 89 | { |
---|
| 90 | $ase=new ASE_Install($prefixeTable, __FILE__); |
---|
| 91 | $ase->deactivate(); |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | function plugin_uninstall($plugin_id) |
---|
| 97 | { |
---|
| 98 | global $prefixeTable, $gpcInstalled; |
---|
| 99 | if($gpcInstalled) |
---|
| 100 | { |
---|
| 101 | $ase=new ASE_Install($prefixeTable, __FILE__); |
---|
| 102 | $result=$ase->uninstall(); |
---|
| 103 | } |
---|
| 104 | else |
---|
| 105 | { |
---|
| 106 | gpcMsgError($errors, 'gpc'); |
---|
| 107 | } |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | ?> |
---|