source: extensions/UserStat/maintain.inc.php @ 5116

Last change on this file since 5116 was 4270, checked in by grum, 15 years ago

[UserStat] Adding a directory for the plugin UserStat

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : UserStat
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//ini_set('error_reporting', E_ALL);
14//ini_set('display_errors', true);
15
16if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
17
18define('USERSTAT_DIR' , basename(dirname(__FILE__)));
19define('USERSTAT_PATH' , PHPWG_PLUGINS_PATH . USERSTAT_DIR . '/');
20
21
22global $gpc_installed, $lang; //needed for plugin manager compatibility
23
24/* -----------------------------------------------------------------------------
25AStat-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.1
32  if(checkGPCRelease(2,0,1))
33  {
34    @include_once("userstat_aim.class.inc.php");
35    $gpc_installed=true;
36  }
37}
38
39function gpcMsgError(&$errors)
40{
41  array_push($errors, sprintf(l10n('us_gpc2_not_installed'), "2.0.1"));
42}
43// -----------------------------------------------------------------------------
44
45
46load_language('plugin.lang', USERSTAT_PATH);
47
48function plugin_install($plugin_id, $plugin_version, &$errors)
49{
50  global $prefixeTable, $gpc_installed;
51  if($gpc_installed)
52  {
53    $obj = new UserStat_AIM($prefixeTable, __FILE__);
54    $obj->delete_config();
55    $obj->init_config();
56    $obj->save_config();
57  }
58  else
59  {
60    gpcMsgError($errors);
61  }
62}
63
64function plugin_activate($plugin_id, $plugin_version, &$errors)
65{
66  global $prefixeTable, $gpc_installed;
67  if($gpc_installed)
68  {
69    $obj = new UserStat_AIM($prefixeTable, __FILE__);
70    $obj->init_config();
71    $obj->load_config();
72    $obj->save_config();
73  }
74  else
75  {
76    gpcMsgError($errors);
77  }
78}
79
80function plugin_deactivate($plugin_id)
81{
82}
83
84function plugin_uninstall($plugin_id)
85{
86  global $prefixeTable, $gpc_installed;
87  if($gpc_installed)
88  {
89    $obj = new UserStat_AIM($prefixeTable, __FILE__);
90    $obj->delete_config();
91  }
92  else
93  {
94    gpcMsgError($errors);
95  }
96}
97
98
99
100?>
Note: See TracBrowser for help on using the repository browser.