remove unused plugins and code
This commit is contained in:
@ -1,189 +0,0 @@
|
||||
{
|
||||
"main": {
|
||||
"logo": {
|
||||
"type": "file",
|
||||
"pretty": "Site Logo (Used mostly in emails)",
|
||||
"default": "images\/logo.png",
|
||||
"value": "images\/logoScaled.png"
|
||||
},
|
||||
"logoLarge": {
|
||||
"type": "file",
|
||||
"pretty": "Large Site Logo (Used mostly when sharing images on social media)",
|
||||
"default": "images\/logoLarge.jpg",
|
||||
"value": "images\/logoLarge.png"
|
||||
},
|
||||
"name": {
|
||||
"type": "text",
|
||||
"pretty": "Site Name",
|
||||
"default": "TTP Example",
|
||||
"value": "JoeyKimsey"
|
||||
},
|
||||
"template": {
|
||||
"type": "text",
|
||||
"pretty": "Default Site Template",
|
||||
"default": "default",
|
||||
"value": "default"
|
||||
},
|
||||
"tokenEnabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable CSRF Token for all forms.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"loginLimit": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum Login Attempts per hour",
|
||||
"default": 5,
|
||||
"value": 5
|
||||
},
|
||||
"loginTimer": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum Login session length. (in seconds)",
|
||||
"default": 604800,
|
||||
"value": 604800
|
||||
}
|
||||
},
|
||||
"database": {
|
||||
"dbEnabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Database Enabled",
|
||||
"default": true,
|
||||
"protected": true,
|
||||
"value": true
|
||||
},
|
||||
"dbHost": {
|
||||
"type": "text",
|
||||
"pretty": "Database Host (IE: http:\/\/localhost:3306)",
|
||||
"default": "127.0.0.1",
|
||||
"protected": true,
|
||||
"value": "192.168.1.194"
|
||||
},
|
||||
"dbMaxQuery": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum results per query",
|
||||
"default": 100,
|
||||
"protected": true,
|
||||
"value": 100
|
||||
},
|
||||
"dbName": {
|
||||
"type": "text",
|
||||
"pretty": "Database Name",
|
||||
"default": "ttp-example",
|
||||
"protected": true,
|
||||
"value": "jk"
|
||||
},
|
||||
"dbPassword": {
|
||||
"type": "text",
|
||||
"pretty": "Database Password",
|
||||
"default": "",
|
||||
"protected": true,
|
||||
"value": "48164816"
|
||||
},
|
||||
"dbPrefix": {
|
||||
"type": "text",
|
||||
"pretty": "Database table Prefix",
|
||||
"default": "TTP_",
|
||||
"protected": true,
|
||||
"value": "TTP_"
|
||||
},
|
||||
"dbUsername": {
|
||||
"type": "text",
|
||||
"pretty": "Database Username",
|
||||
"default": "root",
|
||||
"protected": true,
|
||||
"value": "root"
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"defaultGroup": {
|
||||
"type": "customSelect",
|
||||
"pretty": "The Default Group for new registrations.",
|
||||
"default": 5,
|
||||
"value": 5
|
||||
}
|
||||
},
|
||||
"logging": {
|
||||
"admin": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Admin Action Logging.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"errors": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Error Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"logins": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Login Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"feedback": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable User Feedback.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"sendEmail": {
|
||||
"type": "radio",
|
||||
"pretty": "Email the user after submitting.",
|
||||
"default": false,
|
||||
"value": false
|
||||
},
|
||||
"emailTemplate": {
|
||||
"type": "text",
|
||||
"pretty": "Email Template",
|
||||
"default": "feedbackEmail",
|
||||
"value": "feedbackEmail"
|
||||
}
|
||||
},
|
||||
"resume": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable the resume Feature.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"portfolio": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable the portfolio Feature.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"wip": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable the wip Feature.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable User Contact.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"sendEmail": {
|
||||
"type": "radio",
|
||||
"pretty": "Email the user after submitting.",
|
||||
"default": false,
|
||||
"value": false
|
||||
},
|
||||
"emailTemplate": {
|
||||
"type": "text",
|
||||
"pretty": "Email Template",
|
||||
"default": "contactEmail",
|
||||
"value": "contactEmail"
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
{"main":{"logo":{"type":"file","pretty":"Site Logo (Used mostly in emails)","default":"images\/logo.png","value":"images\/logo.png"},"logoLarge":{"type":"file","pretty":"Large Site Logo (Used mostly when sharing images on social media)","default":"images\/logoLarge.jpg","value":"images\/curseforge.png"},"name":{"type":"text","pretty":"Site Name","default":"TTP Example","value":"JoeyKimsey"},"template":{"type":"text","pretty":"Default Site Template","default":"default","value":"default"},"tokenEnabled":{"type":"radio","pretty":"Enable CSRF Token for all forms.","default":true,"value":true},"loginLimit":{"type":"text","pretty":"Maximum Login Attempts per hour","default":5,"value":5},"loginTimer":{"type":"text","pretty":"Maximum Login session length. (in seconds)","default":604800,"value":604800}},"database":{"dbEnabled":{"type":"radio","pretty":"Database Enabled","default":true,"protected":true,"value":true},"dbHost":{"type":"text","pretty":"Database Host (IE: http:\/\/localhost:3306)","default":"127.0.0.1","protected":true,"value":"192.168.1.194"},"dbMaxQuery":{"type":"text","pretty":"Maximum results per query","default":100,"protected":true,"value":100},"dbName":{"type":"text","pretty":"Database Name","default":"ttp-example","protected":true,"value":"jk"},"dbPassword":{"type":"text","pretty":"Database Password","default":"","protected":true,"value":"48164816"},"dbPrefix":{"type":"text","pretty":"Database table Prefix","default":"TTP_","protected":true,"value":"TTP_"},"dbUsername":{"type":"text","pretty":"Database Username","default":"root","protected":true,"value":"root"}},"group":{"defaultGroup":{"type":"customSelect","pretty":"The Default Group for new registrations.","default":5,"value":5}},"logging":{"admin":{"type":"radio","pretty":"Enable Admin Action Logging.","default":true,"value":true},"errors":{"type":"radio","pretty":"Enable Error Logging","default":true,"value":true},"logins":{"type":"radio","pretty":"Enable Login Logging","default":true,"value":true}},"feedback":{"enabled":{"type":"radio","pretty":"Enable User Feedback.","default":true,"value":true},"sendEmail":{"type":"radio","pretty":"Email the user after submitting.","default":false,"value":false},"emailTemplate":{"type":"text","pretty":"Email Template","default":"feedbackEmail","value":"feedbackEmail"}},"resume":{"enabled":{"type":"radio","pretty":"Enable the resume Feature.","default":true,"value":true}},"portfolio":{"enabled":{"type":"radio","pretty":"Enable the portfolio Feature.","default":true,"value":true}},"wip":{"enabled":{"type":"radio","pretty":"Enable the wip Feature.","default":true,"value":true}}}
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"main":{"logo":{"type":"file","pretty":"Site Logo (Used mostly in emails)","default":"images\/logo.png","value":"images\/logo.png"},"name":{"type":"text","pretty":"Site Name","default":"TTP Example","value":"JoeyKimsey"},"template":{"type":"text","pretty":"Default Site Template","default":"default","value":"default"},"tokenEnabled":{"type":"radio","pretty":"Enable CSRF Token for all forms.","default":true,"value":true},"loginLimit":{"type":"text","pretty":"Maximum Login Attempts per hour","default":5,"value":5}},"database":{"dbEnabled":{"type":"radio","pretty":"Database Enabled","default":true,"protected":true,"value":true},"dbHost":{"type":"text","pretty":"Database Host (IE: http:\/\/localhost:3306)","default":"127.0.0.1","protected":true,"value":"192.168.1.194"},"dbMaxQuery":{"type":"text","pretty":"Maximum results per query","default":100,"protected":true,"value":100},"dbName":{"type":"text","pretty":"Database Name","default":"ttp-example","protected":true,"value":"jk"},"dbPassword":{"type":"text","pretty":"Database Password","default":"","protected":true,"value":"48164816"},"dbPrefix":{"type":"text","pretty":"Database table Prefix","default":"TTP_","protected":true,"value":"TTP_"},"dbUsername":{"type":"text","pretty":"Database Username","default":"root","protected":true,"value":"root"}},"group":{"defaultGroup":{"type":"customSelect","pretty":"The Default Group for new registrations.","default":5,"value":5}},"logging":{"admin":{"type":"radio","pretty":"Enable Admin Action Logging.","default":true,"value":true},"errors":{"type":"radio","pretty":"Enable Error Logging","default":true,"value":true},"logins":{"type":"radio","pretty":"Enable Login Logging","default":true,"value":true}},"bugreports":{"enabled":{"type":"radio","pretty":"Enable Bug reporting.","default":true,"value":true},"sendEmail":{"type":"radio","pretty":"Email the user after submitting.","default":true,"value":true},"emailTemplate":{"type":"text","pretty":"Email Template","default":"BugReportEmail","value":"BugReportEmail"}},"feedback":{"enabled":{"type":"radio","pretty":"Enable User Feedback.","default":true,"value":true},"sendEmail":{"type":"radio","pretty":"Email the user after submitting.","default":false,"value":false},"emailTemplate":{"type":"text","pretty":"Email Template","default":"feedbackEmail","value":"feedbackEmail"}},"resume":{"enabled":{"type":"radio","pretty":"Enable the resume Feature.","default":true,"value":true}},"portfolio":{"enabled":{"type":"radio","pretty":"Enable the portfolio Feature.","default":true,"value":true}},"wip":{"enabled":{"type":"radio","pretty":"Enable the wip Feature.","default":true,"value":true}}}
|
@ -1 +0,0 @@
|
||||
{"main":{"logo":{"type":"file","pretty":"Site Logo (Used mostly in emails)","default":"images\/logo.png","value":"images\/logo.png"},"name":{"type":"text","pretty":"Site Name","default":"TTP Example","value":"JoeyKimsey"},"template":{"type":"text","pretty":"Default Site Template","default":"default","value":"default"},"tokenEnabled":{"type":"radio","pretty":"Enable CSRF Token for all forms.","default":true,"value":true},"loginLimit":{"type":"text","pretty":"Maximum Login Attempts per hour","default":5,"value":5}},"database":{"dbEnabled":{"type":"radio","pretty":"Database Enabled","default":true,"protected":true,"value":true},"dbHost":{"type":"text","pretty":"Database Host (IE: http:\/\/localhost:3306)","default":"127.0.0.1","protected":true,"value":"192.168.1.194"},"dbMaxQuery":{"type":"text","pretty":"Maximum results per query","default":100,"protected":true,"value":100},"dbName":{"type":"text","pretty":"Database Name","default":"ttp-example","protected":true,"value":"jk"},"dbPassword":{"type":"text","pretty":"Database Password","default":"","protected":true,"value":"48164816"},"dbPrefix":{"type":"text","pretty":"Database table Prefix","default":"TTP_","protected":true,"value":"TTP_"},"dbUsername":{"type":"text","pretty":"Database Username","default":"root","protected":true,"value":"root"}}}
|
@ -1,137 +0,0 @@
|
||||
<?php
|
||||
define( 'APP_SPACE', 'TheTempusProject' );
|
||||
if ( ! defined( 'APP_ROOT_DIRECTORY' ) ) {
|
||||
define( 'APP_ROOT_DIRECTORY', dirname( __DIR__ ) . DIRECTORY_SEPARATOR ); // need to verify
|
||||
}
|
||||
define( 'APP_DIRECTORY', APP_ROOT_DIRECTORY . 'app' . DIRECTORY_SEPARATOR );
|
||||
// Directories
|
||||
define( 'CSS_DIRECTORY', APP_ROOT_DIRECTORY . 'css' . DIRECTORY_SEPARATOR );
|
||||
define( 'IMAGE_DIRECTORY', APP_ROOT_DIRECTORY . 'images' . DIRECTORY_SEPARATOR );
|
||||
define( 'JAVASCRIPT_DIRECTORY', APP_ROOT_DIRECTORY . 'js' . DIRECTORY_SEPARATOR );
|
||||
define( 'HTACCESS_LOCATION', APP_ROOT_DIRECTORY . '.htaccess' );
|
||||
if ( ! defined( 'CONFIG_DIRECTORY' ) ) {
|
||||
define( 'CONFIG_DIRECTORY', APP_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
define( 'PLUGIN_DIRECTORY', APP_DIRECTORY . 'plugins' . DIRECTORY_SEPARATOR );
|
||||
define( 'MODEL_DIRECTORY', APP_DIRECTORY . 'models' . DIRECTORY_SEPARATOR );
|
||||
define( 'CONTROLLER_DIRECTORY', APP_DIRECTORY . 'controllers' . DIRECTORY_SEPARATOR );
|
||||
define( 'ADMIN_CONTROLLER_DIRECTORY', CONTROLLER_DIRECTORY. 'admin' . DIRECTORY_SEPARATOR );
|
||||
define( 'API_CONTROLLER_DIRECTORY', CONTROLLER_DIRECTORY. 'api' . DIRECTORY_SEPARATOR );
|
||||
// Files
|
||||
define( 'PERMISSIONS_JSON', CONFIG_DIRECTORY . 'permissions.json' );
|
||||
define( 'PREFERENCES_JSON', CONFIG_DIRECTORY . 'preferences.json' );
|
||||
define( 'INSTALL_JSON_LOCATION', CONFIG_DIRECTORY . 'install.json' );
|
||||
define( 'INSTALLER_LOCATION', APP_ROOT_DIRECTORY . 'install.php' );
|
||||
// Other
|
||||
define( 'PLUGINS_ENABLED', true );
|
||||
define( 'INSTALL_STATUS_NOT_REQUIRED', 'Not Required' );
|
||||
define( 'INSTALL_STATUS_NOT_FOUND', 'Not Found' );
|
||||
define( 'INSTALL_STATUS_PARTIALLY_INSTALLED', 'Partially Installed' );
|
||||
define( 'INSTALL_STATUS_NOT_INSTALLED', 'Not Installed' );
|
||||
define( 'INSTALL_STATUS_INSTALLED', 'Installed' );
|
||||
define( 'INSTALL_STATUS_UNINSTALLED', 'Uninstalled' );
|
||||
define( 'INSTALL_STATUS_SUCCESS', 'Success' );
|
||||
define( 'INSTALL_STATUS_SKIPPED', 'Skipped' );
|
||||
define( 'INSTALL_STATUS_FAIL', 'Failed' );
|
||||
define( 'MODEL_INSTALL_FLAGS', [ 'installTable', 'installPermissions', 'installConfigs', 'installResources', 'installPreferences' ] );
|
||||
define( 'PLUGIN_INSTALL_FLAGS', [ 'models_installed', 'permissions_installed', 'configs_installed', 'resources_installed', 'preferences_installed' ] );
|
||||
# Tempus Debugger
|
||||
define( 'CANARY_SECURE_HASH', 'd73ed7591a30f0ca7d686a0e780f0d05' );
|
||||
# Tempus Project Core
|
||||
// Check
|
||||
define( 'MINIMUM_PHP_VERSION', 8.1);
|
||||
// Cookies
|
||||
define( 'DEFAULT_COOKIE_PREFIX', 'TP_');
|
||||
// Debug
|
||||
|
||||
define( 'CANARY_DEBUG_DIRECTORY', APP_ROOT_DIRECTORY . 'logs' . DIRECTORY_SEPARATOR );
|
||||
define( 'CANARY_DEBUG_LEVEL_ERROR', 'error' );
|
||||
define( 'CANARY_DEBUG_LEVEL_WARN', 'warn' );
|
||||
define( 'CANARY_DEBUG_LEVEL_INFO', 'info' );
|
||||
define( 'CANARY_DEBUG_LEVEL_LOG', 'log' );
|
||||
define( 'CANARY_DEBUG_LEVEL_DEBUG', 'debug' );
|
||||
define( 'CANARY_DEBUG_TO_FILE_LEVEL', CANARY_DEBUG_LEVEL_INFO );
|
||||
define( 'CANARY_ENABLED', true );
|
||||
define( 'DEBUG_EMAIL', 'webmaster@' . $_SERVER['HTTP_HOST'] );
|
||||
define( 'HERMES_REDIRECTS_ENABLED', true );
|
||||
define( 'RENDERING_ENABLED', true );
|
||||
define( 'CANARY_TRACE_ENABLED', false );
|
||||
define( 'CANARY_DEBUG_TO_CONSOLE', false );
|
||||
define( 'CANARY_DEBUG_TO_FILE', true );
|
||||
// Directories
|
||||
if ( ! defined( 'VENDOR_DIRECTORY' ) ) {
|
||||
define( 'VENDOR_DIRECTORY', APP_ROOT_DIRECTORY . 'vendor' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( VENDOR_DIRECTORY . 'thetempusproject' )) {
|
||||
define( 'TP_VENDOR_DIRECTORY', VENDOR_DIRECTORY . 'thetempusproject' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( VENDOR_DIRECTORY . 'TheTempusProject' )) {
|
||||
define( 'TP_VENDOR_DIRECTORY', VENDOR_DIRECTORY . 'TheTempusProject' . DIRECTORY_SEPARATOR );
|
||||
} else {
|
||||
define( 'TP_VENDOR_DIRECTORY', VENDOR_DIRECTORY);
|
||||
}
|
||||
# Bedrock
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'tempusprojectcore' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'tempusprojectcore' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'TempusProjectCore' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'TempusProjectCore' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'bedrock' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'bedrock' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Bedrock' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Bedrock' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( BEDROCK_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'BEDROCK_CONFIG_DIRECTORY', BEDROCK_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
# Canary
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'tempusdebugger' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'tempusdebugger' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'TempusDebugger' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'TempusDebugger' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'canary' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'canary' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Canary' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Canary' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( CANARY_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'CANARY_CONFIG_DIRECTORY', CANARY_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
# Hermes
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'hermes' )) {
|
||||
define( 'HERMES_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'hermes' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Hermes' )) {
|
||||
define( 'HERMES_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Hermes' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( HERMES_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'HERMES_CONFIG_DIRECTORY', HERMES_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
# Houdini
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'houdini' )) {
|
||||
define( 'HOUDINI_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'houdini' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Houdini' )) {
|
||||
define( 'HOUDINI_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Houdini' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( HOUDINI_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'HOUDINI_CONFIG_DIRECTORY', HOUDINI_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
// Shared Directories
|
||||
define( 'BIN_DIRECTORY', APP_ROOT_DIRECTORY . 'bin' . DIRECTORY_SEPARATOR );
|
||||
define( 'VIEW_DIRECTORY', APP_DIRECTORY . 'views' . DIRECTORY_SEPARATOR );
|
||||
define( 'ERRORS_DIRECTORY', VIEW_DIRECTORY . 'errors' . DIRECTORY_SEPARATOR );
|
||||
define( 'CLASSES_DIRECTORY', APP_DIRECTORY . 'classes' . DIRECTORY_SEPARATOR );
|
||||
define( 'FUNCTIONS_DIRECTORY', APP_DIRECTORY . 'functions' . DIRECTORY_SEPARATOR );
|
||||
define( 'RESOURCES_DIRECTORY', APP_DIRECTORY . 'resources' . DIRECTORY_SEPARATOR );
|
||||
define( 'TEMPLATE_DIRECTORY', APP_DIRECTORY . 'templates' . DIRECTORY_SEPARATOR );
|
||||
define( 'UPLOAD_DIRECTORY', APP_ROOT_DIRECTORY . 'uploads' . DIRECTORY_SEPARATOR );
|
||||
define( 'IMAGE_UPLOAD_DIRECTORY', UPLOAD_DIRECTORY . 'images' . DIRECTORY_SEPARATOR );
|
||||
// Files
|
||||
define( 'COMPOSER_JSON_LOCATION', APP_ROOT_DIRECTORY . 'composer.json' );
|
||||
define( 'COMPOSER_LOCK_LOCATION', APP_ROOT_DIRECTORY . 'composer.lock' );
|
||||
define( 'CONFIG_JSON', CONFIG_DIRECTORY . 'config.json' );
|
||||
// Other
|
||||
define( 'EMAIL_FROM_EMAIL', 'noreply@localohost.com' );
|
||||
// Sessions
|
||||
define( 'DEFAULT_SESSION_PREFIX', 'TP_' );
|
||||
// Token
|
||||
define( 'DEFAULT_TOKEN_NAME', 'TP_SESSION_TOKEN' );
|
||||
# Tell the app; all constants have been loaded
|
||||
define( 'TEMPUS_PROJECT_CONSTANTS_LOADED', true );
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"bugReport":{"pretty":"Can Submit Bug Reports","default":false},"modAccess":{"pretty":"Access Moderator Areas","default":false},"feedback":{"pretty":"Can Submit Feedback","default":false},"sendMessages":{"pretty":"Can send Messages","default":false},"sendNotifications":{"pretty":"Can send notifications","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"memberAccess":{"pretty":"Access Member Areas","default":false},"controlMemberships":{"pretty":"User can Access and Control user memberships.","default":false}}
|
@ -1 +0,0 @@
|
||||
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"bugReport":{"pretty":"Can Submit Bug Reports","default":false},"modAccess":{"pretty":"Access Moderator Areas","default":false},"feedback":{"pretty":"Can Submit Feedback","default":false},"sendMessages":{"pretty":"Can send Messages","default":false},"sendNotifications":{"pretty":"Can send notifications","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"memberAccess":{"pretty":"Access Member Areas","default":false},"controlMemberships":{"pretty":"User can Access and Control user memberships.","default":false}}
|
@ -1 +0,0 @@
|
||||
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"}}
|
@ -1 +0,0 @@
|
||||
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"}}
|
@ -1 +0,0 @@
|
||||
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"feedback":{"pretty":"Can Submit Feedback","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"memberAccess":{"pretty":"Access Member Areas","default":false},"controlMemberships":{"pretty":"User can Access and Control user memberships.","default":false},"contact":{"pretty":"Can Submit Contact","default":true},"updates":{"pretty":"Can create status updates","default":false}}
|
@ -1 +0,0 @@
|
||||
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"feedback":{"pretty":"Can Submit Feedback","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"memberAccess":{"pretty":"Access Member Areas","default":false},"controlMemberships":{"pretty":"User can Access and Control user memberships.","default":false},"contact":{"pretty":"Can Submit Contact","default":true},"updates":{"pretty":"Can create status updates","default":false}}
|
@ -1 +0,0 @@
|
||||
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"}}
|
@ -1 +0,0 @@
|
||||
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/nginx\/jk.local\/images\/defaultAvatar.png"}}
|
@ -1,204 +0,0 @@
|
||||
{
|
||||
"main":
|
||||
{
|
||||
"logo":
|
||||
{
|
||||
"type": "file",
|
||||
"pretty": "Site Logo (Used mostly in emails)",
|
||||
"default": "images/logo.png",
|
||||
"value": "images/logo.png"
|
||||
},
|
||||
"name":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Site Name",
|
||||
"default": "TTP Example",
|
||||
"value": "Joey Kimsey"
|
||||
},
|
||||
"template":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Default Site Template",
|
||||
"default": "default",
|
||||
"value": "default"
|
||||
},
|
||||
"tokenEnabled":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable CSRF Token for all forms.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"loginLimit":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Maximum Login Attempts per hour",
|
||||
"default": 5,
|
||||
"value": "5"
|
||||
}
|
||||
},
|
||||
"uploads":
|
||||
{
|
||||
"files":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable File Uploads",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"images":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Image Uploads",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"maxFileSize":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Maximum File Size",
|
||||
"default": 5000000,
|
||||
"value": "5000000"
|
||||
},
|
||||
"maxImageSize":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Maximum Image Size",
|
||||
"default": 500000,
|
||||
"value": "500000"
|
||||
}
|
||||
},
|
||||
"database":
|
||||
{
|
||||
"dbMaxQuery":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Maximum results per query",
|
||||
"default": 100,
|
||||
"protected": true,
|
||||
"value": 100
|
||||
},
|
||||
"dbEnabled":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Database Enabled",
|
||||
"default": true,
|
||||
"protected": true,
|
||||
"value": true
|
||||
},
|
||||
"dbHost":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Database Host (IE: http://localhost:3306)",
|
||||
"default": "127.0.0.1",
|
||||
"protected": true,
|
||||
"value": "194.195.208.99"
|
||||
},
|
||||
"dbName":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Database Name",
|
||||
"default": "ttp-example",
|
||||
"protected": true,
|
||||
"value": "jk-com"
|
||||
},
|
||||
"dbPassword":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Database Password",
|
||||
"default": "",
|
||||
"protected": true,
|
||||
"value": "lsVb#$D74816"
|
||||
},
|
||||
"dbPrefix":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Database table Prefix",
|
||||
"default": "TTP_",
|
||||
"protected": true,
|
||||
"value": "TTP_"
|
||||
},
|
||||
"dbUsername":
|
||||
{
|
||||
"type": "text",
|
||||
"pretty": "Database Username",
|
||||
"default": "root",
|
||||
"protected": true,
|
||||
"value": "joeyk"
|
||||
}
|
||||
},
|
||||
"group":
|
||||
{
|
||||
"defaultGroup":
|
||||
{
|
||||
"type": "customSelect",
|
||||
"pretty": "The Default Group for new registrations.",
|
||||
"default": 5,
|
||||
"value": 5
|
||||
}
|
||||
},
|
||||
"logging":
|
||||
{
|
||||
"admin":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Admin Action Logging.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"errors":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Error Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"logins":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Login Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"bookmarks":
|
||||
{
|
||||
"enabled":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Bookmarks.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"calendar":
|
||||
{
|
||||
"enabled":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Calendar.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"contacts":
|
||||
{
|
||||
"enabled":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Contacts.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"notes":
|
||||
{
|
||||
"enabled":
|
||||
{
|
||||
"type": "radio",
|
||||
"pretty": "Enable Notes.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
{"main":{"logo":{"value":"images\/logo.png"},"name":{"value":"Joey Kimsey"},"loginLimit":{"type":"text","pretty":"Maximum Login Attempts per hour","default":5,"value":5}},"database":{"dbMaxQuery":{"value":100},"dbEnabled":{"value":true},"dbHost":{"value":"194.195.208.99"},"dbName":{"value":"jk-com"},"dbPassword":{"value":"lsVb#$D74816"},"dbPrefix":{"value":"TTP_"},"dbUsername":{"value":"joeyk"}}}
|
@ -1,139 +0,0 @@
|
||||
<?php
|
||||
define( 'APP_SPACE', 'TheTempusProject' );
|
||||
if ( ! defined( 'APP_ROOT_DIRECTORY' ) ) {
|
||||
define( 'APP_ROOT_DIRECTORY', dirname( __DIR__ ) . DIRECTORY_SEPARATOR ); // need to verify
|
||||
}
|
||||
define( 'APP_DIRECTORY', APP_ROOT_DIRECTORY . 'app' . DIRECTORY_SEPARATOR );
|
||||
// Directories
|
||||
define( 'CSS_DIRECTORY', APP_ROOT_DIRECTORY . 'css' . DIRECTORY_SEPARATOR );
|
||||
define( 'IMAGE_DIRECTORY', APP_ROOT_DIRECTORY . 'images' . DIRECTORY_SEPARATOR );
|
||||
define( 'JAVASCRIPT_DIRECTORY', APP_ROOT_DIRECTORY . 'js' . DIRECTORY_SEPARATOR );
|
||||
define( 'HTACCESS_LOCATION', APP_ROOT_DIRECTORY . '.htaccess' );
|
||||
if ( ! defined( 'CONFIG_DIRECTORY' ) ) {
|
||||
define( 'CONFIG_DIRECTORY', APP_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
define( 'PLUGIN_DIRECTORY', APP_DIRECTORY . 'plugins' . DIRECTORY_SEPARATOR );
|
||||
define( 'MODEL_DIRECTORY', APP_DIRECTORY . 'models' . DIRECTORY_SEPARATOR );
|
||||
define( 'CONTROLLER_DIRECTORY', APP_DIRECTORY . 'controllers' . DIRECTORY_SEPARATOR );
|
||||
define( 'ADMIN_CONTROLLER_DIRECTORY', CONTROLLER_DIRECTORY. 'admin' . DIRECTORY_SEPARATOR );
|
||||
define( 'API_CONTROLLER_DIRECTORY', CONTROLLER_DIRECTORY. 'api' . DIRECTORY_SEPARATOR );
|
||||
// Files
|
||||
define( 'PERMISSIONS_JSON', CONFIG_DIRECTORY . 'permissions.json' );
|
||||
define( 'PREFERENCES_JSON', CONFIG_DIRECTORY . 'preferences.json' );
|
||||
define( 'INSTALL_JSON_LOCATION', CONFIG_DIRECTORY . 'install.json' );
|
||||
define( 'INSTALLER_LOCATION', APP_ROOT_DIRECTORY . 'install.php' );
|
||||
// Other
|
||||
define( 'PLUGINS_ENABLED', true );
|
||||
define( 'INSTALL_STATUS_NOT_REQUIRED', 'Not Required' );
|
||||
define( 'INSTALL_STATUS_NOT_FOUND', 'Not Found' );
|
||||
define( 'INSTALL_STATUS_PARTIALLY_INSTALLED', 'Partially Installed' );
|
||||
define( 'INSTALL_STATUS_NOT_INSTALLED', 'Not Installed' );
|
||||
define( 'INSTALL_STATUS_INSTALLED', 'Installed' );
|
||||
define( 'INSTALL_STATUS_UNINSTALLED', 'Uninstalled' );
|
||||
define( 'INSTALL_STATUS_SUCCESS', 'Success' );
|
||||
define( 'INSTALL_STATUS_SKIPPED', 'Skipped' );
|
||||
define( 'INSTALL_STATUS_FAIL', 'Failed' );
|
||||
define( 'MODEL_INSTALL_FLAGS', [ 'installTable', 'installPermissions', 'installConfigs', 'installResources', 'installPreferences' ] );
|
||||
define( 'PLUGIN_INSTALL_FLAGS', [ 'models_installed', 'permissions_installed', 'configs_installed', 'resources_installed', 'preferences_installed' ] );
|
||||
# Tempus Debugger
|
||||
define( 'CANARY_SECURE_HASH', 'd73ed7591a30f0ca7d686a0e780f0d05' );
|
||||
# Tempus Project Core
|
||||
define( 'APP_NAME', 'The Tempus Project');
|
||||
define( 'TP_DEFAULT_LOGO', 'images/logo.png');
|
||||
// Check
|
||||
define( 'MINIMUM_PHP_VERSION', 8.1);
|
||||
// Cookies
|
||||
define( 'DEFAULT_COOKIE_PREFIX', 'TP_');
|
||||
// Debug
|
||||
|
||||
define( 'CANARY_DEBUG_DIRECTORY', APP_ROOT_DIRECTORY . 'logs' . DIRECTORY_SEPARATOR );
|
||||
define( 'CANARY_DEBUG_LEVEL_ERROR', 'error' );
|
||||
define( 'CANARY_DEBUG_LEVEL_WARN', 'warn' );
|
||||
define( 'CANARY_DEBUG_LEVEL_INFO', 'info' );
|
||||
define( 'CANARY_DEBUG_LEVEL_LOG', 'log' );
|
||||
define( 'CANARY_DEBUG_LEVEL_DEBUG', 'debug' );
|
||||
define( 'CANARY_DEBUG_TO_FILE_LEVEL', CANARY_DEBUG_LEVEL_INFO );
|
||||
define( 'CANARY_ENABLED', true );
|
||||
define( 'DEBUG_EMAIL', 'webmaster@' . $_SERVER['HTTP_HOST'] );
|
||||
define( 'HERMES_REDIRECTS_ENABLED', true );
|
||||
define( 'RENDERING_ENABLED', true );
|
||||
define( 'CANARY_TRACE_ENABLED', false );
|
||||
define( 'CANARY_DEBUG_TO_CONSOLE', false );
|
||||
define( 'CANARY_DEBUG_TO_FILE', true );
|
||||
// Directories
|
||||
if ( ! defined( 'VENDOR_DIRECTORY' ) ) {
|
||||
define( 'VENDOR_DIRECTORY', APP_ROOT_DIRECTORY . 'vendor' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( VENDOR_DIRECTORY . 'thetempusproject' )) {
|
||||
define( 'TP_VENDOR_DIRECTORY', VENDOR_DIRECTORY . 'thetempusproject' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( VENDOR_DIRECTORY . 'TheTempusProject' )) {
|
||||
define( 'TP_VENDOR_DIRECTORY', VENDOR_DIRECTORY . 'TheTempusProject' . DIRECTORY_SEPARATOR );
|
||||
} else {
|
||||
define( 'TP_VENDOR_DIRECTORY', VENDOR_DIRECTORY);
|
||||
}
|
||||
# Bedrock
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'tempusprojectcore' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'tempusprojectcore' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'TempusProjectCore' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'TempusProjectCore' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'bedrock' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'bedrock' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Bedrock' )) {
|
||||
define( 'BEDROCK_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Bedrock' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( BEDROCK_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'BEDROCK_CONFIG_DIRECTORY', BEDROCK_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
# Canary
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'tempusdebugger' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'tempusdebugger' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'TempusDebugger' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'TempusDebugger' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'canary' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'canary' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Canary' )) {
|
||||
define( 'CANARY_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Canary' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( CANARY_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'CANARY_CONFIG_DIRECTORY', CANARY_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
# Hermes
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'hermes' )) {
|
||||
define( 'HERMES_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'hermes' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Hermes' )) {
|
||||
define( 'HERMES_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Hermes' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( HERMES_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'HERMES_CONFIG_DIRECTORY', HERMES_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
# Houdini
|
||||
if ( is_dir( TP_VENDOR_DIRECTORY . 'houdini' )) {
|
||||
define( 'HOUDINI_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'houdini' . DIRECTORY_SEPARATOR );
|
||||
} elseif ( is_dir( TP_VENDOR_DIRECTORY . 'Houdini' )) {
|
||||
define( 'HOUDINI_ROOT_DIRECTORY', TP_VENDOR_DIRECTORY . 'Houdini' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
if ( is_dir( HOUDINI_ROOT_DIRECTORY . 'config' )) {
|
||||
define( 'HOUDINI_CONFIG_DIRECTORY', HOUDINI_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
|
||||
}
|
||||
// Shared Directories
|
||||
define( 'BIN_DIRECTORY', APP_ROOT_DIRECTORY . 'bin' . DIRECTORY_SEPARATOR );
|
||||
define( 'VIEW_DIRECTORY', APP_DIRECTORY . 'views' . DIRECTORY_SEPARATOR );
|
||||
define( 'ERRORS_DIRECTORY', VIEW_DIRECTORY . 'errors' . DIRECTORY_SEPARATOR );
|
||||
define( 'CLASSES_DIRECTORY', APP_DIRECTORY . 'classes' . DIRECTORY_SEPARATOR );
|
||||
define( 'FUNCTIONS_DIRECTORY', APP_DIRECTORY . 'functions' . DIRECTORY_SEPARATOR );
|
||||
define( 'RESOURCES_DIRECTORY', APP_DIRECTORY . 'resources' . DIRECTORY_SEPARATOR );
|
||||
define( 'TEMPLATE_DIRECTORY', APP_DIRECTORY . 'templates' . DIRECTORY_SEPARATOR );
|
||||
define( 'UPLOAD_DIRECTORY', APP_ROOT_DIRECTORY . 'uploads' . DIRECTORY_SEPARATOR );
|
||||
define( 'IMAGE_UPLOAD_DIRECTORY', UPLOAD_DIRECTORY . 'images' . DIRECTORY_SEPARATOR );
|
||||
// Files
|
||||
define( 'COMPOSER_JSON_LOCATION', APP_ROOT_DIRECTORY . 'composer.json' );
|
||||
define( 'COMPOSER_LOCK_LOCATION', APP_ROOT_DIRECTORY . 'composer.lock' );
|
||||
define( 'CONFIG_JSON', CONFIG_DIRECTORY . 'config.json' );
|
||||
// Other
|
||||
define( 'EMAIL_FROM_EMAIL', 'noreply@localohost.com' );
|
||||
// Sessions
|
||||
define( 'DEFAULT_SESSION_PREFIX', 'TP_' );
|
||||
// Token
|
||||
define( 'DEFAULT_TOKEN_NAME', 'TP_SESSION_TOKEN' );
|
||||
# Tell the app; all constants have been loaded
|
||||
define( 'TEMPUS_PROJECT_CONSTANTS_LOADED', true );
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"useBookmarks":{"pretty":"Can use the bookmarks feature","default":false},"createEvents":{"pretty":"Can add events to bookmarks","default":false},"useCalendar":{"pretty":"Can use the calendar feature","default":false},"modAccess":{"pretty":"Access Moderator Areas","default":false},"useContacts":{"pretty":"Can use the contacts feature","default":false},"uploadFiles":{"pretty":"Can upload files","default":false},"sendMessages":{"pretty":"Can send Messages","default":false},"useNotes":{"pretty":"Can use the notes feature","default":false},"sendNotifications":{"pretty":"Can send notifications","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"createTas":{"pretty":"Can create todo items","default":false},"createList":{"pretty":"Can create todo lists","default":false},"updates":{"pretty":"Can create status updates","default":false}}
|
@ -1 +0,0 @@
|
||||
{"adminAccess":{"pretty":"Access Administrator Areas","default":false},"addRoute":{"pretty":"Add Custom Routes","default":false},"uploadImages":{"pretty":"Upload images (such as avatars)","default":false},"useBookmarks":{"pretty":"Can use the bookmarks feature","default":false},"createEvents":{"pretty":"Can add events to bookmarks","default":false},"useCalendar":{"pretty":"Can use the calendar feature","default":false},"modAccess":{"pretty":"Access Moderator Areas","default":false},"useContacts":{"pretty":"Can use the contacts feature","default":false},"uploadFiles":{"pretty":"Can upload files","default":false},"sendMessages":{"pretty":"Can send Messages","default":false},"useNotes":{"pretty":"Can use the notes feature","default":false},"sendNotifications":{"pretty":"Can send notifications","default":false},"redirects":{"pretty":"Can modify redirects","default":false},"createTas":{"pretty":"Can create todo items","default":false},"createList":{"pretty":"Can create todo lists","default":false},"updates":{"pretty":"Can create status updates","default":false}}
|
@ -1 +0,0 @@
|
||||
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"calendarPreference":{"pretty":"Default Calendar View","type":"select","default":"byMonth","options":{"Daily":"byDay","Weekly":"byWeek","Monthly":"byMonth","Yearly":"byYear","All Events":"events"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"weekStart":{"pretty":"First day of the week for the Calendar","type":"select","default":"sunday","options":{"Sunday":"6","Monday":"7"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"}}
|
@ -1 +0,0 @@
|
||||
{"gender":{"pretty":"Gender","type":"select","default":"unspecified","options":["male","female","other","unspecified"],"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"newsletter":{"pretty":"Receive our Newsletter?","type":"checkbox","default":"true","avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png","options":null},"avatar":{"pretty":"Avatar","type":"file","default":"images\/defaultAvatar.png","avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png","options":null},"timezone":{"pretty":"Timezone","type":"timezone","default":"America\/New_York","avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png","options":null},"dateFormat":{"pretty":"Date Format","type":"select","default":"F j, Y","options":{"1-8-1991":"n-j-Y","8-1-1991":"j-n-Y","01-08-1991":"m-d-Y","08-01-1991":"d-m-Y","January 8, 1991":"F-j-Y","8 January, 1991":"j-F-Y","January 08, 1991":"F-d-Y","08 January, 1991":"d-F-Y","Jan 8, 1991":"M-j-Y","8 Jan 1991":"j-M-Y","Jan 08, 1991":"M-d-Y","08 Jan 1991":"d-M-Y"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"timeFormat":{"pretty":"Time Format","type":"select","default":"g:i:s A","options":{"3:33:33 AM":"g:i:s A","03:33:33 AM":"h:i:s A","3:33:33 am":"g:i:s a","03:33:33 am":"h:i:s a","3:33:33 (military)":"G:i:s","03:33:33 (military)":"H:i:s"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"pageLimit":{"pretty":"Items Displayed Per Page","type":"select","default":"10","options":["10","15","20","25","50"],"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"calendarPreference":{"pretty":"Default Calendar View","type":"select","default":"byMonth","options":{"Daily":"byDay","Weekly":"byWeek","Monthly":"byMonth","Yearly":"byYear","All Events":"events"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"},"weekStart":{"pretty":"First day of the week for the Calendar","type":"select","default":"sunday","options":{"Sunday":"6","Monday":"7"},"avatar":"\/var\/www\/joeykimsey.com\/images\/defaultAvatar.png"}}
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/bugreport/controllers/admin/bugreport.php
|
||||
*
|
||||
* This is the bug report admin controller.
|
||||
*
|
||||
* @package TP BugReports
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Controllers\Admin;
|
||||
|
||||
use TheTempusProject\Classes\AdminController;
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Houdini\Classes\Issues;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Models\Bugreport as BugreportModel;
|
||||
|
||||
class Bugreport extends AdminController {
|
||||
protected static $bugreport;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
self::$bugreport = new BugreportModel;
|
||||
self::$title = 'Admin - Bug Reports';
|
||||
$view = Navigation::activePageSelect( 'nav.admin', '/admin/bugreport' );
|
||||
Components::set( 'ADMINNAV', $view );
|
||||
}
|
||||
|
||||
public function index( $data = null ) {
|
||||
Views::view( 'bugreport.admin.list', self::$bugreport->listPaginated() );
|
||||
}
|
||||
|
||||
public function view( $id = null ) {
|
||||
$data = self::$bugreport->findById( $id );
|
||||
if ( $data !== false ) {
|
||||
return Views::view( 'bugreport.admin.view', $data );
|
||||
}
|
||||
Issues::add( 'error', 'Report not found.' );
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function delete( $data = null ) {
|
||||
if ( Input::exists( 'submit' ) ) {
|
||||
$data = Input::post( 'BR_' );
|
||||
}
|
||||
if ( self::$bugreport->delete( (array) $data ) ) {
|
||||
Issues::add( 'success', 'Bug Report Deleted' );
|
||||
} else {
|
||||
Issues::add( 'error', 'There was an error with your request.' );
|
||||
}
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function clear( $data = null ) {
|
||||
self::$bugreport->empty();
|
||||
$this->index();
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/bugreport/controllers/bugreport.php
|
||||
*
|
||||
* This is the bug reports controller.
|
||||
*
|
||||
* @package TP BugReports
|
||||
* @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;
|
||||
|
||||
class Bugreport extends Controller {
|
||||
protected static $bugreport;
|
||||
|
||||
public function index() {
|
||||
self::$bugreport = new BugreportModel;
|
||||
self::$title = 'Bug Report - {SITENAME}';
|
||||
self::$pageDescription = 'On this page you can submit a bug report for the site.';
|
||||
if ( !App::$isLoggedIn ) {
|
||||
return Issues::add( 'notice', 'You must be logged in to report bugs.' );
|
||||
}
|
||||
if ( !Input::exists() ) {
|
||||
return Views::view( 'bugreport.create' );
|
||||
}
|
||||
if ( !Forms::check( 'bugreport' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your report.' => Check::userErrors() ] );
|
||||
return Views::view( 'bugreport.create' );
|
||||
}
|
||||
$result = self::$bugreport->create( App::$activeUser->ID, Input::post( 'url' ), Input::post( 'ourl' ), Input::post( 'repeat' ), Input::post( 'entry' ) );
|
||||
if ( false != $result ) {
|
||||
Session::flash( 'success', 'Your Bug Report has been received. We may contact you for more information at the email address you provided.' );
|
||||
Redirect::to( 'home/index' );
|
||||
} else {
|
||||
Issues::add( 'error', 'There was an unresolved error while submitting your report.' );
|
||||
return Views::view( 'bugreport.create' );
|
||||
}
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/bugreport/forms.php
|
||||
*
|
||||
* This houses all of the form checking functions for this plugin.
|
||||
*
|
||||
* @package TP BugReports
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Plugins\Bugreport;
|
||||
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Classes\Forms;
|
||||
|
||||
class BugReportForms extends Forms {
|
||||
/**
|
||||
* Adds these functions to the form list.
|
||||
*/
|
||||
public function __construct() {
|
||||
self::addHandler( 'bugreport', __CLASS__, 'bugreport' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the bug report form.
|
||||
*
|
||||
* @return {bool}
|
||||
*/
|
||||
public static function bugreport() {
|
||||
if ( !self::url( Input::post( 'url' ) ) ) {
|
||||
self::addUserError( 'Invalid url.' );
|
||||
return false;
|
||||
}
|
||||
if ( !self::url( Input::post( 'ourl' ) ) ) {
|
||||
self::addUserError( 'Invalid original url.' );
|
||||
return false;
|
||||
}
|
||||
if ( !self::tf( Input::post( 'repeat' ) ) ) {
|
||||
self::addUserError( 'Invalid repeat value.' );
|
||||
return false;
|
||||
}
|
||||
if ( !self::token() ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
new BugReportForms;
|
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/bugreport/models/bugreport.php
|
||||
*
|
||||
* This class is used for the manipulation of the bugreports database table.
|
||||
*
|
||||
* @package TP BugReports
|
||||
* @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\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||
use TheTempusProject\Canary\Classes\CustomException;
|
||||
use TheTempusProject\Classes\DatabaseModel;
|
||||
use TheTempusProject\Plugins\Bugreport as Plugin;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class Bugreport extends DatabaseModel {
|
||||
public $tableName = 'bugreports';
|
||||
public $databaseMatrix = [
|
||||
[ 'userID', 'int', '11' ],
|
||||
[ 'time', 'int', '10' ],
|
||||
[ 'repeat', 'varchar', '5' ],
|
||||
[ 'ourl', 'varchar', '256' ],
|
||||
[ 'url', 'varchar', '256' ],
|
||||
[ 'ip', 'varchar', '15' ],
|
||||
[ 'description', 'text', '' ],
|
||||
];
|
||||
public $plugin;
|
||||
|
||||
/**
|
||||
* The model constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->plugin = new Plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function parses the bug reports description and
|
||||
* separates it into separate keys in the array.
|
||||
*
|
||||
* @param array $data - The data being parsed.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filter( $data, $params = [] ) {
|
||||
foreach ( $data as $instance ) {
|
||||
if ( !is_object( $instance ) ) {
|
||||
$instance = $data;
|
||||
$end = true;
|
||||
}
|
||||
$instance->submittedBy = self::$user->getUsername( $instance->userID );
|
||||
$instance->repeatText = ( $instance->repeat ? 'yes' : 'no' );
|
||||
$out[] = $instance;
|
||||
if ( !empty( $end ) ) {
|
||||
$out = $out[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a Bug Report form.
|
||||
*
|
||||
* @param int $ID the user ID submitting the form
|
||||
* @param string $url the url
|
||||
* @param string $o_url the original url
|
||||
* @param int $repeat is repeatable?
|
||||
* @param string $description_ description of the event.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function create( $ID, $url, $oUrl, $repeat, $description ) {
|
||||
if ( !$this->plugin->checkEnabled() ) {
|
||||
Debug::info( 'Bug Reporting is disabled in the config.' );
|
||||
return false;
|
||||
}
|
||||
$fields = [
|
||||
'userID' => App::$activeUser->ID,
|
||||
'time' => time(),
|
||||
'repeat' => $repeat,
|
||||
'ourl' => $oUrl,
|
||||
'url' => $url,
|
||||
'ip' => $_SERVER['REMOTE_ADDR'],
|
||||
'description' => $description,
|
||||
];
|
||||
if ( !self::$db->insert( $this->tableName, $fields ) ) {
|
||||
new CustomException( 'bugreportsCreate' );
|
||||
|
||||
return false;
|
||||
}
|
||||
return self::$db->lastId();
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/bugreport/plugin.php
|
||||
*
|
||||
* This houses all of the main plugin info and functionality.
|
||||
*
|
||||
* @package TP BugReports
|
||||
* @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 ReflectionClass;
|
||||
use TheTempusProject\Classes\Installer;
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Classes\Plugin;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class Bugreport extends Plugin {
|
||||
public $pluginName = 'TP BugReports';
|
||||
public $pluginAuthor = 'JoeyK';
|
||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
||||
public $modelVersion = '1.0';
|
||||
public $pluginVersion = '3.0';
|
||||
public $pluginDescription = '';
|
||||
public $configName = 'bugreports';
|
||||
public $configMatrix = [
|
||||
'enabled' => [
|
||||
'type' => 'radio',
|
||||
'pretty' => 'Enable Bug reporting.',
|
||||
'default' => true,
|
||||
],
|
||||
'sendEmail' => [
|
||||
'type' => 'radio',
|
||||
'pretty' => 'Email the user after submitting.',
|
||||
'default' => true,
|
||||
],
|
||||
'emailTemplate' => [
|
||||
'type' => 'text',
|
||||
'pretty' => 'Email Template',
|
||||
'default' => 'BugReportEmail',
|
||||
],
|
||||
];
|
||||
public $permissionMatrix = [
|
||||
'bugReport' => [
|
||||
'pretty' => 'Can Submit Bug Reports',
|
||||
'default' => false,
|
||||
],
|
||||
];
|
||||
public $contact_footer_links = [
|
||||
[
|
||||
'text' => 'Bug Report',
|
||||
'url' => '{ROOT_URL}bugreport',
|
||||
'filter' => 'loggedin',
|
||||
],
|
||||
];
|
||||
public $admin_links = [
|
||||
[
|
||||
'text' => '<i class="fa fa-fw fa-bug"></i> Bug Reports',
|
||||
'url' => '{ROOT_URL}admin/bugreport',
|
||||
],
|
||||
];
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<div class="context-main-bg context-main p-3">
|
||||
<legend class="text-center">Bug Reports</legend>
|
||||
<hr>
|
||||
{ADMIN_BREADCRUMBS}
|
||||
<form action="{ROOT_URL}admin/bugreport/delete" method="post">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 5%">ID</th>
|
||||
<th style="width: 20%">Time</th>
|
||||
<th style="width: 60%">Description</th>
|
||||
<th style="width: 5%"></th>
|
||||
<th style="width: 5%"></th>
|
||||
<th style="width: 5%">
|
||||
<input type="checkbox" onchange="checkAll(this)" name="check.br" value="BR_[]">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{LOOP}
|
||||
<tr>
|
||||
<td align="center">{ID}</td>
|
||||
<td align="center">{DTC}{time}{/DTC}</td>
|
||||
<td>{description}</td>
|
||||
<td><a href="{ROOT_URL}admin/bugreport/view/{ID}" class="btn btn-sm btn-primary"><i class="fa fa-fw fa-upload"></i></a></td>
|
||||
<td><a href="{ROOT_URL}admin/bugreport/delete/{ID}" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></a></td>
|
||||
<td>
|
||||
<input type="checkbox" value="{ID}" name="BR_[]">
|
||||
</td>
|
||||
</tr>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<tr>
|
||||
<td align="center" colspan="6">
|
||||
No results to show.
|
||||
</td>
|
||||
</tr>
|
||||
{/ALT}
|
||||
</tbody>
|
||||
</table>
|
||||
<button name="submit" value="submit" type="submit" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></button>
|
||||
</form>
|
||||
<br>
|
||||
<a href="{ROOT_URL}admin/bugreport/clear">clear all</a>
|
||||
</div>
|
@ -1,69 +0,0 @@
|
||||
<div class="container py-4">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
{ADMIN_BREADCRUMBS}
|
||||
<div class="card shadow">
|
||||
<!-- Card Header -->
|
||||
<div class="card-header text-center bg-dark text-white">
|
||||
<h3 class="card-title mb-0">Bug Report</h3>
|
||||
</div>
|
||||
|
||||
<!-- Card Body -->
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center">
|
||||
<!-- Log Details -->
|
||||
<table class="table table-borderless">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">ID:</th>
|
||||
<td>{ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Time submitted</th>
|
||||
<td>{DTC}{time}{/DTC}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">URL:</th>
|
||||
<td><a href="{URL}">{URL}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Original URL</th>
|
||||
<td><a href="{OURL}">{OURL}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Multiple occurrences?</th>
|
||||
<td>{repeatText}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">IP:</th>
|
||||
<td>{ip}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">User:</th>
|
||||
<td><a href="{ROOT_URL}admin/users/view/{userID}">{submittedBy}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" colspan="2">Description:</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">{description}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Admin Controls -->
|
||||
<div class="card-footer text-center">
|
||||
{ADMIN}
|
||||
<form action="{ROOT_URL}admin/bugreport/delete" method="post">
|
||||
<input type="hidden" name="BR_" value="{ID}">
|
||||
<input type="hidden" name="token" value="{TOKEN}">
|
||||
<button name="submit" value="submit" type="submit" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></button>
|
||||
</form>
|
||||
{/ADMIN}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,52 +0,0 @@
|
||||
<div class="col-8 mx-auto p-4 rounded shadow-sm mb-5 context-main-bg mt-4 container">
|
||||
<h2 class="text-center mb-4">Bug Report</h2>
|
||||
<hr>
|
||||
<p>Thank you for visiting our bug reporting page. We value our users' input highly and in an effort to better serve your needs, please fill out the form below to help us address this issue.</p>
|
||||
<p>We read each and every bug report submitted, and by submitting this form you allow us to send you a follow-up email.</p>
|
||||
<form action="" method="post">
|
||||
<!-- Page URL -->
|
||||
<div class="mb-3">
|
||||
<label for="url" class="form-label">Page you were trying to reach:</label>
|
||||
<input type="url" name="url" id="url" class="form-control" aria-describedby="urlHelp" required>
|
||||
<small id="urlHelp" class="form-text text-muted">
|
||||
What is the URL of the page you actually received the error on? (The URL is the website address. Example: {ROOT_URL}home)
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<!-- Referrer URL -->
|
||||
<div class="mb-3">
|
||||
<label for="ourl" class="form-label">Page you were on:</label>
|
||||
<input type="url" name="ourl" id="ourl" class="form-control" aria-describedby="ourlHelp">
|
||||
<small id="ourlHelp" class="form-text text-muted">
|
||||
What is the URL of the page you were on before you received the error? (The URL is the website address. Example: {ROOT_URL}home/newhome)
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<!-- Repeat Issue -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label">*Has this happened more than once?</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="repeat" id="repeatNo" value="false" checked>
|
||||
<label class="form-check-label" for="repeatNo">No</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="repeat" id="repeatYes" value="true">
|
||||
<label class="form-check-label" for="repeatYes">Yes</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Description -->
|
||||
<div class="mb-3">
|
||||
<label for="entry" class="form-label">Describe the problem/error as best as you can: (max: 2000 characters)</label>
|
||||
<textarea class="form-control" name="entry" id="entry" rows="6" maxlength="2000" required></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Hidden Token -->
|
||||
<input type="hidden" name="token" value="{TOKEN}">
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="text-center">
|
||||
<button type="submit" name="submit" value="submit" class="btn btn-primary btn-lg">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/comments/controllers/admin/comments.php
|
||||
*
|
||||
* This is the comments admin controller.
|
||||
*
|
||||
* @package TP Comments
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Controllers\Admin;
|
||||
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Houdini\Classes\Issues;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Classes\Forms;
|
||||
use TheTempusProject\Classes\AdminController;
|
||||
use TheTempusProject\Models\Comments as CommentsModel;
|
||||
|
||||
class Comments extends AdminController {
|
||||
protected static $comments;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
self::$title = 'Admin - Comments';
|
||||
self::$comments = new CommentsModel;
|
||||
$view = Navigation::activePageSelect( 'nav.admin', '/admin/comments' );
|
||||
Components::set( 'ADMINNAV', $view );
|
||||
}
|
||||
|
||||
public function edit( $data = null ) {
|
||||
if ( !Input::exists( 'submit' ) ) {
|
||||
return Views::view( 'comments.admin.edit', self::$comments->findById( $data ) );
|
||||
}
|
||||
if ( !Forms::check( 'editComment' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
|
||||
return Views::view( 'comments.admin.edit', self::$comments->findById( $data ) );
|
||||
}
|
||||
if ( self::$comments->update( $data, Input::post( 'comment' ) ) ) {
|
||||
Issues::add( 'success', 'Comment updated' );
|
||||
} else {
|
||||
return Views::view( 'comments.admin.edit', self::$comments->findById( $data ) );
|
||||
}
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function viewComments( $contentID = null ) {
|
||||
if ( empty( $contentID ) ) {
|
||||
Issues::add( 'error', 'Content ID not found.' );
|
||||
return $this->index();
|
||||
}
|
||||
$contentData = self::$comments->findById( $data );
|
||||
if ( empty( $contentID ) ) {
|
||||
return Views::view( 'comments.list', $commentData );
|
||||
}
|
||||
Issues::add( 'error', 'Comment not found.' );
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function delete( $data = null ) {
|
||||
if ( $data == null ) {
|
||||
if ( !Input::exists( 'C_' ) ) {
|
||||
return $this->index();
|
||||
}
|
||||
$data = Input::post( 'C_' );
|
||||
}
|
||||
if ( !self::$comments->delete( $data ) ) {
|
||||
Issues::add( 'error', 'There was an error with your request.' );
|
||||
} else {
|
||||
Issues::add( 'success', 'Comment has been deleted' );
|
||||
}
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
Views::view( 'comments.admin.list', self::$comments->recent() );
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/comments/controllers/moderator.php
|
||||
*
|
||||
* This is the Moderator 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\Houdini\Classes\Template;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Issues;
|
||||
use TheTempusProject\Classes\Controller;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Hermes\Functions\Redirect;
|
||||
use TheTempusProject\Bedrock\Functions\Session;
|
||||
|
||||
class Moderator extends Controller {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
Template::noIndex();
|
||||
if ( !App::$isMod ) {
|
||||
Session::flash( 'error', 'You do not have permission to view this page.' );
|
||||
return Redirect::home();
|
||||
}
|
||||
}
|
||||
|
||||
public function index() {
|
||||
self::$title = 'Moderator\'s Area';
|
||||
Views::view( 'comments.moderator' );
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Comments
|
||||
*/
|
||||
.comments {
|
||||
margin-top: 120px;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/comments/forms.php
|
||||
*
|
||||
* This houses all of the form checking functions for this plugin.
|
||||
*
|
||||
* @package TP Comments
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Plugins\Comments;
|
||||
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Classes\Forms;
|
||||
|
||||
class CommentsForms extends Forms {
|
||||
/**
|
||||
* Adds these functions to the form list.
|
||||
*/
|
||||
public function __construct() {
|
||||
self::addHandler( 'newComment', __CLASS__, 'newComment' );
|
||||
self::addHandler( 'editComment', __CLASS__, 'editComment' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the new comment form.
|
||||
*
|
||||
* @return {bool}
|
||||
*/
|
||||
public static function newComment() {
|
||||
if ( !Input::exists( 'comment' ) ) {
|
||||
Check::addUserError( 'You cannot post a blank comment.' );
|
||||
return false;
|
||||
}
|
||||
if ( !Input::exists( 'contentId' ) ) {
|
||||
Check::addUserError( 'Content ID was missing.' );
|
||||
return false;
|
||||
}
|
||||
// these are disabled because i need to figure out a solution for pages where images are wrong
|
||||
// a missing image loads a new token and messes this up
|
||||
// if ( !Check::token() ) {
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the edit comment form.
|
||||
*
|
||||
* @return {bool}
|
||||
*/
|
||||
public static function editComment() {
|
||||
if ( !Input::exists( 'comment' ) ) {
|
||||
Check::addUserError( 'You cannot post a blank comment.' );
|
||||
return false;
|
||||
}
|
||||
// these are disabled because i need to figure out a solution for pages where images are wrong
|
||||
// a missing image loads a new token and messes this up
|
||||
// if ( !Check::token() ) {
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
new CommentsForms;
|
@ -1,184 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/comments/models/comment.php
|
||||
*
|
||||
* This class is used for the creation, retrieval, and manipulation
|
||||
* of the comments table.
|
||||
*
|
||||
* @package TP Comments
|
||||
* @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\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Classes\DatabaseModel;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Canary\Classes\CustomException;
|
||||
use TheTempusProject\Houdini\Classes\Filters;
|
||||
|
||||
class Comments extends DatabaseModel {
|
||||
public $tableName = 'comments';
|
||||
public $databaseMatrix = [
|
||||
[ 'author', 'int', '11' ],
|
||||
[ 'contentID', 'int', '11' ],
|
||||
[ 'created', 'int', '10' ],
|
||||
[ 'edited', 'int', '10' ],
|
||||
[ 'approved', 'int', '1' ],
|
||||
[ 'contentType', 'varchar', '32' ],
|
||||
[ 'content', 'text', '' ],
|
||||
];
|
||||
|
||||
public function count( $contentType, $contentID ) {
|
||||
if ( !Check::id( $contentID ) ) {
|
||||
Debug::info( 'Comments: illegal ID.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
if ( !Check::dataTitle( $contentType ) ) {
|
||||
Debug::info( 'Comments: illegal Type.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
$where = ['contentType', '=', $contentType, 'AND', 'contentID', '=', $contentID];
|
||||
$data = self::$db->get( $this->tableName, $where );
|
||||
if ( !$data->count() ) {
|
||||
Debug::info( 'No comments found.' );
|
||||
|
||||
return 0;
|
||||
}
|
||||
return $data->count();
|
||||
}
|
||||
|
||||
public function display( $displayCount, $contentType, $contentID ) {
|
||||
if ( !Check::id( $contentID ) ) {
|
||||
Debug::info( 'Comments: illegal ID.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
if ( !Check::dataTitle( $contentType ) ) {
|
||||
Debug::info( 'Comments: illegal Type.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
$where = ['contentType', '=', $contentType, 'AND', 'contentID', '=', $contentID];
|
||||
$commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC', [0, $displayCount] );
|
||||
if ( !$commentData->count() ) {
|
||||
Debug::info( 'No comments found.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
return $this->filter( $commentData->results() );
|
||||
}
|
||||
|
||||
public function update( $id, $comment ) {
|
||||
if ( empty( self::$log ) ) {
|
||||
self::$log = new Log;
|
||||
}
|
||||
if ( !Check::id( $id ) ) {
|
||||
Debug::info( 'Comments: illegal ID.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
$fields = [
|
||||
'edited' => time(),
|
||||
'content' => $comment,
|
||||
'approved' => 1,
|
||||
];
|
||||
if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
|
||||
new CustomException( 'commentUpdate' );
|
||||
Debug::error( "Post: $id not updated: $fields" );
|
||||
|
||||
return false;
|
||||
}
|
||||
self::$log->admin( "Updated Comment: $id" );
|
||||
return true;
|
||||
}
|
||||
|
||||
public function create( $contentType, $contentID, $comment ) {
|
||||
if ( !Check::id( $contentID ) ) {
|
||||
Debug::info( 'Comments: illegal ID.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
if ( !Check::dataTitle( $contentType ) ) {
|
||||
Debug::info( 'Comments: illegal Type.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
$fields = [
|
||||
'author' => App::$activeUser->ID,
|
||||
'edited' => time(),
|
||||
'created' => time(),
|
||||
'content' => $comment,
|
||||
'contentType' => $contentType,
|
||||
'contentID' => $contentID,
|
||||
'approved' => 0,
|
||||
];
|
||||
if ( !self::$db->insert( $this->tableName, $fields ) ) {
|
||||
new CustomException( 'commentCreate' );
|
||||
Debug::error( "Comments: $data not created: $fields" );
|
||||
|
||||
return false;
|
||||
}
|
||||
return self::$db->lastId();
|
||||
}
|
||||
|
||||
public function filter( $data, $params = [] ) {
|
||||
foreach ( $data as $instance ) {
|
||||
if ( !is_object( $instance ) ) {
|
||||
$instance = $data;
|
||||
$end = true;
|
||||
}
|
||||
if ( App::$isAdmin || ( App::$isLoggedIn && $instance->author == App::$activeUser->ID ) ) {
|
||||
$instance->commentControl = Views::simpleView( 'comments.control', ['ID' => $instance->ID] );
|
||||
} else {
|
||||
$instance->commentControl = '';
|
||||
}
|
||||
$data = self::$db->get( $instance->contentType, ['ID', '=', $instance->contentID] )->results();
|
||||
if ( empty( $data ) ) {
|
||||
$title = 'Unknown';
|
||||
} elseif ( empty( $data[0]->title ) ) {
|
||||
$title = 'Unknown';
|
||||
} else {
|
||||
$title = $data[0]->title;
|
||||
}
|
||||
$authorName = self::$user->getUsername( $instance->author );
|
||||
$authorAvatar = self::$user->getAvatar( $instance->author );
|
||||
$instance->avatar = $authorAvatar;
|
||||
$instance->authorName = $authorName;
|
||||
$instance->contentTitle = $title;
|
||||
$instance->content = Filters::applyOne( 'mentions.0', $instance->content, true );
|
||||
$instance->content = Filters::applyOne( 'hashtags.0', $instance->content, true );
|
||||
$out[] = $instance;
|
||||
if ( !empty( $end ) ) {
|
||||
$out = $out[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function recent( $contentType = 'all', $limit = null ) {
|
||||
if ( $contentType === 'all' ) {
|
||||
$where = ['ID', '>', '0'];
|
||||
} else {
|
||||
$where = ['contentType', '=', $contentType];
|
||||
}
|
||||
if ( empty( $limit ) ) {
|
||||
$commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC' );
|
||||
} else {
|
||||
$commentData = self::$db->get( $this->tableName, $where, 'created', 'DESC', [0, $limit] );
|
||||
}
|
||||
if ( !$commentData->count() ) {
|
||||
Debug::info( 'No comments found.' );
|
||||
|
||||
return false;
|
||||
}
|
||||
return $this->filter( $commentData->results() );
|
||||
}
|
||||
}
|
@ -1,154 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/comments/plugin.php
|
||||
*
|
||||
* This houses all of the main plugin info and functionality.
|
||||
*
|
||||
* @package TP Comments
|
||||
* @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 ReflectionClass;
|
||||
use TheTempusProject\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Classes\Installer;
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Classes\Plugin;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Houdini\Classes\Issues;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Classes\Forms;
|
||||
use TheTempusProject\Hermes\Functions\Redirect;
|
||||
use TheTempusProject\Bedrock\Functions\Session;
|
||||
use TheTempusProject\Models\Comments as CommentsModel;
|
||||
|
||||
class Comments extends Plugin {
|
||||
protected static $comments;
|
||||
public $pluginName = 'TP Comments';
|
||||
public $pluginAuthor = 'JoeyK';
|
||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
||||
public $modelVersion = '1.0';
|
||||
public $pluginVersion = '3.0';
|
||||
public $pluginDescription = 'A simple plugin to add user comments for other plugins.';
|
||||
public $admin_links = [
|
||||
[
|
||||
'text' => '<i class="fa fa-fw fa-comment"></i> Comments',
|
||||
'url' => '{ROOT_URL}admin/comments',
|
||||
],
|
||||
];
|
||||
public $main_links = [
|
||||
[
|
||||
'text' => 'Moderator',
|
||||
'url' => '{ROOT_URL}moderator/index',
|
||||
'filter' => 'mod',
|
||||
]
|
||||
];
|
||||
public $permissionMatrix = [
|
||||
'modAccess' => [
|
||||
'pretty' => 'Access Moderator Areas',
|
||||
'default' => false,
|
||||
],
|
||||
];
|
||||
public $resourceMatrix = [
|
||||
'groups' => [
|
||||
[
|
||||
'name' => 'Moderator',
|
||||
'permissions' => '{"adminAccess":false}',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct( $load = false ) {
|
||||
if ( !empty(App::$activePerms) ) {
|
||||
App::$isMod = !empty(App::$activePerms['modAccess']);
|
||||
} else {
|
||||
App::$isMod = false;
|
||||
}
|
||||
$this->filters[] = [
|
||||
'name' => 'mod',
|
||||
'find' => '#{MOD}(.*?){/MOD}#is',
|
||||
'replace' => ( App::$isMod ? '$1' : '' ),
|
||||
'enabled' => true,
|
||||
];
|
||||
self::$comments = new CommentsModel;
|
||||
parent::__construct( $load );
|
||||
}
|
||||
|
||||
public function formPost( $type, $content, $redirect ) {
|
||||
if ( ! $this->checkEnabled() ) {
|
||||
Debug::info( 'Comments Plugin is disabled in the control panel.' );
|
||||
Issues::add( 'error', 'Comments are disabled.' );
|
||||
return false;
|
||||
}
|
||||
if ( !App::$isLoggedIn ) {
|
||||
Session::flash( 'notice', 'You must be logged in to post comments.' );
|
||||
return Redirect::to( $redirect . $content->ID );
|
||||
}
|
||||
if ( !Forms::check( 'newComment' ) ) {
|
||||
Session::flash( 'error', [ 'There was a problem with your comment form.' => Check::userErrors() ] );
|
||||
return Redirect::to( $redirect . $content->ID );
|
||||
}
|
||||
if ( !self::$comments->create( $type, $content->ID, Input::post( 'comment' ) ) ) {
|
||||
Session::flash( 'error', [ 'There was a problem posting your comment.' => Check::userErrors() ] );
|
||||
} else {
|
||||
Session::flash( 'success', 'Comment posted' );
|
||||
}
|
||||
return Redirect::to( $redirect . $content->ID );
|
||||
}
|
||||
|
||||
public function formEdit( $type, $content, $redirect ) {
|
||||
if ( ! $this->checkEnabled() ) {
|
||||
Debug::info( 'Comments Plugin is disabled in the control panel.' );
|
||||
Issues::add( 'error', 'Comments are disabled.' );
|
||||
return false;
|
||||
}
|
||||
if ( !App::$isLoggedIn ) {
|
||||
Session::flash( 'notice', 'You must be logged in to do that.' );
|
||||
return Redirect::to( $type );
|
||||
}
|
||||
if ( !App::$isAdmin && $content->author != App::$activeUser->ID ) {
|
||||
Session::flash( 'error', 'You do not have permission to edit this comment' );
|
||||
return Redirect::to( $type );
|
||||
}
|
||||
if ( !Input::exists( 'submit' ) ) {
|
||||
return Views::view( 'comments.admin.edit', $content );
|
||||
}
|
||||
if ( !Forms::check( 'editComment' ) ) {
|
||||
Issues::add( 'error', [ 'There was a problem editing your comment.' => Check::userErrors() ] );
|
||||
return Views::view( 'comments.admin.edit', $content );
|
||||
}
|
||||
if ( !self::$comments->update( $content->ID, Input::post( 'comment' ) ) ) {
|
||||
Issues::add( 'error', [ 'There was a problem editing your comment.' => Check::userErrors() ] );
|
||||
return Views::view( 'comments.admin.edit', $content );
|
||||
}
|
||||
Session::flash( 'success', 'Comment updated' );
|
||||
return Redirect::to( $redirect . $content->contentID );
|
||||
}
|
||||
|
||||
public function formDelete( $type, $content, $redirect ) {
|
||||
if ( ! $this->checkEnabled() ) {
|
||||
Debug::info( 'Comments Plugin is disabled in the control panel.' );
|
||||
Issues::add( 'error', 'Comments are disabled.' );
|
||||
return false;
|
||||
}
|
||||
if ( !App::$isLoggedIn ) {
|
||||
Session::flash( 'notice', 'You must be logged in to do that.' );
|
||||
return Redirect::to( $type );
|
||||
}
|
||||
if ( !App::$isAdmin && $content->author != App::$activeUser->ID ) {
|
||||
Session::flash( 'error', 'You do not have permission to edit this comment' );
|
||||
return Redirect::to( $type );
|
||||
}
|
||||
if ( !self::$comments->delete( (array) $content->ID ) ) {
|
||||
Session::flash( 'error', 'There was an error with your request.' );
|
||||
} else {
|
||||
Session::flash( 'success', 'Comment has been deleted' );
|
||||
}
|
||||
return Redirect::to( $redirect . $content->contentID );
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<legend>New Comments</legend>
|
||||
<table class="table context-main">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 20%"></th>
|
||||
<th style="width: 70%"></th>
|
||||
<th style="width: 5%"></th>
|
||||
<th style="width: 5%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{LOOP}
|
||||
<tr>
|
||||
<td>{authorName}</td>
|
||||
<td>{content}</td>
|
||||
<td><a href="{ROOT_URL}admin/comments/edit/{ID}" class="btn btn-sm btn-warning"><i class="fa fa-fw fa-pencil"></i></a></td>
|
||||
<td><a href="{ROOT_URL}admin/comments/delete/{ID}" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></a></td>
|
||||
</tr>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<tr>
|
||||
<td align="center" colspan="4">
|
||||
No results to show.
|
||||
</td>
|
||||
</tr>
|
||||
{/ALT}
|
||||
</tbody>
|
||||
</table>
|
@ -1,25 +0,0 @@
|
||||
<div class="mb-4 mt-4">
|
||||
<div class="offset-md-1 col-10 p-3 context-main-bg">
|
||||
<legend class="text-center">Edit Comment</legend>
|
||||
<hr>
|
||||
{ADMIN_BREADCRUMBS}
|
||||
<form action="" method="post" class="container py-4">
|
||||
<fieldset>
|
||||
<div class="mb-3 row">
|
||||
<label for="comment" class="col-lg-5 col-form-label text-end">Comment:</label>
|
||||
<div class="col-lg-3">
|
||||
<textarea class="form-control" name="comment" maxlength="2000" rows="5" cols="50" id="comment">{content}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hidden Token -->
|
||||
<input type="hidden" name="token" value="{TOKEN}">
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="text-center">
|
||||
<button type="submit" name="submit" value="submit" class="btn btn-primary btn-lg">Save</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -1,45 +0,0 @@
|
||||
<div class="context-main-bg context-main p-3">
|
||||
<legend class="text-center">Recent Comments</legend>
|
||||
<hr>
|
||||
{ADMIN_BREADCRUMBS}
|
||||
<form action="{ROOT_URL}admin/comments/delete" method="post">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 20%">Author</th>
|
||||
<th style="width: 20%">Subject</th>
|
||||
<th style="width: 35%">Comment</th>
|
||||
<th style="width: 10%">Time</th>
|
||||
<th style="width: 5%"></th>
|
||||
<th style="width: 5%"></th>
|
||||
<th style="width: 5%">
|
||||
<input type="checkbox" onchange="checkAll(this)" name="check.c" value="C_[]">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{LOOP}
|
||||
<tr>
|
||||
<td><a href="{ROOT_URL}admin/users/view/{author}">{authorName}</a></td>
|
||||
<td><a href="{ROOT_URL}admin/blog/view/{contentID}">{contentTitle}</a></td>
|
||||
<td>{content}</td>
|
||||
<td>{DTC}{created}{/DTC}</td>
|
||||
<td><a href="{ROOT_URL}admin/comments/edit/{ID}" class="btn btn-sm btn-warning"><i class="fa fa-fw fa-pencil"></i></a></td>
|
||||
<td><a href="{ROOT_URL}admin/comments/delete/{ID}" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></a></td>
|
||||
<td>
|
||||
<input type="checkbox" value="{ID}" name="C_[]">
|
||||
</td>
|
||||
</tr>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<tr>
|
||||
<td align="center" colspan="7">
|
||||
No results to show.
|
||||
</td>
|
||||
</tr>
|
||||
{/ALT}
|
||||
</tbody>
|
||||
</table>
|
||||
<button name="submit" value="submit" type="submit" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></button>
|
||||
</form>
|
||||
</div>
|
@ -1,8 +0,0 @@
|
||||
<div class="action">
|
||||
<a href="{ROOT_URL}{COMMENT_TYPE}/comments/edit/{ID}" class="btn btn-warning btn-sm">
|
||||
<span class="fa fa-fw fa-pencil"></span>
|
||||
</a>
|
||||
<a href="{ROOT_URL}{COMMENT_TYPE}/comments/delete/{ID}" class="btn btn-danger btn-sm">
|
||||
<span class="fa fa-fw fa-trash"></span>
|
||||
</a>
|
||||
</div>
|
@ -1,14 +0,0 @@
|
||||
<form action="" method="post" class="text-center mx-auto mt-4" style="max-width: 600px;">
|
||||
<div class="mb-3">
|
||||
<textarea
|
||||
class="form-control"
|
||||
name="comment"
|
||||
maxlength="2000"
|
||||
rows="4"
|
||||
id="comment"
|
||||
placeholder="Write your comment here..."></textarea>
|
||||
</div>
|
||||
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary mb-3">Comment</button>
|
||||
<input type="hidden" name="token" value="{TOKEN}">
|
||||
<input type="hidden" name="contentId" value="{CONTENT_ID}">
|
||||
</form>
|
@ -1,39 +0,0 @@
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center justify-content-between context-second-bg context-main">
|
||||
<h3 class="card-title mb-0">
|
||||
<i class="fa fa-fw fa-comment"></i> Comments
|
||||
</h3>
|
||||
<span class="badge bg-primary">{count}</span>
|
||||
</div>
|
||||
<div class="card-body context-main-bg context-main">
|
||||
<ul class="list-group list-group-flush">
|
||||
{LOOP}
|
||||
<li class="list-group-item context-second-bg context-main mb-2">
|
||||
<div class="d-flex align-items-start">
|
||||
<div class="me-3">
|
||||
<img src="{ROOT_URL}{avatar}" class="rounded-circle" alt="User Avatar" style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div>
|
||||
<div class="mb-1">
|
||||
<small class="text-muted">
|
||||
By: <a href="{ROOT_URL}home/profile/{author}" class="text-decoration-none">{authorName}</a> on {DTC date}{created}{/DTC}
|
||||
</small>
|
||||
</div>
|
||||
<div class="comment-text">
|
||||
{content}
|
||||
</div>
|
||||
{commentControl}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<li class="list-group-item context-second-bg context-main mb-2">
|
||||
<div class="text-center">
|
||||
<p class="mb-0">Be the first to comment.</p>
|
||||
</div>
|
||||
</li>
|
||||
{/ALT}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
@ -1,7 +0,0 @@
|
||||
<h1>Moderator' Area</h1>
|
||||
<div class="jumbotron">
|
||||
<h1>Welcome!</h1>
|
||||
<p>This is the moderator section. You can give some groups permission to access this area. The menu is hidden for normal users and if they get a link to a moderator's area, the authentication system will stop them from accessing any content protected this way.</p>
|
||||
<p>You can even use this feature in-line with your views, hiding certain components from non-moderators</p>
|
||||
<p>The idea behind this role is for them to help you in policing comments as needed.</p>
|
||||
</div>
|
@ -1,121 +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;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Hermes\Functions\Redirect;
|
||||
use TheTempusProject\Bedrock\Functions\Session;
|
||||
|
||||
class Messages extends Controller {
|
||||
private static $message;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
self::$title = 'Messages';
|
||||
self::$message = new Message;
|
||||
if ( ! App::$isLoggedIn ) {
|
||||
Session::flash( 'error', 'You do not have permission to access this page.' );
|
||||
return Redirect::home();
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
Components::set( 'message_inbox', Views::simpleView( 'messages.inbox', self::$message->getInbox() ) );
|
||||
Components::set( 'message_outbox', Views::simpleView( 'messages.outbox', self::$message->getOutbox() ) );
|
||||
Views::view( 'messages.index' );
|
||||
}
|
||||
|
||||
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="badge bg-danger rounded-pill">{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,39 +0,0 @@
|
||||
<h2>Inbox</h2>
|
||||
<form action="{ROOT_URL}messages/delete" method="post">
|
||||
<table class="table table-striped">
|
||||
<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,8 +0,0 @@
|
||||
<div class="context-main context-main-bg col-10 offset-1 my-3 p-3">
|
||||
<div class="my-3 p-3">
|
||||
{message_inbox}
|
||||
</div>
|
||||
<div class="my-3 p-3">
|
||||
{message_outbox}
|
||||
</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,37 +0,0 @@
|
||||
<div class="context-main context-main-bg col-8 offset-2 my-3 p-3">
|
||||
<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 context-main-bg">
|
||||
<h5 class="card-title context-main">{subject}</h5>
|
||||
</div>
|
||||
{/SINGLE}
|
||||
<div class="card-body context-second-bg">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-lg-3 text-center">
|
||||
<a href="{ROOT_URL}home/profile/{userFrom}">{userFrom}</a><br>
|
||||
<img alt="User Pic" src="{ROOT_URL}{fromAvatar}" class="img-circle img-fluid">
|
||||
</div>
|
||||
<div class=" col-md-9 col-lg-9 context-main">
|
||||
{message}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer context-main-bg">
|
||||
{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-md btn-primary my-4">Reply</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -1,46 +0,0 @@
|
||||
<div class="dropdown nav-item mx-2">
|
||||
<a
|
||||
href="#"
|
||||
class="d-flex align-items-center text-white text-decoration-none dropdown-toggle"
|
||||
id="messagesDropdown"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
<i class="fa fa-fw fa-envelope"></i><span class="">{MBADGE}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end text-small shadow" aria-labelledby="messagesDropdown">
|
||||
{LOOP}
|
||||
<!-- Message Item -->
|
||||
<li>
|
||||
<a href="{ROOT_URL}messages/view/{ID}" class="dropdown-item">
|
||||
<div class="d-flex">
|
||||
<h5 class="media-heading text-start">
|
||||
<img class="" style="width: 40px;" src="{ROOT_URL}{fromAvatar}" alt="">
|
||||
<strong>{userFrom}</strong>
|
||||
</h5>
|
||||
<div class="text-end">
|
||||
<div class="media-body">
|
||||
<p class="small text-muted mb-1"><i class="fa fa-clock-o me-1"></i> {DTC}{lastReply}{/DTC}</p>
|
||||
<span>{summary}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<li class="px-3 text-center">
|
||||
<strong>No Messages</strong>
|
||||
</li>
|
||||
{/ALT}
|
||||
<!-- Footer -->
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li>
|
||||
<a href="/messages" class="dropdown-item text-center">
|
||||
Read All New Messages
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
@ -1,37 +0,0 @@
|
||||
<h2>Outbox</h2>
|
||||
<form action="{ROOT_URL}messages/delete" method="post">
|
||||
<table class="table table-striped">
|
||||
<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,18 +0,0 @@
|
||||
<div class="context-main context-main-bg col-8 offset-2 my-3 p-3">
|
||||
<form action="" method="post" class="form-horizontal">
|
||||
<legend class="text-center">Reply</legend>
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<div class="col-6 offset-3">
|
||||
<label for="message" class="control-label">Message:</label>
|
||||
<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}">
|
||||
<div class="text-center">
|
||||
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block my-3">Send</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -1 +0,0 @@
|
||||
class="bg-info"
|
@ -1,85 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/notifications/controllers/admin/notifications.php
|
||||
*
|
||||
* This is the notifications admin controller.
|
||||
*
|
||||
* @package TP Notifications
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Controllers\Admin;
|
||||
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Houdini\Classes\Issues;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Classes\AdminController;
|
||||
use TheTempusProject\Models\Notification as NotificationsModel;
|
||||
use TheTempusProject\Models\Group;
|
||||
use TheTempusProject\Models\User;
|
||||
use TheTempusProject\Houdini\Classes\Forms;
|
||||
use TheTempusProject\Classes\Forms as FormChecker;
|
||||
|
||||
class Notifications extends AdminController {
|
||||
protected static $notifications;
|
||||
public static $user;
|
||||
public static $group;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
self::$title = 'Admin - Notifications';
|
||||
self::$notifications = new NotificationsModel;
|
||||
self::$user = new User;
|
||||
self::$group = new Group;
|
||||
$view = Navigation::activePageSelect( 'nav.admin', '/admin/Notifications' );
|
||||
Components::set( 'ADMINNAV', $view );
|
||||
}
|
||||
|
||||
public function index( $data = null ) {
|
||||
// this is just a simple form to allow admins to send notifications
|
||||
return $this->create();
|
||||
}
|
||||
|
||||
public function create() {
|
||||
$select = Forms::getSelectHtml(
|
||||
'groupSelect',
|
||||
self::$group->listGroupsSimple( true )
|
||||
);
|
||||
Components::set( 'groupSelect', $select );
|
||||
if ( ! Input::exists( 'submit' ) ) {
|
||||
return Views::view( 'notifications.admin.send' );
|
||||
}
|
||||
if ( ! FormChecker::check( 'createNotification' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
|
||||
return Views::view( 'notifications.admin.send' );
|
||||
}
|
||||
if ( Input::exists( 'expires' ) ) {
|
||||
$expiresAt = time() + intval( Input::post( 'expires' ) );
|
||||
} else {
|
||||
$expiresAt = 0;
|
||||
}
|
||||
|
||||
if ( Input::exists( 'groupSelect' ) && Input::post( 'groupSelect' ) != 0 && Input::post( 'groupSelect' ) != 'all' ) {
|
||||
$list = self::$group->listMembers( Input::post( 'groupSelect' ) );
|
||||
} else {
|
||||
$list = self::$user->userList();
|
||||
}
|
||||
|
||||
$results = [];
|
||||
foreach ( $list as $recipient ) {
|
||||
$results[] = self::$notifications->create( Input::post( 'notification' ), 'Admin Issued', $recipient->ID, $expiresAt );
|
||||
}
|
||||
|
||||
// $result = self::$notifications->create( Input::post( 'notification' ), 'Admin Issued', XXXXXXX_user_idsXXXXXX, $expiresAt );
|
||||
if ( ! empty( $results ) ) {
|
||||
Issues::add( 'success', 'Your notification has been sent.' );
|
||||
} else {
|
||||
Issues::add( 'error', [ 'There was an unknown error submitting your data.' => Check::userErrors() ] );
|
||||
}
|
||||
Views::view( 'notifications.admin.send' );
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/notifications/controllers/notifications.php
|
||||
*
|
||||
* This is the home controller for the notifications plugin.
|
||||
*
|
||||
* @package TP Notifications
|
||||
* @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\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Issues;
|
||||
use TheTempusProject\Classes\Controller;
|
||||
use TheTempusProject\Models\Notification as NotificationsModel;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Hermes\Functions\Redirect;
|
||||
use TheTempusProject\Bedrock\Functions\Session;
|
||||
|
||||
class Notifications extends Controller {
|
||||
protected static $notifications;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
self::$notifications = new NotificationsModel;
|
||||
self::$title = 'Notifications - {SITENAME}';
|
||||
self::$pageDescription = 'Your recent notifications';
|
||||
if ( ! App::$isLoggedIn ) {
|
||||
Session::flash( 'error', 'You do not have permission to access this page.' );
|
||||
return Redirect::home();
|
||||
}
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$notifications = self::$notifications->getByUser( 10 );
|
||||
Views::view( 'notifications.list', $notifications );
|
||||
}
|
||||
|
||||
public function markRead( $id = null ) {
|
||||
$notification = self::$notifications->findById( $id );
|
||||
if ( $notification == false ) {
|
||||
Issues::add( 'error', 'Notification not found.' );
|
||||
return $this->index();
|
||||
}
|
||||
if ( $notification->userID != App::$activeUser->ID ) {
|
||||
Issues::add( 'error', 'You do not have permission to modify this notification.' );
|
||||
return $this->index();
|
||||
}
|
||||
$result = self::$notifications->markSeen( $id );
|
||||
if ( $result == true ) {
|
||||
Issues::add( 'success', 'Notification marked as read.' );
|
||||
} else {
|
||||
Issues::add( 'notice', 'There was an problem updating your notification.' );
|
||||
}
|
||||
return $this->index();
|
||||
}
|
||||
|
||||
public function delete( $id = null ) {
|
||||
$notification = self::$notifications->findById( $id );
|
||||
if ( $notification == false ) {
|
||||
Issues::add( 'error', 'Notification not found.' );
|
||||
return $this->index();
|
||||
}
|
||||
if ( $notification->userID != App::$activeUser->ID ) {
|
||||
Issues::add( 'error', 'You do not have permission to modify this notification.' );
|
||||
return $this->index();
|
||||
}
|
||||
$result = self::$notifications->delete( $id );
|
||||
if ( $result == true ) {
|
||||
Issues::add( 'success', 'Notification deleted.' );
|
||||
} else {
|
||||
Issues::add( 'notice', 'There was an problem deleting your notification.' );
|
||||
}
|
||||
return $this->index();
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/notifications/forms.php
|
||||
*
|
||||
* This houses all of the form checking functions for this plugin.
|
||||
*
|
||||
* @package TP Notifications
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Plugins\Notifications;
|
||||
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Classes\Forms;
|
||||
|
||||
class NotificationForms extends Forms {
|
||||
/**
|
||||
* Adds these functions to the form list.
|
||||
*/
|
||||
public function __construct() {
|
||||
self::addHandler( 'createNotification', __CLASS__, 'createNotification' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the createNotification form.
|
||||
*
|
||||
* @return {bool}
|
||||
*/
|
||||
public static function createNotification() {
|
||||
if ( ! Input::exists( 'notification' ) ) {
|
||||
Check::addUserError( 'You must provide a notification.' );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
new NotificationForms;
|
@ -1,146 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/notifications/models/notification.php
|
||||
*
|
||||
* This class is used for the manipulation of the notifications database table.
|
||||
*
|
||||
* @package TP Notifications
|
||||
* @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\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||
use TheTempusProject\Classes\DatabaseModel;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Canary\Classes\CustomException;
|
||||
|
||||
class Notification extends DatabaseModel {
|
||||
public $tableName = 'notifications';
|
||||
public $databaseMatrix = [
|
||||
[ 'notification', 'text', '' ],
|
||||
[ 'origin', 'varchar', '128' ],
|
||||
[ 'userID', 'int', '11' ],
|
||||
[ 'createdAt', 'int', '11' ],
|
||||
[ 'expiresAt', 'int', '11' ],
|
||||
[ 'deletedAt', 'int', '11' ],
|
||||
[ 'seenAt', 'int', '11' ],
|
||||
];
|
||||
|
||||
public function getUnreadCount( $userID ) {
|
||||
$result = self::$db->get(
|
||||
$this->tableName,
|
||||
[
|
||||
'userID', '=', $userID,
|
||||
'AND',
|
||||
'deletedAt', '=', '0',
|
||||
'AND',
|
||||
'seenAt', '=', '0',
|
||||
'AND',
|
||||
'expiresAt', '<', time(),
|
||||
]
|
||||
);
|
||||
return $result->count();
|
||||
}
|
||||
|
||||
public function create( $notification, $origin, $userID, $expiresAt = '0', $deletedAt = '0', $seenAt = '0' ) {
|
||||
$fields = [
|
||||
'notification' => $notification,
|
||||
'origin' => $origin,
|
||||
'userID' => $userID,
|
||||
'createdAt' => time(),
|
||||
'expiresAt' => $expiresAt,
|
||||
'deletedAt' => $deletedAt,
|
||||
'seenAt' => $seenAt,
|
||||
];
|
||||
if ( !self::$db->insert( $this->tableName, $fields ) ) {
|
||||
Debug::info( 'Events::create - failed to insert to db' );
|
||||
return false;
|
||||
}
|
||||
return self::$db->lastId();
|
||||
}
|
||||
|
||||
public function getByUser( $limit = 0 ) {
|
||||
$whereClause = [
|
||||
'userID', '=', App::$activeUser->ID,
|
||||
'AND',
|
||||
'deletedAt', '=', '0',
|
||||
'AND',
|
||||
'expiresAt', '<', time(),
|
||||
];
|
||||
if ( empty( $limit ) ) {
|
||||
$notifications = self::$db->get( $this->tableName, $whereClause );
|
||||
} else {
|
||||
$notifications = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
|
||||
}
|
||||
if ( !$notifications->count() ) {
|
||||
Debug::info( 'Notification:getByUser No Notifications found' );
|
||||
return false;
|
||||
}
|
||||
return $this->filter( $notifications->results() );
|
||||
}
|
||||
|
||||
public function markSeen( $id ) {
|
||||
if ( !Check::id( $id ) ) {
|
||||
Debug::info( 'Notifications: illegal ID.' );
|
||||
return false;
|
||||
}
|
||||
$fields = [
|
||||
'seenAt' => time(),
|
||||
];
|
||||
$notification = self::findById( $id );
|
||||
if ( ! $notification ) {
|
||||
Debug::error( "Notifications: $id not updated" );
|
||||
return false;
|
||||
}
|
||||
if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
|
||||
new CustomException( 'notificationUpdate' );
|
||||
Debug::error( "Notifications: $id not updated" );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete( $id ) {
|
||||
if ( !Check::id( $id ) ) {
|
||||
Debug::info( 'Notifications: illegal ID.' );
|
||||
return false;
|
||||
}
|
||||
$fields = [
|
||||
'deletedAt' => time(),
|
||||
];
|
||||
if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
|
||||
new CustomException( 'notificationDelete' );
|
||||
Debug::error( "Notifications: $id not updated" );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function filter( $messageArray, $filters = [] ) {
|
||||
$out = [];
|
||||
foreach ( $messageArray as $message ) {
|
||||
if ( !is_object( $message ) ) {
|
||||
$message = $messageArray;
|
||||
$end = true;
|
||||
}
|
||||
if ( $message->seenAt == 0 ) {
|
||||
$message->unseenBadge = Views::simpleView( 'notifications.unseenBadge' );
|
||||
$message->markReadLink = '<a href="{ROOT_URL}notifications/markRead/'.$message->ID.'" class="btn btn-sm btn-primary"><i class="fa-solid fa-fw fa-envelope-open"></i></a>';
|
||||
} else {
|
||||
$message->unseenBadge = '';
|
||||
$message->markReadLink = '';
|
||||
}
|
||||
$out[] = (object) $message;
|
||||
if ( !empty( $end ) ) {
|
||||
$out = $out[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/notifications/plugin.php
|
||||
*
|
||||
* This houses all of the main plugin info and functionality.
|
||||
*
|
||||
* @package TP Notifications
|
||||
* @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\Notification;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
|
||||
class Notifications extends Plugin {
|
||||
public $pluginName = 'TP Notifications';
|
||||
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 notification system.';
|
||||
public $permissionMatrix = [
|
||||
'sendNotifications' => [
|
||||
'pretty' => 'Can send notifications',
|
||||
'default' => false,
|
||||
],
|
||||
];
|
||||
public $admin_links = [
|
||||
[
|
||||
'text' => '<i class="fa fa-fw fa-bell"></i> Notify',
|
||||
'url' => '{ROOT_URL}admin/notifications',
|
||||
],
|
||||
];
|
||||
private static $loaded = false;
|
||||
public function __construct( $load = false ) {
|
||||
parent::__construct( $load );
|
||||
if ( $this->checkEnabled() && App::$isLoggedIn ) {
|
||||
$notifications = new Notification;
|
||||
Components::set( 'notificationCount', $notifications->getUnreadCount( App::$activeUser->ID ) );
|
||||
if ( $notifications->getUnreadCount( App::$activeUser->ID ) > 0 ) {
|
||||
$messageBadge = Views::simpleView( 'notifications.badge' );
|
||||
} else {
|
||||
$messageBadge = '';
|
||||
}
|
||||
Components::set( 'NBADGE', $messageBadge );
|
||||
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" class="dropdown-item"><i class="fa fa-fw fa-bell"></i> Notifications {NBADGE}</a></li>';
|
||||
self::$loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
<div class="context-main-bg context-main p-3">
|
||||
<legend class="text-center">Send Notification</legend>
|
||||
<hr>
|
||||
{ADMIN_BREADCRUMBS}
|
||||
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
<!-- Group -->
|
||||
<div class="mb-3 row">
|
||||
<label for="groupSelect" class="col-lg-3 col-form-label text-end">Group:</label>
|
||||
<div class="col-lg-6">
|
||||
{groupSelect}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recipients -->
|
||||
<div class="mb-3 row">
|
||||
<label for="expiration" class="col-lg-3 col-form-label text-end">Expiration:</label>
|
||||
<div class="col-lg-6">
|
||||
<select class="form-control" name="expiration" id="expiration">
|
||||
<option value="0">forever</option>
|
||||
<option value="1800">30 Minutes</option>
|
||||
<option value="3600">60 Minutes</option>
|
||||
<option value="14400">4 hours</option>
|
||||
<option value="28800">8 hours</option>
|
||||
<option value="43200">12 hours</option>
|
||||
<option value="86400">24 hours</option>
|
||||
<option value="172800">2 days</option>
|
||||
<option value="259200">3 days</option>
|
||||
<option value="432000">5 days</option>
|
||||
<option value="604800">7 days</option>
|
||||
<option value="1209600">2 weeks</option>
|
||||
<option value="1814400">3 weeks</option>
|
||||
<option value="2419200">4 weeks</option>
|
||||
<option value="2592000">1 month</option>
|
||||
<option value="5184000">2 months</option>
|
||||
<option value="7776000">3 months</option>
|
||||
<option value="15552000">6 months</option>
|
||||
<option value="31536000">12 months</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notification -->
|
||||
<div class="mb-3 row">
|
||||
<label for="notification" class="col-lg-3 col-form-label text-end">Notification:</label>
|
||||
<div class="col-lg-6">
|
||||
<textarea class="form-control" name="notification" id="notification" rows="6" maxlength="2000" required></textarea>
|
||||
<small class="form-text text-muted">Max: 2000 characters</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hidden Token -->
|
||||
<input type="hidden" name="token" value="{TOKEN}">
|
||||
</fieldset>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="text-center">
|
||||
<button type="submit" name="submit" value="submit" class="btn btn-primary btn-lg center-block">Send</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -1 +0,0 @@
|
||||
<span class="badge bg-danger rounded-pill">{notificationCount}</span>
|
@ -1,38 +0,0 @@
|
||||
<div class="col-8 mx-auto p-4 rounded shadow-sm context-main-bg my-4">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<legend class="text-center">Notifications</legend>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 90%"></th>
|
||||
<th style="width: 5%"></th>
|
||||
<th style="width: 5%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{LOOP}
|
||||
<tr {unseenBadge}>
|
||||
<td class=" context-main">{notification}</td>
|
||||
<td>
|
||||
{markReadLink}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{ROOT_URL}notifications/delete/{ID}" class="btn btn-sm btn-danger">
|
||||
<i class="fa fa-fw fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<tr>
|
||||
<td colspan="7" class=" context-main">
|
||||
No Notifications
|
||||
</td>
|
||||
</tr>
|
||||
{/ALT}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,41 +0,0 @@
|
||||
<!-- Notifications Dropdown -->
|
||||
<div class="dropdown nav-item mx-2">
|
||||
<a
|
||||
href="#"
|
||||
class="d-flex align-items-center text-white text-decoration-none dropdown-toggle"
|
||||
id="notificationsDropdown"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
<i class="fa fa-fw fa-bell"></i><span class="">{NBADGE}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end text-small shadow" aria-labelledby="notificationsDropdown">
|
||||
{LOOP}
|
||||
<!-- Notification Item -->
|
||||
<li>
|
||||
<a href="{ROOT_URL}notifications" class="dropdown-item">
|
||||
<div class="media">
|
||||
<div class="media-body">
|
||||
<p class="small text-muted mb-1"><i class="fa fa-clock-o me-1"></i> {DTC}{createdAt}{/DTC}</p>
|
||||
<span>{notification}</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<li class="px-3 text-center">
|
||||
<strong>No Notifications</strong>
|
||||
</li>
|
||||
{/ALT}
|
||||
<!-- Footer -->
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li>
|
||||
<a href="/notifications" class="dropdown-item text-center">
|
||||
See All Notifications
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
@ -1 +0,0 @@
|
||||
class="bg-info"
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/subscribe/plugin.php
|
||||
*
|
||||
* This houses all of the main plugin info and functionality.
|
||||
*
|
||||
* @package TP Subscribe
|
||||
* @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 ReflectionClass;
|
||||
use TheTempusProject\Classes\Installer;
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Classes\Plugin;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class Subscribe extends Plugin {
|
||||
private static $loaded = false;
|
||||
public $pluginName = 'TP Subscribe';
|
||||
public $pluginAuthor = 'JoeyK';
|
||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
||||
public $modelVersion = '1.0';
|
||||
public $pluginVersion = '3.0';
|
||||
public $pluginDescription = 'A simple plugin to add a method for users to share their email.';
|
||||
public $admin_links = [
|
||||
[
|
||||
'text' => '<i class="fa fa-fw fa-address-book"></i> Subscriptions',
|
||||
'url' => '{ROOT_URL}admin/subscriptions',
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct( $load = false ) {
|
||||
parent::__construct( $load );
|
||||
if ( ! self::$loaded ) {
|
||||
if ( $this->checkEnabled() ) {
|
||||
Components::append( 'FOOTER_RIGHT', Views::simpleView( 'subscribe.footer.right') );
|
||||
}
|
||||
self::$loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<div class="context-main-bg context-main p-3">
|
||||
<legend class="text-center">Add Subscriber</legend>
|
||||
<hr>
|
||||
{ADMIN_BREADCRUMBS}
|
||||
<form action="" method="post">
|
||||
<fieldset>
|
||||
<!-- Subject -->
|
||||
<div class="mb-3 row">
|
||||
<label for="email" class="col-lg-5 col-form-label text-end">Email:</label>
|
||||
<div class="col-lg-3">
|
||||
<input type="email" class="form-control" name="email" id="email" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hidden Token -->
|
||||
<input type="hidden" name="token" value="{TOKEN}">
|
||||
</fieldset>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="text-center">
|
||||
<button type="submit" name="submit" value="submit" class="btn btn-primary btn-lg center-block">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -1,40 +0,0 @@
|
||||
<div class="context-main-bg context-main p-3">
|
||||
<legend class="text-center">Subscribers</legend>
|
||||
<hr>
|
||||
{ADMIN_BREADCRUMBS}
|
||||
<form action="{ROOT_URL}admin/subscriptions/delete" method="post">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 5%">ID</th>
|
||||
<th style="width: 85%">email</th>
|
||||
<th style="width: 5%"></th>
|
||||
<th style="width: 5%">
|
||||
<input type="checkbox" onchange="checkAll(this)" name="check.s" value="S_[]">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{LOOP}
|
||||
<tr>
|
||||
<td align="center">{ID}</td>
|
||||
<td>{EMAIL}</td>
|
||||
<td><a href="{ROOT_URL}admin/subscriptions/delete/{ID}" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></a></td>
|
||||
<td>
|
||||
<input type="checkbox" value="{ID}" name="S_[]">
|
||||
</td>
|
||||
</tr>
|
||||
{/LOOP}
|
||||
{ALT}
|
||||
<tr>
|
||||
<td align="center" colspan="6">
|
||||
No results to show.
|
||||
</td>
|
||||
</tr>
|
||||
{/ALT}
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="{ROOT_URL}admin/subscriptions/add" class="btn btn-sm btn-primary">Add</a>
|
||||
<button name="submit" value="submit" type="submit" class="btn btn-sm btn-danger"><i class="fa fa-fw fa-trash"></i></button>
|
||||
</form>
|
||||
</div>
|
@ -1,11 +0,0 @@
|
||||
<div class="col-md-5 offset-md-1 mb-3 text-center">
|
||||
<h5 class="">Subscribe</h5>
|
||||
<div class="d-flex flex-column flex-sm-row gap-2 justify-content-center mx-auto">
|
||||
<form action="{ROOT_URL}subscribe/home" method="post" class="form-horizontal">
|
||||
<label for="email" class="visually-hidden">Email address</label>
|
||||
<input name="email" id="email" type="email" class="form-control my-2" placeholder="Email address" autocomplete="email">
|
||||
<input type="hidden" name="token" value="{TOKEN}">
|
||||
<button class="btn btn-primary my-2 w-100" name="submit" value="submit" type="submit">Subscribe</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -1,179 +0,0 @@
|
||||
{
|
||||
"main": {
|
||||
"name": {
|
||||
"type": "text",
|
||||
"pretty": "Site Name",
|
||||
"default": "TTP Example",
|
||||
"value": "TTP Example"
|
||||
},
|
||||
"loginLimit": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum Login Attempts per hour",
|
||||
"default": 5,
|
||||
"value": 5
|
||||
},
|
||||
"logo": {
|
||||
"type": "file",
|
||||
"pretty": "Site Logo (Used mostly in emails)",
|
||||
"default": "images/logo.png",
|
||||
"value": "images/logo.png"
|
||||
},
|
||||
"template": {
|
||||
"type": "text",
|
||||
"pretty": "Default Site Template",
|
||||
"default": "default",
|
||||
"value": "default"
|
||||
},
|
||||
"tokenEnabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable CSRF Token for all forms.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"uploads": {
|
||||
"files": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable File Uploads",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"images": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Image Uploads",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"maxFileSize": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum File Size",
|
||||
"default": 5000000,
|
||||
"value": 5000000
|
||||
},
|
||||
"maxImageSize": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum Image Size",
|
||||
"default": 500000,
|
||||
"value": 500000
|
||||
}
|
||||
},
|
||||
"database": {
|
||||
"dbHost": {
|
||||
"type": "text",
|
||||
"pretty": "Database Host (IE: http://localhost:3306)",
|
||||
"default": "127.0.0.1",
|
||||
"protected": true,
|
||||
"value": "127.0.0.1"
|
||||
},
|
||||
"dbUsername": {
|
||||
"type": "text",
|
||||
"pretty": "Database Username",
|
||||
"default": "root",
|
||||
"protected": true,
|
||||
"value": "root"
|
||||
},
|
||||
"dbPrefix": {
|
||||
"type": "text",
|
||||
"pretty": "Database table Prefix",
|
||||
"default": "TTP_",
|
||||
"protected": true,
|
||||
"value": "TTP_"
|
||||
},
|
||||
"dbPassword": {
|
||||
"type": "text",
|
||||
"pretty": "Database Password",
|
||||
"default": "",
|
||||
"protected": true,
|
||||
"value": ""
|
||||
},
|
||||
"dbName": {
|
||||
"type": "text",
|
||||
"pretty": "Database Name",
|
||||
"default": "ttp-example",
|
||||
"protected": true,
|
||||
"value": "ttp-example"
|
||||
},
|
||||
"dbEnabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Database Enabled",
|
||||
"default": true,
|
||||
"protected": true,
|
||||
"value": true
|
||||
},
|
||||
"dbMaxQuery": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum results per query",
|
||||
"default": 100,
|
||||
"protected": true,
|
||||
"value": 100
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"defaultGroup": {
|
||||
"type": "customSelect",
|
||||
"pretty": "The Default Group for new registrations.",
|
||||
"default": 5,
|
||||
"value": 5
|
||||
}
|
||||
},
|
||||
"logging": {
|
||||
"admin": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Admin Action Logging.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"errors": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Error Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"logins": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Login Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"bugReports": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Bug reporting.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"sendEmail": {
|
||||
"type": "radio",
|
||||
"pretty": "Email the user after submiting.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"emailTemplate": {
|
||||
"type": "text",
|
||||
"pretty": "Email Template",
|
||||
"default": "BugReportEmail",
|
||||
"value": "BugReportEmail"
|
||||
}
|
||||
},
|
||||
"feedback": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable User Feedback.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"sendEmail": {
|
||||
"type": "radio",
|
||||
"pretty": "Email the user after submiting.",
|
||||
"default": false,
|
||||
"value": false
|
||||
},
|
||||
"emailTemplate": {
|
||||
"type": "text",
|
||||
"pretty": "Email Template",
|
||||
"default": "feedbackEmail",
|
||||
"value": "feedbackEmail"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
{
|
||||
"installHash": "014c857a650bcb0e4b08b14e1924287c",
|
||||
"installStep": "complete",
|
||||
"modules": {
|
||||
"Group": {
|
||||
"name": "Group",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Success",
|
||||
"installPreferences": "Not Required",
|
||||
"installedResources": ["1", "2", "3", "4", "5", "6"]
|
||||
},
|
||||
"Log": {
|
||||
"name": "Log",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Message": {
|
||||
"name": "Message",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Routes": {
|
||||
"name": "Routes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Success",
|
||||
"installPreferences": "Not Required",
|
||||
"installedResources": ["1", "2", "3", "4", "5"]
|
||||
},
|
||||
"Sessions": {
|
||||
"name": "Sessions",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"User": {
|
||||
"name": "User",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Success"
|
||||
},
|
||||
"Blog": {
|
||||
"name": "Blog",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Success",
|
||||
"installPreferences": "Not Required",
|
||||
"installedResources": ["1"]
|
||||
},
|
||||
"Bugreport": {
|
||||
"name": "Bugreport",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Comments": {
|
||||
"name": "Comments",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Feedback": {
|
||||
"name": "Feedback",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Subscribe": {
|
||||
"name": "Subscribe",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
"adminAccess": {
|
||||
"pretty": "Access Administrator Areas",
|
||||
"default": false
|
||||
},
|
||||
"modAccess": {
|
||||
"pretty": "Access Moderator Areas",
|
||||
"default": false
|
||||
},
|
||||
"memberAccess": {
|
||||
"pretty": "Access Member Areas",
|
||||
"default": false
|
||||
},
|
||||
"sendMessages": {
|
||||
"pretty": "Send messages to other users",
|
||||
"default": false
|
||||
},
|
||||
"addRoute": {
|
||||
"pretty": "Add Custom Routes",
|
||||
"default": false
|
||||
},
|
||||
"uploadImages": {
|
||||
"pretty": "Upload images (such as avatars)",
|
||||
"default": false
|
||||
},
|
||||
"bugReport": {
|
||||
"pretty": "Can Submit Bug Reports",
|
||||
"default": false
|
||||
},
|
||||
"feedback": {
|
||||
"pretty": "Can Submit Feedback",
|
||||
"default": false
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
{
|
||||
"gender": {
|
||||
"pretty": "Gender",
|
||||
"type": "select",
|
||||
"default": "unspecified",
|
||||
"options": ["male", "female", "other", "unspecified"],
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
},
|
||||
"email": {
|
||||
"pretty": "IDK what this is for",
|
||||
"type": "checkbox",
|
||||
"default": "true",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"newsletter": {
|
||||
"pretty": "Receive our Newsletter?",
|
||||
"type": "checkbox",
|
||||
"default": "true",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"avatar": {
|
||||
"pretty": "Avatar",
|
||||
"type": "file",
|
||||
"default": "images/defaultAvatar.png",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"timezone": {
|
||||
"pretty": "Timezone",
|
||||
"type": "timezone",
|
||||
"default": "America/New_York",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"dateFormat": {
|
||||
"pretty": "Date Format",
|
||||
"type": "select",
|
||||
"default": "F j, Y",
|
||||
"options": {
|
||||
"1-8-1991": "n-j-Y",
|
||||
"8-1-1991": "j-n-Y",
|
||||
"01-08-1991": "m-d-Y",
|
||||
"08-01-1991": "d-m-Y",
|
||||
"January 8, 1991": "F-j-Y",
|
||||
"8 January, 1991": "j-F-Y",
|
||||
"January 08, 1991": "F-d-Y",
|
||||
"08 January, 1991": "d-F-Y",
|
||||
"Jan 8, 1991": "M-j-Y",
|
||||
"8 Jan 1991": "j-M-Y",
|
||||
"Jan 08, 1991": "M-d-Y",
|
||||
"08 Jan 1991": "d-M-Y"
|
||||
},
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
},
|
||||
"timeFormat": {
|
||||
"pretty": "Time Format",
|
||||
"type": "select",
|
||||
"default": "g:i:s A",
|
||||
"options": {
|
||||
"3:33:33 AM": "g:i:s A",
|
||||
"03:33:33 AM": "h:i:s A",
|
||||
"3:33:33 am": "g:i:s a",
|
||||
"03:33:33 am": "h:i:s a",
|
||||
"3:33:33 (military)": "G:i:s",
|
||||
"03:33:33 (military)": "H:i:s"
|
||||
},
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
},
|
||||
"pageLimit": {
|
||||
"pretty": "Items Displayed Per Page",
|
||||
"type": "select",
|
||||
"default": "10",
|
||||
"options": ["10", "15", "20", "25", "50"],
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/resources/controllers/example.php
|
||||
*
|
||||
* This is an example controller layout.
|
||||
*
|
||||
* @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\Houdini\Classes\Template;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||
|
||||
// The new controller must extend the default controller class or some functionality will be lost.
|
||||
class Example extends Controller {
|
||||
/**
|
||||
* A constructor does not have to be defined.
|
||||
* If a constructor is used, it must call the parent constructor first.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
Template::noFollow();
|
||||
Template::noIndex();
|
||||
Template::setTemplate( 'example' );
|
||||
}
|
||||
|
||||
/**
|
||||
* A destructor does not have to be defined.
|
||||
* If a destructor is used, it must call the parent destructor last.
|
||||
*/
|
||||
public function __destruct() {
|
||||
Debug::log( 'Something to log before the app ends execution.' );
|
||||
parent::__destruct();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
self::$title = 'Example Controller';
|
||||
Issues::add( 'error', [ 'This is an error with multiple parts.' => [ 'Error 1', 'Error 2' ] ] );
|
||||
Issues::add( 'error', 'This is a single error.' );
|
||||
Issues::add( 'success', [ 'This is a success with multiple parts.' => [ 'Success 1', 'Success 2' ] ] );
|
||||
Issues::add( 'success', 'This is a single success.' );
|
||||
Issues::add( 'notice', 'This is a single notice.' );
|
||||
Issues::add( 'info', 'This is a single info.' );
|
||||
Components::set( 'simple', Views::simpleView( 'simple' ) );
|
||||
Components::set( 'complex', Views::simpleView( 'complex' ) );
|
||||
Views::view( 'example' );
|
||||
$example = Views::simpleView( 'example' );
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
server {
|
||||
listen 8080 default_server;
|
||||
listen [::]:8080 default_server;
|
||||
listen 8081 ssl default_server;
|
||||
listen [::]:8081 ssl default_server;
|
||||
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
include snippets/common.conf;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
location ~* \.(?:js|css|png|jpg|gif|ico)$ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location /js/ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
try_files $uri /index.php?error=js404&file=$uri;
|
||||
}
|
||||
|
||||
location /css/ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
try_files $uri /index.php?error=css404&file=$uri;
|
||||
}
|
||||
|
||||
location / {
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/images/(.*)$ /index.php?error=image404&url=$1 break;
|
||||
rewrite ^/uploads/(.*)$ /index.php?error=upload404&url=$1 break;
|
||||
}
|
||||
rewrite ^/errors/(.*)$ /index.php?error=$1 break;
|
||||
rewrite ^/(.+)$ /index.php?url=$1&$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
|
||||
include snippets/fastcgi-php.conf;
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/resources/models/example.php
|
||||
*
|
||||
* This is an example model.
|
||||
*
|
||||
* @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\Bedrock\Classes\Model;
|
||||
|
||||
class Example extends Model {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/XXXXXXXXXX/plugin.php
|
||||
*
|
||||
* This houses all of the main plugin info and functionality.
|
||||
*
|
||||
* @package TP XXXXXXXXXX
|
||||
* @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 ReflectionClass;
|
||||
use TheTempusProject\Classes\Installer;
|
||||
use TheTempusProject\Houdini\Navigation;
|
||||
use TheTempusProject\Models\forealthough as forealthoughModel;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class notrealplugin extends forealthoughModel {
|
||||
public static $initialized;
|
||||
public $pluginName = 'TP XXXXXXXXXX';
|
||||
public $pluginAuthor = 'JoeyK';
|
||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
||||
public $modelVersion = '1.0';
|
||||
public $pluginVersion = '1.0';
|
||||
public $pluginDescription = 'A simple plugin which adds a site wide XXXXXXXXXX system.';
|
||||
public $configName = 'XXXXXXXXXX';
|
||||
public $databaseMatrix = [
|
||||
[ 'title', 'varchar', '86' ],
|
||||
[ 'suggestion', 'text', '' ],
|
||||
[ 'suggestedOn', 'int', '10' ],
|
||||
[ 'approved', 'varchar', '5' ],
|
||||
[ 'approvedOn', 'int', '10' ],
|
||||
[ 'approvedBy', 'int', '11' ],
|
||||
[ 'author', 'int', '11' ],
|
||||
];
|
||||
public $configMatrix = [
|
||||
'enabled' => [
|
||||
'type' => 'radio',
|
||||
'pretty' => 'Enable XXXXXXXXXX.',
|
||||
'default' => true,
|
||||
],
|
||||
];
|
||||
public $permissionMatrix = [
|
||||
'XXXXXXXXXX' => [
|
||||
'pretty' => 'Can create XXXXXXXXXX',
|
||||
'default' => false,
|
||||
],
|
||||
];
|
||||
public $admin_links = [
|
||||
[
|
||||
'text' => '<i class="fa fa-fw fa-copy"></i> Suggestions',
|
||||
'url' => '{ROOT_URL}admin/suggestions',
|
||||
],
|
||||
];
|
||||
public $main_links = [
|
||||
[
|
||||
'text' => 'Suggestions',
|
||||
'url' => '{ROOT_URL}suggestions/index',
|
||||
],
|
||||
];
|
||||
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}' => 0,
|
||||
'edited{time}' => 0,
|
||||
'draft' => 0,
|
||||
],
|
||||
];
|
||||
public $contact_footer_links = [
|
||||
[
|
||||
'text' => 'Bug Report',
|
||||
'url' => '{ROOT_URL}bugreport',
|
||||
],
|
||||
];
|
||||
public function __construct() {
|
||||
$reflect = new ReflectionClass( $this );
|
||||
if ( true === self::$initialized || !Installer::pluginEnabled( $reflect->getShortName() ) ) {
|
||||
return;
|
||||
}
|
||||
foreach ( $this->contact_footer_links as $key => $link ) {
|
||||
Navigation::addLink( App::CONTACT_FOOTER_MENU_NAME, $link );
|
||||
}
|
||||
foreach ( $this->info_footer_links as $key => $link ) {
|
||||
Navigation::addLink( App::INFO_MENU_NAME, $link );
|
||||
}
|
||||
foreach ( $this->main_links as $key => $link ) {
|
||||
Navigation::addLink( App::MAIN_MENU_NAME, $link );
|
||||
}
|
||||
foreach ( $this->admin_links as $key => $link ) {
|
||||
Navigation::addLink( App::ADMIN_MENU_NAME, $link );
|
||||
}
|
||||
self::$initialized = true;
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
* app/resources/templates/example.tpl
|
||||
*
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{TITLE}</title>
|
||||
<meta name="description" content="{PAGE_DESCRIPTION}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="author" content="The Tempus Project">
|
||||
{ROBOT}
|
||||
<link rel="alternate" hreflang="en-us" href="alternateURL">
|
||||
<link rel="icon" href="{BASE}images/favicon.ico">
|
||||
<!-- Required CSS -->
|
||||
<!-- Custom styles for this template -->
|
||||
<link rel="stylesheet" href="{BASE}Templates/default/default.css">
|
||||
<!-- Required JS -->
|
||||
<script language="JavaScript" type="text/javascript" src="{BASE}JS/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<!--Brand and toggle should get grouped for better mobile display
|
||||
but I had to account for additional menus-->
|
||||
<div class="navbar-header">
|
||||
<a href="{BASE}" class="navbar-brand">{SITENAME}</a>
|
||||
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target=".navbar-ex1-collapse" style="">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
||||
{topNavLeft}
|
||||
<div class="navbar-right">
|
||||
<ul class=" navbar-nav">
|
||||
{topNavRight}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container-fluid">
|
||||
<div class="foot-pad">
|
||||
{ISSUES}
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
{ERROR}
|
||||
{NOTICE}
|
||||
{SUCCESS}
|
||||
{INFO}
|
||||
</div>
|
||||
</div>
|
||||
{/ISSUES}
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
{CONTENT}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<footer>
|
||||
{FOOT}
|
||||
{COPY}
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bootstrap core JavaScript and jquery -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="{BASE}vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* app/resources/templates/example.inc.php
|
||||
*
|
||||
* This is an example loader for the example template.
|
||||
*
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Templates;
|
||||
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Bedrock\Classes\Config;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class ExampleLoader {
|
||||
public function __construct() {
|
||||
Components::set( 'TEMPLATE_URL', Template::parse( '{ROOT_URL}app/templates/default/' ) );
|
||||
Components::set( 'LOGO', Config::get( 'main/logo' ) );
|
||||
Components::set( 'FOOT', Views::simpleView( 'foot' ) );
|
||||
Components::set( 'COPY', Views::simpleView( 'copy' ) );
|
||||
if ( App::$isLoggedIn ) {
|
||||
Components::set( 'STATUS', Views::simpleView( 'nav.statusLoggedIn' ) );
|
||||
Components::set( 'USERNAME', App::$activeUser->username );
|
||||
} else {
|
||||
Components::set( 'STATUS', Views::simpleView( 'nav.statusLoggedOut' ) );
|
||||
}
|
||||
Components::set( 'topNavLeft', Navigation::activePageSelect( 'nav.main' ) );
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
<p>This is a more complex component that includes another component...</p>
|
||||
{simple}
|
||||
<p>...right in the middle!</p>
|
@ -1,141 +0,0 @@
|
||||
|
||||
<p>It is comprised entirely of free form HTML</p>
|
||||
<p>If you are feeling extra bold you can use the templating engine to set variables to be replaced at runtime such as {variable} or even {variable2}, or maybe even just look through some data:</p>
|
||||
{loop}
|
||||
{value1} is the first value.<br />
|
||||
{value2} is the second value.<br />
|
||||
{value3} is the third value.<br />
|
||||
{/loop}
|
||||
{ALT}No Loop{/ALT}
|
||||
{footer}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h1>This is a default view </h1>
|
||||
|
||||
<p>The Tempus-Project template-processor works with the backend to render html for the end user. This process has several steps and components that can get pretty complex. For the moment let's just review a few that can be used to generate web pages. </p>
|
||||
|
||||
<h2>Views</h2>
|
||||
<p>Views are the most basic interaction between the front-end and back-end. Inside of a controler, you can call a view in two ways:</p>
|
||||
<h3>1. Normal - Views::view</h3>
|
||||
<pre></pre>
|
||||
<h3>2. Inline - Views::simpleView</h3>
|
||||
<pre></pre>
|
||||
|
||||
|
||||
<h2>Components</h2>
|
||||
<p>You can think of components as a sort of front-end variable that can be filled in by the back-end before being send to the end-user. You can include components in all template parsing with a simple command:</p>
|
||||
<pre></pre>
|
||||
Adding this to a controler will give access to that component's value in the rendering engine. For example:
|
||||
<pre></pre>
|
||||
|
||||
<h2>Pagination</h2>
|
||||
PAGINATION
|
||||
if (Pagination::totalPages() <= 1) {
|
||||
Components::set('PAGINATION', '<lb>');
|
||||
} else {
|
||||
Components::set('PAGINATION', Views::simpleView('nav.pagination', $pageData));
|
||||
}
|
||||
|
||||
|
||||
|
||||
<h2>Navigation</h2>
|
||||
|
||||
<h2>Filters</h2>
|
||||
<p>In some cases, you may want to hide or show text on a page conditionally. For example, you may have administrator controls on a commonly used page. Obviously you would like to hide those controls from regular users; even if you have safeguards to prevent them from performing any restricted actions.</p>
|
||||
<p>This is where filters come in. They do exactly that, conditionally hide or show part of a page based on back-end logic. The admin example is so common, its already built in. If a user has the isAdmin permission on thier group, they will be able to see anything within the "ADMIN" tag:</p>
|
||||
<pre>
|
||||
Filters::add('member', '#{MEMBER}(.*?){/MEMBER}#is', (self::$isMember ? '$1' : ''), true);
|
||||
Filters::add('mod', '#{MOD}(.*?){/MOD}#is', (self::$isMod ? '$1' : ''), true);
|
||||
Filters::add('admin', '#{ADMIN}(.*?){/ADMIN}#is', (self::$isAdmin ? '$1' : ''), true);
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'#\[b\](.*?)\[/b\]#is' => '<b>$1</b>',
|
||||
'#\[p\](.*?)\[/p\]#is' => '<p>$1</p>',
|
||||
'#\[i\](.*?)\[/i\]#is' => '<i>$1</i>',
|
||||
'#\[u\](.*?)\[/u\]#is' => '<u>$1</u>',
|
||||
'#\[s\](.*?)\[/s\]#is' => '<del>$1</del>',
|
||||
'#\[code\](.*?)\[/code\]#is' => '<code>$1</code>',
|
||||
'#\[color=(.*?)\](.*?)\[/color\]#is' => "<font color='$1'>$2</font>",
|
||||
'#\[img\](.*?)\[/img\]#is' => "<img src='$1'>",
|
||||
'#\[url=(.*?)\](.*?)\[/url\]#is' => "<a href='$1'>$2</a>",
|
||||
'#\[quote=(.*?)\](.*?)\[/quote\]#is' => "<blockquote cite='$1'>$2</blockquote>",
|
||||
'#\(c\)#is' => '✔',
|
||||
'#\(x\)#is' => '✖',
|
||||
'#\(!\)#is' => '❕',
|
||||
'#\(\?\)#is' => '❔',
|
||||
'#\[list\](.*?)\[/list\]#is' => '<ul>$1</ul>',
|
||||
'#\(\.\)(.*)$#m' => '<li>$1</li>',
|
||||
'/(^|\s)@(\w*[a-zA-Z_]+\w*)/' => ' <a href="http://twitter.com/search?q=%40\2">@\2</a>',
|
||||
'/(^|\s)#(\w*[a-zA-Z_]+\w*)/' => ' <a href="http://twitter.com/search?q=%23\2">#\2</a>',
|
||||
'#/\*.*?\*/#s' => null,
|
||||
'#(?<!:)//.*#' => null,
|
||||
"#{CHECKED:(.*?)=(.*?)}#s" => null,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Issues</h2>
|
||||
<p>One of the pre-existing filters happens to be Issues. In the controller for this file, you should see a block that includes several examples of Issues. These issues are automatically added as individual components and hidden with the issues filter.<p>
|
||||
<pre>
|
||||
Issues::add( 'error', [ 'This is an error with multiple parts.' => [ 'Error 1', 'Error 2' ] ] );
|
||||
Issues::add( 'error', 'This is a single error.' );
|
||||
Issues::add( 'success', [ 'This is a success with multiple parts.' => [ 'Success 1', 'Success 2' ] ] );
|
||||
Issues::add( 'success', 'This is a single success.' );
|
||||
Issues::add( 'notice', 'This is a single notice.' );
|
||||
Issues::add( 'info', 'This is a single info.' );
|
||||
Filters::add('issues', '#{ISSUES}(.*?){/ISSUES}#is', (Issues::hasIssues() ? '$1' : ''), true);
|
||||
Components::set( 'NOTICE', $test );
|
||||
Components::set( 'SUCCESS', $test );
|
||||
Components::set( 'ERROR', $test );
|
||||
Components::set( 'INFO', $test );
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Forms</h2>
|
||||
select Radio
|
||||
$selected = 'CHECKED:' . $fieldName . '=' . $value;
|
||||
Components::set($selected, 'checked="checked"');
|
||||
select Option
|
||||
$find = "#\<option (.*?)value=\'" . $value . "\'#s";
|
||||
$replace = "<option $1value='" . $value . "' selected";
|
||||
self::$options[$find] = $replace;
|
@ -1 +0,0 @@
|
||||
<p>This is a simple component.</p>
|
Reference in New Issue
Block a user