Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Admin_System_Log.php

Documentation is available at LC_Page_Admin_System_Log.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once CLASS_EX_REALDIR 'page_extends/admin/LC_Page_Admin_Ex.php';
  26.  
  27. /**
  28.  * ログ のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author Seasoft 塚田将久
  32.  * @version $Id: LC_Page_Admin_System_Log.php 20970 2011-06-10 10:27:24Z Seasoft $
  33.  */
  34. class LC_Page_Admin_System_Log extends LC_Page_Admin_Ex {
  35.  
  36.     // }}}
  37.     // {{{ functions
  38.  
  39.     /**
  40.      * Page を初期化する.
  41.      *
  42.      * @return void 
  43.      */
  44.     function init({
  45.         parent::init();
  46.         $this->tpl_mainpage 'system/log.tpl';
  47.         $this->tpl_subno    'log';
  48.         $this->tpl_mainno   'system';
  49.         $this->tpl_maintitle 'システム設定';
  50.         $this->tpl_subtitle 'EC-CUBE ログ表示';
  51.         $this->line_max     50;
  52.     }
  53.  
  54.     /**
  55.      * Page のプロセス.
  56.      *
  57.      * @return void 
  58.      */
  59.     function process({
  60.         $this->action();
  61.         $this->sendResponse();
  62.     }
  63.  
  64.     /**
  65.      * Page のアクション.
  66.      *
  67.      * @return void 
  68.      */
  69.     function action({
  70.         $objFormParam new SC_FormParam;
  71.  
  72.         // パラメーター情報初期化
  73.         $this->lfInitParam($objFormParam);
  74.  
  75.         // POST値をセット
  76.         $objFormParam->setParam($_POST);
  77.  
  78.         if (SC_Utils_Ex::sfIsInt($tmp $objFormParam->getValue('line'))) {
  79.             $this->line_max $tmp;
  80.         }
  81.  
  82.         $this->tpl_ec_log $this->getEccubeLog();
  83.     }
  84.  
  85.     /**
  86.      * デストラクタ.
  87.      *
  88.      * @return void 
  89.      */
  90.     function destroy({
  91.         parent::destroy();
  92.     }
  93.  
  94.     /**
  95.      * パラメーターの初期化.
  96.      *
  97.      * @return object SC_FormParam インスタンス
  98.      * @return void 
  99.      */
  100.     function lfInitParam(&$objFormParam{
  101.         $objFormParam->addParam('line_max''line_max'INT_LEN''array('NUM_CHECK''MAX_LENGTH_CHECK''EXIST_CHECK'));
  102.     }
  103.  
  104.     /**
  105.      * EC-CUBE ログを取得する.
  106.      *
  107.      * @return array $arrLogs 取得したログ
  108.      */
  109.     function getEccubeLog({
  110.  
  111.         $index 0;
  112.         $arrLogs array();
  113.         for ($gen $gen <= MAX_LOG_QUANTITY$gen++{
  114.             $path LOG_REALFILE;
  115.             if ($gen != 0{
  116.                 $path .= ".$gen";
  117.             }
  118.  
  119.             // ファイルが存在しない場合、前世代のログへ
  120.             if (!file_exists($path)) continue;
  121.  
  122.             $arrLogTmp array_reverse(file($path));
  123.  
  124.             $arrBodyReverse array();
  125.             foreach ($arrLogTmp as $line{
  126.                 $line chop($line);
  127.                 if (preg_match('/^(\d+\/\d+\/\d+ \d+:\d+:\d+) \[([^\]]+)\] (.*)$/'$line$arrMatch)) {
  128.                     $arrLogLine array();
  129.                     // 日時
  130.                     $arrLogLine['date'$arrMatch[1];
  131.                     // パス
  132.                     $arrLogLine['path'$arrMatch[2];
  133.                     // 内容
  134.                     $arrBodyReverse[$arrMatch[3];
  135.                     $arrLogLine['body'implode("\n"array_reverse($arrBodyReverse));
  136.                     $arrBodyReverse array();
  137.  
  138.                     $arrLogs[$arrLogLine;
  139.  
  140.                     // 上限に達した場合、処理を抜ける
  141.                     if (count($arrLogs>= $this->line_maxbreak 2;
  142.                 else {
  143.                     // 内容
  144.                     $arrBodyReverse[$line;
  145.                 }
  146.             }
  147.         }
  148.         return $arrLogs;
  149.     }
  150. }

Documentation generated on Fri, 24 Feb 2012 14:01:49 +0900 by Seasoft