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