Skip to content

Commit

Permalink
Merge branch '5.1.x' of github.com:baserproject/basercms into 5.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Nov 6, 2024
2 parents c687318 + a0b3c2e commit c1d5935
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion plugins/baser-core/src/Model/Table/ContentsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public function getUniqueName($name, $parentId, $contentId = null)
$query = $this->find()->where(['name LIKE' => $name . '%', 'site_root' => false]);
if (isset($parentId)) $query = $query->andWhere(['parent_id' => $parentId]);
if ($contentId) {
$query = $query->andWhere(['id <>' => $contentId]);
$query = $query->andWhere(['Contents.id <>' => $contentId]);
}
$datas = $query->select('name')->orderBy('name')->all()->toArray();
$datas = Hash::extract($datas, '{n}.name');
Expand Down
4 changes: 2 additions & 2 deletions plugins/baser-core/src/Model/Table/SitesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function pluginExistsByDasherize($value)
*/
public function getPublishedAll(): ResultSetInterface
{
return $this->find()->where(['status' => true])->all();
return $this->find()->where(['Sites.status' => true])->all();
}

/**
Expand All @@ -236,7 +236,7 @@ public function getList($mainSiteId = null, $options = [])

$conditions = [];
if (!is_null($options['status'])) {
$conditions = ['status' => $options['status']];
$conditions = ['Sites.status' => $options['status']];
}

if (!is_null($mainSiteId)) {
Expand Down
3 changes: 2 additions & 1 deletion plugins/baser-core/src/View/Helper/BcUploadHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use BaserCore\Event\BcEventDispatcherTrait;
use BaserCore\Service\SiteConfigsServiceInterface;
use Cake\View\Helper\HtmlHelper;
use Laminas\Diactoros\UploadedFile;
use Throwable;

/**
Expand Down Expand Up @@ -159,7 +160,7 @@ public function fileLink($fieldName, $entity, $options = [])
$basePath = '/baser-core/uploads/tmp/';
}

if (is_array($value)) {
if (is_array($value) || $value instanceof UploadedFile) {
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions plugins/bc-admin-third/templates/Admin/Sites/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@

<?php echo $this->BcAdminForm->create($site) ?>

<?php echo $this->BcFormTable->dispatchBefore() ?>

<?php $this->BcBaser->element('Sites/form') ?>

<?php echo $this->BcFormTable->dispatchAfter() ?>

<div class="submit bca-actions">
<div class="bca-actions__before">
<?php echo $this->BcHtml->link(__d('baser_core', '一覧に戻る'), ['action' => 'index'], [
Expand Down
2 changes: 1 addition & 1 deletion plugins/bc-blog/src/Service/BlogCategoriesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function getTreeIndex(int $blogContentId, array $queryParams): array
$categories = [];
foreach ($srcCategories->toArray() as $key => $value) {
/* @var BlogCategory $category */
$category = $this->BlogCategories->find()->where(['id' => $key])->first();
$category = $this->BlogCategories->find()->where(['BlogCategories.id' => $key])->first();
if (!preg_match("/^([_]+)/i", $value, $matches)) {
$category->depth = 0;
$category->layered_title = $category->title;
Expand Down
2 changes: 1 addition & 1 deletion plugins/bc-blog/src/View/Helper/BlogHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;
use BaserCore\Annotation\UnitTest;
use BcMail\View\Helper\MailHelper;

/**
* ブログヘルパー
Expand Down Expand Up @@ -1296,7 +1297,6 @@ public function getEyeCatch($post, $options = [])
*/
public function mailFormLink($title, $contentsName, $datas = [], $options = [])
{
App::uses('MailHelper', 'BcMail.View/Helper');
$MailHelper = new MailHelper($this->_View);
$MailHelper->link($title, $contentsName, $datas, $options);
}
Expand Down
21 changes: 19 additions & 2 deletions plugins/bc-mail/src/View/Helper/MailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public function descriptionExists()

/**
* メールフォームへのリンクを生成する
* $contentsNameはコンテンツ管理上の1階層のみ対応
*
* @param string $title リンクのタイトル
* @param string $contentsName メールフォームのコンテンツ名
Expand All @@ -212,10 +213,26 @@ public function link($title, $contentsName, $datas = [], $options = [])
{
if ($datas && is_array($datas)) {
foreach ($datas as $key => $data) {
$datas[$key] = base64UrlsafeEncode($data);
$datas[$key] = BcUtil::base64UrlsafeEncode($data);
}
}
$link = array_merge(['plugin' => '', 'controller' => $contentsName, 'action' => 'index'], $datas);

$contentsTable = TableRegistry::getTableLocator()->get('BaserCore.Contents');
$content = $contentsTable->find('all')
->where([
'Contents.name' => $contentsName,
'Contents.plugin' => 'BcMail',
'Contents.type' => 'MailContent',
])
->first();

$link = [
'plugin' => 'BcMail',
'controller' => 'Mail',
'action' => 'index',
'entityId' => $content->entity_id,
'?' => $datas,
];
$this->BcBaser->link($title, $link, $options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function saveSearchIndex($searchIndex)
}

if (!empty($searchIndex['content_id'])) {
$content = $this->Contents->find()->select(['lft', 'rght'])->where(['id' => $searchIndex['content_id']])->first();
$content = $this->Contents->find()->select(['lft', 'rght'])->where(['Contents.id' => $searchIndex['content_id']])->first();
$searchIndex['lft'] = $content->lft;
$searchIndex['rght'] = $content->rght;
} else {
Expand Down

0 comments on commit c1d5935

Please sign in to comment.