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