[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;
|
---|
[143] | 14 | var $is_left_page_navi_old;
|
---|
| 15 | var $old_page_link_text;
|
---|
| 16 | var $newer_page_link_text;
|
---|
[51] | 17 | var $is_author_view_count;
|
---|
[88] | 18 | var $is_sql_debug;
|
---|
[76] | 19 | var $groupe_role;
|
---|
[99] | 20 | var $is_use_d3forum;
|
---|
| 21 | var $d3forum_module_dir;
|
---|
| 22 | var $d3forum_forum_id;
|
---|
| 23 | var $d3forum_external_link_format;
|
---|
[145] | 24 | var $is_content_excerpt;
|
---|
| 25 | var $ascii_judged_rate;
|
---|
| 26 | var $excerpt_length_word;
|
---|
| 27 | var $excerpt_length_character;
|
---|
[350] | 28 | var $excerpt_more_link_text;
|
---|
[145] | 29 | var $more_link_text;
|
---|
| 30 | var $viewer_type;
|
---|
[155] | 31 | var $is_multi_user;
|
---|
[201] | 32 | var $meta_keyword_type;
|
---|
| 33 | var $meta_description_type;
|
---|
[202] | 34 | var $meta_robot_type;
|
---|
[379] | 35 | var $is_dashboard_blog_disp;
|
---|
| 36 | var $is_dashboard_forum_disp;
|
---|
[19] | 37 | //constructor
|
---|
[20] | 38 | function XPressME_Class()
|
---|
[19] | 39 | {
|
---|
[76] | 40 | global $xoops_db;
|
---|
| 41 |
|
---|
[19] | 42 | $this->setdefault(); //not setting propaty load
|
---|
| 43 | $this->SettingValueRead();
|
---|
| 44 | }
|
---|
| 45 |
|
---|
[302] | 46 | //Set Default Value
|
---|
[19] | 47 | function setDefault()
|
---|
| 48 | {
|
---|
| 49 | $this->is_use_xoops_upload_path = true;
|
---|
[145] | 50 | $this->is_theme_sidebar_disp = false;
|
---|
[28] | 51 | $this->is_save_post_revision = true;
|
---|
[32] | 52 | $this->is_postnavi_title_disp = true;
|
---|
| 53 | $this->is_left_postnavi_old = true;
|
---|
[143] | 54 | $this->old_post_link_text = __('Older Post', 'xpressme');
|
---|
| 55 | $this->newer_post_link_text = __('Newer Post', 'xpressme');
|
---|
| 56 | $this->is_left_page_navi_old = true;
|
---|
| 57 | $this->old_page_link_text = __('Older Entries', 'xpressme');
|
---|
| 58 | $this->newer_page_link_text = __('Newer Entries', 'xpressme');
|
---|
[51] | 59 | $this->is_author_view_count = false;
|
---|
[88] | 60 | $this->is_sql_debug = false;
|
---|
[99] | 61 | $this->is_use_d3forum = false;
|
---|
| 62 | $this->d3forum_module_dir = '';
|
---|
| 63 | $this->d3forum_forum_id = '';
|
---|
| 64 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
[108] | 65 | $this->is_d3forum_flat = true;
|
---|
| 66 | $this->is_d3forum_desc = true;
|
---|
| 67 | $this->d3forum_views_num = 10;
|
---|
[145] | 68 | $this->is_content_excerpt = true;
|
---|
| 69 | $this->ascii_judged_rate = 90;
|
---|
| 70 | $this->excerpt_length_word = 40;
|
---|
| 71 | $this->excerpt_length_character = 120;
|
---|
[350] | 72 | $this->excerpt_more_link_text = __('Read the rest of this entry »', 'xpressme');
|
---|
| 73 | $this->more_link_text = __('Read the rest of this entry »', 'xpressme');
|
---|
[145] | 74 | $this->viewer_type = 'xoops';
|
---|
[155] | 75 | $this->is_multi_user = false;
|
---|
[201] | 76 | $this->meta_keyword_type = 'xoops';
|
---|
| 77 | $this->meta_description_type = 'xoops';
|
---|
[202] | 78 | $this->meta_robot_type = 'xoops';
|
---|
[379] | 79 | $this->is_dashboard_blog_disp = true;
|
---|
| 80 | $this->is_dashboard_forum_disp = true;
|
---|
[19] | 81 | }
|
---|
| 82 |
|
---|
| 83 | function SettingValueRead()
|
---|
| 84 | {
|
---|
[76] | 85 | global $xoops_db;
|
---|
[19] | 86 | $options = get_option('xpressme_option');
|
---|
| 87 | if (!$options) {
|
---|
| 88 | $this->setDefault();
|
---|
| 89 | $this->SettingValueWrite('add_new');
|
---|
| 90 | } else {
|
---|
| 91 | foreach ($options as $option_name => $option_value){
|
---|
| 92 | $this-> {$option_name} = $option_value;
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
[81] | 95 | if (!empty($xoops_db)) // at install trap
|
---|
| 96 | $this->GroupeRoleRead();
|
---|
[19] | 97 | }
|
---|
| 98 |
|
---|
| 99 | // mode 0:add 1:update
|
---|
| 100 | function SettingValueWrite($mode)
|
---|
| 101 | {
|
---|
| 102 | $write_options = array (
|
---|
[26] | 103 | 'is_use_xoops_upload_path' => $this->is_use_xoops_upload_path ,
|
---|
[32] | 104 | 'is_theme_sidebar_disp' => $this->is_theme_sidebar_disp ,
|
---|
| 105 | 'is_save_post_revision' => $this->is_save_post_revision ,
|
---|
| 106 | 'is_postnavi_title_disp' => $this->is_postnavi_title_disp ,
|
---|
| 107 | 'is_left_postnavi_old' => $this->is_left_postnavi_old ,
|
---|
| 108 | 'old_post_link_text' => $this->old_post_link_text ,
|
---|
[51] | 109 | 'newer_post_link_text' => $this->newer_post_link_text,
|
---|
[143] | 110 | 'is_left_page_navi_old' => $this->is_left_page_navi_old ,
|
---|
| 111 | 'old_page_link_text' => $this->old_page_link_text ,
|
---|
| 112 | 'newer_page_link_text' => $this->newer_page_link_text,
|
---|
[88] | 113 | 'is_author_view_count' => $this->is_author_view_count,
|
---|
[99] | 114 | 'is_sql_debug' => $this->is_sql_debug,
|
---|
| 115 | 'is_use_d3forum' => $this->is_use_d3forum,
|
---|
| 116 | 'd3forum_module_dir' => $this->d3forum_module_dir,
|
---|
| 117 | 'd3forum_forum_id' => $this->d3forum_forum_id,
|
---|
[108] | 118 | 'd3forum_external_link_format' => $this->d3forum_external_link_format,
|
---|
| 119 | 'is_d3forum_flat' => $this->is_d3forum_flat,
|
---|
| 120 | 'is_d3forum_desc' => $this->is_d3forum_desc,
|
---|
[145] | 121 | 'd3forum_views_num' =>$this->d3forum_views_num,
|
---|
| 122 | 'is_content_excerpt' => $this->is_content_excerpt,
|
---|
| 123 | 'ascii_judged_rate' => $this->ascii_judged_rate,
|
---|
| 124 | 'excerpt_length_word' => $this->excerpt_length_word,
|
---|
| 125 | 'excerpt_length_character' => $this->excerpt_length_character,
|
---|
[350] | 126 | 'excerpt_more_link_text' => $this->excerpt_more_link_text,
|
---|
[145] | 127 | 'more_link_text' => $this->more_link_text,
|
---|
[155] | 128 | 'viewer_type' => $this->viewer_type,
|
---|
[201] | 129 | 'is_multi_user' => $this->is_multi_user,
|
---|
| 130 | 'meta_keyword_type' => $this->meta_keyword_type,
|
---|
[202] | 131 | 'meta_description_type' => $this->meta_description_type,
|
---|
[379] | 132 | 'meta_robot_type' => $this->meta_robot_type,
|
---|
| 133 | 'is_dashboard_blog_disp' => $this->is_dashboard_blog_disp,
|
---|
| 134 | 'is_dashboard_forum_disp' => $this->is_dashboard_forum_disp
|
---|
[19] | 135 | );
|
---|
| 136 | if ($mode == 'add_new') {
|
---|
| 137 | add_option('xpressme_option', $write_options);
|
---|
| 138 | } else {
|
---|
| 139 | update_option("xpressme_option", $write_options);
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
[20] | 142 |
|
---|
[76] | 143 | function GroupeRoleRead() {
|
---|
| 144 | global $xoops_db;
|
---|
| 145 |
|
---|
| 146 | // table sync
|
---|
| 147 | $table = get_wp_prefix() . 'group_role';
|
---|
| 148 | $xoops_group = get_xoops_prefix() . 'groups';
|
---|
[152] | 149 | $xoops_group_permission = get_xoops_prefix() . 'group_permission';
|
---|
| 150 |
|
---|
| 151 | $module_id = get_xpress_modid();
|
---|
| 152 |
|
---|
[76] | 153 | $sql= "SELECT * FROM $table";
|
---|
| 154 | $before_groupes = $xoops_db->get_results($sql);
|
---|
| 155 |
|
---|
| 156 | $sql = "DELETE FROM $table";
|
---|
| 157 | $xoops_db->query($sql);
|
---|
| 158 |
|
---|
[152] | 159 | $sql = "SELECT * FROM $xoops_group_permission WHERE gperm_itemid = $module_id";
|
---|
| 160 | $gperms = $xoops_db->get_results($sql);
|
---|
[76] | 161 |
|
---|
[152] | 162 | $sql = "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'";
|
---|
[76] | 163 | $groupes = $xoops_db->get_results($sql);
|
---|
| 164 | $insert_sql = '';
|
---|
| 165 | foreach ($groupes as $groupe) {
|
---|
[152] | 166 | $parmsql = "SELECT * FROM $xoops_group_permission WHERE gperm_itemid = $module_id AND gperm_groupid = $groupe->groupid";
|
---|
| 167 | $gperms = $xoops_db->get_results($parmsql);
|
---|
| 168 | $parmission = '';
|
---|
| 169 | foreach ($gperms as $gperm) {
|
---|
| 170 | $parmission = $gperm->gperm_name;
|
---|
| 171 | if ($parmission == 'module_admin') break;
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | if (!empty($parmission)){
|
---|
| 175 | $role = '';
|
---|
| 176 | foreach ($before_groupes as $before_groupe) {
|
---|
| 177 | if ($groupe->groupid == $before_groupe->groupid) {
|
---|
| 178 | $role = $before_groupe->role;
|
---|
| 179 | $login_all = $before_groupe->login_all;
|
---|
| 180 | }
|
---|
[81] | 181 | }
|
---|
[152] | 182 | if ($parmission == 'module_admin') $role = 'administrator';
|
---|
| 183 |
|
---|
| 184 | $insert_sql = "INSERT INTO $table ";
|
---|
| 185 | $insert_sql .= "(groupid , name , description , group_type , role , login_all) ";
|
---|
| 186 | $insert_sql .= "VALUES (";
|
---|
| 187 | $insert_sql .= $groupe->groupid . ', ';
|
---|
| 188 | $insert_sql .= "'" . $groupe->name . "' , ";
|
---|
| 189 | $insert_sql .= "'" . $groupe->description . "' , ";
|
---|
| 190 | $insert_sql .= "'" . $parmission . "' , ";
|
---|
| 191 | $insert_sql .= "'" . $role . "' , '";
|
---|
| 192 | $insert_sql .= $login_all . "')";
|
---|
| 193 | $xoops_db->query($insert_sql);
|
---|
[76] | 194 | }
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | $sql= "SELECT * FROM $table";
|
---|
| 198 |
|
---|
| 199 | $this->groupe_role = $xoops_db->get_results($sql);
|
---|
| 200 | $sql= "SELECT * FROM $table";
|
---|
| 201 | }
|
---|
| 202 |
|
---|
[328] | 203 | function ReadPostData($post_data = null)
|
---|
[20] | 204 | {
|
---|
[328] | 205 | global $xoops_db;
|
---|
[32] | 206 |
|
---|
[328] | 207 | foreach ( (array) $post_data as $index_key => $value ){
|
---|
| 208 | if (preg_match('/^ch_/',$index_key)){ // case ch_
|
---|
| 209 | $indedx = preg_replace('/^ch_/', '', $index_key);
|
---|
| 210 | $set_value = stripslashes(trim($value));
|
---|
| 211 | // post d3forum
|
---|
| 212 | if ($indedx === 'd3forum') {
|
---|
| 213 | if ($value == 'none'){
|
---|
| 214 | $this->is_use_d3forum = false;
|
---|
| 215 | $this->d3forum_module_dir = '';
|
---|
| 216 | $this->d3forum_forum_id = '';
|
---|
| 217 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
| 218 | } else {
|
---|
| 219 | $d3f_set = explode('|', $value);
|
---|
| 220 | $this->is_use_d3forum = true;
|
---|
| 221 | $this->d3forum_module_dir = $d3f_set[1];
|
---|
| 222 | $this->d3forum_forum_id = $d3f_set[2];
|
---|
| 223 | $this->d3forum_external_link_format = get_xpress_dir_name() . '::xpressD3commentContent';
|
---|
| 224 | }
|
---|
| 225 | } else { //post other
|
---|
| 226 | if(empty($set_value)){
|
---|
| 227 | switch ($indedx) {
|
---|
| 228 | case 'old_post_link_text':
|
---|
| 229 | $set_value = __('Older Post', 'xpressme');
|
---|
| 230 | break;
|
---|
| 231 | case 'newer_post_link_text':
|
---|
| 232 | $set_value = __('Newer Post', 'xpressme');
|
---|
| 233 | break;
|
---|
| 234 | case 'old_page_link_text':
|
---|
| 235 | $set_value = __('Older Entries', 'xpressme');
|
---|
| 236 | break;
|
---|
| 237 | case 'newer_page_link_text':
|
---|
| 238 | $set_value = __('Newer Entries', 'xpressme');
|
---|
| 239 | break;
|
---|
[350] | 240 | case 'excerpt_more_link_text':
|
---|
| 241 | $set_value = __('Read the rest of this entry »', 'xpressme');
|
---|
| 242 | break;
|
---|
| 243 |
|
---|
[328] | 244 | default:
|
---|
| 245 | }
|
---|
| 246 | }
|
---|
| 247 | $this->$indedx = $value;
|
---|
| 248 | }
|
---|
| 249 | } // end of case 'ch_'
|
---|
| 250 | } // end of loop
|
---|
[201] | 251 |
|
---|
[81] | 252 | global $xoops_db;
|
---|
| 253 | $table = get_wp_prefix() . 'group_role';
|
---|
| 254 | // $sql= "SELECT * FROM $table";
|
---|
| 255 | // $this->groupe_role = $xoops_db->get_results($sql); // before Read
|
---|
| 256 |
|
---|
| 257 | foreach ($this->groupe_role as $groupe) {
|
---|
[328] | 258 | $post_role_gid = 'role_gid_' . $groupe->groupid;
|
---|
| 259 | $login_all_gid = 'login_all_gid_' . $groupe->groupid;
|
---|
| 260 | if (isset($post_data[$post_role_gid])){
|
---|
| 261 | $role = stripslashes(trim($post_data[$post_role_gid]));
|
---|
| 262 | $login_all = stripslashes(trim($post_data[$login_all_gid]));
|
---|
| 263 | if (empty($login_all)) $login_all = '0';
|
---|
| 264 | $groupe->role = $role;
|
---|
| 265 | $groupe->login_all = $login_all;
|
---|
| 266 | $update_sql = "UPDATE $table ";
|
---|
| 267 | $update_sql .= 'SET ';
|
---|
| 268 | $update_sql .= "role = '$role' , ";
|
---|
| 269 | $update_sql .= "login_all = $login_all ";
|
---|
| 270 | $update_sql .= "WHERE (groupid = '$groupe->groupid' )";
|
---|
| 271 | $xoops_db->query($update_sql);
|
---|
| 272 | }
|
---|
[81] | 273 | }
|
---|
[20] | 274 | }
|
---|
[21] | 275 |
|
---|
| 276 | function yes_no_radio_option($option_name,$option_desc,$yes = '',$no= ''){
|
---|
[32] | 277 | if (empty( $yes )) $yes = __('YES','xpressme') ;
|
---|
| 278 | if (empty( $no )) $no = __('NO','xpressme') ;
|
---|
| 279 | $value = $this->{$option_name};
|
---|
| 280 | $ans_name = 'ch_' . $option_name;
|
---|
| 281 |
|
---|
| 282 | $form = "<tr>\n";
|
---|
| 283 | $form .= '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
|
---|
| 284 | $form .= "<td>\n";
|
---|
[143] | 285 | $form .= $this->yes_no_radio_option_sub($option_name,$yes,$no);
|
---|
| 286 | $form .= "</td>\n";
|
---|
[145] | 287 | $form .= "</tr>\n";
|
---|
[143] | 288 |
|
---|
| 289 | return $form;
|
---|
| 290 |
|
---|
| 291 | }
|
---|
| 292 | function yes_no_radio_option_sub($option_name,$yes = '',$no= ''){
|
---|
| 293 | if (empty( $yes )) $yes = __('YES','xpressme') ;
|
---|
| 294 | if (empty( $no )) $no = __('NO','xpressme') ;
|
---|
| 295 | $value = $this->{$option_name};
|
---|
| 296 | $ans_name = 'ch_' . $option_name;
|
---|
| 297 |
|
---|
[32] | 298 | if ($value){
|
---|
| 299 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' checked='checked' />" . $yes ."</label><br />\n";
|
---|
| 300 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' />". $no . "</label>\n";
|
---|
| 301 | }else{
|
---|
| 302 | $form .= "<label><input type='radio' name='". $ans_name . "' value='1' />" . $yes . "</label><br />\n";
|
---|
| 303 | $form .= "<label><input type='radio' name='". $ans_name . "' value='0' checked='checked' />". $no ."</label>\n";
|
---|
| 304 | }
|
---|
| 305 | return $form;
|
---|
[21] | 306 | }
|
---|
[32] | 307 |
|
---|
[143] | 308 |
|
---|
[32] | 309 | function text_option($option_name,$option_desc){
|
---|
| 310 | $value = $this->{$option_name};
|
---|
| 311 | $ans_name = 'ch_' . $option_name;
|
---|
[19] | 312 |
|
---|
[32] | 313 | $form = "<tr>\n";
|
---|
| 314 | $form .= '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
|
---|
| 315 | $form .= "<td>\n";
|
---|
[143] | 316 | $form .= $this->text_option_sub($option_name);
|
---|
[32] | 317 | $form .= "</td>\n";
|
---|
[145] | 318 | $form .= "</tr>\n";
|
---|
[32] | 319 |
|
---|
| 320 | return $form;
|
---|
[21] | 321 |
|
---|
[32] | 322 | }
|
---|
[76] | 323 |
|
---|
[143] | 324 | function text_option_sub($option_name){
|
---|
| 325 | $value = $this->{$option_name};
|
---|
| 326 | $ans_name = 'ch_' . $option_name;
|
---|
| 327 |
|
---|
| 328 | $form = '<label> <input name="'. $ans_name . '" type="text" size="25" maxlength="50" value="' . $value . '" /></label>'."\n";
|
---|
| 329 | return $form;
|
---|
| 330 |
|
---|
| 331 | }
|
---|
| 332 |
|
---|
| 333 |
|
---|
| 334 | function single_post_navi_option(){
|
---|
| 335 | $form = '';
|
---|
| 336 | $form .= '<tr><th><label for="single_page_navi">' .__('Single Post Navi Setting', 'xpressme') . '</label></th>';
|
---|
| 337 | $form .= "<td>\n";
|
---|
| 338 | $form .= "<table>\n";
|
---|
| 339 | $form .= "<tr>\n";
|
---|
| 340 |
|
---|
| 341 | $form .= "<td>" . __('Adjustment of Navi link display position','xpressme') . "</td>\n";
|
---|
| 342 | $form .= "<td>\n";
|
---|
| 343 | $form .= $this->yes_no_radio_option_sub('is_left_postnavi_old',
|
---|
| 344 | __("'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right",'xpressme'),
|
---|
| 345 | __("'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right",'xpressme')
|
---|
| 346 | );
|
---|
| 347 | $form .= "</td>\n";
|
---|
| 348 | $form .= "</tr>\n";
|
---|
| 349 |
|
---|
| 350 | $form .= "<tr>\n";
|
---|
| 351 | $form .= "<td>" . __('Select Display name of PostNavi Link','xpressme') . "</td>\n";
|
---|
| 352 | $form .= "<td>\n";
|
---|
| 353 | $form .= $this->yes_no_radio_option_sub('is_postnavi_title_disp',
|
---|
| 354 | __('Title of post','xpressme'),
|
---|
| 355 | __('Title of Navi','xpressme')
|
---|
| 356 | );
|
---|
| 357 | $form .= "</td>\n";
|
---|
| 358 | $form .= "</tr>\n";
|
---|
| 359 |
|
---|
| 360 | $form .= "<tr>\n";
|
---|
| 361 | $form .= "<td>" . __('Display Navi Title of Old Post Link','xpressme') . "</td>\n";
|
---|
| 362 | $form .= "<td>\n";
|
---|
| 363 | $form .= $this->text_option_sub('old_post_link_text');
|
---|
| 364 | $form .= "</td>\n";
|
---|
| 365 | $form .= "</tr>\n";
|
---|
| 366 |
|
---|
| 367 | $form .= "<tr>\n";
|
---|
| 368 | $form .= "<td>" . __('Display Navi Title of Newer Post Link','xpressme') . "</td>\n";
|
---|
| 369 | $form .= "<td>\n";
|
---|
| 370 | $form .= $this->text_option_sub('newer_post_link_text');
|
---|
| 371 | $form .= "</td>\n";
|
---|
| 372 | $form .= "</tr>\n";
|
---|
| 373 |
|
---|
| 374 | $form .= "</table></td></tr>\n";
|
---|
| 375 | return $form;
|
---|
| 376 |
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | function posts_page_navi_option(){
|
---|
| 380 | $form = '';
|
---|
| 381 | $form .= '<tr><th><label for="posts_page_navi">' .__('Posts List Page Navi Setting', 'xpressme') . '</label></th>';
|
---|
| 382 | $form .= "<td>\n";
|
---|
| 383 | $form .= "<table>\n";
|
---|
| 384 | $form .= "<tr>\n";
|
---|
| 385 |
|
---|
| 386 | $form .= "<td>" . __('Adjustment of Navi link display position','xpressme') . "</td>\n";
|
---|
| 387 | $form .= "<td>\n";
|
---|
| 388 | $form .= $this->yes_no_radio_option_sub('is_left_page_navi_old',
|
---|
| 389 | __("'Old Page Link' is displayed in the left, and 'Newer Page Link' is displayed in the right",'xpressme'),
|
---|
| 390 | __("'Newer Page Link' is displayed in the left, and 'Old Page Link' is displayed in the right",'xpressme')
|
---|
| 391 | );
|
---|
| 392 | $form .= "</td>\n";
|
---|
| 393 | $form .= "</tr>\n";
|
---|
| 394 |
|
---|
| 395 | $form .= "<tr>\n";
|
---|
| 396 | $form .= "<td>" . __('Display Navi Title of Old Page Link','xpressme') . "</td>\n";
|
---|
| 397 | $form .= "<td>\n";
|
---|
| 398 | $form .= $this->text_option_sub('old_page_link_text');
|
---|
| 399 | $form .= "</td>\n";
|
---|
| 400 | $form .= "</tr>\n";
|
---|
| 401 |
|
---|
| 402 | $form .= "<tr>\n";
|
---|
| 403 | $form .= "<td>" . __('Display Navi Title of Newer Page Link','xpressme') . "</td>\n";
|
---|
| 404 | $form .= "<td>\n";
|
---|
| 405 | $form .= $this->text_option_sub('newer_page_link_text');
|
---|
| 406 | $form .= "</td>\n";
|
---|
| 407 | $form .= "</tr>\n";
|
---|
| 408 |
|
---|
| 409 | $form .= "</table></td></tr>\n";
|
---|
| 410 | return $form;
|
---|
| 411 |
|
---|
| 412 | }
|
---|
[379] | 413 |
|
---|
| 414 | function dashboard_display_option(){
|
---|
| 415 | $form = '';
|
---|
| 416 | $form .= '<tr><th><label for="posts_page_navi">' .__('Dashboard feed Display Setting', 'xpressme') . '</label></th>';
|
---|
| 417 | $form .= "<td>\n";
|
---|
| 418 | $form .= "<table>\n";
|
---|
| 419 |
|
---|
| 420 | $form .= "<tr>\n";
|
---|
| 421 |
|
---|
| 422 | $form .= "<td>" . __('Display XPressMe Integration Kit Blog','xpressme') . "</td>\n";
|
---|
| 423 | $form .= "<td>\n";
|
---|
| 424 | $form .= $this->yes_no_radio_option_sub('is_dashboard_blog_disp',
|
---|
| 425 | __('YES','xpressme'),
|
---|
| 426 | __('NO','xpressme')
|
---|
| 427 | );
|
---|
| 428 | $form .= "</td>\n";
|
---|
| 429 | $form .= "</tr>\n";
|
---|
| 430 |
|
---|
| 431 | $form .= "<tr>\n";
|
---|
| 432 |
|
---|
| 433 | $form .= "<td>" . __('Display XPressMe Integration Kit Forum','xpressme') . "</td>\n";
|
---|
| 434 | $form .= "<td>\n";
|
---|
| 435 | $form .= $this->yes_no_radio_option_sub('is_dashboard_forum_disp',
|
---|
| 436 | __('YES','xpressme'),
|
---|
| 437 | __('NO','xpressme')
|
---|
| 438 | );
|
---|
| 439 | $form .= "</td>\n";
|
---|
| 440 | $form .= "</tr>\n";
|
---|
| 441 |
|
---|
| 442 | $form .= "</table></td></tr>\n";
|
---|
| 443 | return $form;
|
---|
| 444 | }
|
---|
[252] | 445 |
|
---|
[76] | 446 | function groupe_role_option(){
|
---|
| 447 | global $wp_roles , $xoops_db;
|
---|
[21] | 448 |
|
---|
[76] | 449 | $form = '';
|
---|
[79] | 450 | $form .= '<tr><th><label for="role">' .__('Role Setting at Login', 'xpressme') . '</label></th>';
|
---|
[76] | 451 | $form .= '<td>';
|
---|
| 452 | $form .= "<table>\n";
|
---|
[81] | 453 | $form .= '<tr><td>' . __('XOOPS Groupe', 'xpressme') . '</td><td>' . __('WordPress Role', 'xpressme') . '</td><td>' . __('Role is set at each login', 'xpressme') . "</td></tr>\n";
|
---|
[76] | 454 | foreach ($this->groupe_role as $groupe) {
|
---|
| 455 | $form .= "<tr>";
|
---|
| 456 | $form .= "<td> $groupe->name </td>";
|
---|
| 457 | $form .= "<td>\n" . '<select name="role_gid_'.$groupe->groupid . '" id="role_gid_' . $groupe->groupid . '">' . "\n";
|
---|
| 458 | $role_list = '';
|
---|
| 459 | $group_has_role = false;
|
---|
| 460 |
|
---|
| 461 | $select_value = $groupe->role;
|
---|
[252] | 462 |
|
---|
| 463 |
|
---|
[139] | 464 |
|
---|
[76] | 465 | foreach($wp_roles->role_names as $role => $name) {
|
---|
| 466 | $name = translate_with_context($name);
|
---|
| 467 | if ( $role == $select_value) {
|
---|
| 468 | $selected = ' selected="selected"';
|
---|
| 469 | $group_has_role = true;
|
---|
| 470 | } else {
|
---|
| 471 | $selected = '';
|
---|
| 472 | }
|
---|
[152] | 473 | if ($groupe->group_type != 'module_admin'|| !empty($selected)) {
|
---|
[139] | 474 | $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n";
|
---|
| 475 | }
|
---|
[76] | 476 | }
|
---|
[152] | 477 | if ($groupe->group_type != 'module_admin') {
|
---|
[149] | 478 | if ( $group_has_role ) {
|
---|
| 479 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
[81] | 480 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
| 481 | } else {
|
---|
[149] | 482 | if ($select_value == 'default'){
|
---|
| 483 | $role_list .= '<option value="default" selected="selected">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
| 484 | $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
| 485 | } else {
|
---|
| 486 | $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
|
---|
| 487 | $role_list .= '<option value="" selected="selected">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
|
---|
| 488 | }
|
---|
[81] | 489 | }
|
---|
| 490 | }
|
---|
| 491 | $form .= $role_list . "</select>\n</td>";
|
---|
| 492 | if ($groupe->login_all){
|
---|
| 493 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1" checked ></td>';
|
---|
| 494 | } else {
|
---|
| 495 | $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1"></td>';
|
---|
| 496 | }
|
---|
| 497 | $form .= "</tr>\n";
|
---|
[76] | 498 | }
|
---|
| 499 | $form .= "</table></td></tr>\n";
|
---|
| 500 | return $form;
|
---|
| 501 |
|
---|
| 502 | }
|
---|
[99] | 503 |
|
---|
[108] | 504 | function d3forum_option($do_message = ''){
|
---|
[218] | 505 | global $xoops_db,$xoops_config;
|
---|
[76] | 506 |
|
---|
[99] | 507 | $d3frum_list = array();
|
---|
| 508 | $module_dir_path = get_xoops_root_path();
|
---|
| 509 |
|
---|
| 510 | $forum_list = '<select name="ch_d3forum">' . "\n";
|
---|
| 511 |
|
---|
| 512 | if ($this->is_use_d3forum != true)
|
---|
| 513 | $selected = ' selected="selected"';
|
---|
| 514 | else
|
---|
| 515 | $selected = '';
|
---|
[218] | 516 |
|
---|
| 517 | if ($xoops_config->is_wpmu) {
|
---|
| 518 | $forum_list .= '<option value="none"' . $selected . '>' . __('WordPress MU cannot integrate the comments.', 'xpressme') . "</option>\n";
|
---|
| 519 | } else {
|
---|
| 520 | $forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n";
|
---|
[99] | 521 |
|
---|
[218] | 522 | // Form making for forum selection of D3forum
|
---|
| 523 | $modules_table = get_xoops_prefix() .'modules';
|
---|
| 524 | $sql = "SELECT mid,name,isactive,dirname FROM $modules_table WHERE isactive = 1";
|
---|
| 525 | $modules = $xoops_db->get_results($sql);
|
---|
| 526 | foreach ($modules as $module) {
|
---|
| 527 | $file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php';
|
---|
| 528 | if (! file_exists($file_path)) continue;
|
---|
| 529 | $array_files = file($file_path);
|
---|
| 530 | // It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file.
|
---|
| 531 | foreach ($array_files as $aeey_file){
|
---|
| 532 | if( preg_match( "/\s*(mytrustdirname)\s*(=)\s*([\"'])(d3forum)([\"'])/", $aeey_file ) ) {
|
---|
| 533 | $forums_tb = get_xoops_prefix() . $module->dirname . '_forums';
|
---|
| 534 | $cat_tb = get_xoops_prefix() . $module->dirname . '_categories';
|
---|
| 535 | $sql= "SELECT * FROM $forums_tb LEFT JOIN $cat_tb ON $forums_tb.cat_id = $cat_tb.cat_id";
|
---|
| 536 | $forums = $xoops_db->get_results($sql);
|
---|
| 537 | foreach ($forums as $forum) {
|
---|
| 538 | if (($module->dirname == $this->d3forum_module_dir) && ($forum->forum_id == $this->d3forum_forum_id))
|
---|
| 539 | $selected = ' selected="selected"';
|
---|
| 540 | else
|
---|
| 541 | $selected = '';
|
---|
| 542 | $forum_div = 'forum|' . $module->dirname . '|' . $forum->forum_id;
|
---|
| 543 | $forum_select = "$module->name($module->dirname) $forum->cat_title-$forum->forum_title(ID=$forum->forum_id)";
|
---|
| 544 | $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n";
|
---|
| 545 | }
|
---|
| 546 | break;
|
---|
[99] | 547 | }
|
---|
| 548 | }
|
---|
[218] | 549 | $forum_list .= '<br>';
|
---|
[99] | 550 | }
|
---|
| 551 | }
|
---|
| 552 | $forum_list .= '</select>' . "\n";
|
---|
| 553 |
|
---|
| 554 | $form = '<tr>' . "\n";
|
---|
| 555 | $form .= '<th><label for="d3forum">' .__('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n";
|
---|
| 556 | $form .= "<td>\n";
|
---|
| 557 | $form .= __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') ."<br />\n";
|
---|
| 558 | $form .= $forum_list."\n";
|
---|
[108] | 559 | $form .= '<br /><br />';
|
---|
[333] | 560 | if ($this->is_use_d3forum) {
|
---|
[335] | 561 | if ($this->is_use_d3forum) $disible = ''; else $disible = 'disabled';
|
---|
| 562 | $form .= __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
| 563 | if ($this->is_d3forum_flat){
|
---|
| 564 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' checked='checked' />" . __('Flat','xpressme') ."</label>\n";
|
---|
| 565 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' />". __('Threaded','xpressme') . "</label>\n";
|
---|
| 566 | }else{
|
---|
| 567 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' />" . __('Flat','xpressme') . "</label>\n";
|
---|
| 568 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' checked='checked' />". __('Threaded','xpressme') ."</label>\n";
|
---|
| 569 | }
|
---|
| 570 | $form .= '<br />';
|
---|
| 571 | $form .= __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp";
|
---|
| 572 | if ($this->is_d3forum_desc){
|
---|
| 573 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' checked='checked' />" . __('DESC','xpressme') ."</label>\n";
|
---|
| 574 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' />". __('ASC','xpressme') . "</label>\n";
|
---|
| 575 | }else{
|
---|
| 576 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' />" . __('DESC','xpressme') . "</label>\n";
|
---|
| 577 | $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' checked='checked' />". __('ASC','xpressme') ."</label>\n";
|
---|
| 578 | }
|
---|
| 579 | $form .= '<br />';
|
---|
| 580 | $form .= __('Number of displays of D3Forum comments.', 'xpressme') ." \n";
|
---|
| 581 | $form .= '&emsp<label> <input name="ch_d3forum_views_num" type="text" size="3" maxlength="3" value="' . $this->d3forum_views_num . '" /></label>'."\n";
|
---|
| 582 | $form .= '<div class="submit">'."\n";
|
---|
| 583 | $form .= __('The import and the export between Wordpress Comments and the D3Forum Posts can be done. ', 'xpressme') ."<br />\n";
|
---|
| 584 | $form .= '<input type="submit" value= "' . __('Export to D3Forum', 'xpressme') . '" name="export_d3f" ' . $disible . ' >' ."\n";
|
---|
| 585 | $form .= '<input type="submit" value= "' . __('Import from D3Forum', 'xpressme') . '" name="inport_d3f" ' . $disible . ' >' ."<br />\n";
|
---|
| 586 | $form .= '</div>'."\n";
|
---|
| 587 | if (!empty($do_message)){
|
---|
| 588 | $form .= '<div>' . $do_message . '</div>';
|
---|
| 589 | }
|
---|
[108] | 590 | }
|
---|
[99] | 591 | $form .= "</td>\n";
|
---|
| 592 | $form .= "</tr><tr>\n";
|
---|
| 593 | return $form;
|
---|
| 594 | }
|
---|
[145] | 595 |
|
---|
| 596 | function excerpt_option(){
|
---|
| 597 | $form = '';
|
---|
| 598 | $form .= '<tr><th><label for="excerpt">' .__('Contents Excerpt Setting', 'xpressme') . '</label></th>';
|
---|
| 599 | $form .= "<td>\n";
|
---|
| 600 | $form .= "<table>\n";
|
---|
| 601 | $form .= "<tr>\n";
|
---|
| 602 |
|
---|
| 603 | $form .= "<td>" . __('Is the excerpt display done with the archive of contents?','xpressme') . "</td>\n";
|
---|
| 604 | $form .= "<td>\n";
|
---|
| 605 | $form .= $this->yes_no_radio_option_sub('is_content_excerpt');
|
---|
| 606 | $form .= "</td>\n";
|
---|
| 607 | $form .= "</tr>\n";
|
---|
| 608 |
|
---|
| 609 | $form .= "<tr>\n";
|
---|
| 610 | $form .= "<td>" . __('When ASCII character more than the set ratio is included, it is judged ASCII contents. ','xpressme') . "</td>\n";
|
---|
| 611 | $form .= "<td>\n";
|
---|
| 612 | $form .= $this->text_option_sub('ascii_judged_rate');
|
---|
| 613 | $form .= "</td>\n";
|
---|
| 614 | $form .= "</tr>\n";
|
---|
| 615 |
|
---|
| 616 | $form .= "<tr>\n";
|
---|
| 617 | $form .= "<td>" . __('Excerpt length of word for ASCII contents','xpressme') . "</td>\n";
|
---|
| 618 | $form .= "<td>\n";
|
---|
| 619 | $form .= $this->text_option_sub('excerpt_length_word');
|
---|
| 620 | $form .= "</td>\n";
|
---|
| 621 | $form .= "</tr>\n";
|
---|
| 622 |
|
---|
| 623 | $form .= "<tr>\n";
|
---|
| 624 | $form .= "<td>" . __('Excerpt length of character for multibyte contents','xpressme') . "</td>\n";
|
---|
| 625 | $form .= "<td>\n";
|
---|
| 626 | $form .= $this->text_option_sub('excerpt_length_character');
|
---|
| 627 | $form .= "</td>\n";
|
---|
| 628 | $form .= "</tr>\n";
|
---|
[99] | 629 |
|
---|
[145] | 630 | $form .= "<tr>\n";
|
---|
[350] | 631 | $form .= "<td>" . __('This text is displayed in the link that reads contents not excerpted.(Is not displayed for the blank.)','xpressme') . "</td>\n";
|
---|
[145] | 632 | $form .= "<td>\n";
|
---|
[350] | 633 | $form .= $this->text_option_sub('excerpt_more_link_text');
|
---|
| 634 | $form .= "</td>\n";
|
---|
| 635 | $form .= "</tr>\n";
|
---|
| 636 |
|
---|
| 637 | $form .= "<tr>\n";
|
---|
| 638 | $form .= "<td>" . __('This text is displayed in the link that more tag (<!--more-->). ','xpressme') . "</td>\n";
|
---|
| 639 | $form .= "<td>\n";
|
---|
[145] | 640 | $form .= $this->text_option_sub('more_link_text');
|
---|
| 641 | $form .= "</td>\n";
|
---|
| 642 | $form .= "</tr>\n";
|
---|
| 643 |
|
---|
| 644 | $form .= "</table></td></tr>\n";
|
---|
| 645 | return $form;
|
---|
| 646 | }
|
---|
| 647 |
|
---|
| 648 | function viewer_type_option(){
|
---|
| 649 | $form = "<tr>\n";
|
---|
| 650 | $form .= '<th><label for="viewer_type">' .__('Display Mode Setting', 'xpressme') . '</label></th>';
|
---|
| 651 | $form .= "<td>\n";
|
---|
| 652 |
|
---|
| 653 | $form .= __('Select the XPressME Display Mode.', 'xpressme') ."\n";
|
---|
| 654 | $form .= '<select name="ch_viewer_type">' . "\n";
|
---|
| 655 |
|
---|
| 656 | $form .= '<option value="xoops" ';
|
---|
| 657 | if ($this->viewer_type == 'xoops') $form .= ' selected="selected"';
|
---|
| 658 | $form .= '>'.__('Xoops Mode', 'xpressme') ."</option>\n";
|
---|
| 659 |
|
---|
| 660 | $form .= '<option value="wordpress" ';
|
---|
| 661 | if ($this->viewer_type == 'wordpress') $form .= ' selected="selected"';
|
---|
| 662 | $form .= '>'.__('WordPress Mode', 'xpressme') ."</option>\n";
|
---|
| 663 |
|
---|
| 664 | $form .= '<option value="user_select" ';
|
---|
| 665 | if ($this->viewer_type == 'user_select') $form .= ' selected="selected"';
|
---|
| 666 | $form .= '>'.__('User select', 'xpressme') ."</option>\n";
|
---|
| 667 |
|
---|
| 668 | $form .= "</select><br />\n";
|
---|
| 669 |
|
---|
| 670 | $form .= "</td></tr>\n";
|
---|
| 671 | return $form;
|
---|
| 672 | }
|
---|
[201] | 673 |
|
---|
| 674 | function header_meta_option(){
|
---|
| 675 | $form = "<tr>\n";
|
---|
| 676 | $form .= '<th><label for="header_type">' .__('Header Meta Option', 'xpressme') . '</label></th>';
|
---|
| 677 | $form .= "<td>\n";
|
---|
| 678 | $form .= "<table>\n";
|
---|
| 679 | $form .= "<tr>\n";
|
---|
| 680 |
|
---|
| 681 | $form .= "<td>" . __('Select the Header keyword.', 'xpressme') . "</td>\n";
|
---|
| 682 | $form .= "<td>\n";
|
---|
| 683 | $form .= '<select name="ch_meta_keyword_type">' . "\n";
|
---|
| 684 | $form .= '<option value="xoops" ';
|
---|
| 685 | if ($this->meta_keyword_type == 'xoops') $form .= ' selected="selected"';
|
---|
| 686 | $form .= '>'.__('Xoops KeyWord', 'xpressme') ."</option>\n";
|
---|
| 687 | $form .= '<option value="wordpress" ';
|
---|
| 688 | if ($this->meta_keyword_type == 'wordpress') $form .= ' selected="selected"';
|
---|
| 689 | $form .= '>'.__('WordPress KeyWord', 'xpressme') ."</option>\n";
|
---|
| 690 | $form .= '<option value="wordpress_xoops" ';
|
---|
| 691 | if ($this->meta_keyword_type == 'wordpress_xoops') $form .= ' selected="selected"';
|
---|
| 692 | $form .= '>'.__('WordPress & Xoops KeyWord', 'xpressme') ."</option>\n";
|
---|
| 693 | $form .= "</select><br />\n";
|
---|
| 694 | $form .= "</td>\n";
|
---|
| 695 | $form .= "</tr>\n";
|
---|
| 696 |
|
---|
| 697 | $form .= "<tr>\n";
|
---|
| 698 | $form .= "<td>" . __('Select the Header Description.', 'xpressme') . "</td>\n";
|
---|
| 699 | $form .= "<td>\n";
|
---|
| 700 | $form .= '<select name="ch_meta_description_type">' . "\n";
|
---|
| 701 | $form .= '<option value="xoops" ';
|
---|
| 702 | if ($this->meta_description_type == 'xoops') $form .= ' selected="selected"';
|
---|
| 703 | $form .= '>'.__('Xoops Description', 'xpressme') ."</option>\n";
|
---|
| 704 | $form .= '<option value="wordpress" ';
|
---|
| 705 | if ($this->meta_description_type == 'wordpress') $form .= ' selected="selected"';
|
---|
| 706 | $form .= '>'.__('WordPress Description', 'xpressme') ."</option>\n";
|
---|
| 707 | $form .= '<option value="wordpress_xoops" ';
|
---|
| 708 | if ($this->meta_description_type == 'wordpress_xoops') $form .= ' selected="selected"';
|
---|
| 709 | $form .= '>'.__('WordPress & Xoops Description', 'xpressme') ."</option>\n";
|
---|
| 710 | $form .= "</select><br />\n";
|
---|
| 711 | $form .= "</td>\n";
|
---|
| 712 | $form .= "</tr>\n";
|
---|
[202] | 713 |
|
---|
| 714 | $form .= "<tr>\n";
|
---|
| 715 | $form .= "<td>" . __('Select the Header Robots Index.', 'xpressme') . "</td>\n";
|
---|
| 716 | $form .= "<td>\n";
|
---|
| 717 | $form .= '<select name="ch_meta_robot_type">' . "\n";
|
---|
| 718 | $form .= '<option value="xoops" ';
|
---|
| 719 | if ($this->meta_robot_type == 'xoops') $form .= ' selected="selected"';
|
---|
| 720 | $form .= '>'.__('Xoops Robots Index', 'xpressme') ."</option>\n";
|
---|
| 721 | $form .= '<option value="wordpress" ';
|
---|
| 722 | if ($this->meta_robot_type == 'wordpress') $form .= ' selected="selected"';
|
---|
| 723 | $form .= '>'.__('WordPress Robots Index', 'xpressme') ."</option>\n";
|
---|
| 724 | $form .= "</select><br />\n";
|
---|
| 725 | $form .= "</td>\n";
|
---|
| 726 | $form .= "</tr>\n";
|
---|
| 727 |
|
---|
[201] | 728 | $form .= "</table>\n";
|
---|
| 729 |
|
---|
| 730 | $form .= "</tr>\n";
|
---|
| 731 | return $form;
|
---|
| 732 | }
|
---|
[145] | 733 |
|
---|
[19] | 734 | function xpress_upload_filter($uploads)
|
---|
| 735 | {
|
---|
[95] | 736 | global $xoops_config;
|
---|
[19] | 737 | if ($this->is_use_xoops_upload_path){
|
---|
| 738 | $wordpress_dir = ABSPATH ;
|
---|
[95] | 739 | $xoops_dir = $xoops_config->xoops_upload_path . '/';
|
---|
[19] | 740 | $wordpress_base_url = get_option( 'siteurl' );
|
---|
[95] | 741 | $xoops_upload_url = $xoops_config->xoops_upload_url;
|
---|
[19] | 742 |
|
---|
[246] | 743 | @rmdir($uploads[path]); //remove wordpress side uploads_dir
|
---|
| 744 |
|
---|
[19] | 745 | $uploads[path] = str_replace ($wordpress_dir, $xoops_dir, $uploads[path]);
|
---|
| 746 | $uploads[basedir] = str_replace ($wordpress_dir, $xoops_dir, $uploads[basedir]);
|
---|
| 747 | $uploads[url] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[url]);
|
---|
| 748 | $uploads[baseurl] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[baseurl]);
|
---|
[246] | 749 |
|
---|
| 750 | // Make sure we have an uploads dir
|
---|
| 751 | if ( ! wp_mkdir_p( $uploads[path] ) ) {
|
---|
| 752 | $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads[path] );
|
---|
| 753 | return array( 'error' => $message );
|
---|
| 754 | }
|
---|
[19] | 755 | }
|
---|
| 756 | return $uploads;
|
---|
[88] | 757 | }
|
---|
| 758 |
|
---|
| 759 | // SQL DEBUG TEST
|
---|
| 760 | function is_sql_debug_permission()
|
---|
| 761 | {
|
---|
| 762 | global $current_user;
|
---|
| 763 |
|
---|
[95] | 764 | if (!is_object($current_user)) return false;
|
---|
[88] | 765 | if ($this->is_sql_debug && ($current_user->user_level >= 10))
|
---|
| 766 | return true;
|
---|
| 767 | else
|
---|
| 768 | return false;
|
---|
| 769 | }
|
---|
| 770 |
|
---|
| 771 | function xpress_sql_debug($query_strings)
|
---|
| 772 | {
|
---|
| 773 | if ($this->is_sql_debug_permission()){
|
---|
| 774 | if (empty($GLOBALS['XPress_SQL_Query'])) $GLOBALS['XPress_SQL_Query'] = '';
|
---|
[235] | 775 | $GLOBALS['XPress_SQL_Query'] .= $query_strings . '<br /><br />';
|
---|
[88] | 776 | }
|
---|
| 777 | return $query_strings;
|
---|
| 778 | }
|
---|
| 779 |
|
---|
| 780 | function displayDebugLog()
|
---|
| 781 | {
|
---|
| 782 | if ($this->is_sql_debug_permission()){
|
---|
| 783 | $content = '';
|
---|
| 784 | $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
|
---|
| 785 | $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
|
---|
| 786 | $content .= '<title>XPressME SQL DEBUG</title>' ;
|
---|
| 787 | $content .= '</head><body>';
|
---|
| 788 | $content .= $GLOBALS['XPress_SQL_Query'];
|
---|
| 789 | $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
|
---|
| 790 |
|
---|
| 791 | echo '<script type="text/javascript">
|
---|
| 792 | <!--//
|
---|
| 793 | 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");
|
---|
| 794 | xpress_debug_window.document.clear();
|
---|
| 795 | xpress_debug_window.focus();
|
---|
| 796 | ';
|
---|
| 797 | $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
|
---|
| 798 | foreach ($lines as $line) {
|
---|
| 799 | echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
|
---|
| 800 | }
|
---|
| 801 | echo '
|
---|
| 802 | xpress_debug_window.document.close();
|
---|
| 803 | //-->
|
---|
| 804 | </script>';
|
---|
| 805 | }
|
---|
[328] | 806 | }
|
---|
[19] | 807 | }
|
---|
| 808 | ?> |
---|