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