mirror of
https://github.com/flextype/flextype.git
synced 2025-08-24 13:52:56 +02:00
Merge branch 'dev'
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,3 +1,14 @@
|
||||
## [0.9.3] - 2019-07-07
|
||||
### Fixed
|
||||
- Flextype Core: Entries - issue with binding arguments inside method fetchAll() - fixed. #182
|
||||
- Flextype Core: Entries - issue with possible boolean false result from Filesystem::getTimestamp() inside method fetchAll() - fixed. #182
|
||||
- Flextype Core: Entries - issue with possible boolean false result from Filesystem::getTimestamp() inside method fetch() - fixed. #182
|
||||
- Flextype Admin Panel: critical issue with possibility to register two admins! - fixed. #183 #182
|
||||
- Flextype Admin Panel: Left Navigation - active state for Templates area - fixed. #182
|
||||
- Flextype Default Theme: issue with `TypeError: undefined is not an object` for lightbox - fixed. #182
|
||||
- Flextype Default Theme: fix thumbnail image for Default Theme #182
|
||||
|
||||
|
||||
## [0.9.2] - 2019-07-06
|
||||
### Added
|
||||
- Flextype Default Theme: pagination for blog entries added. #164 #165
|
||||
|
@@ -128,6 +128,7 @@ Flextype is open source, community driven project, and maintained by community!
|
||||
|
||||
* [Github Repository](https://github.com/flextype/flextype)
|
||||
* [Discord](https://discord.gg/CCKPKVG)
|
||||
* [Forum](http://forum.flextype.org)
|
||||
* [Vkontakte](https://vk.com/flextype)
|
||||
* [Twitter](https://twitter.com/getflextype)
|
||||
|
||||
|
@@ -21,7 +21,7 @@ use Flextype\Component\Filesystem\Filesystem;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
define('FLEXTYPE_VERSION', '0.9.2');
|
||||
define('FLEXTYPE_VERSION', '0.9.3');
|
||||
|
||||
/**
|
||||
* Start the session
|
||||
|
@@ -70,7 +70,11 @@ class Entries
|
||||
|
||||
// Create unique entry cache_id
|
||||
// Entry Cache ID = entry + entry file + entry file time stamp
|
||||
$entry_cache_id = md5('entry' . $entry_file . Filesystem::getTimestamp($entry_file));
|
||||
if ($timestamp = Filesystem::getTimestamp($entry_file)) {
|
||||
$entry_cache_id = md5('entry' . $entry_file . $timestamp);
|
||||
} else {
|
||||
$entry_cache_id = md5('entry' . $entry_file);
|
||||
}
|
||||
|
||||
// Try to get the requested entry from cache
|
||||
if ($this->flextype['cache']->contains($entry_cache_id)) {
|
||||
@@ -178,6 +182,7 @@ class Entries
|
||||
|
||||
// Bind: where
|
||||
if (isset($args['where']['key']) && isset($args['where']['expr']) && isset($args['where']['value'])) {
|
||||
$bind_where = [];
|
||||
$bind_where['where']['key'] = $args['where']['key'];
|
||||
$bind_where['where']['expr'] = $expression[$args['where']['expr']];
|
||||
$bind_where['where']['value'] = $args['where']['value'];
|
||||
@@ -187,6 +192,7 @@ class Entries
|
||||
|
||||
// Bind: and where
|
||||
if (isset($args['and_where']['key']) && isset($args['and_where']['expr']) && isset($args['and_where']['value'])) {
|
||||
$bind_and_where = [];
|
||||
$bind_and_where['and_where']['key'] = $args['and_where']['key'];
|
||||
$bind_and_where['and_where']['expr'] = $expression[$args['and_where']['expr']];
|
||||
$bind_and_where['and_where']['value'] = $args['and_where']['value'];
|
||||
@@ -196,6 +202,7 @@ class Entries
|
||||
|
||||
// Bind: or where
|
||||
if (isset($args['or_where']['key']) && isset($args['or_where']['expr']) && isset($args['or_where']['value'])) {
|
||||
$bind_or_where = [];
|
||||
$bind_or_where['or_where']['key'] = $args['or_where']['key'];
|
||||
$bind_or_where['or_where']['expr'] = $expression[$args['or_where']['expr']];
|
||||
$bind_or_where['or_where']['value'] = $args['or_where']['value'];
|
||||
@@ -205,6 +212,7 @@ class Entries
|
||||
|
||||
// Bind: order by
|
||||
if (isset($args['order_by']['field']) && isset($args['order_by']['direction'])) {
|
||||
$bind_order_by = [];
|
||||
$bind_order_by['order_by']['field'] = $args['order_by']['field'];
|
||||
$bind_order_by['order_by']['direction'] = $args['order_by']['direction'];
|
||||
} else {
|
||||
@@ -226,7 +234,11 @@ class Entries
|
||||
// ignore ...
|
||||
} else {
|
||||
if ($current_entry['type'] == 'dir' && Filesystem::has($current_entry['path'] . '/entry.json')) {
|
||||
$_entries_ids .= 'entry:' . ltrim(rtrim(str_replace(PATH['entries'], '', $current_entry['path']), '/'), '/') . ' timestamp:' . Filesystem::getTimestamp($current_entry['path'] . '/entry.json') . ' ';
|
||||
if ($timestamp = Filesystem::getTimestamp($current_entry['path'] . '/entry.json')) {
|
||||
$_entries_ids .= 'entry:' . ltrim(rtrim(str_replace(PATH['entries'], '', $current_entry['path']), '/'), '/') . ' timestamp:' . $timestamp;
|
||||
} else {
|
||||
$_entries_ids .= 'entry:' . ltrim(rtrim(str_replace(PATH['entries'], '', $current_entry['path']), '/'), '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ class TemplatesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/themes/templates/add.html',
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'menu_item' => 'themes',
|
||||
'theme' => $theme,
|
||||
'links' => [
|
||||
'themes' => [
|
||||
@@ -153,7 +153,7 @@ class TemplatesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/themes/templates/edit.html',
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'menu_item' => 'themes',
|
||||
'theme' => $theme,
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => Filesystem::read(PATH['themes'] . '/' . $theme . '/' . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'),
|
||||
@@ -227,7 +227,7 @@ class TemplatesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/themes/templates/rename.html',
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'menu_item' => 'themes',
|
||||
'theme' => $theme,
|
||||
'types' => ['partial' => __('admin_partial'), 'template' => __('admin_template')],
|
||||
'id_current' => $request->getQueryParams()['id'],
|
||||
|
@@ -6,6 +6,8 @@ use Flextype\Component\Filesystem\Filesystem;
|
||||
use Flextype\Component\Session\Session;
|
||||
use Flextype\Component\Text\Text;
|
||||
use function Flextype\Component\I18n\__;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
/**
|
||||
* @property View $view
|
||||
@@ -23,14 +25,22 @@ class UsersController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function login($request, $response)
|
||||
/**
|
||||
* Login page
|
||||
*
|
||||
* @param Request $request PSR7 request
|
||||
* @param Response $response PSR7 response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function login(Request $request, Response $response) : Response
|
||||
{
|
||||
$users = $this->getUsers();
|
||||
|
||||
if ((Session::exists('role') && Session::get('role') == 'admin')) {
|
||||
return $response->withRedirect($this->router->pathFor('admin.entries.index'));
|
||||
} else {
|
||||
if ($users && count($users) > 0) {
|
||||
if (count($users) > 0) {
|
||||
return $this->container->get('view')->render(
|
||||
$response,
|
||||
'plugins/admin/views/templates/users/login.html'
|
||||
@@ -41,7 +51,15 @@ class UsersController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function loginProcess($request, $response)
|
||||
/**
|
||||
* Login page process
|
||||
*
|
||||
* @param Request $request PSR7 request
|
||||
* @param Response $response PSR7 response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function loginProcess(Request $request, Response $response) : Response
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
@@ -61,22 +79,41 @@ class UsersController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function registration($request, $response)
|
||||
/**
|
||||
* Registration page
|
||||
*
|
||||
* @param Request $request PSR7 request
|
||||
* @param Response $response PSR7 response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function registration(Request $request, Response $response) : Response
|
||||
{
|
||||
if ((Session::exists('role') && Session::get('role') == 'admin')) {
|
||||
return $response->withRedirect($this->router->pathFor('admin.entries.index'));
|
||||
$users = $this->getUsers();
|
||||
|
||||
if (count($users) > 0) {
|
||||
return $response->withRedirect($this->router->pathFor('admin.users.login'));
|
||||
} else {
|
||||
return $this->view->render(
|
||||
$response,
|
||||
'plugins/admin/views/templates/users/registration.html'
|
||||
);
|
||||
if ((Session::exists('role') && Session::get('role') == 'admin')) {
|
||||
return $response->withRedirect($this->router->pathFor('admin.entries.index'));
|
||||
} else {
|
||||
return $this->view->render(
|
||||
$response,
|
||||
'plugins/admin/views/templates/users/registration.html'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* registrationProcess
|
||||
* Registration page process
|
||||
*
|
||||
* @param Request $request PSR7 request
|
||||
* @param Response $response PSR7 response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function registrationProcess($request, $response)
|
||||
public function registrationProcess(Request $request, Response $response) : Response
|
||||
{
|
||||
// Get POST data
|
||||
$data = $request->getParsedBody();
|
||||
@@ -101,26 +138,35 @@ class UsersController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* logoutProcess
|
||||
* Logout page process
|
||||
*
|
||||
* @param Request $request PSR7 request
|
||||
* @param Response $response PSR7 response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function logoutProcess($request, $response)
|
||||
public function logoutProcess(Request $request, Response $response) : Response
|
||||
{
|
||||
Session::destroy();
|
||||
return $response->withRedirect($this->router->pathFor('admin.users.login'));
|
||||
}
|
||||
|
||||
public function getUsers()
|
||||
/**
|
||||
* Get Users list
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUsers() : array
|
||||
{
|
||||
// Get Users Profiles
|
||||
$users = Filesystem::listContents(PATH['site'] . '/accounts/');
|
||||
$users_list = Filesystem::listContents(PATH['site'] . '/accounts/');
|
||||
|
||||
// Get Plugins List
|
||||
$_users_list = Filesystem::listContents(PATH['plugins']);
|
||||
$users_list = [];
|
||||
// Users
|
||||
$users = [];
|
||||
|
||||
foreach($_users_list as $user) {
|
||||
if ($user['type'] == 'dir') {
|
||||
$users_list[] = $user;
|
||||
foreach($users_list as $user) {
|
||||
if ($user['type'] == 'file' && $user['extension'] == 'json') {
|
||||
$users[$user['basename']] = $user;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,12 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
*
|
||||
* @author Sergey Romanenko <hello@romanenko.digital>
|
||||
* @link http://romanenko.digital
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Session\Session;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
/**
|
||||
* @property Router $router
|
||||
*/
|
||||
class AuthMiddleware extends Middleware
|
||||
{
|
||||
public function __invoke($request, $response, $next)
|
||||
|
||||
/**
|
||||
* __invoke
|
||||
*
|
||||
* @param Request $request PSR7 request
|
||||
* @param Response $response PSR7 response
|
||||
* @param callable $next Next middleware
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function __invoke(Request $request, Response $response, $next) : Response
|
||||
{
|
||||
if (Session::exists('role') && Session::get('role') == 'admin') {
|
||||
$response = $next($request, $response);
|
||||
|
@@ -29,6 +29,9 @@ class GlobalVarsAdminTwigExtension extends \Twig_Extension implements \Twig_Exte
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Global variables in an extension
|
||||
*/
|
||||
public function getGlobals()
|
||||
{
|
||||
return [
|
||||
|
@@ -76,8 +76,11 @@
|
||||
<script src="//unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var lightbox = $('.gallery-grid a').simpleLightbox({'fileExt': false});
|
||||
if ($('.gallery-grid a').length) {
|
||||
var lightbox = $('.gallery-grid a').simpleLightbox({'fileExt': false});
|
||||
}
|
||||
|
||||
if ($('.gallery-grid').length) {
|
||||
var $grid = $('.gallery-grid').imagesLoaded()
|
||||
.done( function( instance ) {
|
||||
$('.preloader').hide();
|
||||
@@ -89,6 +92,7 @@
|
||||
.progress( function( instance, image ) {
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{{ emitter.emit('onThemeTail') }}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 18 KiB |
Reference in New Issue
Block a user