1 | <?php
|
---|
2 |
|
---|
3 | load_plugin_textdomain('xpressme', 'wp-content/plugins/xpressme/language');
|
---|
4 |
|
---|
5 | class XPressME_Class{
|
---|
6 | var $pluginName = 'xpressme';
|
---|
7 | var $is_use_xoops_upload_path;
|
---|
8 | var $is_theme_sidebar_disp;
|
---|
9 | var $is_save_post_revision;
|
---|
10 | var $is_postnavi_title_disp;
|
---|
11 | var $is_left_postnavi_old;
|
---|
12 | var $old_post_link_text;
|
---|
13 | var $newer_post_link_text;
|
---|
14 | var $is_left_page_navi_old;
|
---|
15 | var $old_page_link_text;
|
---|
16 | var $newer_page_link_text;
|
---|
17 | var $is_author_view_count;
|
---|
18 | var $is_sql_debug;
|
---|
19 | var $groupe_role;
|
---|
20 | var $is_use_d3forum;
|
---|
21 | var $d3forum_module_dir;
|
---|
22 | var $d3forum_forum_id;
|
---|
23 | var $d3forum_external_link_format;
|
---|
24 | var $is_content_excerpt;
|
---|
25 | var $ascii_judged_rate;
|
---|
26 | var $excerpt_length_word;
|
---|
27 | var $excerpt_length_character;
|
---|
28 | var $more_link_text;
|
---|
29 | var $viewer_type;
|
---|
30 | var $is_multi_user;
|
---|
31 | var $meta_keyword_type;
|
---|
32 | var $meta_description_type;
|
---|
33 | var $meta_robot_type;
|
---|
34 | //constructor
|
---|
35 | function XPressME_Class()
|
---|
36 | {
|
---|
37 | global $xoops_db;
|
---|
38 |
|
---|
39 | $this->setdefault(); //not setting propaty load
|
---|
40 | $this->SettingValueRead();
|
---|
41 | }
|
---|
42 |
|
---|
43 | //Set Default Value
|
---|
44 | function setDefault()
|
---|
45 | {
|
---|
46 | $this->is_use_xoops_upload_path = true;
|
---|
47 | $this->is_theme_sidebar_disp = false;
|
---|
48 | $this->is_save_post_revision = true;
|
---|
49 | $this->is_postnavi_title_disp = true;
|
---|
50 | $this->is_left_postnavi_old = true;
|
---|
51 | $this->old_post_link_text = __('Older Post', 'xpressme');
|
---|
52 | $this->newer_post_link_text = __('Newer Post', 'xpressme');
|
---|
53 | $this->is_left_page_navi_old = true;
|
---|
54 | $this->old_page_link_text = __('Older Entries', 'xpressme');
|
---|
55 | $this->newer_page_link_text = __('Newer Entries', 'xpressme');
|
---|
56 | $this->is_author_view_count = false;
|
---|
57 | $this->is_sql_debug = false;
|
---|
58 | $this->is_use_d3forum = false;
|
---|
59 | $this->d3forum_module_dir = '';
|
---|
60 | $this->d3forum_forum_id = '';
|
---|
61 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
62 | $this->is_d3forum_flat = true;
|
---|
63 | $this->is_d3forum_desc = true;
|
---|
64 | $this->d3forum_views_num = 10;
|
---|
65 | $this->is_content_excerpt = true;
|
---|
66 | $this->ascii_judged_rate = 90;
|
---|
67 | $this->excerpt_length_word = 40;
|
---|
68 | $this->excerpt_length_character = 120;
|
---|
69 | $this->more_link_text = __('more', 'xpressme');
|
---|
70 | $this->viewer_type = 'xoops';
|
---|
71 | $this->is_multi_user = false;
|
---|
72 | $this->meta_keyword_type = 'xoops';
|
---|
73 | $this->meta_description_type = 'xoops';
|
---|
74 | $this->meta_robot_type = 'xoops';
|
---|
75 | }
|
---|
76 |
|
---|
77 | function SettingValueRead()
|
---|
78 | {
|
---|
79 | global $xoops_db;
|
---|
80 | $options = get_option('xpressme_option');
|
---|
81 | if (!$options) {
|
---|
82 | $this->setDefault();
|
---|
83 | $this->SettingValueWrite('add_new');
|
---|
84 | } else {
|
---|
85 | foreach ($options as $option_name => $option_value){
|
---|
86 | $this-> {$option_name} = $option_value;
|
---|
87 | }
|
---|
88 | }
|
---|
89 | if (!empty($xoops_db)) // at install trap
|
---|
90 | $this->GroupeRoleRead();
|
---|
91 | }
|
---|
92 |
|
---|
93 | // mode 0:add 1:update
|
---|
94 | function SettingValueWrite($mode)
|
---|
95 | {
|
---|
96 | $write_options = array (
|
---|
97 | 'is_use_xoops_upload_path' => $this->is_use_xoops_upload_path ,
|
---|
98 | 'is_theme_sidebar_disp' => $this->is_theme_sidebar_disp ,
|
---|
99 | 'is_save_post_revision' => $this->is_save_post_revision ,
|
---|
100 | 'is_postnavi_title_disp' => $this->is_postnavi_title_disp ,
|
---|
101 | 'is_left_postnavi_old' => $this->is_left_postnavi_old ,
|
---|
102 | 'old_post_link_text' => $this->old_post_link_text ,
|
---|
103 | 'newer_post_link_text' => $this->newer_post_link_text,
|
---|
104 | 'is_left_page_navi_old' => $this->is_left_page_navi_old ,
|
---|
105 | 'old_page_link_text' => $this->old_page_link_text ,
|
---|
106 | 'newer_page_link_text' => $this->newer_page_link_text,
|
---|
107 | 'is_author_view_count' => $this->is_author_view_count,
|
---|
108 | 'is_sql_debug' => $this->is_sql_debug,
|
---|
109 | 'is_use_d3forum' => $this->is_use_d3forum,
|
---|
110 | 'd3forum_module_dir' => $this->d3forum_module_dir,
|
---|
111 | 'd3forum_forum_id' => $this->d3forum_forum_id,
|
---|
112 | 'd3forum_external_link_format' => $this->d3forum_external_link_format,
|
---|
113 | 'is_d3forum_flat' => $this->is_d3forum_flat,
|
---|
114 | 'is_d3forum_desc' => $this->is_d3forum_desc,
|
---|
115 | 'd3forum_views_num' =>$this->d3forum_views_num,
|
---|
116 | 'is_content_excerpt' => $this->is_content_excerpt,
|
---|
117 | 'ascii_judged_rate' => $this->ascii_judged_rate,
|
---|
118 | 'excerpt_length_word' => $this->excerpt_length_word,
|
---|
119 | 'excerpt_length_character' => $this->excerpt_length_character,
|
---|
120 | 'more_link_text' => $this->more_link_text,
|
---|
121 | 'viewer_type' => $this->viewer_type,
|
---|
122 | 'is_multi_user' => $this->is_multi_user,
|
---|
123 | 'meta_keyword_type' => $this->meta_keyword_type,
|
---|
124 | 'meta_description_type' => $this->meta_description_type,
|
---|
125 | 'meta_robot_type' => $this->meta_robot_type
|
---|
126 | );
|
---|
127 | if ($mode == 'add_new') {
|
---|
128 | add_option('xpressme_option', $write_options);
|
---|
129 | } else {
|
---|
130 | update_option("xpressme_option", $write_options);
|
---|
131 | }
|
---|
132 | }
|
---|
133 |
|
---|
134 | function GroupeRoleRead() {
|
---|
135 | global $xoops_db;
|
---|
136 |
|
---|
137 | // table sync
|
---|
138 | $table = get_wp_prefix() . 'group_role';
|
---|
139 | $xoops_group = get_xoops_prefix() . 'groups';
|
---|
140 | $xoops_group_permission = get_xoops_prefix() . 'group_permission';
|
---|
141 |
|
---|
142 | $module_id = get_xpress_modid();
|
---|
143 |
|
---|
144 | $sql= "SELECT * FROM $table";
|
---|
145 | $before_groupes = $xoops_db->get_results($sql);
|
---|
146 |
|
---|
147 | $sql = "DELETE FROM $table";
|
---|
148 | $xoops_db->query($sql);
|
---|
149 |
|
---|
150 | $sql = "SELECT * FROM $xoops_group_permission WHERE gperm_itemid = $module_id";
|
---|
151 | $gperms = $xoops_db->get_results($sql);
|
---|
152 |
|
---|
153 | $sql = "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'";
|
---|
154 | $groupes = $xoops_db->get_results($sql);
|
---|
155 | $insert_sql = '';
|
---|
156 | foreach ($groupes as $groupe) {
|
---|
157 | $parmsql = "SELECT * FROM $xoops_group_permission WHERE gperm_itemid = $module_id AND gperm_groupid = $groupe->groupid";
|
---|
158 | $gperms = $xoops_db->get_results($parmsql);
|
---|
159 | $parmission = '';
|
---|
160 | foreach ($gperms as $gperm) {
|
---|
161 | $parmission = $gperm->gperm_name;
|
---|
162 | if ($parmission == 'module_admin') break;
|
---|
163 | }
|
---|
164 |
|
---|
165 | if (!empty($parmission)){
|
---|
166 | $role = '';
|
---|
167 | foreach ($before_groupes as $before_groupe) {
|
---|
168 | if ($groupe->groupid == $before_groupe->groupid) {
|
---|
169 | $role = $before_groupe->role;
|
---|
170 | $login_all = $before_groupe->login_all;
|
---|
171 | }
|
---|
172 | }
|
---|
173 | if ($parmission == 'module_admin') $role = 'administrator';
|
---|
174 |
|
---|
175 | $insert_sql = "INSERT INTO $table ";
|
---|
176 | $insert_sql .= "(groupid , name , description , group_type , role , login_all) ";
|
---|
177 | $insert_sql .= "VALUES (";
|
---|
178 | $insert_sql .= $groupe->groupid . ', ';
|
---|
179 | $insert_sql .= "'" . $groupe->name . "' , ";
|
---|
180 | $insert_sql .= "'" . $groupe->description . "' , ";
|
---|
181 | $insert_sql .= "'" . $parmission . "' , ";
|
---|
182 | $insert_sql .= "'" . $role . "' , '";
|
---|
183 | $insert_sql .= $login_all . "')";
|
---|
184 | $xoops_db->query($insert_sql);
|
---|
185 | }
|
---|
186 | }
|
---|
187 |
|
---|
188 | $sql= "SELECT * FROM $table";
|
---|
189 |
|
---|
190 | $this->groupe_role = $xoops_db->get_results($sql);
|
---|
191 | $sql= "SELECT * FROM $table";
|
---|
192 | }
|
---|
193 |
|
---|
194 | function ReadPostData()
|
---|
195 | {
|
---|
196 | $this->is_use_xoops_upload_path = stripslashes(trim($_POST['ch_is_use_xoops_upload_path']));
|
---|
197 | $this->is_theme_sidebar_disp = stripslashes(trim($_POST['ch_is_theme_sidebar_disp']));
|
---|
198 | $this->is_save_post_revision = stripslashes(trim($_POST['ch_is_save_post_revision']));
|
---|
199 | $this->is_postnavi_title_disp = stripslashes(trim($_POST['ch_is_postnavi_title_disp']));
|
---|
200 | $this->is_left_postnavi_old = stripslashes(trim($_POST['ch_is_left_postnavi_old']));
|
---|
201 | $this->old_post_link_text = stripslashes($_POST['ch_old_post_link_text']);
|
---|
202 | if(empty($this->old_post_link_text)) $this->old_post_link_text = __('Older Post', 'xpressme');
|
---|
203 | $this->newer_post_link_text = stripslashes($_POST['ch_newer_post_link_text']);
|
---|
204 | if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('Newer Post', 'xpressme');
|
---|
205 | $this->is_left_page_navi_old = stripslashes(trim($_POST['ch_is_left_page_navi_old']));
|
---|
206 | $this->old_page_link_text = stripslashes($_POST['ch_old_page_link_text']);
|
---|
207 | if(empty($this->old_page_link_text)) $this->old_page_link_text = __('Older Entries', 'xpressme');
|
---|
208 | $this->newer_page_link_text = stripslashes($_POST['ch_newer_page_link_text']);
|
---|
209 | if(empty($this->newer_page_link_text)) $this->newer_page_link_text = __('Newer Entries', 'xpressme');
|
---|
210 | $this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count']));
|
---|
211 | $this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug']));
|
---|
212 | //d3forum
|
---|
213 | $d3forum_select = stripslashes(trim($_POST['ch_d3forum']));
|
---|
214 | if ($d3forum_select == 'none') {
|
---|
215 | $this->is_use_d3forum = false;
|
---|
216 | $this->d3forum_module_dir = '';
|
---|
217 | $this->d3forum_forum_id = '';
|
---|
218 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
219 | } else {
|
---|
220 | $d3f_set = explode('|', $d3forum_select);
|
---|
221 | $this->is_use_d3forum = true;
|
---|
222 | $this->d3forum_module_dir = $d3f_set[1];
|
---|
223 | $this->d3forum_forum_id = $d3f_set[2];
|
---|
224 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
225 | }
|
---|
226 | $this->is_d3forum_flat = stripslashes(trim($_POST['ch_d3forum_type']));
|
---|
227 | $this->is_d3forum_desc = stripslashes(trim($_POST['ch_d3forum_order']));
|
---|
228 | $this->d3forum_views_num = stripslashes(trim($_POST['ch_d3forum_view_num']));
|
---|
229 |
|
---|
230 | $this->is_content_excerpt = stripslashes(trim($_POST['ch_is_content_excerpt']));
|
---|
231 | $this->ascii_judged_rate = stripslashes(trim($_POST['ch_ascii_judged_rate']));
|
---|
232 | $this->excerpt_length_word = stripslashes(trim($_POST['ch_excerpt_length_word']));
|
---|
233 | $this->excerpt_length_character = stripslashes(trim($_POST['ch_excerpt_length_character']));
|
---|
234 | $this->more_link_text = stripslashes(trim($_POST['ch_more_link_text']));
|
---|
235 | $this->viewer_type = stripslashes(trim($_POST['ch_viewer_type']));
|
---|
236 | $this->is_multi_user = stripslashes(trim($_POST['ch_is_multi_user']));
|
---|
237 | $this->meta_keyword_type = stripslashes(trim($_POST['ch_meta_keyword_type']));
|
---|
238 | $this->meta_description_type = stripslashes(trim($_POST['ch_meta_description_type']));
|
---|
239 | $this->meta_robot_type = stripslashes(trim($_POST['ch_meta_robot_type']));
|
---|
240 |
|
---|
241 | global $xoops_db;
|
---|
242 | $table = get_wp_prefix() . 'group_role';
|
---|
243 | // $sql= "SELECT * FROM $table";
|
---|
244 | // $this->groupe_role = $xoops_db->get_results($sql); // before Read
|
---|
245 |
|
---|
246 | foreach ($this->groupe_role as $groupe) {
|
---|
247 | $post_name = 'role_gid_' . $groupe->groupid;
|
---|
248 | $role = stripslashes(trim($_POST[$post_name]));
|
---|
249 | $post_name = 'login_all_gid_' . $groupe->groupid;
|
---|
250 | $login_all = stripslashes(trim($_POST[$post_name]));
|
---|
251 | if (empty($login_all)) $login_all = '0';
|
---|
252 | $groupe->role = $role;
|
---|
253 | $groupe->login_all = $login_all;
|
---|
254 | $update_sql = "UPDATE $table ";
|
---|
255 | $update_sql .= 'SET ';
|
---|
256 | $update_sql .= "role = '$role' , ";
|
---|
257 | $update_sql .= "login_all = $login_all ";
|
---|
258 | $update_sql .= "WHERE (groupid = '$groupe->groupid' )";
|
---|
259 | $xoops_db->query($update_sql);
|
---|
260 | }
|
---|
261 | }
|
---|
262 |
|
---|
263 | function yes_no_radio_option($option_name,$option_desc,$yes = '',$no= ''){
|
---|
264 | if (empty( $yes )) $yes = __('YES','xpressme') ;
|
---|
265 | if (empty( $no )) $no = __('NO','xpressme') ;
|
---|
266 | $value = $this->{$option_name};
|
---|
267 | $ans_name = 'ch_' . $option_name;
|
---|
268 |
|
---|
269 | $form = "<tr>\n";
|
---|
270 | $form .= '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
|
---|
271 | $form .= "<td>\n";
|
---|
272 | $form .= $this->yes_no_radio_option_sub($option_name,$yes,$no);
|
---|
273 | $form .= "</td>\n";
|
---|
274 | $form .= "</tr>\n";
|
---|
275 |
|
---|
276 | return $form;
|
---|
277 |
|
---|
278 | }
|
---|
279 | function yes_no_radio_option_sub($option_name,$yes = '',$no= ''){
|
---|
280 | if (empty( $yes )) $yes = __('YES','xpressme') ;
|
---|
281 | if (empty( $no )) $no = __('NO','xpressme') ;
|
---|
282 | $value = $this->{$option_name};
|
---|
283 | $ans_name = 'ch_' . $option_name;
|
---|
284 |
|
---|
285 | if ($value){
|
---|
286 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' checked='checked' />" . $yes ."</label><br />\n";
|
---|
287 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' />". $no . "</label>\n";
|
---|
288 | }else{
|
---|
289 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' />" . $yes . "</label><br />\n";
|
---|
290 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' checked='checked' />". $no ."</label>\n";
|
---|
291 | }
|
---|
292 | return $form;
|
---|
293 | }
|
---|
294 |
|
---|
295 |
|
---|
296 | function text_option($option_name,$option_desc){
|
---|
297 | $value = $this->{$option_name};
|
---|
298 | $ans_name = 'ch_' . $option_name;
|
---|
299 |
|
---|
300 | $form = "<tr>\n";
|
---|
301 | $form .= '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
|
---|
302 | $form .= "<td>\n";
|
---|
303 | $form .= $this->text_option_sub($option_name);
|
---|
304 | $form .= "</td>\n";
|
---|
305 | $form .= "</tr>\n";
|
---|
306 |
|
---|
307 | return $form;
|
---|
308 |
|
---|
309 | }
|
---|
310 |
|
---|
311 | function text_option_sub($option_name){
|
---|
312 | $value = $this->{$option_name};
|
---|
313 | $ans_name = 'ch_' . $option_name;
|
---|
314 |
|
---|
315 | $form = '<label> <input name="'. $ans_name . '" type="text" size="25" maxlength="50" value="' . $value . '" /></label>'."\n";
|
---|
316 | return $form;
|
---|
317 |
|
---|
318 | }
|
---|
319 |
|
---|
320 |
|
---|
321 | function single_post_navi_option(){
|
---|
322 | $form = '';
|
---|
323 | $form .= '<tr><th><label for="single_page_navi">' .__('Single Post Navi Setting', 'xpressme') . '</label></th>';
|
---|
324 | $form .= "<td>\n";
|
---|
325 | $form .= "<table>\n";
|
---|
326 | $form .= "<tr>\n";
|
---|
327 |
|
---|
328 | $form .= "<td>" . __('Adjustment of Navi link display position','xpressme') . "</td>\n";
|
---|
329 | $form .= "<td>\n";
|
---|
330 | $form .= $this->yes_no_radio_option_sub('is_left_postnavi_old',
|
---|
331 | __("'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right",'xpressme'),
|
---|
332 | __("'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right",'xpressme')
|
---|
333 | );
|
---|
334 | $form .= "</td>\n";
|
---|
335 | $form .= "</tr>\n";
|
---|
336 |
|
---|
337 | $form .= "<tr>\n";
|
---|
338 | $form .= "<td>" . __('Select Display name of PostNavi Link','xpressme') . "</td>\n";
|
---|
339 | $form .= "<td>\n";
|
---|
340 | $form .= $this->yes_no_radio_option_sub('is_postnavi_title_disp',
|
---|
341 | __('Title of post','xpressme'),
|
---|
342 | __('Title of Navi','xpressme')
|
---|
343 | );
|
---|
344 | $form .= "</td>\n";
|
---|
345 | $form .= "</tr>\n";
|
---|
346 |
|
---|
347 | $form .= "<tr>\n";
|
---|
348 | $form .= "<td>" . __('Display Navi Title of Old Post Link','xpressme') . "</td>\n";
|
---|
349 | $form .= "<td>\n";
|
---|
350 | $form .= $this->text_option_sub('old_post_link_text');
|
---|
351 | $form .= "</td>\n";
|
---|
352 | $form .= "</tr>\n";
|
---|
353 |
|
---|
354 | $form .= "<tr>\n";
|
---|
355 | $form .= "<td>" . __('Display Navi Title of Newer Post Link','xpressme') . "</td>\n";
|
---|
356 | $form .= "<td>\n";
|
---|
357 | $form .= $this->text_option_sub('newer_post_link_text');
|
---|
358 | $form .= "</td>\n";
|
---|
359 | $form .= "</tr>\n";
|
---|
360 |
|
---|
361 | $form .= "</table></td></tr>\n";
|
---|
362 | return $form;
|
---|
363 |
|
---|
364 | }
|
---|
365 |
|
---|
366 | function posts_page_navi_option(){
|
---|
367 | $form = '';
|
---|
368 | $form .= '<tr><th><label for="posts_page_navi">' .__('Posts List Page Navi Setting', 'xpressme') . '</label></th>';
|
---|
369 | $form .= "<td>\n";
|
---|
370 | $form .= "<table>\n";
|
---|
371 | $form .= "<tr>\n";
|
---|
372 |
|
---|
373 | $form .= "<td>" . __('Adjustment of Navi link display position','xpressme') . "</td>\n";
|
---|
374 | $form .= "<td>\n";
|
---|
375 | $form .= $this->yes_no_radio_option_sub('is_left_page_navi_old',
|
---|
376 | __("'Old Page Link' is displayed in the left, and 'Newer Page Link' is displayed in the right",'xpressme'),
|
---|
377 | __("'Newer Page Link' is displayed in the left, and 'Old Page Link' is displayed in the right",'xpressme')
|
---|
378 | );
|
---|
379 | $form .= "</td>\n";
|
---|
380 | $form .= "</tr>\n";
|
---|
381 |
|
---|
382 | $form .= "<tr>\n";
|
---|
383 | $form .= "<td>" . __('Display Navi Title of Old Page Link','xpressme') . "</td>\n";
|
---|
384 | $form .= "<td>\n";
|
---|
385 | $form .= $this->text_option_sub('old_page_link_text');
|
---|
386 | $form .= "</td>\n";
|
---|
387 | $form .= "</tr>\n";
|
---|
388 |
|
---|
389 | $form .= "<tr>\n";
|
---|
390 | $form .= "<td>" . __('Display Navi Title of Newer Page Link','xpressme') . "</td>\n";
|
---|
391 | $form .= "<td>\n";
|
---|
392 | $form .= $this->text_option_sub('newer_page_link_text');
|
---|
393 | $form .= "</td>\n";
|
---|
394 | $form .= "</tr>\n";
|
---|
395 |
|
---|
396 | $form .= "</table></td></tr>\n";
|
---|
397 | return $form;
|
---|
398 |
|
---|
399 | }
|
---|
400 |
|
---|
401 | function groupe_role_option(){
|
---|
402 | global $wp_roles , $xoops_db;
|
---|
403 |
|
---|
404 | $form = '';
|
---|
405 | $form .= '<tr><th><label for="role">' .__('Role Setting at Login', 'xpressme') . '</label></th>';
|
---|
406 | $form .= '<td>';
|
---|
407 | $form .= "<table>\n";
|
---|
408 | $form .= '<tr><td>' . __('XOOPS Groupe', 'xpressme') . '</td><td>' . __('WordPress Role', 'xpressme') . '</td><td>' . __('Role is set at each login', 'xpressme') . "</td></tr>\n";
|
---|
409 | foreach ($this->groupe_role as $groupe) {
|
---|
410 | $form .= "<tr>";
|
---|
411 | $form .= "<td> $groupe->name </td>";
|
---|
412 | $form .= "<td>\n" . '<select name="role_gid_'.$groupe->groupid . '" id="role_gid_' . $groupe->groupid . '">' . "\n";
|
---|
413 | $role_list = '';
|
---|
414 | $group_has_role = false;
|
---|
415 |
|
---|
416 | $select_value = $groupe->role;
|
---|
417 |
|
---|
418 |
|
---|
419 |
|
---|
420 | foreach($wp_roles->role_names as $role => $name) {
|
---|
421 | $name = translate_with_context($name);
|
---|
422 | if ( $role == $select_value) {
|
---|
423 | $selected = ' selected="selected"';
|
---|
424 | $group_has_role = true;
|
---|
425 | } else {
|
---|
426 | $selected = '';
|
---|
427 | }
|
---|
428 | if ($groupe->group_type != 'module_admin'|| !empty($selected)) {
|
---|
429 | $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n";
|
---|
430 | }
|
---|
431 | }
|
---|
432 | if ($groupe->group_type != 'module_admin') {
|
---|
433 | if ( $group_has_role ) {
|
---|
434 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
435 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
436 | } else {
|
---|
437 | if ($select_value == 'default'){
|
---|
438 | $role_list .= '<option value="default" selected="selected">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
439 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
440 | } else {
|
---|
441 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
442 | $role_list .= '<option value="" selected="selected">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
443 | }
|
---|
444 | }
|
---|
445 | }
|
---|
446 | $form .= $role_list . "</select>\n</td>";
|
---|
447 | if ($groupe->login_all){
|
---|
448 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1" checked ></td>';
|
---|
449 | } else {
|
---|
450 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1"></td>';
|
---|
451 | }
|
---|
452 | $form .= "</tr>\n";
|
---|
453 | }
|
---|
454 | $form .= "</table></td></tr>\n";
|
---|
455 | return $form;
|
---|
456 |
|
---|
457 | }
|
---|
458 |
|
---|
459 | function d3forum_option($do_message = ''){
|
---|
460 | global $xoops_db,$xoops_config;
|
---|
461 |
|
---|
462 | $d3frum_list = array();
|
---|
463 | $module_dir_path = get_xoops_root_path();
|
---|
464 |
|
---|
465 | $forum_list = '<select name="ch_d3forum">' . "\n";
|
---|
466 |
|
---|
467 | if ($this->is_use_d3forum != true)
|
---|
468 | $selected = ' selected="selected"';
|
---|
469 | else
|
---|
470 | $selected = '';
|
---|
471 |
|
---|
472 | if ($xoops_config->is_wpmu) {
|
---|
473 | $forum_list .= '<option value="none"' . $selected . '>' . __('WordPress MU cannot integrate the comments.', 'xpressme') . "</option>\n";
|
---|
474 | } else {
|
---|
475 | $forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n";
|
---|
476 |
|
---|
477 | // Form making for forum selection of D3forum
|
---|
478 | $modules_table = get_xoops_prefix() .'modules';
|
---|
479 | $sql = "SELECT mid,name,isactive,dirname FROM $modules_table WHERE isactive = 1";
|
---|
480 | $modules = $xoops_db->get_results($sql);
|
---|
481 | foreach ($modules as $module) {
|
---|
482 | $file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php';
|
---|
483 | if (! file_exists($file_path)) continue;
|
---|
484 | $array_files = file($file_path);
|
---|
485 | // It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file.
|
---|
486 | foreach ($array_files as $aeey_file){
|
---|
487 | if( preg_match( "/\s*(mytrustdirname)\s*(=)\s*([\"'])(d3forum)([\"'])/", $aeey_file ) ) {
|
---|
488 | $forums_tb = get_xoops_prefix() . $module->dirname . '_forums';
|
---|
489 | $cat_tb = get_xoops_prefix() . $module->dirname . '_categories';
|
---|
490 | $sql= "SELECT * FROM $forums_tb LEFT JOIN $cat_tb ON $forums_tb.cat_id = $cat_tb.cat_id";
|
---|
491 | $forums = $xoops_db->get_results($sql);
|
---|
492 | foreach ($forums as $forum) {
|
---|
493 | if (($module->dirname == $this->d3forum_module_dir) && ($forum->forum_id == $this->d3forum_forum_id))
|
---|
494 | $selected = ' selected="selected"';
|
---|
495 | else
|
---|
496 | $selected = '';
|
---|
497 | $forum_div = 'forum|' . $module->dirname . '|' . $forum->forum_id;
|
---|
498 | $forum_select = "$module->name($module->dirname) $forum->cat_title-$forum->forum_title(ID=$forum->forum_id)";
|
---|
499 | $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n";
|
---|
500 | }
|
---|
501 | break;
|
---|
502 | }
|
---|
503 | }
|
---|
504 | $forum_list .= '<br>';
|
---|
505 | }
|
---|
506 | }
|
---|
507 | $forum_list .= '</select>' . "\n";
|
---|
508 |
|
---|
509 | $form = '<tr>' . "\n";
|
---|
510 | $form .= '<th><label for="d3forum">' .__('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n";
|
---|
511 | $form .= "<td>\n";
|
---|
512 | $form .= __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') ."<br />\n";
|
---|
513 | $form .= $forum_list."\n";
|
---|
514 | $form .= '<br /><br />';
|
---|
515 | if ($this->is_use_d3forum) $disible = ''; else $disible = 'disabled';
|
---|
516 | $form .= __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
517 | if ($this->is_d3forum_flat){
|
---|
518 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n";
|
---|
519 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' />". __('Threaded','xpressme') . "</label>\n";
|
---|
520 | }else{
|
---|
521 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' />" . __('Flat','xpressme') . "</label>\n";
|
---|
522 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n";
|
---|
523 | }
|
---|
524 | $form .= '<br />';
|
---|
525 | $form .= __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
526 | if ($this->is_d3forum_desc){
|
---|
527 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n";
|
---|
528 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' />". __('ASC','xpressme') . "</label>\n";
|
---|
529 | }else{
|
---|
530 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' />" . __('DESC','xpressme') . "</label>\n";
|
---|
531 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n";
|
---|
532 | }
|
---|
533 | $form .= '<br />';
|
---|
534 | $form .= __('Number of displays of D3Forum comments.', 'xpressme') ." \n";
|
---|
535 | $form .= '&emsp<label> <input name="ch_d3forum_view_num" type="text" size="3" maxlength="3" value="' . $this->d3forum_views_num . '" /></label>'."\n";
|
---|
536 |
|
---|
537 | $form .= '<div class="submit">'."\n";
|
---|
538 | $form .= __('The import and the export between Wordpress Comments and the D3Forum Posts can be done. ', 'xpressme') ."<br />\n";
|
---|
539 | $form .= '<input type="submit" value= "' . __('Export to D3Forum', 'xpressme') . '" name="export_d3f" ' . $disible . ' >' ."\n";
|
---|
540 | $form .= '<input type="submit" value= "' . __('Import from D3Forum', 'xpressme') . '" name="inport_d3f" ' . $disible . ' >' ."<br />\n";
|
---|
541 | $form .= '</div>'."\n";
|
---|
542 | if (!empty($do_message)){
|
---|
543 | $form .= '<div>' . $do_message . '</div>';
|
---|
544 | }
|
---|
545 | $form .= "</td>\n";
|
---|
546 | $form .= "</tr><tr>\n";
|
---|
547 | return $form;
|
---|
548 | }
|
---|
549 |
|
---|
550 | function excerpt_option(){
|
---|
551 | $form = '';
|
---|
552 | $form .= '<tr><th><label for="excerpt">' .__('Contents Excerpt Setting', 'xpressme') . '</label></th>';
|
---|
553 | $form .= "<td>\n";
|
---|
554 | $form .= "<table>\n";
|
---|
555 | $form .= "<tr>\n";
|
---|
556 |
|
---|
557 | $form .= "<td>" . __('Is the excerpt display done with the archive of contents?','xpressme') . "</td>\n";
|
---|
558 | $form .= "<td>\n";
|
---|
559 | $form .= $this->yes_no_radio_option_sub('is_content_excerpt');
|
---|
560 | $form .= "</td>\n";
|
---|
561 | $form .= "</tr>\n";
|
---|
562 |
|
---|
563 | $form .= "<tr>\n";
|
---|
564 | $form .= "<td>" . __('When ASCII character more than the set ratio is included, it is judged ASCII contents. ','xpressme') . "</td>\n";
|
---|
565 | $form .= "<td>\n";
|
---|
566 | $form .= $this->text_option_sub('ascii_judged_rate');
|
---|
567 | $form .= "</td>\n";
|
---|
568 | $form .= "</tr>\n";
|
---|
569 |
|
---|
570 | $form .= "<tr>\n";
|
---|
571 | $form .= "<td>" . __('Excerpt length of word for ASCII contents','xpressme') . "</td>\n";
|
---|
572 | $form .= "<td>\n";
|
---|
573 | $form .= $this->text_option_sub('excerpt_length_word');
|
---|
574 | $form .= "</td>\n";
|
---|
575 | $form .= "</tr>\n";
|
---|
576 |
|
---|
577 | $form .= "<tr>\n";
|
---|
578 | $form .= "<td>" . __('Excerpt length of character for multibyte contents','xpressme') . "</td>\n";
|
---|
579 | $form .= "<td>\n";
|
---|
580 | $form .= $this->text_option_sub('excerpt_length_character');
|
---|
581 | $form .= "</td>\n";
|
---|
582 | $form .= "</tr>\n";
|
---|
583 |
|
---|
584 | $form .= "<tr>\n";
|
---|
585 | $form .= "<td>" . __('More Link Text (Is not displayed for the blank.)','xpressme') . "</td>\n";
|
---|
586 | $form .= "<td>\n";
|
---|
587 | $form .= $this->text_option_sub('more_link_text');
|
---|
588 | $form .= "</td>\n";
|
---|
589 | $form .= "</tr>\n";
|
---|
590 |
|
---|
591 | $form .= "</table></td></tr>\n";
|
---|
592 | return $form;
|
---|
593 | }
|
---|
594 |
|
---|
595 | function viewer_type_option(){
|
---|
596 | $form = "<tr>\n";
|
---|
597 | $form .= '<th><label for="viewer_type">' .__('Display Mode Setting', 'xpressme') . '</label></th>';
|
---|
598 | $form .= "<td>\n";
|
---|
599 |
|
---|
600 | $form .= __('Select the XPressME Display Mode.', 'xpressme') ."\n";
|
---|
601 | $form .= '<select name="ch_viewer_type">' . "\n";
|
---|
602 |
|
---|
603 | $form .= '<option value="xoops" ';
|
---|
604 | if ($this->viewer_type == 'xoops') $form .= ' selected="selected"';
|
---|
605 | $form .= '>'.__('Xoops Mode', 'xpressme') ."</option>\n";
|
---|
606 |
|
---|
607 | $form .= '<option value="wordpress" ';
|
---|
608 | if ($this->viewer_type == 'wordpress') $form .= ' selected="selected"';
|
---|
609 | $form .= '>'.__('WordPress Mode', 'xpressme') ."</option>\n";
|
---|
610 |
|
---|
611 | $form .= '<option value="user_select" ';
|
---|
612 | if ($this->viewer_type == 'user_select') $form .= ' selected="selected"';
|
---|
613 | $form .= '>'.__('User select', 'xpressme') ."</option>\n";
|
---|
614 |
|
---|
615 | $form .= "</select><br />\n";
|
---|
616 |
|
---|
617 | $form .= "</td></tr>\n";
|
---|
618 | return $form;
|
---|
619 | }
|
---|
620 |
|
---|
621 | function header_meta_option(){
|
---|
622 | $form = "<tr>\n";
|
---|
623 | $form .= '<th><label for="header_type">' .__('Header Meta Option', 'xpressme') . '</label></th>';
|
---|
624 | $form .= "<td>\n";
|
---|
625 | $form .= "<table>\n";
|
---|
626 | $form .= "<tr>\n";
|
---|
627 |
|
---|
628 | $form .= "<td>" . __('Select the Header keyword.', 'xpressme') . "</td>\n";
|
---|
629 | $form .= "<td>\n";
|
---|
630 | $form .= '<select name="ch_meta_keyword_type">' . "\n";
|
---|
631 | $form .= '<option value="xoops" ';
|
---|
632 | if ($this->meta_keyword_type == 'xoops') $form .= ' selected="selected"';
|
---|
633 | $form .= '>'.__('Xoops KeyWord', 'xpressme') ."</option>\n";
|
---|
634 | $form .= '<option value="wordpress" ';
|
---|
635 | if ($this->meta_keyword_type == 'wordpress') $form .= ' selected="selected"';
|
---|
636 | $form .= '>'.__('WordPress KeyWord', 'xpressme') ."</option>\n";
|
---|
637 | $form .= '<option value="wordpress_xoops" ';
|
---|
638 | if ($this->meta_keyword_type == 'wordpress_xoops') $form .= ' selected="selected"';
|
---|
639 | $form .= '>'.__('WordPress & Xoops KeyWord', 'xpressme') ."</option>\n";
|
---|
640 | $form .= "</select><br />\n";
|
---|
641 | $form .= "</td>\n";
|
---|
642 | $form .= "</tr>\n";
|
---|
643 |
|
---|
644 | $form .= "<tr>\n";
|
---|
645 | $form .= "<td>" . __('Select the Header Description.', 'xpressme') . "</td>\n";
|
---|
646 | $form .= "<td>\n";
|
---|
647 | $form .= '<select name="ch_meta_description_type">' . "\n";
|
---|
648 | $form .= '<option value="xoops" ';
|
---|
649 | if ($this->meta_description_type == 'xoops') $form .= ' selected="selected"';
|
---|
650 | $form .= '>'.__('Xoops Description', 'xpressme') ."</option>\n";
|
---|
651 | $form .= '<option value="wordpress" ';
|
---|
652 | if ($this->meta_description_type == 'wordpress') $form .= ' selected="selected"';
|
---|
653 | $form .= '>'.__('WordPress Description', 'xpressme') ."</option>\n";
|
---|
654 | $form .= '<option value="wordpress_xoops" ';
|
---|
655 | if ($this->meta_description_type == 'wordpress_xoops') $form .= ' selected="selected"';
|
---|
656 | $form .= '>'.__('WordPress & Xoops Description', 'xpressme') ."</option>\n";
|
---|
657 | $form .= "</select><br />\n";
|
---|
658 | $form .= "</td>\n";
|
---|
659 | $form .= "</tr>\n";
|
---|
660 |
|
---|
661 | $form .= "<tr>\n";
|
---|
662 | $form .= "<td>" . __('Select the Header Robots Index.', 'xpressme') . "</td>\n";
|
---|
663 | $form .= "<td>\n";
|
---|
664 | $form .= '<select name="ch_meta_robot_type">' . "\n";
|
---|
665 | $form .= '<option value="xoops" ';
|
---|
666 | if ($this->meta_robot_type == 'xoops') $form .= ' selected="selected"';
|
---|
667 | $form .= '>'.__('Xoops Robots Index', 'xpressme') ."</option>\n";
|
---|
668 | $form .= '<option value="wordpress" ';
|
---|
669 | if ($this->meta_robot_type == 'wordpress') $form .= ' selected="selected"';
|
---|
670 | $form .= '>'.__('WordPress Robots Index', 'xpressme') ."</option>\n";
|
---|
671 | $form .= "</select><br />\n";
|
---|
672 | $form .= "</td>\n";
|
---|
673 | $form .= "</tr>\n";
|
---|
674 |
|
---|
675 | $form .= "</table>\n";
|
---|
676 |
|
---|
677 | $form .= "</tr>\n";
|
---|
678 | return $form;
|
---|
679 | }
|
---|
680 |
|
---|
681 |
|
---|
682 | function option_page()
|
---|
683 | {
|
---|
684 | global $xoops_config;
|
---|
685 |
|
---|
686 | $xoops_admin_url = $xoops_config->module_url . '/admin/index.php';
|
---|
687 |
|
---|
688 | $do_message ='';
|
---|
689 | if (!empty($_POST['submit_update'])) {
|
---|
690 | $this->ReadPostData();
|
---|
691 | $this->SettingValueWrite('update');
|
---|
692 | } else if (isset($_POST['submit_reset'])) {
|
---|
693 | $this->setDefault();
|
---|
694 | $this->SettingValueWrite('update');
|
---|
695 | } else if (isset($_POST['export_d3f'])) {
|
---|
696 | $do_message = 'export(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
|
---|
697 | $do_message .= wp_to_d3forum($this->d3forum_forum_id, $this->d3forum_module_dir);
|
---|
698 | $do_message .= '....END';
|
---|
699 | } else if (isset($_POST['inport_d3f'])) {
|
---|
700 | $do_message = 'Import(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
|
---|
701 | $do_message .= d3forum_to_wp($this->d3forum_forum_id, $this->d3forum_module_dir);
|
---|
702 | $do_message .= '....END';
|
---|
703 | }
|
---|
704 |
|
---|
705 | echo '<div class="wrap">'."\n";
|
---|
706 | echo '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
|
---|
707 | echo '<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2><br>\n";
|
---|
708 | echo '<div align="right"><a href="' . $xoops_admin_url . '"><h3>'. __('to XOOPS Modules Admin Page', 'xpressme') . '</h3></a></div>';
|
---|
709 | echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
|
---|
710 | echo '<table class="form-table">'."\n";
|
---|
711 | echo $this->viewer_type_option();
|
---|
712 | echo $this->yes_no_radio_option('is_use_xoops_upload_path',
|
---|
713 | __('Media Upload Base Path','xpressme'),
|
---|
714 | __('Use XOOPS UPLOAD PATH','xpressme'),
|
---|
715 | __('USE WordPress BASE_PATH','xpressme')
|
---|
716 | );
|
---|
717 | echo $this->yes_no_radio_option('is_theme_sidebar_disp',
|
---|
718 | __('Thema Sidebar Display','xpressme'),
|
---|
719 | __('YES','xpressme'),
|
---|
720 | __('NO','xpressme')
|
---|
721 | );
|
---|
722 | echo $this->yes_no_radio_option('is_save_post_revision',
|
---|
723 | __('The change tracking of the post is preserved','xpressme'),
|
---|
724 | __('YES','xpressme'),
|
---|
725 | __('NO','xpressme')
|
---|
726 | );
|
---|
727 |
|
---|
728 | echo $this->yes_no_radio_option('is_multi_user',
|
---|
729 | __('Select Multi user mode','xpressme'),
|
---|
730 | __('YES','xpressme'),
|
---|
731 | __('NO','xpressme')
|
---|
732 | );
|
---|
733 |
|
---|
734 |
|
---|
735 | echo $this->single_post_navi_option();
|
---|
736 | echo $this->posts_page_navi_option();
|
---|
737 | echo $this->excerpt_option();
|
---|
738 |
|
---|
739 | echo $this->yes_no_radio_option('is_author_view_count',
|
---|
740 | __('Is the posts author views counted?','xpressme'),
|
---|
741 | __('YES','xpressme'),
|
---|
742 | __('NO','xpressme')
|
---|
743 | );
|
---|
744 | echo $this->header_meta_option();
|
---|
745 | echo $this->yes_no_radio_option('is_sql_debug',
|
---|
746 | __('Is SQL debugging window displayed?','xpressme'),
|
---|
747 | __('YES','xpressme'),
|
---|
748 | __('NO','xpressme')
|
---|
749 | );
|
---|
750 |
|
---|
751 | echo $this->groupe_role_option();
|
---|
752 |
|
---|
753 | echo $this->d3forum_option($do_message);
|
---|
754 | // $this->is_use_xoops_upload_path_html();
|
---|
755 | echo "</table>\n";
|
---|
756 |
|
---|
757 | echo '<p class="submit">'."\n";
|
---|
758 | echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
|
---|
759 | echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
|
---|
760 | echo "</p>\n";
|
---|
761 |
|
---|
762 | echo "</form>\n" ;
|
---|
763 | echo "</div>\n";
|
---|
764 | }
|
---|
765 |
|
---|
766 | function xpress_upload_filter($uploads)
|
---|
767 | {
|
---|
768 | global $xoops_config;
|
---|
769 | if ($this->is_use_xoops_upload_path){
|
---|
770 | $wordpress_dir = ABSPATH ;
|
---|
771 | $xoops_dir = $xoops_config->xoops_upload_path . '/';
|
---|
772 | $wordpress_base_url = get_option( 'siteurl' );
|
---|
773 | $xoops_upload_url = $xoops_config->xoops_upload_url;
|
---|
774 |
|
---|
775 | @rmdir($uploads[path]); //remove wordpress side uploads_dir
|
---|
776 |
|
---|
777 | $uploads[path] = str_replace ($wordpress_dir, $xoops_dir, $uploads[path]);
|
---|
778 | $uploads[basedir] = str_replace ($wordpress_dir, $xoops_dir, $uploads[basedir]);
|
---|
779 | $uploads[url] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[url]);
|
---|
780 | $uploads[baseurl] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[baseurl]);
|
---|
781 |
|
---|
782 | // Make sure we have an uploads dir
|
---|
783 | if ( ! wp_mkdir_p( $uploads[path] ) ) {
|
---|
784 | $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads[path] );
|
---|
785 | return array( 'error' => $message );
|
---|
786 | }
|
---|
787 | }
|
---|
788 | return $uploads;
|
---|
789 | }
|
---|
790 |
|
---|
791 | // SQL DEBUG TEST
|
---|
792 | function is_sql_debug_permission()
|
---|
793 | {
|
---|
794 | global $current_user;
|
---|
795 |
|
---|
796 | if (!is_object($current_user)) return false;
|
---|
797 | if ($this->is_sql_debug && ($current_user->user_level >= 10))
|
---|
798 | return true;
|
---|
799 | else
|
---|
800 | return false;
|
---|
801 | }
|
---|
802 |
|
---|
803 | function xpress_sql_debug($query_strings)
|
---|
804 | {
|
---|
805 | if ($this->is_sql_debug_permission()){
|
---|
806 | if (empty($GLOBALS['XPress_SQL_Query'])) $GLOBALS['XPress_SQL_Query'] = '';
|
---|
807 | $GLOBALS['XPress_SQL_Query'] .= $query_strings . '<br /><br />';
|
---|
808 | }
|
---|
809 | return $query_strings;
|
---|
810 | }
|
---|
811 |
|
---|
812 | function displayDebugLog()
|
---|
813 | {
|
---|
814 | if ($this->is_sql_debug_permission()){
|
---|
815 | $content = '';
|
---|
816 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
|
---|
817 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
|
---|
818 | $content .= '<title>XPressME SQL DEBUG</title>' ;
|
---|
819 | $content .= '</head><body>';
|
---|
820 | $content .= $GLOBALS['XPress_SQL_Query'];
|
---|
821 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
|
---|
822 |
|
---|
823 | echo '<script type="text/javascript">
|
---|
824 | <!--//
|
---|
825 | xpress_debug_window = window.open("", "xpress_debug", "width=680 , height=600 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
|
---|
826 | xpress_debug_window.document.clear();
|
---|
827 | xpress_debug_window.focus();
|
---|
828 | ';
|
---|
829 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
|
---|
830 | foreach ($lines as $line) {
|
---|
831 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
|
---|
832 | }
|
---|
833 | echo '
|
---|
834 | xpress_debug_window.document.close();
|
---|
835 | //-->
|
---|
836 | </script>';
|
---|
837 | }
|
---|
838 | }
|
---|
839 |
|
---|
840 | function set_d3forum_external_link_format()
|
---|
841 | {
|
---|
842 | global $xoops_db;
|
---|
843 | /* var $is_use_d3forum;
|
---|
844 | var $d3forum_module_dir;
|
---|
845 | var $d3forum_forum_id;
|
---|
846 | var $d3forum_external_link_format;
|
---|
847 | if ($this->$is_use_d3forum){
|
---|
848 | $content = '';
|
---|
849 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
|
---|
850 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
|
---|
851 | $content .= '<title>XPressME SQL DEBUG</title>' ;
|
---|
852 | $content .= '</head><body>';
|
---|
853 | $content .= $GLOBALS['XPress_SQL_Query'];
|
---|
854 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
|
---|
855 |
|
---|
856 | echo '<script type="text/javascript">
|
---|
857 | <!--//
|
---|
858 | xpress_debug_window = window.open("", "xpress_debug", "width=680 , height=600 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
|
---|
859 | xpress_debug_window.document.clear();
|
---|
860 | xpress_debug_window.focus();
|
---|
861 | ';
|
---|
862 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
|
---|
863 | foreach ($lines as $line) {
|
---|
864 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
|
---|
865 | }
|
---|
866 | echo '
|
---|
867 | xpress_debug_window.document.close();
|
---|
868 | //-->
|
---|
869 | </script>';
|
---|
870 | }
|
---|
871 | */
|
---|
872 | }
|
---|
873 |
|
---|
874 | }
|
---|
875 | ?> |
---|