/** * 受注を完了する. * * 下記のフローで受注を完了する. * * 1. トランザクションを開始する * 2. カートの内容を検証する. * 3. 受注一時テーブルから受注データを読み込む * 4. ユーザーがログインしている場合はその他の発送先へ登録する * 5. 受注データを受注テーブルへ登録する * 6. トランザクションをコミットする * * 実行中に, 何らかのエラーが発生した場合, 処理を中止しエラーページへ遷移する * * 決済モジュールを使用する場合は対応状況を「決済処理中」に設定し, * 決済完了後「新規受付」に変更すること * * @param integer $orderStatus 受注処理を完了する際に設定する対応状況 * @return void */ function completeOrder($orderStatus = ORDER_NEW) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $objSiteSession = new SC_SiteSession_Ex(); $objCartSession = new SC_CartSession_Ex(); $objCustomer = new SC_Customer_Ex(); $customerId = $objCustomer->getValue('customer_id'); $objQuery->begin(); if (!$objSiteSession->isPrePage()) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSession); } $uniqId = $objSiteSession->getUniqId(); $this->verifyChangeCart($uniqId, $objCartSession); $orderTemp = $this->getOrderTemp($uniqId); $orderTemp['status'] = $orderStatus; $cartkey = $objCartSession->getKey(); $order_id = $this->registerOrderComplete($orderTemp, $objCartSession, $cartkey); $isMultiple = SC_Helper_Purchase::isMultiple(); $shippingTemp =& $this->getShippingTemp($isMultiple); foreach ($shippingTemp as $shippingId => $val) { $this->registerShipmentItem($order_id, $shippingId, $val['shipment_item']); } $this->registerShipping($order_id, $shippingTemp); $objQuery->commit(); //会員情報の最終購入日、購入合計を更新 if ($customerId > 0) { SC_Customer_Ex::updateOrderSummary($customerId); } $this->cleanupSession($order_id, $objCartSession, $objCustomer, $cartkey); GC_Utils_Ex::gfPrintLog('order complete. order_id=' . $order_id); }
function update(array $arrPlugin, SC_Plugin_Installer $installer) { $base_dir = dirname(__FILE__); GC_Utils_Ex::gfPrintLog("[" . $arrPlugin["plugin_code"] . "]更新処理を実行します。", PLUGIN_LOG_REALFILE, FALSE); $log = ""; $xdir = PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"]; if (!is_dir($xdir . "_" . date("Ymd") . "/")) { rename($xdir . "/", $xdir . "_" . date("Ymd") . "/"); } SC_Helper_FileManager_Ex::deleteFile($xdir . "/", false); $log .= SC_Utils_Ex::sfCopyDir("{$base_dir}/", PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"] . "/", '', true); // logo コピー $installer->copyDirectory("copy/plugin_dir/", ""); GC_Utils_Ex::gfPrintLog($log, PLUGIN_LOG_REALFILE, false); $core = new SupportDeviceCore($arrPlugin); $plugin_version = $arrPlugin["plugin_version"]; switch ($plugin_version) { case "0.0.0": case "0.0.1": // 再インストール $core->install($arrPlugin, $installer); $core->update($arrPlugin, $installer, "0.0.0"); break; default: $core->update($arrPlugin, $installer, $plugin_version); break; } $core->createCash(); $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); GC_Utils_Ex::gfPrintLog("[" . $arrPlugin["plugin_code"] . "]更新処理を実行完了しました。", PLUGIN_LOG_REALFILE, FALSE); }
/** * 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 (SC_Utils_Ex::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 { GC_Utils_Ex::gfPrintLog('error id=' . $_GET['id']); } // ページの表示 SC_Response_Ex::sendRedirect(ADMIN_SYSTEM_URLPATH); }
function LC_Page_Admin_System_Log_action_after(LC_Page_Admin_System_Log $objPage) { if (defined("UNSUPPORTED_DEVICE_LOG_REALFILE") && strlen(UNSUPPORTED_DEVICE_LOG_REALFILE) > 0) { $objPage->arrLogList["UNSUPPORTED_DEVICE"] = "非対応端末ログ"; } GC_Utils_Ex::gfPrintLog(print_r($objPage->arrLogList, true), DEBUG_LOG_REALFILE); }
function update(array $arrPlugin, SC_Plugin_Installer $installer) { $plugin_code = $arrPlugin["plugin_code"]; GC_Utils_Ex::gfPrintLog("[{$plugin_code}]更新処理を実行します。", PLUGIN_LOG_REALFILE, FALSE); SC_Utils_Ex::copyDirectory(dirname(__FILE__) . "/", PLUGIN_UPLOAD_REALDIR . $plugin_code . "/"); require_once dirname(__FILE__) . '/AutoDisplayCore.php'; $core = new AutoDisplayCore($arrPlugin); $core->install($arrPlugin, $installer); GC_Utils_Ex::gfPrintLog("[{$plugin_code}]更新処理を実行完了しました。", PLUGIN_LOG_REALFILE, FALSE); }
public function log($message, $type = Zeclib_MigrationLogger::TYPE_INFO) { switch ($type) { case Zeclib_MigrationLogger::TYPE_DEBUG: GC_Utils_Ex::gfPrintLog($message, DEBUG_LOG_REALFILE); break; case Zeclib_MigrationLogger::TYPE_WARNING: case Zeclib_MigrationLogger::TYPE_ERROR: GC_Utils_Ex::gfPrintLog($message, ERROR_LOG_REALFILE); break; default: GC_Utils_Ex::gfPrintLog($message, $this->defaultLogFile); break; } }
/** * Page のアクション. * * @return void */ function action() { $objFormParam = new SC_FormParam_Ex(); // パラメーターの初期化 $this->initParam($objFormParam, $_GET); // パラメーターの検証 if ($objFormParam->checkError() || !SC_Utils_ex::sfIsInt($id = $objFormParam->getValue('id'))) { GC_Utils_Ex::gfPrintLog("error id={$id}"); SC_Utils_Ex::sfDispError(INVALID_MOVE_ERRORR); } $id = $objFormParam->getValue('id'); // レコードの削除 $this->deleteMember($id); // リダイレクト $url = $this->getLocation(ADMIN_SYSTEM_URLPATH) . '?pageno=' . $objFormParam->getValue('pageno'); SC_Response_Ex::sendRedirect($url); }
/** * Page のアクション. * * @return void */ public function action() { $objFormParam = new SC_FormParam_Ex(); $this->initParam($objFormParam); $objFormParam->setParam($_POST); $this->arrForm = $objFormParam->getHashArray(); $this->arrHidden = $objFormParam->getSearchArray(); $objQuery = SC_Query_Ex::getSingletonInstance(); GC_Utils_Ex::gfPrintLog(print_r($objFormParam->getHashArray(), true), DEBUG_LOG_REALFILE); GC_Utils_Ex::gfPrintLog(print_r($_POST, true), DEBUG_LOG_REALFILE); switch ($this->getMode()) { case "csv": $this->doCheck($objQuery, $objFormParam); $this->doSearchCsv($objQuery, $objFormParam); break; case "return": case "search": case "change_status": case "initialize_device_product": case "delete": $this->doCheck($objQuery, $objFormParam); switch ($this->getMode()) { default: case "return": case "search": break; case "change_status": $this->doChangeStatus($objQuery, $objFormParam); break; case "initialize_device_product": $this->doProductSupportinitial($objQuery, $objFormParam); break; case "delete": $this->doDelete($objQuery, $objFormParam); break; } $this->doSearch($objQuery, $objFormParam); break; case 'csv_upload': case "add_csv": SC_Response_Ex::sendRedirect("device_android_csv.php", array(), false); break; default: break; } }
/** * Page のプロセス. * * @return void */ function process() { $objThumb = new gdthumb(); $objBlob = new SC_Helper_Blob_Ex(); $file = NO_IMAGE_REALDIR; // NO_IMAGE_REALDIR以外のファイル名が渡された場合、ファイル名のチェックを行う if (strlen($_GET['image']) >= 1 && $_GET['image'] !== NO_IMAGE_REALDIR) { // ファイル名が正しく、ファイルが存在する場合だけ、$fileを設定 if (!$this->lfCheckFileName()) { GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php $_GET[\'image\']=' . $_GET['image']); } else { $objBlob->getBlob("saveimage", $_GET['image'], IMAGE_TEMP_REALDIR . $_GET['image']); $file = IMAGE_TEMP_REALDIR . $_GET['image']; } } $ret = $objThumb->Main($file, $_GET['width'], $_GET['height'], "", true); }
/** * Page のプロセス. * * @return void */ function process() { $objThumb = new gdthumb(); $file = NO_IMAGE_DIR; // NO_IMAGE_DIR以外のファイル名が渡された場合、ファイル名のチェックを行う if (isset($_GET['image']) && $_GET['image'] !== NO_IMAGE_DIR) { // ファイル名が正しい場合だけ、$fileを設定 if ($this->lfCheckFileName() === true) { $file = IMAGE_SAVE_DIR . $_GET['image']; } else { GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php $_GET["image"]=' . $_GET['image']); } } if (file_exists($file)) { $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true); } else { $objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true); } }
/** * Page のAction. * * @return void */ function action() { $objFormParam = new SC_FormParam_Ex(); $this->lfInitParam($objFormParam); $objFormParam->setParam($_GET); $arrForm = $objFormParam->getHashArray(); $file = NO_IMAGE_REALFILE; // NO_IMAGE_REALFILE以外のファイル名が渡された場合、ファイル名のチェックを行う if (strlen($arrForm['image']) >= 1 && $arrForm['image'] !== NO_IMAGE_REALFILE) { // ファイル名が正しく、ファイルが存在する場合だけ、$fileを設定 if (!$this->lfCheckFileName()) { GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php image=' . $arrForm['image']); } elseif (file_exists(IMAGE_SAVE_REALDIR . $arrForm['image'])) { $file = IMAGE_SAVE_REALDIR . $arrForm['image']; } } // リサイズ画像の出力 $this->lfOutputImage($file, $arrForm['width'], $arrForm['height']); }
/** * ページのレイアウト情報を取得し, 設定する. * * 現在の URL に応じたページのレイアウト情報を取得し, LC_Page インスタンスに * 設定する. * * @access public * @param LC_Page $objPage LC_Page インスタンス * @param boolean $preview プレビュー表示の場合 true * @param string $url ページのURL($_SERVER['SCRIPT_NAME'] の情報) * @param integer $device_type_id 端末種別ID * @return void */ function sfGetPageLayout(&$objPage, $preview = false, $url = '', $device_type_id = DEVICE_TYPE_PC) { // URLを元にページ情報を取得 if ($preview === false) { $url = preg_replace('|^' . preg_quote(ROOT_URLPATH) . '|', '', $url); $arrPageData = $this->getPageProperties($device_type_id, null, 'url = ?', array($url)); } else { $arrPageData = $this->getPageProperties($device_type_id, 0); } $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) . $arrPageData[0]['filename'] . '.tpl'; $objPage->arrPageLayout =& $arrPageData[0]; // ページタイトルを設定 if (SC_Utils_Ex::isBlank($objPage->tpl_title)) { $objPage->tpl_title = $objPage->arrPageLayout['page_name']; } // 該当ページのブロックを取得し, 配置する $masterData = new SC_DB_MasterData_Ex(); $arrTarget = $masterData->getMasterData('mtb_target'); $arrBlocs = $this->getBlocPositions($device_type_id, $objPage->arrPageLayout['page_id']); var_dump($arrTarget); var_dump($arrBlocs); // 無効なプラグインのブロックを取り除く. $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance(); $arrBlocs = $objPlugin->getEnableBlocs($arrBlocs); // php_path, tpl_path が存在するものを, 各ターゲットに配置 foreach ($arrTarget as $target_id => $value) { foreach ($arrBlocs as $arrBloc) { if ($arrBloc['target_id'] != $target_id) { continue; } if (is_file($arrBloc['php_path']) || is_file($arrBloc['tpl_path'])) { $objPage->arrPageLayout[$arrTarget[$target_id]][] = $arrBloc; } else { $error = "ブロックが見つかりません\n" . 'tpl_path: ' . $arrBloc['tpl_path'] . "\n" . 'php_path: ' . $arrBloc['php_path']; GC_Utils_Ex::gfPrintLog($error); } } } // カラム数を取得する $objPage->tpl_column_num = $this->getColumnNum($objPage->arrPageLayout); }
function setReturnTo($key, $mode) { if (SC_Utils_Ex::isAppInnerUrl($_SERVER["HTTP_REFERER"])) { $netUrl = new Net_URL($_SERVER["HTTP_REFERER"]); $dir = basename(dirname($netUrl->path)); $file = basename($netUrl->path); if (preg_match("{.*(confirm|complete).php}", $file)) { GC_Utils_Ex::gfPrintLog($file); return; } switch ($dir) { case "au": case "docomo": case "softbank": break; default: $_SESSION[$key] = $netUrl->getURL(); break; } } }
/** * Page のプロセス. * * @return void */ function process() { // 認証可否の判定 $objSess = new SC_Session(); SC_Utils_Ex::sfIsSuccess($objSess); $this->initParam(); // パラメータの検証 if ($this->objForm->checkError() || !SC_Utils_ex::sfIsInt($id = $this->objForm->getValue('id'))) { GC_Utils_Ex::gfPrintLog("error id={$id}"); SC_Utils_Ex::sfDispError(INVALID_MOVE_ERRORR); } $id = $this->objForm->getValue('id'); // レコードの削除 $objQuery =& new SC_Query(); $objQuery->begin(); $this->renumberRank($objQuery, $id); $this->deleteRecode($objQuery, $id); $objQuery->commit(); // リダイレクト $url = $this->getLocation(URL_SYSTEM_TOP) . '?pageno=' . $this->objForm->getValue('pageno'); $this->sendRedirect($url); }
function update(array $arrPlugin, SC_Plugin_Installer $installer) { require_once DOWNLOADS_TEMP_PLUGIN_UPDATE_DIR . "KisekaeTouchCore.php"; $plugin_code = $arrPlugin["plugin_code"]; $date = date("Ymd"); define("KTC_PLG_ORG_DIR", PLUGIN_UPLOAD_REALDIR . "{$plugin_code}/"); define("KTC_PLG_UPD_DIR", DOWNLOADS_TEMP_PLUGIN_UPDATE_DIR); define("KTC_PLG_BKU_DIR", PLUGIN_UPLOAD_REALDIR . "{$plugin_code}_{$date}/"); if (file_exists(KTC_PLG_BKU_DIR)) { // nop } else { SC_Utils_Ex::recursiveMkdir(KTC_PLG_BKU_DIR); $log = SC_Utils_Ex::sfCopyDir(KTC_PLG_ORG_DIR, KTC_PLG_BKU_DIR, "", TRUE); GC_Utils_Ex::gfPrintLog($log, PLUGIN_LOG_REALFILE, FALSE); } SC_Helper_FileManager_Ex::deleteFile(KTC_PLG_ORG_DIR, FALSE); $log = SC_Utils_Ex::sfCopyDir(KTC_PLG_UPD_DIR, KTC_PLG_ORG_DIR, "", TRUE); GC_Utils_Ex::gfPrintLog($log, PLUGIN_LOG_REALFILE, FALSE); $installer->copyDirectory("copy/plugin_dir/", ""); $core = new KisekaeTouchCore($arrPlugin); $plugin_version = $arrPlugin["plugin_version"]; $core->update($arrPlugin, $installer, $plugin_version); $core->createCash(); }
/** * エラー捕捉時のエラーハンドラ関数 (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 = GC_Utils_Ex::getErrorTypeName($arrError['type']); $errstr = "Fatal error({$error_type_name}): {$arrError[message]} on [{$arrError[file]}({$arrError[line]})]"; GC_Utils_Ex::gfPrintLog($errstr, ERROR_LOG_REALFILE, true); // エラー画面を表示する SC_Helper_HandleError_Ex::displaySystemError($errstr); }
/** * 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"; GC_Utils_Ex::gfPrintLog($msg, DB_LOG_REALFILE); }
/** * Page のアクション. * * @return void */ public function action() { $objFormParam = new SC_FormParam_Ex(); $this->lfInitParam($objFormParam); $objFormParam->setParam($_REQUEST); $objFormParam->convParam(); $this->arrErr = $objFormParam->checkError(); $is_error = !SC_Utils_Ex::isBlank($this->arrErr); $this->bloc_id = $objFormParam->getValue('bloc_id'); $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC); $objBloc = new SC_Helper_Bloc_Ex($this->device_type_id); switch ($this->getMode()) { // 登録/更新 case 'confirm': if (!$is_error) { $this->arrErr = $this->lfCheckError($objFormParam, $this->arrErr, $objBloc); if (SC_Utils_Ex::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'); SC_Response_Ex::reload($arrPram, true); SC_Response_Ex::actionExit(); } } } break; // 削除 // 削除 case 'delete': if (!$is_error) { if ($this->doDelete($objFormParam, $objBloc)) { $arrPram = array('device_type_id' => $this->device_type_id, 'msg' => 'on'); SC_Response_Ex::reload($arrPram, true); SC_Response_Ex::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 (!SC_Utils_Ex::isBlank($this->bloc_id)) { $arrBloc = $this->getBlocTemplate($this->bloc_id, $objBloc); $objFormParam->setParam($arrBloc); } } else { // 画面にエラー表示しないため, ログ出力 GC_Utils_Ex::gfPrintLog('Error: ' . print_r($this->arrErr, true)); } $this->tpl_subtitle = $this->arrDeviceType[$this->device_type_id] . '>' . $this->tpl_subtitle; $this->arrForm = $objFormParam->getFormParamList(); }
static function lfTriggerError($errMsg) { GC_Utils_Ex::gfPrintLog($errMsg, ERROR_LOG_REALFILE, true); // エラー発生時に、プラグイン一覧画面がシステムエラーになり表示できなくなるため、エラーは発生させない // trigger_error($errMsg, E_USER_ERROR); }
/** * 前方互換用 * * @deprecated 2.12.0 GC_Utils_Ex::gfPrintLog を使用すること */ function gfFrontLog($mess, $log_level = 'Info') { trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); // ログレベル=Debugの場合は、DEBUG_MODEがtrueの場合のみログ出力する if ($log_level === 'Debug' && DEBUG_MODE === false) { return; } // ログ出力 GC_Utils_Ex::gfPrintLog($mess, '', true); }
/** * CSVファイルからインサート実行. * * @param object $objQuery * @param string $dir * @param string $mode * @return void */ 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); } GC_Utils_Ex::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); SC_Utils_Ex::extendTimeOut(); } fclose($fp); } return $ret; }
/** * Page のアクション. * * @return void */ public function action() { $objLayout = new SC_Helper_PageLayout_Ex(); $objFormParam = new SC_FormParam_Ex(); $this->lfInitParam($objFormParam); $objFormParam->setParam($_REQUEST); $objFormParam->convParam(); $this->arrErr = $objFormParam->checkError(); $is_error = !SC_Utils_Ex::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 (SC_Utils_Ex::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'); SC_Response_Ex::reload($arrPram, true); } } break; default: if (isset($_GET['msg']) && $_GET['msg'] == 'on') { // 完了メッセージ $this->tpl_onload = "alert('登録が完了しました。');"; } break; } if (SC_Utils_Ex::isBlank($this->arrErr) && $this->checkPath($this->css_name)) { // CSSファイルの読み込み if (!SC_Utils_Ex::isBlank($this->css_name)) { $objFormParam->setValue('css_data', file_get_contents($css_path)); } } else { // 画面にエラー表示しないため, ログ出力 GC_Utils_Ex::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(); }
public function checkSessionPendingOrder() { if (!SC_Utils_Ex::isBlank($_SESSION['order_id'])) { $order_id = $_SESSION['order_id']; unset($_SESSION['order_id']); $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); $arrOrder = SC_Helper_Purchase_Ex::getOrder($order_id); if ($arrOrder['status'] == ORDER_PENDING) { $objCartSess = new SC_CartSession_Ex(); $cartKeys = $objCartSess->getKeys(); if (SC_Utils_Ex::isBlank($cartKeys)) { SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true); GC_Utils_Ex::gfPrintLog('order rollback.(session pending) order_id=' . $order_id); } else { SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true); GC_Utils_Ex::gfPrintLog('order rollback.(session pending and set card) order_id=' . $order_id); } } $objQuery->commit(); } }
function makeTempDownFile($keyname = 'down_file') { $objErr = new SC_CheckError_Ex(); $cnt = 0; $arrKeyname = array_flip($this->keyname); if (!($_FILES[$keyname]['size'] > 0)) { $objErr->arrErr[$keyname] = '※ ' . $this->disp_name[$arrKeyname[$keyname]] . 'がアップロードされていません。(ファイルがアップロードできない場合は、.htaccessファイルのphp_value upload_max_filesizeを調整してください)<br />'; } else { 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]); GC_Utils_Ex::gfPrintLog($result . ' -> ' . $this->temp_dir . $this->temp_file[$cnt]); SC_Utils_Ex::extendTimeOut(); } } $cnt++; } } return $objErr->arrErr[$keyname]; }
function lfRealTimeDailyTotal($sdate, $edate) { $pass = strtotime($edate) - strtotime($sdate); $loop = intval($pass / 86400); for ($i = 0; $i <= $loop; $i++) { $tmp_time = strtotime($sdate) + $i * 86400; $batch_date = date("Y/m/d H:i:s", $tmp_time); $objQuery = new SC_Query(); $arrRet = $objQuery->select("order_date, create_date", "dtb_bat_order_daily", "order_date = ?", array($batch_date)); // すでにバッチ処理が終了しているかチェックする。 $count = count($arrRet); if ($count > 0) { list($create_date) = split("\\.", $arrRet[0]['create_date']); list($order_date) = split("\\.", $arrRet[0]['order_date']); $create_time = strtotime($create_date); $order_time = strtotime($order_date); // オーダー開始日より一日以上後に集計されている場合は集計しなおさない if ($order_time + 86400 < $create_time || $tmp_time > time()) { GC_Utils_Ex::gfPrintLog("EXIT BATCH {$batch_date} {$tmp_time}" . " " . time()); continue; } } GC_Utils_Ex::gfPrintLog("LOADING BATCH {$batch_date}"); $this->lfBatOrderDaily($tmp_time); $this->lfBatOrderDailyHour($tmp_time); $this->lfBatOrderAge($tmp_time); } }
/** * 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() */ function jsonDecode($json) { if (function_exists('json_decode')) { return json_decode($json); } else { GC_Utils_Ex::gfPrintLog(' *use Services_JSON::decode(). faster than using the json_decode!'); $objJson = new Services_JSON(); return $objJson->decode($json); } }
function EndSession() { // セッション情報破棄の前にcustomer_idを保存 $customer_id = $_SESSION['customer']['customer_id']; // $_SESSION['customer']の解放 unset($_SESSION['customer']); // セッションの配送情報を全て破棄する SC_Helper_Purchase_Ex::unsetAllShippingTemp(true); // トランザクショントークンの破棄 SC_Helper_Session_Ex::destroyToken(); $objSiteSess = new SC_SiteSession_Ex(); $objSiteSess->unsetUniqId(); // ログに記録する $log = sprintf("logout : user=%d\tip=%s", $customer_id, $this->getRemoteHost()); GC_Utils_Ex::gfPrintLog($log, CUSTOMER_LOG_REALFILE, false); }
function printLog($msg) { GC_Utils_Ex::gfPrintLog($msg, DATA_REALDIR . 'logs/ownersstore_batch_update.log'); }
/** * ログを出力. * * @param string $msg * @param mixed $data Dumpしたいデータ.デバッグ用. * @param string $suffix */ function log($msg, $data = null, $suffix = '') { $path = DATA_REALDIR . 'logs/' . $this->getCode() . "{$suffix}.log"; GC_Utils_Ex::gfPrintLog($msg, $path); if (!is_null($data)) { GC_Utils_Ex::gfPrintLog(print_r($data, true), $path); } }
/** * 指定されたパスの配下を再帰的に削除. * * @param string $path 削除対象のディレクトリまたはファイルのパス * @param boolean $del_myself $pathそのものを削除するか. true なら削除する. * @return void */ function deleteFile($path, $del_myself = true) { $flg = false; // 対象が存在するかを検証. if (file_exists($path) === false) { GC_Utils_Ex::gfPrintLog($path . ' が存在しません.'); } elseif (is_dir($path)) { // ディレクトリが指定された場合 $handle = opendir($path); if (!$handle) { GC_Utils_Ex::gfPrintLog($path . ' が開けませんでした.'); } while (($item = readdir($handle)) !== false) { if ($item === '.' || $item === '..') { continue; } $cur_path = $path . '/' . $item; if (is_dir($cur_path)) { // ディレクトリの場合、再帰処理 $flg = SC_Helper_FileManager_Ex::deleteFile($cur_path); } else { // ファイルの場合、unlink $flg = @unlink($cur_path); } } closedir($handle); // ディレクトリを削除 GC_Utils_Ex::gfPrintLog($path . ' を削除します.'); if ($del_myself) { $flg = @rmdir($path); } } else { // ファイルが指定された場合. GC_Utils_Ex::gfPrintLog($path . ' を削除します.'); $flg = @unlink($path); } return $flg; }