source: extensions/lmt/maintain.inc.php @ 5548

Last change on this file since 5548 was 5548, checked in by grum, 14 years ago

Update the plugin for compatibility with Piwigo 2.1

  • Property svn:executable set to *
File size: 3.0 KB
Line 
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
14if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
15
16if(!defined('LMT_DIR')) define('LMT_DIR' , basename(dirname(__FILE__)));
17if(!defined('LMT_PATH')) define('LMT_PATH' , PHPWG_PLUGINS_PATH . LMT_DIR . '/');
18
19//ini_set('error_reporting', E_ALL);
20//ini_set('display_errors', true);
21
22global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility
23
24/* -----------------------------------------------------------------------------
25LMT needs the Grum Plugin Classe
26----------------------------------------------------------------------------- */
27$gpc_installed=false;
28$gpcNeeded="3.0.0";
29if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'))
30{
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))
34  {
35    @include_once('lmt_install.class.inc.php');
36    $gpc_installed=true;
37  }
38}
39
40function gpcMsgError(&$errors)
41{
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  }
52}
53// -----------------------------------------------------------------------------
54
55
56
57
58load_language('plugin.lang', LMT_PATH);
59
60
61function plugin_install($plugin_id, $plugin_version, &$errors)
62{
63  global $prefixeTable, $gpc_installed, $gpcNeeded;
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    }
73    GPCCore::register($obj->getPluginName(), LMT_VERSION, $gpcNeeded);
74  }
75  else
76  {
77    gpcMsgError($errors);
78  }
79}
80
81function 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
107function plugin_deactivate($plugin_id)
108{
109/*  global $prefixeTable;
110  $obj = new install_mypolls($prefixeTable, __FILE__);
111  $obj->deactivate(); */
112}
113
114function 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();
122    GPCCore::unregister($obj->getPluginName());
123  }
124  else
125  {
126    gpcMsgError($errors);
127  }
128}
129
130
131?>
Note: See TracBrowser for help on using the repository browser.