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_author_view_count;
|
---|
15 | var $is_sql_debug;
|
---|
16 | var $groupe_role;
|
---|
17 | var $is_use_d3forum;
|
---|
18 | var $d3forum_module_dir;
|
---|
19 | var $d3forum_forum_id;
|
---|
20 | var $d3forum_external_link_format;
|
---|
21 | //constructor
|
---|
22 | function XPressME_Class()
|
---|
23 | {
|
---|
24 | global $xoops_db;
|
---|
25 |
|
---|
26 | $this->setdefault(); //not setting propaty load
|
---|
27 | $this->SettingValueRead();
|
---|
28 | }
|
---|
29 |
|
---|
30 |
|
---|
31 | function add_option_page()
|
---|
32 | {
|
---|
33 | add_options_page('XPressME', __('XPressME Settings', 'xpressme'), 8, 'xpressme_config', array(&$this, 'option_page'));
|
---|
34 | }
|
---|
35 |
|
---|
36 | function add_admin_head()
|
---|
37 | {
|
---|
38 | // add header text
|
---|
39 | }
|
---|
40 |
|
---|
41 |
|
---|
42 | //Set Default Value
|
---|
43 | function setDefault()
|
---|
44 | {
|
---|
45 | $this->is_use_xoops_upload_path = true;
|
---|
46 | $this->is_theme_sidebar_disp = true;
|
---|
47 | $this->is_save_post_revision = true;
|
---|
48 | $this->is_postnavi_title_disp = true;
|
---|
49 | $this->is_left_postnavi_old = true;
|
---|
50 | $this->old_post_link_text = __('to Old Post', 'xpressme');
|
---|
51 | $this->newer_post_link_text = __('to Newer Post', 'xpressme');
|
---|
52 | $this->is_author_view_count = false;
|
---|
53 | $this->is_sql_debug = false;
|
---|
54 | $this->is_use_d3forum = false;
|
---|
55 | $this->d3forum_module_dir = '';
|
---|
56 | $this->d3forum_forum_id = '';
|
---|
57 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
58 | $this->is_d3forum_flat = true;
|
---|
59 | $this->is_d3forum_desc = true;
|
---|
60 | $this->d3forum_views_num = 10;
|
---|
61 | }
|
---|
62 |
|
---|
63 | function SettingValueRead()
|
---|
64 | {
|
---|
65 | global $xoops_db;
|
---|
66 | $options = get_option('xpressme_option');
|
---|
67 | if (!$options) {
|
---|
68 | $this->setDefault();
|
---|
69 | $this->SettingValueWrite('add_new');
|
---|
70 | } else {
|
---|
71 | foreach ($options as $option_name => $option_value){
|
---|
72 | $this-> {$option_name} = $option_value;
|
---|
73 | }
|
---|
74 | }
|
---|
75 | if (!empty($xoops_db)) // at install trap
|
---|
76 | $this->GroupeRoleRead();
|
---|
77 | }
|
---|
78 |
|
---|
79 | // mode 0:add 1:update
|
---|
80 | function SettingValueWrite($mode)
|
---|
81 | {
|
---|
82 | $write_options = array (
|
---|
83 | 'is_use_xoops_upload_path' => $this->is_use_xoops_upload_path ,
|
---|
84 | 'is_theme_sidebar_disp' => $this->is_theme_sidebar_disp ,
|
---|
85 | 'is_save_post_revision' => $this->is_save_post_revision ,
|
---|
86 | 'is_postnavi_title_disp' => $this->is_postnavi_title_disp ,
|
---|
87 | 'is_left_postnavi_old' => $this->is_left_postnavi_old ,
|
---|
88 | 'old_post_link_text' => $this->old_post_link_text ,
|
---|
89 | 'newer_post_link_text' => $this->newer_post_link_text,
|
---|
90 | 'is_author_view_count' => $this->is_author_view_count,
|
---|
91 | 'is_sql_debug' => $this->is_sql_debug,
|
---|
92 | 'is_use_d3forum' => $this->is_use_d3forum,
|
---|
93 | 'd3forum_module_dir' => $this->d3forum_module_dir,
|
---|
94 | 'd3forum_forum_id' => $this->d3forum_forum_id,
|
---|
95 | 'd3forum_external_link_format' => $this->d3forum_external_link_format,
|
---|
96 | 'is_d3forum_flat' => $this->is_d3forum_flat,
|
---|
97 | 'is_d3forum_desc' => $this->is_d3forum_desc,
|
---|
98 | 'd3forum_views_num' =>$this->d3forum_views_num
|
---|
99 | );
|
---|
100 | if ($mode == 'add_new') {
|
---|
101 | add_option('xpressme_option', $write_options);
|
---|
102 | } else {
|
---|
103 | update_option("xpressme_option", $write_options);
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 | function GroupeRoleRead() {
|
---|
108 | global $xoops_db;
|
---|
109 |
|
---|
110 | // table sync
|
---|
111 | $table = get_wp_prefix() . 'group_role';
|
---|
112 | $xoops_group = get_xoops_prefix() . 'groups';
|
---|
113 | $sql= "SELECT * FROM $table";
|
---|
114 | $before_groupes = $xoops_db->get_results($sql);
|
---|
115 |
|
---|
116 | $sql = "DELETE FROM $table";
|
---|
117 | $xoops_db->query($sql);
|
---|
118 |
|
---|
119 |
|
---|
120 | $sql= "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'";
|
---|
121 | $groupes = $xoops_db->get_results($sql);
|
---|
122 | $insert_sql = '';
|
---|
123 | foreach ($groupes as $groupe) {
|
---|
124 | $role = '';
|
---|
125 | foreach ($before_groupes as $before_groupe) {
|
---|
126 | if ($groupe->groupid == $before_groupe->groupid) {
|
---|
127 | $role = $before_groupe->role;
|
---|
128 | $login_all = $before_groupe->login_all;
|
---|
129 | }
|
---|
130 | }
|
---|
131 |
|
---|
132 | $insert_sql = "INSERT INTO $table ";
|
---|
133 | $insert_sql .= "(groupid , name , description , group_type , role , login_all) ";
|
---|
134 | $insert_sql .= "VALUES (";
|
---|
135 | $insert_sql .= $groupe->groupid . ', ';
|
---|
136 | $insert_sql .= "'" . $groupe->name . "' , ";
|
---|
137 | $insert_sql .= "'" . $groupe->description . "' , ";
|
---|
138 | $insert_sql .= "'" . $groupe->group_type . "' , ";
|
---|
139 | $insert_sql .= "'" . $role . "' , '";
|
---|
140 | $insert_sql .= $login_all . "')";
|
---|
141 | $xoops_db->query($insert_sql);
|
---|
142 | }
|
---|
143 |
|
---|
144 | $sql= "SELECT * FROM $table";
|
---|
145 |
|
---|
146 | $this->groupe_role = $xoops_db->get_results($sql);
|
---|
147 | $sql= "SELECT * FROM $table";
|
---|
148 | }
|
---|
149 |
|
---|
150 | function ReadPostData()
|
---|
151 | {
|
---|
152 | $this->is_use_xoops_upload_path = stripslashes(trim($_POST['ch_is_use_xoops_upload_path']));
|
---|
153 | $this->is_theme_sidebar_disp = stripslashes(trim($_POST['ch_is_theme_sidebar_disp']));
|
---|
154 | $this->is_save_post_revision = stripslashes(trim($_POST['ch_is_save_post_revision']));
|
---|
155 | $this->is_postnavi_title_disp = stripslashes(trim($_POST['ch_is_postnavi_title_disp']));
|
---|
156 | $this->is_left_postnavi_old = stripslashes(trim($_POST['ch_is_left_postnavi_old']));
|
---|
157 | $this->old_post_link_text = stripslashes($_POST['ch_old_post_link_text']);
|
---|
158 | if(empty($this->old_post_link_text)) $this->old_post_link_text = __('to Old Post', 'xpressme');
|
---|
159 | $this->newer_post_link_text = stripslashes($_POST['ch_newer_post_link_text']);
|
---|
160 | if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('to Newer Post', 'xpressme');
|
---|
161 | $this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count']));
|
---|
162 | $this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug']));
|
---|
163 | //d3forum
|
---|
164 | $d3forum_select = stripslashes(trim($_POST['ch_d3forum']));
|
---|
165 | if ($d3forum_select == 'none') {
|
---|
166 | $this->is_use_d3forum = false;
|
---|
167 | $this->d3forum_module_dir = '';
|
---|
168 | $this->d3forum_forum_id = '';
|
---|
169 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
170 | } else {
|
---|
171 | $d3f_set = explode('|', $d3forum_select);
|
---|
172 | $this->is_use_d3forum = true;
|
---|
173 | $this->d3forum_module_dir = $d3f_set[1];
|
---|
174 | $this->d3forum_forum_id = $d3f_set[2];
|
---|
175 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
176 | }
|
---|
177 | $this->is_d3forum_flat = stripslashes(trim($_POST['ch_d3forum_type']));
|
---|
178 | $this->is_d3forum_desc = stripslashes(trim($_POST['ch_d3forum_order']));
|
---|
179 | $this->d3forum_views_num = stripslashes(trim($_POST['ch_d3forum_view_num']));
|
---|
180 |
|
---|
181 | global $xoops_db;
|
---|
182 | $table = get_wp_prefix() . 'group_role';
|
---|
183 | // $sql= "SELECT * FROM $table";
|
---|
184 | // $this->groupe_role = $xoops_db->get_results($sql); // before Read
|
---|
185 |
|
---|
186 | foreach ($this->groupe_role as $groupe) {
|
---|
187 | $post_name = 'role_gid_' . $groupe->groupid;
|
---|
188 | $role = stripslashes(trim($_POST[$post_name]));
|
---|
189 | $post_name = 'login_all_gid_' . $groupe->groupid;
|
---|
190 | $login_all = stripslashes(trim($_POST[$post_name]));
|
---|
191 | if (empty($login_all)) $login_all = '0';
|
---|
192 | $groupe->role = $role;
|
---|
193 | $groupe->login_all = $login_all;
|
---|
194 | $update_sql = "UPDATE $table ";
|
---|
195 | $update_sql .= 'SET ';
|
---|
196 | $update_sql .= "role = '$role' , ";
|
---|
197 | $update_sql .= "login_all = $login_all ";
|
---|
198 | $update_sql .= "WHERE (groupid = '$groupe->groupid' )";
|
---|
199 | $xoops_db->query($update_sql);
|
---|
200 | }
|
---|
201 | }
|
---|
202 |
|
---|
203 | function yes_no_radio_option($option_name,$option_desc,$yes = '',$no= ''){
|
---|
204 | if (empty( $yes )) $yes = __('YES','xpressme') ;
|
---|
205 | if (empty( $no )) $no = __('NO','xpressme') ;
|
---|
206 | $value = $this->{$option_name};
|
---|
207 | $ans_name = 'ch_' . $option_name;
|
---|
208 |
|
---|
209 | $form = "<tr>\n";
|
---|
210 | $form .= '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
|
---|
211 | $form .= "<td>\n";
|
---|
212 | if ($value){
|
---|
213 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' checked='checked' />" . $yes ."</label><br />\n";
|
---|
214 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' />". $no . "</label>\n";
|
---|
215 | }else{
|
---|
216 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' />" . $yes . "</label><br />\n";
|
---|
217 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' checked='checked' />". $no ."</label>\n";
|
---|
218 | }
|
---|
219 | $form .= "</td>\n";
|
---|
220 | $form .= "</tr><tr>\n";
|
---|
221 |
|
---|
222 | return $form;
|
---|
223 |
|
---|
224 | }
|
---|
225 |
|
---|
226 | function text_option($option_name,$option_desc){
|
---|
227 | $value = $this->{$option_name};
|
---|
228 | $ans_name = 'ch_' . $option_name;
|
---|
229 |
|
---|
230 | $form = "<tr>\n";
|
---|
231 | $form .= '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
|
---|
232 | $form .= "<td>\n";
|
---|
233 | $form .= '<label> <input name="'. $ans_name . '" type="text" size="25" maxlength="50" value="' . $value . '" /></label>'."\n";
|
---|
234 | $form .= "</td>\n";
|
---|
235 | $form .= "</tr><tr>\n";
|
---|
236 |
|
---|
237 | return $form;
|
---|
238 |
|
---|
239 | }
|
---|
240 |
|
---|
241 | function groupe_role_option(){
|
---|
242 | global $wp_roles , $xoops_db;
|
---|
243 |
|
---|
244 | $form = '';
|
---|
245 | $form .= '<tr><th><label for="role">' .__('Role Setting at Login', 'xpressme') . '</label></th>';
|
---|
246 | $form .= '<td>';
|
---|
247 | $form .= "<table>\n";
|
---|
248 | $form .= '<tr><td>' . __('XOOPS Groupe', 'xpressme') . '</td><td>' . __('WordPress Role', 'xpressme') . '</td><td>' . __('Role is set at each login', 'xpressme') . "</td></tr>\n";
|
---|
249 | foreach ($this->groupe_role as $groupe) {
|
---|
250 | $form .= "<tr>";
|
---|
251 | $form .= "<td> $groupe->name </td>";
|
---|
252 | $form .= "<td>\n" . '<select name="role_gid_'.$groupe->groupid . '" id="role_gid_' . $groupe->groupid . '">' . "\n";
|
---|
253 | $role_list = '';
|
---|
254 | $group_has_role = false;
|
---|
255 |
|
---|
256 | $select_value = $groupe->role;
|
---|
257 |
|
---|
258 | foreach($wp_roles->role_names as $role => $name) {
|
---|
259 | $name = translate_with_context($name);
|
---|
260 | if ( $role == $select_value) {
|
---|
261 | $selected = ' selected="selected"';
|
---|
262 | $group_has_role = true;
|
---|
263 | } else {
|
---|
264 | $selected = '';
|
---|
265 | }
|
---|
266 | $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n";
|
---|
267 | }
|
---|
268 | if ( $group_has_role ) {
|
---|
269 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
270 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
271 | } else {
|
---|
272 | if ($select_value == 'default'){
|
---|
273 | $role_list .= '<option value="default" selected="selected">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
274 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
275 | } else {
|
---|
276 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
277 | $role_list .= '<option value="" selected="selected">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
278 | }
|
---|
279 | }
|
---|
280 | $form .= $role_list . "</select>\n</td>";
|
---|
281 | if ($groupe->login_all){
|
---|
282 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1" checked ></td>';
|
---|
283 | } else {
|
---|
284 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1"></td>';
|
---|
285 | }
|
---|
286 | $form .= "</tr>\n";
|
---|
287 | }
|
---|
288 | $form .= "</table></td></tr>\n";
|
---|
289 | return $form;
|
---|
290 |
|
---|
291 | }
|
---|
292 |
|
---|
293 | function d3forum_option($do_message = ''){
|
---|
294 | global $xoops_db;
|
---|
295 |
|
---|
296 | $d3frum_list = array();
|
---|
297 | $module_dir_path = get_xoops_root_path();
|
---|
298 |
|
---|
299 | $forum_list = '<select name="ch_d3forum">' . "\n";
|
---|
300 |
|
---|
301 | if ($this->is_use_d3forum != true)
|
---|
302 | $selected = ' selected="selected"';
|
---|
303 | else
|
---|
304 | $selected = '';
|
---|
305 | $forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n";
|
---|
306 |
|
---|
307 | // Form making for forum selection of D3forum
|
---|
308 | $modules_table = get_xoops_prefix() .'modules';
|
---|
309 | $sql = "SELECT mid,name,isactive,dirname FROM $modules_table WHERE isactive = 1";
|
---|
310 | $modules = $xoops_db->get_results($sql);
|
---|
311 | foreach ($modules as $module) {
|
---|
312 | $file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php';
|
---|
313 | if (! file_exists($file_path)) continue;
|
---|
314 | $array_files = file($file_path);
|
---|
315 | // It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file.
|
---|
316 | foreach ($array_files as $aeey_file){
|
---|
317 | if( preg_match( "/\s*(mytrustdirname)\s*(=)\s*([\"'])(d3forum)([\"'])/", $aeey_file ) ) {
|
---|
318 | $forums_tb = get_xoops_prefix() . $module->dirname . '_forums';
|
---|
319 | $cat_tb = get_xoops_prefix() . $module->dirname . '_categories';
|
---|
320 | $sql= "SELECT * FROM $forums_tb LEFT JOIN $cat_tb ON $forums_tb.cat_id = $cat_tb.cat_id";
|
---|
321 | $forums = $xoops_db->get_results($sql);
|
---|
322 | foreach ($forums as $forum) {
|
---|
323 | if (($module->dirname == $this->d3forum_module_dir) && ($forum->forum_id == $this->d3forum_forum_id))
|
---|
324 | $selected = ' selected="selected"';
|
---|
325 | else
|
---|
326 | $selected = '';
|
---|
327 | $forum_div = 'forum|' . $module->dirname . '|' . $forum->forum_id;
|
---|
328 | $forum_select = "$module->name($module->dirname) $forum->cat_title-$forum->forum_title(ID=$forum->forum_id)";
|
---|
329 | $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n";
|
---|
330 | }
|
---|
331 | break;
|
---|
332 | }
|
---|
333 | }
|
---|
334 | $forum_list .= '<br>';
|
---|
335 | }
|
---|
336 | $forum_list .= '</select>' . "\n";
|
---|
337 |
|
---|
338 | $form = '<tr>' . "\n";
|
---|
339 | $form .= '<th><label for="d3forum">' .__('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n";
|
---|
340 | $form .= "<td>\n";
|
---|
341 | $form .= __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') ."<br />\n";
|
---|
342 | $form .= $forum_list."\n";
|
---|
343 | $form .= '<br /><br />';
|
---|
344 | if ($this->is_use_d3forum) $disible = ''; else $disible = 'disabled';
|
---|
345 | $form .= __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
346 | if ($this->is_d3forum_flat){
|
---|
347 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n";
|
---|
348 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' />". __('Threaded','xpressme') . "</label>\n";
|
---|
349 | }else{
|
---|
350 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' />" . __('Flat','xpressme') . "</label>\n";
|
---|
351 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n";
|
---|
352 | }
|
---|
353 | $form .= '<br />';
|
---|
354 | $form .= __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
355 | if ($this->is_d3forum_desc){
|
---|
356 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n";
|
---|
357 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' />". __('ASC','xpressme') . "</label>\n";
|
---|
358 | }else{
|
---|
359 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' />" . __('DESC','xpressme') . "</label>\n";
|
---|
360 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n";
|
---|
361 | }
|
---|
362 | $form .= '<br />';
|
---|
363 | $form .= __('Number of displays of D3Forum comments.', 'xpressme') ." \n";
|
---|
364 | $form .= '&emsp<label> <input name="ch_d3forum_view_num" type="text" size="3" maxlength="3" value="' . $this->d3forum_views_num . '" /></label>'."\n";
|
---|
365 |
|
---|
366 | $form .= '<div class="submit">'."\n";
|
---|
367 | $form .= __('The import and the export between Wordpress Comments and the D3Forum Posts can be done. ', 'xpressme') ."<br />\n";
|
---|
368 | $form .= '<input type="submit" value= "' . __('Export to D3Forum', 'xpressme') . '" name="export_d3f" ' . $disible . ' >' ."\n";
|
---|
369 | $form .= '<input type="submit" value= "' . __('Import from D3Forum', 'xpressme') . '" name="inport_d3f" ' . $disible . ' >' ."<br />\n";
|
---|
370 | $form .= '</div>'."\n";
|
---|
371 | if (!empty($do_message)){
|
---|
372 | $form .= '<div>' . $do_message . '</div>';
|
---|
373 | }
|
---|
374 | $form .= "</td>\n";
|
---|
375 | $form .= "</tr><tr>\n";
|
---|
376 | return $form;
|
---|
377 | }
|
---|
378 |
|
---|
379 | function option_page()
|
---|
380 | {
|
---|
381 | $do_message ='';
|
---|
382 | if (!empty($_POST['submit_update'])) {
|
---|
383 | $this->ReadPostData();
|
---|
384 | $this->SettingValueWrite('update');
|
---|
385 | } else if (isset($_POST['submit_reset'])) {
|
---|
386 | $this->fck_setDefault();
|
---|
387 | $this->SettingValueWrite('update');
|
---|
388 | } else if (isset($_POST['export_d3f'])) {
|
---|
389 | $do_message = 'export(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
|
---|
390 | $do_message .= wp_to_d3forum($this->d3forum_forum_id, $this->d3forum_module_dir);
|
---|
391 | $do_message .= '....END';
|
---|
392 | } else if (isset($_POST['inport_d3f'])) {
|
---|
393 | $do_message = 'Import(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
|
---|
394 | $do_message .= d3forum_to_wp($this->d3forum_forum_id, $this->d3forum_module_dir);
|
---|
395 | $do_message .= '....END';
|
---|
396 | }
|
---|
397 |
|
---|
398 | echo '<div class="wrap">'."\n";
|
---|
399 | echo '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
|
---|
400 | echo '<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2>\n";
|
---|
401 | echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
|
---|
402 | echo '<table class="form-table">'."\n";
|
---|
403 | echo $this->yes_no_radio_option('is_use_xoops_upload_path',
|
---|
404 | __('Media Upload Base Path','xpressme'),
|
---|
405 | __('Use XOOPS UPLOAD PATH','xpressme'),
|
---|
406 | __('USE WordPress BASE_PATH','xpressme')
|
---|
407 | );
|
---|
408 | echo $this->yes_no_radio_option('is_theme_sidebar_disp',
|
---|
409 | __('Thema Sidebar Display','xpressme'),
|
---|
410 | __('YES','xpressme'),
|
---|
411 | __('NO','xpressme')
|
---|
412 | );
|
---|
413 | echo $this->yes_no_radio_option('is_save_post_revision',
|
---|
414 | __('The change tracking of the post is preserved','xpressme'),
|
---|
415 | __('YES','xpressme'),
|
---|
416 | __('NO','xpressme')
|
---|
417 | );
|
---|
418 | echo $this->text_option('old_post_link_text',
|
---|
419 | __('Display Navi Title of Old Post Link','xpressme')
|
---|
420 | );
|
---|
421 | echo $this->text_option('newer_post_link_text',
|
---|
422 | __('Display Navi Title of Newer Post Link','xpressme')
|
---|
423 | );
|
---|
424 | echo $this->yes_no_radio_option('is_postnavi_title_disp',
|
---|
425 | __('Select Display name of PostNavi Link','xpressme'),
|
---|
426 | __('Title of post','xpressme'),
|
---|
427 | __('Title of Navi','xpressme')
|
---|
428 | );
|
---|
429 | echo $this->yes_no_radio_option('is_left_postnavi_old',
|
---|
430 | __('Adjustment of Navi link display position','xpressme'),
|
---|
431 | __("'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right",'xpressme'),
|
---|
432 | __("'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right",'xpressme')
|
---|
433 | );
|
---|
434 | echo $this->yes_no_radio_option('is_author_view_count',
|
---|
435 | __('Is the posts author views counted?','xpressme'),
|
---|
436 | __('YES','xpressme'),
|
---|
437 | __('NO','xpressme')
|
---|
438 | );
|
---|
439 | echo $this->yes_no_radio_option('is_sql_debug',
|
---|
440 | __('Is SQL debugging window displayed?','xpressme'),
|
---|
441 | __('YES','xpressme'),
|
---|
442 | __('NO','xpressme')
|
---|
443 | );
|
---|
444 |
|
---|
445 | echo $this->groupe_role_option();
|
---|
446 |
|
---|
447 | echo $this->d3forum_option($do_message);
|
---|
448 | // $this->is_use_xoops_upload_path_html();
|
---|
449 | echo "</table>\n";
|
---|
450 |
|
---|
451 | echo '<p class="submit">'."\n";
|
---|
452 | echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
|
---|
453 | echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
|
---|
454 | echo "</p>\n";
|
---|
455 |
|
---|
456 | echo "</form>\n" ;
|
---|
457 | echo "</div>\n";
|
---|
458 | }
|
---|
459 |
|
---|
460 | function xpress_upload_filter($uploads)
|
---|
461 | {
|
---|
462 | global $xoops_config;
|
---|
463 | if ($this->is_use_xoops_upload_path){
|
---|
464 | $wordpress_dir = ABSPATH ;
|
---|
465 | $xoops_dir = $xoops_config->xoops_upload_path . '/';
|
---|
466 | $wordpress_base_url = get_option( 'siteurl' );
|
---|
467 | $xoops_upload_url = $xoops_config->xoops_upload_url;
|
---|
468 |
|
---|
469 | $uploads[path] = str_replace ($wordpress_dir, $xoops_dir, $uploads[path]);
|
---|
470 | $uploads[basedir] = str_replace ($wordpress_dir, $xoops_dir, $uploads[basedir]);
|
---|
471 | $uploads[url] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[url]);
|
---|
472 | $uploads[baseurl] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[baseurl]);
|
---|
473 | }
|
---|
474 | return $uploads;
|
---|
475 | }
|
---|
476 |
|
---|
477 | // SQL DEBUG TEST
|
---|
478 | function is_sql_debug_permission()
|
---|
479 | {
|
---|
480 | global $current_user;
|
---|
481 |
|
---|
482 | if (!is_object($current_user)) return false;
|
---|
483 | if ($this->is_sql_debug && ($current_user->user_level >= 10))
|
---|
484 | return true;
|
---|
485 | else
|
---|
486 | return false;
|
---|
487 | }
|
---|
488 |
|
---|
489 | function xpress_sql_debug($query_strings)
|
---|
490 | {
|
---|
491 | if ($this->is_sql_debug_permission()){
|
---|
492 | if (empty($GLOBALS['XPress_SQL_Query'])) $GLOBALS['XPress_SQL_Query'] = '';
|
---|
493 | $GLOBALS['XPress_SQL_Query'] .= $query_strings . '<br />';
|
---|
494 | }
|
---|
495 | return $query_strings;
|
---|
496 | }
|
---|
497 |
|
---|
498 | function displayDebugLog()
|
---|
499 | {
|
---|
500 | if ($this->is_sql_debug_permission()){
|
---|
501 | $content = '';
|
---|
502 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
|
---|
503 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
|
---|
504 | $content .= '<title>XPressME SQL DEBUG</title>' ;
|
---|
505 | $content .= '</head><body>';
|
---|
506 | $content .= $GLOBALS['XPress_SQL_Query'];
|
---|
507 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
|
---|
508 |
|
---|
509 | echo '<script type="text/javascript">
|
---|
510 | <!--//
|
---|
511 | 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");
|
---|
512 | xpress_debug_window.document.clear();
|
---|
513 | xpress_debug_window.focus();
|
---|
514 | ';
|
---|
515 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
|
---|
516 | foreach ($lines as $line) {
|
---|
517 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
|
---|
518 | }
|
---|
519 | echo '
|
---|
520 | xpress_debug_window.document.close();
|
---|
521 | //-->
|
---|
522 | </script>';
|
---|
523 | }
|
---|
524 | }
|
---|
525 |
|
---|
526 | function set_d3forum_external_link_format()
|
---|
527 | {
|
---|
528 | global $xoops_db;
|
---|
529 | /* var $is_use_d3forum;
|
---|
530 | var $d3forum_module_dir;
|
---|
531 | var $d3forum_forum_id;
|
---|
532 | var $d3forum_external_link_format;
|
---|
533 | if ($this->$is_use_d3forum){
|
---|
534 | $content = '';
|
---|
535 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
|
---|
536 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
|
---|
537 | $content .= '<title>XPressME SQL DEBUG</title>' ;
|
---|
538 | $content .= '</head><body>';
|
---|
539 | $content .= $GLOBALS['XPress_SQL_Query'];
|
---|
540 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
|
---|
541 |
|
---|
542 | echo '<script type="text/javascript">
|
---|
543 | <!--//
|
---|
544 | 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");
|
---|
545 | xpress_debug_window.document.clear();
|
---|
546 | xpress_debug_window.focus();
|
---|
547 | ';
|
---|
548 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
|
---|
549 | foreach ($lines as $line) {
|
---|
550 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
|
---|
551 | }
|
---|
552 | echo '
|
---|
553 | xpress_debug_window.document.close();
|
---|
554 | //-->
|
---|
555 | </script>';
|
---|
556 | }
|
---|
557 | */
|
---|
558 | }
|
---|
559 |
|
---|
560 | }
|
---|
561 | ?> |
---|