Example #1
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     // チェック後のデータを格納
     $arrClean = array();
     // $_GET['move'] が想定値かどうかチェック
     switch ($_GET['move']) {
         case 'up':
         case 'down':
             $arrClean['move'] = $_GET['move'];
             break;
         default:
             $arrClean['move'] = '';
             break;
     }
     // 正当な数値であればOK
     if (Utils::sfIsInt($_GET['id'])) {
         $arrClean['id'] = $_GET['id'];
         switch ($arrClean['move']) {
             case 'up':
                 $this->lfRunkUp($arrClean['id']);
                 break;
             case 'down':
                 $this->lfRunkDown($arrClean['id']);
                 break;
             default:
                 break;
         }
         // エラー処理
     } else {
         GcUtils::gfPrintLog('error id=' . $_GET['id']);
     }
     // ページの表示
     Application::alias('eccube.response')->sendRedirect(ADMIN_SYSTEM_URLPATH);
 }
Example #2
0
 /**
  * UserAgentを検証する.
  *
  * @return boolean
  */
 public function validateModel()
 {
     $ua = $this->getModel();
     if (!empty($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] === $ua) {
         return true;
     }
     $msg = sprintf('User agent model mismatch : %s != %s(expected), sid=%s', $_SERVER['HTTP_USER_AGENT'], $ua, session_id());
     GcUtils::gfPrintLog($msg);
     return false;
 }
Example #3
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objFormParam = Application::alias('eccube.form_param');
     // パラメーターの初期化
     $this->initParam($objFormParam, $_GET);
     // パラメーターの検証
     if ($objFormParam->checkError() || !Utils::sfIsInt($id = $objFormParam->getValue('id'))) {
         GcUtils::gfPrintLog("error id={$id}");
         Utils::sfDispError(INVALID_MOVE_ERRORR);
     }
     $id = $objFormParam->getValue('id');
     // レコードの削除
     $this->deleteMember($id);
     // リダイレクト
     $url = $this->getLocation(ADMIN_SYSTEM_URLPATH) . '?pageno=' . $objFormParam->getValue('pageno');
     Application::alias('eccube.response')->sendRedirect($url);
 }
Example #4
0
 /**
  * ファイルアップロードを行う.
  *
  * 以下のチェックを行い, ファイルを一時領域へアップロードする.
  * 1. ファイルサイズチェック
  * 2. 拡張子チェック
  *
  * TODO
  * CheckError クラスや, UploadFile クラスが多次元配列に対応して
  * いないため, 独自のロジックを使用している.
  *
  * @param  FormParam $objFormParam FormParam インスタンス
  * @return void
  */
 public function doFileUpload(&$objFormParam)
 {
     $index = $objFormParam->getValue('upload_index');
     $arrDownRealFiles = $objFormParam->getValue('down_realfilename');
     if ($_FILES['down_realfilename']['size'][$index] <= 0) {
         $this->arrErr['down_realfilename'][$index] = '※ ファイルがアップロードされていません';
     } elseif ($_FILES['down_realfilename']['size'][$index] > DOWN_SIZE * 1024) {
         $size = DOWN_SIZE;
         $byte = 'KB';
         if ($size >= 1000) {
             $size = $size / 1000;
             $byte = 'MB';
         }
         $this->arrErr['down_realfilename'][$index] = '※ ダウンロード販売用ファイル名のファイルサイズは' . $size . $byte . '以下のものを使用してください。<br />';
     } else {
         // CheckError::FILE_EXT_CHECK とのソース互換を強めるための配列
         $value = array(0 => 'ダウンロード販売用ファイル名', 1 => 'down_realfilename', 2 => explode(',', DOWNLOAD_EXTENSION));
         // ▼CheckError::FILE_EXT_CHECK から移植
         $match = false;
         if (strlen($_FILES[$value[1]]['name'][$index]) >= 1) {
             $filename = $_FILES[$value[1]]['name'][$index];
             foreach ($value[2] as $check_ext) {
                 $match = preg_match('/' . preg_quote('.' . $check_ext) . '$/i', $filename) >= 1;
                 if ($match === true) {
                     break 1;
                 }
             }
         }
         if ($match === false) {
             $str_ext = implode('・', $value[2]);
             $this->arrErr[$value[1]][$index] = '※ ' . $value[0] . 'で許可されている形式は、' . $str_ext . 'です。<br />';
             // ▲CheckError::FILE_EXT_CHECK から移植
         } else {
             $uniqname = date('mdHi') . '_' . uniqid('') . '.';
             $temp_file = preg_replace("/^.*\\./", $uniqname, $_FILES['down_realfilename']['name'][$index]);
             if (move_uploaded_file($_FILES['down_realfilename']['tmp_name'][$index], DOWN_TEMP_REALDIR . $temp_file)) {
                 $arrDownRealFiles[$index] = $temp_file;
                 $objFormParam->setValue('down_realfilename', $arrDownRealFiles);
                 GcUtils::gfPrintLog($_FILES['down_realfilename']['name'][$index] . ' -> ' . realpath(DOWN_TEMP_REALDIR . $temp_file));
             } else {
                 $objErr->arrErr[$keyname] = '※ ファイルのアップロードに失敗しました。<br />';
                 GcUtils::gfPrintLog('File Upload Error!: ' . $_FILES['down_realfilename']['name'][$index] . ' -> ' . DOWN_TEMP_REALDIR . $temp_file);
             }
         }
     }
 }
Example #5
0
 /**
  * SQL の実行ログ (トレースログ) を書き出す
  *
  * @param string 実行するSQL文
  * @param  array $arrVal プレースホルダに挿入する配列
  * @return void
  */
 private function lfEndDbTraceLog(&$arrStartInfo, &$objSth, &$arrVal)
 {
     if (!defined('SQL_QUERY_LOG_MODE') || SQL_QUERY_LOG_MODE === 0) {
         return;
     }
     $msg = "[execute end {$arrStartInfo['http_request_id']}#{$arrStartInfo['count']}]\n";
     $timeEnd = microtime(true);
     $timeExecTime = $timeEnd - $arrStartInfo['time_start'];
     // ログモード1の場合、
     if (SQL_QUERY_LOG_MODE === 1) {
         // 規定時間より速い場合、ログに出力しない
         if (!defined('SQL_QUERY_LOG_MIN_EXEC_TIME') || $timeExecTime < (double) SQL_QUERY_LOG_MIN_EXEC_TIME) {
             return;
         }
         // 開始時にログ出力していないため、ここで実行内容を出力する
         $msg .= 'SQL: ' . $objSth->query . "\n";
         $msg .= 'PlaceHolder: ' . var_export($arrVal, true) . "\n";
     }
     $msg .= 'execution time: ' . sprintf('%.2f sec', $timeExecTime) . "\n";
     GcUtils::gfPrintLog($msg, DB_LOG_REALFILE);
 }
 /**
  * 指定されたパスの配下を再帰的に削除.
  *
  * @param  string  $path       削除対象のディレクトリまたはファイルのパス
  * @param  boolean $del_myself $pathそのものを削除するか. true なら削除する.
  * @return void
  */
 public function deleteFile($path, $del_myself = true)
 {
     $flg = false;
     // 対象が存在するかを検証.
     if (file_exists($path) === false) {
         GcUtils::gfPrintLog($path . ' が存在しません.');
     } elseif (is_dir($path)) {
         // ディレクトリが指定された場合
         $handle = opendir($path);
         if (!$handle) {
             GcUtils::gfPrintLog($path . ' が開けませんでした.');
         }
         while (($item = readdir($handle)) !== false) {
             if ($item === '.' || $item === '..') {
                 continue;
             }
             $cur_path = $path . '/' . $item;
             if (is_dir($cur_path)) {
                 // ディレクトリの場合、再帰処理
                 $flg = $this->deleteFile($cur_path);
             } else {
                 // ファイルの場合、unlink
                 $flg = @unlink($cur_path);
             }
         }
         closedir($handle);
         // ディレクトリを削除
         GcUtils::gfPrintLog($path . ' を削除します.');
         if ($del_myself) {
             $flg = @rmdir($path);
         }
     } else {
         // ファイルが指定された場合.
         GcUtils::gfPrintLog($path . ' を削除します.');
         $flg = @unlink($path);
     }
     return $flg;
 }
 /**
  * 前方互換用
  *
  * @deprecated 2.12.0 GcUtils::gfPrintLog を使用すること
  */
 public function log($mess, $log_level = 'Info')
 {
     trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING);
     // ログレベル=Debugの場合は、DEBUG_MODEがtrueの場合のみログ出力する
     if ($log_level === 'Debug' && DEBUG_MODE === false) {
         return;
     }
     // ログ出力
     GcUtils::gfPrintLog($mess, '');
 }
Example #8
0
 /**
  * 商品画像のパスを取得する
  *
  * @param $arrForm
  * @return string 指定された商品画像のパス
  */
 public function lfGetProductImage($arrForm)
 {
     $objQuery = Application::alias('eccube.query');
     $table = 'dtb_products';
     $col = $arrForm['image_key'];
     $product_id = $arrForm['product_id'];
     //指定されたカラムが存在する場合にのみ商品テーブルからファイル名を取得
     if (Application::alias('eccube.helper.db')->columnExists($table, $col, '', '', false)) {
         $product_image = $objQuery->get($col, $table, 'product_id = ?', array($product_id));
     } else {
         GcUtils::gfPrintLog('invalid access :resize_image.php image_key=' . $col);
         $product_image = '';
     }
     // ファイル名が正しく、ファイルが存在する場合だけ、$fileを設定
     $file = Utils::getSaveImagePath($product_image);
     return $file;
 }
Example #9
0
 /**
  * CSVファイルからインサート実行.
  *
  * @param  Query $objQuery
  * @param  string $dir
  * @param  string $mode
  * @return boolean
  */
 public function lfExeInsertSQL(&$objQuery, $dir, $mode)
 {
     $tbl_flg = false;
     $col_flg = false;
     $ret = true;
     $pagelayout_flg = false;
     $arrVal = array();
     $arrCol = array();
     $arrAllTableList = $objQuery->listTables();
     $objDir = dir($dir);
     while (false !== ($file_name = $objDir->read())) {
         if (!preg_match('/^((dtb|mtb|plg)_(\\w+))\\.csv$/', $file_name, $matches)) {
             continue;
         }
         $file_path = $dir . $file_name;
         $table = $matches[1];
         // テーブル存在チェック
         if (!in_array($table, $arrAllTableList)) {
             if ($mode === 'restore_config') {
                 continue;
             }
             return false;
         }
         // csvファイルからデータの取得
         $fp = fopen($file_path, 'r');
         if ($fp === false) {
             trigger_error($file_name . ' のファイルオープンに失敗しました。', E_USER_ERROR);
         }
         GcUtils::gfPrintLog('リストア実行: ' . $table);
         $objQuery->delete($table);
         $line = 0;
         $arrColName = array();
         while (!feof($fp)) {
             $line++;
             $arrCsvLine = fgetcsv($fp, 1024 * 1024);
             // 1行目: 列名
             if ($line === 1) {
                 $arrColName = $arrCsvLine;
                 continue;
             }
             // 空行を無視
             // false との比較は PHP 5.2.x Windows バグ対応
             // 参考: http://www.php.net/manual/ja/function.fgetcsv.php#98502
             if ($arrCsvLine === array(null) || $arrCsvLine === false) {
                 continue;
             }
             $arrVal = array_combine($arrColName, $arrCsvLine);
             $objQuery->insert($table, $arrVal);
             Utils::extendTimeOut();
         }
         fclose($fp);
     }
     return $ret;
 }
Example #10
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objFormParam = Application::alias('eccube.form_param');
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $this->arrErr = $objFormParam->checkError();
     $is_error = !Utils::isBlank($this->arrErr);
     $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC);
     switch ($this->getMode()) {
         // 登録
         case 'regist':
             $this->arrErr = $this->lfCheckError($objFormParam, $this->arrErr);
             if (Utils::isBlank($this->arrErr)) {
                 if ($this->doRegister($objFormParam)) {
                     $this->tpl_onload = "alert('登録が完了しました。');";
                 }
             }
             break;
         default:
             break;
     }
     if (!$is_error) {
         // テキストエリアに表示
         $header_path = $this->getTemplatePath($this->device_type_id, 'header');
         $footer_path = $this->getTemplatePath($this->device_type_id, 'footer');
         if ($header_path === false || $footer_path === false) {
             $this->arrErr['err'] = '※ ファイルの取得に失敗しました<br />';
         } else {
             $this->header_data = file_get_contents($header_path);
             $this->footer_data = file_get_contents($footer_path);
         }
     } else {
         // 画面にエラー表示しないため, ログ出力
         GcUtils::gfPrintLog('Error: ' . print_r($this->arrErr, true));
     }
     //サブタイトルの追加
     $this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '>' . $this->tpl_subtitle;
 }
Example #11
0
 /**
  * ログイン失敗情報の記録
  *
  * TODO: ブルートフォースアタック対策の実装
  *
  * @param  string $error_login_id ログイン失敗時に投入されたlogin_id文字列
  * @return void
  */
 public function lfSetIncorrectData($error_login_id)
 {
     GcUtils::gfPrintLog($error_login_id . ' password incorrect.');
 }
Example #12
0
 public function makeTempDownFile($keyname = 'down_file')
 {
     /* @var $objErr CheckError */
     $objErr = Application::alias('eccube.check_error');
     $cnt = 0;
     $check = $this->checkUploadError($keyname, $objErr);
     if ($check) {
         foreach ($this->keyname as $val) {
             // 一致したキーのファイルに情報を保存する。
             if ($val == $keyname) {
                 // 拡張子チェック
                 $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->arrExt[$cnt]), array('FILE_EXT_CHECK'));
                 // ファイルサイズチェック
                 $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array('FILE_SIZE_CHECK'));
                 // エラーがない場合
                 if (!isset($objErr->arrErr[$keyname])) {
                     // 一意なファイル名を作成する。
                     $uniqname = date('mdHi') . '_' . uniqid('') . '.';
                     $this->temp_file[$cnt] = preg_replace("/^.*\\./", $uniqname, $_FILES[$keyname]['name']);
                     $result = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir . $this->temp_file[$cnt]);
                     GcUtils::gfPrintLog($result . ' -> ' . $this->temp_dir . $this->temp_file[$cnt]);
                     Utils::extendTimeOut();
                 }
             }
             $cnt++;
         }
     }
     return $objErr->arrErr[$keyname];
 }
Example #13
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objFormParam = Application::alias('eccube.form_param');
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $this->arrErr = $objFormParam->checkError();
     $is_error = !Utils::isBlank($this->arrErr);
     $this->bloc_id = $objFormParam->getValue('bloc_id');
     $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC);
     /* @var $objBloc BlocHelper */
     $objBloc = Application::alias('eccube.helper.bloc', $this->device_type_id);
     switch ($this->getMode()) {
         // 登録/更新
         case 'confirm':
             if (!$is_error) {
                 $this->arrErr = $this->lfCheckError($objFormParam, $this->arrErr, $objBloc);
                 if (Utils::isBlank($this->arrErr)) {
                     $result = $this->doRegister($objFormParam, $objBloc);
                     if ($result !== false) {
                         $arrPram = array('bloc_id' => $result, 'device_type_id' => $this->device_type_id, 'msg' => 'on');
                         Application::alias('eccube.response')->reload($arrPram, true);
                         Application::alias('eccube.response')->actionExit();
                     }
                 }
             }
             break;
             // 削除
         // 削除
         case 'delete':
             if (!$is_error) {
                 if ($this->doDelete($objFormParam, $objBloc)) {
                     $arrPram = array('device_type_id' => $this->device_type_id, 'msg' => 'on');
                     Application::alias('eccube.response')->reload($arrPram, true);
                     Application::alias('eccube.response')->actionExit();
                 }
             }
             break;
         default:
             if (isset($_GET['msg']) && $_GET['msg'] == 'on') {
                 // 完了メッセージ
                 $this->tpl_onload = "alert('登録が完了しました。');";
             }
             break;
     }
     if (!$is_error) {
         // ブロック一覧を取得
         $this->arrBlocList = $objBloc->getList();
         // bloc_id が指定されている場合にはブロックデータの取得
         if (!Utils::isBlank($this->bloc_id)) {
             $arrBloc = $this->getBlocTemplate($this->bloc_id, $objBloc);
             $objFormParam->setParam($arrBloc);
         }
     } else {
         // 画面にエラー表示しないため, ログ出力
         GcUtils::gfPrintLog('Error: ' . print_r($this->arrErr, true));
     }
     $this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '>' . $this->tpl_subtitle;
     $this->arrForm = $objFormParam->getFormParamList();
 }
Example #14
0
 /**
  * JSON 文字列をデコードする.
  *
  * この関数は, json_decode() 又は Services_JSON::decode() のラッパーです.
  * json_decode() 関数が使用可能な場合は json_decode() 関数を使用する.
  * 使用できない場合は, Services_JSON::decode() 関数を使用する.
  *
  * @param  string $json JSON 形式にエンコードされた文字列
  * @return mixed  デコードされた PHP の型
  * @see json_decode()
  * @see Services_JSON::decode()
  */
 public static function jsonDecode($json)
 {
     if (function_exists('json_decode')) {
         return json_decode($json);
     } else {
         GcUtils::gfPrintLog(' *use Services_JSON::decode(). faster than using the json_decode!');
         /* @var $objJson Services_JSON */
         $objJson = Application::alias('pear.services.json');
         return $objJson->decode($json);
     }
 }
Example #15
0
 protected function log($msg)
 {
     $msg = sprintf("%s %s: %s", $this->plugin_code, $this->exec_func, $msg);
     GcUtils::gfPrintLog($msg, PLUGIN_LOG_REALFILE);
 }
Example #16
0
 /**
  * EC-CUBE がサポートする携帯端末かどうかを判別する。
  *
  * 以下の条件に該当する場合は, false を返す.
  *
  * - 携帯端末だと判別されたが, ユーザーエージェントが解析不能な場合
  * - J-PHONE C4型(パケット非対応)
  * - EzWeb で WAP2 以外の端末
  * - DoCoMo 501i, 502i, 209i, 210i, SH821i, N821i, P821i, P651ps, R691i, F671i, SH251i, SH251iS
  *
  * @return boolean サポートしている場合は true、それ以外の場合は false を返す。
  */
 public static function isSupported()
 {
     $objAgent =& \Net_UserAgent_Mobile::singleton();
     // 携帯端末だと認識されたが、User-Agent の形式が未知の場合
     if (\Net_UserAgent_Mobile::isError($objAgent)) {
         GcUtils::gfPrintLog($objAgent->toString());
         return false;
     }
     if ($objAgent->isDoCoMo()) {
         $arrUnsupportedSeries = array('501i', '502i', '209i', '210i');
         $arrUnsupportedModels = array('SH821i', 'N821i', 'P821i ', 'P651ps', 'R691i', 'F671i', 'SH251i', 'SH251iS');
         return !in_array($objAgent->getSeries(), $arrUnsupportedSeries) && !in_array($objAgent->getModel(), $arrUnsupportedModels);
     } elseif ($objAgent->isEZweb()) {
         return $objAgent->isWAP2();
     } elseif ($objAgent->isVodafone()) {
         return $objAgent->isPacketCompliant();
     } else {
         // 携帯端末ではない場合はサポートしていることにする。
         return true;
     }
 }
Example #17
0
 /**
  * 店舗基本情報を登録する
  *
  * @param  array $arrData 登録するデータ
  * @return void
  */
 public function registerBasisData($arrData)
 {
     /* @var $objQuery Query */
     $objQuery = Application::alias('eccube.query');
     $arrData = $objQuery->extractOnlyColsOf('dtb_baseinfo', $arrData);
     if (isset($arrData['regular_holiday_ids']) && is_array($arrData['regular_holiday_ids'])) {
         // 定休日をパイプ区切りの文字列に変換
         $arrData['regular_holiday_ids'] = implode('|', $arrData['regular_holiday_ids']);
     }
     $arrData['update_date'] = 'CURRENT_TIMESTAMP';
     // UPDATEの実行
     $ret = $objQuery->update('dtb_baseinfo', $arrData);
     GcUtils::gfPrintLog('dtb_baseinfo に UPDATE を実行しました。');
     // UPDATE できなかった場合、INSERT
     if ($ret == 0) {
         $arrData['id'] = 1;
         $objQuery->insert('dtb_baseinfo', $arrData);
         GcUtils::gfPrintLog('dtb_baseinfo に INSERT を実行しました。');
     }
 }
 /**
  * パラメーターから有効なセッションIDを取得する。
  *
  * @return string|false 取得した有効なセッションIDを返す。
  *                      取得できなかった場合は false を返す。
  */
 public function getSessionId()
 {
     // パラメーターからセッションIDを取得する。
     $sessionId = @$_POST[session_name()];
     if (!isset($sessionId)) {
         $sessionId = @$_GET[session_name()];
         // AU動画音声ファイルダウンロード対策
         // キャリアがAUで、動画、音声ファイルをダウンロードする際に
         // SESSIONIDの後に余計なパラメータが付与され、セッションが無効になるケースがある
         if (MobileUserAgent::getCarrier() == 'ezweb') {
             $idArray = split("\\?", $sessionId);
             $sessionId = $idArray[0];
         }
     }
     if (!isset($sessionId)) {
         $sessionId = $this->getExtSessionId();
     }
     if (!isset($sessionId)) {
         return false;
     }
     // セッションIDの存在をチェックする。
     if ($this->sfSessRead($sessionId) === null) {
         GcUtils::gfPrintLog("Non-existent session id : sid={$sessionId}");
         return false;
     }
     return session_id($sessionId);
 }
Example #19
0
 public function checkSessionPendingOrder()
 {
     if (isset($_SESSION['order_id']) && !Utils::isBlank($_SESSION['order_id'])) {
         $order_id = $_SESSION['order_id'];
         unset($_SESSION['order_id']);
         $objQuery = Application::alias('eccube.query');
         $objQuery->begin();
         $arrOrder = static::getOrder($order_id);
         if ($arrOrder['status'] == ORDER_PENDING) {
             /* @var $objCartSess CartSession */
             $objCartSess = Application::alias('eccube.cart_session');
             $cartKeys = $objCartSess->getKeys();
             if (Utils::isBlank($cartKeys)) {
                 static::rollbackOrder($order_id, ORDER_CANCEL, true);
                 GcUtils::gfPrintLog('order rollback.(session pending) order_id=' . $order_id);
             } else {
                 static::cancelOrder($order_id, ORDER_CANCEL, true);
                 GcUtils::gfPrintLog('order rollback.(session pending and set card) order_id=' . $order_id);
             }
         }
         $objQuery->commit();
     }
 }
 /**
  * エラー捕捉時のエラーハンドラ関数 (for PHP >= 5.2.0)
  *
  * この関数は, register_shutdown_function() 関数に登録するための関数である。
  * PHP 5.1 対応処理との互換運用ため E_USER_ERROR は handle_warning で捕捉する。
  *
  * @return void
  */
 public static function handle_error()
 {
     // 最後のエラーを確実に捉えるため、先頭で呼び出す。
     $arrError = error_get_last();
     $is_error = false;
     if (isset($arrError)) {
         switch ($arrError['type']) {
             case E_ERROR:
             case E_PARSE:
             case E_CORE_ERROR:
             case E_COMPILE_ERROR:
                 $is_error = true;
                 break;
             default:
                 break;
         }
     }
     if (!$is_error) {
         return;
     }
     $error_type_name = GcUtils::getErrorTypeName($arrError['type']);
     $errstr = "Fatal error({$error_type_name}): {$arrError[message]} on [{$arrError[file]}({$arrError[line]})]";
     GcUtils::gfPrintLog($errstr, ERROR_LOG_REALFILE, true);
     // エラー画面を表示する
     static::displaySystemError($errstr);
 }
Example #21
0
 /**
  * プラグインアーカイブを解凍する.
  *
  * @param  string  $path アーカイブパス
  * @return boolean Archive_Tar::extractModify()のエラー
  */
 public function unpackPluginArchive($path)
 {
     // 圧縮フラグTRUEはgzip解凍をおこなう
     $tar = new Archive_Tar($path, true);
     $dir = dirname($path);
     $file_name = basename($path);
     // 指定されたフォルダ内に解凍する
     $result = $tar->extractModify($dir . '/', '');
     GcUtils::gfPrintLog("解凍: {$path} -> {$dir}");
     // 解凍元のファイルを削除する.
     unlink($path);
     return $result;
 }
Example #22
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     /* @var $objLayout PageLayoutHelper */
     $objLayout = Application::alias('eccube.helper.page_layout');
     $objFormParam = Application::alias('eccube.form_param');
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $this->arrErr = $objFormParam->checkError();
     $is_error = !Utils::isBlank($this->arrErr);
     $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC);
     $this->page_id = $objFormParam->getValue('page_id');
     switch ($this->getMode()) {
         // 削除
         case 'delete':
             if (!$is_error) {
                 if ($objLayout->isEditablePage($this->device_type_id, $this->page_id)) {
                     $objLayout->lfDelPageData($this->page_id, $this->device_type_id);
                     Application::alias('eccube.response')->reload(array('device_type_id' => $this->device_type_id, 'msg' => 'on'), true);
                     Application::alias('eccube.response')->actionExit();
                 }
             }
             break;
             // 登録/編集
         // 登録/編集
         case 'confirm':
             if (!$is_error) {
                 $this->arrErr = $this->lfCheckError($objFormParam, $this->arrErr);
                 if (Utils::isBlank($this->arrErr)) {
                     $result = $this->doRegister($objFormParam, $objLayout);
                     if ($result !== false) {
                         $arrQueryString = array('device_type_id' => $this->device_type_id, 'page_id' => $result, 'msg' => 'on');
                         Application::alias('eccube.response')->reload($arrQueryString, true);
                         Application::alias('eccube.response')->actionExit();
                     }
                 }
             }
             break;
         default:
             if (isset($_GET['msg']) && $_GET['msg'] == 'on') {
                 $this->tpl_onload = "alert('登録が完了しました。');";
             }
             break;
     }
     if (!$is_error) {
         $this->arrPageList = $objLayout->getPageProperties($this->device_type_id, null);
         // page_id が指定されている場合にはテンプレートデータの取得
         if (!Utils::isBlank($this->page_id)) {
             $arrPageData = $this->getTplMainpage($this->device_type_id, $this->page_id, $objLayout);
             $objFormParam->setParam($arrPageData);
         }
     } else {
         // 画面にエラー表示しないため, ログ出力
         GcUtils::gfPrintLog('Error: ' . print_r($this->arrErr, true));
     }
     $this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '>' . $this->tpl_subtitle;
     $this->arrForm = $objFormParam->getFormParamList();
 }
Example #23
0
 public function EndSession()
 {
     // セッション情報破棄の前にcustomer_idを保存
     $customer_id = $_SESSION['customer']['customer_id'];
     // $_SESSION['customer']の解放
     unset($_SESSION['customer']);
     // セッションの配送情報を全て破棄する
     PurchaseHelper::unsetAllShippingTemp(true);
     // トランザクショントークンの破棄
     SessionHelper::destroyToken();
     /* @var $objSiteSess SiteSession */
     $objSiteSess = Application::alias('eccube.site_session');
     $objSiteSess->unsetUniqId();
     // ログに記録する
     $log = sprintf("logout : user=%d\tip=%s", $customer_id, $this->getRemoteHost());
     GcUtils::gfPrintLog($log, CUSTOMER_LOG_REALFILE, false);
 }
Example #24
0
 /**
  * メッセージを出力
  *
  * @param string $message
  */
 public function log($message)
 {
     GcUtils::gfPrintLog($message, OSTORE_LOG_REALFILE);
 }
Example #25
0
 /**
  * セッションデータが有効かどうかをチェックする。
  *
  * FIXME '@' でエラーを抑制するのは良くない
  *
  * @return boolean セッションデータが有効な場合は true、無効な場合は false を返す。
  */
 public function lfMobileValidateSession()
 {
     // 配列 mobile が登録されているかどうかをチェックする。
     if (!is_array(@$_SESSION['mobile'])) {
         return false;
     }
     // 有効期限を過ぎていないかどうかをチェックする。
     if (intval(@$_SESSION['mobile']['expires']) < time()) {
         $msg = 'Session expired at ' . date('Y/m/d H:i:s', @$_SESSION['mobile']['expires']) . ' : sid=' . session_id();
         GcUtils::gfPrintLog($msg);
         return false;
     }
     // 携帯端末の機種が一致するかどうかをチェックする。
     $model = MobileUserAgent::getModel();
     if (@$_SESSION['mobile']['model'] != $model) {
         $msg = 'User agent model mismatch : ' . '"$model" != "' . @$_SESSION['mobile']['model'] . '" (expected), sid=' . session_id();
         GcUtils::gfPrintLog($msg);
         return false;
     }
     return true;
 }
Example #26
0
 /**
  * @param string $msg
  */
 public function printLog($msg)
 {
     GcUtils::gfPrintLog($msg, DATA_REALDIR . 'logs/ownersstore_batch_update.log');
 }
Example #27
0
 /**
  * APIログ
  *
  * @param string $msg            出力文字列
  * @param text $operation_name
  * @return void
  */
 public function printApiLog($msg, $start_time = '', $operation_name = '')
 {
     if (!Utils::isBlank($operation_name)) {
         $msg = 'API_' . $operation_name . ':' . $msg;
     }
     if (!Utils::isBlank($start_time)) {
         $msg = '(RequestId:' . $start_time . ')' . $msg;
     }
     GcUtils::gfPrintLog($msg, DATA_REALDIR . self::API_LOGFILE, self::API_DEBUG_MODE);
 }
Example #28
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     /* @var $objLayout PageLayoutHelper */
     $objLayout = Application::alias('eccube.helper.page_layout');
     $objFormParam = Application::alias('eccube.form_param');
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objFormParam->convParam();
     $this->arrErr = $objFormParam->checkError();
     $is_error = !Utils::isBlank($this->arrErr);
     // CSSファイル名を取得
     $this->css_name = $objFormParam->getValue('css_name');
     $this->old_css_name = $objFormParam->getValue('old_css_name', $this->css_name);
     $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC);
     $css_dir = $objLayout->getTemplatePath($this->device_type_id, true) . 'css/';
     $css_path = $css_dir . $this->css_name . '.css';
     switch ($this->getMode()) {
         // データ更新処理
         case 'confirm':
             if (!$is_error) {
                 $this->arrErr = array_merge($this->arrErr, $this->lfCheckError($objFormParam, $this->arrErr));
                 if (Utils::isBlank($this->arrErr)) {
                     if ($this->doRegister($css_dir, $this->css_name, $this->old_css_name, $css_path, $objFormParam->getValue('css_data'))) {
                         $this->tpl_onload = "alert('登録が完了しました。');";
                     }
                 }
             }
             break;
         case 'delete':
             if (!$is_error) {
                 if ($this->doDelete($css_path)) {
                     $arrPram = array('device_type_id' => $this->device_type_id, 'msg' => 'on');
                     Application::alias('eccube.response')->reload($arrPram, true);
                 }
             }
             break;
         default:
             if (isset($_GET['msg']) && $_GET['msg'] == 'on') {
                 // 完了メッセージ
                 $this->tpl_onload = "alert('登録が完了しました。');";
             }
             break;
     }
     if (Utils::isBlank($this->arrErr) && $this->checkPath($this->css_name)) {
         // CSSファイルの読み込み
         if (!Utils::isBlank($this->css_name)) {
             $objFormParam->setValue('css_data', file_get_contents($css_path));
         }
     } else {
         // 画面にエラー表示しないため, ログ出力
         GcUtils::gfPrintLog('Error: ' . print_r($this->arrErr, true));
     }
     // ファイルリストを取得
     $this->arrCSSList = $this->getCSSList($css_dir);
     $this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '>' . $this->tpl_subtitle;
     $this->arrForm = $objFormParam->getFormParamList();
 }
Example #29
0
 public function logout()
 {
     unset($_SESSION['cert']);
     unset($_SESSION['login_id']);
     unset($_SESSION['authority']);
     unset($_SESSION['member_id']);
     unset($_SESSION['uniqid']);
     // トランザクショントークンを破棄
     \Eccube\Helper\Session::destroyToken();
     // ログに記録する
     GcUtils::gfPrintLog('logout : user='******' auth=' . $this->authority . ' sid=' . $this->sid);
 }