Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/playwright/test-1.…
Browse files Browse the repository at this point in the history
…45.0
  • Loading branch information
nanasess authored Jul 30, 2024
2 parents f61511f + e2818f4 commit e48cb7a
Show file tree
Hide file tree
Showing 20 changed files with 458 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dockerbuild-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
type=match,prefix=${{ matrix.php }}-apache-,pattern=eccube2-weekly-(.*),group=1
- name: Build and export to Docker
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
load: true
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
- run: git checkout composer.*
## see https://docs.github.com/ja/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action
- name: Push Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
if: success()
with:
context: .
Expand Down
9 changes: 9 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@
"classmap": [
"data/class",
"data/class_extends"
],
"files": [
"data/smarty_extends/function.from_to.php",
"data/smarty_extends/function.include_php_ex.php",
"data/smarty_extends/modifier.h.php",
"data/smarty_extends/modifier.n2s.php",
"data/smarty_extends/modifier.nl2br_html.php",
"data/smarty_extends/modifier.script_escape.php",
"data/smarty_extends/modifier.u.php"
]
}
}
34 changes: 17 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions data/class/SC_Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ public static function actionExit()
/**
* アプリケーション内でリダイレクトする
*
* 内部で生成する URL の searchpart は、下記の順で上書きしていく。(後勝ち)
* 内部で生成する URL のクエリは、下記の順で上書きしていく。(後勝ち)
* 1. 引数 $inheritQueryString が true の場合、$_SERVER['QUERY_STRING']
* 2. $location に含まれる searchpart
* 2. $location に含まれる クエリ
* 3. 引数 $arrQueryString
* @param string $location 「url-path」「現在のURLからのパス」「URL」のいずれか。「../」の解釈は行なわない。
* @param array $arrQueryString URL に付加する searchpart
* @param bool $inheritQueryString 現在のリクエストの searchpart を継承するか
* @param array $arrQueryString URL に付加するクエリ
* @param bool $inheritQueryString 現在のリクエストのクエリを継承するか
* @param bool|null $useSsl true:HTTPSを強制, false:HTTPを強制, null:継承
* @return void
* @static
Expand Down Expand Up @@ -226,7 +226,22 @@ public static function sendRedirect($location, $arrQueryString = array(), $inher
$netUrl->addQueryString(session_name(), session_id());
}

$netUrl->addQueryString(TRANSACTION_ID_NAME, SC_Helper_Session_Ex::getToken());
/**
* transactionid を受け取ったリクエストに関して、値を継承してリダイレクトする。
* @see https://github.com/EC-CUBE/ec-cube2/issues/922
*/
if (// 管理機能 (本来遷移先で判定すべきだが、簡易的に遷移元で判定している。)
GC_Utils_Ex::isAdminFunction()
// 遷移元 transactionid 指定あり
&& isset($_REQUEST[TRANSACTION_ID_NAME])
// リダイレクト先 mode 指定あり
&& isset($netUrl->querystring['mode'])
// リダイレクト先 transactionid 指定なし
&& !isset($netUrl->querystring[TRANSACTION_ID_NAME])
) {
$netUrl->addQueryString(TRANSACTION_ID_NAME, $_REQUEST[TRANSACTION_ID_NAME]);
}

$url = $netUrl->getURL();

header("Location: $url");
Expand Down
9 changes: 8 additions & 1 deletion data/class/SC_View.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ public function init()
$this->_smarty->registerPlugin('modifier', 'sfMultiply', array('SC_Utils_Ex', 'sfMultiply'));
$this->_smarty->registerPlugin('modifier', 'sfRmDupSlash', array('SC_Utils_Ex', 'sfRmDupSlash'));
$this->_smarty->registerPlugin('modifier', 'sfCutString', array('SC_Utils_Ex', 'sfCutString'));
$this->_smarty->addPluginsDir(array('plugins', realpath(dirname(__FILE__)) . '/../smarty_extends'));
$this->_smarty->registerPlugin('function', 'from_to', 'smarty_function_from_to');
$this->_smarty->registerPlugin('function', 'include_php_ex', 'smarty_function_include_php_ex');
$this->_smarty->registerPlugin('modifier', 'h', 'smarty_modifier_h');
$this->_smarty->registerPlugin('modifier', 'n2s', 'smarty_modifier_n2s');
$this->_smarty->registerPlugin('modifier', 'nl2br_html', 'smarty_modifier_nl2br_html');
$this->_smarty->registerPlugin('modifier', 'script_escape', 'smarty_modifier_script_escape');
$this->_smarty->registerPlugin('modifier', 'u', 'smarty_modifier_u');
$this->_smarty->registerPlugin('modifier', 'sfMbConvertEncoding', array('SC_Utils_Ex', 'sfMbConvertEncoding'));
$this->_smarty->registerPlugin('modifier', 'sfGetEnabled', array('SC_Utils_Ex', 'sfGetEnabled'));
$this->_smarty->registerPlugin('modifier', 'sfNoImageMainList', array('SC_Utils_Ex', 'sfNoImageMainList'));
Expand All @@ -63,6 +69,7 @@ public function init()
$this->_smarty->registerPlugin('modifier', 'preg_quote', 'preg_quote');
$this->_smarty->registerPlugin('modifier', 'is_numeric', 'is_numeric');
$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'));
Expand Down
35 changes: 18 additions & 17 deletions data/class/helper/SC_Helper_Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1490,24 +1490,25 @@ public function checkDbMyPendignOrder()

public function checkSessionPendingOrder()
{
if (!SC_Utils_Ex::isBlank($_SESSION['order_id'])) {
$order_id = $_SESSION['order_id'];
unset($_SESSION['order_id']);
$objQuery = SC_Query_Ex::getSingletonInstance();
$objQuery->begin();
$arrOrder = SC_Helper_Purchase_Ex::getOrder($order_id);
if ($arrOrder['status'] == ORDER_PENDING) {
$objCartSess = new SC_CartSession_Ex();
$cartKeys = $objCartSess->getKeys();
if (SC_Utils_Ex::isBlank($cartKeys)) {
SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending) order_id=' . $order_id);
} else {
SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending and set card) order_id=' . $order_id);
}
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);
if ($arrOrder['status'] == ORDER_PENDING) {
$objCartSess = new SC_CartSession_Ex();
$cartKeys = $objCartSess->getKeys();
if (SC_Utils_Ex::isBlank($cartKeys)) {
SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending) order_id=' . $order_id);
} else {
SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
GC_Utils_Ex::gfPrintLog('order rollback.(session pending and set card) order_id=' . $order_id);
}
$objQuery->commit();
}
$objQuery->commit();
}
}
2 changes: 1 addition & 1 deletion data/class/pages/LC_Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function init()
// 開始時刻を設定する。
$this->timeStart = microtime(true);

$this->tpl_authority = $_SESSION['authority'];
$this->tpl_authority = $_SESSION['authority'] ?? null;

// ディスプレイクラス生成
$this->objDisplay = new SC_Display_Ex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function init()
// 開始時刻を設定する。
$this->timeStart = microtime(true);

$this->tpl_authority = $_SESSION['authority'];
$this->tpl_authority = $_SESSION['authority'] ?? null;

// ディスプレイクラス生成
$this->objDisplay = new SC_Display_Ex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class LC_Page_FrontParts_Bloc_Category extends LC_Page_FrontParts_Bloc_Ex
public $arrCat;
/** @var array */
public $arrTree;
/** @var int */
public $root_parent_id;

/**
* Page を初期化する.
Expand Down Expand Up @@ -127,7 +125,6 @@ public function lfGetCatTree($arrParentCategoryId, $count_check = false)
foreach ($arrParentCategoryId as $category_id) {
$arrParentID = $objCategory->getTreeTrail($category_id);
$this->arrParentID = array_merge($this->arrParentID, $arrParentID);
$this->root_parent_id[] = $arrParentID[0];
}

return $arrTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ public function process()
*/
public function action()
{
// 基本情報を渡す
$objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData();
$this->arrInfo = $objSiteInfo->data;

//おすすめ商品表示
$this->arrBestProducts = $this->lfGetRanking();
}
Expand Down
45 changes: 45 additions & 0 deletions data/smarty_extends/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## このディレクトリのファイルは composer.json の autoload.classmap.files に登録することで利用可能です

1. [composer.json](../../composer.json) の autoload.classmap.files に登録します。

``` json
"autoload": {
"classmap": [
"data/class",
"data/class_extends"
],
"files": [
"data/smarty_extends/function.from_to.php",
"data/smarty_extends/function.include_php_ex.php",
"data/smarty_extends/modifier.h.php",
"data/smarty_extends/modifier.n2s.php",
"data/smarty_extends/modifier.nl2br_html.php",
"data/smarty_extends/modifier.script_escape.php",
"data/smarty_extends/modifier.u.php"
]
}
```
2. [SC_View.php](../class/SC_View.php) のコンストラクタに modifier を設定します。
```diff
--- a/data/class/SC_View.php
+++ b/data/class/SC_View.php
@@ -54,7 +54,13 @@ public function init()
$this->_smarty->registerPlugin('modifier', 'sfMultiply', array('SC_Utils_Ex', 'sfMultiply'));
$this->_smarty->registerPlugin('modifier', 'sfRmDupSlash', array('SC_Utils_Ex', 'sfRmDupSlash'));
$this->_smarty->registerPlugin('modifier', 'sfCutString', array('SC_Utils_Ex', 'sfCutString'));
- $this->_smarty->addPluginsDir(array('plugins', realpath(dirname(__FILE__)) . '/../smarty_extends'));
+ $this->_smarty->registerPlugin('function', 'from_to', 'smarty_function_from_to');
+ $this->_smarty->registerPlugin('function', 'include_php_ex', 'smarty_function_include_php_ex');
+ $this->_smarty->registerPlugin('modifier', 'h', 'smarty_modifier_h');
+ $this->_smarty->registerPlugin('modifier', 'n2s', 'smarty_modifier_n2s');
+ $this->_smarty->registerPlugin('modifier', 'nl2br_html', 'smarty_modifier_nl2br_html');
+ $this->_smarty->registerPlugin('modifier', 'script_escape', 'smarty_modifier_script_escape');
+ $this->_smarty->registerPlugin('modifier', 'u', 'smarty_modifier_u');
$this->_smarty->registerPlugin('modifier', 'sfMbConvertEncoding', array('SC_Utils_Ex', 'sfMbConvertEncoding'));
$this->_smarty->registerPlugin('modifier', 'sfGetEnabled', array('SC_Utils_Ex', 'sfGetEnabled'));
$this->_smarty->registerPlugin('modifier', 'sfNoImageMainList', array('SC_Utils_Ex', 'sfNoImageMainList'));
```
3. composer dump-autoload コマンドを実行することで autoload の対象となります。
``` shell
composer dump-autoload
```
1 change: 1 addition & 0 deletions data/smarty_extends/block.marquee.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/**
* marqueeタグで囲む。
*
* @deprecated mobile テンプレートは廃止されたため非推奨
* DoCoMoの携帯端末の場合はmarqueeを使用しない。
*
* @return string 出力
Expand Down
1 change: 1 addition & 0 deletions data/smarty_extends/modifier.numeric_emoji.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/**
* 数値を数字絵文字に変換する。
*
* @deprecated mobile テンプレートは廃止されたため非推奨
* 入力が0~9ではない場合、または、携帯端末からのアクセスではない場合は、
* 入力を [ と ] で囲んだ文字列を返す。
*
Expand Down
Loading

0 comments on commit e48cb7a

Please sign in to comment.