source: extensions/Register_FluxBB/maintain.inc.php @ 21497

Last change on this file since 21497 was 21424, checked in by Eric, 11 years ago

Next version is 2.5.0 :

  • Compliance with Piwigo 2.5
  • Core code refactory : Plugin's configuration vars are now serialized in database
  • Admin panel refactory : No more tabs
  • Admin panel refactory : Clear and dark administration theme compatibility
  • English language reference review and improved
  • Compliance improved with FluxBB 1.5 - Register_FluxBB is still compatible with 1.2 and 1.4 FluxBB forums
  • Update tr_TR, thanks to : LazBoy
  • Update it_IT, thanks to : Ericnet
  • Update pl_PL, thanks to : K.S.
  • Property svn:eol-style set to LF
File size: 2.7 KB
Line 
1<?php
2if(!defined('REGFLUXBB_PATH'))
3{
4  define('REGFLUXBB_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
5}
6
7include_once (PHPWG_ROOT_PATH.'/include/constants.php');
8include_once (REGFLUXBB_PATH.'include/functions.inc.php');
9
10function plugin_install()
11{
12  global $prefixeTable, $conf;
13
14  // Set current plugin version in config table
15  $plugin =  RegFluxBB_Infos(REGFLUXBB_PATH);
16  $version = $plugin['version'];
17
18  // Default global parameters for RegisterFluxBB conf
19  // -------------------------------------------------
20  $defaultRegFluxBB = array(
21    'REGFLUXBB_VERSION' => $version,
22    'FLUXBB_PREFIX'     => '',
23    'FLUXBB_ADMIN'      => '',
24    'FLUXBB_GUEST'      => '',
25    'FLUXBB_DEL_PT'     => 'false',
26    'FLUXBB_CONFIRM'    => 'false',
27    'FLUXBB_DETAIL'     => 'false',
28    'FLUXBB_UAM_LINK'   => 'false',
29    'FLUXBB_GROUP'      => ''
30  );
31
32  // Create RegisterFluxBB conf if not already exists
33  // ------------------------------------------------
34        $query = '
35SELECT param
36  FROM '.CONFIG_TABLE.'
37WHERE param = "Register_FluxBB"
38;';
39  $count = pwg_db_num_rows(pwg_query($query));
40 
41  if ($count == 0)
42  {
43    $q = '
44INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
45VALUES ("Register_FluxBB","'.pwg_db_real_escape_string(serialize($defaultRegFluxBB)).'","Register_FluxBB parameters")
46  ;';
47    pwg_query($q);
48  }
49
50  // Create relation table between FluxBB and Piwigo
51  // -----------------------------------------------
52  $q = '
53CREATE TABLE IF NOT EXISTS '.Register_FluxBB_ID_TABLE.' (
54  id_user_pwg smallint(5) NOT NULL default "0",
55  id_user_FluxBB int(10) NOT NULL default "0",
56PRIMARY KEY  (id_user_pwg),
57  KEY id_user_pwg (id_user_pwg, id_user_FluxBB)
58)
59;';
60
61  pwg_query($q);
62
63}
64
65function plugin_activate()
66{
67  global $conf;
68
69/* Cleaning obsolete files */
70/* *********************** */
71  regfluxbb_obsolete_files();
72
73include_once (REGFLUXBB_PATH.'include/upgradedb.inc.php');
74
75/* Database upgrade */
76/* **************** */
77  $conf_RegFluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
78
79  if (isset($conf_RegFluxBB[0]) and strpos($conf_RegFluxBB[0],"{") === false) /* Version < 2.5.0 */
80  {
81    upgrade_240_250();
82  }
83
84/* Update plugin version number in #_config table */
85/* and check consistency of #_plugins table       */
86/* ********************************************** */
87  RegFluxBB_version_update();
88
89/* Reload plugin parameters */
90/* ************************ */
91  load_conf_from_db('param like \'Register_FluxBB\'');
92}
93
94function plugin_uninstall()
95{
96  global $conf;
97
98  if (isset($conf['Register_FluxBB']))
99  {
100    $q = '
101DELETE FROM '.CONFIG_TABLE.'
102WHERE param="Register_FluxBB" LIMIT 1
103;';
104
105    pwg_query($q);
106  }
107
108  $q = 'DROP TABLE '.Register_FluxBB_ID_TABLE.';';
109  pwg_query( $q );
110
111}
112?>
Note: See TracBrowser for help on using the repository browser.