remove unused plugins
This commit is contained in:
@ -1,84 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* app/plugins/donate/controllers/donate.php
|
|
||||||
*
|
|
||||||
* This is the Donations controller.
|
|
||||||
*
|
|
||||||
* @package TP Donate
|
|
||||||
* @version 3.0
|
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
||||||
* @link https://TheTempusProject.com
|
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
||||||
*/
|
|
||||||
namespace TheTempusProject\Controllers;
|
|
||||||
|
|
||||||
use TheTempusProject\Hermes\Functions\Redirect;
|
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
|
||||||
use TheTempusProject\Bedrock\Functions\Input;
|
|
||||||
use TheTempusProject\Bedrock\Functions\Session;
|
|
||||||
use TheTempusProject\Houdini\Classes\Issues;
|
|
||||||
use TheTempusProject\Houdini\Classes\Views;
|
|
||||||
use TheTempusProject\Classes\Controller;
|
|
||||||
use TheTempusProject\Classes\Forms;
|
|
||||||
use TheTempusProject\Models\Bugreport as BugreportModel;
|
|
||||||
use TheTempusProject\TheTempusProject as App;
|
|
||||||
use TheTempusProject\Bedrock\Classes\Config;
|
|
||||||
use TheTempusProject\Hermes\Functions\Route as Routes;
|
|
||||||
|
|
||||||
class Donate extends Controller {
|
|
||||||
protected static $bugreport;
|
|
||||||
|
|
||||||
public function index() {
|
|
||||||
self::$title = 'Donate - {SITENAME}';
|
|
||||||
self::$pageDescription = 'Donations help support our cause and our efforts. Please use this page to select an amount and give today.';
|
|
||||||
|
|
||||||
if ( !Input::exists() ) {
|
|
||||||
return Views::view( 'donate.donate' );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !Forms::check( 'donate' ) ) {
|
|
||||||
Issues::add( 'error', [ 'There was an error with your form.' => Check::userErrors() ] );
|
|
||||||
return Views::view( 'donate.donate' );
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$api_key = Config::getValue( 'donations/stripeSecret' );
|
|
||||||
$stripe = new \Stripe\StripeClient( $api_key );
|
|
||||||
$session = $stripe->checkout->sessions->create([
|
|
||||||
'payment_method_types' => ['card'],
|
|
||||||
'line_items' => [[
|
|
||||||
'price_data' => [
|
|
||||||
'currency' => 'usd',
|
|
||||||
'product_data' => [
|
|
||||||
'name' => 'Donation',
|
|
||||||
],
|
|
||||||
'unit_amount' => Input::post("amount"), // Amount in cents ($10)
|
|
||||||
],
|
|
||||||
'quantity' => 1,
|
|
||||||
]],
|
|
||||||
'mode' => 'payment',
|
|
||||||
'metadata' => [
|
|
||||||
'note' => Input::post("comment"),
|
|
||||||
],
|
|
||||||
'success_url' => Routes::getAddress() . 'donate/success?session_id={CHECKOUT_SESSION_ID}',
|
|
||||||
'cancel_url' => Routes::getAddress() . 'donate/continue',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Redirect to the Checkout session
|
|
||||||
header('Location: ' . $session->url);
|
|
||||||
exit;
|
|
||||||
} catch (\Stripe\Exception\ApiErrorException $e) {
|
|
||||||
echo "Error creating Checkout session: " . $e->getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function success() {
|
|
||||||
self::$title = 'Thank you!';
|
|
||||||
Views::view( 'donate.success' );
|
|
||||||
}
|
|
||||||
|
|
||||||
public function continue() {
|
|
||||||
self::$title = 'Thank you!';
|
|
||||||
Views::view( 'donate.fail' );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* app/plugins/donate/forms.php
|
|
||||||
*
|
|
||||||
* This houses all of the form checking functions for this plugin.
|
|
||||||
*
|
|
||||||
* @package TP Donate
|
|
||||||
* @version 3.0
|
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
||||||
* @link https://TheTempusProject.com
|
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
||||||
*/
|
|
||||||
namespace TheTempusProject\Plugins\Donate;
|
|
||||||
|
|
||||||
use TheTempusProject\Bedrock\Functions\Input;
|
|
||||||
use TheTempusProject\Classes\Forms;
|
|
||||||
|
|
||||||
class DonateForms extends Forms {
|
|
||||||
/**
|
|
||||||
* Adds these functions to the form list.
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
self::addHandler( 'donate', __CLASS__, 'donate' );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates the bug report form.
|
|
||||||
*
|
|
||||||
* @return {bool}
|
|
||||||
*/
|
|
||||||
public static function donate() {
|
|
||||||
if ( !Input::exists( 'amount' ) ) {
|
|
||||||
self::addUserError( 'You must specify an amount' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !self::token() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new DonateForms;
|
|
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* app/plugins/donate/models/donations.php
|
|
||||||
*
|
|
||||||
* This class is used for the manipulation of the donations database table.
|
|
||||||
*
|
|
||||||
* @package TP Donate
|
|
||||||
* @version 3.0
|
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
||||||
* @link https://TheTempusProject.com
|
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
||||||
*/
|
|
||||||
namespace TheTempusProject\Models;
|
|
||||||
|
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
|
||||||
use TheTempusProject\Plugins\Bugreport as Plugin;
|
|
||||||
|
|
||||||
class Donations extends DatabaseModel {
|
|
||||||
public $tableName = 'donations';
|
|
||||||
public $databaseMatrix = [
|
|
||||||
[ 'amount', 'int', '11' ],
|
|
||||||
[ 'createdAt', 'int', '10' ],
|
|
||||||
[ 'user_d', 'int', '10' ],
|
|
||||||
[ 'comment', 'text', '' ],
|
|
||||||
];
|
|
||||||
public $plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The model constructor.
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
$this->plugin = new Plugin;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* app/plugins/donate/plugin.php
|
|
||||||
*
|
|
||||||
* This houses all of the main plugin info and functionality.
|
|
||||||
*
|
|
||||||
* @package TP Donate
|
|
||||||
* @version 3.0
|
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
||||||
* @link https://TheTempusProject.com
|
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
||||||
*/
|
|
||||||
namespace TheTempusProject\Plugins;
|
|
||||||
|
|
||||||
use TheTempusProject\TheTempusProject as App;
|
|
||||||
use TheTempusProject\Classes\Plugin;
|
|
||||||
use Stripe\StripeClient;
|
|
||||||
use TheTempusProject\Bedrock\Classes\Config;
|
|
||||||
use TheTempusProject\Hermes\Functions\Route as Routes;
|
|
||||||
use TheTempusProject\Models\Memberships;
|
|
||||||
|
|
||||||
class Donate extends Plugin {
|
|
||||||
public static $stripe;
|
|
||||||
private static $loaded = false;
|
|
||||||
public $pluginName = 'TP Donations';
|
|
||||||
public $configName = 'donations';
|
|
||||||
public $pluginAuthor = 'JoeyK';
|
|
||||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
|
||||||
public $modelVersion = '1.0';
|
|
||||||
public $pluginVersion = '3.0';
|
|
||||||
public $pluginDescription = 'A simple plugin which adds a site wide donation system.';
|
|
||||||
public $permissionMatrix = [
|
|
||||||
'controlMemberships' => [
|
|
||||||
'pretty' => 'Can donate.',
|
|
||||||
'default' => true,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
public $main_links = [
|
|
||||||
[
|
|
||||||
'text' => 'Donate!',
|
|
||||||
'url' => '{ROOT_URL}donate',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
public $configMatrix = [
|
|
||||||
'stripePublishable' => [
|
|
||||||
'type' => 'text',
|
|
||||||
'pretty' => 'Stripe Publishable key',
|
|
||||||
'default' => 'pk_xxxxxxxxxxxxxxx',
|
|
||||||
],
|
|
||||||
'stripeSecret' => [
|
|
||||||
'type' => 'text',
|
|
||||||
'pretty' => 'Stripe Secret key',
|
|
||||||
'default' => 'sk_xxxxxxxxxxxxxxx',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function __construct( $load = false ) {
|
|
||||||
parent::__construct( $load );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-8 col-md-offset-2">
|
|
||||||
<div class="jumbotron text-center">
|
|
||||||
<h1>Support Our Projects</h1>
|
|
||||||
<p>Your funding helps provide more time and resources, enables exciting new projects, and ensures continued updates and improvements to all of our services.</p>
|
|
||||||
<p>By contributing, you're supporting these platforms:</p>
|
|
||||||
<ul class="list-unstyled">
|
|
||||||
<li><strong>AllTheBookmarks.com</strong> - Your one-stop bookmark management service.</li>
|
|
||||||
<li><strong>ForgottenPlanner.com</strong> - Keep your plans on track.</li>
|
|
||||||
<li><strong>TempusToolkit.com</strong> - Time management made easier.</li>
|
|
||||||
<li><strong>WoWditions.com</strong> - Enhancing your World of Warcraft experience.</li>
|
|
||||||
<li><strong>WhatsThatUploadSite.com</strong> - Simplified upload site discovery.</li>
|
|
||||||
<li><strong>PollingDownTheStreet.com</strong> - Find your local polling station effortlessly.</li>
|
|
||||||
</ul>
|
|
||||||
<p>Every donation helps us grow and continue providing value to our community. Thank you for your support!</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6 col-md-offset-3">
|
|
||||||
<form action="" method="POST" role="form">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="donation-amount">Donation Amount ($):</label>
|
|
||||||
<input type="number" class="form-control" id="donation-amount" name="amount" placeholder="Enter amount">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="donation-comment">Leave a Comment (Optional):</label>
|
|
||||||
<textarea class="form-control" id="donation-comment" name="comment" rows="4" placeholder="Share your thoughts or specify how you'd like your donation to be used."></textarea>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="token" value="{TOKEN}">
|
|
||||||
<button type="submit" value="submit" name="submit" class="btn btn-primary btn-lg btn-block">Donate Now</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,4 +0,0 @@
|
|||||||
<div class="jumbotron text-center">
|
|
||||||
<h1>Thanks for taking the time to explore donation.</h1>
|
|
||||||
<p>Now may not be the right time, but we thank you anyways!</p>
|
|
||||||
</div>
|
|
@ -1,5 +0,0 @@
|
|||||||
<div class="jumbotron text-center">
|
|
||||||
<h1>Thanks for supporting!</h1>
|
|
||||||
<p>Its people like you who keep the pixels on around here.
|
|
||||||
Every Dollar counts, so thank you again.</p>
|
|
||||||
</div>
|
|
@ -1,113 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* app/controllers/messages.php
|
|
||||||
*
|
|
||||||
* This is the user messages controller.
|
|
||||||
*
|
|
||||||
* @version 3.0
|
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
||||||
* @link https://TheTempusProject.com
|
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
||||||
*/
|
|
||||||
namespace TheTempusProject\Controllers;
|
|
||||||
|
|
||||||
use TheTempusProject\Classes\Controller;
|
|
||||||
use TheTempusProject\Classes\Forms as FormChecker;
|
|
||||||
use TheTempusProject\Models\Message;
|
|
||||||
use TheTempusProject\Houdini\Classes\Components;
|
|
||||||
use TheTempusProject\Houdini\Classes\Views;
|
|
||||||
use TheTempusProject\Houdini\Classes\Issues;
|
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
|
||||||
use TheTempusProject\Bedrock\Functions\Input;
|
|
||||||
|
|
||||||
class Messages extends Controller {
|
|
||||||
private static $message;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
self::$title = 'Messages';
|
|
||||||
self::$message = new Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create() {
|
|
||||||
self::$title .= ' - New Message';
|
|
||||||
if ( Input::get( 'prepopuser' ) ) {
|
|
||||||
$data = Input::get( 'prepopuser' );
|
|
||||||
}
|
|
||||||
if ( !empty( $data ) && self::$user->checkUsername( $data ) ) {
|
|
||||||
Components::set( 'prepopuser', $data );
|
|
||||||
} else {
|
|
||||||
Components::set( 'prepopuser', '' );
|
|
||||||
}
|
|
||||||
if ( !Input::exists( 'submit' ) ) {
|
|
||||||
return Views::view( 'messages.create' );
|
|
||||||
}
|
|
||||||
if ( !FormChecker::check( 'newMessage' ) ) {
|
|
||||||
Issues::add( 'error', [ 'There was an problem sending your messages.' => Check::userErrors() ] );
|
|
||||||
return Views::view( 'messages.create' );
|
|
||||||
}
|
|
||||||
if ( self::$message->newThread( Input::post( 'toUser' ), Input::post( 'subject' ), Input::post( 'message' ) ) ) {
|
|
||||||
Issues::add( 'success', 'Message Sent.' );
|
|
||||||
} else {
|
|
||||||
Issues::add( 'notice', 'There was an problem sending your messages.' );
|
|
||||||
}
|
|
||||||
return $this->index();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function delete( $id = '' ) {
|
|
||||||
if ( Input::exists( 'T_' ) ) {
|
|
||||||
self::$message->delete( Input::post( 'T_' ) );
|
|
||||||
}
|
|
||||||
if ( Input::exists( 'F_' ) ) {
|
|
||||||
self::$message->delete( Input::post( 'F_' ) );
|
|
||||||
}
|
|
||||||
if ( Input::exists( 'ID' ) ) {
|
|
||||||
self::$message->delete( Input::get( 'ID' ) );
|
|
||||||
}
|
|
||||||
if ( !empty( $id ) ) {
|
|
||||||
self::$message->delete( $id );
|
|
||||||
}
|
|
||||||
return $this->index();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function index() {
|
|
||||||
Views::view( 'messages.inbox', self::$message->getInbox() );
|
|
||||||
Views::view( 'messages.outbox', self::$message->getOutbox() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public function read( $id = '' ) {
|
|
||||||
self::$message->markRead( $id );
|
|
||||||
return $this->index();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reply() {
|
|
||||||
if ( Input::exists( 'messageID' ) ) {
|
|
||||||
$data = Input::post( 'messageID' );
|
|
||||||
}
|
|
||||||
if ( !Check::id( $data ) ) {
|
|
||||||
Issues::add( 'error', 'There was an error with your request.' );
|
|
||||||
return $this->index();
|
|
||||||
}
|
|
||||||
self::$title .= ' - Reply to: ' . self::$message->messageTitle( $data );
|
|
||||||
if ( !Input::exists( 'message' ) ) {
|
|
||||||
Components::set( 'messageID', $data );
|
|
||||||
return Views::view( 'messages.reply' );
|
|
||||||
}
|
|
||||||
if ( !FormChecker::check( 'replyMessage' ) ) {
|
|
||||||
Issues::add( 'error', [ 'There was an problem sending your messages.' => Check::userErrors() ] );
|
|
||||||
Components::set( 'messageID', $data );
|
|
||||||
return Views::view( 'messages.reply' );
|
|
||||||
}
|
|
||||||
if ( !self::$message->newMessageReply( $data, Input::post( 'message' ) ) ) {
|
|
||||||
Issues::add( 'error', 'There was an error with your request.' );
|
|
||||||
return $this->index();
|
|
||||||
}
|
|
||||||
Issues::add( 'success', 'Reply Sent.' );
|
|
||||||
return $this->index();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function view( $id = '' ) {
|
|
||||||
self::$title = self::$message->messageTitle( $id );
|
|
||||||
return Views::view( 'messages.message', self::$message->getThread( $id, true ) );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,452 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* app/models/message.php
|
|
||||||
*
|
|
||||||
* Houses all of the functions for the core messaging system.
|
|
||||||
*
|
|
||||||
* @version 3.0
|
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
||||||
* @link https://TheTempusProject.com
|
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
||||||
*/
|
|
||||||
namespace TheTempusProject\Models;
|
|
||||||
|
|
||||||
use TheTempusProject\Classes\DatabaseModel;
|
|
||||||
use TheTempusProject\Houdini\Classes\Components;
|
|
||||||
use TheTempusProject\Houdini\Classes\Views;
|
|
||||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
|
||||||
use TheTempusProject\Bedrock\Functions\Check;
|
|
||||||
use TheTempusProject\Bedrock\Functions\Sanitize;
|
|
||||||
use TheTempusProject\TheTempusProject as App;
|
|
||||||
use TheTempusProject\Canary\Classes\CustomException;
|
|
||||||
|
|
||||||
class Message extends DatabaseModel {
|
|
||||||
public $tableName = 'messages';
|
|
||||||
public $databaseMatrix = [
|
|
||||||
[ 'userTo', 'int', '11' ],
|
|
||||||
[ 'userFrom', 'int', '11' ],
|
|
||||||
[ 'parent', 'int', '11' ],
|
|
||||||
[ 'sent', 'int', '10' ],
|
|
||||||
[ 'lastReply', 'int', '10' ],
|
|
||||||
[ 'senderDeleted', 'int', '1' ],
|
|
||||||
[ 'recieverDeleted', 'int', '1' ],
|
|
||||||
[ 'isRead', 'int', '1' ],
|
|
||||||
[ 'message', 'text', '' ],
|
|
||||||
[ 'subject', 'text', '' ],
|
|
||||||
];
|
|
||||||
private $messages;
|
|
||||||
private $usernames;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The model constructor.
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
self::$message = $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the most recent relative message in a thread
|
|
||||||
*
|
|
||||||
* @param int $parent - the id of the parent message
|
|
||||||
* @param string $user - the id of the relative user
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
public function getLatestMessage( $parent, $user, $type = null ) {
|
|
||||||
if ( !Check::id( $parent ) ) {
|
|
||||||
Debug::info( 'Invalid message ID' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !Check::id( $user ) ) {
|
|
||||||
Debug::info( 'Invalid user ID' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $parent ] );
|
|
||||||
if ( $messageData->count() == 0 ) {
|
|
||||||
Debug::info( 'Message not found.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$message = $messageData->first();
|
|
||||||
$params = [ 'parent', '=', $parent ];
|
|
||||||
if ( $type !== null ) {
|
|
||||||
$params = array_merge( $params, [ 'AND', $type, '=', $user ] );
|
|
||||||
}
|
|
||||||
$messageData = self::$db->get( $this->tableName, $params, 'ID', 'DESC', [ 0, 1 ] );
|
|
||||||
if ( $messageData->count() != 0 ) {
|
|
||||||
if ( $messageData->first()->recieverDeleted == 0 ) {
|
|
||||||
$message = $messageData->first();
|
|
||||||
} else {
|
|
||||||
$message->recieverDeleted = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This calls a view of the requested message.
|
|
||||||
*
|
|
||||||
* @param int $ID - The message ID you are looking for.
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function getThread( $id, $markRead = false ) {
|
|
||||||
if ( !Check::id( $id ) ) {
|
|
||||||
Debug::info( 'Invalid ID' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $id ] );
|
|
||||||
if ( $messageData->count() == 0 ) {
|
|
||||||
Debug::info( 'Message not found.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$message = $messageData->first();
|
|
||||||
if ( $message->userTo == App::$activeUser->ID ) {
|
|
||||||
$permissionCheck = 1;
|
|
||||||
if ( $message->recieverDeleted == 1 ) {
|
|
||||||
Debug::info( 'User has already deleted this message.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( $message->userFrom == App::$activeUser->ID ) {
|
|
||||||
$permissionCheck = 1;
|
|
||||||
if ( $message->senderDeleted == 1 ) {
|
|
||||||
Debug::info( 'User has already deleted this message.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( empty( $permissionCheck ) ) {
|
|
||||||
Debug::info( 'You do not have permission to view this message.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( $message->parent != 0 ) {
|
|
||||||
$find = $message->parent;
|
|
||||||
} else {
|
|
||||||
$find = $message->ID;
|
|
||||||
}
|
|
||||||
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $find, 'OR', 'Parent', '=', $find ], 'ID', 'ASC' )->results();
|
|
||||||
Components::set( 'PID', $find );
|
|
||||||
|
|
||||||
if ( $markRead == true ) {
|
|
||||||
foreach ( $messageData as $instance ) {
|
|
||||||
$this->markRead( $instance->ID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this->filter( $messageData );
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getInbox( $limit = null ) {
|
|
||||||
if ( empty( $limit ) ) {
|
|
||||||
$limit = 10;
|
|
||||||
}
|
|
||||||
$limit = [ 0, $limit ];
|
|
||||||
$messageData = self::$db->get(
|
|
||||||
$this->tableName,
|
|
||||||
[
|
|
||||||
'parent', '=', 0,
|
|
||||||
'AND',
|
|
||||||
'userFrom', '=', App::$activeUser->ID,
|
|
||||||
'OR',
|
|
||||||
'parent', '=', 0,
|
|
||||||
'AND',
|
|
||||||
'userTo', '=', App::$activeUser->ID,
|
|
||||||
],
|
|
||||||
'ID',
|
|
||||||
'DESC',
|
|
||||||
$limit
|
|
||||||
);
|
|
||||||
if ( $messageData->count() == 0 ) {
|
|
||||||
Debug::info( 'getInbox: No messages found' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$filters = [
|
|
||||||
'importantUser' => App::$activeUser->ID,
|
|
||||||
'deleted' => false,
|
|
||||||
'type' => 'userTo',
|
|
||||||
];
|
|
||||||
return $this->filter( $messageData->results(), $filters );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function calls the view for the message outbox.
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function getOutbox( $limit = null ) {
|
|
||||||
if ( empty( $limit ) ) {
|
|
||||||
$limit = 10;
|
|
||||||
}
|
|
||||||
$limit = [ 0, $limit ];
|
|
||||||
$messageData = self::$db->get(
|
|
||||||
$this->tableName,
|
|
||||||
[
|
|
||||||
'parent', '=', 0,
|
|
||||||
'AND',
|
|
||||||
'userFrom', '=', App::$activeUser->ID,
|
|
||||||
],
|
|
||||||
'ID',
|
|
||||||
'DESC',
|
|
||||||
$limit
|
|
||||||
);
|
|
||||||
if ( $messageData->count() == 0 ) {
|
|
||||||
Debug::info( 'getOutbox: No messages found' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$filters = [
|
|
||||||
'importantUser' => App::$activeUser->ID,
|
|
||||||
'deleted' => false,
|
|
||||||
'type' => 'userFrom',
|
|
||||||
];
|
|
||||||
return $this->filter( $messageData->results(), $filters );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is to prep our messages for display. An array of raw messages
|
|
||||||
* sent through this function will automatically have all the user ID's filter
|
|
||||||
* into actual usernames.
|
|
||||||
*
|
|
||||||
* @param $messageArray - This is an array of messages that need to be processed.
|
|
||||||
* @return array - It will return the same message array after being processed.
|
|
||||||
* @todo add filtering for BB-code.
|
|
||||||
*/
|
|
||||||
public function filter( $messageArray, $filters = [] ) {
|
|
||||||
$out = [];
|
|
||||||
foreach ( $messageArray as $message ) {
|
|
||||||
if ( !is_object( $message ) ) {
|
|
||||||
$message = $messageArray;
|
|
||||||
$end = true;
|
|
||||||
}
|
|
||||||
if ( isset( $filters['type'] ) && isset( $filters['importantUser'] ) ) {
|
|
||||||
$type = $filters['type'];
|
|
||||||
} else {
|
|
||||||
$type = null;
|
|
||||||
}
|
|
||||||
if ( isset( $filters['importantUser'] ) ) {
|
|
||||||
$user = $filters['importantUser'];
|
|
||||||
} else {
|
|
||||||
$user = App::$activeUser->ID;
|
|
||||||
}
|
|
||||||
if ( $message->parent == 0 ) {
|
|
||||||
$last = $this->getLatestMessage( $message->ID, $user, $type );
|
|
||||||
} else {
|
|
||||||
$last = $message;
|
|
||||||
}
|
|
||||||
if ( $type != null && $message->$type != $user && $last->$type != $user ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ( isset( $filters['deleted'] ) && $filters['deleted'] == false ) {
|
|
||||||
if ( $type == 'userFrom' ) {
|
|
||||||
if ( $last->senderDeleted == 1 ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( $type == 'userTo' ) {
|
|
||||||
if ( $last->recieverDeleted == 1 ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$messageOut = (array) $message;
|
|
||||||
$short = explode( ' ', Sanitize::contentShort( $message->message ) );
|
|
||||||
$summary = implode( ' ', array_splice( $short, 0, 25 ) );
|
|
||||||
if ( count( $short, 1 ) >= 25 ) {
|
|
||||||
$messageOut['summary'] = $summary . '...';
|
|
||||||
} else {
|
|
||||||
$messageOut['summary'] = $summary;
|
|
||||||
}
|
|
||||||
if ( $last->isRead == 0 ) {
|
|
||||||
$messageOut['unreadBadge'] = Views::simpleView( 'messages.unreadBadge' );
|
|
||||||
} else {
|
|
||||||
$messageOut['unreadBadge'] = '';
|
|
||||||
}
|
|
||||||
$messageOut['fromAvatar'] = self::$user->getAvatar( $message->userFrom );
|
|
||||||
$messageOut['userTo'] = self::$user->getUsername( $message->userTo );
|
|
||||||
$messageOut['userFrom'] = self::$user->getUsername( $message->userFrom );
|
|
||||||
$out[] = (object) $messageOut;
|
|
||||||
if ( !empty( $end ) ) {
|
|
||||||
$out = $out[0];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to check input and save messages to the DB.
|
|
||||||
*
|
|
||||||
* @param string $data - Username of the person receiving the sent message.
|
|
||||||
* @return function
|
|
||||||
*/
|
|
||||||
public function newThread( $to, $subject, $message ) {
|
|
||||||
if ( !self::$user->usernameExists( $to ) ) {
|
|
||||||
Debug::info( 'Message->sendMessage: User not found.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$fields = [
|
|
||||||
'userTo' => self::$user->getID( $to ),
|
|
||||||
'userFrom' => App::$activeUser->ID,
|
|
||||||
'parent' => 0,
|
|
||||||
'sent' => time(),
|
|
||||||
'lastReply' => time(),
|
|
||||||
'senderDeleted' => 0,
|
|
||||||
'recieverDeleted' => 0,
|
|
||||||
'isRead' => 0,
|
|
||||||
'subject' => $subject,
|
|
||||||
'message' => $message,
|
|
||||||
];
|
|
||||||
if ( !self::$db->insert( $this->tableName, $fields ) ) {
|
|
||||||
new CustomException( 'messageSend' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUnreadCount( $userId ) {
|
|
||||||
$result = self::$db->get(
|
|
||||||
$this->tableName,
|
|
||||||
[
|
|
||||||
'userTo', '=', $userId,
|
|
||||||
'AND',
|
|
||||||
'isRead', '=', 0,
|
|
||||||
'AND',
|
|
||||||
'parent', '=', 0,
|
|
||||||
'AND',
|
|
||||||
'recieverDeleted', '=', 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
return $result->count();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function unreadCount() {
|
|
||||||
if ( empty( App::$activeUser->ID ) ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return $this->getUnreadCount( App::$activeUser->ID );
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasPermission( $id ) {
|
|
||||||
if ( !Check::id( $id ) ) {
|
|
||||||
Debug::info( 'Invalid ID' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$messageData = self::$db->get( 'messages', [ 'ID', '=', $id ] );
|
|
||||||
if ( $messageData->count() == 0 ) {
|
|
||||||
Debug::info( 'Message not found.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$message = $messageData->first();
|
|
||||||
if ( $message->userTo != App::$activeUser->ID && $message->userFrom != App::$activeUser->ID ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marks a message as read. This is setup to only work
|
|
||||||
* if the message was sent to the active user.
|
|
||||||
*
|
|
||||||
* @param int - The message ID you are marking as read.
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function markRead( $id ) {
|
|
||||||
if ( !Check::id( $id ) ) {
|
|
||||||
Debug::info( 'Invalid ID' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$result = self::$db->get( $this->tableName, [ 'ID', '=', $id, 'AND', 'userTo', '=', App::$activeUser->ID, 'AND', 'isRead', '=', '0' ] );
|
|
||||||
if ( $result->count() == 0 ) {
|
|
||||||
Debug::info( 'Failed to mark message as read.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !self::$db->update( $this->tableName, $id, [ 'isRead' => 1 ] ) ) {
|
|
||||||
Debug::error( 'Failed to mark message as read.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function newMessageReply( $id, $message ) {
|
|
||||||
if ( !$this->hasPermission( $id ) ) {
|
|
||||||
Debug::info( 'Permission Denied.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$messageData = self::$db->get( $this->tableName, [ 'ID', '=', $id ] )->first();
|
|
||||||
if ( $messageData->userTo == App::$activeUser->ID ) {
|
|
||||||
$recipient = $messageData->userFrom;
|
|
||||||
} else {
|
|
||||||
$recipient = $messageData->userTo;
|
|
||||||
}
|
|
||||||
if ( $recipient === App::$activeUser->ID ) {
|
|
||||||
Debug::info( 'Cannot send messages to yourself' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !self::$db->update( $this->tableName, $messageData->ID, [ 'lastReply' => time() ] ) ) {
|
|
||||||
new CustomException( 'messagesReplyUpdate' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$fields = [
|
|
||||||
'senderDeleted' => 0,
|
|
||||||
'recieverDeleted' => 0,
|
|
||||||
'isRead' => 0,
|
|
||||||
'userTo' => $recipient,
|
|
||||||
'userFrom' => App::$activeUser->ID,
|
|
||||||
'message' => $message,
|
|
||||||
'subject' => 're: ' . $messageData->subject,
|
|
||||||
'sent' => time(),
|
|
||||||
'parent' => $messageData->ID,
|
|
||||||
'lastReply' => time(),
|
|
||||||
];
|
|
||||||
if ( !self::$db->insert( $this->tableName, $fields ) ) {
|
|
||||||
new CustomException( 'messagesReplySend' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function messageTitle( $id ) {
|
|
||||||
if ( !$this->hasPermission( $id ) ) {
|
|
||||||
Debug::info( 'Permission Denied.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$message = self::$db->get( $this->tableName, [ 'ID', '=', $id ] )->first();
|
|
||||||
return $message->subject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to delete messages from the DB.
|
|
||||||
*
|
|
||||||
* @param int $data - The ID of the message you are trying to delete.
|
|
||||||
* @todo - done at 5 am after no sleep. This can be simplified a lot, i just wanted a working solution ASAP
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function delete( $data ) {
|
|
||||||
if ( !is_array( $data ) ) {
|
|
||||||
$data = [ $data ];
|
|
||||||
}
|
|
||||||
foreach ( $data as $instance ) {
|
|
||||||
if ( !Check::id( $instance ) ) {
|
|
||||||
$error = true;
|
|
||||||
}
|
|
||||||
if ( !$this->hasPermission( $instance ) ) {
|
|
||||||
Debug::info( 'Permission Denied.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$message = self::$db->get( $this->tableName, [ 'ID', '=', $instance ] )->first();
|
|
||||||
if ( $message->userTo == App::$activeUser->ID ) {
|
|
||||||
$fields = [ 'recieverDeleted' => '1' ];
|
|
||||||
} else {
|
|
||||||
$fields = [ 'senderDeleted' => '1' ];
|
|
||||||
}
|
|
||||||
if ( !self::$db->update( $this->tableName, $instance, $fields ) ) {
|
|
||||||
$error = true;
|
|
||||||
}
|
|
||||||
Debug::info( "message Deleted: $instance" );
|
|
||||||
if ( !empty( $end ) ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !empty( $error ) ) {
|
|
||||||
Debug::info( 'There was an error deleting one or more messages.' );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* app/plugins/messages/plugin.php
|
|
||||||
*
|
|
||||||
* This houses all of the main plugin info and functionality.
|
|
||||||
*
|
|
||||||
* @package TP Messages
|
|
||||||
* @version 3.0
|
|
||||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
||||||
* @link https://TheTempusProject.com
|
|
||||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
||||||
*/
|
|
||||||
namespace TheTempusProject\Plugins;
|
|
||||||
|
|
||||||
use TheTempusProject\TheTempusProject as App;
|
|
||||||
use TheTempusProject\Classes\Plugin;
|
|
||||||
use TheTempusProject\Models\Message;
|
|
||||||
use TheTempusProject\Houdini\Classes\Components;
|
|
||||||
use TheTempusProject\Houdini\Classes\Views;
|
|
||||||
|
|
||||||
class Messages extends Plugin {
|
|
||||||
public $pluginName = 'TP Messages';
|
|
||||||
public $pluginAuthor = 'JoeyK';
|
|
||||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
|
||||||
public $modelVersion = '1.0';
|
|
||||||
public $pluginVersion = '3.0';
|
|
||||||
public $pluginDescription = 'A simple plugin which adds a site wide messaging system.';
|
|
||||||
public $permissionMatrix = [
|
|
||||||
'sendMessages' => [
|
|
||||||
'pretty' => 'Can send Messages',
|
|
||||||
'default' => false,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
private static $loaded = false;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
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" class="dropdown-item"><i class="fa fa-fw fa-envelope"></i> Inbox {MBADGE}</a></li>';
|
|
||||||
self::$loaded = true;
|
|
||||||
}
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
<span class="label label-danger">{MESSAGE_COUNT}</span>
|
|
@ -1,57 +0,0 @@
|
|||||||
<div class="container py-4">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<form action="" method="post" class="needs-validation">
|
|
||||||
<legend class="mb-4">New Message</legend>
|
|
||||||
<fieldset>
|
|
||||||
<!-- To User Field -->
|
|
||||||
<div class="mb-3 row">
|
|
||||||
<label for="toUser" class="col-sm-6 col-form-label">To:</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
name="toUser"
|
|
||||||
id="toUser"
|
|
||||||
value="{prepopuser}"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Subject Field -->
|
|
||||||
<div class="mb-3 row">
|
|
||||||
<label for="subject" class="col-sm-6 col-form-label">Subject:</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
name="subject"
|
|
||||||
id="subject"
|
|
||||||
required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Message Field -->
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="message" class="form-label">Message:</label>
|
|
||||||
<textarea
|
|
||||||
class="form-control"
|
|
||||||
name="message"
|
|
||||||
id="message"
|
|
||||||
rows="6"
|
|
||||||
maxlength="2000"
|
|
||||||
required></textarea>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<input type="hidden" name="token" value="{TOKEN}">
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
name="submit"
|
|
||||||
value="submit"
|
|
||||||
class="btn btn-primary btn-lg">
|
|
||||||
Send
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,40 +0,0 @@
|
|||||||
<h2>Inbox</h2>
|
|
||||||
{PAGINATION}
|
|
||||||
<form action="{ROOT_URL}messages/delete" method="post">
|
|
||||||
<table class="table table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width: 20%">From</th>
|
|
||||||
<th style="width: 25%">Subject</th>
|
|
||||||
<th style="width: 15%">Last Reply</th>
|
|
||||||
<th style="width: 20%"></th>
|
|
||||||
<th style="width: 10%"></th>
|
|
||||||
<th style="width: 10%">
|
|
||||||
<INPUT type="checkbox" onchange="checkAll(this)" name="check.t" value="T_[]"/>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{LOOP}
|
|
||||||
<tr {unreadBadge}>
|
|
||||||
<td><a href="{ROOT_URL}home/profile/{userFrom}">{userFrom}</a></td>
|
|
||||||
<td><a href="{ROOT_URL}messages/view/{ID}">{subject}</a></td>
|
|
||||||
<td>{DTC}{lastReply}{/DTC}</td>
|
|
||||||
<td><a href="{ROOT_URL}messages/read/{ID}">Mark as read</a></td>
|
|
||||||
<td><a href="{ROOT_URL}messages/delete/{ID}">Delete</a></td>
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" value="{ID}" name="T_[]">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/LOOP}
|
|
||||||
{ALT}
|
|
||||||
<tr>
|
|
||||||
<td align="center" colspan="6">
|
|
||||||
No Messages.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/ALT}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<button name="submit" value="submit" type="submit" class="btn btn-sm btn-danger">Delete</button> <a href="{ROOT_URL}messages/create" class="btn btn-sm btn-primary">New message</a>
|
|
||||||
</form>
|
|
@ -1,43 +0,0 @@
|
|||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 col-md-6 col-lg-6 col-sm-offset-0 col-md-offset-3 col-lg-offset-3 top-pad" >
|
|
||||||
<div class="card panel-primary">
|
|
||||||
{LOOP}
|
|
||||||
{SINGLE}
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">{subject}</h3>
|
|
||||||
</div>
|
|
||||||
{/SINGLE}
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 col-lg-3 " align="center">
|
|
||||||
<a href="{ROOT_URL}home/profile/{userFrom}">{userFrom}</a><br>
|
|
||||||
<img alt="User Pic" src="{ROOT_URL}{fromAvatar}" class="img-circle img-responsive">
|
|
||||||
</div>
|
|
||||||
<div class=" col-md-9 col-lg-9 ">
|
|
||||||
<table class="table table-user-information">
|
|
||||||
<tbody>
|
|
||||||
<td>{message}</td>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
{ADMIN}
|
|
||||||
{ID}
|
|
||||||
<span class="float-right">
|
|
||||||
{DTC}{sent}{/DTC}
|
|
||||||
</span>
|
|
||||||
{/ADMIN}
|
|
||||||
</div>
|
|
||||||
{/LOOP}
|
|
||||||
</div>
|
|
||||||
<form action="{ROOT_URL}messages/reply" method="post">
|
|
||||||
<input type="hidden" name="token" value="{TOKEN}">
|
|
||||||
<input type="hidden" name="messageID" value="{PID}">
|
|
||||||
<button name="submit" value="reply" type="submit" class="btn btn-sm btn-primary">Reply</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,43 +0,0 @@
|
|||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 col-md-6 col-lg-6 col-sm-offset-0 col-md-offset-3 col-lg-offset-3 top-pad" >
|
|
||||||
<div class="card panel-primary">
|
|
||||||
{LOOP}
|
|
||||||
{SINGLE}
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">{subject}</h3>
|
|
||||||
</div>
|
|
||||||
{/SINGLE}
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 col-lg-3 " align="center">
|
|
||||||
<a href="{ROOT_URL}home/profile/{userFrom}">{userFrom}</a><br>
|
|
||||||
<img alt="User Pic" src="{ROOT_URL}{fromAvatar}" class="img-circle img-responsive">
|
|
||||||
</div>
|
|
||||||
<div class=" col-md-9 col-lg-9 ">
|
|
||||||
<table class="table table-user-information">
|
|
||||||
<tbody>
|
|
||||||
<td>{message}</td>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
{ADMIN}
|
|
||||||
{ID}
|
|
||||||
<span class="float-right">
|
|
||||||
{DTC}{sent}{/DTC}
|
|
||||||
</span>
|
|
||||||
{/ADMIN}
|
|
||||||
</div>
|
|
||||||
{/LOOP}
|
|
||||||
</div>
|
|
||||||
<form action="{ROOT_URL}messages/reply" method="post">
|
|
||||||
<input type="hidden" name="token" value="{TOKEN}">
|
|
||||||
<input type="hidden" name="messageID" value="{PID}">
|
|
||||||
<button name="submit" value="reply" type="submit" class="btn btn-sm btn-primary">Reply</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,49 +0,0 @@
|
|||||||
<div class="dropdown nav-item mx-2">
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
class="d-block dropdown-toggle nav-link"
|
|
||||||
id="messagesDropdown"
|
|
||||||
data-bs-toggle="dropdown"
|
|
||||||
aria-haspopup="true"
|
|
||||||
aria-expanded="false">
|
|
||||||
<i class="fa fa-fw fa-envelope"></i><span class="ml-3">{MBADGE}</span>
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu text-small" aria-labelledby="messagesDropdown">
|
|
||||||
<li class="message-header">
|
|
||||||
<div class="media">
|
|
||||||
<div class="media-body text-center" style="padding-bottom: 10px; padding-top: 10px">
|
|
||||||
{MESSAGE_COUNT} unread message(s) total
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{LOOP}
|
|
||||||
<li class="message-preview">
|
|
||||||
<a href="{ROOT_URL}messages/view/{ID}">
|
|
||||||
<div class="media">
|
|
||||||
<span class="float-left">
|
|
||||||
<img class="media-object avatar-round-40" src="{ROOT_URL}{fromAvatar}" alt="">
|
|
||||||
</span>
|
|
||||||
<div class="media-body">
|
|
||||||
<h5 class="media-heading"><strong>{userFrom}</strong>
|
|
||||||
</h5>
|
|
||||||
<p class="small text-muted"><i class="fa fa-clock-o"></i> {DTC}{lastReply}{/DTC}</p>
|
|
||||||
{summary}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{/LOOP}
|
|
||||||
{ALT}
|
|
||||||
<li class="message-preview">
|
|
||||||
<div class="media">
|
|
||||||
<div class="media-body text-center" style="padding-bottom: 10px; padding-top: 10px">
|
|
||||||
<h5 class="media-heading"><strong>No Messages</strong></h5>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{/ALT}
|
|
||||||
<li class="message-footer text-center">
|
|
||||||
<a href="{ROOT_URL}messages" class="dropdown-item">Read All New Messages</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
@ -1,38 +0,0 @@
|
|||||||
<h2>Outbox</h2>
|
|
||||||
{PAGINATION}
|
|
||||||
<form action="{ROOT_URL}messages/delete" method="post">
|
|
||||||
<table class="table table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width: 20%">To</th>
|
|
||||||
<th style="width: 40%">Subject</th>
|
|
||||||
<th style="width: 20%">Sent</th>
|
|
||||||
<th style="width: 10%"></th>
|
|
||||||
<th style="width: 10%">
|
|
||||||
<INPUT type="checkbox" onchange="checkAll(this)" name="check.e" value="F_[]"/>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{LOOP}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{ROOT_URL}home/profile/{userTo}">{userTo}</a></td>
|
|
||||||
<td><a href="{ROOT_URL}messages/view/{ID}">{subject}</a></td>
|
|
||||||
<td>{DTC date}{sent}{/DTC}</td>
|
|
||||||
<td><a href="{ROOT_URL}messages/delete/{ID}">Delete</a></td>
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" value="{ID}" name="F_[]">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/LOOP}
|
|
||||||
{ALT}
|
|
||||||
<tr>
|
|
||||||
<td align="center" colspan="6">
|
|
||||||
No Messages
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/ALT}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<button name="submit" value="submit" type="submit" class="btn btn-sm btn-danger">Delete</button>
|
|
||||||
</form>
|
|
@ -1,14 +0,0 @@
|
|||||||
<form action="" method="post" class="form-horizontal">
|
|
||||||
<legend>Reply</legend>
|
|
||||||
<fieldset>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="message" class="col-lg-3 control-label">Message:</label>
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<textarea class="form-control" name="message" maxlength="2000" rows="10" cols="50" id="message"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<input type="hidden" name="messageID" value="{messageID}">
|
|
||||||
<input type="hidden" name="token" value="{TOKEN}">
|
|
||||||
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Send</button><br>
|
|
||||||
</form>
|
|
@ -1 +0,0 @@
|
|||||||
class="bg-info"
|
|
Reference in New Issue
Block a user