update to bootstrap 4 p1, bugfix for logoLarge, logging cleanup, more

This commit is contained in:
Joey Kimsey
2024-12-08 04:35:25 -05:00
parent 9abd3865f5
commit dcbe7c2ac0
25 changed files with 509 additions and 264 deletions

View File

@ -221,9 +221,9 @@ class Posts extends DatabaseModel {
$whereClause = '*';
}
if ( empty( $limit ) ) {
$postData = self::$db->getPaginated( $this->tableName, $whereClause );
$postData = self::$db->get( $this->tableName, $whereClause );
} else {
$postData = self::$db->getPaginated( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
$postData = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$postData->count() ) {
Debug::info( 'No Blog posts found.' );
@ -239,7 +239,7 @@ class Posts extends DatabaseModel {
} else {
$whereClause = ['draft', '=', '0'];
}
$postData = self::$db->getPaginated( $this->tableName, $whereClause );
$postData = self::$db->get( $this->tableName, $whereClause );
if ( !$postData->count() ) {
Debug::info( 'No Blog posts found.' );
@ -263,7 +263,7 @@ class Posts extends DatabaseModel {
$firstDayUnix = date( 'U', strtotime( "first day of $year" ) );
$lastDayUnix = date( 'U', strtotime( "last day of $year" ) );
$whereClause = array_merge( $whereClause, ['created', '<=', $lastDayUnix, 'AND', 'created', '>=', $firstDayUnix] );
$postData = self::$db->getPaginated( $this->tableName, $whereClause );
$postData = self::$db->get( $this->tableName, $whereClause );
if ( !$postData->count() ) {
Debug::info( 'No Blog posts found.' );
@ -282,7 +282,7 @@ class Posts extends DatabaseModel {
$whereClause = ['draft', '=', '0', 'AND'];
}
$whereClause = array_merge( $whereClause, ['author' => $ID] );
$postData = self::$db->getPaginated( $this->tableName, $whereClause );
$postData = self::$db->get( $this->tableName, $whereClause );
if ( !$postData->count() ) {
Debug::info( 'No Blog posts found.' );
@ -311,7 +311,7 @@ class Posts extends DatabaseModel {
$month = date( 'F', $firstDayUnix );
$lastDayUnix = date( 'U', strtotime( "last day of $month $year" ) );
$whereClause = array_merge( $whereClause, ['created', '<=', $lastDayUnix, 'AND', 'created', '>=', $firstDayUnix] );
$postData = self::$db->getPaginated( $this->tableName, $whereClause );
$postData = self::$db->get( $this->tableName, $whereClause );
if ( !$postData->count() ) {
Debug::info( 'No Blog posts found.' );

View File

@ -28,7 +28,7 @@ class Blog extends Plugin {
public $pluginDescription = 'A simple plugin to add a blog to your installation.';
public $admin_links = [
[
'text' => '<i class="glyphicon glyphicon-text-size"></i> Blog',
'text' => '<i class="fa fa-fw fa-font"></i> Blog',
'url' => '{ROOT_URL}admin/blog',
],
];

View File

@ -32,7 +32,6 @@
<link rel="icon" href="{ROOT_URL}images/favicon.ico">
<!-- Required CSS -->
<link rel="stylesheet" href="{FONT_AWESOME_URL}font-awesome.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="{BOOTSTRAP_CDN}css/bootstrap-theme.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="{BOOTSTRAP_CDN}css/bootstrap.min.css" crossorigin="anonymous">
<!-- RSS -->
<link rel="alternate" href="{ROOT_URL}blog/rss" title="{TITLE} Feed" type="application/rss+xml" />
@ -44,7 +43,7 @@
<!--Brand and toggle should get grouped for better mobile display -->
<div class="navbar-header">
<a href="{ROOT_URL}" class="navbar-brand">{SITENAME}</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse" style="">
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target=".navbar-ex1-collapse" style="">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -55,7 +54,7 @@
<div class="collapse navbar-collapse navbar-ex1-collapse">
{topNavLeft}
<div class="navbar-right">
<ul class="nav navbar-nav">
<ul class="navbar-nav">
{topNavRight}
</ul>
</div>
@ -75,9 +74,7 @@
{/ISSUES}
<div class="row">
<div class="container">
<div class="page-header">
<h1 class="blog-title">{SITENAME} Blog</h1>
</div>
<h1 class="blog-title">{SITENAME} Blog</h1>
<div class="row">
<div class="col-sm-8 blog-main">
{BLOG_BREADCRUMBS}

View File

@ -310,7 +310,7 @@ class Bookmarks extends DatabaseModel {
$base_url = $this->getBaseUrl( $instance->url );
if ( empty( $instance->icon ) ) {
$instance->iconHtml = '<i class="glyphicon glyphicon-link"></i>';
$instance->iconHtml = '<i class="fa fa-fw fa-link"></i>';
} else {
if (strpos($instance->icon, 'http') !== false) {
$instance->iconHtml = '<img src="' . $instance->icon .'" />';
@ -321,34 +321,34 @@ class Bookmarks extends DatabaseModel {
if ( empty( $instance->hiddenAt ) ) {
$instance->hideBtn = '
<a href="{ROOT_URL}bookmarks/hideBookmark/'.$instance->ID.'" class="btn btn-sm btn-warning" role="button">
<i class="glyphicon glyphicon-eye-open"></i>
<i class="fa fa-fw fa-eye"></i>
</a>';
} else {
$instance->hideBtn = '
<a href="{ROOT_URL}bookmarks/showBookmark/'.$instance->ID.'" class="btn btn-sm btn-default" role="button">
<i class="glyphicon glyphicon-eye-open"></i>
<i class="fa fa-fw fa-eye"></i>
</a>';
}
if ( empty( $instance->archivedAt ) ) {
$instance->archiveBtn = '
<a href="{ROOT_URL}bookmarks/archiveBookmark/'.$instance->ID.'" class="btn btn-sm btn-info" role="button">
<i class="glyphicon glyphicon-briefcase"></i>
<i class="fa fa-fw fa-briefcase"></i>
</a>';
} else {
$instance->archiveBtn = '
<a href="{ROOT_URL}bookmarks/unarchiveBookmark/'.$instance->ID.'" class="btn btn-sm btn-default" role="button">
<i class="glyphicon glyphicon-briefcase"></i>
<i class="fa fa-fw fa-briefcase"></i>
</a>';
}
if ( ! empty( $instance->refreshedAt ) && time() < ( $instance->refreshedAt + ( 60 * 10 ) ) ) {
$instance->refreshBtn = '
<a href="{ROOT_URL}bookmarks/refreshBookmark/'.$instance->ID.'" class="btn btn-sm btn-danger" role="button">
<i class="glyphicon glyphicon-refresh"></i>
<i class="fa fa-fw fa-refresh"></i>
</a>';
} else {
$instance->refreshBtn = '
<a href="{ROOT_URL}bookmarks/refreshBookmark/'.$instance->ID.'" class="btn btn-sm btn-success" role="button">
<i class="glyphicon glyphicon-refresh"></i>
<i class="fa fa-fw fa-refresh"></i>
</a>';
}

View File

@ -170,7 +170,7 @@ class Comments extends DatabaseModel {
$where = ['contentType', '=', $contentType];
}
if ( empty( $limit ) ) {
$commentData = self::$db->getPaginated( $this->tableName, $where, 'created', 'DESC' );
$commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC' );
} else {
$commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC', [0, $limit] );
}

View File

@ -67,7 +67,7 @@ class MembershipCustomers extends DatabaseModel {
$api_key = Config::getValue( 'memberships/stripeSecret' );
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
Debug::error( "No Stripe Key found" );
Debug::error( "MembershipCustomers:create No Stripe Key found" );
return false;
}
self::$stripe = new \Stripe\StripeClient( $api_key );

View File

@ -22,6 +22,7 @@ use TheTempusProject\Bedrock\Classes\Config;
class MembershipProducts extends DatabaseModel {
public static $stripe;
private static $loaded = false;
public $tableName = 'membership_products';
public $databaseMatrix = [
[ 'name', 'varchar', '128' ],
@ -35,11 +36,14 @@ class MembershipProducts extends DatabaseModel {
public function __construct() {
parent::__construct();
$api_key = Config::getValue( 'memberships/stripeSecret' );
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
Debug::error( "No Stripe Key found" );
} else {
self::$stripe = new \Stripe\StripeClient( $api_key );
if ( ! self::$loaded ) {
$api_key = Config::getValue( 'memberships/stripeSecret' );
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
Debug::error( "MembershipProducts:__construct No Stripe Key found" );
} else {
self::$stripe = new \Stripe\StripeClient( $api_key );
}
self::$loaded = true;
}
}

View File

@ -24,6 +24,7 @@ use TheTempusProject\Canary\Classes\CustomException;
class Memberships extends DatabaseModel {
public static $stripe;
public static $products;
private static $loaded = false;
public $tableName = 'membership_records';
public $databaseMatrix = [
[ 'stripe_customer', 'varchar', '64' ],
@ -38,12 +39,15 @@ class Memberships extends DatabaseModel {
public function __construct() {
parent::__construct();
self::$products = new MembershipProducts;
$api_key = Config::getValue( 'memberships/stripeSecret' );
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
Debug::error( "No Stripe Key found" );
} else {
self::$stripe = new \Stripe\StripeClient( $api_key );
if ( ! self::$loaded ) {
self::$products = new MembershipProducts;
$api_key = Config::getValue( 'memberships/stripeSecret' );
if ( $api_key == 'sk_xxxxxxxxxxxxxxx' || empty($api_key) ) {
Debug::error( "Memberships:__construct No Stripe Key found" );
} else {
self::$stripe = new \Stripe\StripeClient( $api_key );
}
self::$loaded = true;
}
}
@ -79,9 +83,9 @@ class Memberships extends DatabaseModel {
public function getUserSubs( $limit = null ) {
$whereClause = ['local_user_id', '=', App::$activeUser->ID ];
if ( empty( $limit ) ) {
$postData = self::$db->getPaginated( $this->tableName, $whereClause );
$postData = self::$db->get( $this->tableName, $whereClause );
} else {
$postData = self::$db->getPaginated( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
$postData = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$postData->count() ) {
Debug::info( 'No user subs found.' );

View File

@ -61,7 +61,7 @@ class Message extends DatabaseModel {
Debug::info( 'Invalid user ID' );
return false;
}
$messageData = self::$db->getPaginated( $this->tableName, [ 'ID', '=', $parent ] );
$messageData = self::$db->get( $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->getPaginated( $this->tableName, $params, 'ID', 'DESC', [ 0, 1 ] );
$messageData = self::$db->get( $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->getPaginated( $this->tableName, [ 'ID', '=', $id ] );
$messageData = self::$db->get( $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->getPaginated( $this->tableName, [ 'ID', '=', $find, 'OR', 'Parent', '=', $find ], 'ID', 'ASC' )->results();
$messageData = self::$db->get( $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->getPaginated(
$messageData = self::$db->get(
$this->tableName,
[
'parent', '=', 0,
@ -154,7 +154,7 @@ class Message extends DatabaseModel {
$limit
);
if ( $messageData->count() == 0 ) {
Debug::info( 'No messages found' );
Debug::info( 'getInbox: No messages found' );
return false;
}
$filters = [
@ -175,7 +175,7 @@ class Message extends DatabaseModel {
$limit = 10;
}
$limit = [ 0, $limit ];
$messageData = self::$db->getPaginated(
$messageData = self::$db->get(
$this->tableName,
[
'parent', '=', 0,
@ -187,7 +187,7 @@ class Message extends DatabaseModel {
$limit
);
if ( $messageData->count() == 0 ) {
Debug::info( 'No messages found' );
Debug::info( 'getOutbox: No messages found' );
return false;
}
$filters = [

View File

@ -32,23 +32,23 @@ class Messages extends Plugin {
],
];
private static $loaded = false;
public function __construct() {
// This was taken directly from the main app
// load the message template data as part of the template
$messages = new Message;
Components::set( 'MESSAGE_COUNT', $messages->unreadCount() );
if ( $messages->unreadCount() > 0 ) {
$messageBadge = Views::simpleView( 'messages.badge' );
} else {
$messageBadge = '';
}
Components::set( 'MBADGE', $messageBadge );
if ( App::$isLoggedIn ) {
Components::set( 'RECENT_MESSAGES', Views::simpleView( 'messages.nav.recentMessagesDropdown', $messages->getInbox( 5 ) ) );
} else {
Components::set( 'RECENT_MESSAGES', '' );
}
if ( ! self::$loaded ) {
$messages = new Message;
Components::set( 'MESSAGE_COUNT', $messages->unreadCount() );
if ( $messages->unreadCount() > 0 ) {
$messageBadge = Views::simpleView( 'messages.badge' );
} else {
$messageBadge = '';
}
Components::set( 'MBADGE', $messageBadge );
if ( App::$isLoggedIn ) {
Components::set( 'RECENT_MESSAGES', Views::simpleView( 'messages.nav.recentMessagesDropdown', $messages->getInbox( 5 ) ) );
} else {
Components::set( 'RECENT_MESSAGES', '' );
}
App::$topNavRight .= '{RECENT_MESSAGES}';
App::$topNavRightDropdown .= '<li><a href="{ROOT_URL}messages"><i class="fa fa-fw fa-envelope"></i> Inbox {MBADGE}</a></li>';
self::$loaded = true;

View File

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

View File

@ -33,7 +33,7 @@ class Notifications extends Plugin {
];
public $admin_links = [
[
'text' => '<i class="glyphicon glyphicon-bell"></i> Notify',
'text' => '<i class="fa fa-fw fa-bell"></i> Notify',
'url' => '{ROOT_URL}admin/notifications',
],
];
@ -49,14 +49,14 @@ class Notifications extends Plugin {
$messageBadge = '';
}
Components::set( 'NBADGE', $messageBadge );
if ( App::$isLoggedIn ) {
Components::set( 'recentNotifications', Views::simpleView( 'notifications.nav.recentNotificationsDropdown', $notifications->getByUser( 10 ) ) );
} else {
Components::set( 'recentNotifications', '' );
}
if ( ! self::$loaded ) {
if ( App::$isLoggedIn ) {
Components::set( 'recentNotifications', Views::simpleView( 'notifications.nav.recentNotificationsDropdown', $notifications->getByUser( 10 ) ) );
} else {
Components::set( 'recentNotifications', '' );
}
App::$topNavRight .= '{recentNotifications}';
App::$topNavRightDropdown .= '<li><a href="{ROOT_URL}notifications"><i class="glyphicon glyphicon-bell"></i> Notifications {NBADGE}</a></li>';
App::$topNavRightDropdown .= '<li><a href="{ROOT_URL}notifications"><i class="fa fa-fw fa-bell"></i> Notifications {NBADGE}</a></li>';
self::$loaded = true;
}
}