[19] | 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;
|
---|
[26] | 8 | var $is_theme_sidebar_disp;
|
---|
[28] | 9 | var $is_save_post_revision;
|
---|
[32] | 10 | var $is_postnavi_title_disp;
|
---|
| 11 | var $is_left_postnavi_old;
|
---|
| 12 | var $old_post_link_text;
|
---|
| 13 | var $newer_post_link_text;
|
---|
[51] | 14 | var $is_author_view_count;
|
---|
[88] | 15 | var $is_sql_debug;
|
---|
[76] | 16 | var $groupe_role;
|
---|
[99] | 17 | var $is_use_d3forum;
|
---|
| 18 | var $d3forum_module_dir;
|
---|
| 19 | var $d3forum_forum_id;
|
---|
| 20 | var $d3forum_external_link_format;
|
---|
[19] | 21 | //constructor
|
---|
[20] | 22 | function XPressME_Class()
|
---|
[19] | 23 | {
|
---|
[76] | 24 | global $xoops_db;
|
---|
| 25 |
|
---|
[19] | 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;
|
---|
[26] | 46 | $this->is_theme_sidebar_disp = true;
|
---|
[28] | 47 | $this->is_save_post_revision = true;
|
---|
[32] | 48 | $this->is_postnavi_title_disp = true;
|
---|
| 49 | $this->is_left_postnavi_old = true;
|
---|
[79] | 50 | $this->old_post_link_text = __('to Old Post', 'xpressme');
|
---|
| 51 | $this->newer_post_link_text = __('to Newer Post', 'xpressme');
|
---|
[51] | 52 | $this->is_author_view_count = false;
|
---|
[88] | 53 | $this->is_sql_debug = false;
|
---|
[99] | 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';
|
---|
[108] | 58 | $this->is_d3forum_flat = true;
|
---|
| 59 | $this->is_d3forum_desc = true;
|
---|
| 60 | $this->d3forum_views_num = 10;
|
---|
[19] | 61 | }
|
---|
| 62 |
|
---|
| 63 | function SettingValueRead()
|
---|
| 64 | {
|
---|
[76] | 65 | global $xoops_db;
|
---|
[19] | 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 | }
|
---|
[81] | 75 | if (!empty($xoops_db)) // at install trap
|
---|
| 76 | $this->GroupeRoleRead();
|
---|
[19] | 77 | }
|
---|
| 78 |
|
---|
| 79 | // mode 0:add 1:update
|
---|
| 80 | function SettingValueWrite($mode)
|
---|
| 81 | {
|
---|
| 82 | $write_options = array (
|
---|
[26] | 83 | 'is_use_xoops_upload_path' => $this->is_use_xoops_upload_path ,
|
---|
[32] | 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 ,
|
---|
[51] | 89 | 'newer_post_link_text' => $this->newer_post_link_text,
|
---|
[88] | 90 | 'is_author_view_count' => $this->is_author_view_count,
|
---|
[99] | 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,
|
---|
[108] | 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
|
---|
[19] | 99 | );
|
---|
| 100 | if ($mode == 'add_new') {
|
---|
| 101 | add_option('xpressme_option', $write_options);
|
---|
| 102 | } else {
|
---|
| 103 | update_option("xpressme_option", $write_options);
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
[20] | 106 |
|
---|
[76] | 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) {
|
---|
[81] | 126 | if ($groupe->groupid == $before_groupe->groupid) {
|
---|
| 127 | $role = $before_groupe->role;
|
---|
| 128 | $login_all = $before_groupe->login_all;
|
---|
| 129 | }
|
---|
[76] | 130 | }
|
---|
| 131 |
|
---|
| 132 | $insert_sql = "INSERT INTO $table ";
|
---|
[81] | 133 | $insert_sql .= "(groupid , name , description , group_type , role , login_all) ";
|
---|
[76] | 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 . "' , ";
|
---|
[95] | 139 | $insert_sql .= "'" . $role . "' , '";
|
---|
| 140 | $insert_sql .= $login_all . "')";
|
---|
[76] | 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 |
|
---|
[20] | 150 | function ReadPostData()
|
---|
| 151 | {
|
---|
| 152 | $this->is_use_xoops_upload_path = stripslashes(trim($_POST['ch_is_use_xoops_upload_path']));
|
---|
[26] | 153 | $this->is_theme_sidebar_disp = stripslashes(trim($_POST['ch_is_theme_sidebar_disp']));
|
---|
[28] | 154 | $this->is_save_post_revision = stripslashes(trim($_POST['ch_is_save_post_revision']));
|
---|
[32] | 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']);
|
---|
[79] | 158 | if(empty($this->old_post_link_text)) $this->old_post_link_text = __('to Old Post', 'xpressme');
|
---|
[32] | 159 | $this->newer_post_link_text = stripslashes($_POST['ch_newer_post_link_text']);
|
---|
[79] | 160 | if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('to Newer Post', 'xpressme');
|
---|
[51] | 161 | $this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count']));
|
---|
[88] | 162 | $this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug']));
|
---|
[99] | 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 | }
|
---|
[108] | 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']));
|
---|
[32] | 180 |
|
---|
[81] | 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 | }
|
---|
[20] | 201 | }
|
---|
[21] | 202 |
|
---|
| 203 | function yes_no_radio_option($option_name,$option_desc,$yes = '',$no= ''){
|
---|
[32] | 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;
|
---|
[21] | 223 |
|
---|
| 224 | }
|
---|
[32] | 225 |
|
---|
| 226 | function text_option($option_name,$option_desc){
|
---|
| 227 | $value = $this->{$option_name};
|
---|
| 228 | $ans_name = 'ch_' . $option_name;
|
---|
[19] | 229 |
|
---|
[32] | 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;
|
---|
[21] | 238 |
|
---|
[32] | 239 | }
|
---|
[76] | 240 |
|
---|
| 241 | function groupe_role_option(){
|
---|
| 242 | global $wp_roles , $xoops_db;
|
---|
[21] | 243 |
|
---|
[76] | 244 | $form = '';
|
---|
[79] | 245 | $form .= '<tr><th><label for="role">' .__('Role Setting at Login', 'xpressme') . '</label></th>';
|
---|
[76] | 246 | $form .= '<td>';
|
---|
| 247 | $form .= "<table>\n";
|
---|
[81] | 248 | $form .= '<tr><td>' . __('XOOPS Groupe', 'xpressme') . '</td><td>' . __('WordPress Role', 'xpressme') . '</td><td>' . __('Role is set at each login', 'xpressme') . "</td></tr>\n";
|
---|
[76] | 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 |
|
---|
[139] | 258 |
|
---|
| 259 |
|
---|
[76] | 260 | foreach($wp_roles->role_names as $role => $name) {
|
---|
| 261 | $name = translate_with_context($name);
|
---|
| 262 | if ( $role == $select_value) {
|
---|
| 263 | $selected = ' selected="selected"';
|
---|
| 264 | $group_has_role = true;
|
---|
| 265 | } else {
|
---|
| 266 | $selected = '';
|
---|
| 267 | }
|
---|
[139] | 268 | if ($groupe->group_type != 'Admin' || !empty($selected)) {
|
---|
| 269 | $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n";
|
---|
| 270 | }
|
---|
[76] | 271 | }
|
---|
[139] | 272 | if ($groupe->group_type != 'Admin') {
|
---|
[81] | 273 | if ( $group_has_role ) {
|
---|
| 274 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
| 275 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
| 276 | } else {
|
---|
| 277 | if ($select_value == 'default'){
|
---|
| 278 | $role_list .= '<option value="default" selected="selected">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
| 279 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
| 280 | } else {
|
---|
| 281 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
| 282 | $role_list .= '<option value="" selected="selected">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
| 283 | }
|
---|
| 284 | }
|
---|
[139] | 285 | }
|
---|
[81] | 286 | $form .= $role_list . "</select>\n</td>";
|
---|
| 287 | if ($groupe->login_all){
|
---|
| 288 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1" checked ></td>';
|
---|
| 289 | } else {
|
---|
| 290 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1"></td>';
|
---|
| 291 | }
|
---|
| 292 | $form .= "</tr>\n";
|
---|
[76] | 293 | }
|
---|
| 294 | $form .= "</table></td></tr>\n";
|
---|
| 295 | return $form;
|
---|
| 296 |
|
---|
| 297 | }
|
---|
[99] | 298 |
|
---|
[108] | 299 | function d3forum_option($do_message = ''){
|
---|
[99] | 300 | global $xoops_db;
|
---|
[76] | 301 |
|
---|
[99] | 302 | $d3frum_list = array();
|
---|
| 303 | $module_dir_path = get_xoops_root_path();
|
---|
| 304 |
|
---|
| 305 | $forum_list = '<select name="ch_d3forum">' . "\n";
|
---|
| 306 |
|
---|
| 307 | if ($this->is_use_d3forum != true)
|
---|
| 308 | $selected = ' selected="selected"';
|
---|
| 309 | else
|
---|
| 310 | $selected = '';
|
---|
| 311 | $forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n";
|
---|
| 312 |
|
---|
| 313 | // Form making for forum selection of D3forum
|
---|
| 314 | $modules_table = get_xoops_prefix() .'modules';
|
---|
| 315 | $sql = "SELECT mid,name,isactive,dirname FROM $modules_table WHERE isactive = 1";
|
---|
| 316 | $modules = $xoops_db->get_results($sql);
|
---|
| 317 | foreach ($modules as $module) {
|
---|
| 318 | $file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php';
|
---|
| 319 | if (! file_exists($file_path)) continue;
|
---|
| 320 | $array_files = file($file_path);
|
---|
| 321 | // It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file.
|
---|
| 322 | foreach ($array_files as $aeey_file){
|
---|
[108] | 323 | if( preg_match( "/\s*(mytrustdirname)\s*(=)\s*([\"'])(d3forum)([\"'])/", $aeey_file ) ) {
|
---|
[99] | 324 | $forums_tb = get_xoops_prefix() . $module->dirname . '_forums';
|
---|
| 325 | $cat_tb = get_xoops_prefix() . $module->dirname . '_categories';
|
---|
| 326 | $sql= "SELECT * FROM $forums_tb LEFT JOIN $cat_tb ON $forums_tb.cat_id = $cat_tb.cat_id";
|
---|
| 327 | $forums = $xoops_db->get_results($sql);
|
---|
| 328 | foreach ($forums as $forum) {
|
---|
| 329 | if (($module->dirname == $this->d3forum_module_dir) && ($forum->forum_id == $this->d3forum_forum_id))
|
---|
| 330 | $selected = ' selected="selected"';
|
---|
| 331 | else
|
---|
| 332 | $selected = '';
|
---|
| 333 | $forum_div = 'forum|' . $module->dirname . '|' . $forum->forum_id;
|
---|
| 334 | $forum_select = "$module->name($module->dirname) $forum->cat_title-$forum->forum_title(ID=$forum->forum_id)";
|
---|
| 335 | $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n";
|
---|
| 336 | }
|
---|
| 337 | break;
|
---|
| 338 | }
|
---|
| 339 | }
|
---|
[108] | 340 | $forum_list .= '<br>';
|
---|
[99] | 341 | }
|
---|
| 342 | $forum_list .= '</select>' . "\n";
|
---|
| 343 |
|
---|
| 344 | $form = '<tr>' . "\n";
|
---|
| 345 | $form .= '<th><label for="d3forum">' .__('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n";
|
---|
| 346 | $form .= "<td>\n";
|
---|
| 347 | $form .= __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') ."<br />\n";
|
---|
| 348 | $form .= $forum_list."\n";
|
---|
[108] | 349 | $form .= '<br /><br />';
|
---|
| 350 | if ($this->is_use_d3forum) $disible = ''; else $disible = 'disabled';
|
---|
| 351 | $form .= __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
| 352 | if ($this->is_d3forum_flat){
|
---|
| 353 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n";
|
---|
| 354 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' />". __('Threaded','xpressme') . "</label>\n";
|
---|
| 355 | }else{
|
---|
| 356 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='1' />" . __('Flat','xpressme') . "</label>\n";
|
---|
| 357 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_type' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n";
|
---|
| 358 | }
|
---|
| 359 | $form .= '<br />';
|
---|
| 360 | $form .= __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
| 361 | if ($this->is_d3forum_desc){
|
---|
| 362 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n";
|
---|
| 363 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' />". __('ASC','xpressme') . "</label>\n";
|
---|
| 364 | }else{
|
---|
| 365 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='1' />" . __('DESC','xpressme') . "</label>\n";
|
---|
| 366 | $form .= "&ensp<label><input type='radio' name='ch_d3forum_order' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n";
|
---|
| 367 | }
|
---|
| 368 | $form .= '<br />';
|
---|
| 369 | $form .= __('Number of displays of D3Forum comments.', 'xpressme') ." \n";
|
---|
| 370 | $form .= '&emsp<label> <input name="ch_d3forum_view_num" type="text" size="3" maxlength="3" value="' . $this->d3forum_views_num . '" /></label>'."\n";
|
---|
| 371 |
|
---|
| 372 | $form .= '<div class="submit">'."\n";
|
---|
| 373 | $form .= __('The import and the export between Wordpress Comments and the D3Forum Posts can be done. ', 'xpressme') ."<br />\n";
|
---|
| 374 | $form .= '<input type="submit" value= "' . __('Export to D3Forum', 'xpressme') . '" name="export_d3f" ' . $disible . ' >' ."\n";
|
---|
| 375 | $form .= '<input type="submit" value= "' . __('Import from D3Forum', 'xpressme') . '" name="inport_d3f" ' . $disible . ' >' ."<br />\n";
|
---|
| 376 | $form .= '</div>'."\n";
|
---|
| 377 | if (!empty($do_message)){
|
---|
| 378 | $form .= '<div>' . $do_message . '</div>';
|
---|
| 379 | }
|
---|
[99] | 380 | $form .= "</td>\n";
|
---|
| 381 | $form .= "</tr><tr>\n";
|
---|
| 382 | return $form;
|
---|
| 383 | }
|
---|
| 384 |
|
---|
[19] | 385 | function option_page()
|
---|
| 386 | {
|
---|
[108] | 387 | $do_message ='';
|
---|
[20] | 388 | if (!empty($_POST['submit_update'])) {
|
---|
| 389 | $this->ReadPostData();
|
---|
| 390 | $this->SettingValueWrite('update');
|
---|
| 391 | } else if (isset($_POST['submit_reset'])) {
|
---|
| 392 | $this->fck_setDefault();
|
---|
| 393 | $this->SettingValueWrite('update');
|
---|
[108] | 394 | } else if (isset($_POST['export_d3f'])) {
|
---|
| 395 | $do_message = 'export(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
|
---|
| 396 | $do_message .= wp_to_d3forum($this->d3forum_forum_id, $this->d3forum_module_dir);
|
---|
| 397 | $do_message .= '....END';
|
---|
| 398 | } else if (isset($_POST['inport_d3f'])) {
|
---|
| 399 | $do_message = 'Import(' . $this->d3forum_module_dir . '--ID=' . $this->d3forum_forum_id . ')................';
|
---|
| 400 | $do_message .= d3forum_to_wp($this->d3forum_forum_id, $this->d3forum_module_dir);
|
---|
| 401 | $do_message .= '....END';
|
---|
| 402 | }
|
---|
[20] | 403 |
|
---|
[21] | 404 | echo '<div class="wrap">'."\n";
|
---|
| 405 | echo '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
|
---|
| 406 | echo '<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2>\n";
|
---|
| 407 | echo '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
|
---|
| 408 | echo '<table class="form-table">'."\n";
|
---|
| 409 | echo $this->yes_no_radio_option('is_use_xoops_upload_path',
|
---|
| 410 | __('Media Upload Base Path','xpressme'),
|
---|
| 411 | __('Use XOOPS UPLOAD PATH','xpressme'),
|
---|
[22] | 412 | __('USE WordPress BASE_PATH','xpressme')
|
---|
[21] | 413 | );
|
---|
[26] | 414 | echo $this->yes_no_radio_option('is_theme_sidebar_disp',
|
---|
| 415 | __('Thema Sidebar Display','xpressme'),
|
---|
| 416 | __('YES','xpressme'),
|
---|
| 417 | __('NO','xpressme')
|
---|
| 418 | );
|
---|
[28] | 419 | echo $this->yes_no_radio_option('is_save_post_revision',
|
---|
| 420 | __('The change tracking of the post is preserved','xpressme'),
|
---|
| 421 | __('YES','xpressme'),
|
---|
| 422 | __('NO','xpressme')
|
---|
| 423 | );
|
---|
[79] | 424 | echo $this->text_option('old_post_link_text',
|
---|
| 425 | __('Display Navi Title of Old Post Link','xpressme')
|
---|
| 426 | );
|
---|
| 427 | echo $this->text_option('newer_post_link_text',
|
---|
| 428 | __('Display Navi Title of Newer Post Link','xpressme')
|
---|
| 429 | );
|
---|
[32] | 430 | echo $this->yes_no_radio_option('is_postnavi_title_disp',
|
---|
| 431 | __('Select Display name of PostNavi Link','xpressme'),
|
---|
| 432 | __('Title of post','xpressme'),
|
---|
[79] | 433 | __('Title of Navi','xpressme')
|
---|
[32] | 434 | );
|
---|
| 435 | echo $this->yes_no_radio_option('is_left_postnavi_old',
|
---|
| 436 | __('Adjustment of Navi link display position','xpressme'),
|
---|
| 437 | __("'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right",'xpressme'),
|
---|
| 438 | __("'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right",'xpressme')
|
---|
| 439 | );
|
---|
[51] | 440 | echo $this->yes_no_radio_option('is_author_view_count',
|
---|
| 441 | __('Is the posts author views counted?','xpressme'),
|
---|
| 442 | __('YES','xpressme'),
|
---|
| 443 | __('NO','xpressme')
|
---|
[76] | 444 | );
|
---|
[88] | 445 | echo $this->yes_no_radio_option('is_sql_debug',
|
---|
| 446 | __('Is SQL debugging window displayed?','xpressme'),
|
---|
| 447 | __('YES','xpressme'),
|
---|
| 448 | __('NO','xpressme')
|
---|
| 449 | );
|
---|
| 450 |
|
---|
[99] | 451 | echo $this->groupe_role_option();
|
---|
| 452 |
|
---|
[108] | 453 | echo $this->d3forum_option($do_message);
|
---|
[21] | 454 | // $this->is_use_xoops_upload_path_html();
|
---|
| 455 | echo "</table>\n";
|
---|
[20] | 456 |
|
---|
[21] | 457 | echo '<p class="submit">'."\n";
|
---|
| 458 | echo '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
|
---|
| 459 | echo '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
|
---|
| 460 | echo "</p>\n";
|
---|
[19] | 461 |
|
---|
[21] | 462 | echo "</form>\n" ;
|
---|
| 463 | echo "</div>\n";
|
---|
[19] | 464 | }
|
---|
| 465 |
|
---|
| 466 | function xpress_upload_filter($uploads)
|
---|
| 467 | {
|
---|
[95] | 468 | global $xoops_config;
|
---|
[19] | 469 | if ($this->is_use_xoops_upload_path){
|
---|
| 470 | $wordpress_dir = ABSPATH ;
|
---|
[95] | 471 | $xoops_dir = $xoops_config->xoops_upload_path . '/';
|
---|
[19] | 472 | $wordpress_base_url = get_option( 'siteurl' );
|
---|
[95] | 473 | $xoops_upload_url = $xoops_config->xoops_upload_url;
|
---|
[19] | 474 |
|
---|
| 475 | $uploads[path] = str_replace ($wordpress_dir, $xoops_dir, $uploads[path]);
|
---|
| 476 | $uploads[basedir] = str_replace ($wordpress_dir, $xoops_dir, $uploads[basedir]);
|
---|
| 477 | $uploads[url] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[url]);
|
---|
| 478 | $uploads[baseurl] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[baseurl]);
|
---|
| 479 | }
|
---|
| 480 | return $uploads;
|
---|
[88] | 481 | }
|
---|
| 482 |
|
---|
| 483 | // SQL DEBUG TEST
|
---|
| 484 | function is_sql_debug_permission()
|
---|
| 485 | {
|
---|
| 486 | global $current_user;
|
---|
| 487 |
|
---|
[95] | 488 | if (!is_object($current_user)) return false;
|
---|
[88] | 489 | if ($this->is_sql_debug && ($current_user->user_level >= 10))
|
---|
| 490 | return true;
|
---|
| 491 | else
|
---|
| 492 | return false;
|
---|
| 493 | }
|
---|
| 494 |
|
---|
| 495 | function xpress_sql_debug($query_strings)
|
---|
| 496 | {
|
---|
| 497 | if ($this->is_sql_debug_permission()){
|
---|
| 498 | if (empty($GLOBALS['XPress_SQL_Query'])) $GLOBALS['XPress_SQL_Query'] = '';
|
---|
| 499 | $GLOBALS['XPress_SQL_Query'] .= $query_strings . '<br />';
|
---|
| 500 | }
|
---|
| 501 | return $query_strings;
|
---|
| 502 | }
|
---|
| 503 |
|
---|
| 504 | function displayDebugLog()
|
---|
| 505 | {
|
---|
| 506 | if ($this->is_sql_debug_permission()){
|
---|
| 507 | $content = '';
|
---|
| 508 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
|
---|
| 509 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
|
---|
| 510 | $content .= '<title>XPressME SQL DEBUG</title>' ;
|
---|
| 511 | $content .= '</head><body>';
|
---|
| 512 | $content .= $GLOBALS['XPress_SQL_Query'];
|
---|
| 513 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
|
---|
| 514 |
|
---|
| 515 | echo '<script type="text/javascript">
|
---|
| 516 | <!--//
|
---|
| 517 | 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");
|
---|
| 518 | xpress_debug_window.document.clear();
|
---|
| 519 | xpress_debug_window.focus();
|
---|
| 520 | ';
|
---|
| 521 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
|
---|
| 522 | foreach ($lines as $line) {
|
---|
| 523 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
|
---|
| 524 | }
|
---|
| 525 | echo '
|
---|
| 526 | xpress_debug_window.document.close();
|
---|
| 527 | //-->
|
---|
| 528 | </script>';
|
---|
| 529 | }
|
---|
[19] | 530 | }
|
---|
[104] | 531 |
|
---|
| 532 | function set_d3forum_external_link_format()
|
---|
| 533 | {
|
---|
| 534 | global $xoops_db;
|
---|
| 535 | /* var $is_use_d3forum;
|
---|
| 536 | var $d3forum_module_dir;
|
---|
| 537 | var $d3forum_forum_id;
|
---|
| 538 | var $d3forum_external_link_format;
|
---|
| 539 | if ($this->$is_use_d3forum){
|
---|
| 540 | $content = '';
|
---|
| 541 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
|
---|
| 542 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
|
---|
| 543 | $content .= '<title>XPressME SQL DEBUG</title>' ;
|
---|
| 544 | $content .= '</head><body>';
|
---|
| 545 | $content .= $GLOBALS['XPress_SQL_Query'];
|
---|
| 546 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
|
---|
[28] | 547 |
|
---|
[104] | 548 | echo '<script type="text/javascript">
|
---|
| 549 | <!--//
|
---|
| 550 | 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");
|
---|
| 551 | xpress_debug_window.document.clear();
|
---|
| 552 | xpress_debug_window.focus();
|
---|
| 553 | ';
|
---|
| 554 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
|
---|
| 555 | foreach ($lines as $line) {
|
---|
| 556 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
|
---|
| 557 | }
|
---|
| 558 | echo '
|
---|
| 559 | xpress_debug_window.document.close();
|
---|
| 560 | //-->
|
---|
| 561 | </script>';
|
---|
| 562 | }
|
---|
| 563 | */
|
---|
| 564 | }
|
---|
| 565 |
|
---|
[19] | 566 | }
|
---|
| 567 | ?> |
---|