source: extensions/mypolls/maintain.inc.php @ 32882

Last change on this file since 32882 was 3680, checked in by grum, 15 years ago

Update MyPolls to 2.1.0 alpha-2
Minor changes (ajax management is modified to be compatible with AMM 2.1.0)

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : MyPolls.2
4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.dnsalias.com
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
16define('MYPOLLS_DIR' , basename(dirname(__FILE__)));
17define('MYPOLLS_PATH' , PHPWG_PLUGINS_PATH . MYPOLLS_DIR . '/');
18
19//ini_set('error_reporting', E_ALL);
20//ini_set('display_errors', true);
21
22global $gpc_installed, $lang; //needed for plugin manager compatibility
23
24/* -----------------------------------------------------------------------------
25MyPolls-2 needs the Grum Plugin Classe
26----------------------------------------------------------------------------- */
27$gpc_installed=false;
28if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'))
29{
30  @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php');
31  // need GPC release greater or equal than 2.0.3
32  if(checkGPCRelease(2,0,3))
33  {
34    @include_once('mypolls_install.class.inc.php');
35    $gpc_installed=true;
36  }
37}
38
39function gpcMsgError(&$errors)
40{
41  array_push($errors, sprintf(l10n('mypolls_gpc2_not_installed'), "2.0.3"));
42}
43// -----------------------------------------------------------------------------
44
45
46
47
48load_language('plugin.lang', MYPOLLS_PATH);
49
50
51function plugin_install($plugin_id, $plugin_version, &$errors)
52{
53  global $prefixeTable, $gpc_installed;
54
55  if($gpc_installed)
56  {
57    $obj = new MyPolls_Install($prefixeTable, __FILE__);
58    $result=$obj->install();
59    if(!$result)
60    {
61      array_push($errors, "error");
62    }
63  }
64  else
65  {
66    gpcMsgError($errors);
67  }
68}
69
70function plugin_activate($plugin_id, $plugin_version, &$errors)
71{
72  global $prefixeTable, $gpc_installed;
73
74  if($gpc_installed)
75  {
76    $obj = new MyPolls_Install($prefixeTable, __FILE__);
77    $result=$obj->activate();
78    if($result===false or $result!='')
79    {
80      if(is_string($result))
81      {
82        array_push($errors, $result);
83      }
84      else
85      {
86        array_push($errors, "");
87      }
88    }
89  }
90  else
91  {
92    gpcMsgError($errors);
93  }
94}
95
96function plugin_deactivate($plugin_id)
97{
98/*  global $prefixeTable;
99  $obj = new install_mypolls($prefixeTable, __FILE__);
100  $obj->deactivate(); */
101}
102
103function plugin_uninstall($plugin_id)
104{
105  global $prefixeTable, $gpc_installed;
106
107  if($gpc_installed)
108  {
109    $obj = new MyPolls_Install($prefixeTable, __FILE__);
110    $obj->uninstall();
111  }
112  else
113  {
114    gpcMsgError($errors);
115  }
116}
117
118
119?>
Note: See TracBrowser for help on using the repository browser.