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