Changeset 21647 for branches/version-2_12-dev/data
- Timestamp:
- 2012/03/14 21:36:17 (12 years ago)
- Location:
- branches/version-2_12-dev/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/Smarty/templates/admin/system/log.tpl
r20764 r21647 23 23 *}--> 24 24 25 <p>直近の<!--{$line_max}-->行</p> 25 <style type="text/css"> 26 th { 27 width: auto; 28 } 29 </style> 30 31 <!--{if count($arrErr) >= 1}--> 32 <div class="attention"> 33 <!--{foreach from=$arrErr item=err}--> 34 <!--{$err}--> 35 <!--{/foreach}--> 36 </div> 37 <!--{/if}--> 38 39 <form action="?" name="form1" style="margin-bottom: 1ex;"> 40 <!--{assign var=key value="log"}--> 41 <select name="<!--{$key|h}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->"> 42 <!--{html_options options=$arrLogList selected=$arrForm[$key]}--> 43 </select> 44 <!--{assign var=key value="line_max"}--> 45 直近の<input type="text" name="<!--{$key|h}-->" value="<!--{$arrForm[$key].value|h}-->" size="6" maxlength="<!--{$arrForm[$key].length|h}-->" style="<!--{$arrErr[$key]|sfGetErrorColor}-->" />行 46 <a class="btn-normal" href="javascript:;" onclick="form1.submit(); return false;"><span>読み込む</span></a> 47 </form> 48 26 49 <table class="list log"> 27 50 <tr> -
branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Log.php
r21591 r21647 34 34 class LC_Page_Admin_System_Log extends LC_Page_Admin_Ex { 35 35 36 // }}} 37 // {{{ functions 36 var $arrLogList = array(); 38 37 39 38 /** … … 78 77 79 78 // POST値をセット 80 $objFormParam->setParam($_POST); 81 82 if (SC_Utils_Ex::sfIsInt($tmp = $objFormParam->getValue('line'))) { 83 $this->line_max = $tmp; 84 } 85 86 $this->tpl_ec_log = $this->getEccubeLog(); 79 $objFormParam->setParam($_REQUEST); 80 $this->arrErr = $objFormParam->checkError(); 81 $this->arrForm = $objFormParam->getFormParamList(); 82 83 $this->loadLogList(); 84 85 if (empty($this->arrErr)) { 86 $this->line_max = $objFormParam->getValue('line_max'); 87 88 $log_path = $this->getLogPath($objFormParam->getValue('log')); 89 $this->tpl_ec_log = $this->getEccubeLog($log_path); 90 } 87 91 88 92 // フックポイント. … … 103 107 * パラメーターの初期化. 104 108 * 105 * @return object SC_FormParam インスタンス106 109 * @return void 107 110 */ 108 111 function lfInitParam(&$objFormParam) { 109 $objFormParam->addParam('line_max', 'line_max', INT_LEN, '', array('NUM_CHECK', 'MAX_LENGTH_CHECK', 'EXIST_CHECK')); 112 $objFormParam->addParam('ファイル', 'log', null, '', array()); 113 $objFormParam->addParam('行数', 'line_max', INT_LEN, '', array('NUM_CHECK', 'MAX_LENGTH_CHECK'), 50); 110 114 } 111 115 … … 115 119 * @return array $arrLogs 取得したログ 116 120 */ 117 function getEccubeLog( ) {121 function getEccubeLog($log_path_base) { 118 122 119 123 $index = 0; 120 124 $arrLogs = array(); 121 125 for ($gen = 0 ; $gen <= MAX_LOG_QUANTITY; $gen++) { 122 $path = LOG_REALFILE;126 $path = $log_path_base; 123 127 if ($gen != 0) { 124 128 $path .= ".$gen"; … … 132 136 $arrBodyReverse = array(); 133 137 foreach ($arrLogTmp as $line) { 138 // 上限に達した場合、処理を抜ける 139 if (count($arrLogs) >= $this->line_max) break 2; 140 134 141 $line = chop($line); 135 142 if (preg_match('/^(\d+\/\d+\/\d+ \d+:\d+:\d+) \[([^\]]+)\] (.*)$/', $line, $arrMatch)) { … … 145 152 146 153 $arrLogs[] = $arrLogLine; 147 148 // 上限に達した場合、処理を抜ける149 if (count($arrLogs) >= $this->line_max) break 2;150 154 } else { 151 155 // 内容 … … 156 160 return $arrLogs; 157 161 } 162 163 /** 164 * ログファイルのパスを取得する 165 * 166 * セキュリティ面をカバーする役割もある。 167 */ 168 function getLogPath($log_name) { 169 if (strlen($log_name) === 0) { 170 return LOG_REALFILE; 171 } 172 if (defined($const_name = $log_name . '_LOG_REALFILE')) { 173 return constant($const_name); 174 } 175 trigger_error('不正なログが指定されました。', E_USER_ERROR); 176 } 177 178 /** 179 * ログファイルの一覧を読み込む 180 * 181 * TODO mtb_constants から動的生成したい。 182 * @return void 183 */ 184 function loadLogList() { 185 $this->arrLogList[''] = '標準ログファイル'; 186 $this->arrLogList['CUSTOMER'] = '会員ログイン ログファイル'; 187 $this->arrLogList['ADMIN'] = '管理機能ログファイル'; 188 189 if (defined('DEBUG_LOG_REALFILE') && strlen(DEBUG_LOG_REALFILE) >= 1) { 190 $this->arrLogList['DEBUG'] = 'デバッグログファイル'; 191 } 192 193 if (defined('ERROR_LOG_REALFILE') && strlen(ERROR_LOG_REALFILE) >= 1) { 194 $this->arrLogList['ERROR'] = 'エラーログファイル'; 195 } 196 197 if (defined('DB_LOG_REALFILE') && strlen(DB_LOG_REALFILE) >= 1) { 198 $this->arrLogList['DB'] = 'DBログファイル'; 199 } 200 } 158 201 }
Note: See TracChangeset
for help on using the changeset viewer.