diff --git a/data/class/SC_Batch.php b/data/class/SC_Batch.php index 0209374ef8..cae7efb8c8 100644 --- a/data/class/SC_Batch.php +++ b/data/class/SC_Batch.php @@ -24,8 +24,8 @@ /** * バッチ処理用 の基底クラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Batch @@ -34,6 +34,7 @@ class SC_Batch * バッチ処理を実行する * * @param mixed $argv コマンドライン引数 + * * @return mixed バッチの実行結果 */ public function execute($argv = '') diff --git a/data/class/SC_CartSession.php b/data/class/SC_CartSession.php index a59ad9b656..d9316cdbc2 100644 --- a/data/class/SC_CartSession.php +++ b/data/class/SC_CartSession.php @@ -25,6 +25,7 @@ * カートセッション管理クラス * * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_CartSession @@ -167,7 +168,7 @@ public function getTotalQuantity($product_type_id) $total = 0; $max = $this->getMax($product_type_id); for ($i = 0; $i <= $max; $i++) { - $total += (int)$this->cartSession[$product_type_id][$i]['quantity']; + $total += (int) $this->cartSession[$product_type_id][$i]['quantity']; } return $total; @@ -288,7 +289,7 @@ public function setPrevURL($url, $excludePaths = array()) { // 前頁として記録しないページを指定する。 $arrExclude = array( - '/shopping/' + '/shopping/', ); $arrExclude = array_merge($arrExclude, $excludePaths); $exclude = false; @@ -346,20 +347,20 @@ public function getValue($key, $product_type_id) public function adjustSessionProductsClass(&$arrProductsClass) { $arrNecessaryItems = array( - 'product_id' => true, - 'product_class_id' => true, - 'name' => true, - 'price02' => true, - 'point_rate' => true, - 'main_list_image' => true, - 'main_image' => true, - 'product_code' => true, - 'stock' => true, - 'stock_unlimited' => true, - 'sale_limit' => true, - 'class_name1' => true, + 'product_id' => true, + 'product_class_id' => true, + 'name' => true, + 'price02' => true, + 'point_rate' => true, + 'main_list_image' => true, + 'main_image' => true, + 'product_code' => true, + 'stock' => true, + 'stock_unlimited' => true, + 'sale_limit' => true, + 'class_name1' => true, 'classcategory_name1' => true, - 'class_name2' => true, + 'class_name2' => true, 'classcategory_name2' => true, ); @@ -376,7 +377,9 @@ public function adjustSessionProductsClass(&$arrProductsClass) * * @param integer $product_type_id 商品種別ID * @param integer $key + * * @return void + * * @deprecated 本体では使用していないメソッドです * MEMO: せっかく一回だけ読み込みにされてますが、税率対応の関係でちょっと保留 */ @@ -412,6 +415,7 @@ public function setCartSession4getCartList($product_type_id, $key) * @param integer $product_type_id 商品種別ID * @param integer $pref_id 税金計算用注文者都道府県ID * @param integer $country_id 税金計算用注文者国ID + * * @return array カート内商品一覧の配列 */ public function getCartList($product_type_id, $pref_id = 0, $country_id = 0) @@ -435,7 +439,6 @@ public function getCartList($product_type_id, $pref_id = 0, $country_id = 0) isset($this->cartSession[$product_type_id][$i]['cart_no']) && $this->cartSession[$product_type_id][$i]['cart_no'] != '' ) { - // 商品情報は常に取得 // TODO: 同一インスタンス内では1回のみ呼ぶようにしたい // TODO: ここの商品の合計処理は getAllProductsTotalや getAllProductsTaxとで類似重複なので統一出来そう @@ -509,6 +512,7 @@ public function getAllCartList() * カート内にある商品規格IDを全て取得する. * * @param integer $product_type_id 商品種別ID + * * @return array 商品規格ID の配列 */ public function getAllProductClassID($product_type_id) @@ -528,6 +532,7 @@ public function getAllProductClassID($product_type_id) * 商品種別ID を指定して, カート内の商品を全て削除する. * * @param integer $product_type_id 商品種別ID + * * @return void */ public function delAllProducts($product_type_id) @@ -572,6 +577,7 @@ public function downQuantity($cart_no, $product_type_id) * * @param integer $cart_no カート番号 * @param integer $product_type_id 商品種別ID + * * @return integer 該当商品規格の数量 */ public function getQuantity($cart_no, $product_type_id) @@ -609,7 +615,9 @@ public function setQuantity($quantity, $cart_no, $product_type_id) * * @param integer $cart_no カート番号 * @param integer $product_type_id 商品種別ID + * * @return integer 商品規格ID + * * @deprecated 本体では使用していないメソッドです */ public function getProductClassId($cart_no, $product_type_id) @@ -635,6 +643,7 @@ public function getProductClassId($cart_no, $product_type_id) * 4. 在庫数チェック * * @param string $product_type_id 商品種別ID + * * @return string エラーが発生した場合はエラーメッセージ */ public function checkProducts($product_type_id) @@ -695,6 +704,7 @@ public function checkProducts($product_type_id) * 送料無料条件を満たすかどうかチェックする * * @param integer $product_type_id 商品種別ID + * * @return boolean 送料無料の場合 true */ public function isDelivFree($product_type_id) @@ -741,12 +751,12 @@ public function isDelivFree($product_type_id) * @param SC_Customer $objCustomer ログイン中の SC_Customer インスタンス * @param integer $use_point 今回使用ポイント * @param integer|array $deliv_pref 配送先都道府県ID. - 複数に配送する場合は都道府県IDの配列 * @param integer $charge 手数料 * @param integer $discount 値引き * @param integer $deliv_id 配送業者ID * @param integer $order_pref 注文者の都道府県ID * @param integer $order_country_id 注文者の国 + * * @return array カートの計算結果の配列 */ public function calculate( @@ -760,7 +770,6 @@ public function calculate( $order_pref = 0, $order_country_id = 0 ) { - $results = array(); $total_point = $this->getAllProductsPoint($product_type_id); // MEMO: 税金計算は注文者の住所基準 @@ -840,6 +849,7 @@ public function getKeys() * カートに設定された現在のキー(商品種別ID)を登録する. * * @param integer $key 商品種別ID + * * @return void */ public function registerKey($key) @@ -881,6 +891,7 @@ public function isMultiple() * 引数の商品種別の商品がカートに含まれるかどうか. * * @param integer $product_type_id 商品種別ID + * * @return boolean 指定の商品種別がカートに含まれる場合 true */ public function hasProductType($product_type_id) diff --git a/data/class/SC_CheckError.php b/data/class/SC_CheckError.php index a660ccd209..3c402fb215 100644 --- a/data/class/SC_CheckError.php +++ b/data/class/SC_CheckError.php @@ -39,7 +39,6 @@ public function __construct($array = '') } else { $this->arrParam = $_POST; } - } /** @@ -58,6 +57,7 @@ public function doFunc($value, $arrFunc) * @param array $value value[0] = 項目名 * value[1] = 判定対象 * value[2] = 許可するタグが格納された配列 + * * @return void */ public function HTML_TAG_CHECK($value) @@ -82,7 +82,9 @@ public function HTML_TAG_CHECK($value) } $arrDiffTag = array_diff($arrTagIncludedHtml, $arrAllowedTag); - if (empty($arrDiffTag)) return; + if (empty($arrDiffTag)) { + return; + } // 少々荒っぽいが、表示用 HTML に変換する foreach ($arrDiffTag as &$tag) { @@ -101,7 +103,9 @@ public function HTML_TAG_CHECK($value) * 必須入力の判定 * * 受け取りがない場合エラーを返す + * * @param array $value value[0] = 項目名 value[1] = 判定対象 + * * @return void */ public function EXIST_CHECK($value) @@ -133,7 +137,9 @@ public function EXIST_CHECK($value) * 必須入力の判定(逆順) * * 受け取りがない場合エラーを返す + * * @param array $value value[0] = 判定対象 value[1] = 項目名 + * * @return void */ public function EXIST_CHECK_REVERSE($value) @@ -157,7 +163,9 @@ public function EXIST_CHECK_REVERSE($value) * スペース、タブの判定 * * 受け取りがない場合エラーを返す + * * @param array $value value[0] = 項目名 value[1] = 判定対象 + * * @return void */ public function SPTAB_CHECK($value) @@ -186,7 +194,9 @@ public function SPTAB_CHECK($value) * スペース、タブの判定 * * 受け取りがない場合エラーを返す + * * @param array $value value[0] = 項目名 value[1] = 判定対象 + * * @return void */ public function NO_SPTAB($value) @@ -215,7 +225,9 @@ public function NO_SPTAB($value) * ゼロで開始されている数値の判定 * * ゼロで始まる数値の場合エラーを返す + * * @param array $value value[0] = 項目名 value[1] = 判定対象 + * * @return void */ public function ZERO_START($value) @@ -242,7 +254,9 @@ public function ZERO_START($value) * 必須選択の判定 * * プルダウンなどで選択されていない場合エラーを返す + * * @param array $value value[0] = 項目名 value[1] = 判定対象 + * * @return void */ public function SELECT_CHECK($value) @@ -266,10 +280,12 @@ public function SELECT_CHECK($value) * 同一性の判定 * * 入力が指定文字数以上ならエラーを返す + * * @param array $value value[0] = 項目名1 * value[1] = 項目名2 * value[2] = 判定対象文字列1 * value[3] = 判定対象文字列2 + * * @return void */ public function EQUAL_CHECK($value) @@ -298,10 +314,12 @@ public function EQUAL_CHECK($value) * 値が異なることの判定 * * 入力が指定文字数以上ならエラーを返す + * * @param array $value value[0] = 項目名1 * value[1] = 項目名2 * value[2] = 判定対象文字列1 * value[3] = 判定対象文字列2 + * * @return void */ public function DIFFERENT_CHECK($value) @@ -333,10 +351,12 @@ public function DIFFERENT_CHECK($value) * 値の大きさを比較する value[2] < value[3]でなければエラー * * 入力が指定文字数以上ならエラーを返す + * * @param array $value value[0] = 項目名1 * value[1] = 項目名2 * value[2] = 判定対象文字列1 * value[3] = 判定対象文字列2 + * * @return void */ public function GREATER_CHECK($value) @@ -373,9 +393,11 @@ public function GREATER_CHECK($value) * 最大文字数制限の判定 * * 入力が指定文字数以上ならエラーを返す + * * @param integer[] $value value[0] = 項目名 * value[1] = 判定対象文字列 * value[2] = 最大文字数(半角も全角も1文字として数える) + * * @return void */ public function MAX_LENGTH_CHECK($value) @@ -404,9 +426,11 @@ public function MAX_LENGTH_CHECK($value) * 最小文字数制限の判定 * * 入力が指定文字数未満ならエラーを返す + * * @param array $value value[0] = 項目名 * value[1] = 判定対象文字列 * value[2] = 最小文字数(半角も全角も1文字として数える) + * * @return void */ public function MIN_LENGTH_CHECK($value) @@ -435,9 +459,11 @@ public function MIN_LENGTH_CHECK($value) * 最大数制限の判定 * * 入力が最大数より大きければエラーを返す + * * @param array $value value[0] = 項目名 * value[1] = 判定対象文字列 * value[2] = 最大数 + * * @return void */ public function MAX_CHECK($value) @@ -466,9 +492,11 @@ public function MAX_CHECK($value) * 最小数値制限の判定 * * 入力が最小数未満ならエラーを返す + * * @param array $value value[0] = 項目名 * value[1] = 判定対象文字列 * value[2] = 最小数 + * * @return void */ public function MIN_CHECK($value) @@ -496,7 +524,9 @@ public function MIN_CHECK($value) * 数字の判定 * * 入力文字が数字以外ならエラーを返す + * * @param array $value value[0] = 項目名 value[1] = 判定対象文字列 + * * @return void */ public function NUM_CHECK($value) @@ -520,7 +550,9 @@ public function NUM_CHECK($value) * 小数点を含む数字の判定 * * 入力文字が数字以外ならエラーを返す + * * @param array $value value[0] = 項目名 value[1] = 判定対象文字列 + * * @return void */ public function NUM_POINT_CHECK($value) @@ -565,6 +597,7 @@ public function ALPHA_CHECK($value) * 電話番号の判定 * * 数字チェックと文字数チェックを実施する。 + * * @param array $value 各要素は以下の通り。
* [0]: 項目名
* [1]: 電番1項目目
@@ -572,6 +605,7 @@ public function ALPHA_CHECK($value) * [3]: 電番3項目目
* [4]: 電話番号各項目制限 (指定なしの場合、TEL_ITEM_LEN)
* [5]: 電話番号総数 (指定なしの場合、TEL_LEN) + * * @return void */ public function TEL_CHECK($value) @@ -775,7 +809,7 @@ public function TOP_EXIST_CHECK($value) } } - /* カタカナの判定 */ + /* カタカナの判定  */ // 入力文字がカナ以外ならエラーを返す // value[0] = 項目名 value[1] = 判定対象文字列 public function KANA_CHECK($value) @@ -819,7 +853,7 @@ public function KANABLANK_CHECK($value) } } - /* 英数字の判定 */ + /* 英数字の判定  */ // 入力文字が英数字以外ならエラーを返す // value[0] = 項目名 value[1] = 判定対象文字列 public function ALNUM_CHECK($value) @@ -840,7 +874,7 @@ public function ALNUM_CHECK($value) } } - /* 英数記号の判定 */ + /* 英数記号の判定  */ // 入力文字が英数記号以外ならエラーを返す // value[0] = 項目名 value[1] = 判定対象文字列 public function GRAPH_CHECK($value) @@ -873,7 +907,7 @@ public function GRAPH_CHECK($value) public function PASSWORD_CHAR_CHECK($value) { if (PASSWORD_MIN_LEN < 8) { - trigger_error('PASSWORD_MIN_LEN が8未満に設定されています。', E_USER_WARNING); + trigger_error('PASSWORD_MIN_LEN が8未満に設定されています。', \E_USER_WARNING); } $disp_name = $value[0]; $keyname = $value[1]; @@ -886,14 +920,14 @@ public function PASSWORD_CHAR_CHECK($value) $input_var = $this->arrParam[$keyname]; // see https://qiita.com/mpyw/items/886218e7b418dfed254b - $pattern = '/\A(?=.*?[a-z])(?=.*?\d)[!-~]{'.PASSWORD_MIN_LEN.','.PASSWORD_MAX_LEN.'}+\z/i'; + $pattern = '/\A(?=.*?[a-z])(?=.*?\d)[!-~]{' . PASSWORD_MIN_LEN . ',' . PASSWORD_MAX_LEN . '}+\z/i'; if (strlen($input_var) > 0 && !preg_match($pattern, $input_var)) { $this->arrErr[$keyname] = - "※ {$disp_name}は英数字をそれぞれ1種類使用し、".PASSWORD_MIN_LEN."文字以上で入力してください。
"; + "※ {$disp_name}は英数字をそれぞれ1種類使用し、" . PASSWORD_MIN_LEN . "文字以上で入力してください。
"; } } - /* 必須選択の判定 */ + /* 必須選択の判定  */ // 入力値で0が許されない場合エラーを返す // value[0] = 項目名 value[1] = 判定対象 public function ZERO_CHECK($value) @@ -909,7 +943,7 @@ public function ZERO_CHECK($value) } } - /* 桁数の判定 (最小最大)*/ + /* 桁数の判定 (最小最大) */ // 入力文字の桁数判定 → 最小桁数<入力文字列<最大桁数 // value[0] = 項目名 value[1] = 判定対象文字列 value[2] = 最小桁数 value[3] = 最大桁数 public function NUM_RANGE_CHECK($value) @@ -937,7 +971,7 @@ public function NUM_RANGE_CHECK($value) } } - /* 桁数の判定 */ + /* 桁数の判定  */ // 入力文字の桁数判定 → 入力文字列 = 桁数 以外はNGの場合 // value[0] = 項目名 value[1] = 判定対象文字列 value[2] = 桁数 public function NUM_COUNT_CHECK($value) @@ -965,6 +999,7 @@ public function NUM_COUNT_CHECK($value) * @param array $value 各要素は以下の通り。
* [0]: 項目名
* [1]: 判定対象を格納している配列キー + * * @return void */ public function EMAIL_CHECK($value) @@ -983,21 +1018,21 @@ public function EMAIL_CHECK($value) return; } - $wsp = '[\x20\x09]'; - $vchar = '[\x21-\x7e]'; - $quoted_pair = "\\\\(?:$vchar|$wsp)"; - $qtext = '[\x21\x23-\x5b\x5d-\x7e]'; - $qcontent = "(?:$qtext|$quoted_pair)"; + $wsp = '[\x20\x09]'; + $vchar = '[\x21-\x7e]'; + $quoted_pair = "\\\\(?:$vchar|$wsp)"; + $qtext = '[\x21\x23-\x5b\x5d-\x7e]'; + $qcontent = "(?:$qtext|$quoted_pair)"; $quoted_string = "\"$qcontent*\""; - $atext = '[a-zA-Z0-9!#$%&\'*+\-\/\=?^_`{|}~]'; - $dot_atom = "$atext+(?:[.]$atext+)*"; - $local_part = "(?:$dot_atom|$quoted_string)"; - $domain = $dot_atom; - $addr_spec = "{$local_part}[@]$domain"; + $atext = '[a-zA-Z0-9!#$%&\'*+\-\/\=?^_`{|}~]'; + $dot_atom = "$atext+(?:[.]$atext+)*"; + $local_part = "(?:$dot_atom|$quoted_string)"; + $domain = $dot_atom; + $addr_spec = "{$local_part}[@]$domain"; - $dot_atom_loose = "$atext+(?:[.]|$atext)*"; + $dot_atom_loose = "$atext+(?:[.]|$atext)*"; $local_part_loose = "(?:$dot_atom_loose|$quoted_string)"; - $addr_spec_loose = "{$local_part_loose}[@]$domain"; + $addr_spec_loose = "{$local_part_loose}[@]$domain"; if (RFC_COMPLIANT_EMAIL_CHECK) { $regexp = "/\A{$addr_spec}\z/"; @@ -1018,7 +1053,7 @@ public function EMAIL_CHECK($value) $this->MAX_LENGTH_CHECK($arrValueTemp); } - /* メールアドレスに使用できる文字の判定 */ + /* メールアドレスに使用できる文字の判定  */ // メールアドレスに使用する文字を正規表現で判定する // value[0] = 項目名 value[1] = 判定対象メールアドレス public function EMAIL_CHAR_CHECK($value) @@ -1040,7 +1075,7 @@ public function EMAIL_CHAR_CHECK($value) } } - /* URL形式の判定 */ + /* URL形式の判定  */ // URLを正規表現で判定する。デフォルトでhttp://があってもOK // value[0] = 項目名 value[1] = 判定対象URL public function URL_CHECK($value) @@ -1060,7 +1095,7 @@ public function URL_CHECK($value) } } - /* IPアドレスの判定 */ + /* IPアドレスの判定  */ // value[0] = 項目名 value[1] = 判定対象IPアドレス文字列 public function IP_CHECK($value) { @@ -1071,7 +1106,7 @@ public function IP_CHECK($value) return; } - //改行コードが含まれている場合には配列に変換 + // 改行コードが含まれている場合には配列に変換 $params = str_replace("\r", '', $this->arrParam[$keyname]); if (!empty($params)) { if (strpos($params, "\n") === false) { @@ -1088,7 +1123,7 @@ public function IP_CHECK($value) } } - /* 拡張子の判定 */ + /* 拡張子の判定  */ // 受け取りがない場合エラーを返す // value[0] = 項目名 value[1] = 判定対象 value[2]=array(拡張子) public function FILE_EXT_CHECK($value) @@ -1110,7 +1145,7 @@ public function FILE_EXT_CHECK($value) $pattern = '/' . preg_quote('.' . $check_ext) . '$/i'; $match = preg_match($pattern, $filename) >= 1; if ($match === true) { - break 1; + break; } } } @@ -1150,7 +1185,7 @@ public function FIND_FILE($value) } } - /* ファイルが上げられたか確認 */ + /* ファイルが上げられたか確認  */ // 受け取りがない場合エラーを返す // value[0] = 項目名 value[1] = 判定対象 value[2] = 指定サイズ(KB) public function FILE_EXIST_CHECK($value) @@ -1171,7 +1206,7 @@ public function FILE_EXIST_CHECK($value) } } - /* ファイルサイズの判定 */ + /* ファイルサイズの判定  */ // 受け取りがない場合エラーを返す // value[0] = 項目名 value[1] = 判定対象 value[2] = 指定サイズ(KB) public function FILE_SIZE_CHECK($value) @@ -1186,7 +1221,7 @@ public function FILE_SIZE_CHECK($value) $this->createParam($value); - if ($_FILES[$keyname]['size'] > $max_file_size * 1024) { + if ($_FILES[$keyname]['size'] > $max_file_size * 1024) { $byte = 'KB'; if ($max_file_size >= 1000) { $max_file_size = $max_file_size / 1000; @@ -1201,7 +1236,7 @@ public function FILE_SIZE_CHECK($value) } } - /* ファイル名の判定 */ + /* ファイル名の判定  */ // 入力文字が英数字,'_','-','.'以外ならエラーを返す // value[0] = 項目名 value[1] = 判定対象文字列 public function FILE_NAME_CHECK($value) @@ -1223,7 +1258,7 @@ public function FILE_NAME_CHECK($value) } } - /* ファイル名の判定(アップロード以外の時) */ + /* ファイル名の判定(アップロード以外の時)  */ // 入力文字が英数字,'_','-','.'以外ならエラーを返す // value[0] = 項目名 value[1] = 判定対象文字列 public function FILE_NAME_CHECK_BY_NOUPLOAD($value) @@ -1245,7 +1280,7 @@ public function FILE_NAME_CHECK_BY_NOUPLOAD($value) } } - //日付チェック + // 日付チェック // value[0] = 項目名 // value[1] = YYYY // value[2] = MM @@ -1277,7 +1312,7 @@ public function CHECK_DATE($value) } } - //日付チェック + // 日付チェック // value[0] = 項目名 // value[1] = YYYY // value[2] = MM @@ -1308,14 +1343,14 @@ public function CHECK_DATE2($value) if (!(strlen($input_year) > 0 && strlen($input_month) > 0 && strlen($input_day) > 0 && strlen($input_hour) > 0 && strlen($input_minute) > 0)) { $this->arrErr[$keyname] = "※ {$disp_name}は全ての項目を入力して下さい。
"; - } elseif (! checkdate((int) $input_month, (int) $input_day, (int) $input_year)) { + } elseif (!checkdate((int) $input_month, (int) $input_day, (int) $input_year)) { $this->arrErr[$keyname] = "※ {$disp_name}が正しくありません。
"; } } } - //日付チェック + // 日付チェック // value[0] = 項目名 // value[1] = YYYY // value[2] = MM @@ -1338,14 +1373,14 @@ public function CHECK_DATE3($value) if (!(strlen($input_year) > 0 && strlen($input_month) > 0)) { $this->arrErr[$keyname] = "※ {$disp_name}は全ての項目を入力して下さい。
"; - } elseif (! checkdate((int) $input_month, 1, (int) $input_year)) { + } elseif (!checkdate((int) $input_month, 1, (int) $input_year)) { $this->arrErr[$keyname] = "※ {$disp_name}が正しくありません。
"; } } } - //誕生日チェック + // 誕生日チェック // value[0] = 項目名 // value[1] = YYYY // value[2] = MM @@ -1385,7 +1420,7 @@ public function CHECK_BIRTHDAY($value) $this->CHECK_DATE($value); } - /*-----------------------------------------------------------------*/ + /* ----------------------------------------------------------------- */ /* CHECK_SET_TERM /* 年月日に別れた2つの期間の妥当性をチェックし、整合性と期間を返す /* 引数 (開始年,開始月,開始日,終了年,終了月,終了日) @@ -1423,13 +1458,13 @@ public function CHECK_SET_TERM($value) $end_month = $this->arrParam[$value[6]]; $end_day = $this->arrParam[$value[7]]; if ((strlen($start_year) > 0 || strlen($start_month) > 0 || strlen($start_day) > 0) - && ! checkdate((int) $start_month, (int) $start_day, (int) $start_year) + && !checkdate((int) $start_month, (int) $start_day, (int) $start_year) ) { $this->arrErr[$keyname1] = "※ {$disp_name1}を正しく指定してください。
"; } if ((strlen($end_year) > 0 || strlen($end_month) > 0 || strlen($end_day) > 0) - && ! checkdate((int) $end_month, (int) $end_day, (int) $end_year) + && !checkdate((int) $end_month, (int) $end_day, (int) $end_year) ) { $this->arrErr[$keyname2] = "※ {$disp_name2}を正しく指定してください。
"; @@ -1447,7 +1482,7 @@ public function CHECK_SET_TERM($value) } } - /*-----------------------------------------------------------------*/ + /* ----------------------------------------------------------------- */ /* CHECK_SET_TERM2 /* 年月日時に別れた2つの期間の妥当性をチェックし、整合性と期間を返す /* 引数 (開始年,開始月,開始日,開始時間,開始分,開始秒, @@ -1472,7 +1507,7 @@ public function CHECK_SET_TERM($value) // value[12] = end_minute // value[13] = end_second - /*-----------------------------------------------------------------*/ + /* ----------------------------------------------------------------- */ public function CHECK_SET_TERM2($value) { $disp_name1 = $value[0]; @@ -1500,13 +1535,13 @@ public function CHECK_SET_TERM2($value) $end_minute = $this->arrParam[$value[12]]; $end_second = $this->arrParam[$value[13]]; if ((strlen($start_year) > 0 || strlen($start_month) > 0 || strlen($start_day) > 0 || strlen($start_hour) > 0) - && ! checkdate((int) $start_month, (int) $start_day, (int) $start_year) + && !checkdate((int) $start_month, (int) $start_day, (int) $start_year) ) { $this->arrErr[$keyname1] = "※ {$disp_name1}を正しく指定してください。
"; } if ((strlen($end_year) > 0 || strlen($end_month) > 0 || strlen($end_day) > 0 || strlen($end_hour) > 0) - && ! checkdate((int) $end_month, (int) $end_day, (int) $end_year) + && !checkdate((int) $end_month, (int) $end_day, (int) $end_year) ) { $this->arrErr[$keyname2] = "※ {$disp_name2}を正しく指定してください。
"; @@ -1529,11 +1564,10 @@ public function CHECK_SET_TERM2($value) $this->arrErr[$keyname1] = "※ {$disp_name1}と{$disp_name2}の期間指定が不正です。
"; } - } } - /*-----------------------------------------------------------------*/ + /* ----------------------------------------------------------------- */ /* CHECK_SET_TERM3 /* 年月に別れた2つの期間の妥当性をチェックし、整合性と期間を返す /* 引数 (開始年,開始月,終了年,終了月) @@ -1567,18 +1601,18 @@ public function CHECK_SET_TERM3($value) $end_year = $this->arrParam[$value[4]]; $end_month = $this->arrParam[$value[5]]; if ((strlen($start_year) > 0 || strlen($start_month) > 0) - && ! checkdate((int) $start_month, 1, (int) $start_year) + && !checkdate((int) $start_month, 1, (int) $start_year) ) { $this->arrErr[$keyname1] = "※ {$disp_name1}を正しく指定してください。
"; } if ((strlen($end_year) > 0 || strlen($end_month) > 0) - && ! checkdate((int) $end_month, 1, (int) $end_year) + && !checkdate((int) $end_month, 1, (int) $end_year) ) { $this->arrErr[$keyname2] = "※ {$disp_name2}を正しく指定してください。
"; } - if ((strlen($start_year) > 0 && strlen($start_month) > 0 && (strlen($end_year) > 0 || strlen($end_month) > 0))) { + if (strlen($start_year) > 0 && strlen($start_month) > 0 && (strlen($end_year) > 0 || strlen($end_month) > 0)) { $date1 = sprintf('%d%02d', $start_year, $start_month); $date2 = sprintf('%d%02d', $end_year, $end_month); @@ -1589,7 +1623,7 @@ public function CHECK_SET_TERM3($value) } } - //ディレクトリ存在チェック + // ディレクトリ存在チェック public function DIR_CHECK($value) { $disp_name = $value[0]; @@ -1624,7 +1658,7 @@ public function DOMAIN_CHECK($value) } } - /* 携帯メールアドレスの判定 */ + /* 携帯メールアドレスの判定  */ // メールアドレスを正規表現で判定する // value[0] = 項目名 value[1] = 判定対象メールアドレス public function MOBILE_EMAIL_CHECK($value) @@ -1641,7 +1675,7 @@ public function MOBILE_EMAIL_CHECK($value) $objMobile = new SC_Helper_Mobile_Ex(); $input_var = $this->arrParam[$keyname]; if (strlen($input_var) > 0 - &&!$objMobile->gfIsMobileMailAddress($input_var) + && !$objMobile->gfIsMobileMailAddress($input_var) ) { $this->arrErr[$keyname] = "※ {$disp_name}は携帯電話のものではありません。
"; @@ -1652,8 +1686,9 @@ public function MOBILE_EMAIL_CHECK($value) * CHECK_REGIST_CUSTOMER_EMAIL * * メールアドレスが会員登録されているか調べる + * * @param array $value value[0] = 項目名 value[1] = 判定対象メールアドレス - * @access public + * * @return void */ public function CHECK_REGIST_CUSTOMER_EMAIL($value) @@ -1701,10 +1736,10 @@ public function PROHIBITED_STR_CHECK($value) $this->createParam($value); - $targetStr = $this->arrParam[$keyname]; + $targetStr = $this->arrParam[$keyname]; $prohibitedStr = str_replace(array('|', '/'), array('\|', '\/'), $arrProhibitedStr); - $pattern = '/' . join('|', $prohibitedStr) . '/i'; + $pattern = '/' . implode('|', $prohibitedStr) . '/i'; if (preg_match_all($pattern, $targetStr, $matches)) { $this->arrErr[$keyname] = "※ {$disp_name}は入力できません。
"; @@ -1714,8 +1749,8 @@ public function PROHIBITED_STR_CHECK($value) /** * パラメーターとして適切な文字列かチェックする. * - * @access private * @param array $value [0] => 項目名, [1] => 評価する文字列 + * * @return void */ public function EVAL_CHECK($value) @@ -1742,8 +1777,9 @@ public function EVAL_CHECK($value) * ・PHPコードとして評価可能であること。 * ・評価した結果がスカラデータ(定数に指定できる値)であること。 * 本メソッドの利用や改訂にあたっては、eval 関数の危険性を意識する必要がある。 - * @access private + * * @param string 評価する文字列 + * * @return bool パラメーターとして適切な文字列か */ public function evalCheck($value) @@ -1751,14 +1787,15 @@ public function evalCheck($value) if ($value === '' || $value === null) { return true; } + return @eval('return is_scalar(' . $value . ');'); } /** * 未定義の $this->arrParam に空要素を代入する. * - * @access private * @param array $value 配列 + * * @return void */ public function createParam($value) @@ -1766,13 +1803,15 @@ public function createParam($value) foreach ($value as $val_key => $key) { if ($val_key != 0 && (is_string($key) || is_int($key))) { if (!is_numeric($key) && preg_match('/^[a-z0-9_]+$/i', $key)) { - if (!isset($this->arrParam[$key])) $this->arrParam[$key] = ''; + if (!isset($this->arrParam[$key])) { + $this->arrParam[$key] = ''; + } if (!is_array($this->arrParam[$key]) && strlen($this->arrParam[$key]) > 0 && (preg_match('/^[[:alnum:]\-\_]*[\.\/\\\\]*\.\.(\/|\\\\)/', $this->arrParam[$key]) || !preg_match('/\A[^\x00-\x08\x0b\x0c\x0e-\x1f\x7f]+\z/u', $this->arrParam[$key]))) { $this->arrErr[$value[1]] = '※ ' . $value[0] . 'に禁止された記号の並びまたは制御文字が入っています。
'; } } elseif (preg_match('/[^a-z0-9_]/i', $key)) { - trigger_error('', E_USER_ERROR); + trigger_error('', \E_USER_ERROR); } } } @@ -1781,8 +1820,8 @@ public function createParam($value) /** * 値が数字だけかどうかチェックする * - * @access private * @param string $string チェックする文字列 + * * @return boolean 値が10進数の数値表現以外の場合 true */ public function numelicCheck($string) diff --git a/data/class/SC_ClassAutoloader.php b/data/class/SC_ClassAutoloader.php index 323cfd672a..18e629c79b 100644 --- a/data/class/SC_ClassAutoloader.php +++ b/data/class/SC_ClassAutoloader.php @@ -24,8 +24,8 @@ /** * クラスのオートローディングクラス * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_ClassAutoloader @@ -101,7 +101,7 @@ public static function autoload($class, $plugin_upload_realdir = PLUGIN_UPLOAD_R $base_class_str = str_replace(array(''), '', $base_class_str); $base_class_str = preg_replace($exp, $replace, $base_class_str, 1); } else { - $base_class_str = 'class '.$class.' extends '.$parent_classname.' {}'; + $base_class_str = 'class ' . $class . ' extends ' . $parent_classname . ' {}'; } eval($base_class_str); @@ -124,7 +124,7 @@ public static function autoload($class, $plugin_upload_realdir = PLUGIN_UPLOAD_R $base_class_str = str_replace(array(''), '', $base_class_str); $base_class_str = preg_replace($exp, $replace, $base_class_str, 1); } else { - $base_class_str = 'class '.$class.' extends '.$parent_classname.' {}'; + $base_class_str = 'class ' . $class . ' extends ' . $parent_classname . ' {}'; } eval($base_class_str); @@ -144,9 +144,9 @@ class_alias(preg_replace('/_Ex$/', '', $class), $class); if (file_exists($classpath)) { include $classpath; } else { - $arrPath = explode(PATH_SEPARATOR, get_include_path()); + $arrPath = explode(\PATH_SEPARATOR, get_include_path()); foreach ($arrPath as $path) { - if (file_exists($path . '/' .$classpath)) { + if (file_exists($path . '/' . $classpath)) { include $classpath; break; } diff --git a/data/class/SC_Cookie.php b/data/class/SC_Cookie.php index 228c8bd4f1..d8f8591e35 100644 --- a/data/class/SC_Cookie.php +++ b/data/class/SC_Cookie.php @@ -23,7 +23,6 @@ /** * クッキー用クラス - * */ class SC_Cookie { @@ -53,6 +52,7 @@ public function setCookie($key, $val, $secure = false, $httponly = true) * クッキー取得 * * EC-CUBE をURLパスルート以外にインストールしている場合、上位ディレクトリの値も(劣後ではあるが)取得する点に留意。 + * * @param string $key */ public function getCookie($key) diff --git a/data/class/SC_Customer.php b/data/class/SC_Customer.php index 5f29b18adb..e5e1353d82 100644 --- a/data/class/SC_Customer.php +++ b/data/class/SC_Customer.php @@ -28,6 +28,7 @@ class SC_Customer { /** * 会員情報 + * * @var array */ public $customer_data; @@ -40,6 +41,7 @@ class SC_Customer * @param string $email メールアドレス * @param string $pass パスワード * @param bool $mobile email_mobile も検索対象とする場合 true + * * @return bool */ public function getCustomerDataFromEmailPass($pass, $email, $mobile = false) @@ -75,13 +77,15 @@ public function getCustomerDataFromEmailPass($pass, $email, $mobile = false) /** * 携帯端末IDが一致する会員が存在するかどうかをチェックする。 * FIXME + * * @return boolean 該当する会員が存在する場合は true、それ以外の場合 * は false を返す。 + * * @deprecated */ public function checkMobilePhoneId() { - //docomo用にデータを取り出す。 + // docomo用にデータを取り出す。 if (SC_MobileUserAgent_Ex::getCarrier() == 'docomo') { if ($_SESSION['mobile']['phone_id'] == '' && strlen($_SESSION['mobile']['phone_id']) == 0) { $_SESSION['mobile']['phone_id'] = SC_MobileUserAgent_Ex::getId(); @@ -103,13 +107,15 @@ public function checkMobilePhoneId() * パスワードが合っている場合は会員情報を取得する。 * * @param string $pass パスワード + * * @return boolean 該当する会員が存在し、パスワードが合っている場合は true、 * それ以外の場合は false を返す。 + * * @deprecated */ public function getCustomerDataFromMobilePhoneIdPass($pass) { - //docomo用にデータを取り出す。 + // docomo用にデータを取り出す。 if (SC_MobileUserAgent_Ex::getCarrier() == 'docomo') { if ($_SESSION['mobile']['phone_id'] == '' && strlen($_SESSION['mobile']['phone_id']) == 0) { $_SESSION['mobile']['phone_id'] = SC_MobileUserAgent_Ex::getId(); @@ -139,6 +145,7 @@ public function getCustomerDataFromMobilePhoneIdPass($pass) * 携帯端末IDを登録する。 * * @return void + * * @deprecated */ public function updateMobilePhoneId() @@ -195,7 +202,7 @@ public function startSession() { $_SESSION['customer'] = $this->customer_data; // セッション情報の保存 - GC_Utils_Ex::gfPrintLog('access : user='.$this->customer_data['customer_id'] ."\t".'ip='. $this->getRemoteHost(), CUSTOMER_LOG_REALFILE, false); + GC_Utils_Ex::gfPrintLog('access : user=' . $this->customer_data['customer_id'] . "\t" . 'ip=' . $this->getRemoteHost(), CUSTOMER_LOG_REALFILE, false); } /** @@ -225,6 +232,7 @@ public function EndSession() * ログインに成功しているか判定する。 * * @param bool $dont_check_email_mobile + * * @return bool ログインに成功している場合は true */ public function isLoginSuccess($dont_check_email_mobile = false) @@ -255,6 +263,7 @@ public function isLoginSuccess($dont_check_email_mobile = false) * パラメーターの取得 * * @param string $keyname パラメーターのキー名 + * * @return string|int|null パラメータの値 */ public function getValue($keyname) @@ -273,6 +282,7 @@ public function getValue($keyname) /** * パラメーターのセット + * * @param string $keyname * @param string $val */ @@ -285,6 +295,7 @@ public function setValue($keyname, $val) * パラメーターがNULLかどうかの判定 * * @param string $keyname + * * @return bool */ public function hasValue($keyname) @@ -305,8 +316,8 @@ public function isBirthMonth() { if (isset($_SESSION['customer']['birth'])) { $arrRet = preg_split('|[- :/]|', $_SESSION['customer']['birth']); - $birth_month = intval($arrRet[1]); - $now_month = intval(date('m')); + $birth_month = (int) $arrRet[1]; + $now_month = (int) date('m'); if ($birth_month == $now_month) { return true; @@ -368,6 +379,7 @@ public static function updateOrderSummary($customer_id) * * @param string $login_email ログインメールアドレス * @param string $login_pass ログインパスワード + * * @return bool ログインに成功した場合 true; 失敗した場合 false */ public function doLogin($login_email, $login_pass) diff --git a/data/class/SC_CustomerList.php b/data/class/SC_CustomerList.php index 5e897eac23..388124e644 100644 --- a/data/class/SC_CustomerList.php +++ b/data/class/SC_CustomerList.php @@ -56,14 +56,18 @@ public function __construct($array, $mode = '') } // 会員ID - if (!isset($this->arrSql['search_customer_id'])) $this->arrSql['search_customer_id'] = ''; + if (!isset($this->arrSql['search_customer_id'])) { + $this->arrSql['search_customer_id'] = ''; + } if (strlen($this->arrSql['search_customer_id']) > 0) { $this->setWhere('customer_id = ?'); $this->arrVal[] = $this->arrSql['search_customer_id']; } // 名前 - if (!isset($this->arrSql['search_name'])) $this->arrSql['search_name'] = ''; + if (!isset($this->arrSql['search_name'])) { + $this->arrSql['search_name'] = ''; + } if (strlen($this->arrSql['search_name']) > 0) { $this->setWhere('(' . $dbFactory->concatColumn(array('name01', 'name02')) . ' LIKE ?)'); $searchName = $this->addSearchStr($this->arrSql['search_name']); @@ -71,7 +75,9 @@ public function __construct($array, $mode = '') } // 名前(フリガナ) - if (!isset($this->arrSql['search_kana'])) $this->arrSql['search_kana'] = ''; + if (!isset($this->arrSql['search_kana'])) { + $this->arrSql['search_kana'] = ''; + } if (strlen($this->arrSql['search_kana']) > 0) { $this->setWhere('(' . $dbFactory->concatColumn(array('kana01', 'kana02')) . ' LIKE ?)'); $searchKana = $this->addSearchStr($this->arrSql['search_kana']); @@ -79,14 +85,18 @@ public function __construct($array, $mode = '') } // 都道府県 - if (!isset($this->arrSql['search_pref'])) $this->arrSql['search_pref'] = ''; + if (!isset($this->arrSql['search_pref'])) { + $this->arrSql['search_pref'] = ''; + } if (strlen($this->arrSql['search_pref']) > 0) { $this->setWhere('pref = ?'); $this->arrVal[] = $this->arrSql['search_pref']; } // 電話番号 - if (!isset($this->arrSql['search_tel'])) $this->arrSql['search_tel'] = ''; + if (!isset($this->arrSql['search_tel'])) { + $this->arrSql['search_tel'] = ''; + } if (is_numeric($this->arrSql['search_tel'])) { $this->setWhere('(' . $dbFactory->concatColumn(array('tel01', 'tel02', 'tel03')) . ' LIKE ?)'); $searchTel = $this->addSearchStr($this->arrSql['search_tel']); @@ -94,7 +104,9 @@ public function __construct($array, $mode = '') } // 性別 - if (!isset($this->arrSql['search_sex'])) $this->arrSql['search_sex'] = ''; + if (!isset($this->arrSql['search_sex'])) { + $this->arrSql['search_sex'] = ''; + } if (is_array($this->arrSql['search_sex'])) { $arrSexVal = $this->setItemTerm($this->arrSql['search_sex'], 'sex'); foreach ($arrSexVal as $data) { @@ -103,7 +115,9 @@ public function __construct($array, $mode = '') } // 職業 - if (!isset($this->arrSql['search_job'])) $this->arrSql['search_job'] = ''; + if (!isset($this->arrSql['search_job'])) { + $this->arrSql['search_job'] = ''; + } if (is_array($this->arrSql['search_job'])) { if (in_array('不明', $this->arrSql['search_job'])) { $arrJobVal = $this->setItemTermWithNull($this->arrSql['search_job'], 'job'); @@ -118,14 +132,16 @@ public function __construct($array, $mode = '') } // E-MAIL - if (!isset($this->arrSql['search_email'])) $this->arrSql['search_email'] = ''; + if (!isset($this->arrSql['search_email'])) { + $this->arrSql['search_email'] = ''; + } if (strlen($this->arrSql['search_email']) > 0) { - //カンマ区切りで複数の条件指定可能に + // カンマ区切りで複数の条件指定可能に $this->arrSql['search_email'] = explode(',', $this->arrSql['search_email']); $sql_where = ''; foreach ($this->arrSql['search_email'] as $val) { $val = trim($val); - //検索条件を含まない + // 検索条件を含まない if ($this->arrSql['not_emailinc'] == '1') { if ($sql_where == '') { $sql_where .= 'dtb_customer.email NOT ILIKE ? '; @@ -146,15 +162,17 @@ public function __construct($array, $mode = '') } // E-MAIL(mobile) - if (!isset($this->arrSql['search_email_mobile'])) $this->arrSql['search_email_mobile'] = ''; + if (!isset($this->arrSql['search_email_mobile'])) { + $this->arrSql['search_email_mobile'] = ''; + } if (strlen($this->arrSql['search_email_mobile']) > 0) { - //カンマ区切りで複数の条件指定可能に + // カンマ区切りで複数の条件指定可能に $this->arrSql['search_email_mobile'] = explode(',', $this->arrSql['search_email_mobile']); $sql_where = ''; foreach ($this->arrSql['search_email_mobile'] as $val) { $val = trim($val); - //検索条件を含まない + // 検索条件を含まない if ($this->arrSql['not_email_mobileinc'] == '1') { if ($sql_where == '') { $sql_where .= 'dtb_customer.email_mobile NOT ILIKE ? '; @@ -201,15 +219,15 @@ public function __construct($array, $mode = '') case 1: $this->setWhere("(dtb_customer.email <> dtb_customer.email_mobile OR $sqlEmailMobileIsEmpty)"); break; - // 携帯メールアドレス + // 携帯メールアドレス case 2: $this->setWhere("NOT $sqlEmailMobileIsEmpty"); break; - // PCメールアドレス (携帯メールアドレスを登録している会員は除外) + // PCメールアドレス (携帯メールアドレスを登録している会員は除外) case 3: $this->setWhere($sqlEmailMobileIsEmpty); break; - // 携帯メールアドレス (PCメールアドレスを登録している会員は除外) + // 携帯メールアドレス (PCメールアドレスを登録している会員は除外) case 4: $this->setWhere('dtb_customer.email = dtb_customer.email_mobile'); break; @@ -218,8 +236,12 @@ public function __construct($array, $mode = '') } // 購入金額指定 - if (!isset($this->arrSql['search_buy_total_from'])) $this->arrSql['search_buy_total_from'] = ''; - if (!isset($this->arrSql['search_buy_total_to'])) $this->arrSql['search_buy_total_to'] = ''; + if (!isset($this->arrSql['search_buy_total_from'])) { + $this->arrSql['search_buy_total_from'] = ''; + } + if (!isset($this->arrSql['search_buy_total_to'])) { + $this->arrSql['search_buy_total_to'] = ''; + } if (is_numeric($this->arrSql['search_buy_total_from']) || is_numeric($this->arrSql['search_buy_total_to'])) { $arrBuyTotal = $this->selectRange($this->arrSql['search_buy_total_from'], $this->arrSql['search_buy_total_to'], 'buy_total'); foreach ($arrBuyTotal as $data) { @@ -228,8 +250,12 @@ public function __construct($array, $mode = '') } // 購入回数指定 - if (!isset($this->arrSql['search_buy_times_from'])) $this->arrSql['search_buy_times_from'] = ''; - if (!isset($this->arrSql['search_buy_times_to'])) $this->arrSql['search_buy_times_to'] = ''; + if (!isset($this->arrSql['search_buy_times_from'])) { + $this->arrSql['search_buy_times_from'] = ''; + } + if (!isset($this->arrSql['search_buy_times_to'])) { + $this->arrSql['search_buy_times_to'] = ''; + } if (is_numeric($this->arrSql['search_buy_times_from']) || is_numeric($this->arrSql['search_buy_times_to'])) { $arrBuyTimes = $this->selectRange($this->arrSql['search_buy_times_from'], $this->arrSql['search_buy_times_to'], 'buy_times'); foreach ($arrBuyTimes as $data) { @@ -238,63 +264,103 @@ public function __construct($array, $mode = '') } // 誕生日期間指定 - if (!isset($this->arrSql['search_b_start_year'])) $this->arrSql['search_b_start_year'] = ''; - if (!isset($this->arrSql['search_b_start_month'])) $this->arrSql['search_b_start_month'] = ''; - if (!isset($this->arrSql['search_b_start_day'])) $this->arrSql['search_b_start_day'] = ''; - if (!isset($this->arrSql['search_b_end_year'])) $this->arrSql['search_b_end_year'] = ''; - if (!isset($this->arrSql['search_b_end_month'])) $this->arrSql['search_b_end_month'] = ''; - if (!isset($this->arrSql['search_b_end_day'])) $this->arrSql['search_b_end_day'] = ''; + if (!isset($this->arrSql['search_b_start_year'])) { + $this->arrSql['search_b_start_year'] = ''; + } + if (!isset($this->arrSql['search_b_start_month'])) { + $this->arrSql['search_b_start_month'] = ''; + } + if (!isset($this->arrSql['search_b_start_day'])) { + $this->arrSql['search_b_start_day'] = ''; + } + if (!isset($this->arrSql['search_b_end_year'])) { + $this->arrSql['search_b_end_year'] = ''; + } + if (!isset($this->arrSql['search_b_end_month'])) { + $this->arrSql['search_b_end_month'] = ''; + } + if (!isset($this->arrSql['search_b_end_day'])) { + $this->arrSql['search_b_end_day'] = ''; + } if ((strlen($this->arrSql['search_b_start_year']) > 0 && strlen($this->arrSql['search_b_start_month']) > 0 && strlen($this->arrSql['search_b_start_day']) > 0) || strlen($this->arrSql['search_b_end_year']) > 0 && strlen($this->arrSql['search_b_end_month']) > 0 && strlen($this->arrSql['search_b_end_day']) > 0) { $arrBirth = $this->selectTermRange($this->arrSql['search_b_start_year'], $this->arrSql['search_b_start_month'], $this->arrSql['search_b_start_day'], - $this->arrSql['search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], 'birth'); + $this->arrSql['search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], 'birth'); foreach ($arrBirth as $data) { $this->arrVal[] = $data; } } // 誕生月の検索 - if (!isset($this->arrSql['search_birth_month'])) $this->arrSql['search_birth_month'] = ''; + if (!isset($this->arrSql['search_birth_month'])) { + $this->arrSql['search_birth_month'] = ''; + } if (is_numeric($this->arrSql['search_birth_month'])) { $this->setWhere(' EXTRACT(month from birth) = ?'); $this->arrVal[] = $this->arrSql['search_birth_month']; } // 登録期間指定 - if (!isset($this->arrSql['search_start_year'])) $this->arrSql['search_start_year'] = ''; - if (!isset($this->arrSql['search_start_month'])) $this->arrSql['search_start_month'] = ''; - if (!isset($this->arrSql['search_start_day'])) $this->arrSql['search_start_day'] = ''; - if (!isset($this->arrSql['search_end_year'])) $this->arrSql['search_end_year'] = ''; - if (!isset($this->arrSql['search_end_month'])) $this->arrSql['search_end_month'] = ''; - if (!isset($this->arrSql['search_end_day'])) $this->arrSql['search_end_day'] = ''; - if ( (strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0) || - (strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) >0 && strlen($this->arrSql['search_end_day']) > 0)) { + if (!isset($this->arrSql['search_start_year'])) { + $this->arrSql['search_start_year'] = ''; + } + if (!isset($this->arrSql['search_start_month'])) { + $this->arrSql['search_start_month'] = ''; + } + if (!isset($this->arrSql['search_start_day'])) { + $this->arrSql['search_start_day'] = ''; + } + if (!isset($this->arrSql['search_end_year'])) { + $this->arrSql['search_end_year'] = ''; + } + if (!isset($this->arrSql['search_end_month'])) { + $this->arrSql['search_end_month'] = ''; + } + if (!isset($this->arrSql['search_end_day'])) { + $this->arrSql['search_end_day'] = ''; + } + if ((strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0) || + (strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) > 0 && strlen($this->arrSql['search_end_day']) > 0)) { $arrRegistTime = $this->selectTermRange($this->arrSql['search_start_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day'], - $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col); + $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col); foreach ($arrRegistTime as $data) { $this->arrVal[] = $data; } } // 最終購入日指定 - if (!isset($this->arrSql['search_buy_start_year'])) $this->arrSql['search_buy_start_year'] = ''; - if (!isset($this->arrSql['search_buy_start_month'])) $this->arrSql['search_buy_start_month'] = ''; - if (!isset($this->arrSql['search_buy_start_day'])) $this->arrSql['search_buy_start_day'] = ''; - if (!isset($this->arrSql['search_buy_end_year'])) $this->arrSql['search_buy_end_year'] = ''; - if (!isset($this->arrSql['search_buy_end_month'])) $this->arrSql['search_buy_end_month'] = ''; - if (!isset($this->arrSql['search_buy_end_day'])) $this->arrSql['search_buy_end_day'] = ''; - - if ( (strlen($this->arrSql['search_buy_start_year']) > 0 && strlen($this->arrSql['search_buy_start_month']) > 0 && strlen($this->arrSql['search_buy_start_day']) > 0) || - (strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) >0 && strlen($this->arrSql['search_buy_end_day']) > 0)) { + if (!isset($this->arrSql['search_buy_start_year'])) { + $this->arrSql['search_buy_start_year'] = ''; + } + if (!isset($this->arrSql['search_buy_start_month'])) { + $this->arrSql['search_buy_start_month'] = ''; + } + if (!isset($this->arrSql['search_buy_start_day'])) { + $this->arrSql['search_buy_start_day'] = ''; + } + if (!isset($this->arrSql['search_buy_end_year'])) { + $this->arrSql['search_buy_end_year'] = ''; + } + if (!isset($this->arrSql['search_buy_end_month'])) { + $this->arrSql['search_buy_end_month'] = ''; + } + if (!isset($this->arrSql['search_buy_end_day'])) { + $this->arrSql['search_buy_end_day'] = ''; + } + + if ((strlen($this->arrSql['search_buy_start_year']) > 0 && strlen($this->arrSql['search_buy_start_month']) > 0 && strlen($this->arrSql['search_buy_start_day']) > 0) || + (strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) > 0 && strlen($this->arrSql['search_buy_end_day']) > 0)) { $arrRegistTime = $this->selectTermRange($this->arrSql['search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day'], - $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], 'last_buy_date'); + $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], 'last_buy_date'); foreach ($arrRegistTime as $data) { $this->arrVal[] = $data; } } // 購入商品コード - if (!isset($this->arrSql['search_buy_product_code'])) $this->arrSql['search_buy_product_code'] = ''; + if (!isset($this->arrSql['search_buy_product_code'])) { + $this->arrSql['search_buy_product_code'] = ''; + } if (strlen($this->arrSql['search_buy_product_code']) > 0) { $this->setWhere('customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_code LIKE ?) AND del_flg = 0)'); $search_buyproduct_code = $this->addSearchStr($this->arrSql['search_buy_product_code']); @@ -302,7 +368,9 @@ public function __construct($array, $mode = '') } // 購入商品名称 - if (!isset($this->arrSql['search_buy_product_name'])) $this->arrSql['search_buy_product_name'] = ''; + if (!isset($this->arrSql['search_buy_product_name'])) { + $this->arrSql['search_buy_product_name'] = ''; + } if (strlen($this->arrSql['search_buy_product_name']) > 0) { $this->setWhere('customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_name LIKE ?) AND del_flg = 0)'); $search_buyproduct_name = $this->addSearchStr($this->arrSql['search_buy_product_name']); @@ -310,20 +378,24 @@ public function __construct($array, $mode = '') } // カテゴリを選択している場合のみ絞込検索を行う - if (!isset($this->arrSql['search_category_id'])) $this->arrSql['search_category_id'] = ''; + if (!isset($this->arrSql['search_category_id'])) { + $this->arrSql['search_category_id'] = ''; + } if (strlen($this->arrSql['search_category_id']) > 0) { // カテゴリで絞込検索を行うSQL文生成 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($this->arrSql['search_category_id']); // カテゴリで絞込みが可能の場合 if ($tmp_where != '') { - $this->setWhere(' customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_product_categories WHERE '.$tmp_where.') AND del_flg = 0)) '); + $this->setWhere(' customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_product_categories WHERE ' . $tmp_where . ') AND del_flg = 0)) '); $this->arrVal = array_merge((array) $this->arrVal, (array) $tmp_arrval); } } // 会員状態 - if (!isset($this->arrSql['search_status'])) $this->arrSql['search_status'] = ''; + if (!isset($this->arrSql['search_status'])) { + $this->arrSql['search_status'] = ''; + } if (is_array($this->arrSql['search_status'])) { $arrStatusVal = $this->setItemTerm($this->arrSql['search_status'], 'status'); foreach ($arrStatusVal as $data) { @@ -370,6 +442,7 @@ public function getListCount() /** * CSVダウンロード用SQL + * * @deprecated 本体で使用していないため非推奨 */ public function getListCSV($arrColumnCSV) @@ -378,12 +451,14 @@ public function getListCSV($arrColumnCSV) $i = 0; $state = ''; foreach ($this->arrColumnCSV as $val) { - if ($i != 0) $state .= ', '; + if ($i != 0) { + $state .= ', '; + } $state .= $val['sql']; - $i ++; + $i++; } - $this->select = 'SELECT ' .$state. ' FROM dtb_customer '; + $this->select = 'SELECT ' . $state . ' FROM dtb_customer '; return $this->getSql(2); } diff --git a/data/class/SC_Date.php b/data/class/SC_Date.php index ed93939b3f..c24475dade 100644 --- a/data/class/SC_Date.php +++ b/data/class/SC_Date.php @@ -29,14 +29,18 @@ class SC_Date public $day; public $end_year; - public static $arrHoliday = NULL; - public static $arrRegularHoliday = NULL; + public static $arrHoliday = null; + public static $arrRegularHoliday = null; // コンストラクタ - public function __construct($start_year='', $end_year='') + public function __construct($start_year = '', $end_year = '') { - if ($start_year) $this->setStartYear($start_year); - if ($end_year) $this->setEndYear($end_year); + if ($start_year) { + $this->setStartYear($start_year); + } + if ($end_year) { + $this->setEndYear($end_year); + } } public function setStartYear($year) @@ -75,6 +79,7 @@ public function setDay($day) /** * 年プルダウン用の配列を返す * FIXME $default_year に一致いる行が無かった場合、先頭か末尾に付加すべきと思われる。 + * * @param string $year XMLファイル名 * @param bool|string $default_year * false 「選択なし」は含めない。 @@ -84,13 +89,19 @@ public function setDay($day) */ public function getYear($year = '', $default_year = false, $default_key = '----') { - if ($year) $this->setStartYear($year); + if ($year) { + $this->setStartYear($year); + } $year = $this->start_year; - if (! $year) $year = DATE('Y'); + if (!$year) { + $year = date('Y'); + } $end_year = $this->end_year; - if (! $end_year) $end_year = (DATE('Y') + 3); + if (!$end_year) { + $end_year = (date('Y') + 3); + } $year_array = array(); @@ -110,13 +121,19 @@ public function getYear($year = '', $default_year = false, $default_key = '----' public function getZeroYear($year = '') { - if ($year) $this->setStartYear($year); + if ($year) { + $this->setStartYear($year); + } $year = $this->start_year; - if (! $year) $year = DATE('Y'); + if (!$year) { + $year = date('Y'); + } $end_year = $this->end_year; - if (! $end_year) $end_year = (DATE('Y') + 3); + if (!$end_year) { + $end_year = (date('Y') + 3); + } $year_array = array(); @@ -131,7 +148,7 @@ public function getZeroYear($year = '') public function getZeroMonth() { $month_array = array(); - for ($i=1; $i <= 12; $i++) { + for ($i = 1; $i <= 12; $i++) { $val = sprintf('%02d', $i); $month_array[$val] = $val; } @@ -143,10 +160,12 @@ public function getMonth($default = false) { $month_array = array(); - if ($default) $month_array[''] = '--'; + if ($default) { + $month_array[''] = '--'; + } - for ($i=0; $i < 12; $i++) { - $month_array[$i + 1 ] = $i + 1; + for ($i = 0; $i < 12; $i++) { + $month_array[$i + 1] = $i + 1; } return $month_array; @@ -156,10 +175,12 @@ public function getDay($default = false) { $day_array = array(); - if ($default) $day_array[''] = '--'; + if ($default) { + $day_array[''] = '--'; + } - for ($i=0; $i < 31; $i++) { - $day_array[ $i + 1 ] = $i + 1; + for ($i = 0; $i < 31; $i++) { + $day_array[$i + 1] = $i + 1; } return $day_array; @@ -168,7 +189,7 @@ public function getDay($default = false) public function getHour() { $hour_array = array(); - for ($i=0; $i<=23; $i++) { + for ($i = 0; $i <= 23; $i++) { $hour_array[$i] = $i; } @@ -178,7 +199,7 @@ public function getHour() public function getMinutes() { $minutes_array = array(); - for ($i=0; $i<=59; $i++) { + for ($i = 0; $i <= 59; $i++) { $minutes_array[$i] = $i; } @@ -187,7 +208,7 @@ public function getMinutes() public function getMinutesInterval() { - $minutes_array = array('00'=>'00', '30'=>'30'); + $minutes_array = array('00' => '00', '30' => '30'); return $minutes_array; } @@ -198,12 +219,17 @@ public function getMinutesInterval() * @param integer $year * @param integer $month * @param integer $day + * * @return boolean 休日の場合はtrue */ public function isHoliday($year, $month, $day) { - if (is_null(SC_Date_Ex::$arrHoliday)) $this->setArrHoliday(); - if (is_null(SC_Date_Ex::$arrRegularHoliday)) $this->setRegularHoliday(); + if (is_null(SC_Date_Ex::$arrHoliday)) { + $this->setArrHoliday(); + } + if (is_null(SC_Date_Ex::$arrRegularHoliday)) { + $this->setRegularHoliday(); + } if (!empty(SC_Date_Ex::$arrHoliday[$month])) { if (in_array($day, SC_Date_Ex::$arrHoliday[$month])) { @@ -230,7 +256,7 @@ private function setArrHoliday() $objHoliday = new SC_Helper_Holiday_Ex(); $holiday = $objHoliday->getList(); $arrHoliday = array(); - foreach ($holiday AS $val) { + foreach ($holiday as $val) { $arrHoliday[$val['month']][] = $val['day']; } SC_Date_Ex::$arrHoliday = $arrHoliday; diff --git a/data/class/SC_Display.php b/data/class/SC_Display.php index 0957a115ab..d7b5478123 100644 --- a/data/class/SC_Display.php +++ b/data/class/SC_Display.php @@ -25,6 +25,7 @@ * Http コンテンツ出力を制御するクラス. * * @author Ryuichi Tokugami + * * @version $Id$ */ class SC_Display @@ -83,6 +84,7 @@ public function prepare($page, $is_admin = false) * リロードを行う. * * SC_Response::reload() のラッパーです. + * * @deprecated SC_Response::reload() を使用してください */ public function reload($queryString = array(), $removeQueryString = false) @@ -145,13 +147,15 @@ public function setView($view) * SC_Display::PC = PC = 10 * * @static + * * @param $reset boolean + * * @return integer 端末種別ID */ - public static function detectDevice($reset = FALSE) + public static function detectDevice($reset = false) { if (is_null(SC_Display_Ex::$device) || $reset) { - //$nu = new Net_UserAgent_Mobile(); + // $nu = new Net_UserAgent_Mobile(); $su = new SC_SmartphoneUserAgent_Ex(); if ($su->isSmartphone()) { SC_Display_Ex::$device = DEVICE_TYPE_SMARTPHONE; @@ -163,7 +167,7 @@ public static function detectDevice($reset = FALSE) return SC_Display_Ex::$device; } - public function assign($val1,$val2) + public function assign($val1, $val2) { $this->view->assign($val1, $val2); } diff --git a/data/class/SC_FormParam.php b/data/class/SC_FormParam.php index aa3556f7f2..c25df39ad7 100644 --- a/data/class/SC_FormParam.php +++ b/data/class/SC_FormParam.php @@ -26,7 +26,6 @@ * * :XXX: addParam と setParam で言う「パラメーター」が用語として競合しているように感じる。(2009/10/17 Seasoft 塚田) * - * @package SC * @author EC-CUBE CO.,LTD. */ class SC_FormParam @@ -68,7 +67,7 @@ public function __construct() // SC_FormParamのフックポイント // TODO: debug_backtrace以外にいい方法があれば良いが、一旦これで - $backtraces = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 2); + $backtraces = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 2); // 呼び出し元のクラスを取得 $class = $backtraces[1]['class']; $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance(); @@ -111,7 +110,9 @@ public function addParam($disp_name, $keyname, $length = '', $convert = '', $arr // $seq :trueの場合、$arrVal[0]~の配列を登録順にインスタンスに格納する public function setParam($arrVal, $seq = false) { - if (!is_array($arrVal)) return; + if (!is_array($arrVal)) { + return; + } if (!$seq) { foreach ($arrVal as $key => $val) { $this->setValue($key, $val); @@ -237,17 +238,17 @@ public function checkError($br = true) unset($arrErr[$key]); } break; - // 小文字に変換 + // 小文字に変換 case 'CHANGE_LOWER': $this->toLower($key); break; - // ファイルの存在チェック + // ファイルの存在チェック case 'FILE_EXISTS': if ($value != '' && !file_exists($this->check_dir . $value)) { $arrErr[$key] = '※ ' . $this->disp_name[$index] . 'のファイルが存在しません。
'; } break; - // ダウンロード用ファイルの存在チェック + // ダウンロード用ファイルの存在チェック case 'DOWN_FILE_EXISTS': if ($value != '' && !file_exists(DOWN_SAVE_REALDIR . $value)) { $arrErr[$key] = '※ ' . $this->disp_name[$index] . 'のファイルが存在しません。
'; @@ -278,6 +279,7 @@ public function checkError($br = true) * 配列の場合は再帰的にチェックする * @param array $arrErr エラーメッセージを格納する配列(の一部) * @param integer $length チェック対象の値の長さ + * * @return void */ public function recursionCheck($disp_name, $func, $value, &$arrErr, @@ -287,11 +289,12 @@ public function recursionCheck($disp_name, $func, $value, &$arrErr, if (is_array($value)) { foreach ($value as $key => $in) { $this->recursionCheck($disp_name, $func, $in, $arrErr[$key], - $length); + $length); if (SC_Utils_Ex::isBlank($arrErr[$key])) { unset($arrErr[$key]); } } + return; } @@ -307,6 +310,7 @@ public function recursionCheck($disp_name, $func, $value, &$arrErr, * フォームの入力パラメーターに応じて, 再帰的に mb_convert_kana 関数を実行する. * * @return void + * * @see mb_convert_kana */ public function convParam() @@ -341,6 +345,7 @@ public function recursionConvParam(&$value, $convert) * 連想配列で返す * * @param array $arrKey 対象のキー + * * @return array 連想配列 */ public function getHashArray($arrKey = array()) @@ -372,6 +377,7 @@ public function getDbArray() * 配列の縦横を入れ替えて返す * * @param array $arrKey 対象のキー + * * @return array 縦横を入れ替えた配列 */ public function getSwapArray($arrKey = array()) @@ -464,6 +470,7 @@ public function splitParamCheckBoxes($keyname) * 入力パラメーターの先頭及び末尾にある空白文字を削除する. * * @param boolean $has_wide_space 全角空白も削除する場合 true + * * @return void */ public function trimParam($has_wide_space = true) @@ -478,6 +485,7 @@ public function trimParam($has_wide_space = true) * * @param mixed $value 変換する値. 配列の場合は再帰的に実行する. * @param boolean $has_wide_space 全角空白も削除する場合 true + * * @return void */ public function recursionTrim(&$value, $has_wide_space = true) @@ -503,6 +511,7 @@ public function recursionTrim(&$value, $has_wide_space = true) * 引数で指定した文字列で始まるパラメーター名の入力値を連想配列で取得する. * * @param string $prefix パラメーター名の接頭辞 + * * @return array 検索結果引き継ぎ用の連想配列. */ public function getSearchArray($prefix = 'search_') @@ -521,6 +530,7 @@ public function getSearchArray($prefix = 'search_') * 前方互換用 * * 1次キーが添字なのが特徴だったと思われる。 + * * @deprecated 2.12.0 必要ならば getFormParamList メソッドに引数を追加するなどで実現可能 */ public function getFormDispArray() @@ -530,7 +540,7 @@ public function getFormDispArray() // キー名 $formDispArray[$index]['keyname'] = $key; // 表示名 - $formDispArray[$index]['disp_name'] = $this->disp_name[$index]; + $formDispArray[$index]['disp_name'] = $this->disp_name[$index]; // 文字数制限 $formDispArray[$index]['length'] = $this->length[$index]; // 入力値 @@ -544,13 +554,14 @@ public function getFormDispArray() * パラメーターの削除 * * addParamの逆の関数 + * * @param string $keyname */ public function removeParam($keyname) { $index = array_search($keyname, $this->keyname); - if ($index !== FALSE) { + if ($index !== false) { // 削除 unset($this->disp_name[$index]); unset($this->keyname[$index]); @@ -561,12 +572,12 @@ public function removeParam($keyname) unset($this->input_db[$index]); // 歯抜けになった配列を詰める - $this->disp_name = array_merge($this->disp_name); - $this->keyname = array_merge($this->keyname); - $this->length = array_merge($this->length); - $this->convert = array_merge($this->convert); - $this->arrCheck = array_merge($this->arrCheck); - $this->input_db = array_merge($this->input_db); + $this->disp_name = array_merge($this->disp_name); + $this->keyname = array_merge($this->keyname); + $this->length = array_merge($this->length); + $this->convert = array_merge($this->convert); + $this->arrCheck = array_merge($this->arrCheck); + $this->input_db = array_merge($this->input_db); } } @@ -581,7 +592,7 @@ public function overwriteParam($keyname, $target, $value) { $index = array_search($keyname, $this->keyname); - if ($index !== FALSE) { + if ($index !== false) { if ($target == 'default') { $this->arrDefault[$keyname] = $value; } else { @@ -595,6 +606,7 @@ public function overwriteParam($keyname, $target, $value) * * @param string $keyname 取得するキー名 * @param string $target 項目名(disp_name,length,convert等) + * * @return mixed パラメーターの設定情報 */ public function getParamSetting($keyname = null, $target = null) @@ -612,7 +624,7 @@ public function getParamSetting($keyname = null, $target = null) if (is_null($keyname)) { // 全ての設定情報を取得 $ret = array(); - foreach ($this->keyname as $index=>$key) { + foreach ($this->keyname as $index => $key) { foreach ($arrSetting as $item) { if ($item == 'arrDefault') { $ret[$key]['default'] = $this->{$item}[$key]; @@ -621,6 +633,7 @@ public function getParamSetting($keyname = null, $target = null) } } } + return $ret; } @@ -637,6 +650,7 @@ public function getParamSetting($keyname = null, $target = null) $ret[$item] = $this->{$item}[$index]; } } + return $ret; } diff --git a/data/class/SC_Fpdf.php b/data/class/SC_Fpdf.php index fb7995fc13..5319bf809b 100644 --- a/data/class/SC_Fpdf.php +++ b/data/class/SC_Fpdf.php @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/* * PDF 納品書を出力する * * TODO ページクラスとすべき要素を多々含んでいるように感じる。 @@ -55,6 +55,7 @@ class SC_Fpdf extends SC_Helper_FPDI public $disp_mode; /** @var int */ public $pageno; + public function __construct($download, $title, $tpl_pdf = 'nouhinsyo1.pdf') { parent::__construct(); @@ -66,7 +67,7 @@ public function __construct($download, $title, $tpl_pdf = 'nouhinsyo1.pdf') $this->tpl_dispmode = 'real'; // 表示モード $masterData = new SC_DB_MasterData_Ex(); $this->arrPref = $masterData->getMasterData('mtb_pref'); - $this->width_cell = array(110.3,12,21.7,24.5); + $this->width_cell = array(110.3, 12, 21.7, 24.5); $this->label_cell[] = '商品名 / 商品コード / [ 規格 ]'; $this->label_cell[] = '数量'; @@ -76,14 +77,14 @@ public function __construct($download, $title, $tpl_pdf = 'nouhinsyo1.pdf') $this->arrMessage = array( 'このたびはお買上げいただきありがとうございます。', '下記の内容にて納品させていただきます。', - 'ご確認くださいますよう、お願いいたします。' + 'ご確認くださいますよう、お願いいたします。', ); // SJISフォント $this->AddSJISFont(); $this->SetFont('SJIS'); - //ページ総数取得 + // ページ総数取得 $this->AliasNbPages(); // マージン設定 @@ -103,7 +104,7 @@ public function setData($arrData) // ページを追加(新規) $this->AddPage(); - //表示倍率(100%) + // 表示倍率(100%) $this->SetDisplayMode($this->tpl_dispmode); if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) { @@ -140,24 +141,24 @@ private function setShopData() $this->lfText(125, 74, $text, 8); $this->lfText(125, 77, $arrInfo['law_addr02'], 8); - $text = 'TEL: '.$arrInfo['law_tel01'].'-'.$arrInfo['law_tel02'].'-'.$arrInfo['law_tel03']; - //FAX番号が存在する場合、表示する + $text = 'TEL: ' . $arrInfo['law_tel01'] . '-' . $arrInfo['law_tel02'] . '-' . $arrInfo['law_tel03']; + // FAX番号が存在する場合、表示する if (strlen($arrInfo['law_fax01']) > 0) { - $text .= ' FAX: '.$arrInfo['law_fax01'].'-'.$arrInfo['law_fax02'].'-'.$arrInfo['law_fax03']; + $text .= ' FAX: ' . $arrInfo['law_fax01'] . '-' . $arrInfo['law_fax02'] . '-' . $arrInfo['law_fax03']; } - $this->lfText(125, 80, $text, 8); //TEL・FAX + $this->lfText(125, 80, $text, 8); // TEL・FAX if (strlen($arrInfo['law_email']) > 0) { - $text = 'Email: '.$arrInfo['law_email']; - $this->lfText(125, 83, $text, 8); //Email + $text = 'Email: ' . $arrInfo['law_email']; + $this->lfText(125, 83, $text, 8); // Email } - //ロゴ画像 + // ロゴ画像 $logo_file = PDF_TEMPLATE_REALDIR . 'logo.png'; $this->Image($logo_file, 124, 46, 40); if (defined('INVOICE_REGISTRATION_NUM')) { - $text = '登録番号: '.INVOICE_REGISTRATION_NUM; + $text = '登録番号: ' . INVOICE_REGISTRATION_NUM; $this->lfText(125, 87, $text, 8); } } @@ -165,11 +166,11 @@ private function setShopData() private function setMessageData() { // メッセージ - $this->lfText(27, 89, $this->arrData['msg1'], 8); //メッセージ1 - $this->lfText(27, 92, $this->arrData['msg2'], 8); //メッセージ2 - $this->lfText(27, 95, $this->arrData['msg3'], 8); //メッセージ3 - $text = '作成日: '.$this->arrData['year'].'年'.$this->arrData['month'].'月'.$this->arrData['day'].'日'; - $this->lfText(158, 288, $text, 8); //作成日 + $this->lfText(27, 89, $this->arrData['msg1'], 8); // メッセージ1 + $this->lfText(27, 92, $this->arrData['msg2'], 8); // メッセージ2 + $this->lfText(27, 95, $this->arrData['msg3'], 8); // メッセージ3 + $text = '作成日: ' . $this->arrData['year'] . '年' . $this->arrData['month'] . '月' . $this->arrData['day'] . '日'; + $this->lfText(158, 288, $text, 8); // 作成日 } private function setOrderData() @@ -179,53 +180,53 @@ private function setOrderData() $this->lfGetOrderData($this->arrData['order_id']); // 購入者情報 - $text = '〒 '.$this->arrDisp['order_zip01'].' - '.$this->arrDisp['order_zip02']; - $this->lfText(23, 43, $text, 8); //購入者郵便番号 + $text = '〒 ' . $this->arrDisp['order_zip01'] . ' - ' . $this->arrDisp['order_zip02']; + $this->lfText(23, 43, $text, 8); // 購入者郵便番号 $y = 47; // 住所1の1行目の高さ - $text = $this->arrPref[$this->arrDisp['order_pref']] . $this->arrDisp['order_addr01']; //購入者都道府県+住所1 + $text = $this->arrPref[$this->arrDisp['order_pref']] . $this->arrDisp['order_addr01']; // 購入者都道府県+住所1 - while (mb_strwidth($text) > 68){ + while (mb_strwidth($text) > 68) { $line = mb_strimwidth($text, 0, 68); // 1行分の文字列 $this->lfText(27, $y, $line, 8); $cut = strlen($line); - $text = substr($text, $cut , strlen($text) - $cut); + $text = substr($text, $cut, strlen($text) - $cut); $y = $y + 3; } - if ($text != ""){ + if ($text != "") { $this->lfText(27, $y, $text, 8); $y = $y + 3; } - $text = $this->arrDisp['order_addr02']; //購入者住所2 + $text = $this->arrDisp['order_addr02']; // 購入者住所2 - while (mb_strwidth($text) > 68){ + while (mb_strwidth($text) > 68) { $line = mb_strimwidth($text, 0, 68); // 1行分の文字列 $this->lfText(27, $y, $line, 8); $cut = strlen($line); - $text = substr($text, $cut , strlen($text) - $cut); + $text = substr($text, $cut, strlen($text) - $cut); $y = $y + 3; } - if ($text != ""){ + if ($text != "") { $this->lfText(27, $y, $text, 8); $y = $y + 3; } - $text = $this->arrDisp['order_name01'].' '.$this->arrDisp['order_name02'].' 様'; - $this->lfText(27, $y + 2, $text, 11); //購入者氏名 + $text = $this->arrDisp['order_name01'] . ' ' . $this->arrDisp['order_name02'] . ' 様'; + $this->lfText(27, $y + 2, $text, 11); // 購入者氏名 // お届け先情報 $this->SetFont('SJIS', '', 10); - $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 - $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 + $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); // ご注文日 + $this->lfText(25, 135, $this->arrDisp['order_id'], 10); // 注文番号 $this->SetFont('Gothic', 'B', 15); - $this->Cell(0, 10, $this->tpl_title, 0, 2, 'C', 0, ''); //文書タイトル(納品書・請求書) + $this->Cell(0, 10, $this->tpl_title, 0, 2, 'C', 0, ''); // 文書タイトル(納品書・請求書) $this->Cell(0, 66, '', 0, 2, 'R', 0, ''); $this->Cell(5, 0, '', 0, 0, 'R', 0, ''); $this->SetFont('SJIS', 'B', 15); - $this->Cell(67, 8, number_format($this->arrDisp['payment_total']).' 円', 0, 2, 'R', 0, ''); + $this->Cell(67, 8, number_format($this->arrDisp['payment_total']) . ' 円', 0, 2, 'R', 0, ''); $this->Cell(0, 45, '', 0, 2, '', 0, ''); $this->SetFont('SJIS', '', 8); @@ -246,14 +247,14 @@ private function setOrderData() // 小計(商品毎) $data[2] = $data[0] * $data[1]; - $arrOrder[$i][0] = $this->arrDisp['product_name'][$i].' / '; - $arrOrder[$i][0] .= $this->arrDisp['product_code'][$i].' / '; + $arrOrder[$i][0] = $this->arrDisp['product_name'][$i] . ' / '; + $arrOrder[$i][0] .= $this->arrDisp['product_code'][$i] . ' / '; if ($this->arrDisp['classcategory_name1'][$i]) { - $arrOrder[$i][0] .= ' [ '.$this->arrDisp['classcategory_name1'][$i]; + $arrOrder[$i][0] .= ' [ ' . $this->arrDisp['classcategory_name1'][$i]; if ($this->arrDisp['classcategory_name2'][$i] == '') { $arrOrder[$i][0] .= ' ]'; } else { - $arrOrder[$i][0] .= ' * '.$this->arrDisp['classcategory_name2'][$i].' ]'; + $arrOrder[$i][0] .= ' * ' . $this->arrDisp['classcategory_name2'][$i] . ' ]'; } } @@ -261,9 +262,9 @@ private function setOrderData() if ($this->arrDisp['tax_rate'][$i] < $defaultTaxRule['tax_rate']) { $arrOrder[$i][0] .= ' ※'; } - $arrOrder[$i][1] = number_format($data[0]); - $arrOrder[$i][2] = number_format($data[1]).$monetary_unit; - $arrOrder[$i][3] = number_format($data[2]).$monetary_unit; + $arrOrder[$i][1] = number_format($data[0]); + $arrOrder[$i][2] = number_format($data[1]) . $monetary_unit; + $arrOrder[$i][3] = number_format($data[2]) . $monetary_unit; if (array_key_exists($this->arrDisp['tax_rate'][$i], $arrTaxableTotal) === false) { $arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] = 0; } @@ -279,34 +280,34 @@ private function setOrderData() $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '商品合計'; - $arrOrder[$i][3] = number_format($this->arrDisp['subtotal']).$monetary_unit; + $arrOrder[$i][3] = number_format($this->arrDisp['subtotal']) . $monetary_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '送料'; - $arrOrder[$i][3] = number_format($this->arrDisp['deliv_fee']).$monetary_unit; - $arrTaxableTotal[intval($defaultTaxRule['tax_rate'])] += $this->arrDisp['deliv_fee']; + $arrOrder[$i][3] = number_format($this->arrDisp['deliv_fee']) . $monetary_unit; + $arrTaxableTotal[(int) $defaultTaxRule['tax_rate']] += $this->arrDisp['deliv_fee']; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '手数料'; - $arrOrder[$i][3] = number_format($this->arrDisp['charge']).$monetary_unit; - $arrTaxableTotal[intval($defaultTaxRule['tax_rate'])] += $this->arrDisp['charge']; + $arrOrder[$i][3] = number_format($this->arrDisp['charge']) . $monetary_unit; + $arrTaxableTotal[(int) $defaultTaxRule['tax_rate']] += $this->arrDisp['charge']; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '値引き'; $discount_total = ($this->arrDisp['use_point'] * POINT_VALUE) + $this->arrDisp['discount']; - $arrOrder[$i][3] = '- '.number_format($discount_total).$monetary_unit; + $arrOrder[$i][3] = '- ' . number_format($discount_total) . $monetary_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '請求金額'; - $arrOrder[$i][3] = number_format($this->arrDisp['payment_total']).$monetary_unit; + $arrOrder[$i][3] = number_format($this->arrDisp['payment_total']) . $monetary_unit; // ポイント表記 if ($this->arrData['disp_point'] && $this->arrDisp['customer_id']) { @@ -320,13 +321,13 @@ private function setOrderData() $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '利用ポイント'; - $arrOrder[$i][3] = number_format($this->arrDisp['use_point']).$point_unit; + $arrOrder[$i][3] = number_format($this->arrDisp['use_point']) . $point_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '加算ポイント'; - $arrOrder[$i][3] = number_format($this->arrDisp['add_point']).$point_unit; + $arrOrder[$i][3] = number_format($this->arrDisp['add_point']) . $point_unit; } $this->FancyTable($this->label_cell, $arrOrder, $this->width_cell); @@ -369,7 +370,7 @@ public function createPdf() ob_clean(); if ($this->pdf_download == 1) { if ($this->PageNo() == 1) { - $filename = 'nouhinsyo-No'.$this->arrData['order_id'].'.pdf'; + $filename = 'nouhinsyo-No' . $this->arrData['order_id'] . '.pdf'; } else { $filename = 'nouhinsyo.pdf'; } diff --git a/data/class/SC_Image.php b/data/class/SC_Image.php index e404ccfd72..292a5df5a2 100644 --- a/data/class/SC_Image.php +++ b/data/class/SC_Image.php @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -//---- アップロードファイル加工クラス(thumb.phpとセットで使用する) +// ---- アップロードファイル加工クラス(thumb.phpとセットで使用する) class SC_Image { public $tmp_dir; @@ -32,39 +32,39 @@ public function __construct($tmp_dir) $this->tmp_dir = rtrim($tmp_dir, '/') . '/'; } - //--- 一時ファイル生成(サムネイル画像生成用) + // --- 一時ファイル生成(サムネイル画像生成用) public function makeTempImage($keyname, $max_width, $max_height) { // 一意なIDを取得する。 - $mainname = uniqid('').'.'; + $mainname = uniqid('') . '.'; // 拡張子以外を置き換える。 $newFileName = preg_replace("/^.*\./", $mainname, $_FILES[$keyname]['name']); - $result = $this->MakeThumb($_FILES[$keyname]['tmp_name'], $this->tmp_dir, $max_width, $max_height, $newFileName); + $result = $this->MakeThumb($_FILES[$keyname]['tmp_name'], $this->tmp_dir, $max_width, $max_height, $newFileName); GC_Utils_Ex::gfDebugLog($result); return $newFileName; } - //--- ファイルを指定保存DIRへ移動 + // --- ファイルを指定保存DIRへ移動 public function moveTempImage($filename, $save_dir) { // コピー元ファイル、コピー先ディレクトリが存在する場合にのみ実行する - $from_path = $this->tmp_dir.$filename; - $to_path = $save_dir.'/'.$filename; + $from_path = $this->tmp_dir . $filename; + $to_path = $save_dir . '/' . $filename; if (file_exists($from_path) && file_exists($save_dir)) { if (copy($from_path, $to_path)) { unlink($from_path); } } else { - GC_Utils_Ex::gfDebugLog($from_path.'->'.$to_path.'のcopyに失敗しました。'); + GC_Utils_Ex::gfDebugLog($from_path . '->' . $to_path . 'のcopyに失敗しました。'); } } - //---- 指定ファイルを削除 + // ---- 指定ファイルを削除 public function deleteImage($filename, $dir) { - if (file_exists($dir.'/'.$filename)) { - unlink($dir.'/'.$filename); + if (file_exists($dir . '/' . $filename)) { + unlink($dir . '/' . $filename); } } @@ -86,15 +86,19 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName // 画像の最大縦幅(単位:ピクセル) $ThmMaxHeight = LARGE_IMAGE_HEIGHT; - //拡張子取得 + // 拡張子取得 $array_ext = explode('.', $FromImgPath); $ext = $array_ext[count($array_ext) - 1]; $MW = $ThmMaxWidth; - if ($tmpMW) $MW = $tmpMW; // $MWに最大横幅セット + if ($tmpMW) { + $MW = $tmpMW; + } // $MWに最大横幅セット $MH = $ThmMaxHeight; - if ($tmpMH) $MH = $tmpMH; // $MHに最大縦幅セット + if ($tmpMH) { + $MH = $tmpMH; + } // $MHに最大縦幅セット if (empty($FromImgPath) || empty($ToImgPath)) { return array(0, '出力元画像パス、または出力先フォルダが指定されていません。'); @@ -104,7 +108,7 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName return array(0, '出力元画像が見つかりません。'); } - $size = @GetImageSize($FromImgPath); + $size = @getimagesize($FromImgPath); $re_size = $size; // 画像の種類が不明 or swf @@ -112,7 +116,7 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName return array(0, '画像形式がサポートされていません。'); } - //アスペクト比固定処理 + // アスペクト比固定処理 $tmp_w = $size[0] / $MW; $tmp_h = 0; if ($MH != 0) { @@ -145,7 +149,7 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName $ImgDefault = null; $RetVal = ''; switch ($size[2]) { - case '1': //gif形式 + case '1': // gif形式 if ($tmp_w <= 1 && $tmp_h <= 1) { if ($newFileName) { $ToFile = $newFileName; @@ -154,20 +158,19 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName } else { $ToFile .= '.gif'; } - if (!@copy($FromImgPath, $ToImgPath.$ToFile)) { // エラー処理 - + if (!@copy($FromImgPath, $ToImgPath . $ToFile)) { // エラー処理 return array(0, 'ファイルのコピーに失敗しました。'); } - ImageDestroy($ImgNew); + imagedestroy($ImgNew); return array(1, $ToFile); } - ImageColorAllocate($ImgNew, 255, 235, 214); //背景色 - $black = ImageColorAllocate($ImgNew, 0, 0, 0); - $red = ImageColorAllocate($ImgNew, 255, 0, 0); - Imagestring($ImgNew, 4, 5, 5, "GIF $size[0]x$size[1]", $red); - ImageRectangle($ImgNew, 0, 0, ($re_size[0]-1), ($re_size[1]-1), $black); + imagecolorallocate($ImgNew, 255, 235, 214); // 背景色 + $black = imagecolorallocate($ImgNew, 0, 0, 0); + $red = imagecolorallocate($ImgNew, 255, 0, 0); + imagestring($ImgNew, 4, 5, 5, "GIF $size[0]x$size[1]", $red); + imagerectangle($ImgNew, 0, 0, $re_size[0] - 1, $re_size[1] - 1, $black); if ($newFileName) { $ToFile = $newFileName; @@ -176,22 +179,22 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName } else { $ToFile .= '.png'; } - $TmpPath = $ToImgPath.$ToFile; - @Imagepng($ImgNew, $TmpPath); + $TmpPath = $ToImgPath . $ToFile; + @imagepng($ImgNew, $TmpPath); // 画像が作成されていない場合 if (!@file_exists($TmpPath)) { return array(0, '画像の出力に失敗しました。'); } - ImageDestroy($ImgNew); + imagedestroy($ImgNew); return array(1, $ToFile); - case '2': //jpg形式 - $ImgDefault = ImageCreateFromJpeg($FromImgPath); - //ImageCopyResized($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); + case '2': // jpg形式 + $ImgDefault = imagecreatefromjpeg($FromImgPath); + // ImageCopyResized($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); if ($re_size[0] != $size[0] || $re_size[0] != $size[0]) { - ImageCopyResampled($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); + imagecopyresampled($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); } GC_Utils_Ex::gfDebugLog($size); @@ -204,19 +207,19 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName } else { $ToFile .= '.jpg'; } - $TmpPath = $ToImgPath.$ToFile; - @ImageJpeg($ImgNew, $TmpPath); + $TmpPath = $ToImgPath . $ToFile; + @imagejpeg($ImgNew, $TmpPath); // 画像が作成されていない場合 if (!@file_exists($TmpPath)) { - return array(0, "画像の出力に失敗しました。
${ImgNew}
${TmpPath}"); + return array(0, "画像の出力に失敗しました。
{$ImgNew}
{$TmpPath}"); } $RetVal = $ToFile; break; - case '3': //png形式 - $ImgDefault = ImageCreateFromPNG($FromImgPath); - //ImageCopyResized($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); - ImageCopyResampled($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); + case '3': // png形式 + $ImgDefault = imagecreatefrompng($FromImgPath); + // ImageCopyResized($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); + imagecopyresampled($ImgNew, $ImgDefault, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); if ($newFileName) { $ToFile = $newFileName; @@ -225,8 +228,8 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName } else { $ToFile .= '.png'; } - $TmpPath = $ToImgPath.$ToFile; - @ImagePNG($ImgNew, $TmpPath); + $TmpPath = $ToImgPath . $ToFile; + @imagepng($ImgNew, $TmpPath); // 画像が作成されていない場合 if (!@file_exists($TmpPath)) { return array(0, '画像の出力に失敗しました。'); @@ -236,9 +239,9 @@ public function MakeThumb($FromImgPath, $ToImgPath, $tmpMW, $tmpMH, $newFileName } if (is_resource($ImgDefault)) { - ImageDestroy($ImgDefault); + imagedestroy($ImgDefault); } - ImageDestroy($ImgNew); + imagedestroy($ImgNew); return array(1, $RetVal); } diff --git a/data/class/SC_Initial.php b/data/class/SC_Initial.php index 202e6c3872..7375886275 100644 --- a/data/class/SC_Initial.php +++ b/data/class/SC_Initial.php @@ -25,6 +25,7 @@ * アプリケーションの初期設定クラス. * * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Initial @@ -34,14 +35,13 @@ class SC_Initial */ public function __construct() { - /** EC-CUBEのバージョン */ + /* EC-CUBEのバージョン */ define('ECCUBE_VERSION', '2.17.2-p2'); } /** * 初期設定を行う. * - * @access protected * @return void */ public function init() @@ -63,45 +63,43 @@ public function init() /** * 初期設定ファイルを読み込み, パスの設定を行う. * - * @access protected * @return void */ public function requireInitialConfig() { - define('CONFIG_REALFILE', realpath(dirname(__FILE__)) . '/../config/config.php'); + define('CONFIG_REALFILE', realpath(__DIR__) . '/../config/config.php'); if (file_exists(CONFIG_REALFILE)) { require_once CONFIG_REALFILE; - // heroku用 - } else if (getenv('DATABASE_URL')) { - ini_set( 'display_errors', 1 ); - copy(realpath(dirname(__FILE__)) . '/../../tests/config.php', CONFIG_REALFILE); + // heroku用 + } elseif (getenv('DATABASE_URL')) { + ini_set('display_errors', 1); + copy(realpath(__DIR__) . '/../../tests/config.php', CONFIG_REALFILE); require_once CONFIG_REALFILE; - } else if (!GC_Utils_Ex::isInstallFunction()){ - + } elseif (!GC_Utils_Ex::isInstallFunction()) { // PHP8対応 if (!defined("HTTP_URL")) { - define ('HTTP_URL', ''); - define ('HTTPS_URL', ''); - define ('ROOT_URLPATH', ''); - define ('DOMAIN_NAME', ''); - define ('DB_TYPE', ''); - define ('DB_USER', ''); - define ('DB_PASSWORD', ''); - define ('DB_SERVER', ''); - define ('DB_NAME', ''); - define ('DB_PORT', ''); - define ('ADMIN_DIR', ''); - define ('ADMIN_FORCE_SSL', ""); - define ('ADMIN_ALLOW_HOSTS', ''); - define ('AUTH_MAGIC', ''); - define ('PASSWORD_HASH_ALGOS', 'sha256'); - define ('MAIL_BACKEND', 'mail'); - define ('SMTP_HOST', ''); - define ('SMTP_PORT', ''); - define ('SMTP_USER', ''); - define ('SMTP_PASSWORD', ''); + define('HTTP_URL', ''); + define('HTTPS_URL', ''); + define('ROOT_URLPATH', ''); + define('DOMAIN_NAME', ''); + define('DB_TYPE', ''); + define('DB_USER', ''); + define('DB_PASSWORD', ''); + define('DB_SERVER', ''); + define('DB_NAME', ''); + define('DB_PORT', ''); + define('ADMIN_DIR', ''); + define('ADMIN_FORCE_SSL', ""); + define('ADMIN_ALLOW_HOSTS', ''); + define('AUTH_MAGIC', ''); + define('PASSWORD_HASH_ALGOS', 'sha256'); + define('MAIL_BACKEND', 'mail'); + define('SMTP_HOST', ''); + define('SMTP_PORT', ''); + define('SMTP_USER', ''); + define('SMTP_PASSWORD', ''); } } } @@ -109,8 +107,8 @@ public function requireInitialConfig() /** * DSN を定義する. * - * @access protected * @return void + * * @deprecated 下位互換用 */ public function defineDSN() @@ -119,7 +117,7 @@ public function defineDSN() && defined('DB_SERVER') && defined('DB_PORT') && defined('DB_NAME') ) { $dsn = DB_TYPE . '://' . DB_USER . ':' . DB_PASSWORD . '@' . DB_SERVER . ':' . DB_PORT . '/' . DB_NAME; - /** サイト用DB */ + /* サイト用DB */ // ここで生成した DSN は使用せず, SC_Query のコンストラクタでパラメータを設定する. define('DEFAULT_DSN', $dsn); } @@ -130,7 +128,7 @@ public function defineDSN() */ public function setErrorReporting() { - error_reporting(E_ALL); + error_reporting(\E_ALL); } /** @@ -138,17 +136,16 @@ public function setErrorReporting() * * TODO SJIS-win や, eucJP-win への対応 * - * @access protected * @return void */ public function phpconfigInit() { ini_set('html_errors', '1'); - if (PHP_VERSION_ID < 50600) { + if (\PHP_VERSION_ID < 50600) { ini_set('mbstring.http_input', CHAR_CODE); ini_set('mbstring.http_output', CHAR_CODE); } - if (PHP_VERSION_ID < 80100) { + if (\PHP_VERSION_ID < 80100) { ini_set('auto_detect_line_endings', 1); } ini_set('default_charset', CHAR_CODE); @@ -163,19 +160,19 @@ public function phpconfigInit() ini_set('arg_separator.output', '&'); - //ロケールを明示的に設定 - $res = setlocale(LC_ALL, LOCALE); - if ($res === FALSE) { - if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID >= 70000) { + // ロケールを明示的に設定 + $res = setlocale(\LC_ALL, LOCALE); + if ($res === false) { + if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID >= 70000) { // Windows 版 PHP7 以降の fgetcsv 関数は、日本語のロケールで // UTF-8 のファイルを正常にパースできないため、ロケールを英語に設定する // see https://github.com/EC-CUBE/ec-cube/issues/1780#issuecomment-248557386 - setlocale(LC_ALL, 'English_United States.1252'); + setlocale(\LC_ALL, 'English_United States.1252'); } else { // TODO: Windows上のロケール設定が正常に働かない場合があることに暫定的に対応 // ''を指定するとApache実行環境の環境変数が使われる // See also: http://php.net/manual/ja/function.setlocale.php - setlocale(LC_ALL, ''); + setlocale(\LC_ALL, ''); } } @@ -186,7 +183,6 @@ public function phpconfigInit() /** * 定数 DIR_INDEX_PATH を設定する. * - * @access protected * @return void */ public function defineDirectoryIndex() @@ -222,7 +218,6 @@ public function defineDirectoryIndex() * mtb_constants.php を読み込んで定数として定義する. * キャッシュディレクトリに存在しない場合は, 初期データからコピーする. * - * @access protected * @return void */ public function defineParameter() @@ -236,25 +231,25 @@ public function defineParameter() if (is_file(CACHE_REALDIR . 'mtb_constants.php')) { require_once CACHE_REALDIR . 'mtb_constants.php'; - // キャッシュが無ければ, 初期データからコピー + // キャッシュが無ければ, 初期データからコピー } elseif (is_file(CACHE_REALDIR . '../mtb_constants_init.php')) { $mtb_constants = file_get_contents(CACHE_REALDIR . '../mtb_constants_init.php'); if (is_writable(CACHE_REALDIR)) { $handle = fopen(CACHE_REALDIR . 'mtb_constants.php', 'w'); if (!$handle) { - die($errorMessage); + exit($errorMessage); } if (fwrite($handle, $mtb_constants) === false) { - die($errorMessage); + exit($errorMessage); } fclose($handle); require_once CACHE_REALDIR . 'mtb_constants.php'; } else { - die($errorMessage); + exit($errorMessage); } } else { - die(CACHE_REALDIR . '../mtb_constants_init.php が存在しません'); + exit(CACHE_REALDIR . '../mtb_constants_init.php が存在しません'); } } @@ -264,22 +259,21 @@ public function defineParameter() * ソースのみ差し替えたバージョンアップを考慮したもの。 * SC_Initial_Ex::defineIfNotDefined() で定義することを想定 * - * @access protected * @return void */ public function complementParameter() { // 2.13.0 のデータとの互換用 - /** サイトトップ */ + /* サイトトップ */ SC_Initial_Ex::defineIfNotDefined('TOP_URL', HTTP_URL . DIR_INDEX_PATH); - /** カートトップ */ + /* カートトップ */ SC_Initial_Ex::defineIfNotDefined('CART_URL', HTTP_URL . 'cart/' . DIR_INDEX_PATH); // 2.13.0 のテンプレートとの互換用 // @deprecated 2.13.1 - /** サイトトップ */ + /* サイトトップ */ SC_Initial_Ex::defineIfNotDefined('TOP_URLPATH', ROOT_URLPATH . DIR_INDEX_PATH); - /** カートトップ */ + /* カートトップ */ SC_Initial_Ex::defineIfNotDefined('CART_URLPATH', ROOT_URLPATH . 'cart/' . DIR_INDEX_PATH); } @@ -288,7 +282,6 @@ public function complementParameter() * * Smarty キャッシュディレクトリを生成する. * - * @access protected * @return void */ public function createCacheDir() @@ -316,163 +309,162 @@ public function createCacheDir() /** * 定数定義 * - * @access protected * @return void */ public function defineConstants() { // LC_Page_Error用 - /** 指定商品ページがない */ + /* 指定商品ページがない */ define('PRODUCT_NOT_FOUND', 1); - /** カート内が空 */ + /* カート内が空 */ define('CART_EMPTY', 2); - /** ページ推移エラー */ + /* ページ推移エラー */ define('PAGE_ERROR', 3); - /** 購入処理中のカート商品追加エラー */ + /* 購入処理中のカート商品追加エラー */ define('CART_ADD_ERROR', 4); - /** 他にも購入手続きが行われた場合 */ + /* 他にも購入手続きが行われた場合 */ define('CANCEL_PURCHASE', 5); - /** 指定カテゴリページがない */ + /* 指定カテゴリページがない */ define('CATEGORY_NOT_FOUND', 6); - /** ログインに失敗 */ + /* ログインに失敗 */ define('SITE_LOGIN_ERROR', 7); - /** 会員専用ページへのアクセスエラー */ + /* 会員専用ページへのアクセスエラー */ define('CUSTOMER_ERROR', 8); - /** 購入時の売り切れエラー */ + /* 購入時の売り切れエラー */ define('SOLD_OUT', 9); - /** カート内商品の読込エラー */ + /* カート内商品の読込エラー */ define('CART_NOT_FOUND', 10); - /** ポイントの不足 */ + /* ポイントの不足 */ define('LACK_POINT', 11); - /** 仮登録者がログインに失敗 */ + /* 仮登録者がログインに失敗 */ define('TEMP_LOGIN_ERROR', 12); - /** URLエラー */ + /* URLエラー */ define('URL_ERROR', 13); - /** ファイル解凍エラー */ + /* ファイル解凍エラー */ define('EXTRACT_ERROR', 14); - /** FTPダウンロードエラー */ + /* FTPダウンロードエラー */ define('FTP_DOWNLOAD_ERROR', 15); - /** FTPログインエラー */ + /* FTPログインエラー */ define('FTP_LOGIN_ERROR', 16); - /** FTP接続エラー */ + /* FTP接続エラー */ define('FTP_CONNECT_ERROR', 17); - /** DB作成エラー */ + /* DB作成エラー */ define('CREATE_DB_ERROR', 18); - /** DBインポートエラー */ + /* DBインポートエラー */ define('DB_IMPORT_ERROR', 19); - /** 設定ファイル存在エラー */ + /* 設定ファイル存在エラー */ define('FILE_NOT_FOUND', 20); - /** 書き込みエラー */ + /* 書き込みエラー */ define('WRITE_FILE_ERROR', 21); - /** ダウンロードファイル存在エラー */ + /* ダウンロードファイル存在エラー */ define('DOWNFILE_NOT_FOUND', 22); - /** フリーメッセージ */ + /* フリーメッセージ */ define('FREE_ERROR_MSG', 999); // LC_Page_Error_DispError用 - /** ログイン失敗 */ + /* ログイン失敗 */ define('LOGIN_ERROR', 1); - /** アクセス失敗(タイムアウト等) */ + /* アクセス失敗(タイムアウト等) */ define('ACCESS_ERROR', 2); - /** アクセス権限違反 */ + /* アクセス権限違反 */ define('AUTH_ERROR', 3); - /** 不正な遷移エラー */ + /* 不正な遷移エラー */ define('INVALID_MOVE_ERRORR', 4); // オーナーズストア通信関連 - /** オーナーズストア通信ステータス */ + /* オーナーズストア通信ステータス */ define('OSTORE_STATUS_ERROR', 'ERROR'); - /** オーナーズストア通信ステータス */ + /* オーナーズストア通信ステータス */ define('OSTORE_STATUS_SUCCESS', 'SUCCESS'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_UNKNOWN', '1000'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_INVALID_PARAM', '1001'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_NO_CUSTOMER', '1002'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_WRONG_URL_PASS', '1003'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_NO_PRODUCTS', '1004'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_NO_DL_DATA', '1005'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_DL_DATA_OPEN', '1006'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_DLLOG_AUTH', '1007'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_ADMIN_AUTH', '2001'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_HTTP_REQ', '2002'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_HTTP_RESP', '2003'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_FAILED_JSON_PARSE', '2004'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_NO_KEY', '2005'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_INVALID_ACCESS', '2006'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_INVALID_PARAM', '2007'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_AUTOUP_DISABLE', '2008'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_PERMISSION', '2009'); - /** オーナーズストア通信エラーコード */ + /* オーナーズストア通信エラーコード */ define('OSTORE_E_C_BATCH_ERR', '2010'); // プラグイン関連 - /** プラグインの状態:アップロード済み */ + /* プラグインの状態:アップロード済み */ define('PLUGIN_STATUS_UPLOADED', '1'); - /** プラグインの状態:インストール済み */ + /* プラグインの状態:インストール済み */ define('PLUGIN_STATUS_INSTALLED', '2'); - /** プラグイン有効/無効:有効 */ + /* プラグイン有効/無効:有効 */ define('PLUGIN_ENABLE_TRUE', '1'); - /** プラグイン有効/無効:無効 */ + /* プラグイン有効/無効:無効 */ define('PLUGIN_ENABLE_FALSE', '2'); // CSV入出力関連 - /** CSV入出力列設定有効無効フラグ: 有効 */ + /* CSV入出力列設定有効無効フラグ: 有効 */ define('CSV_COLUMN_STATUS_FLG_ENABLE', 1); - /** CSV入出力列設定有効無効フラグ: 無効 */ + /* CSV入出力列設定有効無効フラグ: 無効 */ define('CSV_COLUMN_STATUS_FLG_DISABLE', 2); - /** CSV入出力列設定読み書きフラグ: 読み書き可能 */ + /* CSV入出力列設定読み書きフラグ: 読み書き可能 */ define('CSV_COLUMN_RW_FLG_READ_WRITE', 1); - /** CSV入出力列設定読み書きフラグ: 読み込みのみ可能 */ + /* CSV入出力列設定読み書きフラグ: 読み込みのみ可能 */ define('CSV_COLUMN_RW_FLG_READ_ONLY', 2); - /** CSV入出力列設定読み書きフラグ: キー列 */ + /* CSV入出力列設定読み書きフラグ: キー列 */ define('CSV_COLUMN_RW_FLG_KEY_FIELD', 3); // 配置ID - /** 配置ID: 未使用 */ + /* 配置ID: 未使用 */ define('TARGET_ID_UNUSED', 0); - /** 配置ID: LeftNavi */ + /* 配置ID: LeftNavi */ define('TARGET_ID_LEFT', 1); - /** 配置ID: MainHead */ + /* 配置ID: MainHead */ define('TARGET_ID_MAIN_HEAD', 2); - /** 配置ID: RightNavi */ + /* 配置ID: RightNavi */ define('TARGET_ID_RIGHT', 3); - /** 配置ID: MainFoot */ + /* 配置ID: MainFoot */ define('TARGET_ID_MAIN_FOOT', 4); - /** 配置ID: TopNavi */ + /* 配置ID: TopNavi */ define('TARGET_ID_TOP', 5); - /** 配置ID: BottomNavi */ + /* 配置ID: BottomNavi */ define('TARGET_ID_BOTTOM', 6); - /** 配置ID: HeadNavi */ + /* 配置ID: HeadNavi */ define('TARGET_ID_HEAD', 7); - /** 配置ID: HeadTopNavi */ + /* 配置ID: HeadTopNavi */ define('TARGET_ID_HEAD_TOP', 8); - /** 配置ID: FooterBottomNavi */ + /* 配置ID: FooterBottomNavi */ define('TARGET_ID_FOOTER_BOTTOM', 9); - /** 配置ID: HeaderInternalNavi */ + /* 配置ID: HeaderInternalNavi */ define('TARGET_ID_HEADER_INTERNAL', 10); // 他 - /** アクセス成功 */ + /* アクセス成功 */ define('SUCCESS', 0); - /** 無制限フラグ: 無制限 */ + /* 無制限フラグ: 無制限 */ define('UNLIMITED_FLG_UNLIMITED', '1'); - /** 無制限フラグ: 制限有り */ + /* 無制限フラグ: 制限有り */ define('UNLIMITED_FLG_LIMITED', '0'); } @@ -481,7 +473,6 @@ public function defineConstants() * * variables_order ディレクティブによる差を吸収する。 * - * @access protected * @return void */ public function resetSuperglobalsRequest() @@ -494,6 +485,7 @@ public function resetSuperglobalsRequest() * * @param string $name 定数の名前。 * @param string $value 定数の値。 + * * @return void */ public static function defineIfNotDefined($name, $value = null) @@ -551,7 +543,7 @@ public function normalizeHostname() $msg .= '要求値=' . var_export($request_hostname, true) . ' '; $msg .= '設定値=' . var_export($correct_hostname, true) . ' '; $msg .= 'リダイレクト先=' . var_export($correct_url, true) . ' '; - trigger_error($msg, E_USER_WARNING); + trigger_error($msg, \E_USER_WARNING); // リダイレクト(恒久的) SC_Response_Ex::sendHttpStatus(301); SC_Response_Ex::sendRedirect($correct_url); @@ -562,9 +554,10 @@ public function normalizeHostname() * PHPバージョン互換処理 * * @deprecated https://github.com/EC-CUBE/ec-cube2/issues/681 が実現したら、外部ライブラリへ移行して、削除する予定。 + * * @return void */ - function compatPhp() + public function compatPhp() { if (!function_exists('str_starts_with')) { /** @@ -572,9 +565,11 @@ function compatPhp() * * @param string $haystack * @param string $needle + * * @return bool */ - function str_starts_with($haystack, $needle) { + function str_starts_with($haystack, $needle) + { return strncmp($haystack, $needle, strlen($needle)) === 0; } } @@ -585,12 +580,14 @@ function str_starts_with($haystack, $needle) { * * @param string $haystack * @param string $needle + * * @return bool */ - function str_ends_with($haystack, $needle) { + function str_ends_with($haystack, $needle) + { $needle_len = strlen($needle); - return substr($haystack, - $needle_len, $needle_len) === $needle; + return substr($haystack, -$needle_len, $needle_len) === $needle; } } } diff --git a/data/class/SC_MobileEmoji.php b/data/class/SC_MobileEmoji.php index 86533174a8..41d69def3a 100644 --- a/data/class/SC_MobileEmoji.php +++ b/data/class/SC_MobileEmoji.php @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/* * 表示できない絵文字を置き換える文字列 (Shift JIS) * デフォルトは空文字列。 */ @@ -29,6 +29,7 @@ /** * 携帯端末の絵文字を扱うクラス + * * @deprecated */ class SC_MobileEmoji @@ -38,6 +39,7 @@ class SC_MobileEmoji * output buffering 用コールバック関数 * * @param string 入力 + * * @return string 出力 */ public static function handler($buffer) @@ -51,6 +53,7 @@ public static function handler($buffer) * 絵文字番号を絵文字を表す Shift JIS の文字列に変換する。 * * @param string $index 絵文字番号 + * * @return string 絵文字を表す Shift JIS の文字列を返す。 */ public function indexToCode($index) @@ -62,7 +65,7 @@ public function indexToCode($index) static $arrMap = array(); if (empty($arrMap)) { - $arrMap = @include_once dirname(__FILE__) . "/../include/mobile_emoji_map_$carrier.inc"; + $arrMap = @include_once __DIR__ . "/../include/mobile_emoji_map_$carrier.inc"; } return isset($arrMap[$index]) ? $arrMap[$index] : MOBILE_EMOJI_SUBSTITUTE; diff --git a/data/class/SC_MobileImage.php b/data/class/SC_MobileImage.php index 406432abca..7f2d169ad5 100644 --- a/data/class/SC_MobileImage.php +++ b/data/class/SC_MobileImage.php @@ -23,11 +23,12 @@ * 端末の画面解像度にあわせて画像を変換する */ -define('MOBILE_IMAGE_INC_REALDIR', realpath(dirname(__FILE__)) . '/../include/'); +define('MOBILE_IMAGE_INC_REALDIR', realpath(__DIR__) . '/../include/'); require_once MOBILE_IMAGE_INC_REALDIR . 'image_converter.inc'; /** * 画像変換クラス + * * @deprecated */ class SC_MobileImage @@ -37,16 +38,17 @@ class SC_MobileImage * output buffering 用コールバック関数 * * @param string 入力 + * * @return string 出力 */ public static function handler($buffer) { // 端末情報を取得する $carrier = SC_MobileUserAgent_Ex::getCarrier(); - $model = SC_MobileUserAgent_Ex::getModel(); + $model = SC_MobileUserAgent_Ex::getModel(); // 携帯電話の場合のみ処理を行う - if ($carrier !== FALSE) { + if ($carrier !== false) { // HTML中のIMGタグを取得する $images = array(); $pattern = '/]*src=[\'"]?([^>"\'\s]+)[\'"]?[^>]*>/i'; @@ -58,13 +60,13 @@ public static function handler($buffer) if ($fp === false) { return $buffer; } - while (($data = fgetcsv($fp, 1000, ',')) !== FALSE) { + while (($data = fgetcsv($fp, 1000, ',')) !== false) { if ($data[1] == $model || $data[1] == '*') { - $cacheSize = $data[2]; + $cacheSize = $data[2]; $imageFileSize = $data[7]; - $imageType = $data[6]; - $imageWidth = $data[5]; - $imageHeight = $data[4]; + $imageType = $data[6]; + $imageWidth = $data[5]; + $imageHeight = $data[4]; break; } } @@ -72,7 +74,7 @@ public static function handler($buffer) // docomoとsoftbankの場合は画像ファイル一つに利用可能なサイズの上限を計算する // auはHTMLのbyte数上限に画像ファイルサイズが含まれないのでimageFileSizeのまま。 - if ($carrier == 'docomo' or $carrier == 'softbank') { + if ($carrier == 'docomo' || $carrier == 'softbank') { if ($result != false && $result > 0) { // 計算式:(利用端末で表示可能なcacheサイズ - HTMLのバイト数 - 変換後の画像名のバイト数(目安値)) / HTML中の画像数 $temp_imagefilesize = ($cacheSize - strlen($buffer) - (140 * $result)) / $result; @@ -87,7 +89,7 @@ public static function handler($buffer) } // 画像変換の情報をセットする - $imageConverter = New ImageConverter(); + $imageConverter = new ImageConverter(); $imageConverter->setOutputDir(MOBILE_IMAGE_REALDIR); $imageConverter->setImageType($imageType); $imageConverter->setImageWidth($imageWidth); @@ -97,11 +99,11 @@ public static function handler($buffer) // HTML中のIMGタグを変換後のファイルパスに置換する foreach ($images[1] as $key => $path) { // resize_image.phpは除外 - if (stripos($path, ROOT_URLPATH . 'resize_image.php') !== FALSE) { + if (stripos($path, ROOT_URLPATH . 'resize_image.php') !== false) { continue; } - $realpath = html_entity_decode($path, ENT_QUOTES); + $realpath = html_entity_decode($path, \ENT_QUOTES); $realpath = substr_replace($realpath, HTML_REALDIR, 0, strlen(ROOT_URLPATH)); $converted = $imageConverter->execute($realpath); if (isset($converted['outputImageName'])) { diff --git a/data/class/SC_MobileUserAgent.php b/data/class/SC_MobileUserAgent.php index f396885b27..38017d5d83 100644 --- a/data/class/SC_MobileUserAgent.php +++ b/data/class/SC_MobileUserAgent.php @@ -26,6 +26,7 @@ * * 対象とする携帯端末は $_SERVER から決定する。 * 全てのメソッドはクラスメソッド。 + * * @deprecated */ class SC_MobileUserAgent @@ -37,11 +38,13 @@ class SC_MobileUserAgent * * @return string|false 携帯端末のキャリアを表す文字列を返す。 * 携帯端末ではない場合は false を返す。 + * * @deprecated */ public static function getCarrier() { - trigger_error('Net_UserAgent_Mobile is deprecated', E_USER_DEPRECATED); + @trigger_error('Net_UserAgent_Mobile is deprecated', \E_USER_DEPRECATED); + return false; } @@ -54,11 +57,13 @@ public static function getCarrier() * + softbank ... 端末シリアル番号 * * @deprecated + * * @return string|false 取得したIDを返す。取得できなかった場合は false を返す。 */ public static function getId() { - trigger_error('Net_UserAgent_Mobile is deprecated', E_USER_DEPRECATED); + @trigger_error('Net_UserAgent_Mobile is deprecated', \E_USER_DEPRECATED); + return false; } @@ -70,7 +75,8 @@ public static function getId() */ public static function getModel() { - trigger_error('Net_UserAgent_Mobile is deprecated', E_USER_DEPRECATED); + @trigger_error('Net_UserAgent_Mobile is deprecated', \E_USER_DEPRECATED); + return false; } @@ -88,7 +94,8 @@ public static function getModel() */ public static function isSupported() { - trigger_error('Net_UserAgent_Mobile is deprecated', E_USER_DEPRECATED); + @trigger_error('Net_UserAgent_Mobile is deprecated', \E_USER_DEPRECATED); + return false; } @@ -101,7 +108,8 @@ public static function isSupported() */ public function isMobile() { - trigger_error('Net_UserAgent_Mobile is deprecated', E_USER_DEPRECATED); + @trigger_error('Net_UserAgent_Mobile is deprecated', \E_USER_DEPRECATED); + return false; } } diff --git a/data/class/SC_PageNavi.php b/data/class/SC_PageNavi.php index d0d9e2febc..e0578bee5c 100644 --- a/data/class/SC_PageNavi.php +++ b/data/class/SC_PageNavi.php @@ -47,6 +47,7 @@ class SC_PageNavi public $strnavi; // ページ送り文字列 public $arrPagenavi = array(); // ページ public $all_row; + /** * コンストラクタ * @@ -56,24 +57,24 @@ public function __construct($now_page, $all_row, $page_row, $func_name, $navi_ma { $this->arrPagenavi['mode'] = 'search'; - //現在ページ($now_page)が正しい数値でない場合 + // 現在ページ($now_page)が正しい数値でない場合 if (!preg_match("/^[[:digit:]]+$/", $now_page) || $now_page < 1 || strlen($now_page) == 0) { $this->now_page = 1; } else { - $this->now_page = htmlspecialchars($now_page, ENT_QUOTES, CHAR_CODE); + $this->now_page = htmlspecialchars($now_page, \ENT_QUOTES, CHAR_CODE); } $this->arrPagenavi['now_page'] = $this->now_page; // 最終ページの計算 - $this->max_page = ceil($all_row/$page_row); + $this->max_page = ceil($all_row / $page_row); // 最終ページよりも現在ページが大きい場合は、最初に戻す。 if ($this->max_page < $this->now_page) { $this->now_page = 1; } - $this->start_row = ($this->now_page - 1) * $page_row; - $this->all_row = $all_row; + $this->start_row = ($this->now_page - 1) * $page_row; + $this->all_row = $all_row; // 開始行が不正な場合 if (!($this->start_row < $all_row && $this->start_row >= 0)) { @@ -81,13 +82,13 @@ public function __construct($now_page, $all_row, $page_row, $func_name, $navi_ma } if ($all_row > 1) { - //「前へ」「次へ」の設定 + // 「前へ」「次へ」の設定 $before = ''; $next = ''; if ($this->now_page > 1) { $this->arrPagenavi['before'] = $this->now_page - 1; $urlParamThis = str_replace('#page#', $this->arrPagenavi['before'], $urlParam); - $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES); + $urlParamThis = htmlentities($urlParamThis, \ENT_QUOTES); $before = "arrPagenavi['before']}'); return false;\"><<前へ "; } else { $this->arrPagenavi['before'] = $this->now_page; @@ -96,7 +97,7 @@ public function __construct($now_page, $all_row, $page_row, $func_name, $navi_ma if ($this->now_page < $this->max_page) { $this->arrPagenavi['next'] = $this->now_page + 1; $urlParamThis = str_replace('#page#', $this->arrPagenavi['next'], $urlParam); - $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES); + $urlParamThis = htmlentities($urlParamThis, \ENT_QUOTES); $next = " arrPagenavi['next']}'); return false;\">次へ>>"; } else { $this->arrPagenavi['next'] = $this->now_page; @@ -131,7 +132,7 @@ public function __construct($now_page, $all_row, $page_row, $func_name, $navi_ma $page_number .= "$i"; } else { $urlParamThis = str_replace('#page#', $i, $urlParam); - $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES); + $urlParamThis = htmlentities($urlParamThis, \ENT_QUOTES); $page_number .= "$i"; } @@ -141,9 +142,9 @@ public function __construct($now_page, $all_row, $page_row, $func_name, $navi_ma } if ($before && $next) { - $this->strnavi = $before .(($display_number) ? $page_number : ' | ') .$next; + $this->strnavi = $before . (($display_number) ? $page_number : ' | ') . $next; } elseif ($before || $next) { - $this->strnavi = $before .(($display_number) ? $page_number : '') .$next; + $this->strnavi = $before . (($display_number) ? $page_number : '') . $next; } } else { $this->arrPagenavi['arrPageno'][0] = 1; diff --git a/data/class/SC_Product.php b/data/class/SC_Product.php index 9b99d0beb9..257181c556 100644 --- a/data/class/SC_Product.php +++ b/data/class/SC_Product.php @@ -26,6 +26,7 @@ * * @author EC-CUBE CO.,LTD. * @author Kentaro Ohkouchi + * * @version $Id$ */ class SC_Product @@ -61,6 +62,7 @@ class SC_Product * @param string $col 並び替えの基準とするフィールド * @param string $table 並び替えの基準とするフィールドがあるテーブル * @param string $order 並び替えの順序 ASC / DESC + * * @return void */ public function setProductsOrder($col, $table = 'dtb_products', $order = 'ASC') @@ -75,13 +77,14 @@ public function setProductsOrder($col, $table = 'dtb_products', $order = 'ASC') * * @param SC_Query $objQuery SC_Query インスタンス * @param array $arrVal 検索パラメーターの配列 + * * @return array 商品IDの配列 */ public function findProductIdsOrder(&$objQuery, $arrVal = array()) { $table = 'dtb_products AS alldtl'; - if (is_array($this->arrOrderData) and $objQuery->order == '') { + if (is_array($this->arrOrderData) && $objQuery->order == '') { $o_col = $this->arrOrderData['col']; $o_table = $this->arrOrderData['table']; $o_order = $this->arrOrderData['order']; @@ -103,6 +106,7 @@ public function findProductIdsOrder(&$objQuery, $arrVal = array()) * * @param SC_Query $objQuery SC_Query インスタンス * @param array $arrVal 検索パラメーターの配列 + * * @return integer 対象商品ID数 */ public function findProductCount(&$objQuery, $arrVal = array()) @@ -121,6 +125,7 @@ public function findProductCount(&$objQuery, $arrVal = array()) * * @param SC_Query $objQuery SC_Query インスタンス * @param array $product_ids 商品IDの配列 + * * @return array 商品一覧の配列 */ public function lists(&$objQuery, $product_ids = array()) @@ -163,6 +168,7 @@ public function lists(&$objQuery, $product_ids = array()) * * @param SC_Query $objQuery SC_Query インスタンス * @param array $arrProductId 商品ID + * * @return array 商品一覧の配列 (キー: 商品ID) */ public function getListByProductIds(&$objQuery, $arrProductId = array()) @@ -191,7 +197,7 @@ public function getListByProductIds(&$objQuery, $arrProductId = array()) foreach ($arrProductId as $product_id) { $arrTmp[$product_id] = $arrProducts[$product_id]; } - $arrProducts =& $arrTmp; + $arrProducts = &$arrTmp; unset($arrTmp); } @@ -205,6 +211,7 @@ public function getListByProductIds(&$objQuery, $arrProductId = array()) * 商品詳細を取得する. * * @param integer $product_id 商品ID + * * @return array 商品詳細情報の配列 */ public function getDetail($product_id) @@ -216,7 +223,7 @@ public function getDetail($product_id) // SC_DB_DBFactory::alldtlSQL() で生成される追加条件のため // product_id の配列を生成ておく $arrWhereVal = array($product_id, $product_id, $product_id); - $arrProduct = (array)$objQuery->getRow('*', $from, $where, $arrWhereVal); + $arrProduct = (array) $objQuery->getRow('*', $from, $where, $arrWhereVal); // 税込金額を設定する SC_Product_Ex::setIncTaxToProduct($arrProduct); @@ -228,6 +235,7 @@ public function getDetail($product_id) * 商品詳細情報と商品規格を取得する. * * @param integer $productClassId 商品規格ID + * * @return array 商品詳細情報と商品規格の配列 */ public function getDetailAndProductsClass($productClassId) @@ -246,6 +254,7 @@ public function getDetailAndProductsClass($productClassId) * * @param array $arrProductId 商品ID の配列 * @param boolean $has_deleted 削除された商品規格も含む場合 true; 初期値 false + * * @return void */ public function setProductsClassByProductIds($arrProductId, $has_deleted = false) @@ -349,6 +358,7 @@ public function setProductsClassByProductIds($arrProductId, $has_deleted = false * * @param SC_Query $objQuery SC_Queryインスタンス * @param array $params 検索パラメーターの配列 + * * @return array 商品規格の配列 */ public function getProductsClassByQuery(&$objQuery, $params) @@ -404,6 +414,7 @@ public function getProductsClassByQuery(&$objQuery, $params) * 削除された商品規格は取得しない. * * @param integer $productClassId 商品規格ID + * * @return array 商品規格の配列 */ public function getProductsClass($productClassId) @@ -430,6 +441,7 @@ public function getProductsClass($productClassId) * * @param array $productIds 商品IDの配列 * @param boolean $has_deleted 削除された商品規格も含む場合 true; 初期値 false + * * @return array 商品規格の配列 */ public function getProductsClassByProductIds($productIds = array(), $has_deleted = false) @@ -452,6 +464,7 @@ public function getProductsClassByProductIds($productIds = array(), $has_deleted * * @param array $productId 商品ID * @param boolean $has_deleted 削除された商品規格も含む場合 true; 初期値 false + * * @return array 全ての組み合わせの商品規格の配列 */ public function getProductsClassFullByProductId($productId, $has_deleted = false) @@ -465,6 +478,7 @@ public function getProductsClassFullByProductId($productId, $has_deleted = false * 商品IDをキーにした, 商品ステータスIDの配列を取得する. * * @param array 商品ID の配列 + * * @return array 商品IDをキーにした商品ステータスIDの配列 */ public function getProductStatus($productIds) @@ -504,7 +518,9 @@ public function setProductStatus($productId, $productStatusIds) $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->delete('dtb_product_status', 'product_id = ?', array($productId)); foreach ($productStatusIds as $productStatusId) { - if ($productStatusId == '') continue; + if ($productStatusId == '') { + continue; + } $val['product_status_id'] = $productStatusId; $objQuery->insert('dtb_product_status', $val); } @@ -516,7 +532,9 @@ public function setProductStatus($productId, $productStatusIds) * getDetailAndProductsClass() の結果から, 販売制限数を取得する. * * @param array $p 商品詳細の検索結果の配列 + * * @return integer 商品詳細の結果から求めた販売制限数. + * * @see getDetailAndProductsClass() */ public function getBuyLimit($p) @@ -543,6 +561,7 @@ public function getBuyLimit($p) * * @param integer $productClassId 商品規格ID * @param integer $quantity 減少させる在庫数 + * * @return boolean 在庫の減少に成功した場合 true; 失敗した場合 false */ public function reduceStock($productClassId, $quantity) @@ -553,8 +572,8 @@ public function reduceStock($productClassId, $quantity) $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->update('dtb_products_class', array(), - 'product_class_id = ?', array($productClassId), - array('stock' => 'stock - ?'), array($quantity)); + 'product_class_id = ?', array($productClassId), + array('stock' => 'stock - ?'), array($quantity)); // TODO エラーハンドリング $productsClass = $this->getDetailAndProductsClass($productClassId); @@ -571,6 +590,7 @@ public function reduceStock($productClassId, $quantity) * この関数は, 主にスマートフォンで使用します. * * @param array $arrProducts 商品情報の配列 + * * @return array 旧バージョン互換用のデータ */ public static function setPriceTaxTo(&$arrProducts) @@ -591,10 +611,10 @@ public static function setPriceTaxTo(&$arrProducts) // @deprecated 2.12.4 // 旧バージョン互換用 // 本来は、税額の代入で使用すべきキー名。 - $arrProduct['price01_min_tax_format'] =& $arrProduct['price01_min_inctax_format']; - $arrProduct['price01_max_tax_format'] =& $arrProduct['price01_max_inctax_format']; - $arrProduct['price02_min_tax_format'] =& $arrProduct['price02_min_inctax_format']; - $arrProduct['price02_max_tax_format'] =& $arrProduct['price02_max_inctax_format']; + $arrProduct['price01_min_tax_format'] = &$arrProduct['price01_min_inctax_format']; + $arrProduct['price01_max_tax_format'] = &$arrProduct['price01_max_inctax_format']; + $arrProduct['price02_min_tax_format'] = &$arrProduct['price02_min_inctax_format']; + $arrProduct['price02_max_tax_format'] = &$arrProduct['price02_max_inctax_format']; } // @deprecated 2.12.4 // 旧バージョン互換用 @@ -606,6 +626,7 @@ public static function setPriceTaxTo(&$arrProducts) * 商品情報の配列に税込金額を設定する * * @param array $arrProducts 商品情報の配列 + * * @return void */ public static function setIncTaxToProducts(&$arrProducts) @@ -619,6 +640,7 @@ public static function setIncTaxToProducts(&$arrProducts) * 商品情報の配列に税込金額を設定する * * @param array $arrProduct 商品情報の配列 + * * @return void */ public static function setIncTaxToProduct(&$arrProduct) @@ -634,6 +656,7 @@ public static function setIncTaxToProduct(&$arrProduct) * * @param string $where_products_class 商品規格情報の WHERE 句 * @param array $product_ids 商品IDの配列 + * * @return string 商品詳細の SQL */ public static function alldtlSQL($where_products_class = '', $product_ids = array()) @@ -649,6 +672,7 @@ public static function alldtlSQL($where_products_class = '', $product_ids = arra * MEMO: 2.4系 vw_product_classに相当(?)するイメージ * * @param string $where 商品詳細の WHERE 句 + * * @return string 商品規格詳細の SQL */ public static function prdclsSQL($where = '') @@ -709,6 +733,7 @@ public static function getProductDispConditions($tablename = null) * * @param int $product_id * @param bool $include_hidden + * * @return array */ public function getCategoryIds($product_id, $include_hidden = false) @@ -730,6 +755,7 @@ public function getCategoryIds($product_id, $include_hidden = false) * @param int $product_id * @param bool $include_hidden * @param bool $include_deleted + * * @return bool */ public function isValidProductId($product_id, $include_hidden = false, $include_deleted = false) @@ -751,6 +777,7 @@ public function isValidProductId($product_id, $include_hidden = false, $include_ ) { return true; } + return false; } } diff --git a/data/class/SC_Query.php b/data/class/SC_Query.php index e114aa24e4..168804946c 100644 --- a/data/class/SC_Query.php +++ b/data/class/SC_Query.php @@ -27,6 +27,7 @@ * TODO エラーハンドリング, ロギング方法を見直す * * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Query @@ -55,12 +56,12 @@ public function __construct($dsn = '', $force_run = false, $new = false) { if ($dsn == '') { $dsn = array( - 'phptype' => DB_TYPE, + 'phptype' => DB_TYPE, 'username' => DB_USER, 'password' => DB_PASSWORD, 'protocol' => 'tcp', 'hostspec' => DB_SERVER, - 'port' => DB_PORT, + 'port' => DB_PORT, 'database' => DB_NAME, ); } @@ -107,6 +108,7 @@ public function __construct($dsn = '', $force_run = false, $new = false) * @param string $dsn データソース名 * @param boolean $force_run エラーが発生しても処理を続行する場合 true * @param boolean $new 新規に接続を行うかどうか + * * @return SC_Query シングルトンの SC_Query インスタンス */ public static function getSingletonInstance($dsn = '', $force_run = false, $new = false) @@ -129,6 +131,7 @@ public static function getSingletonInstance($dsn = '', $force_run = false, $new * エラー判定を行う. * * @deprecated PEAR::isError() を使用して下さい + * * @return boolean */ public function isError() @@ -146,6 +149,7 @@ public function isError() * @param string $table テーブル名 * @param string $where where句 * @param array $arrWhereVal プレースホルダ + * * @return integer 件数 */ public function count($table, $where = '', $arrWhereVal = array()) @@ -159,6 +163,7 @@ public function count($table, $where = '', $arrWhereVal = array()) * @param string $table テーブル名 * @param string $where where句 * @param array $arrWhereVal プレースホルダ + * * @return boolean 有無 */ public function exists($table, $where = '', $arrWhereVal = array()) @@ -178,6 +183,7 @@ public function exists($table, $where = '', $arrWhereVal = array()) * @param string $where WHERE句 * @param array $arrWhereVal プレースホルダ * @param integer $fetchmode 使用するフェッチモード。デフォルトは MDB2_FETCHMODE_ASSOC。 + * * @return array|null */ public function select($cols, $from = '', $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) @@ -191,6 +197,7 @@ public function select($cols, $from = '', $where = '', $arrWhereVal = array(), $ * 直前に実行されたSQL文を取得する. * * @param boolean $disp trueの場合、画面出力を行う. + * * @return string SQL文 */ public function getLastQuery($disp = true) @@ -273,6 +280,7 @@ public function exec($str, $arrVal = array()) * @param string $sql SQL クエリ * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 * @param integer $fetchmode 使用するフェッチモード。デフォルトは DB_FETCHMODE_ASSOC。 + * * @return boolean 結果 */ public function doCallbackAll($cbFunc, $sql, $arrVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) @@ -306,6 +314,7 @@ public function doCallbackAll($cbFunc, $sql, $arrVal = array(), $fetchmode = MDB * @param string $sql SQL クエリ * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 * @param integer $fetchmode 使用するフェッチモード。デフォルトは DB_FETCHMODE_ASSOC。 + * * @return array データを含む2次元配列。失敗した場合に 0 または DB_Error オブジェクトを返します。 */ public function getAll($sql, $arrVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) @@ -335,10 +344,12 @@ public function getAll($sql, $arrVal = array(), $fetchmode = MDB2_FETCHMODE_ASSO * 構築した SELECT 文を取得する. * * クラス変数から WHERE 句を組み立てる場合、$arrWhereVal を経由してプレースホルダもクラス変数のもので上書きする。 + * * @param string $cols SELECT 文に含めるカラム名 * @param string $from SELECT 文に含めるテーブル名 * @param string $where SELECT 文に含める WHERE 句 * @param mixed $arrWhereVal プレースホルダ(参照) + * * @return string 構築済みの SELECT 文 */ public function getSql($cols, $from = '', $where = '', &$arrWhereVal = null) @@ -376,6 +387,7 @@ public function getSql($cols, $from = '', $where = '', &$arrWhereVal = null) * この関数で設定した値は SC_Query::getSql() で使用されます. * * @param string $str 付与する SQL 文 + * * @return SC_Query 自分自身のインスタンス */ public function setOption($str) @@ -392,6 +404,7 @@ public function setOption($str) * * @param integer $limit LIMIT 句に付与する値 * @param integer $offset OFFSET 句に付与する値 + * * @return SC_Query 自分自身のインスタンス */ public function setLimitOffset($limit, $offset = 0) @@ -409,6 +422,7 @@ public function setLimitOffset($limit, $offset = 0) * この関数で設定した値は SC_Query::getSql() で使用されます. * * @param string $str GROUP BY 句に付与する文字列 + * * @return SC_Query 自分自身のインスタンス */ public function setGroupBy($str) @@ -428,6 +442,7 @@ public function setGroupBy($str) * この関数で設定した値は SC_Query::getSql() で使用されます. * * @param string $str WHERE 句に付与する AND 条件の文字列 + * * @return SC_Query 自分自身のインスタンス */ public function andWhere($str) @@ -447,6 +462,7 @@ public function andWhere($str) * この関数で設定した値は SC_Query::getSql() で使用されます. * * @param string $str WHERE 句に付与する OR 条件の文字列 + * * @return SC_Query 自分自身のインスタンス */ public function orWhere($str) @@ -467,6 +483,7 @@ public function orWhere($str) * * @param string $where WHERE 句に付与する文字列 * @param mixed $arrWhereVal プレースホルダ + * * @return SC_Query 自分自身のインスタンス */ public function setWhere($where = '', $arrWhereVal = array()) @@ -483,6 +500,7 @@ public function setWhere($where = '', $arrWhereVal = array()) * この関数で設定した値は SC_Query::getSql() で使用されます. * * @param string $str ORDER BY 句に付与する文字列 + * * @return SC_Query 自分自身のインスタンス */ public function setOrder($str) @@ -502,6 +520,7 @@ public function setOrder($str) * この関数で設定した値は SC_Query::getSql() で使用されます. * * @param integer $limit LIMIT 句に設定する値 + * * @return SC_Query 自分自身のインスタンス */ public function setLimit($limit) @@ -519,6 +538,7 @@ public function setLimit($limit) * この関数で設定した値は SC_Query::getSql() で使用されます. * * @param integer $offset OFFSET 句に設定する値 + * * @return SC_Query 自分自身のインスタンス */ public function setOffset($offset) @@ -539,6 +559,7 @@ public function setOffset($offset) * @param array $arrSqlVal SQL文の中で使用するプレースホルダ配列 * @param string $from FROM 句・WHERE 句 * @param array $arrFromVal FROM 句・WHERE 句で使用するプレースホルダ配列 + * * @return integer|DB_Error|boolean 挿入件数またはエラー(DB_Error, false) */ public function insert($table, $arrVal, $arrSql = array(), $arrSqlVal = array(), $from = '', $arrFromVal = array()) @@ -597,6 +618,7 @@ public function insert($table, $arrVal, $arrSql = array(), $arrSqlVal = array(), * @param array $arrWhereVal WHERE句用のプレースホルダ配列 (従来は追加カラム用も兼ねていた) * @param array $arrRawSql 追加カラム * @param array $arrRawSqlVal 追加カラム用のプレースホルダ配列 + * * @return */ public function update($table, $arrVal, $where = '', $arrWhereVal = array(), $arrRawSql = array(), $arrRawSqlVal = array()) @@ -653,6 +675,7 @@ public function update($table, $arrVal, $where = '', $arrWhereVal = array(), $ar * @param string $col カラム名 * @param string $where 付与する WHERE 句 * @param array $arrWhereVal プレースホルダに挿入する値 + * * @return integer MAX文の実行結果 */ public function max($col, $table, $where = '', $arrWhereVal = array()) @@ -669,6 +692,7 @@ public function max($col, $table, $where = '', $arrWhereVal = array()) * @param string $col カラム名 * @param string $where 付与する WHERE 句 * @param array $arrWhereVal プレースホルダに挿入する値 + * * @return integer MIN文の実行結果 */ public function min($col, $table, $where = '', $arrWhereVal = array()) @@ -685,6 +709,7 @@ public function min($col, $table, $where = '', $arrWhereVal = array()) * @param string $col カラム名 * @param string $where 付与する WHERE 句 * @param array $arrWhereVal プレースホルダに挿入する値 + * * @return mixed SQL の実行結果 */ public function get($col, $table = '', $where = '', $arrWhereVal = array()) @@ -701,6 +726,7 @@ public function get($col, $table = '', $where = '', $arrWhereVal = array()) * * @param string $sql 実行する SQL * @param array $arrVal プレースホルダに挿入する値 + * * @return mixed SQL の実行結果 */ public function getOne($sql, $arrVal = array()) @@ -734,6 +760,7 @@ public function getOne($sql, $arrVal = array()) * @param string $where WHERE句 * @param array $arrWhereVal プレースホルダ配列 * @param integer $fetchmode 使用するフェッチモード。デフォルトは MDB2_FETCHMODE_ASSOC。 + * * @return array array('カラム名' => '値', ...)の連想配列 */ public function getRow($col, $table = '', $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) @@ -767,6 +794,7 @@ public function getRow($col, $table = '', $where = '', $arrWhereVal = array(), $ * @param string $col カラム名 * @param string $where 付与する WHERE 句 * @param array $arrWhereVal プレースホルダに挿入する値 + * * @return array SQL の実行結果の配列 */ public function getCol($col, $table = '', $where = '', $arrWhereVal = array()) @@ -799,6 +827,7 @@ public function getCol($col, $table = '', $where = '', $arrWhereVal = array()) * @param string $table テーブル名 * @param string $where WHERE句 * @param array $arrWhereVal プレースホルダ + * * @return */ public function delete($table, $where = '', $arrWhereVal = array()) @@ -828,6 +857,7 @@ public function nextVal($seq_name) * 現在のシーケンス値を取得する. * * @param string $seq_name 取得するシーケンス名 + * * @return integer 現在のシーケンス値 */ public function currVal($seq_name) @@ -840,6 +870,7 @@ public function currVal($seq_name) * * @param string $seq_name シーケンス名 * @param integer $start 設定するシーケンス値 + * * @return MDB2_OK */ public function setVal($seq_name, $start) @@ -870,9 +901,10 @@ public function setVal($seq_name, $start) * @param boolean $ignore_err MDB2切替で無効化されている (エラーが発生しても処理を続行する場合 true) * @param mixed $types プレースホルダの型指定 デフォルトnull = string * @param mixed $result_types 返値の型指定またはDML実行(MDB2_PREPARE_MANIP) + * * @return array SQL の実行結果の配列 */ - public function query($n ,$arr = array(), $ignore_err = false, $types = null, $result_types = MDB2_PREPARE_RESULT) + public function query($n, $arr = array(), $ignore_err = false, $types = null, $result_types = MDB2_PREPARE_RESULT) { $n = $this->dbFactory->sfChangeMySQL($n); @@ -918,6 +950,7 @@ public function listTables() * テーブルのカラム一覧を取得する. * * @param string $table テーブル名 + * * @return array 指定のテーブルのカラム名の配列 */ public function listTableFields($table) @@ -931,6 +964,7 @@ public function listTableFields($table) * テーブルのインデックス一覧を取得する. * * @param string $table テーブル名 + * * @return array 指定のテーブルのインデックス一覧 */ public function listTableIndexes($table) @@ -973,13 +1007,14 @@ public function dropIndex($table, $name) * テーブルの詳細情報を取得する。 * * @param string $table テーブル名 + * * @return array テーブル情報の配列 */ public function getTableInfo($table) { $objManager = $this->conn->loadModule('Reverse'); - return $objManager->tableInfo($table, NULL); + return $objManager->tableInfo($table, null); } /** @@ -990,7 +1025,9 @@ public function getTableInfo($table) * 本来であれば, MDB2::prepare() を適切に使用するべき * * @see MDB2::quote() + * * @param string $val クォートを行う文字列 + * * @return string クォートされた文字列 */ public function quote($val) @@ -1003,6 +1040,7 @@ public function quote($val) * * @param string $table テーブル名 * @param array プレースホルダの連想配列 + * * @return array テーブルに存在する列のみ抽出した連想配列 */ public function extractOnlyColsOf($table, $arrParams) @@ -1021,10 +1059,10 @@ public function extractOnlyColsOf($table, $arrParams) /** * プリペアドステートメントを構築する. * - * @access private * @param string $sql プリペアドステートメントを構築する SQL * @param mixed $types プレースホルダの型指定 デフォルト null * @param mixed $result_types 返値の型指定またはDML実行(MDB2_PREPARE_MANIP)、nullは指定無し + * * @return MDB2_Statement_Common プリペアドステートメントインスタンス */ public function prepare($sql, $types = null, $result_types = MDB2_PREPARE_RESULT) @@ -1041,9 +1079,9 @@ public function prepare($sql, $types = null, $result_types = MDB2_PREPARE_RESULT /** * プリペアドクエリを実行する. * - * @access private * @param MDB2_Statement_Common プリペアドステートメントインスタンス * @param array $arrVal プレースホルダに挿入する配列 + * * @return MDB2_Result 結果セットのインスタンス */ public function execute(&$sth, $arrVal = array()) @@ -1076,10 +1114,11 @@ public function execute(&$sth, $arrVal = array()) * * XXX trigger_error で処理する場合、1024文字以内に抑える必要がある。 * XXX 重要な情報を先頭に置き、冗長になりすぎないように留意する。 - * @access private + * * @param PEAR::Error $error PEAR::Error インスタンス * @param string $sql エラーの発生した SQL 文 * @param array $arrVal プレースホルダ + * * @return string トレースしたエラー文字列 */ public function traceError($error, $sql = '', $arrVal = false) @@ -1103,7 +1142,7 @@ public function error($msg) { $msg = "DB処理でエラーが発生しました。\n" . $msg; if (!$this->force_run) { - trigger_error($msg, E_USER_ERROR); + trigger_error($msg, \E_USER_ERROR); } else { GC_Utils_Ex::gfPrintLog($msg, ERROR_LOG_REALFILE, true); } @@ -1117,9 +1156,10 @@ public function error($msg) * @param boolean エラーが発生しても処理を続行する場合 true * @param mixed $types プレースホルダの型指定 デフォルトnull = string * @param mixed $result_types 返値の型指定またはDML実行(MDB2_PREPARE_MANIP) + * * @return array 実行結果の配列 */ - public function getQueryDefsFields($n ,$arr = array(), $ignore_err = false, $types = null, $result_types = MDB2_PREPARE_RESULT) + public function getQueryDefsFields($n, $arr = array(), $ignore_err = false, $types = null, $result_types = MDB2_PREPARE_RESULT) { $n = $this->dbFactory->sfChangeMySQL($n); @@ -1144,6 +1184,7 @@ public function getQueryDefsFields($n ,$arr = array(), $ignore_err = false, $typ * * @param string 実行するSQL文 * @param array $arrVal プレースホルダに挿入する配列 + * * @return array */ private function lfStartDbTraceLog(&$objSth, &$arrVal) @@ -1154,7 +1195,7 @@ private function lfStartDbTraceLog(&$objSth, &$arrVal) if (!array_key_exists('_SC_Query_TraceLogInfo', $GLOBALS)) { $GLOBALS['_SC_Query_TraceLogInfo'] = array(); } - $arrInfo =& $GLOBALS['_SC_Query_TraceLogInfo']; + $arrInfo = &$GLOBALS['_SC_Query_TraceLogInfo']; if (!isset($arrInfo['http_request_id'])) { $arrInfo['http_request_id'] = uniqid(); } @@ -1162,9 +1203,9 @@ private function lfStartDbTraceLog(&$objSth, &$arrVal) $arrInfo['count'] = 0; } $arrStartInfo = array( - 'http_request_id' => $arrInfo['http_request_id'], - 'time_start' => microtime(true), - 'count' => ++$arrInfo['count'], + 'http_request_id' => $arrInfo['http_request_id'], + 'time_start' => microtime(true), + 'count' => ++$arrInfo['count'], ); // ログモード1の場合、開始はログに出力しない @@ -1185,6 +1226,7 @@ private function lfStartDbTraceLog(&$objSth, &$arrVal) * * @param string 実行するSQL文 * @param array $arrVal プレースホルダに挿入する配列 + * * @return void */ private function lfEndDbTraceLog(&$arrStartInfo, &$objSth, &$arrVal) @@ -1217,6 +1259,7 @@ private function lfEndDbTraceLog(&$arrStartInfo, &$objSth, &$arrVal) * * @param SC_Query $objThis プールするインスタンス * @param string $dsn データソース名 + * * @return SC_Query プールしたインスタンス */ public static function setPoolInstance(&$objThis, $dsn = '') @@ -1230,6 +1273,7 @@ public static function setPoolInstance(&$objThis, $dsn = '') * プールしているインスタンスを取得する * * @param string $dsn データソース名 + * * @return SC_Query|null */ public static function getPoolInstance($dsn = '') diff --git a/data/class/SC_Response.php b/data/class/SC_Response.php index 09c9531076..964f110c8d 100644 --- a/data/class/SC_Response.php +++ b/data/class/SC_Response.php @@ -25,6 +25,7 @@ * HttpResponse を扱うクラス. * * @author Ryuichi Tokugami + * * @version $Id$ */ class SC_Response @@ -32,6 +33,7 @@ class SC_Response /** * コンテンツタイプ * Enter description here ... + * * @var unknown_type */ public $contentType; @@ -40,7 +42,6 @@ class SC_Response public $header = array(); /** - * * Enter description here ... */ public $encoding; @@ -58,7 +59,7 @@ public function sendHeader() { // HTTPのヘッダ foreach ($this->header as $name => $head) { - header($name.': '.$head); + header($name . ': ' . $head); } if (strlen($this->statusCode) >= 1) { $this->sendHttpStatus($this->statusCode); @@ -98,7 +99,7 @@ public static function actionExit() $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance(); if (is_object($objPlugin)) { - $arrBacktrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 2); + $arrBacktrace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 2); // 0 番目には object が含まれない場合がある foreach ($arrBacktrace as $backtrace) { if (array_key_exists('object', $backtrace) @@ -125,10 +126,12 @@ public static function actionExit() * 1. 引数 $inheritQueryString が true の場合、$_SERVER['QUERY_STRING'] * 2. $location に含まれる クエリ * 3. 引数 $arrQueryString + * * @param string $location 「url-path」「現在のURLからのパス」「URL」のいずれか。「../」の解釈は行なわない。 * @param array $arrQueryString URL に付加するクエリ * @param bool $inheritQueryString 現在のリクエストのクエリを継承するか * @param bool|null $useSsl true:HTTPSを強制, false:HTTPを強制, null:継承 + * * @return void * @static */ @@ -138,7 +141,7 @@ public static function sendRedirect($location, $arrQueryString = array(), $inher $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance(); if (is_object($objPlugin)) { - $arrBacktrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 2); + $arrBacktrace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 2); // 0 番目には object が含まれない場合がある foreach ($arrBacktrace as $backtrace) { if (array_key_exists('object', $backtrace) && is_object($backtrace['object']) && method_exists($backtrace['object'], 'getMode')) { @@ -155,7 +158,7 @@ public static function sendRedirect($location, $arrQueryString = array(), $inher $pattern = '/^[a-zA-Z0-9_]+$/'; $mode = null; if (isset($_GET['mode']) && preg_match($pattern, $_GET['mode'])) { - $mode = $_GET['mode']; + $mode = $_GET['mode']; } elseif (isset($_POST['mode']) && preg_match($pattern, $_POST['mode'])) { $mode = $_POST['mode']; } @@ -203,7 +206,7 @@ public static function sendRedirect($location, $arrQueryString = array(), $inher } if (!SC_Utils_Ex::isInternalUrl($url)) { - trigger_error('アプリケーション外へのリダイレクトは扱わない: ' . var_export($url, true), E_USER_ERROR); + trigger_error('アプリケーション外へのリダイレクトは扱わない: ' . var_export($url, true), \E_USER_ERROR); } $netUrl = new Net_URL($url); @@ -226,7 +229,7 @@ public static function sendRedirect($location, $arrQueryString = array(), $inher $netUrl->addQueryString(session_name(), session_id()); } - /** + /* * transactionid を受け取ったリクエストに関して、値を継承してリダイレクトする。 * @see https://github.com/EC-CUBE/ec-cube2/issues/922 */ @@ -252,7 +255,9 @@ public static function sendRedirect($location, $arrQueryString = array(), $inher * /html/ からのパスを指定してリダイレクトする * * FIXME メソッド名を分かりやすくしたい。現状だと、引数が「url-path より後」とも「url-path」とも読み取れる。(前者が意図したいところ) + * * @param string $location /html/ からのパス。先頭に / を含むかは任意。「../」の解釈は行なわない。 + * * @return void * @static */ @@ -291,14 +296,20 @@ public function setStatusCode($statusCode = null) * HTTPステータスコードを送出する。 * * @param integer $statusCode HTTPステータスコード + * * @return void + * * @author Seasoft (新規作成) + * * @see Moony_Action::status() (オリジナル) - * @link http://moony.googlecode.com/ (オリジナル) + * @see http://moony.googlecode.com/ (オリジナル) + * * @author YAMAOKA Hiroyuki (オリジナル) * @copyright 2005-2008 YAMAOKA Hiroyuki (オリジナル) * @license http://opensource.org/licenses/bsd-license.php New BSD License (オリジナル) - * @link http://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89 (邦訳) + * + * @see http://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89 (邦訳) + * * @license http://www.gnu.org/licenses/fdl.html GFDL (邦訳) * @static */ @@ -353,7 +364,7 @@ public static function sendHttpStatus($statusCode) 503 => 'Service Unavailable', // サービス利用不可 504 => 'Gateway Timeout', // ゲートウェイタイムアウト 505 => 'HTTP Version Not Supported', // サポートしていないHTTPバージョン - 509 => 'Bandwidth Limit Exceeded' // 帯域幅制限超過 + 509 => 'Bandwidth Limit Exceeded', // 帯域幅制限超過 ); if (isset($messages[$statusCode])) { if ($httpVersion !== '1.1') { @@ -369,9 +380,11 @@ public static function sendHttpStatus($statusCode) * ダウンロード用の HTTP ヘッダを出力する * * @param string $file_name + * * @return void */ - public static function headerForDownload($file_name) { + public static function headerForDownload($file_name) + { header("Content-disposition: attachment; filename={$file_name}"); header("Content-type: application/octet-stream; name={$file_name}"); header('Cache-Control: '); @@ -381,7 +394,8 @@ public static function headerForDownload($file_name) { /** * exit をスキップする場合はオーバーライドすること. */ - protected static function exitWrapper() { + protected static function exitWrapper() + { exit; } } diff --git a/data/class/SC_SelectSql.php b/data/class/SC_SelectSql.php index e258af372c..aaf17fc947 100644 --- a/data/class/SC_SelectSql.php +++ b/data/class/SC_SelectSql.php @@ -53,11 +53,12 @@ public function __construct($array = []) * SQL文生成 * * @param string $mode + * * @return string */ public function getSql($mode = '') { - $this->sql = $this->select .' '. $this->where .' '. $this->group .' '; + $this->sql = $this->select . ' ' . $this->where . ' ' . $this->group . ' '; if ($mode == 2) { $this->sql .= $this->order; @@ -71,7 +72,7 @@ public function getSql($mode = '') */ public static function addSearchStr($val) { - $return = '%' .$val. '%'; + $return = '%' . $val . '%'; return $return; } @@ -82,25 +83,26 @@ public static function addSearchStr($val) * @param int $from * @param int $to * @param string $column + * * @return array */ public function selectRange($from, $to, $column) { // ある単位のみ検索($from = $to) if ($from == $to) { - $this->setWhere($column .' = ?'); + $this->setWhere($column . ' = ?'); $return = array($from); // ~$toまで検索 } elseif (strlen($from) == 0 && strlen($to) > 0) { - $this->setWhere($column .' <= ? '); + $this->setWhere($column . ' <= ? '); $return = array($to); // ~$from以上を検索 } elseif (strlen($from) > 0 && strlen($to) == 0) { - $this->setWhere($column .' >= ? '); + $this->setWhere($column . ' >= ? '); $return = array($from); // $from~$toの検索 } else { - $this->setWhere($column .' BETWEEN ? AND ?'); + $this->setWhere($column . ' BETWEEN ? AND ?'); $return = array($from, $to); } @@ -117,6 +119,7 @@ public function selectRange($from, $to, $column) * @param int $to_month * @param int $to_day * @param string $column + * * @return array */ public function selectTermRange($from_year, $from_month, $from_day, $to_year, $to_month, $to_day, $column) @@ -129,14 +132,14 @@ public function selectTermRange($from_year, $from_month, $from_day, $to_year, $t // 終了期間の構築 // @see http://svn.ec-cube.net/open_trac/ticket/328 // FIXME とりあえずintvalで対策... - $date2 = mktime(0, 0, 0, intval($to_month), intval($to_day), intval($to_year)); + $date2 = mktime(0, 0, 0, (int) $to_month, (int) $to_day, (int) $to_year); $date2 = $date2 + 86400; // SQL文のdate関数に与えるフォーマットは、yyyy/mm/ddで指定する。 $date2 = date('Y/m/d', $date2); // 開始期間だけ指定の場合 if (($from_year != '') && ($from_month != '') && ($from_day != '') && ($to_year == '') && ($to_month == '') && ($to_day == '')) { - $this->setWhere($column .' >= ?'); + $this->setWhere($column . ' >= ?'); $return[] = $date1; } @@ -162,8 +165,10 @@ public function selectTermRange($from_year, $from_month, $from_day, $to_year, $t * checkboxなどで同一カラム内で単一、もしくは複数選択肢が有る場合 * * 例: AND ( sex = xxx OR sex = xxx OR sex = xxx) AND ... + * * @param array $arr * @param string $ItemStr + * * @return array */ public function setItemTerm($arr, $ItemStr) @@ -197,6 +202,7 @@ public function setItemTerm($arr, $ItemStr) * * @param array $arr * @param string $ItemStr + * * @return array */ public function setItemTermWithNull($arr, $ItemStr) @@ -221,6 +227,7 @@ public function setItemTermWithNull($arr, $ItemStr) /** * NULLもしくは''で検索する場合 + * * @deprecated 本体で使用していないため非推奨 */ public function setItemTermWithNullAndSpace($arr, $ItemStr) @@ -231,10 +238,12 @@ public function setItemTermWithNullAndSpace($arr, $ItemStr) $i = 1; if ($arr) { foreach ($arr as $data) { - if ($i == $count) break; + if ($i == $count) { + break; + } $item .= " OR {$ItemStr} = ?"; $return[] = $data; - $i ++; + $i++; } } $item = "({$item}) "; @@ -246,7 +255,7 @@ public function setItemTermWithNullAndSpace($arr, $ItemStr) /** * 複数のカラムでORで優先検索する場合 例: AND ( item_flag1 = xxx OR item_flag2 = xxx OR item_flag3 = xxx) AND ... * - * 配列の構造例  + * 配列の構造例 * if ($_POST['show_site1']) $arrShowsite_1 = array('column' => 'show_site1', * 'value' => $_POST['show_site1']); * @@ -259,7 +268,7 @@ public function setWhereByOR($arrWhere) for ($i = 0; $i < $count; $i++) { if (isset($arrWhere[$i]['value'])) { - $statement .= $arrWhere[$i]['column'] .' = ' . SC_Utils_Ex::sfQuoteSmart($arrWhere[$i]['value']) .' OR '; + $statement .= $arrWhere[$i]['column'] . ' = ' . SC_Utils_Ex::sfQuoteSmart($arrWhere[$i]['value']) . ' OR '; } } @@ -276,7 +285,9 @@ public function setWhereByOR($arrWhere) * WHERE を取得する。 * * ヘンテコセッター互換仕様。 + * * @param $with_where boolean 必要に応じて WHERE を前置するか + * * @return string WHERE */ public function getWhere($with_where = false) @@ -309,7 +320,7 @@ public function setWhere($where) */ public function setOrder($order) { - $this->order = 'ORDER BY ' . $order; + $this->order = 'ORDER BY ' . $order; } /** @@ -317,7 +328,7 @@ public function setOrder($order) */ public function setGroup($group) { - $this->group = 'GROUP BY ' . $group; + $this->group = 'GROUP BY ' . $group; } /** diff --git a/data/class/SC_SendMail.php b/data/class/SC_SendMail.php index 70c9228820..ade9059dac 100644 --- a/data/class/SC_SendMail.php +++ b/data/class/SC_SendMail.php @@ -65,11 +65,11 @@ public function __construct() $this->port = SMTP_PORT; // PEAR::Mailを使ってメール送信オブジェクト作成 - $this->objMail =& Mail::factory($this->backend, - $this->getBackendParams($this->backend)); + $this->objMail = &Mail::factory($this->backend, + $this->getBackendParams($this->backend)); if (PEAR::isError($this->objMail)) { // XXX 環境によっては文字エンコードに差異がないか些か心配 - trigger_error($this->objMail->getMessage(), E_USER_ERROR); + trigger_error($this->objMail->getMessage(), \E_USER_ERROR); } } @@ -164,14 +164,14 @@ public function setBody($body) */ public function setHost($host) { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); $this->host = $host; $arrHost = array( 'host' => $this->host, - 'port' => $this->port + 'port' => $this->port, ); // PEAR::Mailを使ってメール送信オブジェクト作成 - $this->objMail =& Mail::factory('smtp', $arrHost); + $this->objMail = &Mail::factory('smtp', $arrHost); } /** @@ -181,14 +181,14 @@ public function setHost($host) */ public function setPort($port) { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); $this->port = $port; $arrHost = array( 'host' => $this->host, - 'port' => $this->port + 'port' => $this->port, ); // PEAR::Mailを使ってメール送信オブジェクト作成 - $this->objMail =& Mail::factory('smtp', $arrHost); + $this->objMail = &Mail::factory('smtp', $arrHost); } // 名前<メールアドレス>の形式を生成 @@ -198,25 +198,25 @@ public function setPort($port) */ public function getNameAddress($name, $mail_address) { - if ($name != '') { - // 制御文字を変換する。 - $_name = $name; - $_name = mb_encode_mimeheader($_name, 'ISO-2022-JP-MS', 'B', "\n"); - $_name = str_replace('"', '\"', $_name); - $name_address = sprintf('"%s" <%s>', $_name, $mail_address); - } else { - $name_address = $mail_address; - } - - return $name_address; + if ($name != '') { + // 制御文字を変換する。 + $_name = $name; + $_name = mb_encode_mimeheader($_name, 'ISO-2022-JP-MS', 'B', "\n"); + $_name = str_replace('"', '\"', $_name); + $name_address = sprintf('"%s" <%s>', $_name, $mail_address); + } else { + $name_address = $mail_address; + } + + return $name_address; } - public function setItem($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') + public function setItem($to, $subject, $body, $fromaddress, $from_name, $reply_to = '', $return_path = '', $errors_to = '', $bcc = '', $cc = '') { $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); } - public function setItemHtml($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') + public function setItemHtml($to, $subject, $body, $fromaddress, $from_name, $reply_to = '', $return_path = '', $errors_to = '', $bcc = '', $cc = '') { $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); } @@ -233,7 +233,7 @@ public function setItemHtml($to, $subject, $body, $fromaddress, $from_name, $rep $cc -> カーボンコピー $bcc -> ブラインドカーボンコピー */ - public function setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to='', $return_path='', $errors_to='', $bcc='', $cc ='') + public function setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to = '', $return_path = '', $errors_to = '', $bcc = '', $cc = '') { // 宛先設定 $this->setTo($to); @@ -339,7 +339,7 @@ public function sendMail($isHtml = false) // XXX Windows 環境では SJIS でメッセージを受け取るようなので変換する。 $msg = mb_convert_encoding($result->getMessage(), CHAR_CODE, 'auto'); $msg = 'メール送信に失敗しました。[' . $msg . ']'; - trigger_error($msg, E_USER_WARNING); + trigger_error($msg, \E_USER_WARNING); GC_Utils_Ex::gfPrintLog($result->getMessage()); GC_Utils_Ex::gfDebugLog($header); @@ -363,6 +363,7 @@ public function sendHtmlMail() * メーラーバックエンドに応じたパラメーターを返す. * * @param string $backend Pear::Mail のバックエンド + * * @return array メーラーバックエンドに応じたパラメーターの配列 */ public function getBackendParams($backend) @@ -373,7 +374,7 @@ public function getBackendParams($backend) $objDb = new SC_Helper_DB_Ex(); $objSite = $objDb->sfGetBasisData(); if (!empty($objSite['email04']) && strpos($objSite['email04'], '@') > 0) { - $arrParams[] = "-f ".$objSite['email04']; + $arrParams[] = "-f " . $objSite['email04']; } break; @@ -400,7 +401,7 @@ public function getBackendParams($backend) break; default: - trigger_error('不明なバックエンド。[$backend = ' . var_export($backend, true) . ']', E_USER_ERROR); + trigger_error('不明なバックエンド。[$backend = ' . var_export($backend, true) . ']', \E_USER_ERROR); exit; } diff --git a/data/class/SC_Session.php b/data/class/SC_Session.php index e5b9dbc42d..48202663fb 100644 --- a/data/class/SC_Session.php +++ b/data/class/SC_Session.php @@ -49,21 +49,22 @@ public function __construct() if (isset($_SESSION['cert'])) { $this->sid = substr(sha1(session_id()), 0, 8); $this->cert = $_SESSION['cert']; - $this->login_id = $_SESSION['login_id']; + $this->login_id = $_SESSION['login_id']; // 管理者:0, 店舗オーナー:1, 閲覧:2, 販売担当:3 (XXX 現状 0, 1 を暫定実装。2, 3 は未実装。) $this->authority = $_SESSION['authority']; $this->member_id = $_SESSION['member_id']; if (isset($_SESSION['uniq_id'])) { - $this->uniqid = $_SESSION['uniq_id']; + $this->uniqid = $_SESSION['uniq_id']; } // ログに記録する - GC_Utils_Ex::gfPrintLog('access : user='.$this->login_id.' auth='.$this->authority.' sid='.$this->sid); + GC_Utils_Ex::gfPrintLog('access : user=' . $this->login_id . ' auth=' . $this->authority . ' sid=' . $this->sid); } else { // ログに記録する GC_Utils_Ex::gfPrintLog('access error.'); } } + /* 認証成功の判定 */ public function IsSuccess($admin_dir = ADMIN_DIR) { @@ -78,11 +79,11 @@ public function IsSuccess($admin_dir = ADMIN_DIR) if (stripos($path, '/admin/') === 0) { // path が /admin で始まる場合は /admin を削除 $path = str_replace('/admin', '', $path); - } elseif (stripos($path, '/'.$admin_dir) === 0) { + } elseif (stripos($path, '/' . $admin_dir) === 0) { // path が /ADMIN_DIR で始まる場合は /ADMIN_DIR を削除 - $path = str_replace('/'.$admin_dir, '', $path); + $path = str_replace('/' . $admin_dir, '', $path); } - $permission_path = realpath(HTML_REALDIR.$admin_dir.$path); + $permission_path = realpath(HTML_REALDIR . $admin_dir . $path); $arrPermissionPath = explode('/', str_replace('\\', '/', $permission_path)); $arrDiff = array_diff_assoc($arrScriptPath, $arrPermissionPath); @@ -94,6 +95,7 @@ public function IsSuccess($admin_dir = ADMIN_DIR) } } } + return SUCCESS; } @@ -155,7 +157,7 @@ public function logout() // トランザクショントークンを破棄 SC_Helper_Session_Ex::destroyToken(); // ログに記録する - GC_Utils_Ex::gfPrintLog('logout : user='.$this->login_id.' auth='.$this->authority.' sid='.$this->sid); + GC_Utils_Ex::gfPrintLog('logout : user=' . $this->login_id . ' auth=' . $this->authority . ' sid=' . $this->sid); } /** @@ -165,9 +167,10 @@ public function logout() */ public static function regenerateSID() { - if (session_status() === PHP_SESSION_ACTIVE) { + if (session_status() === \PHP_SESSION_ACTIVE) { return session_regenerate_id(true); } + return false; } } diff --git a/data/class/SC_SessionFactory.php b/data/class/SC_SessionFactory.php index d5b4bd72a4..3eaa9b6aae 100644 --- a/data/class/SC_SessionFactory.php +++ b/data/class/SC_SessionFactory.php @@ -37,8 +37,8 @@ * $sessionFactory = SC_SessionFactory::getInstance() * $sessionFactory->initSession(); * - * @package SC_Session * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_SessionFactory @@ -57,21 +57,21 @@ public static function getInstance() switch ($type) { // セッションの維持にリクエストパラメーターを使用する case 'useRequest': - $session = new SC_SessionFactory_UseRequest_Ex; + $session = new SC_SessionFactory_UseRequest_Ex(); SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE ? $session->setState('mobile') : $session->setState('pc'); break; - // クッキーを使用する + // クッキーを使用する case 'useCookie': default: // モバイルの場合はSC_SessionFactory_UseRequestを使用する if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { - $session = new SC_SessionFactory_UseRequest_Ex; + $session = new SC_SessionFactory_UseRequest_Ex(); $session->setState('mobile'); } else { - $session = new SC_SessionFactory_UseCookie_Ex; + $session = new SC_SessionFactory_UseCookie_Ex(); } break; } @@ -81,7 +81,6 @@ public static function getInstance() /** * セッションの初期化を行う. - * */ public function initSession() { diff --git a/data/class/SC_UploadFile.php b/data/class/SC_UploadFile.php index c7c8547aac..5862995da5 100644 --- a/data/class/SC_UploadFile.php +++ b/data/class/SC_UploadFile.php @@ -69,7 +69,7 @@ public function __construct($temp_dir, $save_dir) } // ファイル情報追加 - public function addFile($disp_name, $keyname, $arrExt, $size, $necessary=false, $width=0, $height=0, $image=true) + public function addFile($disp_name, $keyname, $arrExt, $size, $necessary = false, $width = 0, $height = 0, $image = true) { $this->disp_name[] = $disp_name; $this->keyname[] = $keyname; @@ -128,16 +128,16 @@ public function makeTempFile($keyname, $rename = IMAGE_RENAME) } else { // 一意なファイル名を作成する。 if ($rename) { - $uniqname = date('mdHi') . '_' . uniqid('').'.'; + $uniqname = date('mdHi') . '_' . uniqid('') . '.'; $this->temp_file[$cnt] = preg_replace("/^.*\./", $uniqname, $_FILES[$keyname]['name']); } else { $this->temp_file[$cnt] = $_FILES[$keyname]['name']; } if (move_uploaded_file($_FILES[$keyname]['tmp_name'], $this->temp_dir . $this->temp_file[$cnt])) { - GC_Utils_Ex::gfPrintLog($_FILES[$keyname]['name'].' -> '. $this->temp_dir . $this->temp_file[$cnt]); + GC_Utils_Ex::gfPrintLog($_FILES[$keyname]['name'] . ' -> ' . $this->temp_dir . $this->temp_file[$cnt]); } else { $objErr->arrErr[$keyname] = '※ ファイルのアップロードに失敗しました。
'; - GC_Utils_Ex::gfPrintLog('File Upload Error!: ' . $_FILES[$keyname]['name'].' -> '. $this->temp_dir . $this->temp_file[$cnt]); + GC_Utils_Ex::gfPrintLog('File Upload Error!: ' . $_FILES[$keyname]['name'] . ' -> ' . $this->temp_dir . $this->temp_file[$cnt]); } } } @@ -150,7 +150,7 @@ public function makeTempFile($keyname, $rename = IMAGE_RENAME) } // アップロードされたダウンロードファイルを保存する。 - public function makeTempDownFile($keyname='down_file') + public function makeTempDownFile($keyname = 'down_file') { $objErr = new SC_CheckError_Ex(); $cnt = 0; @@ -166,10 +166,10 @@ public function makeTempDownFile($keyname='down_file') // エラーがない場合 if (!isset($objErr->arrErr[$keyname])) { // 一意なファイル名を作成する。 - $uniqname = date('mdHi') . '_' . uniqid('').'.'; + $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]); + $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(); } } @@ -213,7 +213,7 @@ public function deleteKikakuFile($keyname) $objImage->deleteImage($this->temp_file[$cnt], $this->temp_dir); } $this->temp_file[$cnt] = ''; - //$this->save_file[$cnt] = ''; + // $this->save_file[$cnt] = ''; } $cnt++; } @@ -460,9 +460,9 @@ public function setDBDownFile($arrVal) */ public function setPostFileList($arrPost) { - for ($cnt = 0;$cnt < count($this->keyname); $cnt++) { - if (isset($arrPost['temp_down_realfilename:' . ($cnt+1)])) { - $this->temp_file[$cnt] = $arrPost['temp_down_realfilename:' . ($cnt+1)]; + for ($cnt = 0; $cnt < count($this->keyname); $cnt++) { + if (isset($arrPost['temp_down_realfilename:' . ($cnt + 1)])) { + $this->temp_file[$cnt] = $arrPost['temp_down_realfilename:' . ($cnt + 1)]; } } } @@ -521,8 +521,12 @@ public function checkExists($keyname = '') if ($val == $keyname || $keyname == '') { // 必須であればエラーチェック if ($this->necessary[$cnt] == true) { - if (!isset($this->save_file[$cnt])) $this->save_file[$cnt] = ''; - if (!isset($this->temp_file[$cnt])) $this->temp_file[$cnt] = ''; + if (!isset($this->save_file[$cnt])) { + $this->save_file[$cnt] = ''; + } + if (!isset($this->temp_file[$cnt])) { + $this->temp_file[$cnt] = ''; + } if ($this->save_file[$cnt] == '' && $this->temp_file[$cnt] == '' ) { @@ -560,6 +564,7 @@ public function saveResizeImage($keyname, $to_w, $to_h) * * @param string $rename * @param int $keyname + * * @return string */ public function lfGetTmpImageName($rename, $keyname = '', $uploadfile = '') @@ -570,7 +575,7 @@ public function lfGetTmpImageName($rename, $keyname = '', $uploadfile = '') } else { // アップロードした画像名で保存 $uploadfile = strlen($uploadfile) > 0 ? $uploadfile : $_FILES[$keyname]['name']; - $uniqname = preg_replace('/(.+)\.(.+?)$/', '$1', $uploadfile); + $uniqname = preg_replace('/(.+)\.(.+?)$/', '$1', $uploadfile); } $dst_file = $this->temp_dir . $uniqname; @@ -582,6 +587,7 @@ public function lfGetTmpImageName($rename, $keyname = '', $uploadfile = '') * * @param string $keyname ファイルinputタグのname * @param SC_CheckError $objErr SC_CheckErrorインスタンス + * * @return boolean */ public function checkUploadError($keyname, SC_CheckError &$objErr) @@ -589,16 +595,16 @@ public function checkUploadError($keyname, SC_CheckError &$objErr) $index = array_search($keyname, $this->keyname); switch ($_FILES[$keyname]['error']) { - case UPLOAD_ERR_OK: + case \UPLOAD_ERR_OK: return true; break; - case UPLOAD_ERR_NO_FILE: + case \UPLOAD_ERR_NO_FILE: $objErr->arrErr[$keyname] = '※ ' . $this->disp_name[$index] . 'が選択されていません。' . '
'; break; - case UPLOAD_ERR_INI_SIZE: + case \UPLOAD_ERR_INI_SIZE: $objErr->arrErr[$keyname] = '※ ' . $this->disp_name[$index] . 'のアップロードに失敗しました。' diff --git a/data/class/SC_View.php b/data/class/SC_View.php index 01f94f7a47..9a92c99134 100644 --- a/data/class/SC_View.php +++ b/data/class/SC_View.php @@ -49,7 +49,7 @@ public function init() $this->_smarty->registerPlugin('modifier', 'sfTrim', array('SC_Utils_Ex', 'sfTrim')); $this->_smarty->registerPlugin('modifier', 'sfCalcIncTax', array('SC_Helper_DB_Ex', 'sfCalcIncTax')); $this->_smarty->registerPlugin('modifier', 'sfPrePoint', array('SC_Utils_Ex', 'sfPrePoint')); - $this->_smarty->registerPlugin('modifier', 'sfGetChecked',array('SC_Utils_Ex', 'sfGetChecked')); + $this->_smarty->registerPlugin('modifier', 'sfGetChecked', array('SC_Utils_Ex', 'sfGetChecked')); $this->_smarty->registerPlugin('modifier', 'sfTrimURL', array('SC_Utils_Ex', 'sfTrimURL')); $this->_smarty->registerPlugin('modifier', 'sfMultiply', array('SC_Utils_Ex', 'sfMultiply')); $this->_smarty->registerPlugin('modifier', 'sfRmDupSlash', array('SC_Utils_Ex', 'sfRmDupSlash')); @@ -71,9 +71,9 @@ public function init() $this->_smarty->registerPlugin('modifier', 'php_uname', 'php_uname'); $this->_smarty->registerPlugin('modifier', 'array_key_exists', 'array_key_exists'); // XXX register_function で登録すると if で使用できないのではないか? - $this->_smarty->registerPlugin('function','sfIsHTTPS', array('SC_Utils_Ex', 'sfIsHTTPS')); - $this->_smarty->registerPlugin('function','sfSetErrorStyle', array('SC_Utils_Ex', 'sfSetErrorStyle')); - $this->_smarty->registerPlugin('function','printXMLDeclaration', array('GC_Utils_Ex', 'printXMLDeclaration')); + $this->_smarty->registerPlugin('function', 'sfIsHTTPS', array('SC_Utils_Ex', 'sfIsHTTPS')); + $this->_smarty->registerPlugin('function', 'sfSetErrorStyle', array('SC_Utils_Ex', 'sfSetErrorStyle')); + $this->_smarty->registerPlugin('function', 'printXMLDeclaration', array('GC_Utils_Ex', 'printXMLDeclaration')); $this->_smarty->default_modifiers = array('script_escape'); if (ADMIN_MODE == '1') { @@ -105,9 +105,12 @@ public function fetch($template) /** * SC_Display用にレスポンスを返す + * * @global string $GLOBAL_ERR + * * @param array $template * @param boolean $no_error + * * @return string */ public function getResponse($template, $no_error = false) @@ -120,7 +123,7 @@ public function getResponse($template, $no_error = false) define('OUTPUT_ERR', 'ON'); } } - $res = $this->_smarty->fetch($template); + $res = $this->_smarty->fetch($template); if (ADMIN_MODE == '1') { $time_end = microtime(true); $time = $time_end - $this->time_start; @@ -132,16 +135,19 @@ public function getResponse($template, $no_error = false) /** * Pageオブジェクトをセットします. + * * @param LC_Page_Ex $objPage + * * @return void */ public function setPage($objPage) { - $this->objPage = $objPage; + $this->objPage = $objPage; } /** * Smartyのfilterをセットします. + * * @return void */ public function registFilter() @@ -152,11 +158,13 @@ public function registFilter() /** * prefilter用のフィルタ関数。プラグイン用のフックポイント処理を実行 + * * @param string $source ソース * @param \Smarty\Template $smarty Smartyのコンパイラクラス + * * @return string $source ソース */ - public function prefilter_transform($source, \Smarty\Template $template) + public function prefilter_transform($source, Smarty\Template $template) { if (!is_null($this->objPage)) { // フックポイントを実行. @@ -171,11 +179,13 @@ public function prefilter_transform($source, \Smarty\Template $template) /** * outputfilter用のフィルタ関数。プラグイン用のフックポイント処理を実行 + * * @param string $source ソース * @param \Smarty\Template $smarty Smartyのコンパイラクラス + * * @return string $source ソース */ - public function outputfilter_transform($source, \Smarty\Template $template) + public function outputfilter_transform($source, Smarty\Template $template) { if (!is_null($this->objPage)) { // フックポイントを実行. @@ -190,6 +200,7 @@ public function outputfilter_transform($source, \Smarty\Template $template) /** * テンプレートの処理結果を表示 + * * @param string $template * @param bool $no_error */ @@ -214,6 +225,7 @@ public function display($template, $no_error = false) /** * オブジェクト内の変数を全て割り当てる。 + * * @param object $obj */ public function assignobj($obj) @@ -227,6 +239,7 @@ public function assignobj($obj) /** * 連想配列内の変数を全て割り当てる。 + * * @param array $array */ public function assignarray($array) @@ -257,6 +270,7 @@ public function assignTemplatePath($device_type_id) /** * デバッグ + * * @param bool $var */ public function debug($var = true) @@ -264,12 +278,12 @@ public function debug($var = true) $this->_smarty->debugging = $var; } - /** * 2.13のテンプレートのまま動作するためにsmartyの後方互換処理 * * @param mixed $tpl_source * @param mixed $smarty + * * @return array|string|null */ public function lower_compatibility_smarty($tpl_source, $smarty) @@ -291,11 +305,13 @@ public function lower_compatibility_smarty($tpl_source, $smarty) * この関数は 2.13 と同様にテンプレートディレクトリからの相対パスを返す * * @param Smarty_Internal_Template $template + * * @return string 現在のテンプレートファイルパス */ - public function getCurrentTemplateFile(\Smarty\Template $template) + public function getCurrentTemplateFile(Smarty\Template $template) { $current_file = str_replace($template->getSmarty()->getTemplateDir(), '', $template->getSource()->getFilepath()); + return str_replace('\\', '/', $current_file); // Windows 向けにパスの区切り文字を正規化する } } diff --git a/data/class/api/SC_Api_Abstract.php b/data/class/api/SC_Api_Abstract.php index ddb6a05e2b..fc0a7b2155 100644 --- a/data/class/api/SC_Api_Abstract.php +++ b/data/class/api/SC_Api_Abstract.php @@ -24,25 +24,24 @@ /** * APIの抽象クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - abstract class SC_Api_Abstract { /** 認証タイプ */ - const API_AUTH_TYPE_REFERER = '1'; // リファラー - const API_AUTH_TYPE_SESSION_TOKEN = '2'; // CSRF TOKEN - const API_AUTH_TYPE_API_SIGNATURE = '3'; // API 署名認証 推奨 - const API_AUTH_TYPE_CUSTOMER = '4'; // 会員認証 - const API_AUTH_TYPE_MEMBER = '5'; // 管理者認証 - const API_AUTH_TYPE_CUSTOMER_LOGIN_SESSION = '6'; // 顧客ログインセッションが有効 - const API_AUTH_TYPE_MEMBER_LOGIN_SESSION = '7'; // 管理者ログインセッションが有効 - const API_AUTH_TYPE_IP = '8'; // IP認証 - const API_AUTH_TYPE_HOST = '9'; // ホスト認証 - const API_AUTH_TYPE_SSL = '10'; // SSL強制 - const API_AUTH_TYPE_OPEN = '99'; // 完全オープン + public const API_AUTH_TYPE_REFERER = '1'; // リファラー + public const API_AUTH_TYPE_SESSION_TOKEN = '2'; // CSRF TOKEN + public const API_AUTH_TYPE_API_SIGNATURE = '3'; // API 署名認証 推奨 + public const API_AUTH_TYPE_CUSTOMER = '4'; // 会員認証 + public const API_AUTH_TYPE_MEMBER = '5'; // 管理者認証 + public const API_AUTH_TYPE_CUSTOMER_LOGIN_SESSION = '6'; // 顧客ログインセッションが有効 + public const API_AUTH_TYPE_MEMBER_LOGIN_SESSION = '7'; // 管理者ログインセッションが有効 + public const API_AUTH_TYPE_IP = '8'; // IP認証 + public const API_AUTH_TYPE_HOST = '9'; // ホスト認証 + public const API_AUTH_TYPE_SSL = '10'; // SSL強制 + public const API_AUTH_TYPE_OPEN = '99'; // 完全オープン /** API Operation default */ protected $operation_name = 'operation_name'; diff --git a/data/class/api/SC_Api_Operation.php b/data/class/api/SC_Api_Operation.php index 5881bc2612..e28fad204e 100644 --- a/data/class/api/SC_Api_Operation.php +++ b/data/class/api/SC_Api_Operation.php @@ -26,40 +26,40 @@ * 権限チェックと設定チェックを行い、APIオペレーション本体を呼び出す。 * 結果データの生成 * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class SC_Api_Operation { /** API_DEBUG_MODE */ - const API_DEBUG_MODE = false; + public const API_DEBUG_MODE = false; /** 認証タイプ */ - const API_AUTH_TYPE_REFERER = '1'; // リファラー - const API_AUTH_TYPE_SESSION_TOKEN = '2'; // CSRF TOKEN - const API_AUTH_TYPE_API_SIGNATURE = '3'; // API 署名認証 推奨 - const API_AUTH_TYPE_CUSTOMER = '4'; // 会員認証 - const API_AUTH_TYPE_MEMBER = '5'; // 管理者認証 - const API_AUTH_TYPE_CUSTOMER_LOGIN_SESSION = '6'; // 顧客ログインセッションが有効 - const API_AUTH_TYPE_MEMBER_LOGIN_SESSION = '7'; // 管理者ログインセッションが有効 - const API_AUTH_TYPE_IP = '8'; // IP認証 - const API_AUTH_TYPE_HOST = '9'; // ホスト認証 - const API_AUTH_TYPE_SSL = '10'; // SSL強制 - const API_AUTH_TYPE_OPEN = '99'; // 完全オープン + public const API_AUTH_TYPE_REFERER = '1'; // リファラー + public const API_AUTH_TYPE_SESSION_TOKEN = '2'; // CSRF TOKEN + public const API_AUTH_TYPE_API_SIGNATURE = '3'; // API 署名認証 推奨 + public const API_AUTH_TYPE_CUSTOMER = '4'; // 会員認証 + public const API_AUTH_TYPE_MEMBER = '5'; // 管理者認証 + public const API_AUTH_TYPE_CUSTOMER_LOGIN_SESSION = '6'; // 顧客ログインセッションが有効 + public const API_AUTH_TYPE_MEMBER_LOGIN_SESSION = '7'; // 管理者ログインセッションが有効 + public const API_AUTH_TYPE_IP = '8'; // IP認証 + public const API_AUTH_TYPE_HOST = '9'; // ホスト認証 + public const API_AUTH_TYPE_SSL = '10'; // SSL強制 + public const API_AUTH_TYPE_OPEN = '99'; // 完全オープン /** * 有効な管理者ID/PASSかどうかチェックする * * @param string $member_id ログインID文字列 * @param string $member_password ログインパスワード文字列 + * * @return boolean ログイン情報が有効な場合 true */ protected static function checkMemberAccount($member_id, $member_password) { $objQuery = SC_Query_Ex::getSingletonInstance(); - //パスワード、saltの取得 + // パスワード、saltの取得 $cols = 'password, salt'; $table = 'dtb_member'; $where = 'login_id = ? AND del_flg <> 1 AND work = 1'; @@ -80,6 +80,7 @@ protected static function checkMemberAccount($member_id, $member_password) * * @param string $login_email ログインメールアドレス * @param string $login_password ログインパスワード + * * @return boolean ログインに成功した場合 true; 失敗した場合 false */ protected static function checkCustomerAccount($login_email, $login_password) @@ -101,11 +102,11 @@ protected static function checkReferer() { $ret = false; if (!SC_Utils_Ex::isBlank($_SERVER['HTTP_REFERER'])) { - $domain = SC_Utils_Ex::sfIsHTTPS() ? HTTPS_URL : HTTP_URL; + $domain = SC_Utils_Ex::sfIsHTTPS() ? HTTPS_URL : HTTP_URL; $pattern = sprintf('|^%s.*|', $domain); $referer = $_SERVER['HTTP_REFERER']; if (preg_match($pattern, $referer)) { - $ret = true; + $ret = true; } } @@ -118,6 +119,7 @@ protected static function checkReferer() * * @param string 実行処理名 * @param array リクエストパラメータ + * * @return boolean 署名認証に成功した場合 true; 失敗した場合 false */ protected static function checkApiSignature($operation_name, $arrParam, $arrApiConfig) @@ -128,12 +130,12 @@ protected static function checkApiSignature($operation_name, $arrParam, $arrApiC if (SC_Utils_Ex::isBlank($arrParam['Timestamp'])) { return false; } -/* - $allow_account_id = SC_Api_Operation_Ex::getOperationSubConfig($operation_name, 'allow_account_id', $arrApiConfig); - if (!SC_Utils_Ex::isBlank($allow_account_id) and) { - $arrAllowAccountIds = explode('|', $allow_account_id); - } -*/ + /* + $allow_account_id = SC_Api_Operation_Ex::getOperationSubConfig($operation_name, 'allow_account_id', $arrApiConfig); + if (!SC_Utils_Ex::isBlank($allow_account_id) and) { + $arrAllowAccountIds = explode('|', $allow_account_id); + } + */ $access_key = $arrParam['AccessKeyId']; $secret_key = SC_Api_Operation_Ex::getApiSecretKey($access_key); @@ -173,6 +175,7 @@ protected static function checkApiSignature($operation_name, $arrParam, $arrApiC * IPチェックを実行する. * * @param string 実行処理名 + * * @return boolean チェックに成功した場合 true; 失敗した場合 false */ protected static function checkIp($operation_name) @@ -181,7 +184,7 @@ protected static function checkIp($operation_name) $allow_hosts = SC_Api_Utils_Ex::getOperationSubConfig($operation_name, 'allow_hosts'); $arrAllowHost = explode("\n", $allow_hosts); if (is_array($arrAllowHost) && count($arrAllowHost) > 0) { - if (array_search($_SERVER['REMOTE_ADDR'], $arrAllowHost) !== FALSE) { + if (array_search($_SERVER['REMOTE_ADDR'], $arrAllowHost) !== false) { $ret = true; } } @@ -201,6 +204,7 @@ protected static function checkHost($operation_name) * ApiAccessKeyに対応した秘密鍵を取得する。 * * @param string $access_key + * * @return string 秘密鍵文字列 */ protected static function getApiSecretKey($access_key) @@ -216,6 +220,7 @@ protected static function getApiSecretKey($access_key) * * @param string オペレーション名 * @param array リクエストパラメータ + * * @return boolean 権限がある場合 true; 無い場合 false */ protected static function checkOperationAuth($operation_name, &$arrParam, &$arrApiConfig) @@ -282,6 +287,7 @@ protected static function checkOperationAuth($operation_name, &$arrParam, &$arrA * * @param object SC_FormParam * @param SC_FormParam_Ex $objFormParam + * * @return void */ protected static function setApiBaseParam(&$objFormParam) @@ -297,6 +303,7 @@ protected static function setApiBaseParam(&$objFormParam) * API実行 * * @param array $arrPost リクエストパラメーター + * * @return array(string レスポンス名, array レスポンス配列) */ public static function doApiAction($arrPost) @@ -345,7 +352,7 @@ public static function doApiAction($arrPost) // オペレーション結果処理 if ($operation_result) { $arrOperationRequestValid = $objApiOperation->getRequestValidate(); - $arrResponseBody = $objApiOperation->getResponseArray(); + $arrResponseBody = $objApiOperation->getResponseArray(); $response_group_name = $objApiOperation->getResponseGroupName(); } else { $arrErr = $objApiOperation->getErrorArray(); @@ -362,8 +369,8 @@ public static function doApiAction($arrPost) // 実行成功 $arrResponseValidSection = array('Request' => array( 'IsValid' => 'True', - $operation_name . 'Request' => $arrOperationRequestValid - ) + $operation_name . 'Request' => $arrOperationRequestValid, + ), ); $response_outer = $operation_name . 'Response'; SC_Api_Utils_Ex::printApiLog('Operation SUCCESS', $start_time, $response_outer); @@ -375,8 +382,8 @@ public static function doApiAction($arrPost) } $arrResponseValidSection = array('Request' => array( 'IsValid' => 'False', - 'Errors' => array('Error' => $arrResponseErrorSection) - ) + 'Errors' => array('Error' => $arrResponseErrorSection), + ), ); if (is_object($objApiOperation)) { $response_outer = $operation_name . 'Response'; @@ -402,18 +409,19 @@ public static function doApiAction($arrPost) * * @param array $arrParam リクエストパラメーター * @param float $start_time 実行時間計測用開始時間 + * * @return array エコー情報配列 (XML用の _attributes 指定入り) */ protected static function getOperationRequestEcho($arrParam, $start_time) { $arrRet = array( 'HTTPHeaders' => array('Header' => array('_attributes' => array('Name' => 'UserAgent', - 'Value' => htmlspecialchars($_SERVER['HTTP_USER_AGENT'])))), + 'Value' => htmlspecialchars($_SERVER['HTTP_USER_AGENT']), ))), 'RequestId' => $start_time, 'Arguments' => array(), ); foreach ($arrParam as $key => $val) { - $arrRet['Arguments'][] = array('_attributes' => array('Name' => htmlentities($key, ENT_NOQUOTES, 'UTF-8'), 'Value' => htmlentities($val, ENT_NOQUOTES, 'UTF-8'))); + $arrRet['Arguments'][] = array('_attributes' => array('Name' => htmlentities($key, \ENT_NOQUOTES, 'UTF-8'), 'Value' => htmlentities($val, \ENT_NOQUOTES, 'UTF-8'))); } $arrRet['RequestProcessingTime'] = microtime(true) - $start_time; @@ -430,6 +438,7 @@ public static function sendApiResponse($type, $response_outer_name, &$arrRespons { if (API_ENABLE_FLAG == false) { http_response_code(403); + return; } switch ($type) { @@ -450,6 +459,7 @@ public static function sendApiResponse($type, $response_outer_name, &$arrRespons * APIのリクエスト基本パラメーターのチェック * * @param SC_FormParam_Ex $objFormParam + * * @return array $arrErr */ protected static function checkParam($objFormParam) @@ -470,6 +480,7 @@ protected static function checkParam($objFormParam) if (!preg_match("/^[a-zA-Z0-9\-\_\.]+$/", $objFormParam->getValue('Version')) && !SC_Utils::isBlank($objFormParam->getValue('Version'))) { $arrErr['ECCUBE.Version.ParamError'] = 'Versionの値が不正です。'; } + return $arrErr; } } diff --git a/data/class/api/SC_Api_Utils.php b/data/class/api/SC_Api_Utils.php index 5d5db21494..42e427d300 100644 --- a/data/class/api/SC_Api_Utils.php +++ b/data/class/api/SC_Api_Utils.php @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/* * API関係処理のユーティリティ * * @package Api @@ -35,16 +35,16 @@ class SC_Api_Utils { /** API XML Namspase Header */ - const API_XMLNS = 'http://www.ec-cube.net/ECCUBEApi/'; + public const API_XMLNS = 'http://www.ec-cube.net/ECCUBEApi/'; /** API XML lang */ - const API_XML_LANG = 'ja'; + public const API_XML_LANG = 'ja'; /** API LOGFILE_NAME */ - const API_LOGFILE = 'logs/api.log'; + public const API_LOGFILE = 'logs/api.log'; /** API_DEBUG_MODE */ - const API_DEBUG_MODE = false; + public const API_DEBUG_MODE = false; /** * オペレーション名に対応した追加の設定情報を取得する @@ -58,7 +58,7 @@ public static function getOperationSubConfig($operation_name, $key_name = '', $a } if (!SC_Utils_Ex::isBlank($arrApiConfig['sub_data'])) { $arrData = @unserialize($arrApiConfig['sub_data']); - if ($arrData === FALSE) { + if ($arrData === false) { return $arrApiConfig['sub_data']; } else { if ($key_name != '') { @@ -77,6 +77,7 @@ public static function getOperationSubConfig($operation_name, $key_name = '', $a * Configが無い場合は、APIデフォルトを取得する * * @param string $operation_name + * * @return array 設定配列 */ public static function getApiConfig($operation_name) @@ -114,7 +115,7 @@ public static function getApiConfig($operation_name) * @param text $operation_name @ @rturn void */ - public static function printApiLog($msg, $start_time = '' , $operation_name = '') + public static function printApiLog($msg, $start_time = '', $operation_name = '') { if (!SC_Utils_Ex::isBlank($operation_name)) { $msg = 'API_' . $operation_name . ':' . $msg; @@ -130,6 +131,7 @@ public static function printApiLog($msg, $start_time = '' , $operation_name = '' * * @param string $operation_name オペレーション名 * @param array $arrParam リクエストパラメーター + * * @return object APIオペレーションクラスオブジェクト */ public static function loadApiOperation($operation_name, $arrParam = array()) @@ -137,19 +139,19 @@ public static function loadApiOperation($operation_name, $arrParam = array()) // API_UPLOADのほうが優先 // API_UPLOAD > API_CLASS_EX > API_CLASS if (file_exists(API_UPLOAD_REALDIR . $operation_name . '.php')) { - $api_operation_file = API_UPLOAD_REALDIR . $operation_name . '.php'; + $api_operation_file = API_UPLOAD_REALDIR . $operation_name . '.php'; $api_class_name = 'API_' . $operation_name; } elseif (file_exists(API_CLASS_EX_REALDIR . $operation_name . '_Ex.php')) { - $api_operation_file = API_CLASS_EX_REALDIR . $operation_name . '_Ex.php'; + $api_operation_file = API_CLASS_EX_REALDIR . $operation_name . '_Ex.php'; $api_class_name = 'API_' . $operation_name . '_Ex'; } elseif (file_exists(API_CLASS_REALDIR . $operation_name . '.php')) { - $api_operation_file = API_CLASS_REALDIR . $operation_name . '.php'; + $api_operation_file = API_CLASS_REALDIR . $operation_name . '.php'; $api_class_name = 'API_' . $operation_name; } else { return false; } require_once $api_operation_file; - $objApiOperation = new $api_class_name ($arrParam); + $objApiOperation = new $api_class_name($arrParam); return $objApiOperation; } @@ -233,9 +235,9 @@ public static function sendResponseXml($response_outer_name, &$arrResponse) 'encoding' => 'UTF-8', 'rootName' => $response_outer_name, 'rootAttributes' => array('xmlns' => self::API_XMLNS . ECCUBE_VERSION, - 'xml:lang' => self::API_XML_LANG), + 'xml:lang' => self::API_XML_LANG, ), 'defaultTagName' => 'Response', - 'attributesArray' => '_attributes' + 'attributesArray' => '_attributes', ); $objSerializer = new XML_Serializer($options); diff --git a/data/class/api/operations/AddrFromZip.php b/data/class/api/operations/AddrFromZip.php index 6ec4ffa9ad..5890e79496 100644 --- a/data/class/api/operations/AddrFromZip.php +++ b/data/class/api/operations/AddrFromZip.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_AddrFromZip extends SC_Api_Abstract_Ex { protected $operation_name = 'AddrFromZip'; @@ -50,7 +49,7 @@ public function doAction($arrParam) 'City' => $arrAddrList[0]['city'], 'Town' => $arrAddrList[0]['town'], ) - ); + ); return true; } diff --git a/data/class/api/operations/BrowseNodeLookup.php b/data/class/api/operations/BrowseNodeLookup.php index c12262fcb1..bd944c5e1f 100644 --- a/data/class/api/operations/BrowseNodeLookup.php +++ b/data/class/api/operations/BrowseNodeLookup.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_BrowseNodeLookup extends SC_Api_Abstract_Ex { protected $operation_name = 'BrowseNodeLookup'; @@ -72,15 +71,15 @@ public function doAction($arrParam) $arrData = array( 'BrowseNodeId' => $category_id, 'Name' => $arrCategory['category_name'], - 'PageURL' => HTTP_URL . 'products/list.php?category_id=' . $arrCategory['category_id'], - 'has_children' => count($arrChildren) > 0 + 'PageURL' => HTTP_URL . 'products/list.php?category_id=' . $arrCategory['category_id'], + 'has_children' => count($arrChildren) > 0, ); } else { $arrData = array( 'BrowseNodeId' => $category_id, 'Name' => 'ホーム', - 'PageURL' => HTTP_URL, - 'has_children' => count($arrChildren) > 0 + 'PageURL' => HTTP_URL, + 'has_children' => count($arrChildren) > 0, ); } @@ -91,7 +90,7 @@ public function doAction($arrParam) 'BrowseNodeId' => $category['category_id'], 'Name' => $category['category_name'], 'PageURL' => HTTP_URL . 'products/list.php?category_id=' . $category['category_id'], - 'has_children' => $category['has_children'] + 'has_children' => $category['has_children'], ); } } diff --git a/data/class/api/operations/CartAdd.php b/data/class/api/operations/CartAdd.php index 367b405f6c..5e2f7faec9 100644 --- a/data/class/api/operations/CartAdd.php +++ b/data/class/api/operations/CartAdd.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_CartAdd extends SC_Api_Abstract_Ex { protected $operation_name = 'CartAdd'; @@ -41,7 +40,7 @@ class API_CartAdd extends SC_Api_Abstract_Ex public function doAction($arrParam) { $this->arrResponse = array( - 'Version' => ECCUBE_VERSION); + 'Version' => ECCUBE_VERSION, ); return true; } diff --git a/data/class/api/operations/CartClear.php b/data/class/api/operations/CartClear.php index 54f539d782..ff9ade3565 100644 --- a/data/class/api/operations/CartClear.php +++ b/data/class/api/operations/CartClear.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_CartClear extends SC_Api_Abstract_Ex { protected $operation_name = 'CartClear'; @@ -41,7 +40,7 @@ class API_CartClear extends SC_Api_Abstract_Ex public function doAction($arrParam) { $this->arrResponse = array( - 'Version' => ECCUBE_VERSION); + 'Version' => ECCUBE_VERSION, ); return true; } diff --git a/data/class/api/operations/CartCreate.php b/data/class/api/operations/CartCreate.php index 2af3cacb0c..7db9bf86f2 100644 --- a/data/class/api/operations/CartCreate.php +++ b/data/class/api/operations/CartCreate.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_CartCreate extends SC_Api_Abstract_Ex { protected $operation_name = 'CartCreate'; @@ -41,7 +40,7 @@ class API_CartCreate extends SC_Api_Abstract_Ex public function doAction($arrParam) { $this->arrResponse = array( - 'Version' => ECCUBE_VERSION); + 'Version' => ECCUBE_VERSION, ); return true; } diff --git a/data/class/api/operations/CartGet.php b/data/class/api/operations/CartGet.php index 8561e4a0be..fbad30956c 100644 --- a/data/class/api/operations/CartGet.php +++ b/data/class/api/operations/CartGet.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_CartGet extends SC_Api_Abstract_Ex { protected $operation_name = 'CartGet'; @@ -41,7 +40,7 @@ class API_CartGet extends SC_Api_Abstract_Ex public function doAction($arrParam) { $this->arrResponse = array( - 'Version' => ECCUBE_VERSION); + 'Version' => ECCUBE_VERSION, ); return true; } diff --git a/data/class/api/operations/CartModify.php b/data/class/api/operations/CartModify.php index d5b4e10dbb..b9fc636b61 100644 --- a/data/class/api/operations/CartModify.php +++ b/data/class/api/operations/CartModify.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_CartModify extends SC_Api_Abstract_Ex { protected $operation_name = 'CartModify'; @@ -41,7 +40,7 @@ class API_CartModify extends SC_Api_Abstract_Ex public function doAction($arrParam) { $this->arrResponse = array( - 'Version' => ECCUBE_VERSION); + 'Version' => ECCUBE_VERSION, ); return true; } diff --git a/data/class/api/operations/Default.php b/data/class/api/operations/Default.php index 0668e99178..318806c928 100644 --- a/data/class/api/operations/Default.php +++ b/data/class/api/operations/Default.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_Default extends SC_Api_Abstract_Ex { protected $operation_name = 'Default'; diff --git a/data/class/api/operations/GetVersion.php b/data/class/api/operations/GetVersion.php index 755fe39c32..133840dbe5 100644 --- a/data/class/api/operations/GetVersion.php +++ b/data/class/api/operations/GetVersion.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_GetVersion extends SC_Api_Abstract_Ex { protected $operation_name = 'GetVersion'; @@ -41,7 +40,7 @@ class API_GetVersion extends SC_Api_Abstract_Ex public function doAction($arrParam) { $this->arrResponse = array( - 'Version' => ECCUBE_VERSION); + 'Version' => ECCUBE_VERSION, ); return true; } diff --git a/data/class/api/operations/ItemLookup.php b/data/class/api/operations/ItemLookup.php index f52ca5cce8..913dbbe588 100644 --- a/data/class/api/operations/ItemLookup.php +++ b/data/class/api/operations/ItemLookup.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_ItemLookup extends SC_Api_Abstract_Ex { protected $operation_name = 'ItemLookup'; @@ -46,16 +45,16 @@ public function doAction($arrParam) $objProduct = new SC_Product_Ex(); switch ($arrRequest['IdType']) { - case 'product_code': - $search_column = 'product_code'; - break; - case 'product_class_id': - $arrProduct = $objProduct->getDetailAndProductsClass($arrRequest['ItemId']); - break; - case 'product_id': - default: - $arrProduct = $objProduct->getDetail($arrRequest['ItemId']); - break; + case 'product_code': + $search_column = 'product_code'; + break; + case 'product_class_id': + $arrProduct = $objProduct->getDetailAndProductsClass($arrRequest['ItemId']); + break; + case 'product_id': + default: + $arrProduct = $objProduct->getDetail($arrRequest['ItemId']); + break; } $objProduct->setProductsClassByProductIds(array($arrProduct['product_id'])); @@ -79,15 +78,15 @@ public function doAction($arrParam) protected function checkErrorExtended($arrParam) { switch ($arrParam['IdType']) { - case 'product_code': - break; - case 'product_id': - case 'product_class_id': - default: - $objErr = new SC_CheckError_Ex($arrParam); - $objErr->doFunc(array('指定ID', 'ItemId', INT_LEN), array('MAX_LENGTH_CHECK', 'NUM_CHECK')); - $this->addError($objErr->arrErr); - break; + case 'product_code': + break; + case 'product_id': + case 'product_class_id': + default: + $objErr = new SC_CheckError_Ex($arrParam); + $objErr->doFunc(array('指定ID', 'ItemId', INT_LEN), array('MAX_LENGTH_CHECK', 'NUM_CHECK')); + $this->addError($objErr->arrErr); + break; } } diff --git a/data/class/api/operations/ItemSearch.php b/data/class/api/operations/ItemSearch.php index edd714dd20..26b055695d 100644 --- a/data/class/api/operations/ItemSearch.php +++ b/data/class/api/operations/ItemSearch.php @@ -24,11 +24,10 @@ /** * APIの基本クラス * - * @package Api * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ - class API_ItemSearch extends SC_Api_Abstract_Ex { protected $operation_name = 'ItemSearch'; @@ -42,9 +41,9 @@ public function doAction($arrParam) { $arrRequest = $this->doInitParam($arrParam); if (!$this->isParamError()) { - $masterData = new SC_DB_MasterData_Ex(); - $arrSTATUS = $masterData->getMasterData('mtb_status'); - $arrSTATUS_IMAGE = $masterData->getMasterData('mtb_status_image'); + $masterData = new SC_DB_MasterData_Ex(); + $arrSTATUS = $masterData->getMasterData('mtb_status'); + $arrSTATUS_IMAGE = $masterData->getMasterData('mtb_status_image'); $objProduct = new SC_Product_Ex(); $arrSearchData = array( @@ -67,7 +66,7 @@ public function doAction($arrParam) if (!SC_Utils_Ex::isBlank($arrProducts)) { $arrProducts = $this->setStatusDataTo($arrProducts, $arrSTATUS, $arrSTATUS_IMAGE); SC_Product_Ex::setPriceTaxTo($arrProducts); - foreach ($arrProducts as $key=>$val) { + foreach ($arrProducts as $key => $val) { $arrProducts[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']); } @@ -76,7 +75,7 @@ public function doAction($arrParam) $arrData[] = array( 'product_id' => $val['product_id'], 'DetailPageURL' => HTTP_URL . 'products/detail.php?product_id=' . $val['product_id'], - 'ItemAttributes' => $val + 'ItemAttributes' => $val, ); } $this->setResponse('Item', $arrData); @@ -110,6 +109,7 @@ public function getResponseGroupName() * @param integer $disp_number * @param integer $linemax * @param SC_Product_Ex $objProduct + * * @return array * TODO: LC_Page_Products_List::lfGetProductsList() と共通化 */ @@ -125,18 +125,18 @@ protected function getProductsList($searchCondition, $disp_number, $startno, $li case 'price': $objProduct->setProductsOrder('price02', 'dtb_products_class', 'ASC'); break; - // 販売価格が高い順 + // 販売価格が高い順 case '-price': $objProduct->setProductsOrder('price02', 'dtb_products_class', 'DESC'); break; - // 新着順 + // 新着順 case 'releasedate': case 'date': $objProduct->setProductsOrder('create_date', 'dtb_products', 'DESC'); break; - // 新着順 + // 新着順 case 'releasedate': case 'date': $objProduct->setProductsOrder('create_date', 'dtb_products', 'ASC'); @@ -144,8 +144,8 @@ protected function getProductsList($searchCondition, $disp_number, $startno, $li default: if (strlen($searchCondition['where_category']) >= 1) { - $dtb_product_categories = '(SELECT * FROM dtb_product_categories WHERE '.$searchCondition['where_category'].')'; - $arrOrderVal = $searchCondition['arrvalCategory']; + $dtb_product_categories = '(SELECT * FROM dtb_product_categories WHERE ' . $searchCondition['where_category'] . ')'; + $arrOrderVal = $searchCondition['arrvalCategory']; } else { $dtb_product_categories = 'dtb_product_categories'; } @@ -184,11 +184,11 @@ protected function getProductsList($searchCondition, $disp_number, $startno, $li protected function getSearchCondition($arrSearchData) { $searchCondition = array( - 'where' => '', - 'arrval' => array(), - 'where_category' => '', - 'arrvalCategory' => array(), - 'orderby' => '' + 'where' => '', + 'arrval' => array(), + 'where_category' => '', + 'arrvalCategory' => array(), + 'orderby' => '', ); // カテゴリからのWHERE文字列取得 @@ -214,15 +214,15 @@ protected function getSearchCondition($arrSearchData) // 分割したキーワードを一つずつwhere文に追加 foreach ($names as $val) { if (strlen($val) > 0) { - $searchCondition['where'] .= ' AND ( alldtl.name ILIKE ? OR alldtl.comment3 ILIKE ?) '; - $searchCondition['arrval'][] = "%$val%"; - $searchCondition['arrval'][] = "%$val%"; + $searchCondition['where'] .= ' AND ( alldtl.name ILIKE ? OR alldtl.comment3 ILIKE ?) '; + $searchCondition['arrval'][] = "%$val%"; + $searchCondition['arrval'][] = "%$val%"; } } // メーカーらのWHERE文字列取得 if ($arrSearchData['maker_id']) { - $searchCondition['where'] .= ' AND alldtl.maker_id = ? '; + $searchCondition['where'] .= ' AND alldtl.maker_id = ? '; $searchCondition['arrval'][] = $arrSearchData['maker_id']; } @@ -245,10 +245,11 @@ protected function getSearchCondition($arrSearchData) /** * 商品情報配列に商品ステータス情報を追加する * - * @param Array $arrProducts 商品一覧情報 - * @param Array $arrStatus 商品ステータス配列 - * @param Array $arrStatusImage スタータス画像配列 - * @return Array $arrProducts 商品一覧情報 + * @param array $arrProducts 商品一覧情報 + * @param array $arrStatus 商品ステータス配列 + * @param array $arrStatusImage スタータス画像配列 + * + * @return array $arrProducts 商品一覧情報 */ protected function setStatusDataTo($arrProducts, $arrStatus, $arrStatusImage) { @@ -259,7 +260,7 @@ protected function setStatusDataTo($arrProducts, $arrStatus, $arrStatusImage) $arrProductStatus = array( 'status_cd' => $product_status_id, 'status_name' => $arrStatus[$product_status_id], - 'status_image' =>$arrStatusImage[$product_status_id], + 'status_image' => $arrStatusImage[$product_status_id], ); $arrProducts['productStatus'][$product_id][$i] = $arrProductStatus; } diff --git a/data/class/batch/SC_Batch_Update.php b/data/class/batch/SC_Batch_Update.php index 03f238550b..0920b91985 100644 --- a/data/class/batch/SC_Batch_Update.php +++ b/data/class/batch/SC_Batch_Update.php @@ -26,8 +26,8 @@ * * XXX Singleton にするべき... * - * @package Batch * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Batch_Update extends SC_Batch @@ -46,21 +46,22 @@ class SC_Batch_Update extends SC_Batch * バッチ処理を実行する. * * @param string $target アップデータファイルのディレクトリパス + * * @return void */ public function execute($target = '.') { $msg = ''; $oldMask = umask(0); - $bkupDistInfoArray = array(); //バックアップファイル用のdistinfoファイル内容 + $bkupDistInfoArray = array(); // バックアップファイル用のdistinfoファイル内容 $bkupPath = DATA_REALDIR . 'downloads/backup/update_' . time() . '/'; $bkupPathFile = $bkupPath . 'files/'; $this->lfMkdirRecursive($bkupPathFile . 'dummy'); $arrLog = array( - 'err' => array(), - 'ok' => array(), - 'buckup_path' => $bkupPath + 'err' => array(), + 'ok' => array(), + 'buckup_path' => $bkupPath, ); if (!is_writable($bkupPath) || !is_writable($bkupPathFile)) { @@ -78,10 +79,10 @@ public function execute($target = '.') foreach ($fileArrays as $path) { if (is_file($path)) { // ファイル名を取得 - $fileName = pathinfo($path, PATHINFO_BASENAME); + $fileName = pathinfo($path, \PATHINFO_BASENAME); // 拡張子を取得 - $suffix = pathinfo($path, PATHINFO_EXTENSION); + $suffix = pathinfo($path, \PATHINFO_EXTENSION); // distinfo の変数定義 $distinfo = isset($distinfo) ? $distinfo : ''; @@ -93,7 +94,7 @@ public function execute($target = '.') // 除外ファイルをスキップ if (in_array($fileName, $excludeArray)) { - //$arrLog['ok'][] = '次のファイルは除外されました: ' . $path; + // $arrLog['ok'][] = '次のファイルは除外されました: ' . $path; $msg = '次のファイルは除外されました: ' . $path; $this->printLog($msg); continue; @@ -102,7 +103,7 @@ public function execute($target = '.') // sha1 を取得 $sha1 = sha1_file($path); - //$arrLog[] = $sha1 . ' => ' . $path; + // $arrLog[] = $sha1 . ' => ' . $path; // 変換対象を順に処理 foreach ($includeArray as $include) { @@ -128,7 +129,7 @@ public function execute($target = '.') // バックアップを作成 if (file_exists($out)) { - $bkupTo = $bkupPathFile . pathinfo($out, PATHINFO_BASENAME); + $bkupTo = $bkupPathFile . pathinfo($out, \PATHINFO_BASENAME); $bkupDistInfoArray[sha1_file($out)] = $out; if (!@copy($out, $bkupTo)) { @@ -163,7 +164,7 @@ public function execute($target = '.') continue; } - $msg = 'ファイルのコピーに成功しました: ' . $out; + $msg = 'ファイルのコピーに成功しました: ' . $out; $arrLog['ok'][] = $msg; $this->printLog($msg); // ファイルを閉じる @@ -194,7 +195,9 @@ public function execute($target = '.') * * @param string 任意のパス名 * @param string $dir + * * @return array $dir より下層に存在するパス名の配列 + * * @see http://www.php.net/glob */ public function listdirs($dir) @@ -202,10 +205,14 @@ public function listdirs($dir) static $alldirs = array(); $dirs = glob($dir . '/*'); if (is_array($dirs) && count($dirs) > 0) { - foreach ($dirs as $d) $alldirs[] = $d; + foreach ($dirs as $d) { + $alldirs[] = $d; + } } if (is_array($dirs)) { - foreach ($dirs as $dir) $this->listdirs($dir); + foreach ($dirs as $dir) { + $this->listdirs($dir); + } } return $alldirs; @@ -221,12 +228,12 @@ public function lfMkdirRecursive($path) $path = dirname($path); // HTML_REALDIR/DATA_REALDIRの判別 - if (preg_match("@\Q".HTML_REALDIR."\E@", $path) > 0) { + if (preg_match("@\Q" . HTML_REALDIR . "\E@", $path) > 0) { $dir = str_replace('\\', '/', HTML_REALDIR); - $path = preg_replace("@\Q".HTML_REALDIR."\E@", '', $path); - } elseif (preg_match("@\Q".DATA_REALDIR."\E@", $path) > 0) { + $path = preg_replace("@\Q" . HTML_REALDIR . "\E@", '', $path); + } elseif (preg_match("@\Q" . DATA_REALDIR . "\E@", $path) > 0) { $dir = str_replace('\\', '/', DATA_REALDIR); - $path = preg_replace("@\Q".DATA_REALDIR."\E@", '', $path); + $path = preg_replace("@\Q" . DATA_REALDIR . "\E@", '', $path); } else { $dir = ''; } @@ -235,7 +242,9 @@ public function lfMkdirRecursive($path) foreach ($arrDirs as $n) { $dir .= $n . '/'; if (!file_exists($dir)) { - if (!@mkdir($dir)) break; + if (!@mkdir($dir)) { + break; + } } } } @@ -246,7 +255,7 @@ public function makeDistInfo($bkupDistInfoArray) . '$distifo = array(' . "\n"; foreach ($bkupDistInfoArray as $key => $value) { - $src .= "'${key}' => '${value}',\n"; + $src .= "'{$key}' => '{$value}',\n"; } $src .= ");\n?>"; diff --git a/data/class/db/SC_DB_DBFactory.php b/data/class/db/SC_DB_DBFactory.php index cad8b94b8c..1221345e77 100644 --- a/data/class/db/SC_DB_DBFactory.php +++ b/data/class/db/SC_DB_DBFactory.php @@ -24,8 +24,8 @@ /** * DBに依存した処理を抽象化するファクトリークラス. * - * @package DB * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_DB_DBFactory @@ -34,6 +34,7 @@ class SC_DB_DBFactory * DB_TYPE に応じた DBFactory インスタンスを生成する. * * @param string $db_type 任意のインスタンスを返したい場合は DB_TYPE 文字列を指定 + * * @return SC_DB_DBFactory DBFactory インスタンス */ public static function getInstance($db_type = DB_TYPE) @@ -47,7 +48,7 @@ public static function getInstance($db_type = DB_TYPE) return new SC_DB_DBFactory_PGSQL(); default: - return new SC_DB_DBFactory(); + return new self(); } } @@ -59,19 +60,20 @@ public static function getInstance($db_type = DB_TYPE) * $dsn が空ではない場合は, $dsn の値を返す. * * @param string $dsn データソース名 + * * @return string データソース名またはDB接続パラメータの連想配列 */ public function getDSN($dsn = '') { if (empty($dsn)) { if (defined('DEFAULT_DSN')) { - $dsn = array('phptype' => DB_TYPE, + $dsn = array('phptype' => DB_TYPE, 'username' => DB_USER, 'password' => DB_PASSWORD, 'protocol' => 'tcp', 'hostspec' => DB_SERVER, - 'port' => DB_PORT, - 'database' => DB_NAME + 'port' => DB_PORT, + 'database' => DB_NAME, ); } else { return ''; @@ -85,6 +87,7 @@ public function getDSN($dsn = '') * DBのバージョンを取得する. * * @param string $dsn データソース名 + * * @return string データベースのバージョン */ public function sfGetDBVersion($dsn = '') @@ -96,6 +99,7 @@ public function sfGetDBVersion($dsn = '') * MySQL 用の SQL 文に変更する. * * @param string $sql SQL 文 + * * @return string MySQL 用に置換した SQL 文 */ public function sfChangeMySQL($sql) @@ -107,6 +111,7 @@ public function sfChangeMySQL($sql) * 昨日の売上高・売上件数を算出する SQL を返す. * * @param string $method SUM または COUNT + * * @return string 昨日の売上高・売上件数を算出する SQL */ public function getOrderYesterdaySql($method) @@ -118,6 +123,7 @@ public function getOrderYesterdaySql($method) * 当月の売上高・売上件数を算出する SQL を返す. * * @param string $method SUM または COUNT + * * @return string 当月の売上高・売上件数を算出する SQL */ public function getOrderMonthSql($method) @@ -159,6 +165,7 @@ public function getDownloadableDaysWhereSql() * 文字列連結を行う. * * @param string[] $columns 連結を行うカラム名 + * * @return string 連結後の SQL 文 */ public function concatColumn($columns) @@ -172,7 +179,9 @@ public function concatColumn($columns) * 引数に部分一致するテーブル名を配列で返す. * * @deprecated SC_Query::listTables() を使用してください + * * @param string $expression 検索文字列 + * * @return array テーブル名の配列 */ public function findTableNames($expression = '') @@ -187,6 +196,7 @@ public function findTableNames($expression = '') * * @param string $table 対象テーブル名 * @param string $name 対象カラム名 + * * @return array インデックス設定情報配列 */ public function sfGetCreateIndexDefinition($table, $name, $definition) @@ -198,6 +208,7 @@ public function sfGetCreateIndexDefinition($table, $name, $definition) * 各 DB に応じた SC_Query での初期化を行う * * @param SC_Query $objQuery SC_Query インスタンス + * * @return void */ public function initObjQuery(SC_Query &$objQuery) @@ -211,7 +222,7 @@ public function initObjQuery(SC_Query &$objQuery) */ public function listTables(SC_Query &$objQuery) { - $objManager =& $objQuery->conn->loadModule('Manager'); + $objManager = &$objQuery->conn->loadModule('Manager'); return $objManager->listTables(); } @@ -222,9 +233,10 @@ public function listTables(SC_Query &$objQuery) * @param string 元の SQL 文 * @param integer LIMIT * @param integer OFFSET + * * @return string 付加後の SQL 文 */ - function addLimitOffset($sql, $limit = 0, $offset = 0) + public function addLimitOffset($sql, $limit = 0, $offset = 0) { if ($limit != 0) { $sql .= " LIMIT $limit"; @@ -242,6 +254,7 @@ function addLimitOffset($sql, $limit = 0, $offset = 0) * * @param string $where_products_class 商品規格情報の WHERE 句 * @param array $product_ids 商品IDの配列 + * * @return string 商品詳細の SQL */ public function alldtlSQL($where_products_class = '', $product_ids = array()) @@ -257,8 +270,8 @@ public function alldtlSQL($where_products_class = '', $product_ids = array()) // 商品IDが特定できている場合は, 先に product_id で対象を絞り込む if (count($product_ids) > 0) { $in = SC_Utils_Ex::repeatStrWithSeparator('?', count($product_ids)); - $product_id_cause = ' AND product_id IN ('.$in.')'; - $dtb_products_table = ' ( SELECT * FROM dtb_products WHERE product_id IN ('.$in.') ) AS dtb_products'; + $product_id_cause = ' AND product_id IN (' . $in . ')'; + $dtb_products_table = ' ( SELECT * FROM dtb_products WHERE product_id IN (' . $in . ') ) AS dtb_products'; } /* * point_rate, deliv_fee は商品規格(dtb_products_class)ごとに保持しているが, diff --git a/data/class/db/SC_DB_MasterData.php b/data/class/db/SC_DB_MasterData.php index 3804936ac6..ac14bcac01 100644 --- a/data/class/db/SC_DB_MasterData.php +++ b/data/class/db/SC_DB_MasterData.php @@ -37,8 +37,8 @@ * マスターデータがキャッシュされると, key => value 形式の配列として使用できる. * マスターデータのキャッシュは, MASTER_DATA_REALDIR/マスターデータ名.php というファイルが生成される. * - * @package DB * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_DB_MasterData @@ -62,6 +62,7 @@ class SC_DB_MasterData * @param string $name マスターデータ名 * @param array $columns [0] => キー, [1] => 表示文字列, [2] => 表示順 * を表すカラム名を格納した配列 + * * @return array マスターデータ */ public function getMasterData($name, $columns = array()) @@ -94,6 +95,7 @@ public function getMasterData($name, $columns = array()) * を表すカラム名を格納した配列 * @param array $masterData マスターデータ * @param bool $autoCommit トランザクションを自動的に commit する場合 true + * * @return integer マスターデータの登録数 */ public function registMasterData($name, $columns, $masterData, $autoCommit = true) @@ -108,7 +110,7 @@ public function registMasterData($name, $columns, $masterData, $autoCommit = tru foreach ($masterData as $key => $val) { $sqlVal = array($columns[0] => (string) $key, $columns[1] => (string) $val, - $columns[2] => (string) $i); + $columns[2] => (string) $i, ); $this->objQuery->insert($name, $sqlVal); $i++; } @@ -130,6 +132,7 @@ public function registMasterData($name, $columns, $masterData, $autoCommit = tru * を表すカラム名を格納した配列 * @param array $masterData マスターデータ * @param bool $autoCommit トランザクションを自動的に commit する場合 true + * * @return integer マスターデータの更新数 */ public function updateMasterData($name, $columns, $masterData, $autoCommit = true) @@ -145,7 +148,7 @@ public function updateMasterData($name, $columns, $masterData, $autoCommit = tru $i = 0; foreach ($masterData as $key => $val) { $sqlVal = array($columns[1] => $val); - $this->objQuery->update($name, $sqlVal, $columns[0] . ' = ' . SC_Utils_Ex::sfQuoteSmart($key)); + $this->objQuery->update($name, $sqlVal, $columns[0] . ' = ' . SC_Utils_Ex::sfQuoteSmart($key)); $i++; } if ($autoCommit) { @@ -165,6 +168,7 @@ public function updateMasterData($name, $columns, $masterData, $autoCommit = tru * @param string $key キー名 * @param string $comment コメント * @param bool $autoCommit トランザクションを自動的に commit する場合 true + * * @return integer マスターデータの更新数 */ public function insertMasterData($name, $key, $value, $comment, $autoCommit = true) @@ -198,6 +202,7 @@ public function insertMasterData($name, $key, $value, $comment, $autoCommit = tr * * @param string $name マスターデータ名 * @param bool $autoCommit トランザクションを自動的に commit する場合 true + * * @return integer マスターデータの削除数 */ public function deleteMasterData($name, $autoCommit = true) @@ -222,6 +227,7 @@ public function deleteMasterData($name, $autoCommit = true) * マスターデータのキャッシュを消去する. * * @param string $name マスターデータ名 + * * @return boolean|null 消去した場合 true */ public function clearCache($name) @@ -249,6 +255,7 @@ public function clearCache($name) * @param bool $isDefine 定数を生成する場合 true * @param string[] $commentColumn [0] => キー, [1] => コメント文字列, * [2] => 表示順 を表すカラム名を格納した配列 + * * @return bool キャッシュの生成に成功した場合 true */ public function createCache($name, $columns = array(), $isDefine = false, $commentColumn = array()) @@ -268,7 +275,7 @@ public function createCache($name, $columns = array(), $isDefine = false, $comme } else { $data .= $this->getMasterDataAsDefine($masterData); } - $data .= "\n"; + $data .= "\n"; // 配列を生成する場合 } else { @@ -302,6 +309,7 @@ public function createCache($name, $columns = array(), $isDefine = false, $comme * @param string $name マスターデータ名 * @param array $columns [0] => キー, [1] => 表示文字列, [2] => 表示順 * を表すカラム名を格納した配列 + * * @return array マスターデータ */ public function getDbMasterData($name, $columns = array()) @@ -331,6 +339,7 @@ public function getDbMasterData($name, $columns = array()) * * @param array $columns [0] => キー, [1] => 表示文字列, [2] => 表示順 * を表すカラム名を格納した配列 + * * @return array カラム名を格納した配列 */ public function getDefaultColumnName($columns = array()) @@ -345,9 +354,9 @@ public function getDefaultColumnName($columns = array()) /** * マスターデータの配列を定数定義の文字列として出力する. * - * @access private * @param array $masterData マスターデータの配列 * @param array $comments コメントの配列 + * * @return string 定数定義の文字列 */ public function getMasterDataAsDefine($masterData, $comments = array()) diff --git a/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php b/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php index 46dc8b391b..61ea5638e3 100644 --- a/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php +++ b/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php @@ -28,8 +28,8 @@ * 必ず SC_DB_DBFactory クラスを経由してインスタンス化する. * また, SC_DB_DBFactory クラスの関数を必ずオーバーライドしている必要がある. * - * @package DB * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_DB_DBFactory_MYSQL extends SC_DB_DBFactory @@ -41,6 +41,7 @@ class SC_DB_DBFactory_MYSQL extends SC_DB_DBFactory * DBのバージョンを取得する. * * @param string $dsn データソース名 + * * @return string データベースのバージョン */ public function sfGetDBVersion($dsn = '') @@ -54,8 +55,8 @@ public function sfGetDBVersion($dsn = '') /** * MySQL 用の SQL 文に変更する. * - * @access private * @param string $sql SQL 文 + * * @return string MySQL 用に置換した SQL 文 */ public function sfChangeMySQL($sql) @@ -72,6 +73,7 @@ public function sfChangeMySQL($sql) $sql = $this->sfChangeArrayToString($sql); // rank に引用符をつける $sql = $this->sfChangeReservedWords($sql); + return $sql; } @@ -92,6 +94,7 @@ public function getCharSet() * 昨日の売上高・売上件数を算出する SQL を返す. * * @param string $method SUM または COUNT + * * @return string 昨日の売上高・売上件数を算出する SQL */ public function getOrderYesterdaySql($method) @@ -106,11 +109,12 @@ public function getOrderYesterdaySql($method) * 当月の売上高・売上件数を算出する SQL を返す. * * @param string $method SUM または COUNT + * * @return string 当月の売上高・売上件数を算出する SQL */ public function getOrderMonthSql($method) { - return 'SELECT '.$method.'(total) FROM dtb_order ' + return 'SELECT ' . $method . '(total) FROM dtb_order ' . 'WHERE del_flg = 0 ' . "AND date_format(create_date, '%Y/%m') = ? " . "AND date_format(create_date, '%Y/%m/%d') <> date_format(CURRENT_TIMESTAMP, '%Y/%m/%d') " @@ -147,6 +151,7 @@ public function getSendHistoryWhereStartdateSql() * ダウンロード販売の検索条件の SQL を返す. * * @param string $dtb_order_alias + * * @return string 検索条件の SQL */ public function getDownloadableDaysWhereSql($dtb_order_alias = 'dtb_order') @@ -169,6 +174,7 @@ public function getDownloadableDaysWhereSql($dtb_order_alias = 'dtb_order') * 売上集計の期間別集計のSQLを返す * * @param mixed $type + * * @return string 検索条件のSQL */ public function getOrderTotalDaysWhereSql($type) @@ -191,7 +197,7 @@ public function getOrderTotalDaysWhereSql($type) break; } - return " date_format(create_date, '".$format."') AS str_date, + return " date_format(create_date, '" . $format . "') AS str_date, COUNT(order_id) AS total_order, SUM(CASE WHEN order_sex = 1 THEN 1 ELSE 0 END) AS men, SUM(CASE WHEN order_sex = 2 THEN 1 ELSE 0 END) AS women, @@ -217,6 +223,7 @@ public function getOrderTotalAgeColSql() * 文字列連結を行う. * * @param string[] $columns 連結を行うカラム名 + * * @return string 連結後の SQL 文 */ public function concatColumn($columns) @@ -226,7 +233,7 @@ public function concatColumn($columns) $total = count($columns); foreach ($columns as $column) { $sql .= $column; - if ($i < $total -1) { + if ($i < $total - 1) { $sql .= ', '; } $i++; @@ -242,12 +249,13 @@ public function concatColumn($columns) * 引数に部分一致するテーブル名を配列で返す. * * @param string $expression 検索文字列 + * * @return array テーブル名の配列 */ public function findTableNames($expression = '') { $objQuery = SC_Query_Ex::getSingletonInstance(); - $sql = 'SHOW TABLES LIKE '. $objQuery->quote('%' . $expression . '%'); + $sql = 'SHOW TABLES LIKE ' . $objQuery->quote('%' . $expression . '%'); $arrColList = $objQuery->getAll($sql); $arrColList = SC_Utils_Ex::sfSwapArray($arrColList, false); @@ -257,8 +265,8 @@ public function findTableNames($expression = '') /** * ILIKE句 を LIKE句へ変換する. * - * @access private * @param string $sql SQL文 + * * @return string 変換後の SQL 文 */ public function sfChangeILIKE($sql) @@ -271,8 +279,8 @@ public function sfChangeILIKE($sql) /** * RANDOM() を RAND() に変換する. * - * @access private * @param string $sql SQL文 + * * @return string 変換後の SQL 文 */ public function sfChangeRANDOM($sql) @@ -285,8 +293,8 @@ public function sfChangeRANDOM($sql) /** * TRUNC() を TRUNCATE() に変換する. * - * @access private * @param string $sql SQL文 + * * @return string 変換後の SQL 文 */ public function sfChangeTrunc($sql) @@ -299,14 +307,14 @@ public function sfChangeTrunc($sql) /** * ARRAY_TO_STRING(ARRAY(A),B) を GROUP_CONCAT() に変換する. * - * @access private * @param string $sql SQL文 + * * @return string 変換後の SQL 文 */ public function sfChangeArrayToString($sql) { - if (strpos(strtoupper($sql), 'ARRAY_TO_STRING') !== FALSE) { - preg_match_all('/ARRAY_TO_STRING.*?\(.*?ARRAY\(.*?SELECT (.+?) FROM (.+?) WHERE (.+?)\).*?\,.*?\'(.+?)\'.*?\)/is', $sql, $match, PREG_SET_ORDER); + if (strpos(strtoupper($sql), 'ARRAY_TO_STRING') !== false) { + preg_match_all('/ARRAY_TO_STRING.*?\(.*?ARRAY\(.*?SELECT (.+?) FROM (.+?) WHERE (.+?)\).*?\,.*?\'(.+?)\'.*?\)/is', $sql, $match, \PREG_SET_ORDER); foreach ($match as $item) { $replace = 'GROUP_CONCAT(' . $item[1] . ' SEPARATOR \'' . $item[4] . '\') FROM ' . $item[2] . ' WHERE ' . $item[3]; @@ -324,6 +332,7 @@ public function sfChangeArrayToString($sql) * * @param string $table 対象テーブル名 * @param string $name 対象カラム名 + * * @return array インデックス設定情報配列 */ public function sfGetCreateIndexDefinition($table, $name, $definition) @@ -350,6 +359,7 @@ public function sfChangeReservedWords($sql) { $changesql = preg_replace('/(^|[^\w])RANK([^\w]|$)/i', '$1`RANK`$2', $sql); $changesql = preg_replace('/``/i', '`', $changesql); // 2重エスケープ問題の対処 + return $changesql; } @@ -367,6 +377,7 @@ public function getDummyFromClauseSql() * 各 DB に応じた SC_Query での初期化を行う * * @param SC_Query $objQuery SC_Query インスタンス + * * @return void */ public function initObjQuery(SC_Query &$objQuery) diff --git a/data/class/db/dbfactory/SC_DB_DBFactory_PGSQL.php b/data/class/db/dbfactory/SC_DB_DBFactory_PGSQL.php index 64eed7faee..8a720e6e4c 100644 --- a/data/class/db/dbfactory/SC_DB_DBFactory_PGSQL.php +++ b/data/class/db/dbfactory/SC_DB_DBFactory_PGSQL.php @@ -28,8 +28,8 @@ * 必ず SC_DB_DBFactory クラスを経由してインスタンス化する. * また, SC_DB_DBFactory クラスの関数を必ずオーバーライドしている必要がある. * - * @package DB * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_DB_DBFactory_PGSQL extends SC_DB_DBFactory @@ -38,6 +38,7 @@ class SC_DB_DBFactory_PGSQL extends SC_DB_DBFactory * DBのバージョンを取得する. * * @param string $dsn データソース名 + * * @return string データベースのバージョン */ public function sfGetDBVersion($dsn = '') @@ -54,8 +55,8 @@ public function sfGetDBVersion($dsn = '') * * DB_TYPE が PostgreSQL の場合は何もしない * - * @access private * @param string $sql SQL 文 + * * @return string MySQL 用に置換した SQL 文 */ public function sfChangeMySQL($sql) @@ -67,11 +68,12 @@ public function sfChangeMySQL($sql) * 昨日の売上高・売上件数を算出する SQL を返す. * * @param string $method SUM または COUNT + * * @return string 昨日の売上高・売上件数を算出する SQL */ public function getOrderYesterdaySql($method) { - return 'SELECT '.$method.'(total) FROM dtb_order ' + return 'SELECT ' . $method . '(total) FROM dtb_order ' . 'WHERE del_flg = 0 ' . "AND to_char(create_date,'YYYY/MM/DD') = to_char(CURRENT_TIMESTAMP - interval '1 days','YYYY/MM/DD') " . 'AND status <> ' . ORDER_CANCEL; @@ -81,11 +83,12 @@ public function getOrderYesterdaySql($method) * 当月の売上高・売上件数を算出する SQL を返す. * * @param string $method SUM または COUNT + * * @return string 当月の売上高・売上件数を算出する SQL */ public function getOrderMonthSql($method) { - return 'SELECT '.$method.'(total) FROM dtb_order ' + return 'SELECT ' . $method . '(total) FROM dtb_order ' . 'WHERE del_flg = 0 ' . "AND to_char(create_date,'YYYY/MM') = ? " . "AND to_char(create_date,'YYYY/MM/DD') <> to_char(CURRENT_TIMESTAMP,'YYYY/MM/DD') " @@ -122,12 +125,13 @@ public function getSendHistoryWhereStartdateSql() * ダウンロード販売の検索条件の SQL を返す. * * @param string $dtb_order_alias + * * @return string 検索条件の SQL */ public function getDownloadableDaysWhereSql($dtb_order_alias = 'dtb_order') { $baseinfo = SC_Helper_DB_Ex::sfGetBasisData(); - //downloadable_daysにNULLが入っている場合(無期限ダウンロード可能時)もあるので、NULLの場合は0日に補正 + // downloadable_daysにNULLが入っている場合(無期限ダウンロード可能時)もあるので、NULLの場合は0日に補正 $downloadable_days = $baseinfo['downloadable_days']; // FIXME 怪しい比較「== null」 if ($downloadable_days == null || $downloadable_days == '') { @@ -151,6 +155,7 @@ public function getDownloadableDaysWhereSql($dtb_order_alias = 'dtb_order') * 売上集計の期間別集計のSQLを返す * * @param mixed $type + * * @return string 検索条件のSQL */ public function getOrderTotalDaysWhereSql($type) @@ -173,7 +178,7 @@ public function getOrderTotalDaysWhereSql($type) break; } - return "to_char(create_date, '".$format."') AS str_date, + return "to_char(create_date, '" . $format . "') AS str_date, COUNT(order_id) AS total_order, SUM(CASE WHEN order_sex = 1 THEN 1 ELSE 0 END) AS men, SUM(CASE WHEN order_sex = 2 THEN 1 ELSE 0 END) AS women, @@ -199,6 +204,7 @@ public function getOrderTotalAgeColSql() * 文字列連結を行う. * * @param string[] $columns 連結を行うカラム名 + * * @return string 連結後の SQL 文 */ public function concatColumn($columns) @@ -208,7 +214,7 @@ public function concatColumn($columns) $total = count($columns); foreach ($columns as $column) { $sql .= $column; - if ($i < $total -1) { + if ($i < $total - 1) { $sql .= ' || '; } $i++; @@ -223,24 +229,26 @@ public function concatColumn($columns) * 引数に部分一致するテーブル名を配列で返す. * * @deprecated SC_Query::listTables() を使用してください + * * @param string $expression 検索文字列 + * * @return array テーブル名の配列 */ public function findTableNames($expression = '') { $objQuery = SC_Query_Ex::getSingletonInstance(); $sql = ' SELECT c.relname AS name, ' - . ' CASE c.relkind ' - . " WHEN 'r' THEN 'table' " - . " WHEN 'v' THEN 'view' END AS type " - . ' FROM pg_catalog.pg_class c ' - . 'LEFT JOIN pg_catalog.pg_namespace n ' - . ' ON n.oid = c.relnamespace ' - . " WHERE c.relkind IN ('r','v') " - . " AND n.nspname NOT IN ('pg_catalog', 'pg_toast') " - . ' AND pg_catalog.pg_table_is_visible(c.oid) ' - . ' AND c.relname LIKE ?' - . ' ORDER BY 1,2;'; + . ' CASE c.relkind ' + . " WHEN 'r' THEN 'table' " + . " WHEN 'v' THEN 'view' END AS type " + . ' FROM pg_catalog.pg_class c ' + . 'LEFT JOIN pg_catalog.pg_namespace n ' + . ' ON n.oid = c.relnamespace ' + . " WHERE c.relkind IN ('r','v') " + . " AND n.nspname NOT IN ('pg_catalog', 'pg_toast') " + . ' AND pg_catalog.pg_table_is_visible(c.oid) ' + . ' AND c.relname LIKE ?' + . ' ORDER BY 1,2;'; $arrColList = $objQuery->getAll($sql, array('%' . $expression . '%')); $arrColList = SC_Utils_Ex::sfSwapArray($arrColList, false); @@ -272,6 +280,7 @@ public function getDummyFromClauseSql() * テーブル一覧を取得する * * MDB2_Driver_Manager_pgsql#listTables の不具合回避を目的として独自実装している。 + * * @return array テーブル名の配列 */ public function listTables(SC_Query &$objQuery) diff --git a/data/class/graph/SC_Graph_Bar.php b/data/class/graph/SC_Graph_Bar.php index f1742fe4b7..a26967697d 100644 --- a/data/class/graph/SC_Graph_Bar.php +++ b/data/class/graph/SC_Graph_Bar.php @@ -27,7 +27,8 @@ class SC_Graph_Bar extends SC_Graph_Line_Ex // コンストラクタ public function __construct( $bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP, - $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) { + $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) + { parent::__construct($bgw, $bgh, $left, $top, $area_width, $area_height); } @@ -62,11 +63,11 @@ public function drawBar($line_no) // データ数を数える $count = count($arrPointList); // 半目盛りの幅を求める - $half_scale = intval($this->area_width / ($count + 1) / 2); + $half_scale = (int) ($this->area_width / ($count + 1) / 2); // 目盛りの幅を求める - $scale_width = intval($this->area_width / ($count + 1)); + $scale_width = (int) ($this->area_width / ($count + 1)); // 棒グラフのサイズを求める - $bar_width = intval(($scale_width - (BAR_PAD * 2)) / $this->line_max); + $bar_width = (int) (($scale_width - (BAR_PAD * 2)) / $this->line_max); // 色数の取得 $c_max = count($this->arrColor); for ($i = 0; $i < $count; $i++) { @@ -79,7 +80,7 @@ public function drawBar($line_no) if ($this->shade_on) { imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom, $this->shade_color); } - //imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[($i % $c_max)]); + // imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[($i % $c_max)]); imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[$line_no]); imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color); } diff --git a/data/class/graph/SC_Graph_Base.php b/data/class/graph/SC_Graph_Base.php index 49e0d71d75..cf734e8bc6 100644 --- a/data/class/graph/SC_Graph_Base.php +++ b/data/class/graph/SC_Graph_Base.php @@ -21,113 +21,113 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** TTFフォントファイル */ +/* TTFフォントファイル */ define('FONT_REALFILE', DATA_REALDIR . 'fonts/wlmaru20044.ttf'); -/** フォントサイズ */ +/* フォントサイズ */ define('FONT_SIZE', 8); -/** タイトルフォントサイズ */ +/* タイトルフォントサイズ */ define('TITLE_FONT_SIZE', 11); -/** 背景幅 */ +/* 背景幅 */ define('BG_WIDTH', 720); -/** 背景高さ */ +/* 背景高さ */ define('BG_HEIGHT', 400); -/** 行間 */ +/* 行間 */ define('LINE_PAD', 5); -/** フォント補正値(実際の描画幅/フォントサイズ) */ +/* フォント補正値(実際の描画幅/フォントサイズ) */ define('TEXT_RATE', 0.75); // ----------------------------------------------------------------------------- // 円グラフ // ----------------------------------------------------------------------------- -/** 円グラフ位置 */ +/* 円グラフ位置 */ define('PIE_LEFT', 200); -/** 円グラフ位置 */ +/* 円グラフ位置 */ define('PIE_TOP', 150); -/** 円グラフ幅 */ +/* 円グラフ幅 */ define('PIE_WIDTH', 230); -/** 円グラフ高さ */ +/* 円グラフ高さ */ define('PIE_HEIGHT', 100); -/** 円グラフ太さ */ +/* 円グラフ太さ */ define('PIE_THICK', 30); -/** 円グラフのラベル位置を上にあげる */ +/* 円グラフのラベル位置を上にあげる */ define('PIE_LABEL_UP', 20); -/** 値が大きいほど影が長くなる */ +/* 値が大きいほど影が長くなる */ define('PIE_SHADE_IMPACT', 0.1); // ----------------------------------------------------------------------------- // 折れ線グラフ // ----------------------------------------------------------------------------- -/** Y軸の目盛り数 */ +/* Y軸の目盛り数 */ define('LINE_Y_SCALE', 10); -/** X軸の目盛り数 */ +/* X軸の目盛り数 */ define('LINE_X_SCALE', 10); -/** 線グラフ位置 */ +/* 線グラフ位置 */ define('LINE_LEFT', 60); -/** 線グラフ位置 */ +/* 線グラフ位置 */ define('LINE_TOP', 50); -/** 線グラフ背景のサイズ */ +/* 線グラフ背景のサイズ */ define('LINE_AREA_WIDTH', 600); -/** 線グラフ背景のサイズ */ +/* 線グラフ背景のサイズ */ define('LINE_AREA_HEIGHT', 300); -/** 線グラフマークのサイズ */ +/* 線グラフマークのサイズ */ define('LINE_MARK_SIZE', 6); -/** 目盛り幅 */ +/* 目盛り幅 */ define('LINE_SCALE_SIZE', 6); -/** X軸のラベルの表示制限数 */ +/* X軸のラベルの表示制限数 */ define('LINE_XLABEL_MAX', 30); -/** X軸のタイトルと軸の間隔 */ +/* X軸のタイトルと軸の間隔 */ define('LINE_XTITLE_PAD', -5); -/** Y軸のタイトルと軸の間隔 */ +/* Y軸のタイトルと軸の間隔 */ define('LINE_YTITLE_PAD', 15); // ----------------------------------------------------------------------------- // 棒グラフ // ----------------------------------------------------------------------------- -/** グラフと目盛りの間隔 */ +/* グラフと目盛りの間隔 */ define('BAR_PAD', 6); // ----------------------------------------------------------------------------- // タイトルラベル // ----------------------------------------------------------------------------- -/** 背景枠との上幅 */ +/* 背景枠との上幅 */ define('TITLE_TOP', 10); // ----------------------------------------------------------------------------- // 凡例 // ----------------------------------------------------------------------------- -/** 背景枠との上幅 */ +/* 背景枠との上幅 */ define('LEGEND_TOP', 10); -/** 背景枠との右幅 */ +/* 背景枠との右幅 */ define('LEGEND_RIGHT', 10); /** * SC_Graph 共通クラス. * - * @package Graph * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Graph_Base @@ -190,7 +190,9 @@ public function __construct($bgw, $bgh, $left, $top) $this->bgh = $bgh; $this->image = imagecreatetruecolor($bgw, $bgh); // アンチエイリアス有効 - if (function_exists('imageantialias')) imageantialias($this->image, true); + if (function_exists('imageantialias')) { + imageantialias($this->image, true); + } // 背景色をセット imagefill($this->image, 0, 0, $this->lfGetImageColor($this->image, $this->ARR_BG_COLOR)); @@ -279,7 +281,7 @@ public function getTextWidth($text, $font_size) /** * @param integer $color */ - public function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) + public function setText($font_size, $left, $top, $text, $color = null, $angle = 0, $labelbg = false) { // 時計回りに角度を変更 $angle = -$angle; @@ -303,11 +305,11 @@ public function setText($font_size, $left, $top, $text, $color = NULL, $angle = * */ $text = mb_convert_encoding($text, 'EUC-JP', CHAR_CODE); - //$text = mb_convert_encoding($text, CHAR_CODE); - if ($color != NULL) { - ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_REALFILE, $text); + // $text = mb_convert_encoding($text, CHAR_CODE); + if ($color != null) { + imagettftext($this->image, $font_size, $angle, $left, $top + $font_size, $color, FONT_REALFILE, $text); } else { - ImageTTFText($this->image, $font_size, $angle, $left, $top + $font_size, $this->text_color, FONT_REALFILE, $text); + imagettftext($this->image, $font_size, $angle, $left, $top + $font_size, $this->text_color, FONT_REALFILE, $text); } } @@ -333,7 +335,7 @@ public function debugPrint($text) $this->text_top = FONT_SIZE + LINE_PAD; } // テキスト描画 - ImageTTFText($this->image, FONT_SIZE, 0, LINE_PAD, $this->text_top, $this->text_color, FONT_REALFILE, $text); + imagettftext($this->image, FONT_SIZE, 0, LINE_PAD, $this->text_top, $this->text_color, FONT_REALFILE, $text); $this->text_top += FONT_SIZE + LINE_PAD; } @@ -380,7 +382,7 @@ public function drawLegend($legend_max = '', $clabelbg = true) for ($i = 0; $i < $label_max; $i++) { // カラーアイコンの表示 imagerectangle($this->image, $left, $top, $left + FONT_SIZE, $top + FONT_SIZE, $this->flame_color); - imagefilledrectangle($this->image, $left + 1, $top + 1, $left + FONT_SIZE - 1, $top + FONT_SIZE - 1, $this->arrColor[($i % $c_max)]); + imagefilledrectangle($this->image, $left + 1, $top + 1, $left + FONT_SIZE - 1, $top + FONT_SIZE - 1, $this->arrColor[$i % $c_max]); // ラベルの表示 $this->setText(FONT_SIZE, $left + FONT_SIZE + LINE_PAD, $top, $this->arrLegend[$i]); $top += FONT_SIZE + LINE_PAD; @@ -416,35 +418,34 @@ public function setLegend($arrLegend) * * 表示色をメンバ変数にセットする. * - * @access protected * @return void */ public function init() { // 凡例背景 - $this->ARR_LEGENDBG_COLOR = array(245,245,245); + $this->ARR_LEGENDBG_COLOR = array(245, 245, 245); // ラベル背景 - $this->ARR_LABELBG_COLOR = array(255,255,255); + $this->ARR_LABELBG_COLOR = array(255, 255, 255); // グラフカラー $this->ARR_GRAPH_RGB = array( - array(200,50,50), - array(50,50,200), - array(50,200,50), - array(255,255,255), - array(244,200,200), - array(200,200,255), - array(50,200,50), - array(255,255,255), - array(244,244,244), + array(200, 50, 50), + array(50, 50, 200), + array(50, 200, 50), + array(255, 255, 255), + array(244, 200, 200), + array(200, 200, 255), + array(50, 200, 50), + array(255, 255, 255), + array(244, 244, 244), ); // 影の色 - $this->ARR_SHADE_COLOR = array(100,100,100); + $this->ARR_SHADE_COLOR = array(100, 100, 100); // 縁の色 $this->ARR_FLAME_COLOR = array(0, 0, 0); // 文字色 $this->ARR_TEXT_COLOR = array(0, 0, 0); // 背景カラー - $this->ARR_BG_COLOR = array(255,255,255); + $this->ARR_BG_COLOR = array(255, 255, 255); // タイトル文字色 $this->ARR_TITLE_COLOR = array(0, 0, 0); // グリッド線色 @@ -459,6 +460,7 @@ public function init() * @param integer $cx 中心点X座標 * @param integer $cy 中心点Y座標 * @param integer $e 角度 + * * @return double[] 円の中心点と直径から弧の終端座標の配列 */ public function lfGetArcPos($cx, $cy, $cw, $ch, $e) @@ -476,19 +478,19 @@ public function lfGetArcPos($cx, $cy, $cw, $ch, $e) /** 画像にテキストを描画する */ public function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) { - $color = ImageColorAllocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]); + $color = imagecolorallocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]); $text = mb_convert_encoding($text, 'UTF-8', CHAR_CODE); // 表示角度 $angle = 0; // テキスト描画 - ImageTTFText($dst_image, $font_size, $angle, $left, $top, $color, $font, $text); + imagettftext($dst_image, $font_size, $angle, $left, $top, $color, $font, $text); } /** 表示色の取得 */ public function lfGetImageColor($image, $array) { if (count($array) != 3) { - return NULL; + return null; } $ret = imagecolorallocate($image, $array[0], $array[1], $array[2]); @@ -499,7 +501,7 @@ public function lfGetImageColor($image, $array) public function lfGetImageDarkColor($image, $array) { if (count($array) != 3) { - return NULL; + return null; } $i = 0; $dark = array(); diff --git a/data/class/graph/SC_Graph_Line.php b/data/class/graph/SC_Graph_Line.php index 9083026033..ffedc0f897 100644 --- a/data/class/graph/SC_Graph_Line.php +++ b/data/class/graph/SC_Graph_Line.php @@ -42,7 +42,8 @@ class SC_Graph_Line extends SC_Graph_Base_Ex // コンストラクタ public function __construct( $bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP, - $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) { + $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) + { parent::__construct($bgw, $bgh, $left, $top); $this->area_width = $area_width; $this->area_height = $area_height; @@ -123,7 +124,7 @@ public function drawXLine($bar = false) // 棒グラフの場合は半目盛りずらす if ($bar) { - $half_scale = intval($this->area_width / ($count + 1) / 2); + $half_scale = (int) ($this->area_width / ($count + 1) / 2); } else { $half_scale = 0; } @@ -148,7 +149,7 @@ public function drawXLine($bar = false) $bar_margin = 0; } - $this->setText(FONT_SIZE, $x_pos + $this->x_margin + $bar_margin, $pos + FONT_SIZE + $this->y_margin, $this->arrXLabel[$i], NULL, $this->XLabelAngle); + $this->setText(FONT_SIZE, $x_pos + $this->x_margin + $bar_margin, $pos + FONT_SIZE + $this->y_margin, $this->arrXLabel[$i], null, $this->XLabelAngle); } } @@ -190,7 +191,7 @@ public function setMark($line_no, $left, $top, $size = LINE_MARK_SIZE) public function setYScale() { // 1目盛りの値 - $number = intval($this->graph_max / LINE_Y_SCALE); + $number = (int) ($this->graph_max / LINE_Y_SCALE); // 目盛り幅を求める $size = $this->area_height / LINE_Y_SCALE; $pos = 0; @@ -203,7 +204,6 @@ public function setYScale() } } - // public function setMax($arrData) { // データの最大値を取得する。 @@ -211,9 +211,9 @@ public function setMax($arrData) // 10の何倍かを取得 $figure = strlen($data_max) - 1; // 次の桁を計算する - $tenval = pow(10, $figure); + $tenval = 10 ** $figure; // グラフ上での最大値を求める - $this->graph_max = $tenval * (intval($data_max / $tenval) + 1); + $this->graph_max = $tenval * ((int) ($data_max / $tenval) + 1); // 最大値が10未満の場合の対応 if ($this->graph_max < 10) { $this->graph_max = 10; @@ -316,9 +316,9 @@ public function setData($arrData) $this->arrPointList[$this->line_max] = array(); for ($i = 0; $i < $count; $i++) { // X座標を求める - $x = intval($this->left + ($scale_width * ($i + 1))); + $x = (int) ($this->left + ($scale_width * ($i + 1))); // Y座標を求める - $y = intval($this->top + $this->area_height - ($this->arrDataList[$this->line_max][$i] * $rate)); + $y = (int) ($this->top + $this->area_height - ($this->arrDataList[$this->line_max][$i] * $rate)); // XY座標を保存する $this->arrPointList[$this->line_max][] = array($x, $y); } diff --git a/data/class/graph/SC_Graph_Pie.php b/data/class/graph/SC_Graph_Pie.php index 0863d9583f..e5a70bbe2b 100644 --- a/data/class/graph/SC_Graph_Pie.php +++ b/data/class/graph/SC_Graph_Pie.php @@ -63,7 +63,7 @@ public function getCircleData($array) $cnt = 0; foreach ($array as $val) { $ret = round($val * $rate); - $new_total+= $ret; + $new_total += $ret; $arrRet[] = $ret; // パーセント表示用 $this->arrLabel[] = round($val * $p_rate) . ' %'; @@ -100,7 +100,7 @@ public function drawShade() { $move = 1; for ($i = ($this->cy + $this->cz); $i <= ($this->cy + $this->cz + ($this->cz * PIE_SHADE_IMPACT)); $i++) { - imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, IMG_ARC_PIE); + imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, \IMG_ARC_PIE); $move += 0.5; } } @@ -147,10 +147,10 @@ public function drawGraph() $end = $start + $arrRad[$j]; if ($start == 0 && $end == 360) { // -90~270で指定すると円が描画できないので0~360に指定 - imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]); + imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[$j % $dc_max]); } else { // -90°は12時の位置から開始するように補正している - imagearc($this->image, $x, $i, $w, $h, $start - 90, $end - 90, $this->arrDarkColor[($j % $dc_max)]); + imagearc($this->image, $x, $i, $w, $h, $start - 90, $end - 90, $this->arrDarkColor[$j % $dc_max]); } $start = $end; } @@ -166,15 +166,15 @@ public function drawGraph() // 開始・終了が同一値だと、(imagefilledarc 関数における) 0°から360°として動作するようなので、スキップする。 // XXX 値ラベルは別ロジックなので、実質問題を生じないと考えている。 if ($start == $end) { - continue 1; + continue; } // -90°は12時の位置から開始するように補正するもの。 // 塗りつぶし - imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->arrColor[($key % $c_max)], IMG_ARC_PIE); + imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->arrColor[$key % $c_max], \IMG_ARC_PIE); // FIXME 360°描画の場合、(imagefilledarc 関数における) 0°から360°として動作する。本来-90°から360°として動作すべき。 // なお、360°と0°の組み合わせを考慮すると線が無いのも問題があるので、この処理をスキップする対応は不適当である。 // 縁取り線 - imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->flame_color, IMG_ARC_EDGED|IMG_ARC_NOFILL); + imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->flame_color, \IMG_ARC_EDGED | \IMG_ARC_NOFILL); $start = $end; } @@ -209,11 +209,11 @@ public function drawLabel($arrRad) foreach ($arrRad as $key => $rad) { $center = $start + ($rad / 2); $end = $start + $rad; - list($sx, $sy) = $this->lfGetArcPos($this->cx, $this->cy, ($this->cw / 1.5), ($this->ch / 1.5), $center); - list($ex, $ey) = $this->lfGetArcPos($this->cx, $this->cy, ($this->cw * 1.5), ($this->ch * 1.5), $center); + list($sx, $sy) = $this->lfGetArcPos($this->cx, $this->cy, $this->cw / 1.5, $this->ch / 1.5, $center); + list($ex, $ey) = $this->lfGetArcPos($this->cx, $this->cy, $this->cw * 1.5, $this->ch * 1.5, $center); // 指示線の描画 imageline($this->image, $sx, $sy, $ex + 2, $ey - PIE_LABEL_UP, $this->flame_color); - $this->setText(FONT_SIZE, $ex - 10, $ey - PIE_LABEL_UP - FONT_SIZE, $this->arrLabel[$key], NULL, 0, true); + $this->setText(FONT_SIZE, $ex - 10, $ey - PIE_LABEL_UP - FONT_SIZE, $this->arrLabel[$key], null, 0, true); $start = $end; } } diff --git a/data/class/helper/SC_Helper_Address.php b/data/class/helper/SC_Helper_Address.php index 2dd177a8d7..fd246a04b0 100644 --- a/data/class/helper/SC_Helper_Address.php +++ b/data/class/helper/SC_Helper_Address.php @@ -24,8 +24,8 @@ /** * 会員の登録配送先を管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Address @@ -34,6 +34,7 @@ class SC_Helper_Address * お届け先を登録 * * @param array $sqlval + * * @return array() */ public function registAddress($sqlval) @@ -47,10 +48,10 @@ public function registAddress($sqlval) $other_deliv_id = $sqlval['other_deliv_id']; // 追加 - if (intval($other_deliv_id) === 0) { + if ((int) $other_deliv_id === 0) { // 別のお届け先最大登録数に達している場合、エラー - $from = 'dtb_other_deliv'; - $where = 'customer_id = ?'; + $from = 'dtb_other_deliv'; + $where = 'customer_id = ?'; $arrVal = array($customer_id); $deliv_count = $objQuery->count($from, $where, $arrVal); if ($deliv_count >= DELIV_ADDR_MAX) { @@ -63,8 +64,8 @@ public function registAddress($sqlval) // 変更 } else { - $from = 'dtb_other_deliv'; - $where = 'customer_id = ? AND other_deliv_id = ?'; + $from = 'dtb_other_deliv'; + $where = 'customer_id = ? AND other_deliv_id = ?'; $arrVal = array($customer_id, $other_deliv_id); $deliv_count = $objQuery->count($from, $where, $arrVal); if ($deliv_count != 1) { @@ -82,6 +83,7 @@ public function registAddress($sqlval) * お届け先を取得 * * @param integer $other_deliv_id + * * @return array() */ public function getAddress($other_deliv_id, $customer_id = '') @@ -92,9 +94,9 @@ public function getAddress($other_deliv_id, $customer_id = '') $objQuery = SC_Query_Ex::getSingletonInstance(); - $col = '*'; - $from = 'dtb_other_deliv'; - $where = 'customer_id = ? AND other_deliv_id = ?'; + $col = '*'; + $from = 'dtb_other_deliv'; + $where = 'customer_id = ? AND other_deliv_id = ?'; $arrVal = array($customer_id, $other_deliv_id); $address = $objQuery->getRow($col, $from, $where, $arrVal); @@ -106,6 +108,7 @@ public function getAddress($other_deliv_id, $customer_id = '') * * @param integer $customer_id * @param integer $startno + * * @return array */ public function getList($customer_id, $startno = '') @@ -116,15 +119,16 @@ public function getList($customer_id, $startno = '') $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->setOrder('other_deliv_id DESC'); - //スマートフォン用の処理 + // スマートフォン用の処理 if ($startno != '') { $objQuery->setLimitOffset(SEARCH_PMAX, $startno); } - $col = '*'; - $from = 'dtb_other_deliv'; - $where = 'customer_id = ?'; + $col = '*'; + $from = 'dtb_other_deliv'; + $where = 'customer_id = ?'; $arrVal = array($customer_id); + return $objQuery->select($col, $from, $where, $arrVal); } @@ -139,11 +143,12 @@ public function deleteAddress($other_deliv_id, $customer_id = '') return false; } - $objQuery = SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); - $from = 'dtb_other_deliv'; - $where = 'customer_id = ? AND other_deliv_id = ?'; + $from = 'dtb_other_deliv'; + $where = 'customer_id = ? AND other_deliv_id = ?'; $arrVal = array($customer_id, $other_deliv_id); + return $objQuery->delete($from, $where, $arrVal); } @@ -151,6 +156,7 @@ public function deleteAddress($other_deliv_id, $customer_id = '') * お届け先フォーム初期化 * * @param SC_FormParam $objFormParam SC_FormParam インスタンス + * * @return void */ public function setFormParam(&$objFormParam) @@ -163,6 +169,7 @@ public function setFormParam(&$objFormParam) * お届け先フォームエラーチェック * * @param SC_FormParam $objFormParam SC_FormParam インスタンス + * * @return void */ public function errorCheck(&$objFormParam) @@ -176,6 +183,7 @@ public function errorCheck(&$objFormParam) * お届け先エラーチェック * * @param array $arrParam + * * @return boolean / false */ public function delivErrorCheck($arrParam) diff --git a/data/class/helper/SC_Helper_BestProducts.php b/data/class/helper/SC_Helper_BestProducts.php index e38f55b4d7..65b924d55d 100644 --- a/data/class/helper/SC_Helper_BestProducts.php +++ b/data/class/helper/SC_Helper_BestProducts.php @@ -24,8 +24,8 @@ /** * おすすめ商品を管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_BestProducts @@ -35,6 +35,7 @@ class SC_Helper_BestProducts * * @param integer $best_id おすすめ商品ID * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false + * * @return array */ public static function getBestProducts($best_id, $has_deleted = false) @@ -55,6 +56,7 @@ public static function getBestProducts($best_id, $has_deleted = false) * * @param integer $rank ランク * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false + * * @return array */ public static function getByRank($rank, $has_deleted = false) @@ -76,6 +78,7 @@ public static function getByRank($rank, $has_deleted = false) * @param integer $dispNumber 表示件数 * @param integer $pageNumber ページ番号 * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false + * * @return array */ public static function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false) @@ -90,7 +93,7 @@ public static function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = $objQuery->setOrder('rank'); if ($dispNumber > 0) { if ($pageNumber > 0) { - $objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber)); + $objQuery->setLimitOffset($dispNumber, ($pageNumber - 1) * $dispNumber); } else { $objQuery->setLimit($dispNumber); } @@ -104,6 +107,7 @@ public static function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = * おすすめ商品の登録. * * @param array $sqlval + * * @return multiple 登録成功:おすすめ商品ID, 失敗:FALSE */ public static function saveBestProducts($sqlval) @@ -129,13 +133,14 @@ public static function saveBestProducts($sqlval) $ret = $objQuery->update('dtb_best_products', $sqlval, $where, array($best_id)); } - return ($ret) ? $sqlval['best_id'] : FALSE; + return ($ret) ? $sqlval['best_id'] : false; } /** * おすすめ商品の削除. * * @param integer $best_id おすすめ商品ID + * * @return void */ public static function deleteBestProducts($best_id) @@ -153,6 +158,7 @@ public static function deleteBestProducts($best_id) * 商品IDの配列からおすすめ商品を削除. * * @param array $productIDs 商品ID + * * @return void */ public static function deleteByProductIDs($productIDs) @@ -169,6 +175,7 @@ public static function deleteByProductIDs($productIDs) * おすすめ商品の表示順をひとつ上げる. * * @param integer $best_id おすすめ商品ID + * * @return void */ public static function rankUp($best_id) @@ -197,6 +204,7 @@ public static function rankUp($best_id) * おすすめ商品の表示順をひとつ下げる. * * @param integer $best_id おすすめ商品ID + * * @return void */ public static function rankDown($best_id) @@ -226,6 +234,7 @@ public static function rankDown($best_id) * * @param integer $best_id 対象ID * @param integer $rank 変更したいrank値 + * * @return void */ public static function changeRank($best_id, $rank) diff --git a/data/class/helper/SC_Helper_Bloc.php b/data/class/helper/SC_Helper_Bloc.php index 228a4a8854..84540882cb 100644 --- a/data/class/helper/SC_Helper_Bloc.php +++ b/data/class/helper/SC_Helper_Bloc.php @@ -24,13 +24,13 @@ /** * ブロックを管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Bloc { - private $device_type_id = NULL; + private $device_type_id = null; public function __construct($devide_type_id = DEVICE_TYPE_PC) { @@ -41,6 +41,7 @@ public function __construct($devide_type_id = DEVICE_TYPE_PC) * ブロックの情報を取得. * * @param integer $bloc_id ブロックID + * * @return array */ public function getBloc($bloc_id) @@ -99,6 +100,7 @@ public function getWhere($where = '', $sqlval = array()) * ブロックの登録. * * @param array $sqlval + * * @return multiple 登録成功:ブロックID, 失敗:FALSE */ public function save($sqlval) @@ -129,13 +131,13 @@ public function save($sqlval) if ($is_new || SC_Utils_Ex::isBlank($arrExists)) { $objQuery->setOrder(''); $arrValues['bloc_id'] = 1 + $objQuery->max('bloc_id', $table, 'device_type_id = ?', - array($arrValues['device_type_id'])); + array($arrValues['device_type_id'])); $arrValues['create_date'] = 'CURRENT_TIMESTAMP'; $objQuery->insert($table, $arrValues); // 更新 } else { $objQuery->update($table, $arrValues, 'bloc_id = ? AND device_type_id = ?', - array($arrValues['bloc_id'], $arrValues['device_type_id'])); + array($arrValues['bloc_id'], $arrValues['device_type_id'])); } $bloc_path = $bloc_dir . $arrValues['tpl_path']; @@ -154,6 +156,7 @@ public function save($sqlval) * ブロックの削除. * * @param integer $bloc_id + * * @return boolean */ public function delete($bloc_id) @@ -165,9 +168,9 @@ public function delete($bloc_id) $is_error = false; if (!SC_Utils_Ex::isBlank($arrExists)) { $objQuery->delete('dtb_bloc', 'bloc_id = ? AND device_type_id = ?', - array($arrExists[0]['bloc_id'], $arrExists[0]['device_type_id'])); + array($arrExists[0]['bloc_id'], $arrExists[0]['device_type_id'])); $objQuery->delete('dtb_blocposition', 'bloc_id = ? AND device_type_id = ?', - array($arrExists[0]['bloc_id'], $arrExists[0]['device_type_id'])); + array($arrExists[0]['bloc_id'], $arrExists[0]['device_type_id'])); $bloc_dir = SC_Helper_PageLayout_Ex::getTemplatePath($this->device_type_id) . BLOC_DIR; $exists_file = $bloc_dir . $arrExists[0]['filename'] . '.tpl'; diff --git a/data/class/helper/SC_Helper_CSV.php b/data/class/helper/SC_Helper_CSV.php index 7a2d0a7c77..a1656cdc5c 100644 --- a/data/class/helper/SC_Helper_CSV.php +++ b/data/class/helper/SC_Helper_CSV.php @@ -1,4 +1,5 @@ init(); + } + + /** + * 項目情報を初期化する. + * + * @return void + */ + public function init() + { + $this->arrSubnavi = array( + 1 => 'product', + 2 => 'customer', + 3 => 'order', + 4 => 'review', + 5 => 'category', + ); + + $this->arrSubnaviName = array( + 1 => '商品管理', + 2 => '会員管理', + 3 => '受注管理', + 4 => 'レビュー', + 5 => 'カテゴリ', + ); + } + + /** + * CSVファイルを送信する + * + * @param integer $csv_id CSVフォーマットID + * @param string $where WHERE条件文 + * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 + * @param string $order ORDER文 + * @param boolean $is_download true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) + * + * @return boolean|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string + */ + public function sfDownloadCsv($csv_id, $where = '', $arrVal = array(), $order = '', $is_download = false) + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + + // CSV出力タイトル行の作成 + $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfGetCsvOutput($csv_id, 'status = ' . CSV_COLUMN_STATUS_FLG_ENABLE)); + if (count($arrOutput) <= 0) { + return false; + } // 失敗終了 + $arrOutputCols = $arrOutput['col']; + + $cols = SC_Utils_Ex::sfGetCommaList($arrOutputCols, true); + + // 商品の場合 + $from = ''; + if ($csv_id == 1) { + // この WHERE 句を足さないと無効な規格も出力される。現行仕様と合わせる為追加。 + $inner_where = 'dtb_products_class.del_flg = 0'; + $from = SC_Product_Ex::prdclsSQL($inner_where); + // 会員の場合 + } elseif ($csv_id == 2) { + $from = 'dtb_customer'; + // 注文の場合 + } elseif ($csv_id == 3) { + $from = 'dtb_order'; + // レビューの場合 + } elseif ($csv_id == 4) { + $from = 'dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id'; + // カテゴリの場合 + } elseif ($csv_id == 5) { + $from = 'dtb_category'; + } + + $objQuery->setOrder($order); + $sql = $objQuery->getSql($cols, $from, $where); + + return $this->sfDownloadCsvFromSql($sql, $arrVal, $this->arrSubnavi[$csv_id], $arrOutput['disp_name'], $is_download); + } + + /** + * CSV 項目を出力する. + * + * @param integer $csv_id CSV ID + * @param string $where SQL の WHERE 句 + * @param array $arrVal WHERE 句の要素 + * @param array $order SQL の ORDER BY 句 + * + * @return array CSV 項目の配列 + */ + public function sfGetCsvOutput($csv_id = '', $where = '', $arrVal = array(), $order = 'rank, no') + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + + $cols = 'no, csv_id, col, disp_name, rank, status, rw_flg, mb_convert_kana_option, size_const_type, error_check_types'; + $table = 'dtb_csv'; + + if (SC_Utils_Ex::sfIsInt($csv_id)) { + if ($where == '') { + $where = 'csv_id = ?'; + } else { + $where = "$where AND csv_id = ?"; + } + $arrVal[] = $csv_id; + } + $objQuery->setOrder($order); + + $arrRet = $objQuery->select($cols, $table, $where, $arrVal); + + return $arrRet; + } + + /** + * CSVが出力設定でインポート可能かのチェック + * + * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) + * + * @return boolean true:インポート可能、false:インポート不可 + */ + public function sfIsImportCSVFrame(&$arrCSVFrame) + { + $result = true; + foreach ($arrCSVFrame as $val) { + if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE + && $val['rw_flg'] == CSV_COLUMN_RW_FLG_READ_WRITE + && $val['error_check_types'] != '' + && strpos(strtoupper($val['error_check_types']), 'EXIST_CHECK') !== false + ) { + // 必須フィールド + $result = false; + } + } + + return $result; + } + + /** + * CSVが出力設定で更新可能かのチェック + * + * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) + * + * @return boolean true:更新可能、false:新規追加のみ不可 + */ + public function sfIsUpdateCSVFrame(&$arrCSVFrame) + { + $result = true; + foreach ($arrCSVFrame as $val) { + if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE + && $val['rw_flg'] == CSV_COLUMN_RW_FLG_KEY_FIELD + ) { + // キーフィールド + $result = false; + } + } + + return $result; + } + + /** + * CSVファイルのカウント数を得る. + * + * @param resource $fp fopenを使用して作成したファイルポインタ + * + * @return integer CSV のカウント数 + */ + public function sfGetCSVRecordCount($fp) + { + $count = 0; + while (!feof($fp)) { + $arrCSV = fgetcsv($fp, CSV_LINE_MAX); + $count++; + } + // ファイルポインタを戻す + if (rewind($fp)) { + return $count - 1; + } else { + return false; + } + } + + /** + * CSV作成 テンポラリファイル出力 コールバック関数 + * + * @param mixed $data 出力データ + * + * @return boolean true (true:固定 false:中断) + */ + public function cbOutputCSV($data) + { + // mb_convert_variablesで変換できない文字は"?"にする + mb_substitute_character(SUBSTITUTE_CHAR); + // 1行目のみヘッダーを出力する + if ($this->output_header) { + $header = array_keys($data); + mb_convert_variables('cp932', CHAR_CODE, $header); + fputcsv($this->fpOutput, $header); + $this->output_header = false; + } + mb_convert_variables('cp932', CHAR_CODE, $data); + fputcsv($this->fpOutput, $data); + SC_Utils_Ex::extendTimeOut(); + + return true; + } + + /** + * SQL文からクエリ実行し CSVファイルを送信する + * + * @param integer $sql SQL文 + * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 + * @param string ファイル名の頭に付ける文字列 + * @param array|null ヘッダ出力列配列。null の場合、SQL 文の列名を出力する。 + * @param boolean true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) + * + * @return boolean|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string + */ + public function sfDownloadCsvFromSql($sql, $arrVal = array(), $file_head = 'csv', $arrHeader = null, $is_download = false) + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + + if (!$is_download) { + ob_start(); + } + + $this->fpOutput = &SC_Helper_CSV_Ex::fopen_for_output_csv(); + + // mb_convert_variablesで変換できない文字は"?"にする + mb_substitute_character(SUBSTITUTE_CHAR); + // ヘッダー構築 + $this->output_header = false; + if (is_array($arrHeader)) { + mb_convert_variables('cp932', CHAR_CODE, $arrHeader); + fputcsv($this->fpOutput, $arrHeader); + } elseif (is_null($arrHeader)) { + // ループバック内でヘッダーを出力する + $this->output_header = true; + } + + $objQuery->doCallbackAll(array(&$this, 'cbOutputCSV'), $sql, $arrVal); + + // コールバック内でヘッダー出力する場合、0行時にヘッダーを生成できない。 + // コールバックが呼ばれていない場合、念のため CRLF を出力しておく。 + // XXX WEB画面前提で、アラート表示する流れのほうが親切かもしれない。 + if ($this->output_header) { + fwrite($this->fpOutput, "\r\n"); + } + + fclose($this->fpOutput); + + // CSV 用の HTTP ヘッダーを送出する。 + if ($is_download) { + $file_name = $file_head . '_' . date('ymd_His') . '.csv'; + SC_Response_Ex::headerForDownload($file_name); + $return = true; + } + // 戻り値にCSVデータをセットする + else { + $return = ob_get_clean(); + } + + return $return; + } + + /** + * 前方互換用 + * + * @deprecated 2.13.2 fputcsv を使うこと。(sfDownloadCsvFromSql や cbOutputCSV の実装を参照) + */ + public function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') + { + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); + if (strlen($delimiter) != 1) { + trigger_error('delimiter must be a single character', \E_USER_WARNING); + + return ''; + } + + if (strlen($enclosure) < 1) { + trigger_error('enclosure must be a single character', \E_USER_WARNING); + + return ''; + } + + foreach ($fields as $key => $value) { + $field = &$fields[$key]; + + // 配列を「|」区切りの文字列に変換する + if (is_array($field)) { + $field = implode($arrayDelimiter, $field); + } + + /* enclose a field that contains a delimiter, an enclosure character, or a newline */ + if (is_string($field) + && preg_match('/[' . preg_quote($delimiter) . preg_quote($enclosure) . '\\s]/', $field) + ) { + $field = $enclosure . preg_replace('/' . preg_quote($enclosure) . '/', $enclosure . $enclosure, $field) . $enclosure; + } + } + + return implode($delimiter, $fields); + } + + /** + * 前方互換用 + * + * @deprecated 2.13.2 + */ + public function lfDownloadCsv($arrData, $prefix = '') + { + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); + if ($prefix == '') { + $dir_name = SC_Utils_Ex::sfUpDirName(); + $file_name = $dir_name . date('ymdHis') . '.csv'; + } else { + $file_name = $prefix . date('ymdHis') . '.csv'; + } + SC_Response_Ex::headerForDownload($file_name); + + /* データを出力 */ + $fp = &SC_Helper_CSV_Ex::fopen_for_output_csv(); + foreach ($arrData as $lineArray) { + fputcsv($fp, $lineArray); + } + fclose($fp); + } + + /** + * 前方互換用 + * + * @deprecated 2.13.2 + */ + public function lfDownloadCSVFile($filepath, $prefix = '') + { + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); + $file_name = $prefix . date('YmdHis') . '.csv'; + SC_Response_Ex::headerForDownload($file_name); + + /* データを出力 */ + // file_get_contentsはメモリマッピングも自動的に使ってくれるので高速&省メモリ + echo file_get_contents($filepath); + } + + /** + * CSV 出力用のファイルポインタリソースを開く + * + * @return resource ファイルポインタリソース + */ + public static function &fopen_for_output_csv($filename = 'php://output') + { + $fp = fopen($filename, 'w'); + + stream_filter_append($fp, 'convert.eccube_lf2crlf'); + + return $fp; + } + } + + /** + * 改行コードを CRLF に変換するフィルター + * + * @author Seasoft 塚田将久 (新規作成) + * * @version $Id$ */ -class SC_Helper_CSV -{ - /** 項目英名 */ - public $arrSubnavi; - - /** 項目名 */ - public $arrSubnaviName; - - /** @var resource */ - public $fpOutput; - - /** ヘッダーを出力するか (cbOutputCSV 用) */ - private $output_header = false; - - /** - * デフォルトコンストラクタ. - */ - public function __construct() - { - $this->init(); - } - - /** - * 項目情報を初期化する. - * - * @access private - * @return void - */ - public function init() - { - $this->arrSubnavi = array( - 1 => 'product', - 2 => 'customer', - 3 => 'order', - 4 => 'review', - 5 => 'category', - ); - - $this->arrSubnaviName = array( - 1 => '商品管理', - 2 => '会員管理', - 3 => '受注管理', - 4 => 'レビュー', - 5 => 'カテゴリ', - ); - } - - /** - * CSVファイルを送信する - * - * @param integer $csv_id CSVフォーマットID - * @param string $where WHERE条件文 - * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 - * @param string $order ORDER文 - * @param boolean $is_download true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) - * @return boolean|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string - */ - public function sfDownloadCsv($csv_id, $where = '', $arrVal = array(), $order = '', $is_download = false) - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - - // CSV出力タイトル行の作成 - $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfGetCsvOutput($csv_id, 'status = ' . CSV_COLUMN_STATUS_FLG_ENABLE)); - if (count($arrOutput) <= 0) return false; // 失敗終了 - $arrOutputCols = $arrOutput['col']; - - $cols = SC_Utils_Ex::sfGetCommaList($arrOutputCols, true); - - // 商品の場合 - $from = ''; - if ($csv_id == 1) { - // この WHERE 句を足さないと無効な規格も出力される。現行仕様と合わせる為追加。 - $inner_where = 'dtb_products_class.del_flg = 0'; - $from = SC_Product_Ex::prdclsSQL($inner_where); - // 会員の場合 - } elseif ($csv_id == 2) { - $from = 'dtb_customer'; - // 注文の場合 - } elseif ($csv_id == 3) { - $from = 'dtb_order'; - // レビューの場合 - } elseif ($csv_id == 4) { - $from = 'dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id'; - // カテゴリの場合 - } elseif ($csv_id == 5) { - $from = 'dtb_category'; - } - - $objQuery->setOrder($order); - $sql = $objQuery->getSql($cols, $from, $where); - - return $this->sfDownloadCsvFromSql($sql, $arrVal, $this->arrSubnavi[$csv_id], $arrOutput['disp_name'], $is_download); - } - - /** - * CSV 項目を出力する. - * - * @param integer $csv_id CSV ID - * @param string $where SQL の WHERE 句 - * @param array $arrVal WHERE 句の要素 - * @param array $order SQL の ORDER BY 句 - * @return array CSV 項目の配列 - */ - public function sfGetCsvOutput($csv_id = '', $where = '', $arrVal = array(), $order = 'rank, no') - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - - $cols = 'no, csv_id, col, disp_name, rank, status, rw_flg, mb_convert_kana_option, size_const_type, error_check_types'; - $table = 'dtb_csv'; - - if (SC_Utils_Ex::sfIsInt($csv_id)) { - if ($where == '') { - $where = 'csv_id = ?'; - } else { - $where = "$where AND csv_id = ?"; - } - $arrVal[] = $csv_id; - } - $objQuery->setOrder($order); - - $arrRet = $objQuery->select($cols, $table, $where, $arrVal); - - return $arrRet; - } - - /** - * CSVが出力設定でインポート可能かのチェック - * - * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) - * @return boolean true:インポート可能、false:インポート不可 - */ - public function sfIsImportCSVFrame(&$arrCSVFrame) - { - $result = true; - foreach ($arrCSVFrame as $val) { - if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE - && $val['rw_flg'] == CSV_COLUMN_RW_FLG_READ_WRITE - && $val['error_check_types'] != '' - && strpos(strtoupper($val['error_check_types']), 'EXIST_CHECK') !== FALSE - ) { - //必須フィールド - $result = false; - } - } - - return $result; - } - - /** - * CSVが出力設定で更新可能かのチェック - * - * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) - * @return boolean true:更新可能、false:新規追加のみ不可 - */ - public function sfIsUpdateCSVFrame(&$arrCSVFrame) - { - $result = true; - foreach ($arrCSVFrame as $val) { - if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE - && $val['rw_flg'] == CSV_COLUMN_RW_FLG_KEY_FIELD - ) { - //キーフィールド - $result = false; - } - } - - return $result; - } - - /** - * CSVファイルのカウント数を得る. - * - * @param resource $fp fopenを使用して作成したファイルポインタ - * @return integer CSV のカウント数 - */ - public function sfGetCSVRecordCount($fp) - { - $count = 0; - while (!feof($fp)) { - $arrCSV = fgetcsv($fp, CSV_LINE_MAX); - $count++; - } - // ファイルポインタを戻す - if (rewind($fp)) { - return $count-1; - } else { - return FALSE; - } - } - - /** - * CSV作成 テンポラリファイル出力 コールバック関数 - * - * @param mixed $data 出力データ - * @return boolean true (true:固定 false:中断) - */ - public function cbOutputCSV($data) - { - // mb_convert_variablesで変換できない文字は"?"にする - mb_substitute_character(SUBSTITUTE_CHAR); - // 1行目のみヘッダーを出力する - if ($this->output_header) { - $header = array_keys($data); - mb_convert_variables('cp932', CHAR_CODE, $header); - fputcsv($this->fpOutput, $header); - $this->output_header = false; - } - mb_convert_variables('cp932', CHAR_CODE, $data); - fputcsv($this->fpOutput, $data); - SC_Utils_Ex::extendTimeOut(); - - return true; - } - - /** - * SQL文からクエリ実行し CSVファイルを送信する - * - * @param integer $sql SQL文 - * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 - * @param string ファイル名の頭に付ける文字列 - * @param array|null ヘッダ出力列配列。null の場合、SQL 文の列名を出力する。 - * @param boolean true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) - * @return boolean|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string - */ - public function sfDownloadCsvFromSql($sql, $arrVal = array(), $file_head = 'csv', $arrHeader = null, $is_download = false) - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - - if (!$is_download) { - ob_start(); - } - - $this->fpOutput =& SC_Helper_CSV_Ex::fopen_for_output_csv(); - - // mb_convert_variablesで変換できない文字は"?"にする - mb_substitute_character(SUBSTITUTE_CHAR); - // ヘッダー構築 - $this->output_header = false; - if (is_array($arrHeader)) { - mb_convert_variables('cp932', CHAR_CODE, $arrHeader); - fputcsv($this->fpOutput, $arrHeader); - } elseif (is_null($arrHeader)) { - // ループバック内でヘッダーを出力する - $this->output_header = true; - } - - $objQuery->doCallbackAll(array(&$this, 'cbOutputCSV'), $sql, $arrVal); - - // コールバック内でヘッダー出力する場合、0行時にヘッダーを生成できない。 - // コールバックが呼ばれていない場合、念のため CRLF を出力しておく。 - // XXX WEB画面前提で、アラート表示する流れのほうが親切かもしれない。 - if ($this->output_header) { - fwrite($this->fpOutput, "\r\n"); - } - - fclose($this->fpOutput); - - // CSV 用の HTTP ヘッダーを送出する。 - if ($is_download) { - $file_name = $file_head . '_' . date('ymd_His') .'.csv'; - SC_Response_Ex::headerForDownload($file_name); - $return = true; - } - // 戻り値にCSVデータをセットする - else { - $return = ob_get_clean(); - } - - return $return; - } - - /** - * 前方互換用 - * - * @deprecated 2.13.2 fputcsv を使うこと。(sfDownloadCsvFromSql や cbOutputCSV の実装を参照) - */ - public function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') - { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); - if (strlen($delimiter) != 1) { - trigger_error('delimiter must be a single character', E_USER_WARNING); - - return ''; - } - - if (strlen($enclosure) < 1) { - trigger_error('enclosure must be a single character', E_USER_WARNING); - - return ''; - } - - foreach ($fields as $key => $value) { - $field =& $fields[$key]; - - // 配列を「|」区切りの文字列に変換する - if (is_array($field)) { - $field = implode($arrayDelimiter, $field); - } - - /* enclose a field that contains a delimiter, an enclosure character, or a newline */ - if (is_string($field) - && preg_match('/[' . preg_quote($delimiter) . preg_quote($enclosure) . '\\s]/', $field) - ) { - $field = $enclosure . preg_replace('/' . preg_quote($enclosure) . '/', $enclosure . $enclosure, $field) . $enclosure; - } - } - - return implode($delimiter, $fields); - } - - /** - * 前方互換用 - * - * @deprecated 2.13.2 - */ - public function lfDownloadCsv($arrData, $prefix = '') - { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); - if ($prefix == '') { - $dir_name = SC_Utils_Ex::sfUpDirName(); - $file_name = $dir_name . date('ymdHis') .'.csv'; - } else { - $file_name = $prefix . date('ymdHis') .'.csv'; - } - SC_Response_Ex::headerForDownload($file_name); - - /* データを出力 */ - $fp =& SC_Helper_CSV_Ex::fopen_for_output_csv(); - foreach ($arrData as $lineArray) { - fputcsv($fp, $lineArray); - } - fclose($fp); - } - - /** - * 前方互換用 - * - * @deprecated 2.13.2 - */ - public function lfDownloadCSVFile($filepath, $prefix = '') - { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); - $file_name = $prefix . date('YmdHis') . '.csv'; - SC_Response_Ex::headerForDownload($file_name); - - /* データを出力 */ - // file_get_contentsはメモリマッピングも自動的に使ってくれるので高速&省メモリ - echo file_get_contents($filepath); - } - - /** - * CSV 出力用のファイルポインタリソースを開く - * - * @return resource ファイルポインタリソース - */ - public static function &fopen_for_output_csv($filename = 'php://output') - { - $fp = fopen($filename, 'w'); - - stream_filter_append($fp, 'convert.eccube_lf2crlf'); - - return $fp; - } -} - -/** - * 改行コードを CRLF に変換するフィルター - * - * @package php_user_filter - * @author Seasoft 塚田将久 (新規作成) - * @version $Id$ - */ -class php_user_filter_lf2crlf extends php_user_filter -{ - #[\ReturnTypeWillChange] - public function filter($in, $out, &$consumed, $closing) - { - while ($bucket = stream_bucket_make_writeable($in)) { - $bucket->data = preg_replace("/[\r\n]+$/", "\r\n", $bucket->data); - $consumed += $bucket->datalen; - stream_bucket_append($out, $bucket); - } - return PSFS_PASS_ON; - } -} -stream_filter_register('convert.eccube_lf2crlf', 'php_user_filter_lf2crlf'); + class php_user_filter_lf2crlf extends php_user_filter + { + #[\ReturnTypeWillChange] + public function filter($in, $out, &$consumed, $closing) + { + while ($bucket = stream_bucket_make_writeable($in)) { + $bucket->data = preg_replace("/[\r\n]+$/", "\r\n", $bucket->data); + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + + return \PSFS_PASS_ON; + } + } + + stream_filter_register('convert.eccube_lf2crlf', 'php_user_filter_lf2crlf'); diff --git a/data/class/helper/SC_Helper_Category.php b/data/class/helper/SC_Helper_Category.php index 69a6beeab0..29288aef65 100644 --- a/data/class/helper/SC_Helper_Category.php +++ b/data/class/helper/SC_Helper_Category.php @@ -24,8 +24,8 @@ /** * カテゴリーを管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Category @@ -37,7 +37,7 @@ class SC_Helper_Category * * @param boolean $count_check 登録商品数をチェックする場合はtrue */ - public function __construct($count_check = FALSE) + public function __construct($count_check = false) { $this->count_check = $count_check; } @@ -46,6 +46,7 @@ public function __construct($count_check = FALSE) * カテゴリーの情報を取得. * * @param integer $category_id カテゴリーID + * * @return array */ public function get($category_id) @@ -67,9 +68,10 @@ public function get($category_id) * カテゴリー一覧の取得. * * @param boolean $cid_to_key 配列のキーをカテゴリーIDにする場合はtrue + * * @return array カテゴリー一覧の配列 */ - public function getList($cid_to_key = FALSE) + public function getList($cid_to_key = false) { static $arrCategory = array(), $cidIsKey = array(); @@ -122,12 +124,13 @@ public function getTree() * * @param integer $category_id 起点のカテゴリーID * @param boolean $id_only IDだけの配列を返す場合はtrue + * * @return array */ - public function getTreeTrail($category_id, $id_only = TRUE) + public function getTreeTrail($category_id, $id_only = true) { - $arrCategory = $this->getList(TRUE); - $arrTrailID = SC_Utils_Ex::getTreeTrail($category_id, 'category_id', 'parent_category_id', $arrCategory, TRUE, 0, $id_only); + $arrCategory = $this->getList(true); + $arrTrailID = SC_Utils_Ex::getTreeTrail($category_id, 'category_id', 'parent_category_id', $arrCategory, true, 0, $id_only); return $arrTrailID; } @@ -136,9 +139,11 @@ public function getTreeTrail($category_id, $id_only = TRUE) * 指定カテゴリーの子孫カテゴリーを取得 * * @param int $category_id カテゴリーID + * * @return array */ - public function getTreeBranch($category_id) { + public function getTreeBranch($category_id) + { $arrTree = $this->getTree(); $arrTrail = $this->getTreeTrail($category_id, true); @@ -160,9 +165,11 @@ public function getTreeBranch($category_id) { * カテゴリーの削除 * * @param int $category_id カテゴリーID + * * @return void */ - public function delete($category_id) { + public function delete($category_id) + { $objDb = new SC_Helper_DB_Ex(); // ランク付きレコードの削除(※処理負荷を考慮してレコードごと削除する。) $objDb->sfDeleteRankRecord('dtb_category', 'category_id', $category_id, '', true); @@ -173,9 +180,11 @@ public function delete($category_id) { * * @param int $category_id * @param bool $include_deleted + * * @return bool */ - public function isValidCategoryId($category_id, $include_deleted = false) { + public function isValidCategoryId($category_id, $include_deleted = false) + { if ($include_deleted) { $where = ''; } else { @@ -188,6 +197,7 @@ public function isValidCategoryId($category_id, $include_deleted = false) { ) { return true; } + return false; } } diff --git a/data/class/helper/SC_Helper_Customer.php b/data/class/helper/SC_Helper_Customer.php index 305159cd78..d5c3576190 100644 --- a/data/class/helper/SC_Helper_Customer.php +++ b/data/class/helper/SC_Helper_Customer.php @@ -24,9 +24,8 @@ /** * 会員情報の登録・編集・検索ヘルパークラス. * - * - * @package Helper * @author Hirokazu Fukuda + * * @version $Id$ */ class SC_Helper_Customer @@ -36,7 +35,7 @@ class SC_Helper_Customer * * @param array $arrData 登録するデータの配列(SC_FormParamのgetDbArrayの戻り値) * @param array $customer_id nullの場合はinsert, 存在する場合はupdate - * @access public + * * @return integer 登録編集したユーザーのcustomer_id */ public static function sfEditCustomerData($arrData, $customer_id = null) @@ -61,9 +60,9 @@ public static function sfEditCustomerData($arrData, $customer_id = null) $arrData['salt'] = $salt; } $is_password_updated = false; - //-- パスワードの更新がある場合は暗号化 - if ($arrData['password'] == DEFAULT_PASSWORD or $arrData['password'] == '') { - //更新しない + // -- パスワードの更新がある場合は暗号化 + if ($arrData['password'] == DEFAULT_PASSWORD || $arrData['password'] == '') { + // 更新しない unset($arrData['password']); } else { // 旧バージョン(2.11未満)からの移行を考慮 @@ -75,9 +74,9 @@ public static function sfEditCustomerData($arrData, $customer_id = null) $arrData['password'] = SC_Utils_Ex::sfGetHashString($arrData['password'], $salt); } - //-- 秘密の質問の更新がある場合は暗号化 - if ($arrData['reminder_answer'] == DEFAULT_PASSWORD or $arrData['reminder_answer'] == '') { - //更新しない + // -- 秘密の質問の更新がある場合は暗号化 + if ($arrData['reminder_answer'] == DEFAULT_PASSWORD || $arrData['reminder_answer'] == '') { + // 更新しない unset($arrData['reminder_answer']); // 旧バージョン(2.11未満)からの移行を考慮 @@ -96,12 +95,12 @@ public static function sfEditCustomerData($arrData, $customer_id = null) } } - //デフォルト国IDを追加 + // デフォルト国IDを追加 if (FORM_COUNTRY_ENABLE == false) { $arrData['country_id'] = DEFAULT_COUNTRY_ID; } - //-- 編集登録実行 + // -- 編集登録実行 if (is_numeric($customer_id)) { // 編集 $objQuery->update('dtb_customer', $arrData, 'customer_id = ? ', array($customer_id)); @@ -129,6 +128,7 @@ public static function sfEditCustomerData($arrData, $customer_id = null) * @param integer $order_id 注文番号 * @param integer $use_point 利用ポイント * @param integer $add_point 加算ポイント + * * @return array 最終ポイントの配列 */ public static function sfGetCustomerPoint($order_id, $use_point, $add_point) @@ -160,6 +160,7 @@ public static function sfGetCustomerPoint($order_id, $use_point, $add_point) * XXX SC_CheckError からしか呼び出されず, 本クラスの中で SC_CheckError を呼び出している * * @param string $email メールアドレス + * * @return integer 0:登録可能 1:登録済み 2:再登録制限期間内削除ユーザー 3:自分のアドレス */ public static function sfCheckRegisterUserFromEmail($email) @@ -187,8 +188,8 @@ public static function sfCheckRegisterUserFromEmail($email) } else { // 退会した会員である場合 $leave_time = SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']); - $now_time = time(); - $pass_time = $now_time - $leave_time; + $now_time = time(); + $pass_time = $now_time - $leave_time; // 退会から何時間-経過しているか判定する。 $limit_time = ENTRY_LIMIT_HOUR * 3600; if ($pass_time < $limit_time) { @@ -209,6 +210,7 @@ public static function sfCheckRegisterUserFromEmail($email) * * @param integer $customer_id チェック対象会員の会員ID * @param string $email チェック対象のメールアドレス + * * @return boolean メールアドレスが重複する場合 true */ public static function sfCustomerEmailDuplicationCheck($customer_id, $email) @@ -216,11 +218,11 @@ public static function sfCustomerEmailDuplicationCheck($customer_id, $email) $objQuery = SC_Query_Ex::getSingletonInstance(); $arrResults = $objQuery->getRow('email, email_mobile', - 'dtb_customer', 'customer_id = ?', - array($customer_id)); + 'dtb_customer', 'customer_id = ?', + array($customer_id)); $return - = strlen($arrResults['email']) >= 1 && $email === $arrResults['email'] - || strlen($arrResults['email_mobile']) >= 1 && $email === $arrResults['email_mobile'] + = strlen($arrResults['email']) >= 1 && $email === $arrResults['email'] + || strlen($arrResults['email_mobile']) >= 1 && $email === $arrResults['email_mobile'] ; return $return; @@ -231,21 +233,21 @@ public static function sfCustomerEmailDuplicationCheck($customer_id, $email) * * @param mixed $customer_id * @param boolean $mask_flg - * @access public + * * @return array 会員情報の配列を返す */ public static function sfGetCustomerData($customer_id, $mask_flg = true) { - $objQuery = SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); // 会員情報DB取得 - $ret = $objQuery->select('*', 'dtb_customer', 'customer_id=? AND del_flg = 0', array($customer_id)); + $ret = $objQuery->select('*', 'dtb_customer', 'customer_id=? AND del_flg = 0', array($customer_id)); if (empty($ret)) { - trigger_error('存在しない会員IDです。', E_USER_ERROR); + trigger_error('存在しない会員IDです。', \E_USER_ERROR); } - $arrForm = $ret[0]; + $arrForm = $ret[0]; // 確認項目に複製 $arrForm['email02'] = $arrForm['email']; @@ -254,13 +256,13 @@ public static function sfGetCustomerData($customer_id, $mask_flg = true) // 誕生日を年月日に分ける if (isset($arrForm['birth'])) { $birth = explode(' ', $arrForm['birth']); - list($arrForm['year'], $arrForm['month'], $arrForm['day']) = array_map("intval",explode('-', $birth[0])); + list($arrForm['year'], $arrForm['month'], $arrForm['day']) = array_map("intval", explode('-', $birth[0])); } if ($mask_flg) { - $arrForm['password'] = DEFAULT_PASSWORD; - $arrForm['password02'] = DEFAULT_PASSWORD; - $arrForm['reminder_answer'] = DEFAULT_PASSWORD; + $arrForm['password'] = DEFAULT_PASSWORD; + $arrForm['password02'] = DEFAULT_PASSWORD; + $arrForm['reminder_answer'] = DEFAULT_PASSWORD; } return $arrForm; @@ -274,12 +276,12 @@ public static function sfGetCustomerData($customer_id, $mask_flg = true) * @param integer $customer_id 会員ID (指定無しでも構わないが、Where条件を入れる事) * @param string $add_where 追加WHERE条件 * @param string[] $arrAddVal 追加WHEREパラメーター - * @access public + * * @return array 対象会員データ */ public static function sfGetCustomerDataFromId($customer_id, $add_where = '', $arrAddVal = array()) { - $objQuery = SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); if ($add_where == '') { $where = 'customer_id = ? AND del_flg = 0'; @@ -299,7 +301,6 @@ public static function sfGetCustomerDataFromId($customer_id, $add_where = '', $a /** * 重複しない会員登録キーを発行する。 * - * @access public * @return string 会員登録キーの文字列 */ public static function sfGetUniqSecretKey() @@ -319,14 +320,14 @@ public static function sfGetUniqSecretKey() * * @param string $uniqid 会員登録キー * @param boolean $check_status 本会員のみを対象とするか - * @access public + * * @return integer 会員ID */ public static function sfGetCustomerId($uniqid, $check_status = false) { - $objQuery = SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); - $where = 'secret_key = ?'; + $where = 'secret_key = ?'; if ($check_status) { $where .= ' AND status = 1 AND del_flg = 0'; @@ -340,7 +341,7 @@ public static function sfGetCustomerId($uniqid, $check_status = false) * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param boolean $isAdmin true:管理者画面 false:会員向け - * @access public + * * @return void */ public static function sfCustomerEntryParam(&$objFormParam, $isAdmin = false) @@ -365,7 +366,7 @@ public static function sfCustomerEntryParam(&$objFormParam, $isAdmin = false) * 会員情報変更フォーム初期化 * * @param SC_FormParam $objFormParam SC_FormParam インスタンス - * @access public + * * @return void */ public static function sfCustomerMypageParam(&$objFormParam) @@ -386,7 +387,7 @@ public static function sfCustomerMypageParam(&$objFormParam) * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param string $prefix キー名にprefixを付ける場合に指定 - * @access public + * * @return void */ public static function sfCustomerCommonParam(&$objFormParam, $prefix = '') @@ -427,6 +428,7 @@ public static function sfCustomerCommonParam(&$objFormParam, $prefix = '') * @param boolean $isAdmin true:管理者画面 false:会員向け * @param boolean $is_mypage マイページの場合 true * @param string $prefix キー名にprefixを付ける場合に指定 + * * @return void */ public static function sfCustomerRegisterParam(&$objFormParam, $isAdmin = false, $is_mypage = false, $prefix = '') @@ -457,8 +459,9 @@ public static function sfCustomerRegisterParam(&$objFormParam, $isAdmin = false, /** * 会員登録エラーチェック + * * @param SC_FormParam $objFormParam SC_FormParam インスタンス - * @access public + * * @return array エラーの配列 */ public static function sfCustomerEntryErrorCheck(&$objFormParam) @@ -488,7 +491,7 @@ public static function sfCustomerEntryErrorCheck(&$objFormParam) * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param boolean $isAdmin 管理画面チェック時:true - * @access public + * * @return array エラーの配列 */ public static function sfCustomerMypageErrorCheck(&$objFormParam, $isAdmin = false) @@ -517,7 +520,7 @@ public static function sfCustomerMypageErrorCheck(&$objFormParam, $isAdmin = fal * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param string $prefix キー名にprefixを付ける場合に指定 - * @access public + * * @return SC_CheckError_Ex エラー情報の配列 */ public static function sfCustomerCommonErrorCheck(&$objFormParam, $prefix = '') @@ -543,6 +546,7 @@ public static function sfCustomerCommonErrorCheck(&$objFormParam, $prefix = '') * * @param SC_CheckError $objErr SC_CheckError インスタンス * @param boolean $isAdmin 管理画面チェック時:true + * * @return SC_CheckError $objErr エラー情報 */ public static function sfCustomerRegisterErrorCheck(&$objErr, $isAdmin = false) @@ -570,7 +574,7 @@ public static function sfCustomerRegisterErrorCheck(&$objErr, $isAdmin = false) * 会員検索パラメーター(管理画面用) * * @param SC_FormParam $objFormParam SC_FormParam インスタンス - * @access public + * * @return void */ public static function sfSetSearchParam(&$objFormParam) @@ -620,7 +624,7 @@ public static function sfSetSearchParam(&$objFormParam) * 会員検索パラメーター エラーチェック(管理画面用) * * @param SC_FormParam $objFormParam SC_FormParam インスタンス - * @access public + * * @return array エラー配列 */ public static function sfCheckErrorSearchParam(&$objFormParam) @@ -669,6 +673,7 @@ public static function sfCheckErrorSearchParam(&$objFormParam) * * @param array $arrParam 検索パラメーター連想配列 * @param string $limitMode ページングを利用するか判定用フラグ + * * @return array( integer 全体件数, mixed 会員データ一覧配列, mixed SC_PageNaviオブジェクト) */ public static function sfGetSearchData($arrParam, $limitMode = '') @@ -681,7 +686,7 @@ public static function sfGetSearchData($arrParam, $limitMode = '') if ($disp_pageno == 0) { $disp_pageno = 1; } - $offset = intval($page_max) * (intval($disp_pageno) - 1); + $offset = (int) $page_max * ((int) $disp_pageno - 1); if ($limitMode == '') { $objQuery->setLimitOffset($page_max, $offset); } @@ -693,10 +698,10 @@ public static function sfGetSearchData($arrParam, $limitMode = '') // ページ送りの取得 $objNavi = new SC_PageNavi_Ex($arrParam['search_pageno'], - $linemax, - $page_max, - 'eccube.moveSearchPage', - NAVI_PMAX); + $linemax, + $page_max, + 'eccube.moveSearchPage', + NAVI_PMAX); return array($linemax, $arrData, $objNavi); } @@ -705,6 +710,7 @@ public static function sfGetSearchData($arrParam, $limitMode = '') * 仮会員かどうかを判定する. * * @param string $login_email メールアドレス + * * @return boolean 仮会員の場合 true */ public static function checkTempCustomer($login_email) @@ -721,13 +727,14 @@ public static function checkTempCustomer($login_email) * 会員を削除する処理 * * @param integer $customer_id 会員ID + * * @return boolean true:成功 false:失敗 */ public static function delete($customer_id) { $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id, 'del_flg = 0'); if (SC_Utils_Ex::isBlank($arrData)) { - //対象となるデータが見つからない。 + // 対象となるデータが見つからない。 return false; } // XXXX: 仮会員は物理削除となっていたが論理削除に変更。 diff --git a/data/class/helper/SC_Helper_DB.php b/data/class/helper/SC_Helper_DB.php index 7d0f916325..71a4d254b4 100644 --- a/data/class/helper/SC_Helper_DB.php +++ b/data/class/helper/SC_Helper_DB.php @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/* * DB関連のヘルパークラス. * * @package Helper @@ -62,6 +62,7 @@ class SC_Helper_DB * @param string $colType カラムのデータ型 * @param string $dsn データソース名 * @param bool $add カラムの作成も行う場合 true + * * @return bool カラムが存在する場合とカラムの生成に成功した場合 true, * テーブルが存在しない場合 false, * 引数 $add == false でカラムが存在しない場合 false @@ -74,7 +75,9 @@ public static function sfColumnExists($tableName, $colName, $colType = '', $dsn $objQuery = SC_Query_Ex::getSingletonInstance($dsn); // テーブルが無ければエラー - if (!in_array($tableName, $objQuery->listTables())) return false; + if (!in_array($tableName, $objQuery->listTables())) { + return false; + } // 正常に接続されている場合 if (!$objQuery->isError()) { @@ -111,6 +114,7 @@ public static function sfColumnAdd($tableName, $colName, $colType) * @param string $tableName テーブル名 * @param string $where データを検索する WHERE 句 * @param array $arrWhereVal WHERE句のプレースホルダ値 + * * @return bool データが存在する場合 true, データの追加に成功した場合 true, * $add == false で, データが存在しない場合 false */ @@ -128,6 +132,7 @@ public static function sfDataExists($tableName, $where, $arrWhereVal) * 引数 $force が false の場合は, キャッシュされた結果を使用する. * * @param boolean $force キャッシュファイルを生成し、ローカルキャッシュを削除するか + * * @return array 店舗基本情報の配列 */ public static function sfGetBasisData($force = false) @@ -160,8 +165,11 @@ public static function sfGetBasisData($force = false) * 基本情報のキャッシュデータを取得する * * エラー画面表示で直接呼ばれる。キャッシュファイルが存在しなくとも空の配列を応答することで、(幾らかの情報欠落などはあるかもしれないが) エラー画面の表示できるよう考慮している。 + * * @param boolean $generate キャッシュファイルが無い時、DBのデータを基にキャッシュを生成するか + * * @return array 店舗基本情報の配列 + * * @deprecated 2.17.1 本体で使用されていないため非推奨 */ public static function sfGetBasisDataCache($generate = false) @@ -183,7 +191,9 @@ public static function sfGetBasisDataCache($generate = false) * 基本情報のキャッシュデータを取得する * * エラー画面表示で直接呼ばれる。キャッシュファイルが存在しなくとも空の配列を応答することで、(幾らかの情報欠落などはあるかもしれないが) エラー画面の表示できるよう考慮している。 + * * @param boolean $ignore_error エラーを無視するか + * * @return array 店舗基本情報の配列 */ public static function getBasisDataFromCacheFile($ignore_error = false) @@ -194,8 +204,7 @@ public static function getBasisDataFromCacheFile($ignore_error = false) if (file_exists(SC_HELPER_DB_BASIS_DATA_CACHE_REALFILE)) { // キャッシュデータファイルを読み込みアンシリアライズした配列を取得 $arrReturn = unserialize(file_get_contents(SC_HELPER_DB_BASIS_DATA_CACHE_REALFILE)); - } - elseif (!$ignore_error) { + } elseif (!$ignore_error) { throw new Exception('基本情報のキャッシュデータファイルが存在しません。'); } @@ -255,6 +264,7 @@ public static function sfCreateBasisDataCache() * 基本情報の登録数を取得する * * @return int + * * @deprecated */ public function sfGetBasisCount() @@ -278,6 +288,7 @@ public function sfGetBasisExists() /** * 選択中のアイテムのルートカテゴリIDを取得する + * * @deprecated 本体で使用されていないため非推奨 */ public function sfGetRootId() @@ -285,8 +296,12 @@ public function sfGetRootId() if (!$this->g_root_on) { $this->g_root_on = true; - if (!isset($_GET['product_id'])) $_GET['product_id'] = ''; - if (!isset($_GET['category_id'])) $_GET['category_id'] = ''; + if (!isset($_GET['product_id'])) { + $_GET['product_id'] = ''; + } + if (!isset($_GET['category_id'])) { + $_GET['category_id'] = ''; + } if (!empty($_GET['product_id']) || !empty($_GET['category_id'])) { // 選択中のカテゴリIDを判定する @@ -315,6 +330,7 @@ public function sfGetRootId() * @param integer $use_point 利用ポイント * @param integer $add_point 加算ポイント * @param integer $order_status 対応状況 + * * @return array オーダー前ポイントの配列 */ public static function sfGetRollbackPoint($order_id, $use_point, $add_point, $order_status) @@ -349,6 +365,7 @@ public static function sfGetRollbackPoint($order_id, $use_point, $add_point, $or * * @param integer $parent_category_id 親カテゴリID * @param bool $count_check 登録商品数のチェックを行う場合 true + * * @return array カテゴリツリーの配列 */ public static function sfGetCatTree($parent_category_id, $count_check = false) @@ -396,6 +413,7 @@ public static function sfGetCatTree($parent_category_id, $count_check = false) * @param integer $parent 上位カテゴリID * @param array パンくずリスト用の配列 * @result void + * * @see sfGetCatTree() * @deprecated 本体で使用されていないため非推奨 */ @@ -422,6 +440,7 @@ public function findTree(&$arrTree, $parent, &$result) * * @param integer $product_id 商品ID * @param bool $count_check 登録商品数のチェックを行う場合 true + * * @return array カテゴリツリーの配列 */ public static function sfGetMultiCatTree($product_id, $count_check = false) @@ -471,7 +490,9 @@ public static function sfGetMultiCatTree($product_id, $count_check = false) * 親カテゴリを連結した文字列を取得する. * * @param integer $category_id カテゴリID + * * @return string 親カテゴリを連結した文字列 + * * @deprecated 本体で使用されていないため非推奨 */ public function sfGetCatCombName($category_id) @@ -498,7 +519,9 @@ public function sfGetCatCombName($category_id) * 指定したカテゴリIDの大カテゴリを取得する. * * @param integer $category_id カテゴリID + * * @return array 指定したカテゴリIDの大カテゴリ + * * @deprecated 本体で使用されていないため非推奨 */ public function sfGetFirstCat($category_id) @@ -525,6 +548,7 @@ public function sfGetFirstCat($category_id) * @param string $addwhere 追加する WHERE 句 * @param bool $products_check 商品の存在するカテゴリのみ取得する場合 true * @param string $head カテゴリ名のプレフィックス文字列 + * * @return array カテゴリツリーの配列 */ public static function sfGetCategoryList($addwhere = '', $products_check = false, $head = CATEGORY_HEAD) @@ -533,7 +557,7 @@ public static function sfGetCategoryList($addwhere = '', $products_check = false $where = 'del_flg = 0'; if ($addwhere != '') { - $where.= " AND $addwhere"; + $where .= " AND $addwhere"; } $objQuery->setOption('ORDER BY rank DESC'); @@ -566,6 +590,7 @@ public static function sfGetCategoryList($addwhere = '', $products_check = false * 親カテゴリの Value=0 を対象とする * * @param bool $parent_zero 親カテゴリの Value=0 の場合 true + * * @return array カテゴリツリーの配列 */ public static function sfGetLevelCatList($parent_zero = true) @@ -580,7 +605,7 @@ public static function sfGetLevelCatList($parent_zero = true) $arrCatName = array(); foreach ($arrRet as $arrTmp) { $arrCatName[$arrTmp['category_id']] = - (($arrTmp['parent_category_id'] > 0)? + (($arrTmp['parent_category_id'] > 0) ? $arrCatName[$arrTmp['parent_category_id']] : '') . CATEGORY_HEAD . $arrTmp['category_name']; } @@ -619,6 +644,7 @@ public static function sfGetLevelCatList($parent_zero = true) * @param integer $product_id プロダクトID * @param integer $category_id カテゴリID * @param bool $closed 引数のカテゴリIDが無効な場合で, 非表示の商品を含む場合はtrue + * * @return array 選択中の商品のカテゴリIDの配列 */ public static function sfGetCategoryId($product_id, $category_id = 0, $closed = false) @@ -634,7 +660,7 @@ public static function sfGetCategoryId($product_id, $category_id = 0, $closed = // XXX SC_Helper_Category::isValidCategoryId() で使用している SC_Helper_DB::sfIsRecord() が内部で del_flg = 0 を追加するため, $closed は機能していない if ($objCategory->isValidCategoryId($category_id, $closed)) { $category_id = array($category_id); - } elseif (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_products','product_id', $product_id, $status)) { + } elseif (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_products', 'product_id', $product_id, $status)) { $objQuery = SC_Query_Ex::getSingletonInstance(); $category_id = $objQuery->getCol('category_id', 'dtb_product_categories', 'product_id = ?', array($product_id)); } else { @@ -650,6 +676,7 @@ public static function sfGetCategoryId($product_id, $category_id = 0, $closed = * * @param integer $category_id カテゴリID * @param integer $product_id プロダクトID + * * @return void */ public function addProductBeforCategories($category_id, $product_id) @@ -657,7 +684,7 @@ public function addProductBeforCategories($category_id, $product_id) $objQuery = SC_Query_Ex::getSingletonInstance(); $sqlval = array('category_id' => $category_id, - 'product_id' => $product_id); + 'product_id' => $product_id, ); $arrSql = array(); $arrSql['rank'] = '(SELECT COALESCE(MAX(rank), 0) FROM dtb_product_categories sub WHERE category_id = ?) + 1'; @@ -672,21 +699,23 @@ public function addProductBeforCategories($category_id, $product_id) * * @param integer $category_id カテゴリID * @param integer $product_id プロダクトID + * * @return void + * * @deprecated 本体で使用されていないため非推奨 */ public function addProductAfterCategories($category_id, $product_id) { $sqlval = array('category_id' => $category_id, - 'product_id' => $product_id); + 'product_id' => $product_id, ); $objQuery = SC_Query_Ex::getSingletonInstance(); // 現在の商品カテゴリを取得 $arrCat = $objQuery->select('product_id, category_id, rank', - 'dtb_product_categories', - 'category_id = ?', - array($category_id)); + 'dtb_product_categories', + 'category_id = ?', + array($category_id)); $min = 0; foreach ($arrCat as $val) { @@ -706,13 +735,14 @@ public function addProductAfterCategories($category_id, $product_id) * * @param integer $category_id カテゴリID * @param integer $product_id プロダクトID + * * @return void */ public function removeProductByCategories($category_id, $product_id) { $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->delete('dtb_product_categories', - 'category_id = ? AND product_id = ?', array($category_id, $product_id)); + 'category_id = ? AND product_id = ?', array($category_id, $product_id)); } /** @@ -720,6 +750,7 @@ public function removeProductByCategories($category_id, $product_id) * * @param array $arrCategory_id 登録するカテゴリIDの配列 * @param integer $product_id プロダクトID + * * @return void */ public function updateProductCategories($arrCategory_id, $product_id) @@ -728,9 +759,9 @@ public function updateProductCategories($arrCategory_id, $product_id) // 現在のカテゴリ情報を取得 $arrCurrentCat = $objQuery->getCol('category_id', - 'dtb_product_categories', - 'product_id = ?', - array($product_id)); + 'dtb_product_categories', + 'product_id = ?', + array($product_id)); // 登録するカテゴリ情報と比較 foreach ($arrCurrentCat as $category_id) { @@ -750,18 +781,17 @@ public function updateProductCategories($arrCategory_id, $product_id) /** * カテゴリ数の登録を行う. * - * * @param SC_Query $objQuery SC_Query インスタンス * @param boolean $is_force_all_count 全カテゴリの集計を強制する場合 true * @param bool $is_nostock_hidden 在庫切れの商品は非表示にする場合 true * * @return void */ - public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $is_nostock_hidden = NOSTOCK_HIDDEN) + public function sfCountCategory($objQuery = null, $is_force_all_count = false, $is_nostock_hidden = NOSTOCK_HIDDEN) { $objProduct = new SC_Product_Ex(); - if ($objQuery == NULL) { + if ($objQuery == null) { $objQuery = SC_Query_Ex::getSingletonInstance(); } @@ -771,7 +801,7 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ $is_out_trans = true; } - //共通のfrom/where文の構築 + // 共通のfrom/where文の構築 $where_alldtl = SC_Product_Ex::getProductDispConditions('alldtl'); // 在庫無し商品の非表示 if ($is_nostock_hidden) { @@ -780,7 +810,7 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ $from_alldtl = 'dtb_products as alldtl'; } - //dtb_category_countの構成 + // dtb_category_countの構成 // 各カテゴリに所属する商品の数を集計。集計対象には子カテゴリを含まない。 if ($is_force_all_count) { @@ -791,7 +821,7 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ $arrCategoryCountOld = $objQuery->select('category_id, product_count', 'dtb_category_count'); } - //各カテゴリ内の商品数を数えて取得 + // 各カテゴリ内の商品数を数えて取得 $sql = <<< __EOS__ SELECT T1.category_id, count(*) as product_count FROM dtb_category AS T1 @@ -807,15 +837,15 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ $arrCategoryCountNew = $objQuery->getAll($sql); // 各カテゴリに所属する商品の数を集計。集計対象には子カテゴリを「含む」。 - //差分を取得して、更新対象カテゴリだけを確認する。 + // 差分を取得して、更新対象カテゴリだけを確認する。 - //各カテゴリ毎のデータ値において以前との差を見る - //古いデータの構造入れ替え + // 各カテゴリ毎のデータ値において以前との差を見る + // 古いデータの構造入れ替え $arrOld = []; foreach ($arrCategoryCountOld as $item) { $arrOld[$item['category_id']] = $item['product_count']; } - //新しいデータの構造入れ替え + // 新しいデータの構造入れ替え $arrNew = []; foreach ($arrCategoryCountNew as $item) { $arrNew[$item['category_id']] = $item['product_count']; @@ -825,7 +855,7 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ unset($arrCategoryCountNew); $arrNotExistsProductCategoryId = []; - //削除カテゴリを想定して、古いカテゴリ一覧から見て商品数が異なるデータが無いか確認。 + // 削除カテゴリを想定して、古いカテゴリ一覧から見て商品数が異なるデータが無いか確認。 foreach ($arrOld as $category_id => $count) { // 商品が存在しない if (!isset($arrNew[$category_id])) { @@ -866,8 +896,8 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ unset($arrOld); unset($arrNew); - //dtb_category_total_count 集計処理開始 - //更新対象カテゴリIDだけ集計しなおす。 + // dtb_category_total_count 集計処理開始 + // 更新対象カテゴリIDだけ集計しなおす。 $arrUpdateData = []; foreach ($arrTgtCategoryId as $category_id) { $arrWhereVal = []; @@ -889,7 +919,7 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ foreach ($arrUpdateData as $category_id => $count) { if ($count == 0) { $objQuery->delete('dtb_category_total_count', 'category_id = ?', array($category_id)); - continue 1; + continue; } $sqlval = [ 'product_count' => $count, @@ -916,6 +946,7 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $ * @param string $id_name ID名 * @param integer $id ID * @param array 子ID の配列 + * * @deprecated 本体で使用されていないため非推奨 */ public static function sfGetChildsID($table, $pid_name, $id_name, $id) @@ -932,6 +963,7 @@ public static function sfGetChildsID($table, $pid_name, $id_name, $id) * @param string $pid_name 親ID名 * @param string $id_name ID名 * @param integer $id ID番号 + * * @return array 子IDの配列 */ public static function sfGetChildrenArray($table, $pid_name, $id_name, $id) @@ -954,6 +986,7 @@ public static function sfGetChildrenArray($table, $pid_name, $id_name, $id) * @param string $id_name ID名 * @param array $arrPID 親IDの配列 * @param string $table + * * @return array 子IDの配列 */ public static function sfGetChildrenArraySub($table, $pid_name, $id_name, $arrPID) @@ -974,7 +1007,9 @@ public static function sfGetChildrenArraySub($table, $pid_name, $id_name, $arrPI * @param string $pid_name 親ID名 * @param string $id_name ID名 * @param integer $id ID + * * @return array 親IDの配列 + * * @deprecated SC_Helper_DB::sfGetParentsArray() を使用して下さい */ public static function sfGetParents($table, $pid_name, $id_name, $id) @@ -991,6 +1026,7 @@ public static function sfGetParents($table, $pid_name, $id_name, $id) * @param string $pid_name 親ID名 * @param string $id_name ID名 * @param integer $id ID + * * @return array 親IDの配列 */ public static function sfGetParentsArray($table, $pid_name, $id_name, $id) @@ -1002,7 +1038,7 @@ public static function sfGetParentsArray($table, $pid_name, $id_name, $id) while ($ret != '0' && !SC_Utils_Ex::isBlank($ret)) { // 無限ループの予防 if ($loop_cnt > LEVEL_MAX) { - trigger_error('最大階層制限到達', E_USER_ERROR); + trigger_error('最大階層制限到達', \E_USER_ERROR); } $arrParents[] = $ret; @@ -1041,6 +1077,7 @@ public static function sfGetParentsArraySub($table, $pid_name, $id_name, $child) * カテゴリから商品を検索する場合のWHERE文と値を返す. * * @param integer $category_id カテゴリID + * * @return array 商品を検索する場合の配列 */ public static function sfGetCatWhere($category_id) @@ -1061,6 +1098,7 @@ public static function sfGetCatWhere($category_id) * @param string $valname データ内容のカラム名 * @param string $where WHERE句 * @param array $arrVal プレースホルダ + * * @return array SELECT ボックス用リストの配列 */ public static function sfGetIDValueList($table, $keyname, $valname, $where = '', $arrVal = array()) @@ -1088,6 +1126,7 @@ public static function sfGetIDValueList($table, $keyname, $valname, $where = '', * @param string $colname カラム名 * @param integer $id テーブルのキー * @param string $andwhere SQL の AND 条件である WHERE 句 + * * @return void */ public function sfRankUp($table, $colname, $id, $andwhere = '') @@ -1096,7 +1135,7 @@ public function sfRankUp($table, $colname, $id, $andwhere = '') $objQuery->begin(); $where = "$colname = ?"; if ($andwhere != '') { - $where.= " AND $andwhere"; + $where .= " AND $andwhere"; } // 対象項目のランクを取得 $rank = $objQuery->get('rank', $table, $where, array($id)); @@ -1107,7 +1146,7 @@ public function sfRankUp($table, $colname, $id, $andwhere = '') // ランクが一つ上のIDを取得する。 $where = 'rank = ?'; if ($andwhere != '') { - $where.= " AND $andwhere"; + $where .= " AND $andwhere"; } $uprank = $rank + 1; $up_id = $objQuery->get($colname, $table, $where, array($uprank)); @@ -1140,6 +1179,7 @@ public function sfRankUp($table, $colname, $id, $andwhere = '') * @param string $colname カラム名 * @param integer $id テーブルのキー * @param string $andwhere SQL の AND 条件である WHERE 句 + * * @return void */ public function sfRankDown($table, $colname, $id, $andwhere = '') @@ -1148,7 +1188,7 @@ public function sfRankDown($table, $colname, $id, $andwhere = '') $objQuery->begin(); $where = "$colname = ?"; if ($andwhere != '') { - $where.= " AND $andwhere"; + $where .= " AND $andwhere"; } // 対象項目のランクを取得 $rank = $objQuery->get('rank', $table, $where, array($id)); @@ -1158,7 +1198,7 @@ public function sfRankDown($table, $colname, $id, $andwhere = '') // ランクが一つ下のIDを取得する。 $where = 'rank = ?'; if ($andwhere != '') { - $where.= " AND $andwhere"; + $where .= " AND $andwhere"; } $downrank = $rank - 1; $down_id = $objQuery->get($colname, $table, $where, array($downrank)); @@ -1192,6 +1232,7 @@ public function sfRankDown($table, $colname, $id, $andwhere = '') * @param integer $keyId キーの値 * @param integer $pos 指定順位 * @param string $where SQL の AND 条件である WHERE 句 + * * @return void */ public function sfMoveRank($tableName, $keyIdColumn, $keyId, $pos, $where = '') @@ -1239,6 +1280,7 @@ public function sfMoveRank($tableName, $keyIdColumn, $keyId, $pos, $where = '') * * @param int $position 指定された位置 * @param int $maxRank 現在のランク最大値 + * * @return int $newRank DBに登録するRANK値 */ public function getNewRank($position, $maxRank) @@ -1262,6 +1304,7 @@ public function getNewRank($position, $maxRank) * @param SC_Query $objQuery * @param string $tableName * @param string $addWhere + * * @return boolean */ public function moveOtherItemRank($newRank, $oldRank, &$objQuery, $tableName, $addWhere) @@ -1273,15 +1316,15 @@ public function moveOtherItemRank($newRank, $oldRank, &$objQuery, $tableName, $a $where .= " AND $addWhere"; } if ($newRank > $oldRank) { - //位置を上げる場合、他の商品の位置を1つ下げる(ランクを1下げる) + // 位置を上げる場合、他の商品の位置を1つ下げる(ランクを1下げる) $arrRawSql['rank'] = 'rank - 1'; $arrWhereVal = array($oldRank + 1, $newRank); } elseif ($newRank < $oldRank) { - //位置を下げる場合、他の商品の位置を1つ上げる(ランクを1上げる) + // 位置を下げる場合、他の商品の位置を1つ上げる(ランクを1上げる) $arrRawSql['rank'] = 'rank + 1'; $arrWhereVal = array($newRank, $oldRank - 1); } else { - //入れ替え先の順位が入れ替え元の順位と同じ場合なにもしない + // 入れ替え先の順位が入れ替え元の順位と同じ場合なにもしない return false; } @@ -1299,24 +1342,26 @@ public function moveOtherItemRank($newRank, $oldRank, &$objQuery, $tableName, $a * @param string $andwhere SQL の AND 条件である WHERE 句 * @param bool $delete レコードごと削除する場合 true, * レコードごと削除しない場合 false + * * @return void */ public function sfDeleteRankRecord($table, $colname, $id, $andwhere = '', - $delete = false) { + $delete = false) + { $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); // 削除レコードのランクを取得する。 $where = "$colname = ?"; if ($andwhere != '') { - $where.= " AND $andwhere"; + $where .= " AND $andwhere"; } $rank = $objQuery->get('rank', $table, $where, array($id)); if (!$delete) { // ランクを最下位にする、DELフラグON $sqlval = array( - 'rank' => 0, - 'del_flg' => 1, + 'rank' => 0, + 'del_flg' => 1, ); $where = "$colname = ?"; $arrWhereVal = array($id); @@ -1348,7 +1393,9 @@ public function sfDeleteRankRecord($table, $colname, $id, $andwhere = '', * @param string $id_name ID名 * @param string $col_name カラム名 * @param array $arrId IDの配列 + * * @return array 特定のカラムの配列 + * * @deprecated 本体で使用されていないため非推奨 */ public function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId) @@ -1361,7 +1408,7 @@ public function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId) if ($where == '') { $where = "$id_name = ?"; } else { - $where.= " OR $id_name = ?"; + $where .= " OR $id_name = ?"; } } @@ -1383,7 +1430,9 @@ public function sfGetParentsCol($objQuery, $table, $id_name, $col_name, $arrId) * @param integer $old_catid 旧カテゴリID * @param integer $new_catid 新カテゴリID * @param integer $id ID + * * @return void + * * @deprecated 本体で使用されていないため非推奨 */ public function sfMoveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid, $new_catid, $id) @@ -1424,7 +1473,9 @@ public function sfMoveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid * @param string $col カラム名 * @param array $arrVal 要素の配列 * @param string $addwhere SQL の AND 条件である WHERE 句 + * * @return bool レコードが存在する場合 true + * * @deprecated SC_Query::exists() を使用してください */ public static function sfIsRecord($table, $col, $arrVal, $addwhere = '') @@ -1435,7 +1486,7 @@ public static function sfIsRecord($table, $col, $arrVal, $addwhere = '') $where = 'del_flg = 0'; if ($addwhere != '') { - $where.= " AND $addwhere"; + $where .= " AND $addwhere"; } foreach ($arrCol as $val) { @@ -1443,7 +1494,7 @@ public static function sfIsRecord($table, $col, $arrVal, $addwhere = '') if ($where == '') { $where = "$val = ?"; } else { - $where.= " AND $val = ?"; + $where .= " AND $val = ?"; } } } @@ -1460,14 +1511,15 @@ public static function sfIsRecord($table, $col, $arrVal, $addwhere = '') * メーカー商品数数の登録を行う. * * @param SC_Query $objQuery SC_Query インスタンス + * * @return void */ public function sfCountMaker($objQuery) { - //テーブル内容の削除 + // テーブル内容の削除 $objQuery->query('DELETE FROM dtb_maker_count'); - //各メーカーの商品数を数えて格納 + // 各メーカーの商品数を数えて格納 $sql = ' INSERT INTO dtb_maker_count(maker_id, product_count, create_date) '; $sql .= ' SELECT T1.maker_id, count(T2.maker_id), CURRENT_TIMESTAMP '; $sql .= ' FROM dtb_maker AS T1 LEFT JOIN dtb_products AS T2'; @@ -1482,8 +1534,8 @@ public function sfCountMaker($objQuery) * * @param integer $product_id プロダクトID * @param integer $maker_id メーカーID - * @return array 選択中の商品のメーカーIDの配列 * + * @return array 選択中の商品のメーカーIDの配列 */ public function sfGetMakerId($product_id, $maker_id = 0, $closed = false) { @@ -1519,6 +1571,7 @@ public function sfGetMakerId($product_id, $maker_id = 0, $closed = false) * * @param string $addwhere 追加する WHERE 句 * @param bool $products_check 商品の存在するカテゴリのみ取得する場合 true + * * @return array カテゴリツリーの配列 */ public function sfGetMakerList($addwhere = '', $products_check = false) @@ -1527,7 +1580,7 @@ public function sfGetMakerList($addwhere = '', $products_check = false) $where = 'del_flg = 0'; if ($addwhere != '') { - $where.= " AND $addwhere"; + $where .= " AND $addwhere"; } $objQuery->setOption('ORDER BY rank DESC'); @@ -1558,7 +1611,9 @@ public function sfGetMakerList($addwhere = '', $products_check = false) * 店舗基本情報に基づいて税金額を返す * * @param integer $price 計算対象の金額 + * * @return double 税金額 + * * @deprecated SC_Helper_TaxRule::sfTax() を使用してください */ public function sfTax($price) @@ -1576,14 +1631,16 @@ public function sfTax($price) * @param int $price 計算対象の金額 * @param int $tax * @param int $tax_rule + * * @return double 税金付与した金額 + * * @deprecated SC_Helper_TaxRule::calcTax() を使用してください */ public static function sfCalcIncTax($price, $tax = null, $tax_rule = null) { // 店舗基本情報を取得 $CONF = SC_Helper_DB_Ex::sfGetBasisData(); - $tax = $tax === null ? $CONF['tax'] : $tax; + $tax = $tax === null ? $CONF['tax'] : $tax; $tax_rule = $tax_rule === null ? $CONF['tax_rule'] : $tax_rule; return SC_Utils_Ex::sfCalcIncTax($price, $tax, $tax_rule); @@ -1594,6 +1651,7 @@ public static function sfCalcIncTax($price, $tax = null, $tax_rule = null) * * @param integer $totalpoint * @param integer $use_point + * * @return integer 加算ポイント */ public static function sfGetAddPoint($totalpoint, $use_point) @@ -1610,7 +1668,9 @@ public static function sfGetAddPoint($totalpoint, $use_point) * XXX プラグイン用に追加。将来消すかも。 * * @param string $sqlFilePath SQL ファイルのパス + * * @return void + * * @deprecated 本体で使用されていないため非推奨 */ public function sfExecSqlByFile($sqlFilePath) @@ -1619,11 +1679,15 @@ public function sfExecSqlByFile($sqlFilePath) $objQuery = SC_Query_Ex::getSingletonInstance(); $sqls = file_get_contents($sqlFilePath); - if ($sqls === false) trigger_error('ファイルは存在するが読み込めない', E_USER_ERROR); + if ($sqls === false) { + trigger_error('ファイルは存在するが読み込めない', \E_USER_ERROR); + } foreach (explode(';', $sqls) as $sql) { $sql = trim($sql); - if (strlen($sql) == 0) continue; + if (strlen($sql) == 0) { + continue; + } $objQuery->query($sql); } } @@ -1633,11 +1697,14 @@ public function sfExecSqlByFile($sqlFilePath) * 商品規格を設定しているか * * @param integer $product_id 商品ID + * * @return bool 商品規格が存在する場合:true, それ以外:false */ public function sfHasProductClass($product_id) { - if (!SC_Utils_Ex::sfIsInt($product_id)) return false; + if (!SC_Utils_Ex::sfIsInt($product_id)) { + return false; + } $objQuery = SC_Query_Ex::getSingletonInstance(); $where = 'product_id = ? AND del_flg = 0 AND (classcategory_id1 != 0 OR classcategory_id2 != 0)'; @@ -1650,6 +1717,7 @@ public function sfHasProductClass($product_id) * 店舗基本情報を登録する * * @param array $arrData 登録するデータ + * * @return void */ public static function registerBasisData($arrData) @@ -1686,7 +1754,9 @@ public static function registerBasisData($arrData) * @param string $table * @param string $where * @param array $arrval + * * @return integer レコード件数 + * * @deprecated SC_Query::count() を使用してください */ public function countRecords($table, $where = '', $arrval = array()) diff --git a/data/class/helper/SC_Helper_Delivery.php b/data/class/helper/SC_Helper_Delivery.php index 7544bbcf6f..5066007fe4 100644 --- a/data/class/helper/SC_Helper_Delivery.php +++ b/data/class/helper/SC_Helper_Delivery.php @@ -24,8 +24,8 @@ /** * 配送方法を管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Delivery @@ -35,6 +35,7 @@ class SC_Helper_Delivery * * @param integer $deliv_id 配送方法ID * @param boolean $has_deleted 削除された支払方法も含む場合 true; 初期値 false + * * @return array */ public function get($deliv_id, $has_deleted = false) @@ -72,6 +73,7 @@ public function get($deliv_id, $has_deleted = false) * * @param integer $product_type_id 商品種別ID * @param boolean $has_deleted 削除された支払方法も含む場合 true; 初期値 false + * * @return array */ public function getList($product_type_id = null, $has_deleted = false) @@ -101,6 +103,7 @@ public function getList($product_type_id = null, $has_deleted = false) * 配送方法の登録. * * @param array $sqlval + * * @return integer $deliv_id */ public function save($sqlval) @@ -213,6 +216,7 @@ public function save($sqlval) * 配送方法の削除. * * @param integer $deliv_id 配送方法ID + * * @return void */ public function delete($deliv_id) @@ -226,6 +230,7 @@ public function delete($deliv_id) * 配送方法の表示順をひとつ上げる. * * @param integer $deliv_id 配送方法ID + * * @return void */ public function rankUp($deliv_id) @@ -238,6 +243,7 @@ public function rankUp($deliv_id) * 配送方法の表示順をひとつ下げる. * * @param integer $deliv_id 配送方法ID + * * @return void */ public function rankDown($deliv_id) @@ -250,6 +256,7 @@ public function rankDown($deliv_id) * 同じ内容の配送方法が存在するか確認. * * @param array $arrDeliv + * * @return boolean */ public function checkExist($arrDeliv) @@ -269,6 +276,7 @@ public function checkExist($arrDeliv) * 配送方法IDをキー, 名前を値とする配列を取得. * * @param string $type 値のタイプ + * * @return array */ public static function getIDValueList($type = 'name') @@ -280,6 +288,7 @@ public static function getIDValueList($type = 'name') * 配送業者IDからお届け時間の配列を取得する. * * @param integer $deliv_id 配送業者ID + * * @return array お届け時間の配列 */ public static function getDelivTime($deliv_id) @@ -299,6 +308,7 @@ public static function getDelivTime($deliv_id) * 配送業者ID から, 有効な支払方法IDを取得する. * * @param integer $deliv_id 配送業者ID + * * @return array 有効な支払方法IDの配列 */ public static function getPayments($deliv_id) @@ -314,6 +324,7 @@ public static function getPayments($deliv_id) * * @param integer|array $pref_id 都道府県ID 又は都道府県IDの配列 * @param integer $deliv_id 配送業者ID + * * @return string 指定の都道府県, 配送業者の配送料金 */ public static function getDelivFee($pref_id, $deliv_id = 0) @@ -343,6 +354,7 @@ public static function getDelivFee($pref_id, $deliv_id = 0) * 配送業者ID から, 配送料金の一覧を取得する. * * @param integer $deliv_id 配送業者ID + * * @return array 配送料金の配列 */ public static function getDelivFeeList($deliv_id) diff --git a/data/class/helper/SC_Helper_FPDI.php b/data/class/helper/SC_Helper_FPDI.php index 836d3d2062..b7d18fac6d 100644 --- a/data/class/helper/SC_Helper_FPDI.php +++ b/data/class/helper/SC_Helper_FPDI.php @@ -1,5 +1,6 @@ 'Japan1','supplement'=>2); + $registry = array('ordering' => 'Japan1', 'supplement' => 2); $this->AddCIDFonts('Gothic', 'KozGoPro-Medium-Acro,MS-PGothic,Osaka', $cw, $c_map, $registry); } - public function SJISMultiCell($w, $h, $txt, $border=0, $align='L', $fill=false) + public function SJISMultiCell($w, $h, $txt, $border = 0, $align = 'L', $fill = false) { $arrArg = func_get_args(); @@ -72,7 +73,7 @@ public function FancyTable($header, $data, $w) $this->Cell(0, $h, '', 0, 0, '', 0, ''); $product_width = $this->GetStringWidth($row[0]); if ($w[0] < $product_width) { - $output_lines = (int)($product_width / $w[0]) + 1; + $output_lines = (int) ($product_width / $w[0]) + 1; $output_height = $output_lines * $h; if ($this->y + $output_height >= $this->PageBreakTrigger) { $this->AddPage(); @@ -110,7 +111,7 @@ public function Text($x, $y, $txt) parent::Text($x, $y, $this->lfConvSjis($txt)); } - public function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') + public function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '') { parent::Cell($w, $h, $this->lfConvSjis($txt), $border, $ln, $align, $fill, $link); } @@ -128,13 +129,14 @@ public function lfConvSjis($conv_str) public function _out($s) { // Add a line to the document - if($this->state==2) - $this->pages[$this->page] .= $s."\n"; - elseif($this->state==1) + if ($this->state == 2) { + $this->pages[$this->page] .= $s . "\n"; + } elseif ($this->state == 1) { $this->_put($s); - elseif($this->state==0) + } elseif ($this->state == 0) { $this->Error('No page has been added yet'); - elseif($this->state==3) + } elseif ($this->state == 3) { $this->Error('The document is closed'); + } } } diff --git a/data/class/helper/SC_Helper_FileManager.php b/data/class/helper/SC_Helper_FileManager.php index cd26cefc60..238da84b2e 100644 --- a/data/class/helper/SC_Helper_FileManager.php +++ b/data/class/helper/SC_Helper_FileManager.php @@ -24,8 +24,8 @@ /** * ファイル管理 のヘルパークラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Helper_FileManager @@ -34,6 +34,7 @@ class SC_Helper_FileManager * 指定パス配下のディレクトリ取得する. * * @param string $dir 取得するディレクトリパス + * * @return array */ public static function sfGetFileList($dir) @@ -47,16 +48,18 @@ public static function sfGetFileList($dir) $cnt = 0; $arrDir = array(); // 行末の/を取り除く - while (($file = readdir($dh)) !== false) $arrDir[] = $file; + while (($file = readdir($dh)) !== false) { + $arrDir[] = $file; + } $dir = rtrim($dir, '/'); // アルファベットと数字でソート natcasesort($arrDir); foreach ($arrDir as $file) { // ./ と ../を除くファイルのみを取得 if ($file != '.' && $file != '..') { - $path = $dir.'/'.$file; + $path = $dir . '/' . $file; // SELECT内の見た目を整えるため指定文字数で切る - $file_size = SC_Utils_Ex::sfCutString(SC_Helper_FileManager::sfGetDirSize($path), FILE_NAME_LEN); + $file_size = SC_Utils_Ex::sfCutString(self::sfGetDirSize($path), FILE_NAME_LEN); $file_time = date('Y/m/d', filemtime($path)); // ディレクトリとファイルで格納配列を変える @@ -90,6 +93,7 @@ public static function sfGetFileList($dir) * 指定したディレクトリのバイト数を取得する. * * @param string $dir ディレクトリ + * * @return integer */ public static function sfGetDirSize($dir) @@ -102,7 +106,7 @@ public static function sfGetDirSize($dir) while ($file = readdir($handle)) { // 行末の/を取り除く $dir = rtrim($dir, '/'); - $path = $dir.'/'.$file; + $path = $dir . '/' . $file; if ($file != '..' && $file != '.' && !is_dir($path)) { $bytes += filesize($path); } elseif (is_dir($path) && $file != '..' && $file != '.') { @@ -129,6 +133,7 @@ public static function sfGetDirSize($dir) * @param string $dir ディレクトリ * @param string $tree_status 現在のツリーの状態開いているフォルダのパスを * | 区切りで格納 + * * @return array ツリー生成用の配列 */ public function sfGetFileTree($dir, $tree_status) @@ -170,6 +175,7 @@ public function sfGetFileTree($dir, $tree_status) * @param integer $cnt 連番 * @param string $tree_status 現在のツリーの状態開いているフォルダのパスが * | 区切りで格納 + * * @return void */ public function sfGetFileTreeSub($dir, $default_rank, &$cnt, &$arrTree, $tree_status) @@ -178,14 +184,16 @@ public function sfGetFileTreeSub($dir, $default_rank, &$cnt, &$arrTree, $tree_st $handle = opendir($dir); if ($handle) { $arrDir = array(); - while (false !== ($item = readdir($handle))) $arrDir[] = $item; + while (false !== ($item = readdir($handle))) { + $arrDir[] = $item; + } // アルファベットと数字でソート natcasesort($arrDir); foreach ($arrDir as $item) { if ($item != '.' && $item != '..') { // 文末の/を取り除く $dir = rtrim($dir, '/'); - $path = $dir.'/'.$item; + $path = $dir . '/' . $item; // ディレクトリのみ取得 if (is_dir($path)) { $arrTree[$cnt]['path'] = $path; @@ -218,6 +226,7 @@ public function sfGetFileTreeSub($dir, $default_rank, &$cnt, &$arrTree, $tree_st * * @param string ディレクトリ * @param string $dir + * * @return bool ファイルが存在する場合 true */ public function sfDirChildExists($dir) @@ -228,7 +237,7 @@ public function sfDirChildExists($dir) while ($file = readdir($handle)) { // 行末の/を取り除く $dir = rtrim($dir, '/'); - $path = $dir.'/'.$file; + $path = $dir . '/' . $file; if ($file != '..' && $file != '.' && is_dir($path)) { return true; } @@ -245,6 +254,7 @@ public function sfDirChildExists($dir) * @param string $dir ディレクトリ * @param string $tree_status 現在のツリーの状態開いているフォルダのパスが * | 区切りで格納 + * * @return bool 前回開かれた状態の場合 true */ public function lfIsFileOpen($dir, $tree_status) @@ -262,6 +272,7 @@ public function lfIsFileOpen($dir, $tree_status) * ファイルのダウンロードを行う. * * @param string $file ファイルパス + * * @return void */ public function sfDownloadFile($file) @@ -272,7 +283,7 @@ public function sfDownloadFile($file) header('Content-type: application/octet-stream; name=' . $file_name); header('Cache-Control: '); header('Pragma: '); - echo ($this->sfReadFile($file)); + echo $this->sfReadFile($file); } /** @@ -280,6 +291,7 @@ public function sfDownloadFile($file) * * @param string $file ファイルパス * @param integer $mode パーミッション + * * @return bool ファイル作成に成功した場合 true */ public function sfCreateFile($file, $mode = '') @@ -299,16 +311,17 @@ public function sfCreateFile($file, $mode = '') * * @param string ファイルパス * @param string $filename + * * @return string ファイルの内容 */ public function sfReadFile($filename) { $str = ''; // バイナリモードでオープン - $fp = @fopen($filename, 'rb'); - //ファイル内容を全て変数に読み込む + $fp = @fopen($filename, 'r'); + // ファイル内容を全て変数に読み込む if ($fp) { - $str = @fread($fp, filesize($filename)+1); + $str = @fread($fp, filesize($filename) + 1); } @fclose($fp); @@ -320,6 +333,7 @@ public function sfReadFile($filename) * * @param string $filename ファイルパス * @param string $value 書き込み内容 + * * @return boolean ファイルの書き込みに成功した場合 true */ public static function sfWriteFile($filename, $value) @@ -335,14 +349,16 @@ public static function sfWriteFile($filename, $value) return false; } - return fclose($fp);; + return fclose($fp); } /** * ユーザが作成したファイルをアーカイブしダウンロードさせる * TODO 要リファクタリング + * * @param string $dir アーカイブを行なうディレクトリ * @param string $template_code テンプレートコード + * * @return boolean 成功した場合 true; 失敗した場合 false */ public static function downloadArchiveFiles($dir, $template_code) @@ -356,7 +372,7 @@ public static function downloadArchiveFiles($dir, $template_code) $arrFileList = array(); foreach ($arrFileHash as $val) { $arrFileList[] = $val['file_name']; - $debug_message.= '圧縮:'.$val['file_name']."\n"; + $debug_message .= '圧縮:' . $val['file_name'] . "\n"; } GC_Utils_Ex::gfPrintLog($debug_message); @@ -366,8 +382,8 @@ public static function downloadArchiveFiles($dir, $template_code) $tar = new Archive_Tar($dlFileName, true); if ($tar->create($arrFileList)) { // ダウンロード用HTTPヘッダ出力 - header("Content-disposition: attachment; filename=${dlFileName}"); - header("Content-type: application/octet-stream; name=${dlFileName}"); + header("Content-disposition: attachment; filename={$dlFileName}"); + header("Content-type: application/octet-stream; name={$dlFileName}"); header('Cache-Control: '); header('Pragma: '); readfile($dlFileName); @@ -383,6 +399,7 @@ public static function downloadArchiveFiles($dir, $template_code) * tarアーカイブを解凍する. * * @param string $path アーカイブパス + * * @return boolean Archive_Tar::extractModify()のエラー */ public static function unpackFile($path) @@ -397,8 +414,8 @@ public static function unpackFile($path) $unpacking_name = preg_replace("/(\.tar|\.tar\.gz)$/", '', $file_name); // 指定されたフォルダ内に解凍する - $result = $tar->extractModify($dir. '/', $unpacking_name); - GC_Utils_Ex::gfPrintLog('解凍:' . $dir.'/'.$file_name.'->'.$dir.'/'.$unpacking_name); + $result = $tar->extractModify($dir . '/', $unpacking_name); + GC_Utils_Ex::gfPrintLog('解凍:' . $dir . '/' . $file_name . '->' . $dir . '/' . $unpacking_name); // フォルダ削除 SC_Helper_FileManager_Ex::deleteFile($dir . '/' . $unpacking_name); @@ -413,6 +430,7 @@ public static function unpackFile($path) * * @param string $path 削除対象のディレクトリまたはファイルのパス * @param boolean $del_myself $pathそのものを削除するか. true なら削除する. + * * @return bool */ public static function deleteFile($path, $del_myself = true) @@ -428,7 +446,9 @@ public static function deleteFile($path, $del_myself = true) GC_Utils_Ex::gfPrintLog($path . ' が開けませんでした.'); } while (($item = readdir($handle)) !== false) { - if ($item === '.' || $item === '..') continue; + if ($item === '.' || $item === '..') { + continue; + } $cur_path = $path . '/' . $item; if (is_dir($cur_path)) { // ディレクトリの場合、再帰処理 @@ -459,6 +479,7 @@ public static function deleteFile($path, $del_myself = true) * パスが USER_REALDIR の範囲外の場合は USER_DIR を返す. * * @param string $path 変換するパス + * * @return string USER_REALDIR 以下の相対パス */ public static function convertToRelativePath($path) @@ -467,9 +488,9 @@ public static function convertToRelativePath($path) $path = SC_Helper_FileManager_Ex::convertToAbsolutePath($path); // パスを正規化して返す - $path = str_replace(realpath(HTML_REALDIR).DIRECTORY_SEPARATOR, '', realpath($path)); + $path = str_replace(realpath(HTML_REALDIR) . \DIRECTORY_SEPARATOR, '', realpath($path)); $path = str_replace('\\', '/', $path); - $path = $endsWithSlash ? $path.'/' : $path; + $path = $endsWithSlash ? $path . '/' : $path; return $path; } @@ -480,16 +501,17 @@ public static function convertToRelativePath($path) * パスが USER_REALDIR の範囲外の場合は USER_REALDIR を返す. * * @param string $path 変換するパス + * * @return string USER_REALDIR 以下の絶対パス */ public static function convertToAbsolutePath($path) { $endsWithSlash = substr($path, -1) === '/'; // 絶対パスかどうか - if (strpos($path , '/') === 0 || preg_match('/^[a-z]:/i', $path)) { + if (strpos($path, '/') === 0 || preg_match('/^[a-z]:/i', $path)) { $path = realpath($path); } else { - $path = realpath(HTML_REALDIR.$path); + $path = realpath(HTML_REALDIR . $path); } // USER_REALDIR 以下のパスかどうか @@ -499,7 +521,7 @@ public static function convertToAbsolutePath($path) // パスを正規化して返す $path = str_replace('\\', '/', $path); - $path = $endsWithSlash ? $path.'/' : $path; + $path = $endsWithSlash ? $path . '/' : $path; return $path; } diff --git a/data/class/helper/SC_Helper_HandleError.php b/data/class/helper/SC_Helper_HandleError.php index a1b1d81843..31a645c590 100644 --- a/data/class/helper/SC_Helper_HandleError.php +++ b/data/class/helper/SC_Helper_HandleError.php @@ -26,16 +26,16 @@ * * 依存するクラスに構文エラーがあると、捕捉できない。よって、依存は最小に留めること。 * 現状 GC_Utils_Ex(GC_Utils) に依存しているため、その中で構文エラーは捕捉できない。 - * @package Helper + * * @version $Id$ */ class SC_Helper_HandleError { /** エラー処理中か */ - static $under_error_handling = false; + public static $under_error_handling = false; /** display_errors の初期値 */ - static $default_display_errors; + public static $default_display_errors; /** * 処理の読み込みを行う @@ -52,13 +52,13 @@ public static function load() // エラーレベル設定 (PHPのログに対する指定であり、以降のエラーハンドリングには影響しない模様) // 開発時は -1 (全て) を推奨 - error_reporting(E_ALL & ~E_NOTICE & ~E_USER_NOTICE); + error_reporting(\E_ALL & ~\E_NOTICE & ~\E_USER_NOTICE); static::$default_display_errors = ini_get('display_errors'); if (!(defined('SAFE') && SAFE === true) && !(defined('INSTALL_FUNCTION') && INSTALL_FUNCTION === true)) { // E_USER_ERROR または警告を捕捉した場合のエラーハンドラ - set_error_handler(array(__CLASS__, 'handle_warning'), E_USER_ERROR | E_WARNING | E_USER_WARNING | E_CORE_WARNING | E_COMPILE_WARNING); + set_error_handler(array(__CLASS__, 'handle_warning'), \E_USER_ERROR | \E_WARNING | \E_USER_WARNING | \E_CORE_WARNING | \E_COMPILE_WARNING); // E_USER_ERROR 以外のエラーを捕捉した場合の処理用 register_shutdown_function(array(__CLASS__, 'handle_error')); @@ -80,6 +80,7 @@ public static function load() * @param string $errstr エラーメッセージ * @param string $errfile エラーが発生したファイル名 * @param integer $errline エラーが発生した行番号 + * * @return void|boolean E_USER_ERROR が発生した場合は, エラーページへリダイレクト; * E_WARNING, E_USER_WARNING が発生した場合、true を返す */ @@ -99,7 +100,7 @@ public static function handle_warning($errno, $errstr, $errfile, $errline) $error_type_name = GC_Utils_Ex::getErrorTypeName($errno); switch ($errno) { - case E_USER_ERROR: + case \E_USER_ERROR: // パラメーターが読み込まれるまでは、エラー例外をスローする。(上の分岐があるため phpunit の実行中に限定される。) if (!defined('ERROR_LOG_REALFILE')) { ini_set('display_errors', static::$default_display_errors); @@ -113,10 +114,10 @@ public static function handle_warning($errno, $errstr, $errfile, $errline) exit(1); break; - case E_WARNING: - case E_USER_WARNING: - case E_CORE_WARNING: - case E_COMPILE_WARNING: + case \E_WARNING: + case \E_USER_WARNING: + case \E_CORE_WARNING: + case \E_COMPILE_WARNING: if (defined('ERROR_LOG_REALFILE')) { $message = "Warning($error_type_name): $errstr on [$errfile($errline)]"; GC_Utils_Ex::gfPrintLog($message, ERROR_LOG_REALFILE); @@ -139,11 +140,13 @@ public static function handle_warning($errno, $errstr, $errfile, $errline) * エラーページへリダイレクトする. * * @param string $buffer 出力バッファリングの内容 + * * @return string|void エラーが捕捉された場合は, エラーページへリダイレクトする; * エラーが捕捉されない場合は, 出力バッファリングの内容を返す + * * @deprecated 2.18 EC-CUBE 本体では使用していない。 */ - static function &_fatal_error_handler(&$buffer) + public static function &_fatal_error_handler(&$buffer) { if (preg_match('/(Fatal error)<\/b>: +(.+) in (.+)<\/b> on line (\d+)<\/b>
/i', $buffer, $matches)) { $message = "$matches[1]: $matches[2] on [$matches[3]($matches[4])]"; @@ -177,10 +180,10 @@ public static function handle_error() $is_error = false; if (isset($arrError)) { switch ($arrError['type']) { - case E_ERROR: - case E_PARSE: - case E_CORE_ERROR: - case E_COMPILE_ERROR: + case \E_ERROR: + case \E_PARSE: + case \E_CORE_ERROR: + case \E_COMPILE_ERROR: $is_error = true; break; default: @@ -211,6 +214,7 @@ public static function handle_error() * エラー画面を表示する * * @param string|null $errstr エラーメッセージ + * * @return void */ public static function displaySystemError($errstr = null) diff --git a/data/class/helper/SC_Helper_Holiday.php b/data/class/helper/SC_Helper_Holiday.php index a49ac12989..31e6b1cfa6 100644 --- a/data/class/helper/SC_Helper_Holiday.php +++ b/data/class/helper/SC_Helper_Holiday.php @@ -24,8 +24,8 @@ /** * 休日を管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Holiday @@ -35,6 +35,7 @@ class SC_Helper_Holiday * * @param integer $holiday_id 休日ID * @param boolean $has_deleted 削除された休日も含む場合 true; 初期値 false + * * @return array */ public function get($holiday_id, $has_deleted = false) @@ -53,6 +54,7 @@ public function get($holiday_id, $has_deleted = false) * 休日一覧の取得. * * @param boolean $has_deleted 削除された休日も含む場合 true; 初期値 false + * * @return array */ public function getList($has_deleted = false) @@ -74,6 +76,7 @@ public function getList($has_deleted = false) * 休日の登録. * * @param array $sqlval + * * @return multiple 登録成功:休日ID, 失敗:FALSE */ public function save($sqlval) @@ -97,13 +100,14 @@ public function save($sqlval) $ret = $objQuery->update('dtb_holiday', $sqlval, $where, array($holiday_id)); } - return ($ret) ? $sqlval['holiday_id'] : FALSE; + return ($ret) ? $sqlval['holiday_id'] : false; } /** * 休日の削除. * * @param integer $holiday_id 休日ID + * * @return void */ public function delete($holiday_id) @@ -117,6 +121,7 @@ public function delete($holiday_id) * 休日の表示順をひとつ上げる. * * @param integer $holiday_id 休日ID + * * @return void */ public function rankUp($holiday_id) @@ -129,6 +134,7 @@ public function rankUp($holiday_id) * 休日の表示順をひとつ下げる. * * @param integer $holiday_id 休日ID + * * @return void */ public function rankDown($holiday_id) @@ -143,9 +149,10 @@ public function rankDown($holiday_id) * @param integer $month * @param integer $day * @param integer $holiday_id + * * @return boolean 同日付の休日が存在:true */ - public function isDateExist($month, $day, $holiday_id = NULL) + public function isDateExist($month, $day, $holiday_id = null) { $objQuery = SC_Query_Ex::getSingletonInstance(); $where = 'del_flg = 0 AND month = ? AND day = ?'; diff --git a/data/class/helper/SC_Helper_Kiyaku.php b/data/class/helper/SC_Helper_Kiyaku.php index 20b631a912..fbbf3b63d8 100644 --- a/data/class/helper/SC_Helper_Kiyaku.php +++ b/data/class/helper/SC_Helper_Kiyaku.php @@ -24,8 +24,8 @@ /** * 会員規約を管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Kiyaku @@ -35,6 +35,7 @@ class SC_Helper_Kiyaku * * @param integer $kiyaku_id 会員規約ID * @param boolean $has_deleted 削除された会員規約も含む場合 true; 初期値 false + * * @return array */ public function getKiyaku($kiyaku_id, $has_deleted = false) @@ -53,6 +54,7 @@ public function getKiyaku($kiyaku_id, $has_deleted = false) * 会員規約一覧の取得. * * @param boolean $has_deleted 削除された会員規約も含む場合 true; 初期値 false + * * @return array */ public function getList($has_deleted = false) @@ -74,6 +76,7 @@ public function getList($has_deleted = false) * 会員規約の登録. * * @param array $sqlval + * * @return multiple 登録成功:会員規約ID, 失敗:FALSE */ public function saveKiyaku($sqlval) @@ -97,13 +100,14 @@ public function saveKiyaku($sqlval) $ret = $objQuery->update('dtb_kiyaku', $sqlval, $where, array($kiyaku_id)); } - return ($ret) ? $sqlval['kiyaku_id'] : FALSE; + return ($ret) ? $sqlval['kiyaku_id'] : false; } /** * 会員規約の削除. * * @param integer $kiyaku_id 会員規約ID + * * @return void */ public function deleteKiyaku($kiyaku_id) @@ -117,6 +121,7 @@ public function deleteKiyaku($kiyaku_id) * 会員規約の表示順をひとつ上げる. * * @param integer $kiyaku_id 会員規約ID + * * @return void */ public function rankUp($kiyaku_id) @@ -129,6 +134,7 @@ public function rankUp($kiyaku_id) * 会員規約の表示順をひとつ下げる. * * @param integer $kiyaku_id 会員規約ID + * * @return void */ public function rankDown($kiyaku_id) @@ -142,17 +148,18 @@ public function rankDown($kiyaku_id) * * @param string $title 規約タイトル * @param integer $kiyaku_id 会員規約ID + * * @return boolean 同名のタイトルが存在:TRUE */ - public function isTitleExist($title, $kiyaku_id = NULL) + public function isTitleExist($title, $kiyaku_id = null) { $objQuery = SC_Query_Ex::getSingletonInstance(); - $where = 'del_flg = 0 AND kiyaku_title = ?'; + $where = 'del_flg = 0 AND kiyaku_title = ?'; $arrVal = array($title); if (!SC_Utils_Ex::isBlank($kiyaku_id)) { - $where .= ' AND kiyaku_id <> ?'; + $where .= ' AND kiyaku_id <> ?'; $arrVal[] = $kiyaku_id; } diff --git a/data/class/helper/SC_Helper_Mail.php b/data/class/helper/SC_Helper_Mail.php index 3fc82696e2..01c3351df4 100644 --- a/data/class/helper/SC_Helper_Mail.php +++ b/data/class/helper/SC_Helper_Mail.php @@ -24,8 +24,8 @@ /** * メール関連 のヘルパークラス. * - * @package Helper * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Helper_Mail @@ -51,7 +51,7 @@ class SC_Helper_Mail public function __construct() { $masterData = new SC_DB_MasterData_Ex(); - $this->arrMAILTPLPATH = $masterData->getMasterData('mtb_mail_tpl_path'); + $this->arrMAILTPLPATH = $masterData->getMasterData('mtb_mail_tpl_path'); $this->arrPref = $masterData->getMasterData('mtb_pref'); $this->arrCountry = $masterData->getMasterData('mtb_country'); } @@ -102,9 +102,15 @@ public function sfSendTemplateMail($to, $to_name, $template_id, &$objPage, $from // メール送信処理 $objSendMail = new SC_SendMail_Ex(); - if ($from_address == '') $from_address = $arrInfo['email03']; - if ($from_name == '') $from_name = $arrInfo['shop_name']; - if ($reply_to == '') $reply_to = $arrInfo['email03']; + if ($from_address == '') { + $from_address = $arrInfo['email03']; + } + if ($from_name == '') { + $from_name = $arrInfo['shop_name']; + } + if ($reply_to == '') { + $reply_to = $arrInfo['email03']; + } $error = $arrInfo['email04']; $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); @@ -140,7 +146,7 @@ public function sfSendOrderMail($order_id, $template_id, $subject = '', $header $arrOrder = $objQuery->getRow('*', 'dtb_order', $where, array($order_id)); if (empty($arrOrder)) { - trigger_error("該当する受注が存在しない。(注文番号: $order_id)", E_USER_ERROR); + trigger_error("該当する受注が存在しない。(注文番号: $order_id)", \E_USER_ERROR); } $where = 'order_id = ?'; @@ -161,7 +167,7 @@ public function sfSendOrderMail($order_id, $template_id, $subject = '', $header $arrTplVar->arrCustomer = $arrCustomer; $arrTplVar->arrOrder = $arrOrder; - //その他決済情報 + // その他決済情報 if ($arrOrder['memo02'] != '') { $arrOther = unserialize($arrOrder['memo02']); @@ -202,7 +208,7 @@ public function sfSendOrderMail($order_id, $template_id, $subject = '', $header $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); - $objSendMail->setTo($arrOrder['order_email'], $arrOrder['order_name01'] . ' '. $arrOrder['order_name02'] .' 様'); + $objSendMail->setTo($arrOrder['order_email'], $arrOrder['order_name01'] . ' ' . $arrOrder['order_name02'] . ' 様'); // 送信フラグ:trueの場合は、送信する。 if ($send) { @@ -218,6 +224,7 @@ public function sfSendOrderMail($order_id, $template_id, $subject = '', $header * 配送情報の取得 * * @param integer $order_id 受注ID + * * @return array 配送情報を格納した配列 */ public function sfGetShippingData($order_id) @@ -247,7 +254,7 @@ public function sfSendTplMail($to, $tmp_subject, $tplpath, &$objPage) $objMailView->setPage($this->getPage()); $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); // メール本文の取得 - $objPage->tpl_shopname=$arrInfo['shop_name']; + $objPage->tpl_shopname = $arrInfo['shop_name']; $objPage->tpl_infoemail = $arrInfo['email02']; $objMailView->assignobj($objPage); $body = $objMailView->fetch($tplpath); @@ -277,23 +284,23 @@ public function sfSendMail($to, $tmp_subject, $body) $objSendMail->sendMail(); } - //件名にテンプレートを用いる + // 件名にテンプレートを用いる /** * @param SC_SiteView_Ex $objMailView */ - public function sfMakeSubject($subject, &$objMailView = NULL) + public function sfMakeSubject($subject, &$objMailView = null) { if (empty($objMailView)) { $objMailView = new SC_SiteView_Ex(); $objMailView->setPage($this->getPage()); } - $objTplAssign = new stdClass; + $objTplAssign = new stdClass(); $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); - $objTplAssign->tpl_shopname=$arrInfo['shop_name']; - $objTplAssign->tpl_infoemail=$subject; // 従来互換 - $objTplAssign->tpl_mailtitle=$subject; + $objTplAssign->tpl_shopname = $arrInfo['shop_name']; + $objTplAssign->tpl_infoemail = $subject; // 従来互換 + $objTplAssign->tpl_mailtitle = $subject; $objMailView->assignobj($objTplAssign); $subject = $objMailView->fetch('mail_templates/mail_title.tpl'); // #1940 (SC_Helper_Mail#sfMakeSubject 先頭に改行を含む値を返す) 対応 @@ -314,7 +321,9 @@ public function sfSaveMailHistory($order_id, $template_id, $subject, $body) $sqlval['order_id'] = $order_id; $sqlval['template_id'] = $template_id; $sqlval['send_date'] = 'CURRENT_TIMESTAMP'; - if (!isset($_SESSION['member_id'])) $_SESSION['member_id'] = ''; + if (!isset($_SESSION['member_id'])) { + $_SESSION['member_id'] = ''; + } if ($_SESSION['member_id'] != '') { $sqlval['creator_id'] = $_SESSION['member_id']; } else { @@ -329,6 +338,7 @@ public function sfSaveMailHistory($order_id, $template_id, $subject, $body) /** * 会員登録があるかどうかのチェック(仮会員を含まない) + * * @deprecated 本体では使用されていないため非推奨 */ public function sfCheckCustomerMailMaga($email) @@ -353,8 +363,8 @@ public function sfCheckCustomerMailMaga($email) * @param integer $customer_id 会員ID * @param boolean $is_mobile false(default):PCアドレスにメールを送る true:携帯アドレスにメールを送る * @param $resend_flg true 仮登録メール再送 - * @return boolean true:成功 false:失敗 * + * @return boolean true:成功 false:失敗 */ public function sfSendRegistMail($secret_key, $customer_id = '', $is_mobile = false, $resend_flg = false) { @@ -378,15 +388,14 @@ public function sfSendRegistMail($secret_key, $customer_id = '', $is_mobile = fa $objMailText->assign('uniqid', $arrCustomerData['secret_key']); $objMailText->assignobj($arrCustomerData); - $objHelperMail = new SC_Helper_Mail_Ex(); + $objHelperMail = new SC_Helper_Mail_Ex(); // 仮会員が有効の場合 - if (CUSTOMER_CONFIRM_MAIL == true and $arrCustomerData['status'] == 1 or $arrCustomerData['status'] == 1 and $resend_flg == true) { - $subject = $objHelperMail->sfMakeSubject('会員登録のご確認', $objMailText); + if (CUSTOMER_CONFIRM_MAIL == true && $arrCustomerData['status'] == 1 || $arrCustomerData['status'] == 1 && $resend_flg == true) { + $subject = $objHelperMail->sfMakeSubject('会員登録のご確認', $objMailText); $toCustomerMail = $objMailText->fetch('mail_templates/customer_mail.tpl'); } else { - $subject = $objHelperMail->sfMakeSubject('会員登録のご完了', $objMailText); + $subject = $objHelperMail->sfMakeSubject('会員登録のご完了', $objMailText); $toCustomerMail = $objMailText->fetch('mail_templates/customer_regist_mail.tpl'); - } $objMail = new SC_SendMail_Ex(); @@ -407,7 +416,7 @@ public function sfSendRegistMail($secret_key, $customer_id = '', $is_mobile = fa } else { $to_addr = $arrCustomerData['email']; } - $objMail->setTo($to_addr, $arrCustomerData['name01'] . $arrCustomerData['name02'] .' 様'); + $objMail->setTo($to_addr, $arrCustomerData['name01'] . $arrCustomerData['name02'] . ' 様'); $objMail->sendMail(); @@ -416,8 +425,11 @@ public function sfSendRegistMail($secret_key, $customer_id = '', $is_mobile = fa /** * 保存されているメルマガテンプレートの取得 + * * @param integer 特定IDのテンプレートを取り出したい時はtemplate_idを指定。未指定時は全件取得 + * * @return array メールテンプレート情報を格納した配列 + * * @todo 表示順も引数で変更できるように */ public static function sfGetMailmagaTemplate($template_id = null) @@ -429,7 +441,7 @@ public static function sfGetMailmagaTemplate($template_id = null) // 条件文 $where = 'del_flg = ?'; $arrValues[] = 0; - //template_id指定時 + // template_id指定時 if (SC_Utils_Ex::sfIsInt($template_id) === true) { $where .= ' AND template_id = ?'; $arrValues[] = $template_id; @@ -445,7 +457,9 @@ public static function sfGetMailmagaTemplate($template_id = null) /** * 保存されているメルマガ送信履歴の取得 + * * @param integer 特定の送信履歴を取り出したい時はsend_idを指定。未指定時は全件取得 + * * @return array 送信履歴情報を格納した配列 */ public function sfGetSendHistory($send_id = null) @@ -458,7 +472,7 @@ public function sfGetSendHistory($send_id = null) $where = 'del_flg = ?'; $arrValues[] = 0; - //send_id指定時 + // send_id指定時 if (SC_Utils_Ex::sfIsInt($send_id) === true) { $where .= ' AND send_id = ?'; $arrValues[] = $send_id; @@ -476,6 +490,7 @@ public function sfGetSendHistory($send_id = null) * 指定したIDのメルマガ配送を行う * * @param integer $send_id dtb_send_history の情報 + * * @return void */ public static function sfSendMailmagazine($send_id) @@ -489,7 +504,9 @@ public static function sfSendMailmagazine($send_id) $arrMail = $objQuery->getRow('*', 'dtb_send_history', $where, array($send_id)); // 対象となる$send_idが見つからない - if (SC_Utils_Ex::isBlank($arrMail)) return; + if (SC_Utils_Ex::isBlank($arrMail)) { + return; + } // 送信先リストの取得 $arrDestinationList = $objQuery->select( @@ -541,16 +558,16 @@ public static function sfSendMailmagazine($send_id) // 送信結果情報を更新 $objQuery->update('dtb_send_customer', - array('send_flag'=>$sendFlag), - 'send_id = ? AND customer_id = ?', - array($send_id,$arrDestination['customer_id'])); + array('send_flag' => $sendFlag), + 'send_id = ? AND customer_id = ?', + array($send_id, $arrDestination['customer_id'])); } // メール全件送信完了後の処理 $objQuery->update('dtb_send_history', - array('end_date'=>'CURRENT_TIMESTAMP', 'complete_count'=>$complete_count), - 'send_id = ?', - array($send_id)); + array('end_date' => 'CURRENT_TIMESTAMP', 'complete_count' => $complete_count), + 'send_id = ?', + array($send_id)); // 送信完了 報告メール $compSubject = date('Y年m月d日H時i分') . ' 下記メールの配信が完了しました。'; diff --git a/data/class/helper/SC_Helper_Mailtemplate.php b/data/class/helper/SC_Helper_Mailtemplate.php index a95d1dc7bd..35fa7ac740 100644 --- a/data/class/helper/SC_Helper_Mailtemplate.php +++ b/data/class/helper/SC_Helper_Mailtemplate.php @@ -24,8 +24,8 @@ /** * メールテンプレートを管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Mailtemplate @@ -35,6 +35,7 @@ class SC_Helper_Mailtemplate * * @param integer $template_id メールテンプレートID * @param boolean $has_deleted 削除されたメールテンプレートも含む場合 true; 初期値 false + * * @return array */ public function get($template_id, $has_deleted = false) @@ -54,6 +55,7 @@ public function get($template_id, $has_deleted = false) * メールテンプレート一覧の取得. * * @param boolean $has_deleted 削除されたメールテンプレートも含む場合 true; 初期値 false + * * @return array */ public function getList($has_deleted = false) @@ -74,6 +76,7 @@ public function getList($has_deleted = false) * メールテンプレートの登録. * * @param array $sqlval + * * @return multiple 登録成功:メールテンプレートID, 失敗:FALSE */ public function save($sqlval) @@ -100,6 +103,6 @@ public function save($sqlval) $ret = $objQuery->update('dtb_mailtemplate', $sqlval, $where, array($template_id)); } - return ($ret) ? $sqlval['template_id'] : FALSE; + return ($ret) ? $sqlval['template_id'] : false; } } diff --git a/data/class/helper/SC_Helper_Maker.php b/data/class/helper/SC_Helper_Maker.php index f2b7078953..574ca0cb8a 100644 --- a/data/class/helper/SC_Helper_Maker.php +++ b/data/class/helper/SC_Helper_Maker.php @@ -24,8 +24,8 @@ /** * メーカーを管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Maker @@ -35,6 +35,7 @@ class SC_Helper_Maker * * @param integer $maker_id メーカーID * @param boolean $has_deleted 削除されたメーカーも含む場合 true; 初期値 false + * * @return array */ public function getMaker($maker_id, $has_deleted = false) @@ -54,6 +55,7 @@ public function getMaker($maker_id, $has_deleted = false) * * @param integer $name メーカー名 * @param boolean $has_deleted 削除されたメーカーも含む場合 true; 初期値 false + * * @return array */ public function getByName($name, $has_deleted = false) @@ -72,6 +74,7 @@ public function getByName($name, $has_deleted = false) * メーカー一覧の取得. * * @param boolean $has_deleted 削除されたメーカーも含む場合 true; 初期値 false + * * @return array */ public function getList($has_deleted = false) @@ -93,6 +96,7 @@ public function getList($has_deleted = false) * メーカーの登録. * * @param array $sqlval + * * @return multiple 登録成功:メーカーID, 失敗:FALSE */ public function saveMaker($sqlval) @@ -116,13 +120,14 @@ public function saveMaker($sqlval) $ret = $objQuery->update('dtb_maker', $sqlval, $where, array($maker_id)); } - return ($ret) ? $sqlval['maker_id'] : FALSE; + return ($ret) ? $sqlval['maker_id'] : false; } /** * メーカーの削除. * * @param integer $maker_id メーカーID + * * @return void */ public function delete($maker_id) @@ -136,6 +141,7 @@ public function delete($maker_id) * メーカーの表示順をひとつ上げる. * * @param integer $maker_id メーカーID + * * @return void */ public function rankUp($maker_id) @@ -148,6 +154,7 @@ public function rankUp($maker_id) * メーカーの表示順をひとつ下げる. * * @param integer $maker_id メーカーID + * * @return void */ public function rankDown($maker_id) diff --git a/data/class/helper/SC_Helper_Mobile.php b/data/class/helper/SC_Helper_Mobile.php index dbc41f520b..9eada82fc3 100644 --- a/data/class/helper/SC_Helper_Mobile.php +++ b/data/class/helper/SC_Helper_Mobile.php @@ -24,9 +24,10 @@ /** * モバイルのヘルパークラス. * - * @package Helper * @author EC-CUBE CO.,LTD. + * * @version $Id$ + * * @deprecated */ class SC_Helper_Mobile @@ -38,11 +39,11 @@ class SC_Helper_Mobile * Application/octet-streamで対応出来ないファイルタイプのみ拡張子をキーに記述する * 拡張子が本配列に存在しない場合は application/force-download を利用する */ public $arrMimetypes = array( - 'html'=> 'text/html', + 'html' => 'text/html', 'css' => 'text/css', - 'hdml'=> 'text/x-hdml', + 'hdml' => 'text/x-hdml', 'mmf' => 'application/x-smaf', - 'jpeg'=> 'image/jpeg', + 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', @@ -72,7 +73,7 @@ class SC_Helper_Mobile 'zip' => 'application/zip', 'doc' => 'application/msword', 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint' + 'ppt' => 'application/vnd.ms-powerpoint', ); /** @@ -93,6 +94,7 @@ public function lfMobileCheckCompatibility() * 入力データを内部エンコーディングに変換し、絵文字を除去する。 * * @param string &$value 入力データへの参照 + * * @return void */ public function lfMobileConvertInputValue(&$value) @@ -140,8 +142,8 @@ public function lfMobileGetExtSessionId() foreach ($_REQUEST as $key => $value) { $session_id = $objQuery->get('session_id', 'dtb_mobile_ext_session_id', - 'param_key = ? AND param_value = ? AND url = ? AND create_date >= ?', - array($key, $value, $url, $time)); + 'param_key = ? AND param_value = ? AND url = ? AND create_date >= ?', + array($key, $value, $url, $time)); if (isset($session_id)) { return $session_id; } @@ -173,7 +175,7 @@ public function lfMobileGetSessionId() // セッションIDの存在をチェックする。 $objSession = new SC_Helper_Session_Ex(); if ($objSession->sfSessRead($sessionId) === null) { - GC_Utils_Ex::gfPrintLog("Non-existent session id : sid=".substr(sha1($sessionId), 0, 8)); + GC_Utils_Ex::gfPrintLog("Non-existent session id : sid=" . substr(sha1($sessionId), 0, 8)); return false; } @@ -196,7 +198,7 @@ public function lfMobileValidateSession() } // 有効期限を過ぎていないかどうかをチェックする。 - if (intval(@$_SESSION['mobile']['expires']) < time()) { + if ((int) (@$_SESSION['mobile']['expires']) < time()) { $msg = 'Session expired at ' . date('Y/m/d H:i:s', @$_SESSION['mobile']['expires']) . ' : sid=' . substr(sha1(session_id()), 0, 8); GC_Utils_Ex::gfPrintLog($msg); @@ -241,7 +243,7 @@ public function lfMobileInitOutput() // 内部エンコーディングから Shift JIS に変換する。 ob_start('mb_output_handler'); - //download.phpに対してカタカナ変換をするとファイルが壊れてしまうため回避する + // download.phpに対してカタカナ変換をするとファイルが壊れてしまうため回避する if ($_SERVER['SCRIPT_FILENAME'] != HTML_REALDIR . 'mypage/download.php') { // 全角カタカナを半角カタカナに変換する。 ob_start(create_function('$buffer', 'return mb_convert_kana($buffer, "k");')); @@ -267,7 +269,7 @@ public function sfMobileInit() /** * Location等でセッションIDを付加する必要があるURLにセッションIDを付加する。 * - * @return String + * @return string */ public function gfAddSessionId($url = null) { @@ -303,6 +305,7 @@ public function lfGenerateKaraMailToken() * * @param string $next_url 空メール受け付け後に遷移させるページ (モバイルサイトトップからの相対URL) * @param string $session_id セッションID (省略した場合は現在のセッションID) + * * @return string|false トークンを返す。エラーが発生した場合はfalseを返す。 */ public function gfPrepareKaraMail($next_url, $session_id = null) @@ -321,7 +324,7 @@ public function gfPrepareKaraMail($next_url, $session_id = null) $arrValues = array( 'session_id' => $session_id, - 'next_url' => $next_url, + 'next_url' => $next_url, ); $try = 10; @@ -350,6 +353,7 @@ public function gfPrepareKaraMail($next_url, $session_id = null) * * @param string $token トークン * @param string $email メールアドレス + * * @return boolean 成功した場合はtrue、失敗した場合はfalseを返す。 */ public function gfRegisterKaraMail($token, $email) @@ -359,8 +363,8 @@ public function gfRegisterKaraMail($token, $email) // GC $time = date('Y-m-d H:i:s', time() - MOBILE_SESSION_LIFETIME); $objQuery->delete('dtb_mobile_kara_mail', - '(email IS NULL AND create_date < ?) OR (email IS NOT NULL AND receive_date < ?)', - array($time, $time)); + '(email IS NULL AND create_date < ?) OR (email IS NOT NULL AND receive_date < ?)', + array($time, $time)); $kara_mail_id = $objQuery->get('kara_mail_id', 'dtb_mobile_kara_mail', 'token = ?', array($token)); if (!isset($kara_mail_id)) { @@ -376,11 +380,12 @@ public function gfRegisterKaraMail($token, $email) /** * 空メール管理テーブルからトークンが一致する行を削除し、 - * 次に遷移させるページのURLを返す。  + * 次に遷移させるページのURLを返す。 * * メールアドレスは $_SESSION['mobile']['kara_mail_from'] に登録される。 * * @param string $token トークン + * * @return string|false URLを返す。エラーが発生した場合はfalseを返す。 */ public function gfFinishKaraMail($token) @@ -420,6 +425,7 @@ public function gfFinishKaraMail($token) * @param string $param_key パラメーター名 * @param string $param_value パラメーター値 * @param string $url URL + * * @return void */ public function sfMobileSetExtSessionId($param_key, $param_value, $url) @@ -431,10 +437,10 @@ public function sfMobileSetExtSessionId($param_key, $param_value, $url) $objQuery->delete('dtb_mobile_ext_session_id', 'create_date < ?', array($time)); $arrValues = array( - 'session_id' => session_id(), - 'param_key' => $param_key, + 'session_id' => session_id(), + 'param_key' => $param_key, 'param_value' => $param_value, - 'url' => $url, + 'url' => $url, ); $objQuery->insert('dtb_mobile_ext_session_id', $arrValues); @@ -444,6 +450,7 @@ public function sfMobileSetExtSessionId($param_key, $param_value, $url) * メールアドレスが携帯のものかどうかを判別する。 * * @param string $address メールアドレス + * * @return boolean 携帯のメールアドレスの場合はtrue、それ以外の場合はfalseを返す。 */ public function gfIsMobileMailAddress($address) @@ -465,11 +472,12 @@ public function gfIsMobileMailAddress($address) * ファイルのMIMEタイプを判別する * * @param string $filename ファイル名 + * * @return string MIMEタイプ */ public function getMimeType($filename) { - //ファイルの拡張子からコンテンツタイプを決定する + // ファイルの拡張子からコンテンツタイプを決定する $file_extension = strtolower(substr(strrchr($filename, '.'), 1)); $mime_type = $this->defaultMimeType; if (array_key_exists($file_extension, $this->arrMimetypes)) { diff --git a/data/class/helper/SC_Helper_News.php b/data/class/helper/SC_Helper_News.php index 5ff42f593d..f663e18865 100644 --- a/data/class/helper/SC_Helper_News.php +++ b/data/class/helper/SC_Helper_News.php @@ -24,8 +24,8 @@ /** * ニュースを管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_News @@ -35,6 +35,7 @@ class SC_Helper_News * * @param integer $news_id ニュースID * @param boolean $has_deleted 削除されたニュースも含む場合 true; 初期値 false + * * @return array */ public static function getNews($news_id, $has_deleted = false) @@ -56,6 +57,7 @@ public static function getNews($news_id, $has_deleted = false) * @param integer $dispNumber 表示件数 * @param integer $pageNumber ページ番号 * @param boolean $has_deleted 削除されたニュースも含む場合 true; 初期値 false + * * @return array */ public function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false) @@ -70,7 +72,7 @@ public function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false) $objQuery->setOrder('rank DESC'); if ($dispNumber > 0) { if ($pageNumber > 0) { - $objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber)); + $objQuery->setLimitOffset($dispNumber, ($pageNumber - 1) * $dispNumber); } else { $objQuery->setLimit($dispNumber); } @@ -84,6 +86,7 @@ public function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false) * ニュースの登録. * * @param array $sqlval + * * @return multiple 登録成功:ニュースID, 失敗:FALSE */ public function saveNews($sqlval) @@ -107,13 +110,14 @@ public function saveNews($sqlval) $ret = $objQuery->update('dtb_news', $sqlval, $where, array($news_id)); } - return ($ret) ? $sqlval['news_id'] : FALSE; + return ($ret) ? $sqlval['news_id'] : false; } /** * ニュースの削除. * * @param integer $news_id ニュースID + * * @return void */ public function deleteNews($news_id) @@ -127,6 +131,7 @@ public function deleteNews($news_id) * ニュースの表示順をひとつ上げる. * * @param integer $news_id ニュースID + * * @return void */ public function rankUp($news_id) @@ -139,6 +144,7 @@ public function rankUp($news_id) * ニュースの表示順をひとつ下げる. * * @param integer $news_id ニュースID + * * @return void */ public function rankDown($news_id) @@ -152,6 +158,7 @@ public function rankDown($news_id) * * @param integer $news_id ニュースID * @param integer $rank 移動先の表示順 + * * @return void */ public function moveRank($news_id, $rank) @@ -164,6 +171,7 @@ public function moveRank($news_id, $rank) * ニュース記事数を計算. * * @param boolean $has_deleted 削除されたニュースも含む場合 true; 初期値 false + * * @return integer ニュース記事数 */ public function getCount($has_deleted = false) diff --git a/data/class/helper/SC_Helper_PageLayout.php b/data/class/helper/SC_Helper_PageLayout.php index 1296ddf61d..35515254bb 100644 --- a/data/class/helper/SC_Helper_PageLayout.php +++ b/data/class/helper/SC_Helper_PageLayout.php @@ -24,8 +24,8 @@ /** * Webページのレイアウト情報を制御するヘルパークラス. * - * @package Helper * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Helper_PageLayout @@ -36,11 +36,11 @@ class SC_Helper_PageLayout * 現在の 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 */ public function sfGetPageLayout(&$objPage, $preview = false, $url = '', $device_type_id = DEVICE_TYPE_PC) @@ -55,17 +55,17 @@ public function sfGetPageLayout(&$objPage, $preview = false, $url = '', $device_ } if (empty($arrPageData)) { - trigger_error('ページ情報を取得できませんでした。', E_USER_WARNING); + trigger_error('ページ情報を取得できませんでした。', \E_USER_WARNING); } $objPage->tpl_mainpage = static::getTemplatePath($device_type_id) . $arrPageData[0]['filename'] . '.tpl'; if (!file_exists($objPage->tpl_mainpage)) { $msg = 'メイン部のテンプレートが存在しません。[' . $objPage->tpl_mainpage . ']'; - trigger_error($msg, E_USER_WARNING); + trigger_error($msg, \E_USER_WARNING); } - $objPage->arrPageLayout =& $arrPageData[0]; + $objPage->arrPageLayout = &$arrPageData[0]; if (strlen($objPage->arrPageLayout['author']) === 0) { $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); $objPage->arrPageLayout['author'] = $arrInfo['company_name']; @@ -96,7 +96,7 @@ public function sfGetPageLayout(&$objPage, $preview = false, $url = '', $device_ $error = "ブロックが見つかりません\n" . 'tpl_path: ' . $arrBloc['tpl_path'] . "\n" . 'php_path: ' . $arrBloc['php_path']; - trigger_error($error, E_USER_WARNING); + trigger_error($error, \E_USER_WARNING); } } } @@ -111,11 +111,11 @@ public function sfGetPageLayout(&$objPage, $preview = false, $url = '', $device_ * $device_type_id は必須. デフォルト値は DEVICE_TYPE_PC. * $page_id が null の場合は, $page_id が 0 以外のものを検索する. * - * @access public * @param integer $device_type_id 端末種別ID * @param integer $page_id ページID; null の場合は, 0 以外を検索する. * @param string $where 追加の検索条件 * @param string[] $arrParams 追加の検索パラメーター + * * @return array ページ属性の配列 */ public function getPageProperties($device_type_id = DEVICE_TYPE_PC, $page_id = null, $where = '', $arrParams = array()) @@ -137,11 +137,11 @@ public function getPageProperties($device_type_id = DEVICE_TYPE_PC, $page_id = n /** * ブロック情報を取得する. * - * @access public * @param integer $device_type_id 端末種別ID * @param string $where 追加の検索条件 * @param array $arrParams 追加の検索パラメーター * @param boolean $has_realpath php_path, tpl_path の絶対パスを含める場合 true + * * @return array ブロック情報の配列 */ public function getBlocs($device_type_id = DEVICE_TYPE_PC, $where = '', $arrParams = array(), $has_realpath = true) @@ -158,10 +158,10 @@ public function getBlocs($device_type_id = DEVICE_TYPE_PC, $where = '', $arrPara /** * ブロック配置情報を取得する. * - * @access public * @param integer $device_type_id 端末種別ID * @param integer $page_id ページID * @param boolean $has_realpath php_path, tpl_path の絶対パスを含める場合 true + * * @return array 配置情報を含めたブロックの配列 */ public function getBlocPositions($device_type_id, $page_id, $has_realpath = true) @@ -181,7 +181,7 @@ public function getBlocPositions($device_type_id, $page_id, $has_realpath = true $this->setBlocPathTo($device_type_id, $arrBlocs); } - //全ページ設定と各ページのブロックの重複を削除 + // 全ページ設定と各ページのブロックの重複を削除 $arrUniqBlocIds = array(); foreach ($arrBlocs as $index => $arrBloc) { if ($arrBloc['anywhere'] == 1) { @@ -202,9 +202,9 @@ public function getBlocPositions($device_type_id, $page_id, $has_realpath = true * * XXX ファイルを確実に削除したかどうかのチェック * - * @access public * @param integer $page_id ページID * @param integer $device_type_id 端末種別ID + * * @return integer 削除数 */ public function lfDelPageData($page_id, $device_type_id = DEVICE_TYPE_PC) @@ -227,9 +227,9 @@ public function lfDelPageData($page_id, $device_type_id = DEVICE_TYPE_PC) * * dtb_pagelayout の削除後に呼び出すこと。 * - * @access private * @param string $filename * @param integer $device_type_id 端末種別ID + * * @return void // TODO boolean にするべき? */ public function lfDelFile($filename, $device_type_id) @@ -260,9 +260,9 @@ public function lfDelFile($filename, $device_type_id) /** * 編集可能ページかどうか. * - * @access public * @param integer $device_type_id 端末種別ID * @param integer $page_id ページID + * * @return boolean �合 true */ public function isEditablePage($device_type_id, $page_id) @@ -281,9 +281,9 @@ public function isEditablePage($device_type_id, $page_id) /** * テンプレートのパスを取得する. * - * @access public * @param integer $device_type_id 端末種別ID * @param boolean $isUser USER_REALDIR 以下のパスを返す場合 true + * * @return string テンプレートのパス */ public static function getTemplatePath($device_type_id = DEVICE_TYPE_PC, $isUser = false) @@ -320,25 +320,25 @@ public static function getTemplatePath($device_type_id = DEVICE_TYPE_PC, $isUser * 引数 $hasPackage を true にした場合は, user_data/packages/template_name * を取得する. * - * @access public * @param integer $device_type_id 端末種別ID * @param boolean $hasPackage パッケージのパスも含める場合 true + * * @return string 端末に応じた DocumentRoot から user_data までのパス */ public static function getUserDir($device_type_id = DEVICE_TYPE_PC, $hasPackage = false) { switch ($device_type_id) { - case DEVICE_TYPE_MOBILE: - $templateName = MOBILE_TEMPLATE_NAME; - break; + case DEVICE_TYPE_MOBILE: + $templateName = MOBILE_TEMPLATE_NAME; + break; - case DEVICE_TYPE_SMARTPHONE: - $templateName = SMARTPHONE_TEMPLATE_NAME; - break; + case DEVICE_TYPE_SMARTPHONE: + $templateName = SMARTPHONE_TEMPLATE_NAME; + break; - case DEVICE_TYPE_PC: - default: - $templateName = TEMPLATE_NAME; + case DEVICE_TYPE_PC: + default: + $templateName = TEMPLATE_NAME; } $userDir = ROOT_URLPATH . USER_DIR; if ($hasPackage) { @@ -351,15 +351,15 @@ public static function getUserDir($device_type_id = DEVICE_TYPE_PC, $hasPackage /** * ブロックの php_path, tpl_path を設定する. * - * @access private * @param integer $device_type_id 端末種別ID * @param array $arrBlocs 設定するブロックの配列 + * * @return void */ public function setBlocPathTo($device_type_id = DEVICE_TYPE_PC, &$arrBlocs = array()) { foreach ($arrBlocs as $key => $value) { - $arrBloc =& $arrBlocs[$key]; + $arrBloc = &$arrBlocs[$key]; $arrBloc['php_path'] = SC_Utils_Ex::isBlank($arrBloc['php_path']) ? '' : HTML_REALDIR . $arrBloc['php_path']; $bloc_dir = $this->getTemplatePath($device_type_id) . BLOC_DIR; $arrBloc['tpl_path'] = SC_Utils_Ex::isBlank($arrBloc['tpl_path']) ? '' : $bloc_dir . $arrBloc['tpl_path']; @@ -369,8 +369,8 @@ public function setBlocPathTo($device_type_id = DEVICE_TYPE_PC, &$arrBlocs = arr /** * カラム数を取得する. * - * @access private * @param array $arrPageLayout レイアウト情報の配列 + * * @return integer $col_num カラム数 */ public function getColumnNum($arrPageLayout) @@ -378,9 +378,14 @@ public function getColumnNum($arrPageLayout) // メインは確定 $col_num = 1; // LEFT NAVI - if (!empty($arrPageLayout['LeftNavi'])) $col_num++; + if (!empty($arrPageLayout['LeftNavi'])) { + $col_num++; + } // RIGHT NAVI - if (!empty($arrPageLayout['RightNavi'])) $col_num++; + if (!empty($arrPageLayout['RightNavi'])) { + $col_num++; + } + return $col_num; } } diff --git a/data/class/helper/SC_Helper_Payment.php b/data/class/helper/SC_Helper_Payment.php index 6f2e638e6c..84e6beee58 100644 --- a/data/class/helper/SC_Helper_Payment.php +++ b/data/class/helper/SC_Helper_Payment.php @@ -24,8 +24,8 @@ /** * 支払方法を管理するヘルパークラス. * - * @package Helper * @author pineray + * * @version $Id$ */ class SC_Helper_Payment @@ -35,6 +35,7 @@ class SC_Helper_Payment * * @param integer $payment_id 支払方法ID * @param boolean $has_deleted 削除された支払方法も含む場合 true; 初期値 false + * * @return array */ public function get($payment_id, $has_deleted = false) @@ -53,6 +54,7 @@ public function get($payment_id, $has_deleted = false) * 支払方法一覧の取得. * * @param boolean $has_deleted 削除された支払方法も含む場合 true; 初期値 false + * * @return array */ public function getList($has_deleted = false) @@ -74,6 +76,7 @@ public function getList($has_deleted = false) * 購入金額に応じた支払方法を取得する. * * @param integer $total 購入金額 + * * @return array 購入金額に応じた支払方法の配列 */ public function getByPrice($total) @@ -110,6 +113,7 @@ public function getByPrice($total) * 支払方法の登録. * * @param array $sqlval + * * @return void */ public function save($sqlval) @@ -138,6 +142,7 @@ public function save($sqlval) * 支払方法の削除. * * @param integer $payment_id 支払方法ID + * * @return void */ public function delete($payment_id) @@ -151,6 +156,7 @@ public function delete($payment_id) * 支払方法の表示順をひとつ上げる. * * @param integer $payment_id 支払方法ID + * * @return void */ public function rankUp($payment_id) @@ -163,6 +169,7 @@ public function rankUp($payment_id) * 支払方法の表示順をひとつ下げる. * * @param integer $payment_id 支払方法ID + * * @return void */ public function rankDown($payment_id) @@ -177,6 +184,7 @@ public function rankDown($payment_id) * dtb_payment.memo03 に値が入っている場合は決済モジュールと見なす. * * @param integer $payment_id 支払い方法ID + * * @return boolean 決済モジュールを使用する支払い方法の場合 true */ public static function useModule($payment_id) @@ -191,6 +199,7 @@ public static function useModule($payment_id) * 支払方法IDをキー, 名前を値とする配列を取得. * * @param string $type 値のタイプ + * * @return array */ public static function getIDValueList($type = 'payment_method') diff --git a/data/class/helper/SC_Helper_Plugin.php b/data/class/helper/SC_Helper_Plugin.php index 6ff3e27d7d..e3da953b2d 100644 --- a/data/class/helper/SC_Helper_Plugin.php +++ b/data/class/helper/SC_Helper_Plugin.php @@ -24,7 +24,6 @@ /** * プラグインのヘルパークラス. * - * @package Helper * @version $Id$ */ class SC_Helper_Plugin @@ -43,13 +42,20 @@ class SC_Helper_Plugin * プラグインエンジン自身のインストール処理を起動する * * @param bool $plugin_activate_flg プラグインを有効化する場合 true + * * @return void */ public function load($plugin_activate_flg = true, $plugin_upload_realdir = PLUGIN_UPLOAD_REALDIR) { - if (!defined('CONFIG_REALFILE') || !file_exists(CONFIG_REALFILE)) return; // インストール前 - if (GC_Utils_Ex::isInstallFunction()) return; // インストール中 - if ($plugin_activate_flg === false) return; + if (!defined('CONFIG_REALFILE') || !file_exists(CONFIG_REALFILE)) { + return; + } // インストール前 + if (GC_Utils_Ex::isInstallFunction()) { + return; + } // インストール中 + if ($plugin_activate_flg === false) { + return; + } // 有効なプラグインを取得 $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin(); // pluginディレクトリを取得 @@ -63,9 +69,9 @@ public function load($plugin_activate_flg = true, $plugin_upload_realdir = PLUGI // エラー出力 $msg = 'プラグイン本体ファイルが存在しない。当該プラグインを無視して続行する。'; $msg .= 'ファイル=' . var_export($plugin_file_path, true) . '; '; - trigger_error($msg, E_USER_WARNING); + trigger_error($msg, \E_USER_WARNING); // 次のプラグインへ続行 - continue 1; + continue; } // プラグイン本体ファイルをrequire. require_once $plugin_file_path; @@ -88,6 +94,7 @@ public function load($plugin_activate_flg = true, $plugin_upload_realdir = PLUGI * SC_Helper_Plugin オブジェクトを返す(Singletonパターン) * * @param bool $plugin_activate_flg プラグインを有効化する場合 true + * * @return SC_Helper_Plugin SC_Helper_Pluginオブジェクト */ public static function getSingletonInstance($plugin_activate_flg = PLUGIN_ACTIVATE_FLAG, $plugin_upload_realdir = PLUGIN_UPLOAD_REALDIR) @@ -112,6 +119,7 @@ public static function getSingletonInstance($plugin_activate_flg = PLUGIN_ACTIVA * * @param string $hook_point フックポイント * @param array $arrArgs コールバック関数へ渡す引数 + * * @return void */ public function doAction($hook_point, $arrArgs = array()) @@ -162,7 +170,7 @@ public function doAction($hook_point, $arrArgs = array()) /** * スーパーフックポイントを登録します. * - * @param Object $objPlugin プラグインのインスタンス + * @param object $objPlugin プラグインのインスタンス * @param string $hook_point スーパーフックポイント * @param string $function_name 実行する関数名 * @param string $priority 実行順 @@ -179,7 +187,7 @@ public function registerSuperHookPoint($objPlugin, $hook_point, $function_name, /** * ローカルフックポイントを登録します. * - * @param Object $objPlugin プラグインのインスタンス + * @param object $objPlugin プラグインのインスタンス * @param string $priority 実行順 */ public function registerLocalHookPoint($objPlugin, $priority) @@ -187,7 +195,7 @@ public function registerLocalHookPoint($objPlugin, $priority) // ローカルプラグイン関数を定義しているかを検証. if (method_exists($objPlugin, 'register') === true) { // アクションの登録(プラグイン側に記述) - $objPluginHelper =& SC_Helper_Plugin::getSingletonInstance(); + $objPluginHelper = &self::getSingletonInstance(); $objPlugin->register($objPluginHelper, $priority); } } @@ -198,6 +206,7 @@ public function registerLocalHookPoint($objPlugin, $priority) * @param string $hook_point フックポイント名 * @param callback $function コールバック関数名 * @param integer $priority 同一フックポイント内での実行優先度 + * * @return boolean 成功すればtrue */ public function addAction($hook_point, $function, $priority = 0) @@ -217,6 +226,7 @@ public function addAction($hook_point, $function, $priority = 0) * @param string $hook_point フックポイント名 * @param callback $function コールバック関数名 * @param integer $priority 同一フックポイント内での実行優先度 + * * @return string コールバック関数を一意に識別するID */ public function makeActionUniqueId($hook_point, $function, $priority) @@ -237,9 +247,10 @@ public function makeActionUniqueId($hook_point, $function, $priority) if (function_exists('spl_object_hash')) { return spl_object_hash($function[0]) . $function[1]; } else { - $obj_idx = get_class($function[0]).$function[1]; - if ( false === $priority) + $obj_idx = get_class($function[0]) . $function[1]; + if (false === $priority) { return false; + } $obj_idx .= isset($this->arrRegistedPluginActions[$hook_point][$priority]) ? count((array) $this->arrRegistedPluginActions[$hook_point][$priority]) : $filter_id_count; @@ -249,7 +260,7 @@ public function makeActionUniqueId($hook_point, $function, $priority) return $obj_idx; } } elseif (is_string($function[0])) { - return $function[0].$function[1]; + return $function[0] . $function[1]; } } @@ -257,6 +268,7 @@ public function makeActionUniqueId($hook_point, $function, $priority) * ブロックの配列から有効でないpluginのブロックを除外して返します. * * @param array $arrBlocs プラグインのインストールディレクトリ + * * @return array $arrBlocsサイトルートからメディアディレクトリへの相対パス */ public function getEnableBlocs($arrBlocs) @@ -267,7 +279,7 @@ public function getEnableBlocs($arrBlocs) // 通常ブロック以外. if ($value['plugin_id'] != '') { // ブロック配列から削除する - unset ($arrBlocs[$key]); + unset($arrBlocs[$key]); } } } @@ -275,10 +287,11 @@ public function getEnableBlocs($arrBlocs) return $arrBlocs; } - /** + /** * テンプレートのヘッダに追加するPHPのURLをセットする * * @param string $url PHPファイルのURL + * * @return void */ public function setHeadNavi($url) @@ -290,14 +303,15 @@ public function setHeadNavi($url) * PHPのURLをテンプレートのヘッダに追加する * * @param array|null $arrBlocs 配置情報を含めたブロックの配列 + * * @return void */ public function setHeadNaviBlocs(&$arrBlocs) { foreach ($this->arrHeadNaviBlocsByPlugin as $key => $value) { $arrBlocs[] = array( - 'target_id' =>$value, - 'php_path' => $key + 'target_id' => $value, + 'php_path' => $key, ); } } @@ -308,6 +322,7 @@ public function setHeadNaviBlocs(&$arrBlocs) * @param string $hook_point hook point * @param SC_SiteView[] $arrArgs argument passing to callback function * @param boolean $plugin_activate_flg + * * @return void */ public static function hook($hook_point, $arrArgs = array(), $plugin_activate_flg = PLUGIN_ACTIVATE_FLAG) @@ -317,13 +332,14 @@ public static function hook($hook_point, $arrArgs = array(), $plugin_activate_fl return; } - $objPlugin = SC_Helper_Plugin::getSingletonInstance($plugin_activate_flg); + $objPlugin = self::getSingletonInstance($plugin_activate_flg); // 以前、エラー処理中に (オブジェクトではない) false に対し、doAction をコールする不具合があった。(#1971, #2551) // 現在、そういった状況は回避している認識だが、念のため同様の状況が発生した場合、ログを残し、実行しない。 if (!is_object($objPlugin)) { // XXX 致命的エラーの処理中だと、この方法ではログが残らない模様。実質的に問題無いと考えている。 - trigger_error('プラグインの処理で意図しない状況が発生しました。', E_USER_WARNING); + trigger_error('プラグインの処理で意図しない状況が発生しました。', \E_USER_WARNING); + return; } diff --git a/data/class/helper/SC_Helper_Purchase.php b/data/class/helper/SC_Helper_Purchase.php index 3f58a5221b..6f0bbc419e 100644 --- a/data/class/helper/SC_Helper_Purchase.php +++ b/data/class/helper/SC_Helper_Purchase.php @@ -27,13 +27,12 @@ * TODO 購入時強制会員登録機能(#521)の実装を検討 * TODO dtb_customer.buy_times, dtb_customer.buy_total の更新 * - * @package Helper * @author Kentaro Ohkouchi + * * @version $Id$ */ class SC_Helper_Purchase { - public $arrShippingKey = array( 'name01', 'name02', 'kana01', 'kana02', 'company_name', 'sex', 'zip01', 'zip02', 'country_id', 'zipcode', 'pref', 'addr01', 'addr02', @@ -58,6 +57,7 @@ class SC_Helper_Purchase * 決済完了後「新規受付」に変更すること * * @param integer $orderStatus 受注処理を完了する際に設定する対応状況 + * * @return void */ public function completeOrder($orderStatus = ORDER_NEW) @@ -84,7 +84,7 @@ public function completeOrder($orderStatus = ORDER_NEW) $orderTemp['status'] = $orderStatus; $cartkey = $objCartSession->getKey(); $order_id = $this->registerOrderComplete($orderTemp, $objCartSession, $cartkey); - $isMultiple = SC_Helper_Purchase::isMultiple(); + $isMultiple = self::isMultiple(); $shippingTemp = &$this->getShippingTemp($isMultiple); foreach ($shippingTemp as $shippingId => $val) { $this->registerShipmentItem($order_id, $shippingId, $val['shipment_item']); @@ -93,7 +93,7 @@ public function completeOrder($orderStatus = ORDER_NEW) $this->registerShipping($order_id, $shippingTemp); $objQuery->commit(); - //会員情報の最終購入日、購入合計を更新 + // 会員情報の最終購入日、購入合計を更新 if ($customerId > 0) { SC_Customer_Ex::updateOrderSummary($customerId); } @@ -117,6 +117,7 @@ public function completeOrder($orderStatus = ORDER_NEW) * @param integer $order_id 受注ID * @param integer $orderStatus 対応状況 * @param boolean $is_delete 受注データを論理削除する場合 true + * * @return void */ public static function cancelOrder($order_id, $orderStatus = ORDER_CANCEL, $is_delete = false) @@ -165,6 +166,7 @@ public static function cancelOrder($order_id, $orderStatus = ORDER_CANCEL, $is_d * @param integer $order_id 受注ID * @param integer $orderStatus 対応状況 * @param boolean $is_delete 受注データを論理削除する場合 true + * * @return string 受注一時ID */ public static function rollbackOrder($order_id, $orderStatus = ORDER_CANCEL, $is_delete = false) @@ -214,6 +216,7 @@ public static function rollbackOrder($order_id, $orderStatus = ORDER_CANCEL, $is * * @param string $uniqId ユニークID * @param SC_CartSession $objCartSession + * * @return void */ public static function verifyChangeCart($uniqId, &$objCartSession) @@ -250,6 +253,7 @@ public static function verifyChangeCart($uniqId, &$objCartSession) * 受注一時情報を取得する. * * @param integer $uniqId 受注一時情報ID + * * @return array 受注一時情報の配列 */ public static function getOrderTemp($uniqId) @@ -263,6 +267,7 @@ public static function getOrderTemp($uniqId) * 受注IDをキーにして受注一時情報を取得する. * * @param integer $order_id 受注ID + * * @return array 受注一時情報の配列 */ public static function getOrderTempByOrderId($order_id) @@ -280,9 +285,10 @@ public static function getOrderTempByOrderId($order_id) * @param integer $uniqId 受注一時情報ID * @param array $params 登録する受注情報の配列 * @param SC_Customer $objCustomer SC_Customer インスタンス + * * @return void */ - public static function saveOrderTemp($uniqId, $params, &$objCustomer = NULL) + public static function saveOrderTemp($uniqId, $params, &$objCustomer = null) { if (SC_Utils_Ex::isBlank($uniqId)) { return; @@ -305,8 +311,8 @@ public static function saveOrderTemp($uniqId, $params, &$objCustomer = NULL) } $exists = SC_Helper_Purchase_Ex::getOrderTemp($uniqId); - //国ID追加 - $sqlval['order_country_id'] = ($sqlval['order_country_id']) ? $sqlval['order_country_id'] : DEFAULT_COUNTRY_ID; + // 国ID追加 + $sqlval['order_country_id'] = ($sqlval['order_country_id']) ? $sqlval['order_country_id'] : DEFAULT_COUNTRY_ID; if (SC_Utils_Ex::isBlank($exists)) { $sqlval['order_temp_id'] = $uniqId; @@ -325,11 +331,15 @@ public static function saveOrderTemp($uniqId, $params, &$objCustomer = NULL) public static function getShippingTemp($has_shipment_item = false) { // ダウンロード商品の場合setされていないので空の配列を返す. - if (!isset($_SESSION['shipping'])) return array(); + if (!isset($_SESSION['shipping'])) { + return array(); + } if ($has_shipment_item) { $arrReturn = array(); foreach ($_SESSION['shipping'] as $key => $arrVal) { - if (is_array($arrVal['shipment_item']) && count($arrVal['shipment_item']) == 0) continue; + if (is_array($arrVal['shipment_item']) && count($arrVal['shipment_item']) == 0) { + continue; + } $arrReturn[$key] = $arrVal; } @@ -343,6 +353,7 @@ public static function getShippingTemp($has_shipment_item = false) * 配送商品をクリア(消去)する * * @param integer $shipping_id 配送先ID + * * @return void */ public function clearShipmentItemTemp($shipping_id = null) @@ -352,8 +363,12 @@ public function clearShipmentItemTemp($shipping_id = null) $this->clearShipmentItemTemp($key); } } else { - if (!isset($_SESSION['shipping'][$shipping_id])) return; - if (!is_array($_SESSION['shipping'][$shipping_id])) return; + if (!isset($_SESSION['shipping'][$shipping_id])) { + return; + } + if (!is_array($_SESSION['shipping'][$shipping_id])) { + return; + } unset($_SESSION['shipping'][$shipping_id]['shipment_item']); } } @@ -364,6 +379,7 @@ public function clearShipmentItemTemp($shipping_id = null) * @param integer $shipping_id 配送先ID * @param integer $product_class_id 商品規格ID * @param integer $quantity 数量 + * * @return void */ public function setShipmentItemTemp($shipping_id, $product_class_id, $quantity) @@ -400,6 +416,7 @@ public function setShipmentItemTemp($shipping_id, $product_class_id, $quantity) /** * 配送先都道府県の配列を返す. + * * @param boolean $is_multiple */ public static function getShippingPref($is_multiple) @@ -426,8 +443,10 @@ public function isMultiple() * 配送情報をセッションに保存する. * * XXX マージする理由が不明(なんとなく便利な気はするけど)。分かる方コメントに残してください。 + * * @param array $arrSrc 配送情報の連想配列 * @param integer $shipping_id 配送先ID + * * @return void */ public static function saveShippingTemp($arrSrc, $shipping_id = 0) @@ -446,6 +465,7 @@ public static function saveShippingTemp($arrSrc, $shipping_id = 0) * セッションの配送情報を破棄する. * * @deprecated 2.12.0 から EC-CUBE 本体では使用していない。 + * * @return void */ public static function unsetShippingTemp() @@ -457,6 +477,7 @@ public static function unsetShippingTemp() * セッションの配送情報を全て破棄する * * @param bool $multiple_temp 複数お届け先の画面戻り処理用の情報も破棄するか + * * @return void */ public static function unsetAllShippingTemp($multiple_temp = false) @@ -471,6 +492,7 @@ public static function unsetAllShippingTemp($multiple_temp = false) * セッションの配送情報を個別に破棄する * * @param integer $shipping_id 配送先ID + * * @return void */ public static function unsetOneShippingTemp($shipping_id) @@ -489,6 +511,7 @@ public static function unsetOneShippingTemp($shipping_id) * @param SC_Customer $objCustomer SC_Customer インスタンス * @param string $prefix コピー先の接頭辞. デフォルト order * @param array $keys コピー対象のキー + * * @return void */ public static function copyFromCustomer( @@ -537,6 +560,7 @@ public static function copyFromCustomer( * @param array $arrKey コピー対象のキー * @param string $prefix コピー先の接頭辞. デフォルト shipping * @param string $src_prefix コピー元の接頭辞. デフォルト order + * * @return void */ public function copyFromOrder(&$dest, $src, $prefix = 'shipping', $src_prefix = 'order', $arrKey = null) @@ -561,6 +585,7 @@ public function copyFromOrder(&$dest, $src, $prefix = 'shipping', $src_prefix = * 配送情報のみ抜き出す。 * * @param string $arrSrc 元となる配列 + * * @return void */ public function extractShipping($arrSrc) @@ -575,6 +600,7 @@ public function extractShipping($arrSrc) /** * お届け日一覧を取得する. + * * @param SC_CartSession $objCartSess * @param integer $product_type_id */ @@ -586,50 +612,50 @@ public function getDelivDate(&$objCartSess, $product_type_id) $delivDateIds[] = $item['productsClass']['deliv_date_id']; } $max_date = max($delivDateIds); - //発送目安 + // 発送目安 switch ($max_date) { - //即日発送 + // 即日発送 case '1': $start_day = 1; break; - //1-2日後 + // 1-2日後 case '2': $start_day = 3; break; - //3-4日後 + // 3-4日後 case '3': $start_day = 5; break; - //1週間以降 + // 1週間以降 case '4': $start_day = 8; break; - //2週間以降 + // 2週間以降 case '5': $start_day = 15; break; - //3週間以降 + // 3週間以降 case '6': $start_day = 22; break; - //1ヶ月以降 + // 1ヶ月以降 case '7': $start_day = 32; break; - //2ヶ月以降 + // 2ヶ月以降 case '8': $start_day = 62; break; - //お取り寄せ(商品入荷後) + // お取り寄せ(商品入荷後) case '9': $start_day = ''; break; default: - //お届け日が設定されていない場合 + // お届け日が設定されていない場合 $start_day = ''; break; } - //お届け可能日のスタート値から、お届け日の配列を取得する + // お届け可能日のスタート値から、お届け日の配列を取得する $arrDelivDate = $this->getDateArray($start_day, DELIV_DATE_END_MAX); return $arrDelivDate; @@ -643,7 +669,7 @@ public function getDateArray($start_day, $end_day) $masterData = new SC_DB_MasterData_Ex(); $arrWDAY = $masterData->getMasterData('mtb_wday'); $arrDate = array(); - //お届け可能日のスタート値がセットされていれば + // お届け可能日のスタート値がセットされていれば if ($start_day >= 1) { $now_time = time(); $max_day = $start_day + $end_day; @@ -672,6 +698,7 @@ public function getDateArray($start_day, $end_day) * @param integer $order_id 受注ID * @param array $arrParams 配送情報の連想配列 * @param boolean $convert_shipping_date yyyy/mm/dd(EEE) 形式の配送日付を変換する場合 true + * * @return void */ public static function registerShipping($order_id, $arrParams, $convert_shipping_date = true) @@ -705,7 +732,7 @@ public static function registerShipping($order_id, $arrParams, $convert_shipping $arrValues['order_id'] = $order_id; $arrValues['create_date'] = 'CURRENT_TIMESTAMP'; $arrValues['update_date'] = 'CURRENT_TIMESTAMP'; - //国ID追加 + // 国ID追加 /*いらないかもしれないんでとりあえずコメントアウト $arrValues['shipping_country_id'] = DEFAULT_COUNTRY_ID; */ @@ -726,7 +753,6 @@ public static function registerShipping($order_id, $arrParams, $convert_shipping array($order_id), array('shipping_time' => "($sql_sub)") ); - } /** @@ -735,6 +761,7 @@ public static function registerShipping($order_id, $arrParams, $convert_shipping * @param integer $order_id 受注ID * @param integer $shipping_id 配送先ID * @param array $arrParams 配送商品の配列 + * * @return void */ public static function registerShipmentItem($order_id, $shipping_id, $arrParams) @@ -792,6 +819,7 @@ public static function registerShipmentItem($order_id, $shipping_id, $arrParams) * @param array $orderParams 登録する受注情報の配列 * @param SC_CartSession $objCartSession カート情報のインスタンス * @param integer $cartKey 登録を行うカート情報のキー + * * @return integer 受注ID */ public function registerOrderComplete($orderParams, &$objCartSession, $cartKey) @@ -801,7 +829,7 @@ public function registerOrderComplete($orderParams, &$objCartSession, $cartKey) // 不要な変数を unset $unsets = array( 'mailmaga_flg', 'deliv_check', 'point_check', 'password', - 'reminder', 'reminder_answer', 'mail_flag', 'session' + 'reminder', 'reminder_answer', 'mail_flag', 'session', ); foreach ($unsets as $unset) { unset($orderParams[$unset]); @@ -868,6 +896,7 @@ public function registerOrderComplete($orderParams, &$objCartSession, $cartKey) * * @param integer $order_id 受注ID * @param array $arrParams 受注情報の連想配列 + * * @return integer 受注ID */ public static function registerOrder($order_id, $arrParams) @@ -928,6 +957,7 @@ public static function registerOrder($order_id, $arrParams) * * @param integer $order_id 受注ID * @param array $arrParams 受注情報の連想配列 + * * @return void */ public static function registerOrderDetail($order_id, $arrParams) @@ -950,6 +980,7 @@ public static function registerOrderDetail($order_id, $arrParams) * * @param integer $order_id 受注ID * @param integer $customer_id 会員ID + * * @return array 受注情報の配列 */ public static function getOrder($order_id, $customer_id = null) @@ -970,12 +1001,13 @@ public static function getOrder($order_id, $customer_id = null) * * @param integer $order_id 受注ID * @param boolean $has_order_status 対応状況, 入金日も含める場合 true + * * @return array 受注詳細の配列 */ public static function getOrderDetail($order_id, $has_order_status = true) { $objQuery = SC_Query_Ex::getSingletonInstance(); - $dbFactory = SC_DB_DBFactory_Ex::getInstance(); + $dbFactory = SC_DB_DBFactory_Ex::getInstance(); $col = <<< __EOS__ T3.product_id, T3.product_class_id as product_class_id, @@ -1027,7 +1059,9 @@ public static function getOrderDetail($order_id, $has_order_status = true) * 2. 販売価格が 0 円である * * 受注詳細行には, is_downloadable という真偽値が設定される. + * * @param array 受注詳細の配列 + * * @return void */ public static function setDownloadableFlgTo(&$arrOrderDetail) @@ -1036,7 +1070,7 @@ public static function setDownloadableFlgTo(&$arrOrderDetail) // 販売価格が 0 円 if ($arrOrderDetail[$key]['price'] == '0') { $arrOrderDetail[$key]['is_downloadable'] = true; - // ダウンロード期限内かつ, 入金日あり + // ダウンロード期限内かつ, 入金日あり } elseif ( $arrOrderDetail[$key]['effective'] == '1' && !SC_Utils_Ex::isBlank($arrOrderDetail[$key]['payment_date']) @@ -1053,6 +1087,7 @@ public static function setDownloadableFlgTo(&$arrOrderDetail) * * @param integer $order_id 受注ID * @param boolean $has_items 結果に配送商品も含める場合 true + * * @return array 配送情報の配列 */ public function getShippings($order_id, $has_items = true) @@ -1089,6 +1124,7 @@ public function getShippings($order_id, $has_items = true) * @param integer $order_id 受注ID * @param integer $shipping_id 配送先ID * @param boolean $has_detail 商品詳細も取得する場合 true + * * @return array 商品規格IDをキーにした配送商品の配列 */ public static function getShipmentItems($order_id, $shipping_id, $has_detail = true) @@ -1130,9 +1166,10 @@ public static function getShipmentItems($order_id, $shipping_id, $has_detail = t * * @param integer $order_id 受注ID * @param object $objPage LC_Page インスタンス + * * @return boolean 送信に成功したか。現状では、正確には取得できない。 */ - public static function sendOrderMail($order_id, &$objPage = NULL) + public static function sendOrderMail($order_id, &$objPage = null) { $objMail = new SC_Helper_Mail_Ex(); @@ -1161,6 +1198,7 @@ public static function sendOrderMail($order_id, &$objPage = NULL) * @param integer|null $newAddPoint 加算ポイント (null=変更無し) * @param integer|null $newUsePoint 使用ポイント (null=変更無し) * @param array $sqlval 更新後の値をリファレンスさせるためのパラメーター + * * @return void */ public static function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddPoint = null, $newUsePoint = null, &$sqlval = array()) @@ -1250,7 +1288,7 @@ public static function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddP // 対応状況が発送済みに変更の場合、発送日を更新 if ($arrOrderOld['status'] != ORDER_DELIV && $newStatus == ORDER_DELIV) { $sqlval['commit_date'] = 'CURRENT_TIMESTAMP'; - // 対応状況が入金済みに変更の場合、入金日を更新 + // 対応状況が入金済みに変更の場合、入金日を更新 } elseif ($arrOrderOld['status'] != ORDER_PRE_END && $newStatus == ORDER_PRE_END) { $sqlval['payment_date'] = 'CURRENT_TIMESTAMP'; } @@ -1262,8 +1300,8 @@ public static function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddP $objQuery->update('dtb_order', $dest, 'order_id = ?', array($orderId)); // ▲受注テーブルの更新 - //会員情報の最終購入日、購入合計を更新 - if ($arrOrderOld['customer_id'] > 0 and $arrOrderOld['status'] != $newStatus) { + // 会員情報の最終購入日、購入合計を更新 + if ($arrOrderOld['customer_id'] > 0 && $arrOrderOld['status'] != $newStatus) { SC_Customer_Ex::updateOrderSummary($arrOrderOld['customer_id']); } } @@ -1292,8 +1330,7 @@ public static function sfUpdateOrderNameCol($order_id, $temp_table = false) array(), $sql_where, array($order_id), - array('payment_method' => - '(SELECT payment_method FROM dtb_payment WHERE payment_id = ' . $tgt_table . '.payment_id)') + array('payment_method' => '(SELECT payment_method FROM dtb_payment WHERE payment_id = ' . $tgt_table . '.payment_id)') ); } @@ -1303,6 +1340,7 @@ public static function sfUpdateOrderNameCol($order_id, $temp_table = false) * $status が null の場合は false を返す. * * @param integer $status 対応状況 + * * @return boolean 使用するか(会員テーブルから減算するか) */ public static function isUsePoint($status) @@ -1312,7 +1350,6 @@ public static function isUsePoint($status) } switch ($status) { case ORDER_CANCEL: // キャンセル - return false; default: break; @@ -1325,6 +1362,7 @@ public static function isUsePoint($status) * ポイント加算するかの判定 * * @param integer $status 対応状況 + * * @return boolean 加算するか */ public static function isAddPoint($status) @@ -1335,11 +1373,9 @@ public static function isAddPoint($status) case ORDER_PRE_END: // 入金済み case ORDER_CANCEL: // キャンセル case ORDER_BACK_ORDER: // 取り寄せ中 - return false; case ORDER_DELIV: // 発送済み - return true; default: @@ -1382,6 +1418,7 @@ public static function cleanupSession($orderId, &$objCartSession, &$objCustomer, * * @param SC_CartSession $objCartSession カート情報のインスタンス * @param integer $shipping_id 配送先ID + * * @return void */ public function setShipmentItemTempForSole(&$objCartSession, $shipping_id = 0) @@ -1392,7 +1429,9 @@ public function setShipmentItemTempForSole(&$objCartSession, $shipping_id = 0) $arrCartList = &$objCartSession->getCartList($objCartSess->getKey()); foreach ($arrCartList as $arrCartRow) { - if ($arrCartRow['quantity'] == 0) continue; + if ($arrCartRow['quantity'] == 0) { + continue; + } $this->setShipmentItemTemp($shipping_id, $arrCartRow['id'], $arrCartRow['quantity']); } } @@ -1411,7 +1450,9 @@ public static function getNextOrderID() /** * 決済処理中スタータスの受注データのキャンセル処理 + * * @param bool $cancel_flg 決済処理中ステータスのロールバックをするか(true:する false:しない) + * * @return void */ public function cancelPendingOrder($cancel_flg) @@ -1490,14 +1531,18 @@ public function checkDbMyPendignOrder() public function checkSessionPendingOrder() { - if (!isset($_SESSION['order_id'])) return; - if (SC_Utils_Ex::isBlank($_SESSION['order_id'])) return; + if (!isset($_SESSION['order_id'])) { + return; + } + if (SC_Utils_Ex::isBlank($_SESSION['order_id'])) { + return; + } $order_id = $_SESSION['order_id']; unset($_SESSION['order_id']); $objQuery = SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); - $arrOrder = SC_Helper_Purchase_Ex::getOrder($order_id); + $arrOrder = SC_Helper_Purchase_Ex::getOrder($order_id); if ($arrOrder['status'] == ORDER_PENDING) { $objCartSess = new SC_CartSession_Ex(); $cartKeys = $objCartSess->getKeys(); diff --git a/data/class/helper/SC_Helper_Session.php b/data/class/helper/SC_Helper_Session.php index 7d1b5dccec..828cc4fa2f 100644 --- a/data/class/helper/SC_Helper_Session.php +++ b/data/class/helper/SC_Helper_Session.php @@ -8,8 +8,8 @@ /** * セッション関連のヘルパークラス. * - * @package Helper * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class SC_Helper_Session @@ -24,13 +24,13 @@ class SC_Helper_Session public function __construct() { $this->objDb = new SC_Helper_DB_Ex(); - if (session_status() !== PHP_SESSION_ACTIVE) { + if (session_status() !== \PHP_SESSION_ACTIVE) { session_set_save_handler(array(&$this, 'sfSessOpen'), - array(&$this, 'sfSessClose'), - array(&$this, 'sfSessRead'), - array(&$this, 'sfSessWrite'), - array(&$this, 'sfSessDestroy'), - array(&$this, 'sfSessGc')); + array(&$this, 'sfSessClose'), + array(&$this, 'sfSessRead'), + array(&$this, 'sfSessWrite'), + array(&$this, 'sfSessDestroy'), + array(&$this, 'sfSessGc')); } // 通常よりも早い段階(オブジェクトが破棄される前)でセッションデータを書き込んでセッションを終了する @@ -43,6 +43,7 @@ public function __construct() * * @param string $save_path セッションを保存するパス(使用しない) * @param string $session_name セッション名(使用しない) + * * @return bool セッションが正常に開始された場合 true */ public function sfSessOpen($save_path, $session_name) @@ -64,6 +65,7 @@ public function sfSessClose() * セッションのデータをDBから読み込む. * * @param string $id セッションID + * * @return string セッションデータの値 */ public function sfSessRead($id) @@ -89,6 +91,7 @@ public function sfSessRead($id) * * @param string $id セッションID * @param string $sess_data セッションデータの値 + * * @return bool セッションの書き込みに成功した場合 true */ public function sfSessWrite($id, $sess_data) @@ -121,6 +124,7 @@ public function sfSessWrite($id, $sess_data) * セッションを破棄する. * * @param string $id セッションID + * * @return bool セッションを正常に破棄した場合 true */ public function sfSessDestroy($id) @@ -142,8 +146,8 @@ public function sfSessGc($maxlifetime) { // MAX_LIFETIME以上更新されていないセッションを削除する。 $objQuery = SC_Query_Ex::getSingletonInstance(); - $limit = date("Y-m-d H:i:s",time() - MAX_LIFETIME); - $where = "update_date < '". $limit . "' "; + $limit = date("Y-m-d H:i:s", time() - MAX_LIFETIME); + $where = "update_date < '" . $limit . "' "; $objQuery->delete('dtb_session', $where); return true; @@ -164,7 +168,6 @@ public function sfSessGc($maxlifetime) * 遷移先のページで, LC_Page::isValidToken() の返り値をチェックすることにより, * 画面遷移の妥当性が確認できる. * - * @access protected * @return string トランザクショントークンの文字列 */ public static function getToken() @@ -179,7 +182,6 @@ public static function getToken() /** * トランザクショントークン用の予測困難な文字列を生成して返す. * - * @access private * @return string トランザクショントークン用の文字列 */ public static function createToken() @@ -200,9 +202,9 @@ public static function createToken() * セッションが破棄されるまで, トークンを保持する. * 引数 $is_unset が true の場合は, 妥当性検証後に破棄される. * - * @access protected * @param boolean $is_unset 妥当性検証後, トークンを unset する場合 true; * デフォルト値は false + * * @return boolean トランザクショントークンが有効な場合 true */ public static function isValidToken($is_unset = false) @@ -240,7 +242,7 @@ public static function destroyToken() */ public static function adminAuthorization() { - if (($script_path = realpath($_SERVER['SCRIPT_FILENAME'])) !== FALSE) { + if (($script_path = realpath($_SERVER['SCRIPT_FILENAME'])) !== false) { $arrScriptPath = explode('/', str_replace('\\', '/', $script_path)); $arrAdminPath = explode('/', str_replace('\\', '/', substr(HTML_REALDIR . ADMIN_DIR, 0, -1))); $arrDiff = array_diff_assoc($arrAdminPath, $arrScriptPath); diff --git a/data/class/helper/SC_Helper_TaxRule.php b/data/class/helper/SC_Helper_TaxRule.php index b0b5324097..b08adb091a 100644 --- a/data/class/helper/SC_Helper_TaxRule.php +++ b/data/class/helper/SC_Helper_TaxRule.php @@ -24,8 +24,8 @@ /** * 税規約を管理するヘルパークラス. * - * @package Helper * @author AMUAMU + * * @version $Id$ */ class SC_Helper_TaxRule @@ -38,9 +38,10 @@ class SC_Helper_TaxRule * @param int $product_class_id 商品規格ID * @param int $pref_id 都道府県ID * @param int $country_id 国ID + * * @return double 税金付与した金額 */ - public static function sfCalcIncTax($price, $product_id = 0, $product_class_id = 0, $pref_id =0, $country_id = 0) + public static function sfCalcIncTax($price, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) { return (int) $price + SC_Helper_TaxRule_Ex::sfTax($price, $product_id, $product_class_id, $pref_id, $country_id); } @@ -53,9 +54,10 @@ public static function sfCalcIncTax($price, $product_id = 0, $product_class_id = * @param int $product_class_id 商品規格ID * @param int $pref_id 都道府県ID * @param int $country_id 国ID + * * @return double 税金付与した金額 */ - public static function sfTax($price, $product_id = 0, $product_class_id = 0, $pref_id =0, $country_id = 0) + public static function sfTax($price, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) { $arrTaxRule = SC_Helper_TaxRule_Ex::getTaxRule($product_id, $product_class_id, $pref_id, $country_id); @@ -74,6 +76,7 @@ public static function sfTax($price, $product_id = 0, $product_class_id = 0, $pr * * @param array{8?:int, 10?:int} $arrTaxableTotal 税率ごとのお支払い合計金額 * @param int $discount_total 値引額合計 + * * @return array{8?:array{discount;int,total:int,tax:int}, 10?:array{discount;int,total:int,tax:int}} */ public static function getTaxPerTaxRate($arrTaxableTotal, $discount_total = 0) @@ -89,9 +92,9 @@ public static function getTaxPerTaxRate($arrTaxableTotal, $discount_total = 0) // 按分後の値引額の合計(8%対象商品の按分後の値引額 + 10%対象商品の按分後の値引額)が実際の値引額より+-1円となる事への対処 // ①按分した値引き額を四捨五入で丸める foreach ($arrTaxableTotal as $rate => $total) { - $discount[$rate] = $taxable_total !== 0 ? round(($discount_total * $total / $taxable_total), 0) : 0; + $discount[$rate] = $taxable_total !== 0 ? round($discount_total * $total / $taxable_total, 0) : 0; $divide[$rate] = [ - 'discount' => intval($discount[$rate]), + 'discount' => (int) $discount[$rate], ]; $cf_discount += $divide[$rate]['discount']; } @@ -108,16 +111,17 @@ public static function getTaxPerTaxRate($arrTaxableTotal, $discount_total = 0) if ($rate == $defaultTaxRule) { $discount[$rate] = $divide[$defaultTaxRule]['discount']; } else { - $discount[$rate] = $taxable_total !== 0 ? round(($discount_total * $total / $taxable_total), 0) : 0; + $discount[$rate] = $taxable_total !== 0 ? round($discount_total * $total / $taxable_total, 0) : 0; } $reduced_total = $total - $discount[$rate]; $tax = $reduced_total * ($rate / (100 + $rate)); $result[$rate] = [ - 'discount' => intval($discount[$rate]), - 'total' => intval($reduced_total), - 'tax' => intval(static::roundByCalcRule($tax, $defaultTaxRule)), + 'discount' => (int) $discount[$rate], + 'total' => (int) $reduced_total, + 'tax' => (int) (static::roundByCalcRule($tax, $defaultTaxRule)), ]; } + return $result; } @@ -128,6 +132,7 @@ public static function getTaxPerTaxRate($arrTaxableTotal, $discount_total = 0) * * @param array{8?:int, 10?:int} $arrTaxableTotal 税率ごとのお支払い合計金額 * @param int $discount_total 値引額合計 + * * @return string (<税率>%対象: <値引後税込合計>円 内消費税: <値引後税額>円) */ public static function getTaxDetail($arrTaxableTotal, $discount_total = 0) @@ -135,7 +140,7 @@ public static function getTaxDetail($arrTaxableTotal, $discount_total = 0) $arrTaxPerTaxRate = static::getTaxPerTaxRate($arrTaxableTotal, $discount_total); $result = ''; foreach ($arrTaxPerTaxRate as $rate => $item) { - $result .= '('.$rate .'%対象: '. number_format($item['total']).'円 内消費税: '.number_format($item['tax']).'円)'.PHP_EOL; + $result .= '(' . $rate . '%対象: ' . number_format($item['total']) . '円 内消費税: ' . number_format($item['tax']) . '円)' . \PHP_EOL; } return $result; @@ -147,6 +152,7 @@ public static function getTaxDetail($arrTaxableTotal, $discount_total = 0) * * @param int $price 計算対象の金額 * @param int $tax_rule_id 税規約ID + * * @return double 税金付与した金額 */ public static function calcIncTaxFromRuleId($price, $tax_rule_id = 0) @@ -160,6 +166,7 @@ public static function calcIncTaxFromRuleId($price, $tax_rule_id = 0) * * @param int $price 計算対象の金額 * @param int $tax_rule_id 税規約ID + * * @return double 税金付与した金額 */ public static function calcTaxFromRuleId($price, $tax_rule_id = 0) @@ -177,12 +184,13 @@ public static function calcTaxFromRuleId($price, $tax_rule_id = 0) * XXX int のみか不明 * @param int $calc_rule 端数処理 * @param int $tax_adjust 調整額 + * * @return double 税金額 */ public static function calcTax($price, $tax, $calc_rule, $tax_adjust = 0) { $real_tax = $tax / 100; - $ret = (int)$price * $real_tax; + $ret = (int) $price * $real_tax; $ret = self::roundByCalcRule($ret, $calc_rule); return $ret + $tax_adjust; @@ -196,6 +204,7 @@ public static function calcTax($price, $tax, $calc_rule, $tax_adjust = 0) * @param int $pref_id 都道府県ID * @param int $country_id 国ID * @param int $option_product_tax_rule 商品別税率を有効にする場合 1, 無効の場合 0 + * * @return array 税設定情報 * * @see https://github.com/EC-CUBE/ec-cube2/pull/301 @@ -237,7 +246,7 @@ public static function getTaxRule($product_id = 0, $product_class_id = 0, $pref_ $arrRequest = array('product_id' => $product_id, 'product_class_id' => $product_class_id, 'pref_id' => $pref_id, - 'country_id' => $country_id); + 'country_id' => $country_id, ); // 地域設定を優先するが、システムパラメーターなどに設定を持っていくか // 後に書いてあるほど優先される、詳細後述MEMO参照 @@ -313,9 +322,10 @@ public static function getTaxRule($product_id = 0, $product_class_id = 0, $pref_ * @param integer $tax_adjust 消費税加算額 * @param int $pref_id 県ID * @param int $country_id 国ID + * * @return void */ - public static function setTaxRuleForProduct($tax_rate, $product_id = 0, $product_class_id = 0, $tax_adjust=0, $pref_id = 0, $country_id = 0) + public static function setTaxRuleForProduct($tax_rate, $product_id = 0, $product_class_id = 0, $tax_adjust = 0, $pref_id = 0, $country_id = 0) { // 基本設定を取得 $arrRet = SC_Helper_TaxRule_Ex::getTaxRule(); @@ -327,7 +337,7 @@ public static function setTaxRuleForProduct($tax_rate, $product_id = 0, $product // 日付は登録時点を設定 $apply_date = 'CURRENT_TIMESTAMP'; // 税情報を設定 - SC_Helper_TaxRule_Ex::setTaxRule($calc_rule, $tax_rate, $apply_date, NULL, $tax_adjust, $product_id, $product_class_id, $pref_id, $country_id); + SC_Helper_TaxRule_Ex::setTaxRule($calc_rule, $tax_rate, $apply_date, null, $tax_adjust, $product_id, $product_class_id, $pref_id, $country_id); } else { // 商品別レコードが残っていれば削除 $objQuery = SC_Query_Ex::getSingletonInstance(); @@ -347,15 +357,16 @@ public static function setTaxRuleForProduct($tax_rate, $product_id = 0, $product * @param int $calc_rule 端数処理 * @param int $tax_rate 税率 * @param string $apply_date 適用日時 - * @param null|integer $tax_rule_id 税規約ID + * @param integer|null $tax_rule_id 税規約ID * @param int $tax_adjust 調整額 * @param int $product_id 商品ID * @param int $product_class_id 商品規格ID * @param int $pref_id 都道府県ID * @param int $country_id 国ID + * * @return void */ - public static function setTaxRule($calc_rule, $tax_rate, $apply_date, $tax_rule_id=NULL, $tax_adjust=0, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) + public static function setTaxRule($calc_rule, $tax_rate, $apply_date, $tax_rule_id = null, $tax_adjust = 0, $product_id = 0, $product_class_id = 0, $pref_id = 0, $country_id = 0) { $table = 'dtb_tax_rule'; $arrValues = array(); @@ -368,14 +379,14 @@ public static function setTaxRule($calc_rule, $tax_rate, $apply_date, $tax_rule_ // 新規か更新か? $objQuery = SC_Query_Ex::getSingletonInstance(); - if ($tax_rule_id == NULL && $product_id != 0) { + if ($tax_rule_id == null && $product_id != 0) { $where = 'del_flg = 0 AND product_id = ? AND product_class_id = ? AND pref_id = ? AND country_id = ?'; $arrVal = array($product_id, $product_class_id, $pref_id, $country_id); $arrCheck = $objQuery->getRow('*', 'dtb_tax_rule', $where, $arrVal); $tax_rule_id = $arrCheck['tax_rule_id']; } - if ($tax_rule_id == NULL) { + if ($tax_rule_id == null) { // 税情報を新規 // INSERTの実行 $arrValues['tax_rule_id'] = $objQuery->nextVal('dtb_tax_rule_tax_rule_id'); @@ -395,6 +406,7 @@ public static function setTaxRule($calc_rule, $tax_rate, $apply_date, $tax_rule_ /** * @param bool $has_deleted + * * @return array|null */ public function getTaxRuleList($has_deleted = false) @@ -416,6 +428,7 @@ public function getTaxRuleList($has_deleted = false) /** * @param int $tax_rule_id * @param bool $has_deleted + * * @return array */ public static function getTaxRuleData($tax_rule_id, $has_deleted = false) @@ -432,6 +445,7 @@ public static function getTaxRuleData($tax_rule_id, $has_deleted = false) /** * @param string $apply_date * @param bool $has_deleted + * * @return mixed */ public function getTaxRuleByTime($apply_date, $has_deleted = false) @@ -450,6 +464,7 @@ public function getTaxRuleByTime($apply_date, $has_deleted = false) * 税規約の削除. * * @param int $tax_rule_id 税規約ID + * * @return void */ public static function deleteTaxRuleData($tax_rule_id) @@ -457,7 +472,7 @@ public static function deleteTaxRuleData($tax_rule_id) $objQuery = SC_Query_Ex::getSingletonInstance(); $sqlval = array(); - $sqlval['del_flg'] = 1; + $sqlval['del_flg'] = 1; $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; $where = 'tax_rule_id = ?'; $objQuery->update('dtb_tax_rule', $sqlval, $where, array($tax_rule_id)); @@ -468,6 +483,7 @@ public static function deleteTaxRuleData($tax_rule_id) * * @param float|integer $value 端数処理を行う数値 * @param integer $calc_rule 課税規則 + * * @return double 端数処理後の数値 */ public static function roundByCalcRule($value, $calc_rule) @@ -477,15 +493,15 @@ public static function roundByCalcRule($value, $calc_rule) case 1: $ret = round($value); break; - // 切り捨て + // 切り捨て case 2: $ret = floor($value); break; - // 切り上げ + // 切り上げ case 3: $ret = ceil($value); break; - // デフォルト:切り上げ + // デフォルト:切り上げ default: $ret = ceil($value); break; diff --git a/data/class/helper/SC_Helper_Transform.php b/data/class/helper/SC_Helper_Transform.php index 92dbade067..9b5b61b717 100644 --- a/data/class/helper/SC_Helper_Transform.php +++ b/data/class/helper/SC_Helper_Transform.php @@ -24,7 +24,6 @@ /** * テンプレートをDOM変形するためのヘルパークラス * - * @package Helper * @version $Id$ */ class SC_Helper_Transform @@ -42,26 +41,27 @@ class SC_Helper_Transform protected $footer_source; protected $search_depth; - const ERR_TARGET_ELEMENT_NOT_FOUND = 1; + public const ERR_TARGET_ELEMENT_NOT_FOUND = 1; /** * SmartyのHTMLソースをDOMに変換しておく * * @param string $source 変形対象のテンプレート + * * @return void */ public function __construct($source) { $this->objDOM = new DOMDocument(); $this->objDOM->strictErrorChecking = false; - $this->snip_count = 0; + $this->snip_count = 0; $this->smarty_tags_idx = 0; - $this->arrErr = array(); - $this->arrElementTree = array(); + $this->arrErr = array(); + $this->arrElementTree = array(); $this->arrSelectElements = array(); $this->html_source = $source; - $this->header_source = NULL; - $this->footer_source = NULL; + $this->header_source = null; + $this->footer_source = null; $this->search_depth = 0; $encoding = mb_detect_encoding($source); @@ -114,9 +114,9 @@ public function __construct($source) $source = $arrMatches[2]; $this->footer_source = $arrMatches[3]; } elseif (preg_match('/^.*?]*>.+<\/body>.*$/is', $source)) { - $source = ''.$source.''; + $source = '' . $source . ''; } else { - $source = ''.$source.''; + $source = '' . $source . ''; } @$this->objDOM->loadHTML($source); @@ -130,9 +130,10 @@ public function __construct($source) * @param integer $index インデックス(指定がある場合) * @param boolean $require エレメントが見つからなかった場合、エラーとするか * @param string $err_msg エラーメッセージ + * * @return SC_Helper_Transform */ - public function select($selector, $index = NULL, $require = true, $err_msg = NULL) + public function select($selector, $index = null, $require = true, $err_msg = null) { $this->arrSelectElements = array(); $this->search_depth = 0; @@ -141,7 +142,7 @@ public function select($selector, $index = NULL, $require = true, $err_msg = NUL $cur_idx = 0; // ツリーを初めから全検索する - for ($iLoop=0; $iLoop < count($this->arrElementTree); $iLoop++) { + for ($iLoop = 0; $iLoop < count($this->arrElementTree); $iLoop++) { if (preg_match($regex, $this->arrElementTree[$iLoop][0])) { // インデックスが指定されていない(見つけたエレメント全て)、もしくは指定されたインデックスなら選択する if (is_null($index) || $cur_idx == $index) { @@ -170,9 +171,10 @@ public function select($selector, $index = NULL, $require = true, $err_msg = NUL * @param integer $index インデックス(指定がある場合) * @param boolean $require エレメントが見つからなかった場合、エラーとするか * @param string $err_msg エラーメッセージ + * * @return SC_Helper_Transform */ - public function find($selector, $index = NULL, $require = true, $err_msg = NULL) + public function find($selector, $index = null, $require = true, $err_msg = null) { $arrParentElements = $this->arrSelectElements[$this->search_depth]; $this->search_depth++; @@ -183,7 +185,7 @@ public function find($selector, $index = NULL, $require = true, $err_msg = NULL) $cur_idx = 0; // 親エレメント位置からツリーを検索する - for ($iLoop=$objElement[0]; $iLoop < count($this->arrElementTree); $iLoop++) { + for ($iLoop = $objElement[0]; $iLoop < count($this->arrElementTree); $iLoop++) { if (preg_match($regex, $this->arrElementTree[$iLoop][0])) { // インデックスが指定されていない(見つけたエレメント全て)、もしくは指定されたインデックスなら選択する if (is_null($index) || $cur_idx == $index) { @@ -210,6 +212,7 @@ public function find($selector, $index = NULL, $require = true, $err_msg = NULL) * 選択状態を指定数戻す * * @param int $back_num 選択状態を戻す数 + * * @return SC_Helper_Transform */ public function end($back_num = 1) @@ -227,6 +230,7 @@ public function end($back_num = 1) * 要素の前にHTMLを挿入 * * @param string $html_snip 挿入するHTMLの断片 + * * @return SC_Helper_Transform */ public function insertBefore($html_snip) @@ -244,6 +248,7 @@ public function insertBefore($html_snip) * 要素の後にHTMLを挿入 * * @param string $html_snip 挿入するHTMLの断片 + * * @return SC_Helper_Transform */ public function insertAfter($html_snip) @@ -261,6 +266,7 @@ public function insertAfter($html_snip) * 要素の先頭にHTMLを挿入 * * @param string $html_snip 挿入するHTMLの断片 + * * @return SC_Helper_Transform */ public function appendFirst($html_snip) @@ -278,6 +284,7 @@ public function appendFirst($html_snip) * 要素の末尾にHTMLを挿入 * * @param string $html_snip 挿入するHTMLの断片 + * * @return SC_Helper_Transform */ public function appendChild($html_snip) @@ -295,6 +302,7 @@ public function appendChild($html_snip) * 要素を指定したHTMLに置換 * * @param string $html_snip 置換後のHTMLの断片 + * * @return SC_Helper_Transform */ public function replaceElement($html_snip) @@ -336,12 +344,12 @@ public function getHTML() $err_msg = ''; foreach ($this->arrErr as $arrErr) { if ($arrErr['err_msg']) { - $err_msg .= '
'.$arrErr['err_msg']; + $err_msg .= '
' . $arrErr['err_msg']; } else { if ($arrErr['type'] == self::ERR_TARGET_ELEMENT_NOT_FOUND) { $err_msg .= "
${arrErr['selector']} が存在しません"; } else { - $err_msg .= '
'.print_r($arrErr, true); + $err_msg .= '
' . print_r($arrErr, true); } } } @@ -360,7 +368,7 @@ public function getHTML() '', $html ); - $html = $this->header_source.$html.$this->footer_source; + $html = $this->header_source . $html . $this->footer_source; $html = str_replace($this->arrSmartyTagsSub, $this->arrSmartyTagsOrg, $html); return $html; @@ -375,6 +383,7 @@ public function getHTML() * コメント形式への置換 * * @param array $arrMatches マッチしたタグの情報 + * * @return string 代わりの文字列 */ protected function lfCaptureSmartyTags2Comment(array $arrMatches) @@ -393,6 +402,7 @@ protected function lfCaptureSmartyTags2Comment(array $arrMatches) * コメント形式への置換 * * @param array $arrMatches マッチしたタグの情報 + * * @return string 代わりの文字列 */ protected function lfCaptureHeadTags2Comment(array $arrMatches) @@ -407,7 +417,7 @@ protected function lfCaptureHeadTags2Comment(array $arrMatches) $content_type_tag .= ''; $content_type_tag .= ''; - return $arrMatches[1].$content_type_tag.$substitute_tag.$arrMatches[3]; + return $arrMatches[1] . $content_type_tag . $substitute_tag . $arrMatches[3]; } /** @@ -416,6 +426,7 @@ protected function lfCaptureHeadTags2Comment(array $arrMatches) * HTMLエレメント内部の処理 * * @param array $arrMatches マッチしたタグの情報 + * * @return string 代わりの文字列 */ protected function lfCaptureSmartyTagsInTag(array $arrMatches) @@ -434,6 +445,7 @@ protected function lfCaptureSmartyTagsInTag(array $arrMatches) * ダミーへの置換実行 * * @param array $arrMatches マッチしたタグの情報 + * * @return string 代わりの文字列 */ protected function lfCaptureSmartyTags2Temptag(array $arrMatches) @@ -452,6 +464,7 @@ protected function lfCaptureSmartyTags2Temptag(array $arrMatches) * クォート内(=属性値)内にあるSmartyタグ(ダミーに置換済み)を、テキストに置換 * * @param array $arrMatches マッチしたタグの情報 + * * @return string 代わりの文字列 */ protected function lfCaptureSmartyTagsInQuote(array $arrMatches) @@ -471,6 +484,7 @@ protected function lfCaptureSmartyTagsInQuote(array $arrMatches) * テキストへの置換実行 * * @param array $arrMatches マッチしたタグの情報 + * * @return string 代わりの文字列 */ protected function lfCaptureSmartyTags2Value(array $arrMatches) @@ -488,6 +502,7 @@ protected function lfCaptureSmartyTags2Value(array $arrMatches) * エレメント内部にあって、属性値ではないものを、ダミーの属性として置換 * * @param array $arrMatches マッチしたタグの情報 + * * @return string 代わりの文字列 */ protected function lfCaptureSmartyTags2Attr(array $arrMatches) @@ -496,19 +511,22 @@ protected function lfCaptureSmartyTags2Attr(array $arrMatches) $substitute_tag = sprintf('rel%08d="######"', $tag_idx); $this->arrSmartyTagsSub[$tag_idx] = $substitute_tag; - return ' '.$substitute_tag.' '; // 属性はパース時にスペースが詰まるので、こちらにはスペースを入れておく + return ' ' . $substitute_tag . ' '; // 属性はパース時にスペースが詰まるので、こちらにはスペースを入れておく } /** * DOM Element / Document を走査し、name、class別に分類する * * @param DOMNode $objDOMElement DOMNodeオブジェクト + * * @return void */ protected function lfScanChild(DOMNode $objDOMElement, $parent_selector = '') { $objNodeList = $objDOMElement->childNodes; - if (is_null($objNodeList)) return; + if (is_null($objNodeList)) { + return; + } foreach ($objNodeList as $element) { // DOMElementのみ取り出す @@ -517,19 +535,24 @@ protected function lfScanChild(DOMNode $objDOMElement, $parent_selector = '') $arrAttr[] = $element->tagName; if (method_exists($element, 'getAttribute')) { // idを持っていればidを付加する - if ($element->hasAttribute('id')) - $arrAttr[] = '#'.$element->getAttribute('id'); + if ($element->hasAttribute('id')) { + $arrAttr[] = '#' . $element->getAttribute('id'); + } // classを持っていればclassを付加する(複数の場合は複数付加する) if ($element->hasAttribute('class')) { $arrClasses = preg_split('/\s+/', $element->getAttribute('class')); - foreach ($arrClasses as $classname) $arrAttr[] = '.'.$classname; + foreach ($arrClasses as $classname) { + $arrAttr[] = '.' . $classname; + } } } // 親要素のセレクタを付けてツリーへ登録する - $this_selector = $parent_selector.' '.implode('', $arrAttr); + $this_selector = $parent_selector . ' ' . implode('', $arrAttr); $this->arrElementTree[] = array($this_selector, $element); // エレメントが子孫要素を持っていればさらに調べる - if ($element->hasChildNodes()) $this->lfScanChild($element, $this_selector); + if ($element->hasChildNodes()) { + $this->lfScanChild($element, $this_selector); + } } } } @@ -539,29 +562,45 @@ protected function lfScanChild(DOMNode $objDOMElement, $parent_selector = '') * * @param string $selector セレクタ * @param string $parent_index セレクタ検索時の親要素の位置(子孫要素検索のため) + * * @return string 正規表現文字列 */ - protected function lfSelector2Regex($selector, $parent_index = NULL) + protected function lfSelector2Regex($selector, $parent_index = null) { // jQueryライクなセレクタを正規表現に $selector = preg_replace('/ *> */', ' >', $selector); // 子セレクタをツリー検索用に 「A >B」の記法にする $regex = '/'; - if (!is_null($parent_index)) $regex .= preg_quote($this->arrElementTree[$parent_index][0], '/'); // (親要素の指定(絞り込み時)があれば頭に付加する(特殊文字はエスケープ) + if (!is_null($parent_index)) { + $regex .= preg_quote($this->arrElementTree[$parent_index][0], '/'); + } // (親要素の指定(絞り込み時)があれば頭に付加する(特殊文字はエスケープ) $arrSelectors = explode(' ', $selector); foreach ($arrSelectors as $sub_selector) { if (preg_match('/^(>?)([\w\-]+)?(#[\w\-]+)?(\.[\w\-]+)*$/', $sub_selector, $arrMatch)) { // 子セレクタ - if (isset($arrMatch[1]) && $arrMatch[1]) $regex .= ' '; - else $regex .= '.* '; + if (isset($arrMatch[1]) && $arrMatch[1]) { + $regex .= ' '; + } else { + $regex .= '.* '; + } // タグ名 - if (isset($arrMatch[2]) && $arrMatch[2]) $regex .= preg_quote($arrMatch[2], '/'); - else $regex .= '([\w\-]+)?'; + if (isset($arrMatch[2]) && $arrMatch[2]) { + $regex .= preg_quote($arrMatch[2], '/'); + } else { + $regex .= '([\w\-]+)?'; + } // id - if (isset($arrMatch[3]) && $arrMatch[3]) $regex .= preg_quote($arrMatch[3], '/'); - else $regex .= '(#(\w|\-|#{3}[0-9]{8}#{3})+)?'; + if (isset($arrMatch[3]) && $arrMatch[3]) { + $regex .= preg_quote($arrMatch[3], '/'); + } else { + $regex .= '(#(\w|\-|#{3}[0-9]{8}#{3})+)?'; + } // class - if (isset($arrMatch[4]) && $arrMatch[4]) $regex .= '(\.(\w|\-|#{3}[0-9]{8}#{3})+)*'.preg_quote($arrMatch[4], '/').'(\.(\w|\-|#{3}[0-9]{8}#{3})+)*'; // class指定の時は前後にもclassが付いているかもしれない - else $regex .= '(\.(\w|\-|#{3}[0-9]{8}#{3})+)*'; + if (isset($arrMatch[4]) && $arrMatch[4]) { + $regex .= '(\.(\w|\-|#{3}[0-9]{8}#{3})+)*' . preg_quote($arrMatch[4], '/') . '(\.(\w|\-|#{3}[0-9]{8}#{3})+)*'; + } // class指定の時は前後にもclassが付いているかもしれない + else { + $regex .= '(\.(\w|\-|#{3}[0-9]{8}#{3})+)*'; + } } } $regex .= '$/i'; @@ -574,12 +613,13 @@ protected function lfSelector2Regex($selector, $parent_index = NULL) * * @param integer $elementNo エレメントのインデックス * @param array $arrElement インデックスとDOMオブジェクトをペアとした配列 + * * @return void */ protected function lfAddElement($elementNo, array &$arrElement) { if (is_array($this->arrSelectElements[$this->search_depth]) && array_key_exists($arrElement[0], $this->arrSelectElements[$this->search_depth])) { - //nop + // nop } else { $this->arrSelectElements[$this->search_depth][$arrElement[0]] = array($elementNo, &$arrElement[1]); } @@ -591,6 +631,7 @@ protected function lfAddElement($elementNo, array &$arrElement) * @param string $mode 実行するメソッドの種類 * @param string $target_key 対象のエレメントの完全なセレクタ * @param string $html_snip HTMLコード + * * @return boolean */ protected function lfSetTransform($mode, $target_key, $html_snip) @@ -609,7 +650,9 @@ protected function lfSetTransform($mode, $target_key, $html_snip) $objElement = &$this->arrElementTree[$target_key][1]; } - if (!$objElement) return false; + if (!$objElement) { + return false; + } try { switch ($mode) { @@ -624,18 +667,22 @@ protected function lfSetTransform($mode, $target_key, $html_snip) $objElement->appendChild($objSnip); break; case 'insertBefore': - if (!is_object($objElement->parentNode)) return false; + if (!is_object($objElement->parentNode)) { + return false; + } $objElement->parentNode->insertBefore($objSnip, $objElement); break; case 'insertAfter': if ($objElement->nextSibling) { - $objElement->parentNode->insertBefore($objSnip, $objElement->nextSibling); + $objElement->parentNode->insertBefore($objSnip, $objElement->nextSibling); } else { - $objElement->parentNode->appendChild($objSnip); + $objElement->parentNode->appendChild($objSnip); } break; case 'replaceElement': - if (!is_object($objElement->parentNode)) return false; + if (!is_object($objElement->parentNode)) { + return false; + } $objElement->parentNode->replaceChild($objSnip, $objElement); break; default: @@ -655,14 +702,15 @@ protected function lfSetTransform($mode, $target_key, $html_snip) * @param string $selector セレクタ * @param integer $type エラーの種類 * @param string $err_msg エラーメッセージ + * * @return void */ - protected function lfSetError($selector, $type, $err_msg = NULL) + protected function lfSetError($selector, $type, $err_msg = null) { $this->arrErr[] = array( - 'selector' => $selector, - 'type' => $type, - 'err_msg' => $err_msg + 'selector' => $selector, + 'type' => $type, + 'err_msg' => $err_msg, ); } } diff --git a/data/class/pages/LC_Page.php b/data/class/pages/LC_Page.php index 63f3e7229e..0380430d55 100644 --- a/data/class/pages/LC_Page.php +++ b/data/class/pages/LC_Page.php @@ -28,8 +28,8 @@ * PHP4 ではこのような抽象クラスを作っても継承先で何でもできてしまうため、 * あまり意味がないが、アーキテクトを統一するために作っておく. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page @@ -71,6 +71,7 @@ class LC_Page /** * プラグインを実行フラグ + * * @deprecated 定数 PLUGIN_ACTIVATE_FLAG を使用してください */ public $plugin_activate_flg = PLUGIN_ACTIVATE_FLAG; @@ -308,7 +309,7 @@ public function init() if (!$this->skip_load_page_layout) { $layout = new SC_Helper_PageLayout_Ex(); $layout->sfGetPageLayout($this, false, $_SERVER['SCRIPT_NAME'], - $this->objDisplay->detectDevice()); + $this->objDisplay->detectDevice()); } // スーパーフックポイントを実行. @@ -355,7 +356,7 @@ public function sendResponse() $objPlugin->doAction('LC_Page_process', array($this)); // ページクラス名をテンプレートに渡す - $arrBacktrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); // class のみ使用 + $arrBacktrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 2); // class のみ使用 if (strlen($this->tpl_page_class_name) === 0) { $this->tpl_page_class_name = preg_replace('/_Ex$/', '', $arrBacktrace[1]['class']); } @@ -370,12 +371,13 @@ public function sendResponse() * * @param string $file_name * @param string $data + * * @return void */ public function sendResponseCSV($file_name, $data) { - $this->objDisplay->addHeader('Content-disposition', "attachment; filename=${file_name}"); - $this->objDisplay->addHeader('Content-type', "application/octet-stream; name=${file_name}"); + $this->objDisplay->addHeader('Content-disposition', "attachment; filename={$file_name}"); + $this->objDisplay->addHeader('Content-type', "application/octet-stream; name={$file_name}"); $this->objDisplay->addHeader('Cache-Control', ''); $this->objDisplay->addHeader('Pragma', ''); @@ -388,6 +390,7 @@ public function sendResponseCSV($file_name, $data) * デストラクタ * * ・ブロックの基底クラス (LC_Page_FrontParts_Bloc) では、継承していない。 + * * @return void */ public function __destruct() @@ -408,6 +411,7 @@ public function __destruct() * ローカルフックポイントを生成し、実行します. * * @param SC_Helper_Plugin_Ex $objPlugin + * * @return void */ public function doLocalHookpointBefore(SC_Helper_Plugin_Ex $objPlugin) @@ -417,7 +421,7 @@ public function doLocalHookpointBefore(SC_Helper_Plugin_Ex $objPlugin) if ($parent_class_name != 'LC_Page') { $objPlugin->doAction($parent_class_name . '_action_before', array($this)); } - $class_name = get_class($this); + $class_name = static::class; if ($parent_class_name != 'LC_Page' && $class_name != $parent_class_name) { $objPlugin->doAction($class_name . '_action_before', array($this)); } @@ -427,6 +431,7 @@ public function doLocalHookpointBefore(SC_Helper_Plugin_Ex $objPlugin) * ローカルフックポイントを生成し、実行します. * * @param SC_Helper_Plugin_Ex $objPlugin + * * @return void */ public function doLocalHookpointAfter(SC_Helper_Plugin_Ex $objPlugin) @@ -436,7 +441,7 @@ public function doLocalHookpointAfter(SC_Helper_Plugin_Ex $objPlugin) if ($parent_class_name != 'LC_Page') { $objPlugin->doAction($parent_class_name . '_action_after', array($this)); } - $class_name = get_class($this); + $class_name = static::class; if ($parent_class_name != 'LC_Page' && $class_name != $parent_class_name) { $objPlugin->doAction($class_name . '_action_after', array($this)); } @@ -444,7 +449,6 @@ public function doLocalHookpointAfter(SC_Helper_Plugin_Ex $objPlugin) /** * テンプレート取得 - * */ public function getTemplate() { @@ -453,7 +457,6 @@ public function getTemplate() /** * テンプレート設定(ポップアップなどの場合) - * */ public function setTemplate($template) { @@ -471,13 +474,14 @@ public function setTemplate($template) * 返り値に, QUERY_STRING を含めたい場合は, key => value 形式 * の配列を $param へ渡す. * - * @access protected * @param string $path 結果を取得するためのパス * @param array $param URL に付与するパラメーターの配列 * @param mixed $useSSL 結果に HTTPS_URL を使用する場合 true, * HTTP_URL を使用する場合 false, * デフォルト 'escape' 現在のスキーマを使用 + * * @return string $path の存在する http(s):// から始まる絶対パス + * * @see Net_URL */ public function getLocation($path, $param = array(), $useSSL = 'escape') @@ -496,7 +500,7 @@ public function getLocation($path, $param = array(), $useSSL = 'escape') $url = HTTP_URL . $rootPath; } } else { - die("[BUG] Illegal Parametor of \$useSSL "); + exit("[BUG] Illegal Parametor of \$useSSL "); } $netURL = new Net_URL($url); @@ -512,6 +516,7 @@ public function getLocation($path, $param = array(), $useSSL = 'escape') * EC-CUBE のWEBルート(/html/)を / としたパスを返す * * @param string $path 結果を取得するためのパス + * * @return string EC-CUBE のWEBルート(/html/)からのパス。 */ public function getRootPath($path) @@ -540,7 +545,7 @@ public function getRootPath($path) $realPath = realpath($path); } if ($realPath === false) { - trigger_error('realpath でエラー発生。', E_USER_ERROR); + trigger_error('realpath でエラー発生。', \E_USER_ERROR); } $realPath = str_replace('\\', '/', $realPath); @@ -551,7 +556,7 @@ public function getRootPath($path) // HTML_REALDIR を削除した文字列を取得. if (substr($realPath, 0, strlen($htmlPath)) !== $htmlPath) { - trigger_error('不整合', E_USER_ERROR); + trigger_error('不整合', \E_USER_ERROR); } $rootPath = substr($realPath, strlen($htmlPath)); @@ -566,8 +571,8 @@ public function getRootPath($path) /** * 互換性確保用メソッド * - * @access protected * @return void + * * @deprecated 決済モジュール互換のため */ public function allowClientCache() @@ -578,8 +583,8 @@ public function allowClientCache() /** * クライアント・プロキシのキャッシュを制御する. * - * @access protected * @param string $mode (nocache/private) + * * @return void */ public function httpCacheControl($mode = '') @@ -614,7 +619,6 @@ public function httpCacheControl($mode = '') * mode に, 半角英数字とアンダーバー(_) 以外の文字列が検出された場合は null を * 返す. * - * @access protected * @return string|null $_REQUEST['mode'] の文字列 */ public function getMode() @@ -622,7 +626,7 @@ public function getMode() $pattern = '/^[a-zA-Z0-9_]+$/'; $mode = null; if (isset($_REQUEST['mode']) && preg_match($pattern, $_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; + $mode = $_REQUEST['mode']; } return $mode; @@ -639,8 +643,8 @@ public function getMode() * ページによって検証タイミングなどを制御する必要がある場合は, この関数を * オーバーライドし, 個別に設定を行うこと. * - * @access public * @param boolean $is_admin 管理画面でエラー表示をする場合 true + * * @return void */ public function doValidToken($is_admin = false) @@ -666,7 +670,6 @@ public function doValidToken($is_admin = false) /** * トランザクショントークンを取得し, 設定する. * - * @access protected * @return void */ public function setTokenTo() @@ -681,7 +684,7 @@ public function setTokenTo() */ public function log($mess, $log_level) { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); // ログレベル=Debugの場合は、DEBUG_MODEがtrueの場合のみログ出力する if ($log_level === 'Debug' && DEBUG_MODE === false) { return; @@ -696,8 +699,8 @@ public function log($mess, $log_level) * * デバック用途のみに使用すること. * - * @access protected * @param mixed $val デバックする要素 + * * @return void */ public function p($val) @@ -709,13 +712,14 @@ public function p($val) * POST に限定された mode か検証する。 * * POST 以外で、POST に限定された mode を実行しようとした場合、落とす。 + * * @return void */ public function checkLimitPostMode() { if ($_SERVER['REQUEST_METHOD'] !== 'POST' && in_array($mode = $this->getMode(), $this->arrLimitPostMode)) { $msg = "REQUEST_METHOD=[{$_SERVER['REQUEST_METHOD']}]では実行不能な mode=[$mode] が指定されました。"; - trigger_error($msg, E_USER_ERROR); + trigger_error($msg, \E_USER_ERROR); } } diff --git a/data/class/pages/LC_Page_Index.php b/data/class/pages/LC_Page_Index.php index 708501e54f..00687e7634 100644 --- a/data/class/pages/LC_Page_Index.php +++ b/data/class/pages/LC_Page_Index.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * Index のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Index extends LC_Page_Ex @@ -60,7 +59,7 @@ public function process() */ public function action() { - //決済処理中ステータスのロールバック + // 決済処理中ステータスのロールバック $objPurchase = new SC_Helper_Purchase_Ex(); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); diff --git a/data/class/pages/LC_Page_InputZip.php b/data/class/pages/LC_Page_InputZip.php index 21b293cfbc..b72780ca25 100644 --- a/data/class/pages/LC_Page_InputZip.php +++ b/data/class/pages/LC_Page_InputZip.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 郵便番号入力 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_InputZip extends LC_Page_Ex @@ -70,7 +69,7 @@ public function process() // 郵便番号が発見された場合 if (!empty($arrAdsList)) { - $data = $arrAdsList[0]['state']. '|'. $arrAdsList[0]['city']. '|'. $arrAdsList[0]['town']; + $data = $arrAdsList[0]['state'] . '|' . $arrAdsList[0]['city'] . '|' . $arrAdsList[0]['town']; echo $data; // 該当無し @@ -84,6 +83,7 @@ public function process() * 入力エラーのチェック. * * @param array $arrRequest リクエスト値($_GET) + * * @return array $arrErr エラーメッセージ配列 */ public function fnErrorCheck($arrRequest) @@ -112,6 +112,7 @@ public function fnErrorCheck($arrRequest) * エラーチェック. * * @param string $value + * * @return boolean エラー:false */ public function lfInputNameCheck($value) diff --git a/data/class/pages/LC_Page_ResizeImage.php b/data/class/pages/LC_Page_ResizeImage.php index 8ff4c51f8b..e32914da6d 100644 --- a/data/class/pages/LC_Page_ResizeImage.php +++ b/data/class/pages/LC_Page_ResizeImage.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * リサイズイメージ のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_ResizeImage extends LC_Page_Ex @@ -65,12 +64,11 @@ public function action() $objFormParam->setParam($_GET); $arrErr = $objFormParam->checkError(); if (SC_Utils_Ex::isBlank($arrErr)) { - - $arrForm = $objFormParam->getHashArray(); + $arrForm = $objFormParam->getHashArray(); // TODO: ファイル名を直接指定するような処理は避けるべき // NO_IMAGE_REALFILE以外のファイル名が直接渡された場合、ファイル名のチェックを行う - if (strlen($arrForm['image']) >= 1 && $arrForm['image'] !== NO_IMAGE_REALFILE ) { + if (strlen($arrForm['image']) >= 1 && $arrForm['image'] !== NO_IMAGE_REALFILE) { if (!$this->lfCheckFileName($arrForm['image'])) { GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php image=' . $arrForm['image']); } @@ -101,12 +99,14 @@ public function lfInitParam(&$objFormParam) * ファイル名の形式をチェック. * * @deprecated 2.13.0 商品IDを渡す事を推奨 + * * @param $image + * * @return boolean 正常な形式:true 不正な形式:false */ public function lfCheckFileName($image) { - $file = trim($image); + $file = trim($image); if (!preg_match("/^[[:alnum:]_\.-]+$/i", $file)) { return false; } else { @@ -118,6 +118,7 @@ public function lfCheckFileName($image) * 商品画像のパスを取得する * * @param $arrForm + * * @return string 指定された商品画像のパス */ public function lfGetProductImage($arrForm) @@ -126,7 +127,7 @@ public function lfGetProductImage($arrForm) $table = 'dtb_products'; $col = $arrForm['image_key']; $product_id = $arrForm['product_id']; - //指定されたカラムが存在する場合にのみ商品テーブルからファイル名を取得 + // 指定されたカラムが存在する場合にのみ商品テーブルからファイル名を取得 if (SC_Helper_DB_Ex::sfColumnExists($table, $col, '', '', false)) { $product_image = $objQuery->get($col, $table, 'product_id = ?', array($product_id)); } else { diff --git a/data/class/pages/LC_Page_Sitemap.php b/data/class/pages/LC_Page_Sitemap.php index 05677edf98..328dc3f589 100644 --- a/data/class/pages/LC_Page_Sitemap.php +++ b/data/class/pages/LC_Page_Sitemap.php @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * Sitemapプロトコル ファイル生成モジュール. * PHP versions 4 and 5 @@ -39,10 +38,12 @@ * このモジュールを設置後, 各検索エンジンにサイトマップを登録することにより, 検索エンジンの * インデックス化が促進される. * + * * @see https://www.google.com/webmasters/tools/siteoverview?hl=ja * @see https://siteexplorer.search.yahoo.com/mysites * * @author Kentaro Ohkouchi + * * @version $Id:sitemap.php 15532 2007-08-31 14:39:46Z nanasess * * :TODO: 各ページの changefreq や priority を指定できるようにする @@ -82,10 +83,10 @@ public function process() // FIXME PCサイトのみに限定している。ある程度妥当だとは思うが、よりベターな方法はないだろうか。 $this->arrPageList = $this->getPageData('device_type_id = ?', DEVICE_TYPE_PC); - //キャッシュしない(念のため) + // キャッシュしない(念のため) header('Paragrama: no-cache'); - //XMLテキスト + // XMLテキスト header('Content-type: application/xml; charset=utf-8'); // 必ず UTF-8 として出力 @@ -98,8 +99,8 @@ public function process() // TOPページを処理 $arrTopPagesList = $this->getTopPage($this->arrPageList); $this->createSitemap($arrTopPagesList[0]['url'], - $this->date2W3CDatetime($arrTopPagesList[0]['update_date']), - 'daily', 1.0); + $this->date2W3CDatetime($arrTopPagesList[0]['update_date']), + 'daily', 1.0); // 静的なページを処理 foreach ($this->staticURL as $url) { @@ -110,7 +111,7 @@ public function process() $arrEditablePagesList = $this->getEditablePage($this->arrPageList); foreach ($arrEditablePagesList as $arrEditablePage) { $this->createSitemap($arrEditablePage['url'], - $this->date2W3CDatetime($arrEditablePage['update_date'])); + $this->date2W3CDatetime($arrEditablePage['update_date'])); } // 商品一覧ページを処理 @@ -123,7 +124,7 @@ public function process() $arrDetailPagesList = $this->getAllDetail(); foreach ($arrDetailPagesList as $arrDetailPage) { $this->createSitemap($arrDetailPage['url'], - $this->date2W3CDatetime($arrDetailPage['update_date'])); + $this->date2W3CDatetime($arrDetailPage['update_date'])); } echo '' . "\n"; @@ -136,14 +137,16 @@ public function process() * @param string $lastmod ファイルの最終更新日 YYYY-MM-DD or W3C Datetime 形式 * @param string $changefreq ページの更新頻度 * @param double $priority URL の優先度 + * * @return void + * * @see https://www.google.com/webmasters/tools/docs/ja/protocol.html#xmlTagDefinitions * TODO Smarty に移行すべき? */ public function createSitemap($loc, $lastmod = '', $changefreq = '', $priority = '') { printf("\t\n"); - printf("\t\t%s\n", htmlentities($loc, ENT_QUOTES, 'UTF-8')); + printf("\t\t%s\n", htmlentities($loc, \ENT_QUOTES, 'UTF-8')); if (!empty($lastmod)) { printf("\t\t%s\n", $lastmod); } @@ -160,6 +163,7 @@ public function createSitemap($loc, $lastmod = '', $changefreq = '', $priority = * TOPページの情報を取得する. * * @param array $arrPageList 全てのページ情報の配列 + * * @return array TOPページの情報 */ public function getTopPage($arrPageList) @@ -180,6 +184,7 @@ public function getTopPage($arrPageList) * 全ての編集可能ページの情報を取得する. * * @param array $arrPageList 全てのページ情報の配列 + * * @return array 編集可能ページ */ public function getEditablePage($arrPageList) @@ -244,6 +249,7 @@ public function getAllDetail() * * @param string $where WHERE句 * @param array $arrVal WHERE句の値を格納した配列 + * * @return array $arrPageList ブロック情報 */ public function getPageData($where = '', $arrVal = '') @@ -279,7 +285,7 @@ public function getPageData($where = '', $arrVal = '') // URL にプロトコルの記載が無い場合、HTTP_URL を前置する。 foreach ($arrPageList as $key => $value) { - $arrPage =& $arrPageList[$key]; + $arrPage = &$arrPageList[$key]; if (!preg_match('|^https?://|i', $arrPage['url'])) { $arrPage['url'] = HTTP_URL . $arrPage['url']; } @@ -294,6 +300,7 @@ public function getPageData($where = '', $arrVal = '') * date形式の文字列を W3C Datetime 形式に変換して出力する. * * @param date $date 変換する日付 + * * @return string */ public function date2W3CDatetime($date) @@ -303,6 +310,6 @@ public function date2W3CDatetime($date) preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/', $date, $arr); // :TODO: time zone も取得するべき... return sprintf('%04d-%02d-%02dT%02d:%02d:%02d+09:00', - $arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]); + $arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]); } } diff --git a/data/class/pages/abouts/LC_Page_Abouts.php b/data/class/pages/abouts/LC_Page_Abouts.php index 9d04a95e18..1771438d5d 100644 --- a/data/class/pages/abouts/LC_Page_Abouts.php +++ b/data/class/pages/abouts/LC_Page_Abouts.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * サイト概要のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Abouts extends LC_Page_Ex diff --git a/data/class/pages/admin/LC_Page_Admin.php b/data/class/pages/admin/LC_Page_Admin.php index ffd6b830eb..62662aac85 100644 --- a/data/class/pages/admin/LC_Page_Admin.php +++ b/data/class/pages/admin/LC_Page_Admin.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 管理者ログイン のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin extends LC_Page_Ex @@ -144,23 +143,23 @@ public function init() $this->sendAdditionalHeader(); $this->template = MAIN_FRAME; - if (stripos($_SERVER['REQUEST_URI'], rtrim(ROOT_URLPATH.ADMIN_DIR, '/')) === false) { + if (stripos($_SERVER['REQUEST_URI'], rtrim(ROOT_URLPATH . ADMIN_DIR, '/')) === false) { // ADMIN_DIR 以外からのリクエストは認証を要求する SC_Utils_Ex::sfIsSuccess(new SC_Session_Ex()); } - //IP制限チェック + // IP制限チェック $allow_hosts = unserialize(ADMIN_ALLOW_HOSTS); if (is_array($allow_hosts) && count($allow_hosts) > 0) { - if (array_search($_SERVER['REMOTE_ADDR'], $allow_hosts) === FALSE) { + if (array_search($_SERVER['REMOTE_ADDR'], $allow_hosts) === false) { SC_Utils_Ex::sfDispError(AUTH_ERROR); } } - //SSL制限チェック - if (ADMIN_FORCE_SSL == TRUE) { + // SSL制限チェック + if (ADMIN_FORCE_SSL == true) { if (SC_Utils_Ex::sfIsHTTPS() === false) { - SC_Response_Ex::sendRedirect($_SERVER['REQUEST_URI'], $_GET, FALSE, TRUE); + SC_Response_Ex::sendRedirect($_SERVER['REQUEST_URI'], $_GET, false, true); } } @@ -180,7 +179,7 @@ public function init() // ローカルフックポイントを実行 $parent_class_name = get_parent_class($this); $objPlugin->doAction($parent_class_name . '_action_before', array($this)); - $class_name = get_class($this); + $class_name = static::class; if ($class_name != $parent_class_name) { $objPlugin->doAction($class_name . '_action_before', array($this)); } @@ -206,7 +205,7 @@ public function sendResponse() // ローカルフックポイントを実行 $parent_class_name = get_parent_class($this); $objPlugin->doAction($parent_class_name . '_action_after', array($this)); - $class_name = get_class($this); + $class_name = static::class; if ($class_name != $parent_class_name) { $objPlugin->doAction($class_name . '_action_after', array($this)); } @@ -226,9 +225,9 @@ public function sendResponse() * * @deprecated 2.12.0 GC_Utils_Ex::gfPrintLog を使用すること */ - public function log($mess, $log_level='Info') + public function log($mess, $log_level = 'Info') { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); // ログレベル=Debugの場合は、DEBUG_MODEがtrueの場合のみログ出力する if ($log_level === 'Debug' && DEBUG_MODE === false) { return; diff --git a/data/class/pages/admin/LC_Page_Admin_Home.php b/data/class/pages/admin/LC_Page_Admin_Home.php index e2fc418c6f..b7920a13d6 100644 --- a/data/class/pages/admin/LC_Page_Admin_Home.php +++ b/data/class/pages/admin/LC_Page_Admin_Home.php @@ -22,12 +22,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 管理画面ホーム のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Home extends LC_Page_Admin_Ex @@ -111,10 +110,10 @@ public function action() // 会員の累計ポイント $this->customer_point = $this->lfGetTotalCustomerPoint(); - //昨日のレビュー書き込み数 + // 昨日のレビュー書き込み数 $this->review_yesterday_cnt = $this->lfGetReviewYesterday(); - //レビュー書き込み非表示数 + // レビュー書き込み非表示数 $this->review_nondisp_cnt = $this->lfGetReviewNonDisp(); // 品切れ商品 @@ -134,7 +133,7 @@ public function action() */ public function lfGetPHPVersion() { - return 'PHP ' . phpversion(); + return 'PHP ' . PHP_VERSION; } /** @@ -168,6 +167,7 @@ public function lfGetCustomerCnt() * 昨日の売上データの取得 * * @param string $method 取得タイプ 件数:'COUNT' or 金額:'SUM' + * * @return integer 結果数値 */ public function lfGetOrderYesterday($method) @@ -185,6 +185,7 @@ public function lfGetOrderYesterday($method) * 今月の売上データの取得 * * @param string $method 取得タイプ 件数:'COUNT' or 金額:'SUM' + * * @return integer 結果数値 */ public function lfGetOrderMonth($method) @@ -315,11 +316,15 @@ public function lfGetNewOrder() public function lfGetInfo() { // 更新情報の取得ON/OFF確認 - if (!ECCUBE_INFO) return array(); + if (!ECCUBE_INFO) { + return array(); + } // パラメーター「UPDATE_HTTP」が空文字の場合、処理しない。 // XXX これと別に on/off を持たせるべきか。 - if (strlen(UPDATE_HTTP) == 0) return array(); + if (strlen(UPDATE_HTTP) == 0) { + return array(); + } $query = ''; // サイト情報の送信可否設定 diff --git a/data/class/pages/admin/LC_Page_Admin_Index.php b/data/class/pages/admin/LC_Page_Admin_Index.php index 40a8cb784e..20313871c3 100644 --- a/data/class/pages/admin/LC_Page_Admin_Index.php +++ b/data/class/pages/admin/LC_Page_Admin_Index.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 管理者ログイン のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Index extends LC_Page_Admin_Ex @@ -66,7 +65,7 @@ public function action() switch ($this->getMode()) { case 'login': - //ログイン処理 + // ログイン処理 $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->trimParam(); @@ -95,11 +94,12 @@ public function action() * パラメーター情報の初期化 * * @param SC_FormParam_Ex $objFormParam フォームパラメータークラス + * * @return void */ public function lfInitParam(&$objFormParam) { - $objFormParam->addParam('ID', 'login_id', ID_MAX_LEN, '', array('EXIST_CHECK', 'GRAPH_CHECK' ,'MAX_LENGTH_CHECK')); + $objFormParam->addParam('ID', 'login_id', ID_MAX_LEN, '', array('EXIST_CHECK', 'GRAPH_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('PASSWORD', 'password', PASSWORD_MAX_LEN, '', array('EXIST_CHECK', 'GRAPH_CHECK', 'MAX_LENGTH_CHECK')); } @@ -109,6 +109,7 @@ public function lfInitParam(&$objFormParam) * TODO: ブルートフォースアタック対策チェックの実装 * * @param SC_FormParam_Ex $objFormParam フォームパラメータークラス + * * @return array $arrErr エラー配列 */ public function lfCheckError(&$objFormParam) @@ -132,12 +133,13 @@ public function lfCheckError(&$objFormParam) * * @param string $login_id ログインID文字列 * @param string $pass ログインパスワード文字列 + * * @return boolean ログイン情報が有効な場合 true */ public function lfIsLoginMember($login_id, $pass) { $objQuery = SC_Query_Ex::getSingletonInstance(); - //パスワード、saltの取得 + // パスワード、saltの取得 $cols = 'password, salt'; $table = 'dtb_member'; $where = 'login_id = ? AND del_flg <> 1 AND work = 1'; @@ -157,12 +159,13 @@ public function lfIsLoginMember($login_id, $pass) * 管理者ログイン設定処理 * * @param string $login_id ログインID文字列 + * * @return void */ public function lfDoLogin($login_id) { $objQuery = SC_Query_Ex::getSingletonInstance(); - //メンバー情報取得 + // メンバー情報取得 $cols = 'member_id, authority, login_date, name'; $table = 'dtb_member'; $where = 'login_id = ?'; @@ -181,6 +184,7 @@ public function lfDoLogin($login_id) * @param integer $authority 権限ID * @param string $login_name ログイン表示名 * @param string $last_login 最終ログイン日時(YYYY/MM/DD HH:ii:ss形式) またはNULL + * * @return string $sid 設定したセッションのセッションID */ public function lfSetLoginSession($member_id, $login_id, $authority, $login_name, $last_login) @@ -213,6 +217,7 @@ public function lfSetLoginSession($member_id, $login_id, $authority, $login_name * @param string $login_id ログインID文字列 * @param integer $authority 権限ID * @param string $last_login 最終ログイン日時(YYYY/MM/DD HH:ii:ss形式) またはNULL + * * @return void */ public function lfSetLoginData($sid, $member_id, $login_id, $authority, $last_login) @@ -237,6 +242,7 @@ public function lfSetLoginData($sid, $member_id, $login_id, $authority, $last_lo * TODO: ブルートフォースアタック対策の実装 * * @param string $error_login_id ログイン失敗時に投入されたlogin_id文字列 + * * @return void */ public function lfSetIncorrectData($error_login_id) diff --git a/data/class/pages/admin/LC_Page_Admin_Logout.php b/data/class/pages/admin/LC_Page_Admin_Logout.php index 40961bb089..d8d3db1f16 100644 --- a/data/class/pages/admin/LC_Page_Admin_Logout.php +++ b/data/class/pages/admin/LC_Page_Admin_Logout.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * ログアウト のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Logout extends LC_Page_Admin_Ex diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis.php index 7d53a3645c..7df64ce5fb 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 店舗基本情報 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis extends LC_Page_Admin_Ex @@ -51,7 +50,7 @@ public function init() $this->tpl_maintitle = '基本情報管理'; $this->tpl_subtitle = 'SHOPマスター'; - //定休日用配列 + // 定休日用配列 $this->arrRegularHoliday[0] = '日'; $this->arrRegularHoliday[1] = '月'; $this->arrRegularHoliday[2] = '火'; @@ -105,7 +104,8 @@ public function action() SC_Helper_DB_Ex::registerBasisData($arrData); $this->tpl_onload .= "window.alert('SHOPマスターの登録が完了しました。');"; - // breakはつけない + // breakはつけない + // no break default: $arrRet = SC_Helper_DB_Ex::getBasisDataFromDB(); $objFormParam->setParam($arrRet); @@ -122,7 +122,7 @@ public function action() */ public function lfUpdateData($arrData) { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); SC_Helper_DB_Ex::registerBasisData($arrData); } @@ -133,7 +133,7 @@ public function lfUpdateData($arrData) */ public function lfInsertData($arrData) { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + trigger_error('前方互換用メソッドが使用されました。', \E_USER_WARNING); SC_Helper_DB_Ex::registerBasisData($arrData); } diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php index b2a87770d6..57fbaa2959 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 配送方法設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Delivery extends LC_Page_Admin_Ex @@ -79,7 +78,7 @@ public function action() $this->arrErr = $this->lfCheckError($mode, $objFormParam); if (!empty($this->arrErr['deliv_id'])) { - trigger_error('', E_USER_ERROR); + trigger_error('', \E_USER_ERROR); return; } @@ -113,6 +112,7 @@ public function action() * * @param string $mode * @param SC_FormParam_Ex $objFormParam + * * @return array */ public function lfCheckError($mode, &$objFormParam) diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php index b55eec511b..43e8e35eee 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_DeliveryInput.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 配送方法設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_DeliveryInput extends LC_Page_Admin_Ex @@ -86,7 +85,7 @@ public function action() break; case 'pre_edit': if (count($this->arrErr) > 0) { - trigger_error('', E_USER_ERROR); + trigger_error('', \E_USER_ERROR); } $this->lfGetDelivData($objFormParam); break; @@ -223,7 +222,7 @@ public function lfGetDelivData(&$objFormParam) public function lfCheckError(&$objFormParam) { // 入力データを渡す。 - $arrRet = $objFormParam->getHashArray(); + $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php index d90e16549b..bb1624b7c6 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 定休日管理のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Holiday extends LC_Page_Admin_Ex @@ -90,7 +89,7 @@ public function action() case 'edit': $this->arrErr = $this->lfCheckError($objFormParam, $objHoliday); if (!SC_Utils_Ex::isBlank($this->arrErr['holiday_id'])) { - trigger_error('', E_USER_ERROR); + trigger_error('', \E_USER_ERROR); return; } @@ -100,7 +99,7 @@ public function action() $arrParam = $objFormParam->getHashArray(); // 登録実行 $res_holiday_id = $this->doRegist($holiday_id, $arrParam, $objHoliday); - if ($res_holiday_id !== FALSE) { + if ($res_holiday_id !== false) { // 完了メッセージ $holiday_id = $res_holiday_id; $this->tpl_onload = "alert('登録が完了しました。');"; @@ -110,11 +109,11 @@ public function action() $this->tpl_holiday_id = $holiday_id; break; - // 削除 + // 削除 case 'delete': $objHoliday->delete($holiday_id); break; - // 編集前処理 + // 編集前処理 case 'pre_edit': // 編集項目を取得する。 $arrHolidayData = $objHoliday->get($holiday_id); @@ -150,6 +149,7 @@ public function action() * @param integer $holiday_id * @param array $sqlval * @param SC_Helper_Holiday_Ex $objHoliday + * * @return multiple */ public function doRegist($holiday_id, $sqlval, SC_Helper_Holiday_Ex $objHoliday) @@ -169,9 +169,9 @@ public function lfInitParam($mode, &$objFormParam) switch ($mode) { case 'edit': case 'pre_edit': - $objFormParam->addParam('タイトル', 'title', STEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); - $objFormParam->addParam('月', 'month', INT_LEN, 'n', array('SELECT_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); - $objFormParam->addParam('日', 'day', INT_LEN, 'n', array('SELECT_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); + $objFormParam->addParam('タイトル', 'title', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); + $objFormParam->addParam('月', 'month', INT_LEN, 'n', array('SELECT_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); + $objFormParam->addParam('日', 'day', INT_LEN, 'n', array('SELECT_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('定休日ID', 'holiday_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); break; case 'delete': @@ -188,6 +188,7 @@ public function lfInitParam($mode, &$objFormParam) * * @param SC_FormParam_Ex $objFormParam * @param SC_Helper_Holiday_Ex $objHoliday + * * @return array */ public function lfCheckError(&$objFormParam, SC_Helper_Holiday_Ex &$objHoliday) diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php index 0ed60b882b..86b60b0c0f 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 会員規約設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Kiyaku extends LC_Page_Admin_Ex @@ -86,7 +85,7 @@ public function action() // エラーチェック $this->arrErr = $this->lfCheckError($objFormParam, $objKiyaku); if (!SC_Utils_Ex::isBlank($this->arrErr['kiyaku_id'])) { - trigger_error('', E_USER_ERROR); + trigger_error('', \E_USER_ERROR); return; } @@ -96,7 +95,7 @@ public function action() $arrParam = $objFormParam->getHashArray(); // 登録実行 $res_kiyaku_id = $this->doRegist($kiyaku_id, $arrParam, $objKiyaku); - if ($res_kiyaku_id !== FALSE) { + if ($res_kiyaku_id !== false) { // 完了メッセージ $kiyaku_id = $res_kiyaku_id; $this->tpl_onload = "alert('登録が完了しました。');"; @@ -106,12 +105,12 @@ public function action() // 編集中の規約IDを渡す $this->tpl_kiyaku_id = $kiyaku_id; break; - // 削除 + // 削除 case 'delete': $objKiyaku->deleteKiyaku($kiyaku_id); break; - // 編集前処理 + // 編集前処理 case 'pre_edit': // 編集項目を取得する。 $arrKiyakuData = $objKiyaku->getKiyaku($kiyaku_id); @@ -151,6 +150,7 @@ public function action() * @param integer $kiyaku_id * @param array $sqlval * @param SC_Helper_Kiyaku_Ex $objKiyaku + * * @return multiple */ public function doRegist($kiyaku_id, $sqlval, SC_Helper_Kiyaku_Ex &$objKiyaku) @@ -170,8 +170,8 @@ public function lfInitParam($mode, &$objFormParam) switch ($mode) { case 'confirm': case 'pre_edit': - $objFormParam->addParam('規約タイトル', 'kiyaku_title', SMTEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); - $objFormParam->addParam('規約内容', 'kiyaku_text', MLTEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); + $objFormParam->addParam('規約タイトル', 'kiyaku_title', SMTEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); + $objFormParam->addParam('規約内容', 'kiyaku_text', MLTEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('規約ID', 'kiyaku_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); break; case 'delete': @@ -188,6 +188,7 @@ public function lfInitParam($mode, &$objFormParam) * * @param SC_Helper_Kiyaku_Ex $objKiyaku * @param SC_FormParam_Ex $objFormParam + * * @return array */ public function lfCheckError($objFormParam, SC_Helper_Kiyaku_Ex &$objKiyaku) diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Mail.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Mail.php index 6a5c8d6c03..a57c49e91d 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Mail.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Mail.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * メール設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Mail extends LC_Page_Admin_Ex @@ -87,32 +86,30 @@ public function action() switch ($mode) { case 'id_set': - $mailtemplate = $objMailtemplate->get($post['template_id']); - if ($mailtemplate) { - $this->arrForm = $mailtemplate; - } else { - $this->arrForm['template_id'] = $post['template_id']; - } + $mailtemplate = $objMailtemplate->get($post['template_id']); + if ($mailtemplate) { + $this->arrForm = $mailtemplate; + } else { + $this->arrForm['template_id'] = $post['template_id']; + } break; case 'regist': + $this->arrForm = $post; + if ($this->arrErr) { + // エラーメッセージ + $this->tpl_msg = 'エラーが発生しました'; + } else { + // 正常 + $this->lfRegistMailTemplate($this->arrForm, $_SESSION['member_id'], $objMailtemplate); - $this->arrForm = $post; - if ($this->arrErr) { - // エラーメッセージ - $this->tpl_msg = 'エラーが発生しました'; - } else { - // 正常 - $this->lfRegistMailTemplate($this->arrForm, $_SESSION['member_id'], $objMailtemplate); - - // 完了メッセージ - $this->tpl_onload = "window.alert('メール設定が完了しました。テンプレートを選択して内容をご確認ください。');"; - unset($this->arrForm); - } + // 完了メッセージ + $this->tpl_onload = "window.alert('メール設定が完了しました。テンプレートを選択して内容をご確認ください。');"; + unset($this->arrForm); + } break; default: break; } - } public function lfRegistMailTemplate($post, $member_id, SC_Helper_Mailtemplate_Ex $objMailtemplate) @@ -129,10 +126,11 @@ public function lfInitParam($mode, &$objFormParam) { switch ($mode) { case 'regist': - $objFormParam->addParam('メールタイトル', 'subject', MTEXT_LEN, 'KVa', array('EXIST_CHECK','SPTAB_CHECK','MAX_LENGTH_CHECK')); - $objFormParam->addParam('ヘッダー', 'header', LTEXT_LEN, 'KVa', array('SPTAB_CHECK','MAX_LENGTH_CHECK')); - $objFormParam->addParam('フッター', 'footer', LTEXT_LEN, 'KVa', array('SPTAB_CHECK','MAX_LENGTH_CHECK')); + $objFormParam->addParam('メールタイトル', 'subject', MTEXT_LEN, 'KVa', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); + $objFormParam->addParam('ヘッダー', 'header', LTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); + $objFormParam->addParam('フッター', 'footer', LTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('テンプレート', 'template_id', INT_LEN, 'n', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); + // no break case 'id_set': $objFormParam->addParam('テンプレート', 'template_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); break; diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment.php index cf6f9ed250..c41cfa0356 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Payment.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 支払方法設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Payment extends LC_Page_Admin_Ex @@ -77,7 +76,7 @@ public function action() $this->arrErr = $objFormParam->checkError(); if (!empty($this->arrErr['payment_id'])) { - trigger_error('', E_USER_ERROR); + trigger_error('', \E_USER_ERROR); return; } diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_PaymentInput.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_PaymentInput.php index 81526a1324..ea3d3e0b00 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_PaymentInput.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_PaymentInput.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 支払方法設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_PaymentInput extends LC_Page_Admin_Ex @@ -103,7 +102,7 @@ public function action() } $this->tpl_payment_id = $post['payment_id']; break; - // 画像のアップロード + // 画像のアップロード case 'upload_image': $objFormParam->setParam($_REQUEST); $objFormParam->convParam(); @@ -114,7 +113,7 @@ public function action() $this->arrErr[$post['image_key']] = $this->objUpFile->makeTempFile($post['image_key']); $this->tpl_payment_id = $post['payment_id']; break; - // 画像の削除 + // 画像の削除 case 'delete_image': $objFormParam->setParam($_REQUEST); $objFormParam->convParam(); @@ -161,7 +160,7 @@ public function action() /* ファイル情報の初期化 */ public function lfInitFile() { - $this->objUpFile->addFile('ロゴ画像', 'payment_image', array('gif','jpeg','jpg','png'), IMAGE_SIZE, false); + $this->objUpFile->addFile('ロゴ画像', 'payment_image', array('gif', 'jpeg', 'jpg', 'png'), IMAGE_SIZE, false); return $this->objUpFile; } @@ -248,18 +247,18 @@ public function lfCheckError($post, $objFormParam, SC_Helper_Payment_Ex $objPaym } // 入力データを渡す。 - $arrRet = $objFormParam->getHashArray(); + $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); // 利用条件(下限)チェック - if ($arrRet['rule_max'] < $arrPaymentData['rule_min'] and $arrPaymentData['rule_min'] != '') { - $objErr->arrErr['rule'] = '利用条件(下限)は' . $arrPaymentData['rule_min'] .'円以上にしてください。
'; + if ($arrRet['rule_max'] < $arrPaymentData['rule_min'] && $arrPaymentData['rule_min'] != '') { + $objErr->arrErr['rule'] = '利用条件(下限)は' . $arrPaymentData['rule_min'] . '円以上にしてください。
'; } // 利用条件(上限)チェック - if ($arrRet['upper_rule'] > $arrPaymentData['upper_rule_max'] and $arrPaymentData['upper_rule_max'] != '') { - $objErr->arrErr['upper_rule'] = '利用条件(上限)は' . $arrPaymentData['upper_rule_max'] .'円以下にしてください。
'; + if ($arrRet['upper_rule'] > $arrPaymentData['upper_rule_max'] && $arrPaymentData['upper_rule_max'] != '') { + $objErr->arrErr['upper_rule'] = '利用条件(上限)は' . $arrPaymentData['upper_rule_max'] . '円以下にしてください。
'; } // 利用条件チェック diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php index eb74e99b9e..7f5f85d534 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * ポイント設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Point extends LC_Page_Admin_Ex diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php index 319a93f08c..ab3a1617f3 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 税率設定 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Tax extends LC_Page_Admin_Ex @@ -57,22 +56,21 @@ public function init() $this->arrPref = $masterData->getMasterData('mtb_pref'); $this->arrTAXCALCRULE = $masterData->getMasterData('mtb_taxrule'); - //適用時刻の項目値設定 + // 適用時刻の項目値設定 $this->objDate = new SC_Date_Ex(); - //適用時間の年を、「現在年~現在年+2」の範囲に設定 + // 適用時間の年を、「現在年~現在年+2」の範囲に設定 $arrYear = array(); - for ($year=date("Y"); $year<=date("Y") + 2;$year++) { + for ($year = date("Y"); $year <= date("Y") + 2; $year++) { $arrYear[$year] = $year; } $this->arrYear = $arrYear; $arrMinutes = array(); - for ($minutes=0; $minutes< 60; $minutes++) { + for ($minutes = 0; $minutes < 60; $minutes++) { $arrMinutes[$minutes] = $minutes; } $this->arrMinutes = $arrMinutes; - $this->arrEnable = array( '1' => '有効', '0' => '無効'); - + $this->arrEnable = array('1' => '有効', '0' => '無効'); } /** @@ -105,7 +103,7 @@ public function action() // POST値の入力文字変換 $objFormParam->convParam(); - //tax_rule_idを変数にセット + // tax_rule_idを変数にセット $tax_rule_id = $objFormParam->getValue('tax_rule_id'); // モードによる処理切り替え @@ -128,7 +126,7 @@ public function action() break; - // 編集処理 + // 編集処理 case 'edit': // エラーチェック $this->arrErr = $this->lfCheckError($objFormParam, $objTaxRule); @@ -138,7 +136,7 @@ public function action() $arrParam = $objFormParam->getHashArray(); // 登録実行 $res_tax_rule_id = $this->doRegist($tax_rule_id, $arrParam, $objTaxRule); - if ($res_tax_rule_id !== FALSE) { + if ($res_tax_rule_id !== false) { // 完了メッセージ $this->tpl_onload = "alert('登録が完了しました。');"; @@ -152,16 +150,16 @@ public function action() break; - // 編集前処理 + // 編集前処理 case 'pre_edit': $TaxRule = $objTaxRule->getTaxRuleData($tax_rule_id); $tmp = explode(" ", $TaxRule['apply_date']); - $tmp_ymd = array_map("intval",explode('-', $tmp[0])); + $tmp_ymd = array_map("intval", explode('-', $tmp[0])); $TaxRule['apply_date_year'] = $tmp_ymd[0]; $TaxRule['apply_date_month'] = $tmp_ymd[1]; $TaxRule['apply_date_day'] = $tmp_ymd[2]; - $tmp_hm = array_map("intval",explode(":", $tmp[1])); + $tmp_hm = array_map("intval", explode(":", $tmp[1])); $TaxRule['apply_date_hour'] = $tmp_hm[0]; $TaxRule['apply_date_minutes'] = $tmp_hm[1]; @@ -171,7 +169,7 @@ public function action() $this->tpl_tax_rule_id = $tax_rule_id; break; - // 削除 + // 削除 case 'delete': $objTaxRule->deleteTaxRuleData($tax_rule_id); @@ -193,6 +191,7 @@ public function action() * パラメーター情報の初期化を行う. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス + * * @return void */ public function lfInitParam(&$objFormParam) @@ -215,17 +214,18 @@ public function lfInitParam(&$objFormParam) * * @param integer $tax_rule_id * @param SC_Helper_TaxRule_Ex $objTaxRule + * * @return multiple */ public function doRegist($tax_rule_id, $arrParam, SC_Helper_TaxRule_Ex $objTaxRule) { $apply_date = SC_Utils_Ex::sfGetTimestampistime( - $arrParam['apply_date_year'], - sprintf("%02d", $arrParam['apply_date_month']), - sprintf("%02d", $arrParam['apply_date_day']), - sprintf("%02d", $arrParam['apply_date_hour']), - sprintf("%02d", $arrParam['apply_date_minutes']) - ); + $arrParam['apply_date_year'], + sprintf("%02d", $arrParam['apply_date_month']), + sprintf("%02d", $arrParam['apply_date_day']), + sprintf("%02d", $arrParam['apply_date_hour']), + sprintf("%02d", $arrParam['apply_date_minutes']) + ); $calc_rule = $arrParam['calc_rule']; $tax_rate = $arrParam['tax_rate']; @@ -237,6 +237,7 @@ public function doRegist($tax_rule_id, $arrParam, SC_Helper_TaxRule_Ex $objTaxRu * 共通設定の登録処理を実行. * * @param array $arrParam + * * @return integer */ public function doParamRegist($arrParam) @@ -244,11 +245,11 @@ public function doParamRegist($arrParam) $arrData = array(); foreach ($arrParam as $key => $val) { switch ($key) { - case 'product_tax_flg': - $arrData['OPTION_PRODUCT_TAX_RULE'] = $val; - break; - default: - } + case 'product_tax_flg': + $arrData['OPTION_PRODUCT_TAX_RULE'] = $val; + break; + default: + } } $masterData = new SC_DB_MasterData_Ex(); // DBのデータを更新 @@ -263,6 +264,7 @@ public function doParamRegist($arrParam) * 入力エラーチェック. * * @param SC_FormParam $objFormParam + * * @return array $objErr->arrErr エラー内容 */ public function lfCheckError(&$objFormParam, SC_Helper_TaxRule_Ex &$objTaxRule) @@ -285,12 +287,12 @@ public function lfCheckError(&$objFormParam, SC_Helper_TaxRule_Ex &$objTaxRule) $objErr->doFunc(array('適用日時', 'apply_date_year', 'apply_date_month', 'apply_date_day'), array('CHECK_DATE')); if (SC_Utils_Ex::isBlank($objErr->arrErr['apply_date_year']) && $arrForm['tax_rule_id'] != '0') { $apply_date = SC_Utils_Ex::sfGetTimestampistime( - $arrForm['apply_date_year'], - sprintf("%02d", $arrForm['apply_date_month']), - sprintf("%02d", $arrForm['apply_date_day']), - sprintf("%02d", $arrForm['apply_date_hour']), - sprintf("%02d", $arrForm['apply_date_minutes']) - ); + $arrForm['apply_date_year'], + sprintf("%02d", $arrForm['apply_date_month']), + sprintf("%02d", $arrForm['apply_date_day']), + sprintf("%02d", $arrForm['apply_date_hour']), + sprintf("%02d", $arrForm['apply_date_minutes']) + ); // 税規約情報読み込み $arrTaxRuleByTime = $objTaxRule->getTaxRuleByTime($apply_date); diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php index aaa78c366a..5199fe305f 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php @@ -21,12 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * 特定商取引法 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_Tradelaw extends LC_Page_Admin_Ex @@ -114,12 +113,12 @@ public function lfInitParam(&$objFormParam) $objFormParam->addParam('都道府県', 'law_pref', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); $objFormParam->addParam('所在地1', 'law_addr01', MTEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('所在地2', 'law_addr02', MTEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK')); - $objFormParam->addParam('電話番号1', 'law_tel01', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK' ,'NUM_CHECK')); - $objFormParam->addParam('電話番号2', 'law_tel02', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK' ,'NUM_CHECK')); - $objFormParam->addParam('電話番号3', 'law_tel03', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK' ,'NUM_CHECK')); - $objFormParam->addParam('FAX番号1', 'law_fax01', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK')); - $objFormParam->addParam('FAX番号2', 'law_fax02', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK')); - $objFormParam->addParam('FAX番号3', 'law_fax03', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK' ,'NUM_CHECK')); + $objFormParam->addParam('電話番号1', 'law_tel01', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); + $objFormParam->addParam('電話番号2', 'law_tel02', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); + $objFormParam->addParam('電話番号3', 'law_tel03', TEL_ITEM_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK')); + $objFormParam->addParam('FAX番号1', 'law_fax01', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); + $objFormParam->addParam('FAX番号2', 'law_fax02', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); + $objFormParam->addParam('FAX番号3', 'law_fax03', TEL_ITEM_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); $objFormParam->addParam('メールアドレス', 'law_email', null, 'KVa', array('EXIST_CHECK', 'EMAIL_CHECK', 'EMAIL_CHAR_CHECK')); $objFormParam->addParam('URL', 'law_url', STEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'URL_CHECK')); $objFormParam->addParam('必要料金', 'law_term01', MLTEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK')); @@ -154,7 +153,7 @@ public function lfInsertData($sqlval) public function lfCheckError(&$objFormParam) { // 入力データを渡す。 - $arrRet = $objFormParam->getHashArray(); + $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php index 279ee72a1f..439a4c7eaa 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php @@ -21,24 +21,23 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/** CSV ファイルの最大行数 */ +/* CSV ファイルの最大行数 */ define('ZIP_CSV_LINE_MAX', 8192); -/** 画像の表示数量 */ +/* 画像の表示数量 */ define('IMAGE_MAX', 680); -/** 郵便番号CSV ファイルのパス */ +/* 郵便番号CSV ファイルのパス */ define('ZIP_CSV_REALFILE', DATA_REALDIR . 'downloads/KEN_ALL.CSV'); -/** UTF-8 変換済みの郵便番号CSV ファイルのパス */ +/* UTF-8 変換済みの郵便番号CSV ファイルのパス */ define('ZIP_CSV_UTF8_REALFILE', DATA_REALDIR . 'downloads/KEN_ALL_utf-8.CSV'); /** * 郵便番号DB登録 のページクラス. * - * @package Page * @author EC-CUBE CO.,LTD. + * * @version $Id$ */ class LC_Page_Admin_Basis_ZipInstall extends LC_Page_Admin_Ex @@ -77,7 +76,7 @@ public function init() $this->tpl_mainno = 'basis'; $this->tpl_mode = $this->getMode(); - $this->exec = (boolean) $_GET['exec']; + $this->exec = (bool) $_GET['exec']; $this->zip_csv_temp_realfile = DATA_REALDIR . 'downloads/tmp/ken_all.zip'; } @@ -112,14 +111,14 @@ public function action() if ($this->exec) { if (!empty($this->arrErr)) { - trigger_error('', E_USER_ERROR); + trigger_error('', \E_USER_ERROR); } switch ($this->tpl_mode) { // 自動登録 case 'auto': $this->lfAutoCommitZip(); break; - // DB手動登録 + // DB手動登録 case 'manual': $this->insertMtbZip($this->arrForm['startRowNum']); break; @@ -139,7 +138,7 @@ public function action() $this->tpl_mode = null; break; - // 郵便番号CSV更新 + // 郵便番号CSV更新 case 'update_csv': $this->lfDownloadZipFileFromJp(); $this->lfExtractZipFile(); @@ -148,8 +147,8 @@ public function action() $this->tpl_mode = null; break; - // 自動登録時の郵便番号CSV更新 - // XXX iframe内にエラー表示しない様、ここでlfDownloadZipFileFromJp()を呼ぶ。 + // 自動登録時の郵便番号CSV更新 + // XXX iframe内にエラー表示しない様、ここでlfDownloadZipFileFromJp()を呼ぶ。 case 'auto': if (!$this->tpl_skip_update_csv) { $this->lfDownloadZipFileFromJp(); @@ -199,6 +198,7 @@ public function lfDeleteZip() * パラメーター情報の初期化 * * @param SC_FormParam_Ex $objFormParam + * * @return void */ public function lfInitParam($tpl_mode, &$objFormParam) @@ -217,12 +217,10 @@ public function insertMtbZip($start = 1) { $objQuery = SC_Query_Ex::getSingletonInstance(); - $img_path = USER_URL . USER_PACKAGE_DIR . 'admin/img/basis/'; // 画像パスは admin 固定 - - ?> + $img_path = USER_URL . USER_PACKAGE_DIR . 'admin/img/basis/'; // 画像パスは admin 固定?> - +

DB 登録進捗状況

@@ -237,7 +235,7 @@ public function insertMtbZip($start = 1) // 画像を一個表示する件数を求める。 $line_all = $this->countZipCsv(); - $disp_line = intval($line_all / IMAGE_MAX); + $disp_line = (int) ($line_all / IMAGE_MAX); /** 現在行(CSV形式。空行は除く。) */ $cntCurrentLine = 0; @@ -247,11 +245,13 @@ public function insertMtbZip($start = 1) $fp = $this->openZipCsv(); if (!$fp) { - trigger_error(ZIP_CSV_UTF8_REALFILE . ' の読み込みに失敗しました。', E_USER_ERROR); + trigger_error(ZIP_CSV_UTF8_REALFILE . ' の読み込みに失敗しました。', \E_USER_ERROR); } while (!feof($fp)) { $arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX); - if (empty($arrCSV)) continue; + if (empty($arrCSV)) { + continue; + } $cntCurrentLine++; if ($cntCurrentLine >= $start) { $sqlval = array(); @@ -274,9 +274,7 @@ public function insertMtbZip($start = 1) } fclose($fp); - echo ''; - - ?> + echo ''; ?>