Compare commits

..

10 Commits

26 changed files with 315 additions and 54 deletions

1
.gitignore vendored
View File

@ -62,3 +62,4 @@ logs/*
mail.log
vendor/canary/logs/*
.env
components/*

View File

@ -439,7 +439,7 @@ class Installer {
// exclude any flags we don't have a matric map for
if ( empty( $module_data->class_object->$matrix ) ) {
Debug::warn( "$flag_type does not have a proper matrix map and cannot be uninstalled." );
Debug::warn( "$flag_type does not have a proper matrix map and cannot be installed." );
$module_data->$flag_type = INSTALL_STATUS_NOT_FOUND;
}
}
@ -500,7 +500,7 @@ class Installer {
// exclude any flags we don't have a matric map for
if ( empty( $module_data->class_object->$matrix ) ) {
Debug::warn( "$flag_type does not have a proper matrix map and cannot be installed." );
Debug::warn( "$flag_type does not have a proper matrix map and cannot be uninstalled." );
$module_data->$flag_type = INSTALL_STATUS_NOT_FOUND;
}
}

View File

@ -39,7 +39,7 @@ class Admin extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.admin_list', self::$log->list( 'admin' ) );
return Views::view( 'admin.logs.admin_list', self::$log->listPaginated( 'admin' ) );
}
public function view( $id = null ) {

View File

@ -39,7 +39,7 @@ class Errors extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.error_list', self::$log->list( 'error' ) );
return Views::view( 'admin.logs.error_list', self::$log->listPaginated( 'error' ) );
}
public function view( $id = null ) {

View File

@ -95,7 +95,7 @@ class Groups extends AdminController {
}
public function index( $data = null ) {
Views::view( 'admin.groups.list', self::$group->list() );
Views::view( 'admin.groups.list', self::$group->listPaginated() );
}
public function listmembers( $data = null ) {

View File

@ -39,7 +39,7 @@ class Logins extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.login_list', self::$log->list( 'login' ) );
return Views::view( 'admin.logs.login_list', self::$log->listPaginated( 'login' ) );
}
public function view( $id = null ) {

View File

@ -26,8 +26,8 @@ class Logs extends AdminController {
}
public function index( $data = null ) {
Views::view( 'admin.logs.error_list', self::$log->list( 'error' ) );
Views::view( 'admin.logs.admin_list', self::$log->list( 'admin' ) );
Views::view( 'admin.logs.login_list', self::$log->list( 'login' ) );
Views::view( 'admin.logs.error_list', self::$log->listPaginated( 'error' ) );
Views::view( 'admin.logs.admin_list', self::$log->listPaginated( 'admin' ) );
Views::view( 'admin.logs.login_list', self::$log->listPaginated( 'login' ) );
}
}

View File

@ -56,7 +56,7 @@ class Plugins extends AdminController {
if ( !Input::exists( 'installHash' ) ) {
return Views::view( 'admin.modules.plugins.enable' );
}
if ( !Plugin::enable( $name ) ) {
if ( ! Plugin::enable( $name ) ) {
Session::flash( 'error', 'There was an error enabling the plugin.' );
} else {
Session::flash( 'success', 'Plugin has been enabled.' );

View File

@ -88,7 +88,7 @@ class Routes extends AdminController {
}
public function index() {
return Views::view( 'admin.routes.list', self::$routes->list() );
return Views::view( 'admin.routes.list', self::$routes->listPaginated() );
}
public function view( $id = null ) {

View File

@ -140,7 +140,7 @@ class Users extends AdminController {
}
public function index() {
Views::view( 'admin.users.list', self::$user->userList() );
Views::view( 'admin.users.list', self::$user->listPaginated() );
}
public function view( $id = null ) {

View File

@ -257,7 +257,7 @@ class Group extends DatabaseModel {
if ( $group === false ) {
return false;
}
$members = self::$db->get( 'users', [ 'userGroup', '=', $id ] );
$members = self::$db->getPaginated( 'users', [ 'userGroup', '=', $id ] );
if ( !$members->count() ) {
Debug::info( "list members: Could not find anyone in group: $id" );
return false;

View File

@ -19,9 +19,12 @@ use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Canary\Classes\CustomException;
use TheTempusProject\Houdini\Classes\Filters;
use TheTempusProject\Plugins\Comments as CommentPlugin;
use TheTempusProject\Models\Comments;
class Posts extends DatabaseModel {
public $tableName = 'posts';
public static $comments = false;
public $databaseMatrix = [
[ 'author', 'int', '11' ],
@ -32,19 +35,14 @@ class Posts extends DatabaseModel {
[ 'content', 'text', '' ],
];
public $resourceMatrix = [
[
'title' => 'Welcome',
'content' => '<p>This is just a simple message to say thank you for installing The Tempus Project. If you have any questions you can find everything through our website <a href="https://TheTempusProject.com">here</a>.</p>',
'author' => 1,
'created' => '{time}',
'edited' => '{time}',
'draft' => 0,
],
];
public function __construct() {
parent::__construct();
if ( class_exists( 'TheTempusProject\Plugins\Comments' ) ) {
$comments = new CommentPlugin;
if ( $comments->checkEnabled() ) {
self::$comments = new Comments;
}
}
}
public function newPost( $title, $post, $draft ) {
@ -161,6 +159,9 @@ class Posts extends DatabaseModel {
if ( isset( $params['stripHtml'] ) && $params['stripHtml'] === true ) {
$instance->contentSummary = strip_tags( $instance->content );
}
if ( self::$comments !== false ) {
$instance->commentCount = self::$comments->count( 'blog', $instance->ID );
}
$instance->content = Filters::applyOne( 'mentions.0', $instance->content, true );
$instance->content = Filters::applyOne( 'hashtags.0', $instance->content, true );
$out[] = $instance;

View File

@ -38,6 +38,18 @@ class Blog extends Plugin {
'url' => '{ROOT_URL}blog/index',
],
];
public $resourceMatrix = [
'posts' => [
[
'title' => 'Welcome',
'content' => '<p>This is just a simple message to say thank you for installing The Tempus Project. If you have any questions you can find everything through our website <a href="https://TheTempusProject.com">here</a>.</p>',
'author' => 1,
'created' => '{time}',
'edited' => '{time}',
'draft' => 0,
],
],
];
public $posts;
public function __construct( $load = false ) {

View File

@ -54,7 +54,7 @@ class Comments extends Plugin {
],
];
public $resourceMatrix = [
'group' => [
'groups' => [
[
'name' => 'Moderator',
'permissions' => '{"adminAccess":false}',

View File

@ -53,6 +53,6 @@ class Feedback extends AdminController {
}
public function index( $data = null ) {
Views::view( 'feedback.admin.list', self::$feedback->list() );
Views::view( 'feedback.admin.list', self::$feedback->listPaginated() );
}
}

View File

@ -61,7 +61,7 @@ class Message extends DatabaseModel {
Debug::info( 'Invalid user ID' );
return false;
}
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $parent ] );
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $parent ] );
if ( $messageData->count() == 0 ) {
Debug::info( 'Message not found.' );
return false;
@ -71,7 +71,7 @@ class Message extends DatabaseModel {
if ( $type !== null ) {
$params = array_merge( $params, [ 'AND', $type, '=', $user ] );
}
$messageData = self::$db->get( $this->tableName, $params, 'ID', 'DESC', [ 0, 1 ] );
$messageData = self::$db->getPaginated( $this->tableName, $params, 'ID', 'DESC', [ 0, 1 ] );
if ( $messageData->count() != 0 ) {
if ( $messageData->first()->recieverDeleted == 0 ) {
$message = $messageData->first();
@ -93,7 +93,7 @@ class Message extends DatabaseModel {
Debug::info( 'Invalid ID' );
return false;
}
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $id ] );
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $id ] );
if ( $messageData->count() == 0 ) {
Debug::info( 'Message not found.' );
return false;
@ -122,7 +122,7 @@ class Message extends DatabaseModel {
} else {
$find = $message->ID;
}
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $find, 'OR', 'Parent', '=', $find ], 'ID', 'ASC' )->results();
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $find, 'OR', 'Parent', '=', $find ], 'ID', 'ASC' )->results();
Components::set( 'PID', $find );
if ( $markRead == true ) {
@ -138,7 +138,7 @@ class Message extends DatabaseModel {
$limit = 10;
}
$limit = [ 0, $limit ];
$messageData = self::$db->get(
$messageData = self::$db->getPaginated(
$this->tableName,
[
'parent', '=', 0,
@ -175,7 +175,7 @@ class Message extends DatabaseModel {
$limit = 10;
}
$limit = [ 0, $limit ];
$messageData = self::$db->get(
$messageData = self::$db->getPaginated(
$this->tableName,
[
'parent', '=', 0,

View File

@ -74,9 +74,9 @@ class Notification extends DatabaseModel {
'expiresAt', '<', time(),
];
if ( empty( $limit ) ) {
$notifications = self::$db->get( $this->tableName, $whereClause );
$notifications = self::$db->getPaginated( $this->tableName, $whereClause );
} else {
$notifications = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
$notifications = self::$db->getPaginated( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$notifications->count() ) {
Debug::info( 'No Notifications found.' );

View File

@ -27,5 +27,4 @@
</tbody>
</table>
</form>
</div>
{PAGINATION}
</div>

View File

@ -28,7 +28,15 @@ class DefaultLoader extends Loader {
public function __construct() {
Components::set( 'TEMPLATE_URL', Template::parse( '{ROOT_URL}app/templates/default/' ) );
Components::set( 'BOOTSTRAP_CDN', self::BOOTSTRAP_CDN );
if ( VENDOR_AUTOLOADED === true ) {
Components::set( 'FONT_AWESOME_URL', '/vendor/fortawesome/font-awesome/css/' );
Components::set( 'BOOTSTRAP_CDN', '/vendor/twbs/bootstrap/dist/' );
Components::set( 'JQUERY_CDN', '/vendor/components/jquery/' );
} else {
Components::set( 'BOOTSTRAP_CDN', self::BOOTSTRAP_CDN );
Components::set( 'JQUERY_CDN', self::JQUERY_CDN );
Components::set( 'FONT_AWESOME_URL', self::FONT_AWESOME_URL );
}
$this->addCss( '<link rel="stylesheet" href="{ROOT_URL}app/css/main.css">' );
$this->addJs( '<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{ROOT_URL}app/js/main.js"></script>' );
Components::setIfNull( 'LOGO', Config::getValue( 'main/logo' ) );
@ -50,8 +58,6 @@ class DefaultLoader extends Loader {
Components::set( 'topNavRight', Template::parse( App::$topNavRight . '{STATUS}' ) );
Components::set( 'topNavLeft', Navigation::getMenuView( 'nav.main', 'MENU_LINKS', App::MAIN_MENU_NAME ) );
Components::set( 'JQUERY_CDN', self::JQUERY_CDN );
Components::set( 'FONT_AWESOME_URL', self::FONT_AWESOME_URL );
Components::set( 'colorSelect', Views::simpleView( 'forms.colorSelect' ) );
Components::set( 'iconSelect', Views::simpleView( 'forms.iconSelect' ) );
Navigation::setCrumbComponent( 'BREADCRUMB', Input::get( 'url' ) );

View File

@ -1,5 +1,4 @@
<legend><h2>Installed Dependencies</h2></legend>
{PAGINATION}
<table class="table table-striped">
<thead>
<tr>

View File

@ -1,5 +1,4 @@
<legend><h2>Installed Models</h2></legend>
{PAGINATION}
<table class="table table-striped">
<thead>
<tr>

View File

@ -1,5 +1,4 @@
<legend><h2>Installed Plugins</h2></legend>
{PAGINATION}
<table class="table table-striped">
<thead>
<tr>

View File

@ -242,7 +242,7 @@ class TheTempusProject extends Bedrock {
'example' => '(?)',
],
];
public $configMatrix = [
public static $configMatrix = [
"main" => [
"logo" => [
"type" => "file",

View File

@ -21,16 +21,16 @@
"require":
{
"fortawesome/font-awesome": "4.7",
"thetempusproject/bedrock": "1.0.9",
"thetempusproject/bedrock": "1.0.10",
"thetempusproject/canary": "1.0.5",
"thetempusproject/houdini": "1.0.8",
"components/jquery": "1.9.*",
"twbs/bootstrap": "3.3.7"
},
"autoload":
{
"files":
[
"app/functions/forms.php",
"app/functions/common.php"
],
"classmap":
@ -56,8 +56,11 @@
{
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"robloach/component-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
}

253
composer.lock generated
View File

@ -4,8 +4,60 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "91dc97145b402ae3dd4da77b7423cb51",
"content-hash": "4d87b4a533236913cbbc0e75664016de",
"packages": [
{
"name": "components/jquery",
"version": "1.9.1",
"source": {
"type": "git",
"url": "https://github.com/components/jquery.git",
"reference": "ae5c0c13cf163b3751ce55f9d9e97c1ba7ff796d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/components/jquery/zipball/ae5c0c13cf163b3751ce55f9d9e97c1ba7ff796d",
"reference": "ae5c0c13cf163b3751ce55f9d9e97c1ba7ff796d",
"shasum": ""
},
"require": {
"robloach/component-installer": "*"
},
"type": "component",
"extra": {
"component": {
"scripts": [
"jquery.js"
],
"files": [
"jquery.min.js",
"jquery-migrate.js",
"jquery-migrate.min.js",
"jquery.min.map"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "John Resig",
"email": "jeresig@gmail.com"
}
],
"description": "jQuery JavaScript Library",
"homepage": "http://jquery.com",
"support": {
"forum": "http://forum.jquery.com",
"irc": "irc://irc.freenode.org/jquery",
"issues": "http://bugs.jquery.com",
"source": "https://github.com/jquery/jquery",
"wiki": "http://docs.jquery.com/"
},
"time": "2014-10-11T11:52:45+00:00"
},
{
"name": "fortawesome/font-awesome",
"version": "v4.7.0",
@ -58,13 +110,204 @@
},
"time": "2016-10-24T15:52:54+00:00"
},
{
"name": "kriswallsmith/assetic",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/kriswallsmith/assetic.git",
"reference": "e911c437dbdf006a8f62c2f59b15b2d69a5e0aa1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/e911c437dbdf006a8f62c2f59b15b2d69a5e0aa1",
"reference": "e911c437dbdf006a8f62c2f59b15b2d69a5e0aa1",
"shasum": ""
},
"require": {
"php": ">=5.3.1",
"symfony/process": "~2.1|~3.0"
},
"conflict": {
"twig/twig": "<1.27"
},
"require-dev": {
"leafo/lessphp": "^0.3.7",
"leafo/scssphp": "~0.1",
"meenie/javascript-packer": "^1.1",
"mrclay/minify": "<2.3",
"natxet/cssmin": "3.0.4",
"patchwork/jsqueeze": "~1.0|~2.0",
"phpunit/phpunit": "~4.8 || ^5.6",
"psr/log": "~1.0",
"ptachoire/cssembed": "~1.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
"twig/twig": "~1.23|~2.0",
"yfix/packager": "dev-master"
},
"suggest": {
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
"leafo/scssphp": "Assetic provides the integration with the scssphp SCSS compiler",
"leafo/scssphp-compass": "Assetic provides the integration with the SCSS compass plugin",
"patchwork/jsqueeze": "Assetic provides the integration with the JSqueeze JavaScript compressor",
"ptachoire/cssembed": "Assetic provides the integration with phpcssembed to embed data uris",
"twig/twig": "Assetic provides the integration with the Twig templating engine"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-0": {
"Assetic": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kris Wallsmith",
"email": "kris.wallsmith@gmail.com",
"homepage": "http://kriswallsmith.net/"
}
],
"description": "Asset Management for PHP",
"homepage": "https://github.com/kriswallsmith/assetic",
"keywords": [
"assets",
"compression",
"minification"
],
"support": {
"issues": "https://github.com/kriswallsmith/assetic/issues",
"source": "https://github.com/kriswallsmith/assetic/tree/master"
},
"time": "2016-11-11T18:43:20+00:00"
},
{
"name": "robloach/component-installer",
"version": "0.0.12",
"source": {
"type": "git",
"url": "https://github.com/RobLoach/component-installer.git",
"reference": "1864f25db21fc173e02a359f646acd596c1b0460"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/RobLoach/component-installer/zipball/1864f25db21fc173e02a359f646acd596c1b0460",
"reference": "1864f25db21fc173e02a359f646acd596c1b0460",
"shasum": ""
},
"require": {
"kriswallsmith/assetic": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"composer/composer": "1.*"
},
"type": "composer-installer",
"extra": {
"class": "ComponentInstaller\\Installer"
},
"autoload": {
"psr-0": {
"ComponentInstaller": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rob Loach",
"email": "robloach@gmail.com",
"homepage": "http://robloach.net"
}
],
"description": "Allows installation of Components via Composer.",
"support": {
"issues": "https://github.com/RobLoach/component-installer/issues",
"source": "https://github.com/RobLoach/component-installer/tree/master"
},
"abandoned": "oomphinc/composer-installers-extender",
"time": "2013-08-31T23:46:48+00:00"
},
{
"name": "symfony/process",
"version": "v3.4.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca",
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v3.4.47"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00"
},
{
"name": "thetempusproject/bedrock",
"version": "1.0.9",
"version": "1.0.10",
"source": {
"type": "git",
"url": "https://git.thetempusproject.com/the-tempus-project/bedrock",
"reference": "464201cf177eabdba9bf8ebfe734d2e511e76748"
"reference": "42ade08306525488f2449a2f4e3e05569eee9822"
},
"require": {
"php": ">=8.1.0",
@ -101,7 +344,7 @@
"framework",
"mvc"
],
"time": "2024-08-20T10:31:54+00:00"
"time": "2024-08-21T10:12:54+00:00"
},
{
"name": "thetempusproject/canary",
@ -297,5 +540,5 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}

View File

@ -213,7 +213,7 @@ class Install extends Controller {
$baseConfig['database']['dbPassword']['value'] = Input::postNull( 'dbPassword' );
$baseConfig['database']['dbPrefix']['value'] = Input::postNull( 'dbPrefix' );
$baseConfig['database']['dbUsername']['value'] = Input::postNull( 'dbUsername' );
if ( ! TheTempusProject::$activeConfig->generate( CONFIG_JSON, $configMatrix ) ) {
if ( ! TheTempusProject::$activeConfig->generate( CONFIG_JSON, $baseConfig ) ) {
return Issues::add( 'error', 'Config file already exists so the installer has been halted. If there was an error with installation, please delete app/config/config.json manually and try again. The installer should automatically bring you back to this step.' );
}
Session::flash( 'success', 'Config saved successfully.' );
@ -341,7 +341,6 @@ class Install extends Controller {
} else {
$installResult = $this->installer->installModel( (object) $module, [ 'installResources' => true ], false );
}
if ( !$installResult ) {
$error = true;
}