Skip to content

Commit

Permalink
Merge branch 'dev-5' into overall_test_bc-custom-content
Browse files Browse the repository at this point in the history
  • Loading branch information
dovanhung committed Oct 27, 2023
2 parents 3fc80e6 + e315b0c commit f7aac15
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 711 deletions.
32 changes: 16 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@
}
},
"replace": {
"baserproject/baser-core": "5.0.5",
"baserproject/bc-admin-third": "5.0.5",
"baserproject/bc-blog": "5.0.5",
"baserproject/bc-column": "5.0.5",
"baserproject/bc-content-link": "5.0.5",
"baserproject/bc-custom-content": "5.0.5",
"baserproject/bc-editor-template": "5.0.5",
"baserproject/bc-favorite": "5.0.5",
"baserproject/bc-front": "5.0.5",
"baserproject/bc-installer": "5.0.5",
"baserproject/bc-mail": "5.0.5",
"baserproject/bc-search-index": "5.0.5",
"baserproject/bc-theme-config": "5.0.5",
"baserproject/bc-theme-file": "5.0.5",
"baserproject/bc-uploader": "5.0.5",
"baserproject/bc-widget-area": "5.0.5"
"baserproject/baser-core": "5.0.6",
"baserproject/bc-admin-third": "5.0.6",
"baserproject/bc-blog": "5.0.6",
"baserproject/bc-column": "5.0.6",
"baserproject/bc-content-link": "5.0.6",
"baserproject/bc-custom-content": "5.0.6",
"baserproject/bc-editor-template": "5.0.6",
"baserproject/bc-favorite": "5.0.6",
"baserproject/bc-front": "5.0.6",
"baserproject/bc-installer": "5.0.6",
"baserproject/bc-mail": "5.0.6",
"baserproject/bc-search-index": "5.0.6",
"baserproject/bc-theme-config": "5.0.6",
"baserproject/bc-theme-file": "5.0.6",
"baserproject/bc-uploader": "5.0.6",
"baserproject/bc-widget-area": "5.0.6"
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
Expand Down
9 changes: 8 additions & 1 deletion plugins/baser-core/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
5.0.5
5.0.6

///////////////////////////////////////////////////////////////////////////////////////////////////////////
// +---------------------------------------------------------------------------------------------------+ //
Expand All @@ -14,6 +14,13 @@
CHG: 変更内容 / BUG: バグフィックス / NEW: 機能追加


[2023-10-26] basercms-5.0.6
- BUG [BC] fix #1903 コンテンツ一覧(表)コピーの際にコピー先のタイトルに「のコピー」とつかない問題の改善
- BUG [BC] fix #2783 CGIモードでJWT認証が可能なよう改善
- BUG [BC] fix #2403 アップロードファイルのAPIにフルパスのURLを追加
- BUG [ML] fix #1901 バリデーションエラー時にチェックボックスのチェックが外れる
- BUG [ML] fix #2806 メールプラグインが有効化されていない場合にダッシュボードが表示できない問題の改善

[2023-09-28] basercms-5.0.5
- BUG [BC] fix #2744 カスタムコンテンツのバリデーションエラーを改善
- BUG [BC] fix #2199 カスタムコンテンツのAPIで取得する情報に不要な連携データが含まれる処理の改善
Expand Down
67 changes: 6 additions & 61 deletions plugins/baser-core/src/Model/Table/AppTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use BaserCore\Utility\BcUtil;
use Cake\ORM\Association\BelongsToMany;
use Cake\ORM\Table;
use Cake\Core\Configure;
use Cake\I18n\FrozenTime;
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;
Expand All @@ -26,6 +25,10 @@
*/
class AppTable extends Table
{

/**
* Trait
*/
use BcEventDispatcherTrait;

/**
Expand Down Expand Up @@ -68,8 +71,7 @@ class AppTable extends Table
*/
public function setTable(string $table)
{
$table = $this->addPrefix($table);
return parent::setTable($table);
return parent::setTable($this->addPrefix($table));
}

/**
Expand All @@ -83,8 +85,7 @@ public function setTable(string $table)
*/
public function getTable(): string
{
$table = parent::getTable();
$this->_table = $this->addPrefix($table);
$this->setTable(parent::getTable());
return $this->_table;
}

Expand Down Expand Up @@ -148,29 +149,6 @@ public function initialize(array $config): void
FrozenTime::setToStringFormat('yyyy-MM-dd HH:mm:ss');
}

/**
* 配列の文字コードを変換する
*
* @param array $data 変換前のデータ
* @param string $outenc 変換後の文字コード
* @param string $inenc 変換元の文字コード
* @return array 変換後のデータ
* @TODO GLOBAL グローバルな関数として再配置する必要あり
*/
public function convertEncodingByArray($data, $outenc, $inenc)
{
foreach($data as $key => $value) {
if (is_array($value)) {
$data[$key] = $this->convertEncodingByArray($value, $outenc, $inenc);
} else {
if (mb_detect_encoding($value) <> $outenc) {
$data[$key] = mb_convert_encoding($value, $outenc, $inenc);
}
}
}
return $data;
}

/**
* 機種依存文字の変換処理
*
Expand Down Expand Up @@ -257,21 +235,6 @@ public function replaceText($str)
return str_replace(array_keys($arr), array_values($arr), $str);
}

/**
* 範囲を指定しての長さチェック
*
* @param mixed $check 対象となる値
* @param int $min 値の最短値
* @param int $max 値の最長値
* @param boolean
*/
public function between($check, $min, $max)
{
$check = (is_array($check))? current($check) : $check;
$length = mb_strlen($check, Configure::read('App.encoding'));
return ($length >= $min && $length <= $max);
}

/**
* 指定フィールドのMAX値を取得する
*
Expand All @@ -290,24 +253,6 @@ public function getMax(string $field, array $conditions = []): int
return $max->{$field} ?? 0;
}

/**
* 英数チェック
*
* @param string $value チェック対象文字列
* @return boolean
*/
public static function alphaNumeric($value)
{
if (!$value) {
return true;
}
if (preg_match("/^[a-zA-Z0-9]+$/", $value)) {
return true;
} else {
return false;
}
}

/**
* 一つ位置を上げる
* @param string $id
Expand Down
7 changes: 3 additions & 4 deletions plugins/baser-core/src/Model/Table/ContentFoldersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use BcSearchIndex\Service\SearchIndexesServiceInterface;
use BaserCore\Utility\BcContainerTrait;
use Cake\Event\EventInterface;
use Cake\ORM\Exception\PersistenceFailedException;
use Cake\Validation\Validator;
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;
Expand Down Expand Up @@ -69,7 +68,7 @@ public function initialize(array $config): void
/**
* validationDefault
*
* @param Validator $validator
* @param Validator $validator
* @return Validator
* @checked
* @noTodo
Expand Down Expand Up @@ -165,7 +164,7 @@ public function copy(int $id, $newParentId, $newTitle, $newAuthorId, $newSiteId)
'id' => $id,
]);
if ($event !== false) {
$entity = ($event->getResult() === null || $event->getResult() === true) ? $event->getData('data') : $event->getResult();
$entity = ($event->getResult() === null || $event->getResult() === true)? $event->getData('data') : $event->getResult();
}

$entity->content = new Content([
Expand All @@ -176,7 +175,7 @@ public function copy(int $id, $newParentId, $newTitle, $newAuthorId, $newSiteId)
'site_id' => $newSiteId,
'description' => $entity->content->description,
'eyecatch' => $entity->content->eyecatch,
'layout_template' => $entity->content->layout_tmplate?? ''
'layout_template' => $entity->content->layout_tmplate ?? ''
]);
if (!is_null($newSiteId) && $oldEntity->content->site_id !== $newSiteId) {
$entity->content->parent_id = $this->Contents->copyContentFolderPath($entity->content->url, $newSiteId);
Expand Down
2 changes: 0 additions & 2 deletions plugins/baser-core/src/Model/Table/ContentsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
namespace BaserCore\Model\Table;

use ArrayObject;
use Cake\Core\Plugin;
use Cake\Utility\Hash;
use Cake\Core\Configure;
use Cake\I18n\FrozenTime;
use Cake\ORM\TableRegistry;
use BaserCore\Utility\BcUtil;
use Cake\Event\EventInterface;
use Cake\Utility\Inflector;
use Cake\Validation\Validator;
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;
Expand Down
14 changes: 14 additions & 0 deletions plugins/baser-core/src/Model/Validation/BcValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,4 +601,18 @@ public static function checkSelectList($value): bool
return ($result < 2);
}

/**
* 範囲を指定しての長さチェック
*
* @param mixed $value 対象となる値
* @param int $min 値の最短値
* @param int $max 値の最長値
* @param boolean
*/
public static function between($value, $min, $max)
{
$length = mb_strlen($value, Configure::read('App.encoding'));
return ($length >= $min && $length <= $max);
}

}
Loading

0 comments on commit f7aac15

Please sign in to comment.