source: extensions/AMenuManager/maintain.inc.php @ 14919

Last change on this file since 14919 was 10255, checked in by grum, 13 years ago

bug:2144
Compatibility with Piwigo 2.2 (fix css problem + GPC 3.5 needed)

  • Property svn:executable set to *
File size: 2.3 KB
RevLine 
[3681]1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
4
5//ini_set('error_reporting', E_ALL);
6//ini_set('display_errors', true);
7
8defined('AMM_DIR') || define('AMM_DIR' , basename(dirname(__FILE__)));
9defined('AMM_PATH') || define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/');
10
[5545]11include_once('amm_version.inc.php'); // => Don't forget to update this file !!
[3681]12
13
[8962]14global $gpcInstalled, $lang; //needed for plugin manager compatibility
[5545]15
[3681]16/* -----------------------------------------------------------------------------
17AMM needs the Grum Plugin Classe
18----------------------------------------------------------------------------- */
[8962]19$gpcInstalled=false;
[5545]20if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
[3681]21{
[5545]22  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
[10255]23  // need GPC release greater or equal than AMM_GPC_NEEDED
24  if(CommonPlugin::checkGPCRelease(AMM_GPC_NEEDED))
[3681]25  {
[8994]26    include_once("amm_install.class.inc.php");
[8962]27    $gpcInstalled=true;
[3681]28  }
29}
30
31function gpcMsgError(&$errors)
32{
[8962]33  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), AMM_GPC_NEEDED);
[5545]34  if(is_array($errors))
35  {
36    array_push($errors, $msg);
37  }
38  else
39  {
40    $errors=Array($msg);
41  }
[3681]42}
43// -----------------------------------------------------------------------------
44
45
46
47load_language('plugin.lang', AMM_PATH);
48
[8962]49
50
[3681]51function plugin_install($plugin_id, $plugin_version, &$errors)
52{
[8962]53  global $prefixeTable, $gpcInstalled;
54  if($gpcInstalled)
[3681]55  {
56    $amm=new AMM_install($prefixeTable, __FILE__);
57    $result=$amm->install();
58  }
59  else
60  {
61    gpcMsgError($errors);
62  }
63}
64
65function plugin_activate($plugin_id, $plugin_version, &$errors)
66{
[8962]67  global $prefixeTable, $gpcInstalled;
68  if($gpcInstalled)
69  {
70    $amm=new AMM_install($prefixeTable, __FILE__);
71    $result=$amm->activate();
72  }
[3681]73}
74
75function plugin_deactivate($plugin_id)
76{
[8962]77  global $prefixeTable, $gpcInstalled;
78
79  if($gpcInstalled)
80  {
81    $amm=new AMM_install($prefixeTable, __FILE__);
82    $amm->deactivate();
83  }
[3681]84}
85
86function plugin_uninstall($plugin_id)
87{
[8962]88  global $prefixeTable, $gpcInstalled;
89  if($gpcInstalled)
[3681]90  {
91    $amm=new AMM_install($prefixeTable, __FILE__);
92    $result=$amm->uninstall();
93  }
94  else
95  {
96    gpcMsgError($errors);
97  }
98}
99
100
101?>
Note: See TracBrowser for help on using the repository browser.