| [19] | 1 | <?php
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | load_plugin_textdomain('xpressme', 'wp-content/plugins/xpressme/language');
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 | class XPressME_Class{
 | 
|---|
 | 6 |         var $pluginName = 'xpressme';   
 | 
|---|
 | 7 |         var $is_use_xoops_upload_path;
 | 
|---|
| [26] | 8 |         var $is_theme_sidebar_disp;
 | 
|---|
| [28] | 9 |         var $is_save_post_revision;
 | 
|---|
| [32] | 10 |         var $is_postnavi_title_disp;
 | 
|---|
 | 11 |         var $is_left_postnavi_old;
 | 
|---|
 | 12 |         var $old_post_link_text;
 | 
|---|
 | 13 |         var $newer_post_link_text;
 | 
|---|
| [51] | 14 |         var $is_author_view_count;
 | 
|---|
| [88] | 15 |         var $is_sql_debug;
 | 
|---|
| [76] | 16 |         var $groupe_role;
 | 
|---|
| [32] | 17 | 
 | 
|---|
| [19] | 18 |         //constructor
 | 
|---|
| [20] | 19 |         function XPressME_Class()
 | 
|---|
| [19] | 20 |         {
 | 
|---|
| [76] | 21 |                 global $xoops_db;
 | 
|---|
 | 22 |                 
 | 
|---|
| [19] | 23 |                 $this->setdefault();    //not setting propaty load
 | 
|---|
 | 24 |                 $this->SettingValueRead();
 | 
|---|
 | 25 |         }
 | 
|---|
 | 26 | 
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 |         function add_option_page()
 | 
|---|
 | 29 |         {
 | 
|---|
 | 30 |                 add_options_page('XPressME', __('XPressME Settings', 'xpressme'), 8, 'xpressme_config', array(&$this, 'option_page'));
 | 
|---|
 | 31 |         }
 | 
|---|
 | 32 |         
 | 
|---|
 | 33 |         function add_admin_head()
 | 
|---|
 | 34 |         { 
 | 
|---|
 | 35 |                 // add header text
 | 
|---|
 | 36 |         }
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 |         
 | 
|---|
 | 39 |                 //Set Default Value     
 | 
|---|
 | 40 |         function setDefault()
 | 
|---|
 | 41 |         {
 | 
|---|
 | 42 |                 $this->is_use_xoops_upload_path = true;
 | 
|---|
| [26] | 43 |                 $this->is_theme_sidebar_disp = true;
 | 
|---|
| [28] | 44 |                 $this->is_save_post_revision = true;
 | 
|---|
| [32] | 45 |                 $this->is_postnavi_title_disp = true;
 | 
|---|
 | 46 |                 $this->is_left_postnavi_old = true;
 | 
|---|
| [79] | 47 |                 $this->old_post_link_text = __('to Old Post', 'xpressme');
 | 
|---|
 | 48 |                 $this->newer_post_link_text = __('to Newer Post', 'xpressme');
 | 
|---|
| [51] | 49 |                 $this->is_author_view_count = false;
 | 
|---|
| [88] | 50 |                 $this->is_sql_debug = false;
 | 
|---|
| [19] | 51 |         }
 | 
|---|
 | 52 |         
 | 
|---|
 | 53 |         function SettingValueRead()
 | 
|---|
 | 54 |         {
 | 
|---|
| [76] | 55 |                 global $xoops_db;
 | 
|---|
| [19] | 56 |                 $options = get_option('xpressme_option');
 | 
|---|
 | 57 |                 if (!$options) {
 | 
|---|
 | 58 |                         $this->setDefault();
 | 
|---|
 | 59 |                         $this->SettingValueWrite('add_new');
 | 
|---|
 | 60 |                 } else {
 | 
|---|
 | 61 |                         foreach ($options as $option_name => $option_value){
 | 
|---|
 | 62 |                                 $this-> {$option_name} = $option_value;
 | 
|---|
 | 63 |                         }
 | 
|---|
 | 64 |                 }
 | 
|---|
| [81] | 65 |                 if (!empty($xoops_db))  // at install trap
 | 
|---|
 | 66 |                         $this->GroupeRoleRead();
 | 
|---|
| [19] | 67 |         }
 | 
|---|
 | 68 |         
 | 
|---|
 | 69 |                 // mode 0:add  1:update 
 | 
|---|
 | 70 |         function SettingValueWrite($mode)
 | 
|---|
 | 71 |         {
 | 
|---|
 | 72 |                 $write_options = array (
 | 
|---|
| [26] | 73 |                         'is_use_xoops_upload_path' => $this->is_use_xoops_upload_path ,
 | 
|---|
| [32] | 74 |                         'is_theme_sidebar_disp' => $this->is_theme_sidebar_disp ,
 | 
|---|
 | 75 |                         'is_save_post_revision' => $this->is_save_post_revision ,
 | 
|---|
 | 76 |                         'is_postnavi_title_disp' => $this->is_postnavi_title_disp ,
 | 
|---|
 | 77 |                         'is_left_postnavi_old' => $this->is_left_postnavi_old ,
 | 
|---|
 | 78 |                         'old_post_link_text' => $this->old_post_link_text ,
 | 
|---|
| [51] | 79 |                         'newer_post_link_text' => $this->newer_post_link_text,
 | 
|---|
| [88] | 80 |                         'is_author_view_count' => $this->is_author_view_count,
 | 
|---|
 | 81 |                         'is_sql_debug' => $this->is_sql_debug
 | 
|---|
| [19] | 82 |                 );
 | 
|---|
 | 83 |                 if ($mode == 'add_new') {
 | 
|---|
 | 84 |                         add_option('xpressme_option', $write_options);
 | 
|---|
 | 85 |                 } else {                        
 | 
|---|
 | 86 |                         update_option("xpressme_option", $write_options);
 | 
|---|
 | 87 |                 }
 | 
|---|
 | 88 |         }
 | 
|---|
| [20] | 89 |         
 | 
|---|
| [76] | 90 |         function GroupeRoleRead() {
 | 
|---|
 | 91 |                 global $xoops_db;
 | 
|---|
 | 92 |                 
 | 
|---|
 | 93 |                 // table sync
 | 
|---|
 | 94 |                 $table = get_wp_prefix() . 'group_role';
 | 
|---|
 | 95 |                 $xoops_group = get_xoops_prefix() . 'groups';
 | 
|---|
 | 96 |                 $sql=  "SELECT * FROM $table";
 | 
|---|
 | 97 |                 $before_groupes = $xoops_db->get_results($sql);
 | 
|---|
 | 98 |                 
 | 
|---|
 | 99 |                 $sql = "DELETE FROM $table";
 | 
|---|
 | 100 |                 $xoops_db->query($sql);
 | 
|---|
 | 101 |                 
 | 
|---|
 | 102 |                 
 | 
|---|
 | 103 |                 $sql=  "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'";
 | 
|---|
 | 104 |                 $groupes = $xoops_db->get_results($sql);
 | 
|---|
 | 105 |                 $insert_sql = '';
 | 
|---|
 | 106 |                 foreach ($groupes as $groupe) {
 | 
|---|
 | 107 |                         $role = '';
 | 
|---|
 | 108 |                         foreach ($before_groupes as $before_groupe) {
 | 
|---|
| [81] | 109 |                                 if ($groupe->groupid == $before_groupe->groupid) {
 | 
|---|
 | 110 |                                         $role = $before_groupe->role;
 | 
|---|
 | 111 |                                         $login_all = $before_groupe->login_all;
 | 
|---|
 | 112 |                                 }
 | 
|---|
| [76] | 113 |                         }
 | 
|---|
 | 114 |                         
 | 
|---|
 | 115 |                         $insert_sql  = "INSERT INTO  $table ";
 | 
|---|
| [81] | 116 |                         $insert_sql .= "(groupid , name , description , group_type , role , login_all) ";
 | 
|---|
| [76] | 117 |                         $insert_sql .= "VALUES (";
 | 
|---|
 | 118 |                         $insert_sql .= $groupe->groupid . ', ';
 | 
|---|
 | 119 |                         $insert_sql .= "'" . $groupe->name . "' , ";
 | 
|---|
 | 120 |                         $insert_sql .= "'" . $groupe->description . "' , ";
 | 
|---|
 | 121 |                         $insert_sql .= "'" . $groupe->group_type . "' , ";
 | 
|---|
| [81] | 122 |                         $insert_sql .= "'" . $role . "' , ";
 | 
|---|
 | 123 |                         $insert_sql .= $login_all . ")";
 | 
|---|
| [76] | 124 |                         $xoops_db->query($insert_sql);
 | 
|---|
 | 125 |                 }
 | 
|---|
 | 126 |                 
 | 
|---|
 | 127 |                 $sql=  "SELECT * FROM $table";
 | 
|---|
 | 128 |                 
 | 
|---|
 | 129 |                 $this->groupe_role =  $xoops_db->get_results($sql);
 | 
|---|
 | 130 |                         $sql=  "SELECT * FROM $table";  
 | 
|---|
 | 131 |         }
 | 
|---|
 | 132 |         
 | 
|---|
| [20] | 133 |         function ReadPostData()
 | 
|---|
 | 134 |         {
 | 
|---|
 | 135 |                 $this->is_use_xoops_upload_path = stripslashes(trim($_POST['ch_is_use_xoops_upload_path']));
 | 
|---|
| [26] | 136 |                 $this->is_theme_sidebar_disp = stripslashes(trim($_POST['ch_is_theme_sidebar_disp']));
 | 
|---|
| [28] | 137 |                 $this->is_save_post_revision = stripslashes(trim($_POST['ch_is_save_post_revision']));
 | 
|---|
| [32] | 138 |                 $this->is_postnavi_title_disp = stripslashes(trim($_POST['ch_is_postnavi_title_disp']));
 | 
|---|
 | 139 |                 $this->is_left_postnavi_old = stripslashes(trim($_POST['ch_is_left_postnavi_old']));
 | 
|---|
 | 140 |                 $this->old_post_link_text = stripslashes($_POST['ch_old_post_link_text']);
 | 
|---|
| [79] | 141 |                 if(empty($this->old_post_link_text)) $this->old_post_link_text = __('to Old Post', 'xpressme');
 | 
|---|
| [32] | 142 |                 $this->newer_post_link_text = stripslashes($_POST['ch_newer_post_link_text']);
 | 
|---|
| [79] | 143 |                 if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('to Newer Post', 'xpressme');
 | 
|---|
| [51] | 144 |                 $this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count']));
 | 
|---|
| [88] | 145 |                 $this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug']));
 | 
|---|
| [32] | 146 |                 
 | 
|---|
| [81] | 147 |                 global $xoops_db;
 | 
|---|
 | 148 |                 $table = get_wp_prefix() . 'group_role';        
 | 
|---|
 | 149 | //              $sql=  "SELECT * FROM $table";  
 | 
|---|
 | 150 | //              $this->groupe_role =  $xoops_db->get_results($sql);  // before Read
 | 
|---|
 | 151 |                 
 | 
|---|
 | 152 |                 foreach ($this->groupe_role as $groupe) {
 | 
|---|
 | 153 |                         $post_name = 'role_gid_' . $groupe->groupid;
 | 
|---|
 | 154 |                         $role = stripslashes(trim($_POST[$post_name]));
 | 
|---|
 | 155 |                         $post_name = 'login_all_gid_' . $groupe->groupid;
 | 
|---|
 | 156 |                         $login_all = stripslashes(trim($_POST[$post_name]));
 | 
|---|
 | 157 |                         if (empty($login_all)) $login_all = '0';
 | 
|---|
 | 158 |                         $groupe->role = $role;
 | 
|---|
 | 159 |                         $groupe->login_all = $login_all;
 | 
|---|
 | 160 |                         $update_sql  = "UPDATE  $table ";
 | 
|---|
 | 161 |                         $update_sql .= 'SET ';
 | 
|---|
 | 162 |                         $update_sql .= "role  = '$role' , ";
 | 
|---|
 | 163 |                         $update_sql .= "login_all  = $login_all ";
 | 
|---|
 | 164 |                         $update_sql .= "WHERE (groupid = '$groupe->groupid' )";
 | 
|---|
 | 165 |                         $xoops_db->query($update_sql);                  
 | 
|---|
 | 166 |                 }
 | 
|---|
| [20] | 167 |         }
 | 
|---|
| [21] | 168 |         
 | 
|---|
 | 169 |         function yes_no_radio_option($option_name,$option_desc,$yes = '',$no= ''){
 | 
|---|
| [32] | 170 |                 if (empty( $yes ))  $yes = __('YES','xpressme') ;
 | 
|---|
 | 171 |                 if (empty( $no ))  $no = __('NO','xpressme') ;
 | 
|---|
 | 172 |                 $value = $this->{$option_name};
 | 
|---|
 | 173 |                 $ans_name = 'ch_' . $option_name;
 | 
|---|
 | 174 |                 
 | 
|---|
 | 175 |                 $form  =  "<tr>\n";
 | 
|---|
 | 176 |                 $form .=  '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
 | 
|---|
 | 177 |                 $form .=  "<td>\n";
 | 
|---|
 | 178 |                 if ($value){
 | 
|---|
 | 179 |                         $form .= "<label><input type='radio' name='". $ans_name . "' value='1' checked='checked' />" . $yes ."</label><br />\n";
 | 
|---|
 | 180 |                         $form .= "<label><input type='radio' name='". $ans_name . "' value='0' />". $no . "</label>\n";
 | 
|---|
 | 181 |                 }else{
 | 
|---|
 | 182 |                         $form .= "<label><input type='radio' name='". $ans_name . "' value='1' />" . $yes . "</label><br />\n";
 | 
|---|
 | 183 |                         $form .= "<label><input type='radio' name='". $ans_name . "' value='0' checked='checked' />". $no ."</label>\n";
 | 
|---|
 | 184 |                 }
 | 
|---|
 | 185 |                 $form .=  "</td>\n";
 | 
|---|
 | 186 |                 $form .=  "</tr><tr>\n";
 | 
|---|
 | 187 |                         
 | 
|---|
 | 188 |             return $form;
 | 
|---|
| [21] | 189 |         
 | 
|---|
 | 190 |         }
 | 
|---|
| [32] | 191 | 
 | 
|---|
 | 192 |         function text_option($option_name,$option_desc){
 | 
|---|
 | 193 |                 $value = $this->{$option_name};
 | 
|---|
 | 194 |                 $ans_name = 'ch_' . $option_name;
 | 
|---|
| [19] | 195 |                 
 | 
|---|
| [32] | 196 |                 $form  =  "<tr>\n";
 | 
|---|
 | 197 |                 $form .=  '<th><label for="images_to_link">' . $option_desc . "</label></th>\n";
 | 
|---|
 | 198 |                 $form .=  "<td>\n";
 | 
|---|
 | 199 |                 $form .= '<label> <input name="'. $ans_name . '" type="text" size="25" maxlength="50" value="'  . $value . '" /></label>'."\n";
 | 
|---|
 | 200 |                 $form .=  "</td>\n";
 | 
|---|
 | 201 |                 $form .=  "</tr><tr>\n";
 | 
|---|
 | 202 |                         
 | 
|---|
 | 203 |             return $form;
 | 
|---|
| [21] | 204 |         
 | 
|---|
| [32] | 205 |         }
 | 
|---|
| [76] | 206 |         
 | 
|---|
 | 207 |         function groupe_role_option(){
 | 
|---|
 | 208 |                 global $wp_roles , $xoops_db;
 | 
|---|
| [21] | 209 |                 
 | 
|---|
| [76] | 210 |                 $form = '';
 | 
|---|
| [79] | 211 |                 $form .= '<tr><th><label for="role">' .__('Role Setting at Login', 'xpressme') . '</label></th>';
 | 
|---|
| [76] | 212 |                 $form .= '<td>';
 | 
|---|
 | 213 |                 $form .= "<table>\n";
 | 
|---|
| [81] | 214 |                 $form .= '<tr><td>' . __('XOOPS Groupe', 'xpressme') . '</td><td>' . __('WordPress Role', 'xpressme') . '</td><td>' . __('Role is set at each login', 'xpressme') . "</td></tr>\n";
 | 
|---|
| [76] | 215 |                 foreach ($this->groupe_role as $groupe) {
 | 
|---|
 | 216 |                         $form .= "<tr>";
 | 
|---|
 | 217 |                         $form .= "<td> $groupe->name </td>";
 | 
|---|
 | 218 |                         $form .= "<td>\n" . '<select name="role_gid_'.$groupe->groupid . '" id="role_gid_' . $groupe->groupid . '">' . "\n";
 | 
|---|
 | 219 |                         $role_list = '';
 | 
|---|
 | 220 |                         $group_has_role = false;
 | 
|---|
 | 221 |                 
 | 
|---|
 | 222 |                         $select_value = $groupe->role;
 | 
|---|
 | 223 |                 
 | 
|---|
 | 224 |                         foreach($wp_roles->role_names as $role => $name) {
 | 
|---|
 | 225 |                                 $name = translate_with_context($name);
 | 
|---|
 | 226 |                                 if ( $role == $select_value) {
 | 
|---|
 | 227 |                                         $selected = ' selected="selected"';
 | 
|---|
 | 228 |                                         $group_has_role = true;
 | 
|---|
 | 229 |                                 } else {
 | 
|---|
 | 230 |                                         $selected = '';
 | 
|---|
 | 231 |                                 }
 | 
|---|
 | 232 |                                 $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n";
 | 
|---|
 | 233 |                         }
 | 
|---|
| [81] | 234 |                         if ( $group_has_role ) {
 | 
|---|
 | 235 |                                 $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
 | 
|---|
 | 236 |                                 $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
 | 
|---|
 | 237 |                         } else {
 | 
|---|
 | 238 |                                 if ($select_value == 'default'){
 | 
|---|
 | 239 |                                         $role_list .= '<option value="default" selected="selected">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";     
 | 
|---|
 | 240 |                                         $role_list .= '<option value="">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
 | 
|---|
 | 241 |                                 } else {
 | 
|---|
 | 242 |                                         $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";                                 
 | 
|---|
 | 243 |                                         $role_list .= '<option value="" selected="selected">' . __('Group User Doesn\'t Register', 'xpressme') . "</option>\n";
 | 
|---|
 | 244 |                                 }
 | 
|---|
 | 245 |                         }
 | 
|---|
 | 246 |                         $form .= $role_list . "</select>\n</td>";
 | 
|---|
 | 247 |                         if ($groupe->login_all){
 | 
|---|
 | 248 |                                 $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1" checked ></td>';
 | 
|---|
 | 249 |                         } else {
 | 
|---|
 | 250 |                                 $form .= '<td> <input type="checkbox" name="login_all_gid_' . $groupe->groupid . '" value="1"></td>';
 | 
|---|
 | 251 |                         }
 | 
|---|
 | 252 |                         $form .= "</tr>\n";     
 | 
|---|
| [76] | 253 |                 }
 | 
|---|
 | 254 |                 $form .= "</table></td></tr>\n";
 | 
|---|
 | 255 |             return $form;
 | 
|---|
 | 256 | 
 | 
|---|
 | 257 |         }
 | 
|---|
 | 258 |                 
 | 
|---|
| [19] | 259 |         function option_page()
 | 
|---|
 | 260 |         {
 | 
|---|
| [76] | 261 | 
 | 
|---|
| [20] | 262 |                 if (!empty($_POST['submit_update'])) {
 | 
|---|
 | 263 |                         $this->ReadPostData();
 | 
|---|
 | 264 |                         $this->SettingValueWrite('update');
 | 
|---|
 | 265 |                 } else if (isset($_POST['submit_reset'])) {
 | 
|---|
 | 266 |                         $this->fck_setDefault();
 | 
|---|
 | 267 |                         $this->SettingValueWrite('update');
 | 
|---|
 | 268 |                 } 
 | 
|---|
| [19] | 269 | 
 | 
|---|
| [20] | 270 |                 
 | 
|---|
| [21] | 271 |                 echo    '<div class="wrap">'."\n";
 | 
|---|
 | 272 |                 echo            '<div id="icon-options-general" class="icon32"><br /></div>'."\n";
 | 
|---|
 | 273 |                 echo            '<h2>' . __('XPressME Configuration Page', 'xpressme') . "</h2>\n";
 | 
|---|
 | 274 |                 echo            '<form method="post" action="' . $_SERVER["REQUEST_URI"] . '">'."\n" ;
 | 
|---|
 | 275 |                 echo                    '<table class="form-table">'."\n";
 | 
|---|
 | 276 |                 echo                            $this->yes_no_radio_option('is_use_xoops_upload_path',
 | 
|---|
 | 277 |                                                                                                 __('Media Upload Base Path','xpressme'),
 | 
|---|
 | 278 |                                                                                                 __('Use XOOPS UPLOAD PATH','xpressme'),
 | 
|---|
| [22] | 279 |                                                                                                 __('USE WordPress BASE_PATH','xpressme')
 | 
|---|
| [21] | 280 |                                                                                                 );
 | 
|---|
| [26] | 281 |                 echo                            $this->yes_no_radio_option('is_theme_sidebar_disp',
 | 
|---|
 | 282 |                                                                                                 __('Thema Sidebar Display','xpressme'),
 | 
|---|
 | 283 |                                                                                                 __('YES','xpressme'),
 | 
|---|
 | 284 |                                                                                                 __('NO','xpressme')
 | 
|---|
 | 285 |                                                                                                 );
 | 
|---|
| [28] | 286 |                 echo                            $this->yes_no_radio_option('is_save_post_revision',
 | 
|---|
 | 287 |                                                                                                 __('The change tracking of the post is preserved','xpressme'),
 | 
|---|
 | 288 |                                                                                                 __('YES','xpressme'),
 | 
|---|
 | 289 |                                                                                                 __('NO','xpressme')
 | 
|---|
 | 290 |                                                                                                 );
 | 
|---|
| [79] | 291 |                 echo                            $this->text_option('old_post_link_text',
 | 
|---|
 | 292 |                                                                                                 __('Display Navi Title of Old Post Link','xpressme')
 | 
|---|
 | 293 |                                                                                                 );
 | 
|---|
 | 294 |                 echo                            $this->text_option('newer_post_link_text',
 | 
|---|
 | 295 |                                                                                                 __('Display Navi Title of Newer Post Link','xpressme')
 | 
|---|
 | 296 |                                                                                                 );
 | 
|---|
| [32] | 297 |                 echo                            $this->yes_no_radio_option('is_postnavi_title_disp',
 | 
|---|
 | 298 |                                                                                                 __('Select Display name of PostNavi Link','xpressme'),
 | 
|---|
 | 299 |                                                                                                 __('Title of post','xpressme'),
 | 
|---|
| [79] | 300 |                                                                                                 __('Title of Navi','xpressme')
 | 
|---|
| [32] | 301 |                                                                                                 );
 | 
|---|
 | 302 |                 echo                            $this->yes_no_radio_option('is_left_postnavi_old',
 | 
|---|
 | 303 |                                                                                                 __('Adjustment of Navi link display position','xpressme'),
 | 
|---|
 | 304 |                                                                                                 __("'Old Post Link' is displayed in the left, and 'Newer Post Link' is displayed in the right",'xpressme'),
 | 
|---|
 | 305 |                                                                                                 __("'Newer Post Link' is displayed in the left, and 'Old Post Link' is displayed in the right",'xpressme')
 | 
|---|
 | 306 |                                                                                                 );
 | 
|---|
| [51] | 307 |                 echo                            $this->yes_no_radio_option('is_author_view_count',
 | 
|---|
 | 308 |                                                                                                 __('Is the posts author views counted?','xpressme'),
 | 
|---|
 | 309 |                                                                                                 __('YES','xpressme'),
 | 
|---|
 | 310 |                                                                                                 __('NO','xpressme')             
 | 
|---|
| [76] | 311 |                                                                                                 );
 | 
|---|
| [88] | 312 |                 echo                            $this->yes_no_radio_option('is_sql_debug',
 | 
|---|
 | 313 |                                                                                                 __('Is SQL debugging window displayed?','xpressme'),
 | 
|---|
 | 314 |                                                                                                 __('YES','xpressme'),
 | 
|---|
 | 315 |                                                                                                 __('NO','xpressme')             
 | 
|---|
 | 316 |                                                                                                 );
 | 
|---|
 | 317 |                 
 | 
|---|
| [76] | 318 |                 echo                            $this->groupe_role_option();                            
 | 
|---|
| [21] | 319 | //              $this->is_use_xoops_upload_path_html();
 | 
|---|
 | 320 |                 echo                    "</table>\n";
 | 
|---|
| [20] | 321 |                 
 | 
|---|
| [21] | 322 |                 echo            '<p class="submit">'."\n";
 | 
|---|
 | 323 |                 echo            '<input type="submit" value= "' . __('Update Config', 'xpressme') . '" name="submit_update" />' ."\n";
 | 
|---|
 | 324 |                 echo            '<input type="submit" value= "' . __('Preset Config', 'xpressme') . '" name="submit_reset" />' ."\n";
 | 
|---|
 | 325 |                 echo            "</p>\n";
 | 
|---|
| [19] | 326 | 
 | 
|---|
| [21] | 327 |                 echo            "</form>\n" ;
 | 
|---|
 | 328 |                 echo    "</div>\n";
 | 
|---|
| [19] | 329 |         }
 | 
|---|
 | 330 |         
 | 
|---|
 | 331 |         function xpress_upload_filter($uploads)
 | 
|---|
 | 332 |         {
 | 
|---|
 | 333 |                 if ($this->is_use_xoops_upload_path){
 | 
|---|
 | 334 |                         if (!defined("XOOPS_UPLOAD_PATH"))
 | 
|---|
 | 335 |                                 define("XOOPS_UPLOAD_PATH", XOOPS_ROOT_PATH."/uploads");
 | 
|---|
 | 336 |                         if (!defined("XOOPS_UPLOAD_URL"))
 | 
|---|
 | 337 |                                 define("XOOPS_UPLOAD_URL", XOOPS_URL."/uploads");
 | 
|---|
 | 338 | 
 | 
|---|
 | 339 |                         $wordpress_dir = ABSPATH ;
 | 
|---|
 | 340 |                         $xoops_dir = XOOPS_UPLOAD_PATH . '/';
 | 
|---|
 | 341 |                         $wordpress_base_url = get_option( 'siteurl' );
 | 
|---|
 | 342 |                         $xoops_upload_url = XOOPS_UPLOAD_URL;
 | 
|---|
 | 343 |                         
 | 
|---|
 | 344 |                         $uploads[path] =  str_replace ($wordpress_dir, $xoops_dir, $uploads[path]);
 | 
|---|
 | 345 |                         $uploads[basedir] = str_replace ($wordpress_dir, $xoops_dir, $uploads[basedir]);
 | 
|---|
 | 346 |                         $uploads[url] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[url]);
 | 
|---|
 | 347 |                         $uploads[baseurl] = str_replace ($wordpress_base_url, $xoops_upload_url, $uploads[baseurl]);
 | 
|---|
 | 348 |                 }
 | 
|---|
 | 349 |                 return $uploads;
 | 
|---|
| [88] | 350 |         }
 | 
|---|
 | 351 | 
 | 
|---|
 | 352 |         // SQL DEBUG TEST
 | 
|---|
 | 353 |         function is_sql_debug_permission()
 | 
|---|
 | 354 |         {
 | 
|---|
 | 355 |                 global $current_user;
 | 
|---|
 | 356 | 
 | 
|---|
 | 357 |                 if ($this->is_sql_debug && ($current_user->user_level >= 10))
 | 
|---|
 | 358 |                         return true;
 | 
|---|
 | 359 |                 else
 | 
|---|
 | 360 |                         return false;
 | 
|---|
 | 361 |         }
 | 
|---|
 | 362 |         
 | 
|---|
 | 363 |         function xpress_sql_debug($query_strings)
 | 
|---|
 | 364 |         {
 | 
|---|
 | 365 |                 if ($this->is_sql_debug_permission()){
 | 
|---|
 | 366 |                         if (empty($GLOBALS['XPress_SQL_Query'])) $GLOBALS['XPress_SQL_Query'] = '';
 | 
|---|
 | 367 |                         $GLOBALS['XPress_SQL_Query'] .= $query_strings . '<br />';
 | 
|---|
 | 368 |                 }
 | 
|---|
 | 369 |                 return $query_strings;
 | 
|---|
 | 370 |         }
 | 
|---|
 | 371 |         
 | 
|---|
 | 372 |         function displayDebugLog()
 | 
|---|
 | 373 |         {
 | 
|---|
 | 374 |                 if ($this->is_sql_debug_permission()){
 | 
|---|
 | 375 |                         $content = '';
 | 
|---|
 | 376 |                         $content .= '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" />';
 | 
|---|
 | 377 |                         $content .= '<meta http-equiv="content-language" content="'._LANGCODE.'" />' ;
 | 
|---|
 | 378 |                         $content .= '<title>XPressME SQL DEBUG</title>' ;
 | 
|---|
 | 379 |                         $content .= '<link rel="stylesheet" type="text/css" media="all" href="'.getcss($GLOBALS['xoopsConfig']['theme_set']).'" />';
 | 
|---|
 | 380 |                         $content .= '</head><body>';
 | 
|---|
 | 381 |                         $content .= $GLOBALS['XPress_SQL_Query'];
 | 
|---|
 | 382 |                         $content .= '<div style="text-align:center;"><input class="formButton" value="CLOSE" type="button" onclick="javascript:window.close();" /></div></body></html>';
 | 
|---|
 | 383 | 
 | 
|---|
 | 384 |                         echo '<script type="text/javascript">
 | 
|---|
 | 385 |                                 <!--//
 | 
|---|
 | 386 |                                 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");
 | 
|---|
 | 387 |                                 xpress_debug_window.document.clear();
 | 
|---|
 | 388 |                                 xpress_debug_window.focus();
 | 
|---|
 | 389 |                                 ';
 | 
|---|
 | 390 |                         $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
 | 
|---|
 | 391 |                         foreach ($lines as $line) {
 | 
|---|
 | 392 |                                 echo 'xpress_debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
 | 
|---|
 | 393 |                         }
 | 
|---|
 | 394 |                         echo '
 | 
|---|
 | 395 |                                 xpress_debug_window.document.close();
 | 
|---|
 | 396 |                                 //-->
 | 
|---|
 | 397 |                         </script>';
 | 
|---|
 | 398 |                 }
 | 
|---|
| [19] | 399 |         }       
 | 
|---|
| [28] | 400 | 
 | 
|---|
| [19] | 401 | }
 | 
|---|
 | 402 | ?> | 
|---|