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

Revision 5427, 2.0 KB checked in by grum, 10 years ago (diff)

Update the plugin for compatibility with Piwigo 2.1 - use dblayer for sql queries

  • Property svn:executable set to *
Line 
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@include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php');
11
12
13global $gpc_installed, $lang; //needed for plugin manager compatibility
14
15/* -----------------------------------------------------------------------------
16AMM needs the Grum Plugin Classe
17----------------------------------------------------------------------------- */
18$gpc_installed=false;
19if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
20{
21  @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
22  // need GPC release greater or equal than 2.0.5
23
24  if(checkGPCRelease(2,0,5))
25  {
26    @include_once("amm_install.class.inc.php");
27    $gpc_installed=true;
28  }
29}
30
31function gpcMsgError(&$errors)
32{
33  array_push($errors, sprintf(l10n('Grum Plugin Classes is not installed (release >= %s)'), "2.0.5"));
34}
35// -----------------------------------------------------------------------------
36
37
38
39load_language('plugin.lang', AMM_PATH);
40
41function plugin_install($plugin_id, $plugin_version, &$errors)
42{
43  global $prefixeTable, $gpc_installed;
44  if($gpc_installed)
45  {
46    //$menu->register('mbAMM_links', 'Links', 0, 'AMM');
47    //$menu->register('mbAMM_randompict', 'Random pictures', 0, 'AMM');
48    $amm=new AMM_install($prefixeTable, __FILE__);
49    $result=$amm->install();
50  }
51  else
52  {
53    gpcMsgError($errors);
54  }
55}
56
57function plugin_activate($plugin_id, $plugin_version, &$errors)
58{
59  global $prefixeTable;
60
61  $amm=new AMM_install($prefixeTable, __FILE__);
62  $result=$amm->activate();
63}
64
65function plugin_deactivate($plugin_id)
66{
67}
68
69function plugin_uninstall($plugin_id)
70{
71  global $prefixeTable;
72  if($gpc_installed)
73  {
74    $amm=new AMM_install($prefixeTable, __FILE__);
75    $result=$amm->uninstall();
76  }
77  else
78  {
79    gpcMsgError($errors);
80  }
81}
82
83
84
85?>
Note: See TracBrowser for help on using the repository browser.