XPressME Integration Kit

Trac


Ignore:
Timestamp:
Feb 4, 2009, 5:58:57 PM (15 years ago)
Author:
toemon
Message:

SQLデバッグ用表示機能実装 #58

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/xpressme_class.php

    r81 r88  
    1313        var $newer_post_link_text; 
    1414        var $is_author_view_count; 
    15         var $groupe_role_serial; 
     15        var $is_sql_debug; 
    1616        var $groupe_role; 
    1717 
     
    4848                $this->newer_post_link_text = __('to Newer Post', 'xpressme'); 
    4949                $this->is_author_view_count = false; 
     50                $this->is_sql_debug = false; 
    5051        } 
    5152         
     
    7778                        'old_post_link_text' => $this->old_post_link_text , 
    7879                        'newer_post_link_text' => $this->newer_post_link_text, 
    79                         'is_author_view_count' => $this->is_author_view_count 
     80                        'is_author_view_count' => $this->is_author_view_count, 
     81                        'is_sql_debug' => $this->is_sql_debug 
    8082                ); 
    8183                if ($mode == 'add_new') { 
     
    141143                if(empty($this->newer_post_link_text)) $this->newer_post_link_text = __('to Newer Post', 'xpressme'); 
    142144                $this->is_author_view_count = stripslashes(trim($_POST['ch_is_author_view_count'])); 
     145                $this->is_sql_debug = stripslashes(trim($_POST['ch_is_sql_debug'])); 
    143146                 
    144147                global $xoops_db; 
     
    307310                                                                                                __('NO','xpressme')              
    308311                                                                                                ); 
     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                 
    309318                echo                            $this->groupe_role_option();                             
    310319//              $this->is_use_xoops_upload_path_html(); 
     
    339348                } 
    340349                return $uploads; 
     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                } 
    341399        }        
    342400 
Note: See TracChangeset for help on using the changeset viewer.