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