source: extensions/Register_FluxBB/trunk/maintain.inc.php @ 10977

Revision 10977, 1.8 KB checked in by Eric, 9 years ago (diff)

using conf_update_param() and pwg_db_real_escape_string()

  • Property svn:eol-style set to LF
Line 
1<?php
2
3if (!defined('REGFLUXBB_PATH')) define('REGFLUXBB_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
4//ini_set('error_reporting', E_ALL);
5//ini_set('display_errors', true);
6
7include_once (PHPWG_ROOT_PATH.'/include/constants.php');
8include_once (REGFLUXBB_PATH.'include/constants.php');
9include_once (REGFLUXBB_PATH.'include/functions.inc.php');
10
11
12function plugin_install()
13{
14  global $prefixeTable;
15
16  $q = '
17INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
18VALUES ("Register_FluxBB","FluxBB_;PhpWebGallery;Guest;false;false;true;false;0","Parametres Register_FluxBB")
19;';
20   
21  pwg_query($q);
22 
23  $q = "
24CREATE TABLE IF NOT EXISTS ".Register_FluxBB_ID_TABLE." (
25  id_user_pwg smallint(5) NOT NULL default '0',
26  id_user_FluxBB int(10) NOT NULL default '0',
27PRIMARY KEY  (id_user_pwg),
28  KEY id_user_pwg (id_user_pwg, id_user_FluxBB)
29)
30;";
31
32  pwg_query($q);
33
34}
35
36function plugin_activate()
37{
38  global $conf;
39
40/* Cleaning obsolete files */
41/* *********************** */
42  regfluxbb_obsolete_files();
43
44/* Check version < 2.3.0 */
45  $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array();
46 
47  if (!isset($conf_Register_FluxBB[6]) and !isset($conf_Register_FluxBB[7]))
48  {
49    $upgrade_RFBB = $conf_Register_FluxBB[0].';'.$conf_Register_FluxBB[1].';'.$conf_Register_FluxBB[2].';'.$conf_Register_FluxBB[3].';'.$conf_Register_FluxBB[4].';'.$conf_Register_FluxBB[5].';false;0';
50
51    conf_update_param('Register_FluxBB', pwg_db_real_escape_string($upgrade_RFBB));
52  }
53}
54
55function plugin_uninstall()
56{
57  global $conf;
58
59  if (isset($conf['Register_FluxBB']))
60  {
61    $q = '
62DELETE FROM '.CONFIG_TABLE.'
63WHERE param="Register_FluxBB" LIMIT 1
64;';
65
66    pwg_query($q);
67  }
68 
69  $q = 'DROP TABLE '.Register_FluxBB_ID_TABLE.';';
70  pwg_query( $q );
71
72}
73?>
Note: See TracBrowser for help on using the repository browser.