1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Plugin Name : Register_PunBB | |
---|
4 | // | Plugin Version : 1.3a | |
---|
5 | // | File Version : 0.2 | |
---|
6 | // | Plugin Version author : Eric <lucifer@infernoweb.net> | |
---|
7 | // | Plugin description : | |
---|
8 | // | Ce plugin permet l'enregistrement d'un utilisateur directement dans | |
---|
9 | // | PunBB (http://www.punbb.org) - This plugin allows to automatically | |
---|
10 | // | register a PWG user in a PunBB forum (http://www.punbb.org) | |
---|
11 | // +-----------------------------------------------------------------------+ |
---|
12 | // | This program is free software; you can redistribute it and/or modify | |
---|
13 | // | it under the terms of the GNU General Public License as published by | |
---|
14 | // | the Free Software Foundation | |
---|
15 | // | | |
---|
16 | // | This program is distributed in the hope that it will be useful, but | |
---|
17 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
18 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
19 | // | General Public License for more details. | |
---|
20 | // | | |
---|
21 | // | You should have received a copy of the GNU General Public License | |
---|
22 | // | along with this program; if not, write to the Free Software | |
---|
23 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
24 | // | USA. | |
---|
25 | // +-----------------------------------------------------------------------+ |
---|
26 | |
---|
27 | // *************************************** |
---|
28 | // ** Plugin Administration panel setup ** |
---|
29 | // *************************************** |
---|
30 | |
---|
31 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
32 | |
---|
33 | /* ****************************************************** */ |
---|
34 | /* Plugin template initialisation for admin panel display */ |
---|
35 | /* ****************************************************** */ |
---|
36 | |
---|
37 | $me = get_plugin_data($plugin_id); |
---|
38 | |
---|
39 | global $template; |
---|
40 | |
---|
41 | // Setup plugin Language |
---|
42 | $RPlang = ( isset($user['language']) ) ? |
---|
43 | $user['language'] : $conf['default_language']; // en_UK.iso-8859-1 |
---|
44 | $my_path = dirname(__FILE__).'/../'; |
---|
45 | $rp = array(); |
---|
46 | if ( !@file_exists($my_path."language/$RPlang/lang.admin.regpunbb.php") ) |
---|
47 | { |
---|
48 | $SIElang = 'en_UK.iso-8859-1'; |
---|
49 | } |
---|
50 | // Include language |
---|
51 | @include_once( $my_path."language/$RPlang/lang.admin.regpunbb.php" ); |
---|
52 | |
---|
53 | // Load configuration settings from database |
---|
54 | load_conf_from_db('param like \'punbb\\_%\''); |
---|
55 | |
---|
56 | // Update configuration settings in database |
---|
57 | if ( isset($_POST['submit']) ) |
---|
58 | { |
---|
59 | $query = ' |
---|
60 | UPDATE '.CONFIG_TABLE.' |
---|
61 | SET value="'.$_POST['punbb_status'].'" |
---|
62 | WHERE param="punbb_status" |
---|
63 | LIMIT 1'; |
---|
64 | pwg_query($query); |
---|
65 | |
---|
66 | $query = ' |
---|
67 | UPDATE '.CONFIG_TABLE.' |
---|
68 | SET value="'.$_POST['punbb_prefix'].'" |
---|
69 | WHERE param="punbb_prefix" |
---|
70 | LIMIT 1'; |
---|
71 | pwg_query($query); |
---|
72 | |
---|
73 | $query = ' |
---|
74 | UPDATE '.CONFIG_TABLE.' |
---|
75 | SET value="'.$_POST['punbb_id_default_group'].'" |
---|
76 | WHERE param="punbb_id_default_group" |
---|
77 | LIMIT 1'; |
---|
78 | pwg_query($query); |
---|
79 | |
---|
80 | $query = ' |
---|
81 | UPDATE '.CONFIG_TABLE.' |
---|
82 | SET value="'.$_POST['punbb_admin'].'" |
---|
83 | WHERE param="punbb_admin" |
---|
84 | LIMIT 1'; |
---|
85 | pwg_query($query); |
---|
86 | |
---|
87 | $query = ' |
---|
88 | UPDATE '.CONFIG_TABLE.' |
---|
89 | SET value="'.$_POST['punbb_email_setting'].'" |
---|
90 | WHERE param="punbb_email_setting" |
---|
91 | LIMIT 1'; |
---|
92 | pwg_query($query); |
---|
93 | |
---|
94 | $query = ' |
---|
95 | UPDATE '.CONFIG_TABLE.' |
---|
96 | SET value="'.$_POST['punbb_save_pass'].'" |
---|
97 | WHERE param="punbb_save_pass" |
---|
98 | LIMIT 1'; |
---|
99 | pwg_query($query); |
---|
100 | |
---|
101 | $query = ' |
---|
102 | UPDATE '.CONFIG_TABLE.' |
---|
103 | SET value="'.$_POST['punbb_notify_with_post'].'" |
---|
104 | WHERE param="punbb_notify_with_post" |
---|
105 | LIMIT 1'; |
---|
106 | pwg_query($query); |
---|
107 | |
---|
108 | $query = ' |
---|
109 | UPDATE '.CONFIG_TABLE.' |
---|
110 | SET value="'.$_POST['punbb_timezone'].'" |
---|
111 | WHERE param="punbb_timezone" |
---|
112 | LIMIT 1'; |
---|
113 | pwg_query($query); |
---|
114 | |
---|
115 | $query = ' |
---|
116 | UPDATE '.CONFIG_TABLE.' |
---|
117 | SET value="'.$_POST['punbb_language'].'" |
---|
118 | WHERE param="punbb_language" |
---|
119 | LIMIT 1'; |
---|
120 | pwg_query($query); |
---|
121 | |
---|
122 | $query = ' |
---|
123 | UPDATE '.CONFIG_TABLE.' |
---|
124 | SET value="'.$_POST['punbb_style'].'" |
---|
125 | WHERE param="punbb_style" |
---|
126 | LIMIT 1'; |
---|
127 | pwg_query($query); |
---|
128 | |
---|
129 | $query = ' |
---|
130 | UPDATE '.CONFIG_TABLE.' |
---|
131 | SET value="'.$_POST['punbb_del_pt'].'" |
---|
132 | WHERE param="punbb_del_pt" |
---|
133 | LIMIT 1'; |
---|
134 | pwg_query($query); |
---|
135 | |
---|
136 | // Reload settings for correct display after update |
---|
137 | load_conf_from_db('param like \'punbb\\_%\''); |
---|
138 | } |
---|
139 | |
---|
140 | // Users migration from PWG to PunBB |
---|
141 | //TODO: How to insert migration results in pwg template or a new blank window ? |
---|
142 | if ( isset($_POST['Migration']) ) |
---|
143 | { |
---|
144 | include_once (PHPWG_ROOT_PATH.'plugins/Register_Punbb/include/constants.php'); |
---|
145 | include (PHPWG_ROOT_PATH.'plugins/Register_Punbb/reg_punbb_migration.php'); |
---|
146 | } |
---|
147 | |
---|
148 | // Users table synchronization |
---|
149 | //TODO: How to insert synchronization results in pwg template or a new blank window ? |
---|
150 | if ( isset($_POST['Synchro']) ) |
---|
151 | { |
---|
152 | include_once (PHPWG_ROOT_PATH.'plugins/Register_Punbb/include/constants.php'); |
---|
153 | include (PHPWG_ROOT_PATH.'plugins/Register_Punbb/reg_punbb_synchro.php'); |
---|
154 | } |
---|
155 | |
---|
156 | /* Template settings */ |
---|
157 | $template->assign_vars( |
---|
158 | array( |
---|
159 | 'PUNBB_STATUS' => $conf['punbb_status'], |
---|
160 | 'PUNBB_PREFIX' => $conf['punbb_prefix'], |
---|
161 | 'PUNBB_ID_DEFAULT_GROUP' => $conf['punbb_id_default_group'], |
---|
162 | 'PUNBB_ADMIN' => $conf['punbb_admin'], |
---|
163 | 'PUNBB_EMAIL_SETTING' => $conf['punbb_email_setting'], |
---|
164 | 'PUNBB_SAVE_PASS' => $conf['punbb_save_pass'], |
---|
165 | 'PUNBB_NOTIFY_WITH_POST' => $conf['punbb_notify_with_post'], |
---|
166 | 'PUNBB_TIMEZONE' => $conf['punbb_timezone'], |
---|
167 | 'PUNBB_LANGUAGE' => $conf['punbb_language'], |
---|
168 | 'PUNBB_STYLE' => $conf['punbb_style'], |
---|
169 | 'PUNBB_DEL_PT' => $conf['punbb_del_pt'], |
---|
170 | ) |
---|
171 | ); |
---|
172 | |
---|
173 | $template->set_filenames( array('plugin_admin_content' => dirname(__FILE__).'/reg_punbb_admin.tpl') ); |
---|
174 | |
---|
175 | $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); |
---|
176 | ?> |
---|