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