Version 5.0.14
This commit is contained in:
1 parent
5efe744c5f
commit
dbd774b30c
364 files changed
+7048
-1377
No files matched your search
@@ -331,10 +331,10 @@ class Application extends SystemApplication
|
||||
'tab' => 'cms',
|
||||
'module_url' => 'databases',
|
||||
'controller' => 'records',
|
||||
'do' => 'manage&database_id=' . $database['id'],
|
||||
'do' => "&database_id={$database['id']}",
|
||||
'restriction' => 'records_manage',
|
||||
'restriction_module' => 'databases',
|
||||
'menu_checks' => array( 'do' => 'manage', 'database_id' => $database['id'] ),
|
||||
'menu_checks' => array( 'database_id' => $database['id'] ),
|
||||
'menu_controller' => 'records_' . $database['id']
|
||||
);
|
||||
|
||||
@@ -344,10 +344,10 @@ class Application extends SystemApplication
|
||||
'tab' => 'cms',
|
||||
'module_url' => 'databases',
|
||||
'controller' => 'categories',
|
||||
'do' => 'manage&database_id=' . $database['id'],
|
||||
'do' => "&database_id={$database['id']}",
|
||||
'restriction' => 'categories_manage',
|
||||
'restriction_module' => 'databases',
|
||||
'menu_checks' => array( 'do' => 'manage', 'database_id' => $database['id'] ),
|
||||
'menu_checks' => array( 'database_id' => $database['id'] ),
|
||||
'menu_controller' => 'categories_' . $database['id']
|
||||
);
|
||||
}
|
||||
@@ -356,10 +356,10 @@ class Application extends SystemApplication
|
||||
'tab' => 'cms',
|
||||
'module_url' => 'databases',
|
||||
'controller' => 'fields',
|
||||
'do' => 'manage&database_id=' . $database['id'],
|
||||
'do' => "&database_id={$database['id']}",
|
||||
'restriction' => 'cms_fields_manage',
|
||||
'restriction_module' => 'databases',
|
||||
'menu_checks' => array( 'do' => 'manage', 'database_id' => $database['id'] ),
|
||||
'menu_checks' => array( 'database_id' => $database['id'] ),
|
||||
'menu_controller' => 'fields_' . $database['id']
|
||||
);
|
||||
|
||||
|
||||
@@ -498,7 +498,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</article>]]></template>
|
||||
<template template_key="database_category_articles_index" template_title="index" template_desc="" template_location="database" template_group="category_articles" template_params="$database, $articles, $url, $pagination" template_app="" template_type="template"><![CDATA[<header class='ipsPageHeader ipsBox ipsPull ipsPageHeader--category-articles'>
|
||||
<template template_key="database_category_articles_index" template_title="index" template_desc="" template_location="database" template_group="category_articles" template_params="$database, $articles, $url, $pagination, $filters=array()" template_app="" template_type="template"><![CDATA[<header class='ipsPageHeader ipsBox ipsPull ipsPageHeader--category-articles'>
|
||||
<div class="ipsPageHeader__row">
|
||||
<div class='ipsPageHeader__primary'>
|
||||
<h1 class='ipsPageHeader__title'>{$database->_title}</h1>
|
||||
@@ -529,6 +529,18 @@
|
||||
</ul>
|
||||
{{endif}}
|
||||
|
||||
{{if !empty( $filters )}}
|
||||
<div class='ipsMessage ipsMessage--info'>
|
||||
<div class='i-flex i-flex-wrap_wrap-reverse i-gap_2 i-align-items_center'>
|
||||
<span>{lang="cms_database_filtered_by"}</span>
|
||||
<a href='{$database->page->url()->csrf()->setQueryString( array( "do" => "clearFilters" ) )}' class='ipsButton ipsButton--soft ipsButton--small'>{lang="cms_database_filtered_clear"}</a>
|
||||
</div>
|
||||
{{foreach $filters as $id => $data}}
|
||||
{$data['field']->_title} ({$data['value']})
|
||||
{{endforeach}}
|
||||
</div>
|
||||
{{endif}}
|
||||
|
||||
{{if \count($articles)}}
|
||||
<section class='ipsBox ipsBox--cmsCategoryArticles ipsPull'>
|
||||
<i-data>
|
||||
@@ -706,7 +718,7 @@ data-view-tracking-data="{expression="base64_encode(json_encode( $comment->getVi
|
||||
{{if $comment->author()->hasHighlightedReplies() || ( \IPS\IPS::classUsesTrait( $comment, 'IPS\Content\Reactable' ) and $comment->isHighlighted() ) OR $comment->isFeatured()}}
|
||||
<ul class='ipsBadges'>
|
||||
{{if $comment->author()->hasHighlightedReplies()}}
|
||||
<li><span class='ipsBadge ipsBadge--highlightedGroup'>{expression="\IPS\Member\Group::load( $comment->author()->member_group_id )->name" raw="true"}</span></li>
|
||||
<li><span class='ipsBadge ipsBadge--highlightedGroup'>{expression="\IPS\Member\Group::load( $comment->author()->highlightedGroup() )->name" raw="true"}</span></li>
|
||||
{{endif}}
|
||||
{{if $comment->isFeatured()}}
|
||||
<li><span class='ipsBadge ipsBadge--positive'>{lang="this_is_a_featured_post"}</span></li>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<javascript app="cms">
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/blocks" javascript_name="ips.blocks.form.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000100"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/blocks" javascript_name="ips.blocks.form.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000100"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/blocks" javascript_name="ips.blocks.navigation.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000050"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/blocks" javascript_name="ips.blocks.navigation.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000050"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.download.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000150">/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.download.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000150">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -160,7 +160,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.form.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000150"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/databases" javascript_name="ips.databases.form.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000150"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -236,7 +236,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/external" javascript_name="ips.external.communication.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000150"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/external" javascript_name="ips.external.communication.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000150"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -371,7 +371,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/fields" javascript_name="ips.fields.form.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000200"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/fields" javascript_name="ips.fields.form.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000200"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -461,7 +461,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/media" javascript_name="ips.media.main.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000300"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/media" javascript_name="ips.media.main.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000300"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1100,7 +1100,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.embed.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000250"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.embed.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000250"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1135,7 +1135,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.form.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000250"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/pages" javascript_name="ips.pages.form.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000250"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1257,7 +1257,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.form.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000100"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.form.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000100"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1369,7 +1369,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.revisions.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000100">/**
|
||||
<file javascript_app="cms" javascript_location="front" javascript_path="controllers/records" javascript_name="ips.records.revisions.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000100">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1424,7 +1424,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.addForm.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000050">/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.addForm.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000050">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1474,7 +1474,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.conflict.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000050">/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.conflict.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000050">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -1546,7 +1546,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileEditor.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000050"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileEditor.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000050"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -2507,7 +2507,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileList.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000050"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.fileList.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000050"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -2799,7 +2799,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.main.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000050"><![CDATA[/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.main.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000050"><![CDATA[/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -2968,7 +2968,7 @@
|
||||
|
||||
});
|
||||
}(jQuery, _));]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.variablesDialog.js" javascript_type="controller" javascript_version="5001302" javascript_position="1000050">/**
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="controllers/templates" javascript_name="ips.templates.variablesDialog.js" javascript_type="controller" javascript_version="5001403" javascript_position="1000050">/**
|
||||
* Invision Community
|
||||
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
|
||||
*
|
||||
@@ -3013,7 +3013,7 @@
|
||||
}
|
||||
});
|
||||
}(jQuery, _));</file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.media.js" javascript_type="template" javascript_version="5001302" javascript_position="1000050"><![CDATA[ips.templates.set( 'templates.media.grid', "\
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.media.js" javascript_type="template" javascript_version="5001403" javascript_position="1000050"><![CDATA[ips.templates.set( 'templates.media.grid', "\
|
||||
<ul class='ipsGrid ipsGrid--pages-media'>\
|
||||
{{{contents}}}\
|
||||
</ul>\
|
||||
@@ -3030,7 +3030,7 @@ ips.templates.set( 'templates.media.noSearchResults', "\
|
||||
{{#lang}}mediaNoResults{{/lang}}\
|
||||
</div>\
|
||||
");]]></file>
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.templates.js" javascript_type="template" javascript_version="5001302" javascript_position="1000050"><![CDATA[/* TEMPLATE EDITOR TEMPLATES */
|
||||
<file javascript_app="cms" javascript_location="admin" javascript_path="templates" javascript_name="ips.templates.templates.js" javascript_type="template" javascript_version="5001403" javascript_position="1000050"><![CDATA[/* TEMPLATE EDITOR TEMPLATES */
|
||||
/* TEMPLATECEPTION */
|
||||
ips.templates.set('templates.editor.newTab', " \
|
||||
<a href='#' class='ipsTabs__tab' id='ipsTabs_elTemplateEditor_tabbar_tab_{{fileid}}' role='tab' aria-controls='ipsTabs_elTemplateEditor_tabbar_tab_{{fileid}}_panel' aria-selected='false' data-fileid='{{fileid}}' data-location='{{location}}'>{{title}} <span data-action='closeTab'><i class='fa-solid fa-xmark'></i></span></a>\
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language>
|
||||
<app key="cms" version="5001302">
|
||||
<app key="cms" version="5001403">
|
||||
<word key="__app_cms" js="0">Pages</word>
|
||||
<word key="menutab__cms" js="0">Pages</word>
|
||||
<word key="menutab__cms_icon" js="0">file</word>
|
||||
|
||||
@@ -1241,7 +1241,11 @@
|
||||
</div>
|
||||
]]></template>
|
||||
<template template_group="widgets" template_name="Database" template_data="$database, $layout='table', $isCarousel=false" template_location="front" template_app="cms"><![CDATA[{database="$database->id" title="$database->title"}]]></template>
|
||||
<template template_group="widgets" template_name="DatabaseFilters" template_data="$database, $category, $form, $layout='table', $isCarousel=false" template_location="front" template_app="cms"><![CDATA[<h3 class='ipsWidget__header'>{lang="block_DatabaseFilters_title" sprintf="$category->_title"}</h3>
|
||||
<template template_group="widgets" template_name="DatabaseFilters" template_data="$database, $category, $form, $layout='table', $isCarousel=false" template_location="front" template_app="cms"><![CDATA[{{if $category !== null}}
|
||||
<h3 class='ipsWidget__header'>{lang="block_DatabaseFilters_title" sprintf="$category->_title"}</h3>
|
||||
{{else}}
|
||||
<h3 class='ipsWidget__header'>{lang="block_DatabaseFilters_title" sprintf="$database->_title"}</h3>
|
||||
{{endif}}
|
||||
<div class='ipsWidget__content'>
|
||||
{$form|raw}
|
||||
</div>
|
||||
|
||||
@@ -275,6 +275,19 @@
|
||||
"107799": "4.7.20 Beta 5",
|
||||
"107800": "4.7.20",
|
||||
"107801": "4.7.20",
|
||||
"107802": "4.7.20",
|
||||
"107803": "4.7.20",
|
||||
"107810": "4.7.21 Beta 1",
|
||||
"107811": "4.7.21",
|
||||
"107815": "4.7.22 Beta 1",
|
||||
"107816": "4.7.22 Beta 2",
|
||||
"107817": "4.7.22",
|
||||
"107818": "4.7.22",
|
||||
"107819": "4.7.22",
|
||||
"107820": "4.7.22",
|
||||
"107826": "4.7.23 Beta 1",
|
||||
"107827": "4.7.23",
|
||||
"107828": "4.7.23",
|
||||
"500001": "5.0.0 Alpha 1",
|
||||
"500002": "5.0.0 Alpha 2",
|
||||
"5000003": "5.0.0 Alpha 3",
|
||||
@@ -397,5 +410,9 @@
|
||||
"5001204": "5.0.12",
|
||||
"5001300": "5.0.13 Beta 1",
|
||||
"5001301": "5.0.13 Beta 2",
|
||||
"5001302": "5.0.13"
|
||||
"5001302": "5.0.13",
|
||||
"5001400": "5.0.14 Beta 1",
|
||||
"5001401": "5.0.14 Beta 1",
|
||||
"5001402": "5.0.14 Beta 2",
|
||||
"5001403": "5.0.14"
|
||||
}
|
||||
@@ -122,18 +122,15 @@ class Records extends SearchContentAbstract
|
||||
*/
|
||||
public function searchIndexPermissions(): string
|
||||
{
|
||||
if( $this->object instanceof BaseRecords )
|
||||
{
|
||||
/* We don't want to index items in databases with search disabled */
|
||||
if( !$this->object::database()->search )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
$record = ( $this->object instanceof BaseComment ) ? $this->object->item() : $this->object;
|
||||
|
||||
return $this->object->deleteLogPermissions();
|
||||
/* We don't want to index items in databases with search disabled */
|
||||
if( !$record::database()->search )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return parent::searchIndexPermissions();
|
||||
return $record->deleteLogPermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -92,7 +92,7 @@ class category extends Controller
|
||||
try
|
||||
{
|
||||
$category = $catClass::loadAndCheckPerms( Dispatcher::i()->categoryId );
|
||||
$category->saveFilterCookie( FALSE );
|
||||
$category::database()->saveFilterCookie( false, $category );
|
||||
|
||||
Output::i()->redirect( $category->url(), 'cms_filters_cleared' );
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class category extends Controller
|
||||
|
||||
/* Check cookie */
|
||||
$where = array();
|
||||
$cookie = $category->getFilterCookie();
|
||||
$cookie = $category::database()->getFilterCookie( $category );
|
||||
|
||||
if ( $cookie !== NULL )
|
||||
{
|
||||
@@ -192,7 +192,7 @@ class category extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$where = $category->buildWhereFromCookie( $cookie );
|
||||
$where = $category::database()->buildWhereFromCookie( $cookie, $category );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ use IPS\cms\Categories;
|
||||
use IPS\cms\Databases;
|
||||
use IPS\cms\Databases\Controller;
|
||||
use IPS\cms\Databases\Dispatcher;
|
||||
use IPS\cms\Fields;
|
||||
use IPS\cms\Pages\Page;
|
||||
use IPS\cms\Records;
|
||||
use IPS\Content\Filter;
|
||||
@@ -28,6 +29,7 @@ use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Session;
|
||||
use IPS\Theme;
|
||||
use IPS\Xml\Rss;
|
||||
use OutOfRangeException;
|
||||
@@ -47,6 +49,12 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class index extends Controller
|
||||
{
|
||||
/**
|
||||
* Store any active filters for this view
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
static public array $activeFilters = array();
|
||||
|
||||
/**
|
||||
* Determine which method to load
|
||||
@@ -139,13 +147,10 @@ class index extends Controller
|
||||
|
||||
$where = [];
|
||||
|
||||
/** @var Categories $categoryClass */
|
||||
$categoryClass = 'IPS\cms\Categories' . $database->id;
|
||||
$category = $categoryClass::load( $database->_default_category );
|
||||
$cookie = $category->getFilterCookie();
|
||||
$cookie = $database->getFilterCookie();
|
||||
if( $cookie !== null )
|
||||
{
|
||||
$where = $category->buildWhereFromCookie( $cookie );
|
||||
$where = $database->buildWhereFromCookie( $cookie );
|
||||
}
|
||||
elseif( isset( Request::i()->advanced_search_submitted ) and Request::i()->advanced_search_submitted )
|
||||
{
|
||||
@@ -163,7 +168,59 @@ class index extends Controller
|
||||
}
|
||||
if( count( $cookie ) )
|
||||
{
|
||||
$where = $category->buildWhereFromCookie( $cookie );
|
||||
$where = $database->buildWhereFromCookie( $cookie );
|
||||
}
|
||||
}
|
||||
|
||||
/* Build the filters */
|
||||
/* @var Fields $fieldClass */
|
||||
$fieldClass = 'IPS\cms\Fields' . $database->id;
|
||||
$customFields = $fieldClass::data( 'view', null, $fieldClass::FIELD_SKIP_TITLE_CONTENT );
|
||||
if( $cookie !== null )
|
||||
{
|
||||
foreach( $cookie as $f => $v )
|
||||
{
|
||||
if( $f == 'cms_record_i_started' and Member::loggedIn()->member_id )
|
||||
{
|
||||
/* FilterMessage template only accepts \IPS\cms\Fields */
|
||||
$field = new Fields;
|
||||
$field->id = 'cms_record_i_started';
|
||||
|
||||
Member::loggedIn()->language()->words['content_field_cms_record_i_started'] = Member::loggedIn()->language()->addToStack( 'cms_record_i_started_sprintf', FALSE, array( 'sprintf' => $database->recordWord() ) );
|
||||
|
||||
static::$activeFilters['cms_record_i_started'] = array( 'field' => $field, 'value' => Member::loggedIn()->language()->addToStack('content_field_cms_record_i_started_on') );
|
||||
}
|
||||
else
|
||||
{
|
||||
$displayValue = $customFields[ $f ]->displayValue( $v );
|
||||
|
||||
if ( $customFields[ $f ]->type === 'Member' )
|
||||
{
|
||||
if ( ! empty( $v ) )
|
||||
{
|
||||
$newDisplayValue = array();
|
||||
$concat = '\n';
|
||||
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
foreach( $v as $m )
|
||||
{
|
||||
$member = Member::load( $m );
|
||||
$newDisplayValue[] = $member->name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$member = Member::load( $v );
|
||||
$newDisplayValue[] = $member->name;
|
||||
}
|
||||
|
||||
$displayValue = implode( ', ', $newDisplayValue );
|
||||
}
|
||||
}
|
||||
|
||||
static::$activeFilters[ $f ] = array( 'field' => $customFields[ $f ], 'value' => $displayValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +251,7 @@ class index extends Controller
|
||||
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'database_index/featured.css', 'cms', 'front' ) );
|
||||
Output::i()->title = ( $page > 1 ) ? Member::loggedIn()->language()->addToStack( 'title_with_page_number', FALSE, array( 'sprintf' => array( $database->pageTitle(), $page ) ) ) : $database->pageTitle();
|
||||
|
||||
Dispatcher::i()->output .= Output::i()->output = \IPS\cms\Theme::i()->getTemplate( $database->template_featured, 'cms', 'database' )->index( $database, $articles, $url, $pagination );
|
||||
Dispatcher::i()->output .= Output::i()->output = \IPS\cms\Theme::i()->getTemplate( $database->template_featured, 'cms', 'database' )->index( $database, $articles, $url, $pagination, static::$activeFilters );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -275,4 +332,19 @@ class index extends Controller
|
||||
Output::i()->breadcrumb[] = array( NULL, Member::loggedIn()->language()->addToStack( 'cms_select_category' ) );
|
||||
Dispatcher::i()->output = Output::i()->output = Theme::i()->getTemplate( 'records' )->categorySelector( $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear any filters
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clearFilters() : void
|
||||
{
|
||||
Session::i()->csrfCheck();
|
||||
|
||||
$database = Databases::load( Dispatcher::i()->databaseId );
|
||||
$database->saveFilterCookie( false );
|
||||
|
||||
Output::i()->redirect( $database->page->url(), 'cms_filters_cleared' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107802,
|
||||
"name": "4.7.20",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107803,
|
||||
"name": "4.7.20",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107810,
|
||||
"name": "4.7.21 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": true,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"added": [
|
||||
"sitemap_databases_count"
|
||||
],
|
||||
"edited": [],
|
||||
"removed": []
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107811,
|
||||
"name": "4.7.21",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107815,
|
||||
"name": "4.7.22 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107816,
|
||||
"name": "4.7.22 Beta 2",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107817,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107818,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107819,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107820,
|
||||
"name": "4.7.22",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107826,
|
||||
"name": "4.7.23 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107827,
|
||||
"name": "4.7.23",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": 107828,
|
||||
"name": "4.7.23",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeSettings": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"hooks": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"id": 5001400,
|
||||
"name": "5.0.14 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": true,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"html": {
|
||||
"added": [],
|
||||
"edited": [
|
||||
"front\/widgets\/DatabaseFilters"
|
||||
],
|
||||
"removed": []
|
||||
},
|
||||
"css": {
|
||||
"added": [],
|
||||
"edited": [],
|
||||
"removed": []
|
||||
},
|
||||
"resources": {
|
||||
"added": [],
|
||||
"edited": [],
|
||||
"removed": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"id": 5001401,
|
||||
"name": "5.0.14 Beta 1",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"id": 5001402,
|
||||
"name": "5.0.14 Beta 2",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"id": 5001403,
|
||||
"name": "5.0.14",
|
||||
"steps": {
|
||||
"queries": false,
|
||||
"lang": false,
|
||||
"theme": false,
|
||||
"themeeditor": false,
|
||||
"javascript": false,
|
||||
"emailTemplates": false,
|
||||
"acpSearchKeywords": false,
|
||||
"settings": false,
|
||||
"tasks": false,
|
||||
"modules": false,
|
||||
"widgets": false,
|
||||
"customOptions": false,
|
||||
"customRoutines": false
|
||||
},
|
||||
"forceMainUpgrader": false,
|
||||
"forceManualDownloadNoCiC": false,
|
||||
"forceManualDownloadCiC": false
|
||||
}
|
||||
@@ -2077,175 +2077,6 @@ class Categories extends Model implements Permissions
|
||||
Index::i()->massUpdate( 'IPS\cms\Records\Comment' . static::database()->_id, $this->_id, NULL, $permissions, NULL, NULL, NULL, NULL, NULL, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter cookie for this category
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getFilterCookie(): ?array
|
||||
{
|
||||
if ( isset( Request::i()->cookie['cms_filters'] ) )
|
||||
{
|
||||
$saved = json_decode( Request::i()->cookie['cms_filters'], TRUE );
|
||||
|
||||
if ( array_key_exists( $this->id, $saved ) and count( $saved[ $this->id ] ) )
|
||||
{
|
||||
return $saved[ $this->id ];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save filter cookie for this category
|
||||
*
|
||||
* @param array|bool $values Filter values to save (array) or FALSE to remove cookie
|
||||
* @return void
|
||||
*/
|
||||
public function saveFilterCookie( array|bool $values ): void
|
||||
{
|
||||
$cookie = ( isset( Request::i()->cookie['cms_filters'] ) ) ? json_decode( Request::i()->cookie['cms_filters'], TRUE ) : array();
|
||||
|
||||
if ( $values === FALSE )
|
||||
{
|
||||
if ( array_key_exists( $this->id, $cookie ) )
|
||||
{
|
||||
unset( $cookie[ $this->id ] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We only want to include ones where we have actually specified values to filter on */
|
||||
$toSave = array();
|
||||
foreach( $values AS $key => $data )
|
||||
{
|
||||
if ( is_numeric( $key ) or $key == 'cms_record_i_started' )
|
||||
{
|
||||
$toSave[$key] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
$cookie[ $this->id ] = $toSave;
|
||||
}
|
||||
|
||||
Request::i()->setCookie( 'cms_filters', json_encode( $cookie ), DateTime::create()->add( new DateInterval( 'P7D' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the cookie to build filters
|
||||
*
|
||||
* @param array $cookie
|
||||
* @return array
|
||||
*/
|
||||
public function buildWhereFromCookie( array $cookie ) : array
|
||||
{
|
||||
$where = [];
|
||||
$database = static::database();
|
||||
|
||||
/** @var Fields $fieldClass */
|
||||
$fieldClass = 'IPS\cms\Fields' . $database->id;
|
||||
$customFields = $fieldClass::data( 'view', $this, $fieldClass::FIELD_SKIP_TITLE_CONTENT );
|
||||
|
||||
foreach( $cookie as $f => $v )
|
||||
{
|
||||
if ( $f == 'cms_record_i_started' and Member::loggedIn()->member_id )
|
||||
{
|
||||
$where[] = array( 'cms_custom_database_' . $database->id . '.member_id=' . Member::loggedIn()->member_id );
|
||||
continue;
|
||||
}
|
||||
|
||||
$k = 'content_field_' . $f;
|
||||
|
||||
if ( $customFields[ $f ]->type === 'Member' )
|
||||
{
|
||||
if ( ! empty( $v ) )
|
||||
{
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
foreach( $v as $m )
|
||||
{
|
||||
$member = Member::load( $m );
|
||||
$where[] = [ "FIND_IN_SET( " . $member->member_id . ", REPLACE(field_" . $f . ", '\n',','))" ];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$member = Member::load( $v );
|
||||
$where[] = [ "FIND_IN_SET( " . $member->member_id . ", REPLACE(field_" . $f . ", '\n',','))" ];
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $customFields[ $f ] ) and $v !== '___any___' )
|
||||
{
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
if ( array_key_exists( 'start', $v ) or array_key_exists( 'end', $v ) )
|
||||
{
|
||||
$start = ( $v['start'] instanceof DateTime ) ? $v['start']->getTimestamp() : intval( $v['start'] );
|
||||
$end = ( $v['end'] instanceof DateTime ) ? $v['end']->getTimestamp() : intval( $v['end'] );
|
||||
|
||||
if ( $start or $end )
|
||||
{
|
||||
$where[] = array( '( ' . mb_substr( $k, 8 ) . ' BETWEEN ' . $start . ' AND ' . $end . ' )' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$like = array();
|
||||
foreach( $v as $val )
|
||||
{
|
||||
if ( $val === 0 or ! empty( $val ) )
|
||||
{
|
||||
$like[] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if( $customFields[ $f ]->default_value and in_array( $customFields[ $f ]->default_value, $v ) )
|
||||
{
|
||||
$where[] = array( "( " . mb_substr( $k, 8 ) . " IS NULL OR " . Db::i()->findInSet( mb_substr( $k, 8 ), $like ) . ")" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( Db::i()->findInSet( mb_substr( $k, 8 ), $like ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( is_bool( $v ) )
|
||||
{
|
||||
/* YesNo fields are false or true */
|
||||
if ( $v === false )
|
||||
{
|
||||
$where[] = array( '(' . mb_substr( $k, 8 ) . ' IS NULL or ' . mb_substr( $k, 8 ) . '=0)' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( mb_substr( $k, 8 ) . "=1" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $v !== 0 and ! $v )
|
||||
{
|
||||
$where[] = array( mb_substr( $k, 8 ) . " IS NULL" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( mb_substr( $k, 8 ) . "=?", $v );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* [Node] Get meta description
|
||||
|
||||
@@ -13,12 +13,14 @@ namespace IPS\cms;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use DateInterval;
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\cms\Pages\Page;
|
||||
use IPS\Content\Search\Index;
|
||||
use IPS\Content\ViewUpdates;
|
||||
use IPS\Data\Store;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\File;
|
||||
@@ -32,6 +34,7 @@ use IPS\Node\Permissions;
|
||||
use IPS\Patterns\ActiveRecord;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Platform\Bridge;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use IPS\Task;
|
||||
use IPS\Widget\Area;
|
||||
@@ -1490,6 +1493,179 @@ class Databases extends Model implements Permissions
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter cookie for this category/database
|
||||
*
|
||||
* @param Categories|null $category
|
||||
* @return array|null
|
||||
*/
|
||||
public function getFilterCookie( ?Categories $category=null ): ?array
|
||||
{
|
||||
$key = $category ? $category->id : 'd' . $this->id;
|
||||
if ( isset( Request::i()->cookie['cms_filters'] ) )
|
||||
{
|
||||
$saved = json_decode( Request::i()->cookie['cms_filters'], TRUE );
|
||||
|
||||
if ( array_key_exists( $key, $saved ) and count( $saved[ $key ] ) )
|
||||
{
|
||||
return $saved[ $key ];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save filter cookie for this category
|
||||
*
|
||||
* @param array|bool $values Filter values to save (array) or FALSE to remove cookie
|
||||
* @param Categories|null $category
|
||||
* @return void
|
||||
*/
|
||||
public function saveFilterCookie( array|bool $values, ?Categories $category=null ): void
|
||||
{
|
||||
$key = $category ? $category->id : 'd' . $this->id;
|
||||
$cookie = ( isset( Request::i()->cookie['cms_filters'] ) ) ? json_decode( Request::i()->cookie['cms_filters'], TRUE ) : array();
|
||||
|
||||
if ( $values === FALSE )
|
||||
{
|
||||
if ( array_key_exists( $key, $cookie ) )
|
||||
{
|
||||
unset( $cookie[ $key ] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We only want to include ones where we have actually specified values to filter on */
|
||||
$toSave = array();
|
||||
foreach( $values AS $k => $v )
|
||||
{
|
||||
if ( is_numeric( $k ) or $k == 'cms_record_i_started' )
|
||||
{
|
||||
$toSave[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$cookie[ $key ] = $toSave;
|
||||
}
|
||||
|
||||
Request::i()->setCookie( 'cms_filters', json_encode( $cookie ), DateTime::create()->add( new DateInterval( 'P7D' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the cookie to build filters
|
||||
*
|
||||
* @param array $cookie
|
||||
* @param Categories|null $category
|
||||
* @return array
|
||||
*/
|
||||
public function buildWhereFromCookie( array $cookie, ?Categories $category=null ) : array
|
||||
{
|
||||
$where = [];
|
||||
|
||||
/** @var Fields $fieldClass */
|
||||
$fieldClass = 'IPS\cms\Fields' . $this->id;
|
||||
$customFields = $fieldClass::data( 'view', $category, $fieldClass::FIELD_SKIP_TITLE_CONTENT );
|
||||
|
||||
foreach( $cookie as $f => $v )
|
||||
{
|
||||
if ( $f == 'cms_record_i_started' and Member::loggedIn()->member_id )
|
||||
{
|
||||
$where[] = array( 'cms_custom_database_' . $this->id . '.member_id=' . Member::loggedIn()->member_id );
|
||||
continue;
|
||||
}
|
||||
|
||||
$k = 'content_field_' . $f;
|
||||
|
||||
if ( $customFields[ $f ]->type === 'Member' )
|
||||
{
|
||||
if ( ! empty( $v ) )
|
||||
{
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
foreach( $v as $m )
|
||||
{
|
||||
$member = Member::load( $m );
|
||||
$where[] = [ "FIND_IN_SET( " . $member->member_id . ", REPLACE(field_" . $f . ", '\n',','))" ];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$member = Member::load( $v );
|
||||
$where[] = [ "FIND_IN_SET( " . $member->member_id . ", REPLACE(field_" . $f . ", '\n',','))" ];
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $customFields[ $f ] ) and $v !== '___any___' )
|
||||
{
|
||||
if ( is_array( $v ) )
|
||||
{
|
||||
if ( array_key_exists( 'start', $v ) or array_key_exists( 'end', $v ) )
|
||||
{
|
||||
$start = ( $v['start'] instanceof DateTime ) ? $v['start']->getTimestamp() : intval( $v['start'] );
|
||||
$end = ( $v['end'] instanceof DateTime ) ? $v['end']->getTimestamp() : intval( $v['end'] );
|
||||
|
||||
if ( $start or $end )
|
||||
{
|
||||
$where[] = array( '( ' . mb_substr( $k, 8 ) . ' BETWEEN ' . $start . ' AND ' . $end . ' )' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$like = array();
|
||||
foreach( $v as $val )
|
||||
{
|
||||
if ( $val === 0 or ! empty( $val ) )
|
||||
{
|
||||
$like[] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if( $customFields[ $f ]->default_value and in_array( $customFields[ $f ]->default_value, $v ) )
|
||||
{
|
||||
$where[] = array( "( " . mb_substr( $k, 8 ) . " IS NULL OR " . Db::i()->findInSet( mb_substr( $k, 8 ), $like ) . ")" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( Db::i()->findInSet( mb_substr( $k, 8 ), $like ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( is_bool( $v ) )
|
||||
{
|
||||
/* YesNo fields are false or true */
|
||||
if ( $v === false )
|
||||
{
|
||||
$where[] = array( '(' . mb_substr( $k, 8 ) . ' IS NULL or ' . mb_substr( $k, 8 ) . '=0)' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( mb_substr( $k, 8 ) . "=1" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $v !== 0 and ! $v )
|
||||
{
|
||||
$where[] = array( mb_substr( $k, 8 ) . " IS NULL" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( mb_substr( $k, 8 ) . "=?", $v );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get output for API
|
||||
*
|
||||
|
||||
@@ -1241,7 +1241,7 @@ class Fields extends CustomField implements Permissions
|
||||
*/
|
||||
public function get_display_json(): array
|
||||
{
|
||||
return ( is_array( $this->_data['display_json'] ) ) ? $this->_data['display_json'] : json_decode( $this->_data['display_json'], TRUE );
|
||||
return ( is_array( $this->_data['display_json'] ) ) ? $this->_data['display_json'] : ( isset( $this->_data['display_json'] ) ? json_decode( $this->_data['display_json'], TRUE ) : [] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1268,6 +1268,13 @@ class Page extends Model implements Permissions
|
||||
try
|
||||
{
|
||||
$template = Templates::load( $key );
|
||||
|
||||
/* If this is an empty file, don't bother loading it */
|
||||
if( empty( $template->content ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$object = $template->_file_object;
|
||||
|
||||
$return['js'][ $key ] = $object;
|
||||
@@ -1287,6 +1294,13 @@ class Page extends Model implements Permissions
|
||||
try
|
||||
{
|
||||
$template = Templates::load( $key );
|
||||
|
||||
/* Skip if empty */
|
||||
if( empty( $template->content ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$object = $template->_file_object;
|
||||
|
||||
$return['css'][ $key ] = $object;
|
||||
|
||||
@@ -3771,7 +3771,11 @@ class Records extends Item implements
|
||||
{
|
||||
$title = '';
|
||||
|
||||
if( $prefix = static::database()->forum_prefix )
|
||||
if ( $prefix = $this->container()->forum_prefix )
|
||||
{
|
||||
$title .= $prefix . ' ';
|
||||
}
|
||||
else if( $prefix = static::database()->forum_prefix )
|
||||
{
|
||||
$title .= $prefix . ' ';
|
||||
}
|
||||
@@ -3779,7 +3783,11 @@ class Records extends Item implements
|
||||
$column = 'field_' . static::database()->field_title;
|
||||
$title .= $this->$column;
|
||||
|
||||
if( $suffix = static::database()->forum_suffix )
|
||||
if ( $suffix = $this->container()->forum_suffix )
|
||||
{
|
||||
$title .= ' ' . $suffix;
|
||||
}
|
||||
else if( $suffix = static::database()->forum_suffix )
|
||||
{
|
||||
$title .= ' ' . $suffix;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,11 @@ class Codemirror extends Widget
|
||||
{
|
||||
$form = parent::configuration( $form );
|
||||
|
||||
if( !Dispatcher::i()->checkAcpPermission( 'theme_sets_manage', 'core', Module::get( 'core', 'customization', 'admin' ), true ) )
|
||||
{
|
||||
return $form;
|
||||
}
|
||||
|
||||
$form->add(
|
||||
new Form\TextArea(
|
||||
'content',
|
||||
@@ -111,6 +116,11 @@ class Codemirror extends Widget
|
||||
*/
|
||||
public function preConfig( array $values=array() ) : array
|
||||
{
|
||||
if( !array_key_exists( 'content', $values ) )
|
||||
{
|
||||
$values['content'] = $this->configuration['content'];
|
||||
}
|
||||
|
||||
$functionName = 'content_widget_' . $this->uniqueKey;
|
||||
if ( isset( Store::i()->$functionName ) )
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace IPS\cms\widgets;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use DateInterval;
|
||||
use Exception;
|
||||
use IPS\cms\Categories;
|
||||
use IPS\cms\Databases;
|
||||
@@ -85,7 +86,7 @@ class DatabaseFilters extends Widget
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( ! Dispatcher::i()->databaseId AND ! Dispatcher::i()->categoryId )
|
||||
if ( ! Dispatcher::i()->databaseId )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
@@ -99,24 +100,36 @@ class DatabaseFilters extends Widget
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
$category = null;
|
||||
if( isset( Dispatcher::i()->categoryId ) )
|
||||
{
|
||||
/* @var Categories $categoryClass */
|
||||
$categoryClass = "IPS\cms\Categories" . Dispatcher::i()->databaseId;
|
||||
$category = $categoryClass::load( Dispatcher::i()->categoryId );
|
||||
try
|
||||
{
|
||||
/* @var Categories $categoryClass */
|
||||
$categoryClass = "IPS\cms\Categories" . Dispatcher::i()->databaseId;
|
||||
$category = $categoryClass::load( Dispatcher::i()->categoryId );
|
||||
}
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
catch ( OutOfRangeException $e )
|
||||
else
|
||||
{
|
||||
return '';
|
||||
/* Is this the category view? */
|
||||
if( $database->display_settings['index']['type'] == 'categories' or isset( Request::i()->show ) )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/* @var Fields $fieldClass */
|
||||
$fieldClass = 'IPS\cms\Fields' . $database->id;
|
||||
|
||||
$fields = array();
|
||||
$cookie = $category->getFilterCookie();
|
||||
$cookieValues = ( $cookie !== NULL ) ? array_combine( array_map( function( $k ) { return "field_" . $k; }, array_keys( $cookie ) ), $cookie ) : array();
|
||||
$cookie = $database->getFilterCookie( $category );
|
||||
$cookieValues = ( !empty( $cookie ) ) ? array_combine( array_map( function( $k ) { return "field_" . $k; }, array_keys( $cookie ) ), $cookie ) : array();
|
||||
$databaseFields = $fieldClass::roots();
|
||||
|
||||
$urlValues = array();
|
||||
@@ -186,7 +199,8 @@ class DatabaseFilters extends Widget
|
||||
|
||||
if ( count( $fields ) )
|
||||
{
|
||||
$form = new Form( 'category_filters', 'update', $category->url() );
|
||||
$baseUrl = $category ? $category->url() : $database->page->url();
|
||||
$form = new Form( 'category_filters', 'update', $baseUrl );
|
||||
$form->class = 'ipsForm--vertical ipsForm--database-widget-filters';
|
||||
if ( Request::i()->sortby )
|
||||
{
|
||||
@@ -233,7 +247,7 @@ class DatabaseFilters extends Widget
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$url = $category->url()->setQueryString( array( 'advanced_search_submitted' => 1 ) );
|
||||
$url = $baseUrl->setQueryString( array( 'advanced_search_submitted' => 1 ) );
|
||||
$cookie = array();
|
||||
$params = array();
|
||||
foreach( $values as $k => $v )
|
||||
@@ -308,13 +322,13 @@ class DatabaseFilters extends Widget
|
||||
|
||||
if ( $values['cms_widget_filters_remember'] )
|
||||
{
|
||||
$category->saveFilterCookie( $cookie );
|
||||
Output::i()->redirect( $category->url() );
|
||||
$database->saveFilterCookie( $cookie, $category );
|
||||
Output::i()->redirect( $baseUrl );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove the filter cookie */
|
||||
$category->saveFilterCookie( FALSE );
|
||||
$database->saveFilterCookie( false, $category );
|
||||
Output::i()->redirect( $url->setQueryString( $params ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user