diff options
31 files changed, 3 insertions, 1628 deletions
diff --git a/main/app/sprinkles/ConfigManager/CHANGELOG.md b/main/app/sprinkles/ConfigManager/CHANGELOG.md deleted file mode 100644 index 4248a56..0000000 --- a/main/app/sprinkles/ConfigManager/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# Change Log - -## 2.0.4 -- Fix issue with FormGenerator (for real this time) -- Bump FormGenerator version - -## 2.0.3 -- Fix issue with FormGenerator - -## 2.0.2 -- Fix assets bundle issue - -## 2.0.1 -- Updated dependencies - -## 2.0.0 -Updated for UserFrosting v4.1.x - -## 1.0.2 -- Update composer.json - -## 1.0.1 -- Added controlled access -- Added more settings to the default UI - -## 1.0.0 -- Initial release diff --git a/main/app/sprinkles/ConfigManager/LICENSE b/main/app/sprinkles/ConfigManager/LICENSE deleted file mode 100644 index 09386f7..0000000 --- a/main/app/sprinkles/ConfigManager/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Louis Charette - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/main/app/sprinkles/ConfigManager/README.md b/main/app/sprinkles/ConfigManager/README.md deleted file mode 100644 index d90b2fe..0000000 --- a/main/app/sprinkles/ConfigManager/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Configuration Manager Sprinkle for [UserFrosting 4](https://www.userfrosting.com) - -Configuration Manager sprinkle for [UserFrosting 4](https://www.userfrosting.com). Lets you edit UserFrosting configs from the interface. - -> This version only works with UserFrosting 4.1.x ! - -# Help and Contributing - -If you need help using this sprinkle or found any bug, feels free to open an issue or submit a pull request. You can also find me on the [UserFrosting Chat](https://chat.userfrosting.com/) most of the time for direct support. - -<a href='https://ko-fi.com/A7052ICP' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> - -# Installation - -Edit UserFrosting `app/sprinkles.json` file and add the following to the `require` list : `"lcharette/uf_configmanager": "^2.0.0"`. Also add `FormGenerator` and `ConfigManager` to the `base` list. For example: - -``` -{ - "require": { - "lcharette/uf_configmanager": "^2.0.0" - }, - "base": [ - "core", - "account", - "admin", - "FormGenerator", - "ConfigManager" - ] -} -``` - -Run `composer update` then `php bakery bake` to install the sprinkle. - -## Permissions -The migration will automatically add the `update_site_config` permission to the `Site Administrator` role. To give access to the config UI to another user, simply add the `update_site_config` permission slug to that user role. - -## Add link to the menu -The configuration UI is bound to the the `/settings` route. Simply add a link to this route where you want it. The checkAccess make it so it will appear only for users having the appropriate permission. For example, you can add the following to the sidebar menu : - -``` -{% if checkAccess('update_site_config') %} -<li> - <a href="{{site.uri.public}}/settings"><i class="fa fa-gears fa-fw"></i> <span>{{ translate("SITE.CONFIG.MANAGER") }}</span></a> -</li> -{% endif %} -``` - -## Adding custom config - -! TODO - -> *NOTE* Only `.json` are accepted. `Yaml` schemas are cannot be used for now. - -# Licence - -By [Louis Charette](https://github.com/lcharette). Copyright (c) 2017, free to use in personal and commercial software as per the MIT license.
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/asset-bundles.json b/main/app/sprinkles/ConfigManager/asset-bundles.json deleted file mode 100644 index 7550df9..0000000 --- a/main/app/sprinkles/ConfigManager/asset-bundles.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "bundle": { - "js/ConfigManager" : { - "scripts": [ - "js/ConfigManager.js" - ], - "options": { - "result": { - "type": { - "scripts": "plain" - } - } - } - } - } -}
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/assets/js/ConfigManager.js b/main/app/sprinkles/ConfigManager/assets/js/ConfigManager.js deleted file mode 100644 index 2a298f5..0000000 --- a/main/app/sprinkles/ConfigManager/assets/js/ConfigManager.js +++ /dev/null @@ -1,92 +0,0 @@ -/*! - * UF Config Manager - Config Manager Widget - * - * @link https://github.com/lcharette/UF_ConfigManager - * @copyright Copyright (c) 2016 Louis Charette - * @license https://github.com/lcharette/UF_ConfigManager/blob/master/LICENSE (MIT License) - */ - -(function( $ ){ - - 'use strict'; - - var options = {}; - - var methods = { - init : function(optionsArg) { - - // Setup options - options = $.extend( options, $.fn.ConfigManager.defaultOptions, optionsArg ); - - // To use this inside sub-functions - var elements = this; - - // Get the currently selected panel from the url anchor and switch to it - var hash = window.location.hash.substr(1); - if (hash != undefined && hash !== "") { - $(elements).hide(); - $("#"+hash).show(); - - // Change the menu - $(options.menu).find("li").removeClass('active'); - $(options.menu).find('a[href="#'+hash+'"]').parent().addClass("active"); - } - - // Set the menu - $(options.menu).find("li > a").click(function () { - - // Change the menu first - $(options.menu).find("li").removeClass('active'); - $(this).parent().addClass("active"); - - // Change the displayed forms next - $(elements).hide(); - $("#"+$(this).data('target')).show(); - }); - - // For each element the plugin is called on - this.each(function() { - - // To use this inside sub-functions - var formPanel = this; - - // ufForm instance. Don't need FormGeneator now - $(formPanel).find("form").ufForm({ - validators: options.validators[ $(formPanel).attr('id') ], - msgTarget: $(formPanel).find("form .form-alerts") - }).on("submitSuccess.ufForm", function() { - // Forward to settings page on success - window.location.reload(true); - }).on("submitError.ufForm", function() { - $(formPanel).find("form .form-alerts").show(); - }); - - }); - return; - } - }; - - /* - * Main plugin function - */ - $.fn.ConfigManager = function(methodOrOptions) { - if ( methods[methodOrOptions] ) { - return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 )); - } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) { - // Default to "init" - return methods.init.apply( this, arguments ); - } else { - $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.ConfigManager' ); - } - }; - - /* - * Default plugin options - */ - $.fn.ConfigManager.defaultOptions = { - menu : $(".configMenu"), - validators: {} - }; - - -})( jQuery );
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/composer.json b/main/app/sprinkles/ConfigManager/composer.json deleted file mode 100644 index d524836..0000000 --- a/main/app/sprinkles/ConfigManager/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "lcharette/uf_configmanager", - "type": "userfrosting-sprinkle", - "description": "This Sprinkle provides a UI for core and custom site settings", - "keywords": ["UserFrosting", "Config", "Settings", "Admin Panel"], - "homepage": "https://github.com/lcharette/UF_ConfigManager", - "license" : "MIT", - "authors" : [ - { - "name": "Louis Charette", - "homepage": "https://github.com/lcharette" - } - ], - "require": { - "php": ">=5.6", - "lcharette/uf_formgenerator": "^2.2.10" - }, - "autoload": { - "psr-4": { - "UserFrosting\\Sprinkle\\ConfigManager\\": "src/" - } - }, - "extra": { - "installer-name": "ConfigManager" - } -} diff --git a/main/app/sprinkles/ConfigManager/locale/en_US/AdminLTE.php b/main/app/sprinkles/ConfigManager/locale/en_US/AdminLTE.php deleted file mode 100644 index bd1d032..0000000 --- a/main/app/sprinkles/ConfigManager/locale/en_US/AdminLTE.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -return [ - "ADMINLTE" => [ - "SETTINGS" => [ - "@TRANSLATION" => "AdminLTE Settings", - - "DESC" => "Settings for the AdminLTE Theme", - - "SKIN" => "Skin color" - ], - - "SKIN" => [ - "BLUE" => "Blue", - "BLACK" => "Black", - "PURPLE" => "Purple", - "GREEN" => "Green", - "RED" => "Red", - "YELLOW" => "Yellow", - "BLUE_LIGHT" => "Blue Light", - "BLACK_LIGHT" => "Black Light", - "PURPLE_LIGHT" => "Purple Light", - "GREEN_LIGHT" => "Green Light", - "RED_LIGHT" => "Red Light", - "YELLOW_LIGHT" => "Yellow Light" - ] - ] -];
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/locale/en_US/ConfigManager.php b/main/app/sprinkles/ConfigManager/locale/en_US/ConfigManager.php deleted file mode 100644 index b82f099..0000000 --- a/main/app/sprinkles/ConfigManager/locale/en_US/ConfigManager.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -return [ - "SITE" => [ - "CONFIG" => [ - "@TRANSLATION" => "UserFrosting Settings", - - "DESC" => "Core settings of UserFrosting. See the config file for more configuration options", - - "MANAGER" => "Configuration manager", - - "PAGEDESC" => "This pages allows to edit the global site configuration variables stored in the database", - - "SAVED" => "Changes saved successfully !" - ], - "TITLE" => [ - "@TRANSLATION" => "Site title", - "REQUIRED" => "The site title is required" - ], - "REGISTRATION" => [ - "ENABLED" => "Enabled site registration", - "REQUIRE_EMAIL_VERIFICATION" => "Require email verification when registering" - ] - ], - "SETTINGS" => [ - "DISPLAY_ERROR_DETAILS" => "Display error details" - ] -];
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/locale/fr_FR/AdminLTE.php b/main/app/sprinkles/ConfigManager/locale/fr_FR/AdminLTE.php deleted file mode 100644 index 39b4614..0000000 --- a/main/app/sprinkles/ConfigManager/locale/fr_FR/AdminLTE.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -return [ - "ADMINLTE" => [ - "SETTINGS" => [ - "@TRANSLATION" => "Paramètres d'AdminLTE", - - "DESC" => "Paramètres du thème AdminLTE", - - "SKIN" => "Couleur du thème" - ], - - "SKIN" => [ - "BLUE" => "Bleu", - "BLACK" => "Noir", - "PURPLE" => "Violet", - "GREEN" => "Vert", - "RED" => "Rouge", - "YELLOW" => "Jaune", - "BLUE_LIGHT" => "Bleu (Light)", - "BLACK_LIGHT" => "Noir (Light)", - "PURPLE_LIGHT" => "Violet (Light)", - "GREEN_LIGHT" => "Vert (Light)", - "RED_LIGHT" => "Rouge (Light)", - "YELLOW_LIGHT" => "Jaune (Light)" - ] - ] -];
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/locale/fr_FR/ConfigManager.php b/main/app/sprinkles/ConfigManager/locale/fr_FR/ConfigManager.php deleted file mode 100644 index 3f9acff..0000000 --- a/main/app/sprinkles/ConfigManager/locale/fr_FR/ConfigManager.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -return [ - "SITE" => [ - "CONFIG" => [ - "@TRANSLATION" => "Paramètres de UserFrosting", - - "DESC" => "Paramètres principaux de UserFrosting. Voir le fichier config pour plus d'options", - - "MANAGER" => "Gestionnaire des paramètres", - - "PAGEDESC" => "Cette page permet de modifier les paramètres globaux du site enregistrés dans la base de données", - - "SAVED" => "Changements sauvegardés avec succès !" - ], - "TITLE" => [ - "@TRANSLATION" => "Titre du site", - "REQUIRED" => "Le titre du site est requis" - ], - "REGISTRATION" => [ - "ENABLED" => "Activer l'inscription", - "REQUIRE_EMAIL_VERIFICATION" => "Exiger une vérification par e-mail lors de l'inscription" - ] - ], - "SETTINGS" => [ - "DISPLAY_ERROR_DETAILS" => "Afficher le détails des erreurs" - ] -];
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/routes/ConfigManager.php b/main/app/sprinkles/ConfigManager/routes/ConfigManager.php deleted file mode 100644 index f17f589..0000000 --- a/main/app/sprinkles/ConfigManager/routes/ConfigManager.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * UF Config Manager - * - * @link https://github.com/lcharette/UF_ConfigManager - * @copyright Copyright (c) 2016 Louis Charette - * @license https://github.com/lcharette/UF_ConfigManager/blob/master/LICENSE (MIT License) - */ - -$app->group('/settings', function () { - $this->get('', 'UserFrosting\Sprinkle\ConfigManager\Controller\ConfigManagerController:displayMain') - ->setName('ConfigManager'); - - $this->post('/{schema}', 'UserFrosting\Sprinkle\ConfigManager\Controller\ConfigManagerController:update') - ->setName('ConfigManager.save'); -});
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/schema/config/AdminLTE.json b/main/app/sprinkles/ConfigManager/schema/config/AdminLTE.json deleted file mode 100644 index 04e92da..0000000 --- a/main/app/sprinkles/ConfigManager/schema/config/AdminLTE.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name" : "ADMINLTE.SETTINGS", - "desc" : "ADMINLTE.SETTINGS.DESC", - - "config": { - "site.AdminLTE.skin" : { - "validators" : { - "required" : {} - }, - "cached" : true, - "form" : { - "type" : "select", - "label" : "ADMINLTE.SETTINGS.SKIN", - "icon" : "", - "options" : { - "blue" : "ADMINLTE.SKIN.BLUE", - "black" : "ADMINLTE.SKIN.BLACK", - "purple" : "ADMINLTE.SKIN.PURPLE", - "green" : "ADMINLTE.SKIN.GREEN", - "red" : "ADMINLTE.SKIN.RED", - "yellow" : "ADMINLTE.SKIN.YELLOW", - "blue-light" : "ADMINLTE.SKIN.BLUE_LIGHT", - "black-light" : "ADMINLTE.SKIN.BLACK_LIGHT", - "purple-light" : "ADMINLTE.SKIN.PURPLE_LIGHT", - "green-light" : "ADMINLTE.SKIN.GREEN_LIGHT", - "red-light" : "ADMINLTE.SKIN.RED_LIGHT", - "yellow-light" : "ADMINLTE.SKIN.YELLOW_LIGHT" - } - } - } - } -}
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/schema/config/site.json b/main/app/sprinkles/ConfigManager/schema/config/site.json deleted file mode 100644 index 2c9f4f0..0000000 --- a/main/app/sprinkles/ConfigManager/schema/config/site.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name" : "SITE.CONFIG", - "desc" : "SITE.CONFIG.DESC", - - "config": { - "site.title" : { - "validators" : { - "required" : { - "message" : "SITE.TITLE.REQUIRED" - } - }, - "form" : { - "type" : "text", - "label" : "SITE.TITLE", - "icon" : "fa-comment" - } - }, - "site.registration.enabled" : { - "validators" : {}, - "form" : { - "type" : "checkbox", - "label" : "SITE.REGISTRATION.ENABLED" - } - }, - "site.registration.require_email_verification" : { - "validators" : {}, - "form" : { - "type" : "checkbox", - "label" : "SITE.REGISTRATION.REQUIRE_EMAIL_VERIFICATION" - } - }, - "settings.displayErrorDetails" : { - "validators" : {}, - "form" : { - "type" : "checkbox", - "label" : "SETTINGS.DISPLAY_ERROR_DETAILS" - } - } - } -}
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/src/ConfigManager.php b/main/app/sprinkles/ConfigManager/src/ConfigManager.php deleted file mode 100644 index c29cee9..0000000 --- a/main/app/sprinkles/ConfigManager/src/ConfigManager.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * UF Config Manager - * - * @link https://github.com/lcharette/UF_ConfigManager - * @copyright Copyright (c) 2016 Louis Charette - * @license https://github.com/lcharette/UF_ConfigManager/blob/master/LICENSE (MIT License) - */ -namespace UserFrosting\Sprinkle\ConfigManager; - -use UserFrosting\System\Sprinkle\Sprinkle; -use RocketTheme\Toolbox\Event\Event; - -/** - * ConfigManager class. - * - * Bootstrapper class for the 'Settings' sprinkle. - * @extends Sprinkle - */ -class ConfigManager extends Sprinkle -{ - /** - * Defines which events in the UF lifecycle our Sprinkle should hook into. - */ - public static function getSubscribedEvents() - { - return [ - 'onAddGlobalMiddleware' => ['onAddGlobalMiddleware', 0] - ]; - } - - /** - * Add middleware. - */ - public function onAddGlobalMiddleware(Event $event) - { - $app = $event->getApp(); - $app->add($this->ci->configManager); - } -} diff --git a/main/app/sprinkles/ConfigManager/src/Controller/ConfigManagerController.php b/main/app/sprinkles/ConfigManager/src/Controller/ConfigManagerController.php deleted file mode 100644 index 0b5aac0..0000000 --- a/main/app/sprinkles/ConfigManager/src/Controller/ConfigManagerController.php +++ /dev/null @@ -1,173 +0,0 @@ -<?php -/** - * UF Config Manager - * - * @link https://github.com/lcharette/UF_ConfigManager - * @copyright Copyright (c) 2016 Louis Charette - * @license https://github.com/lcharette/UF_ConfigManager/blob/master/LICENSE (MIT License) - */ -namespace UserFrosting\Sprinkle\ConfigManager\Controller; - -use Interop\Container\ContainerInterface; -use UserFrosting\Sprinkle\Core\Facades\Debug; -use UserFrosting\Sprinkle\ConfigManager\Util\ConfigManager; -use UserFrosting\Sprinkle\FormGenerator\Form; -use UserFrosting\Support\Exception\ForbiddenException; -use UserFrosting\Support\Repository\Loader\YamlFileLoader; -use UserFrosting\Fortress\RequestSchema; -use UserFrosting\Fortress\RequestSchema\RequestSchemaRepository; -use UserFrosting\Fortress\RequestDataTransformer; -use UserFrosting\Fortress\ServerSideValidator; -use UserFrosting\Fortress\Adapter\JqueryValidationAdapter; - -/** - * ConfigManagerController Class - * - * Controller class for /settings/* URLs. Generate the interface required to modify the sites settings and saving the changes - */ -class ConfigManagerController { - - /** - * @var ContainerInterface The global container object, which holds all your services. - */ - protected $ci; - - /** - * @var ConfigManager Hold the ConfigManager class that handle setting the config and getting the config schema - * Note that we don't interact with the `Config` db model directly since it can't handle the cache - */ - protected $manager; - - /** - * __construct function. - * Create a new ConfigManagerController object. - * - * @access public - * @param ContainerInterface $ci - * @return void - */ - public function __construct(ContainerInterface $ci) { - $this->ci = $ci; - $this->manager = new ConfigManager($ci); - } - - /** - * mainList function. - * Used to display a list of all schema with their form - * - * @access public - * @param mixed $request - * @param mixed $response - * @param mixed $args - * @return void - */ - public function displayMain($request, $response, $args){ - - // Access-controlled resource - if (!$this->ci->authorizer->checkAccess($this->ci->currentUser, 'update_site_config')) { - throw new ForbiddenException(); - } - - // Get all the config schemas - $schemas = $this->manager->getAllShemas(); - - // Parse each of them to get it's content - foreach ($schemas as $i => $schemaData) { - - // Set the schemam, the validator and the form - $schema = new RequestSchemaRepository($schemaData['config']); - $validator = new JqueryValidationAdapter($schema, $this->ci->translator); - - // Create the form - $config = $this->ci->config; - $form = new Form($schema, $config); - - // The field names dot syntaxt won't make it across the HTTP POST request. - // Wrap them in a nice `data` array - $form->setFormNamespace("data"); - - // Twig doesn't need the raw thing - unset($schemas[$i]['config']); - - // Add the field and validator so Twig can play with them - $schemas[$i]["fields"] = $form->generate(); - $schemas[$i]["validators"] = $validator->rules('json', true); - - // Add the save url for that schema - $schemas[$i]["formAction"] = $this->ci->router->pathFor('ConfigManager.save', ['schema' => $schemaData['filename']]); - } - - // Time to render the page ! - $this->ci->view->render($response, 'pages/ConfigManager.html.twig', [ - "schemas" => $schemas, - ]); - - } - - /** - * update function. - * Processes the request to save the settings to the db - * - * @access public - * @param mixed $request - * @param mixed $response - * @param mixed $args - * @return void - */ - public function update($request, $response, $args){ - - // Get the alert message stream - $ms = $this->ci->alerts; - - // Access-controlled resource - if (!$this->ci->authorizer->checkAccess($this->ci->currentUser, 'update_site_config')) { - throw new ForbiddenException(); - } - - // Request POST data - $post = $request->getParsedBody(); - - // So we first get the shcema data - $loader = new YamlFileLoader("schema://config/".$args['schema'].".json"); - $schemaData = $loader->load(); - - // We can't pass the file directly to RequestSchema because it's a custom one - // So we create a new empty RequestSchemaRepository and feed it the `config` part of our custom schema - $schema = new RequestSchemaRepository($schemaData['config']); - - // Transform the data - $transformer = new RequestDataTransformer($schema); - $data = $transformer->transform($post['data']); - - // We change the dot notation of our elements to a multidimensionnal array - // This is required for the fields (but not for the schema) because the validator doesn't use the - // dot notation the same way. Sending dot notation field name to the validator will fail. - $dataArray = array(); - foreach ($data as $key => $value) { - array_set($dataArray, $key, $value); - } - - // We validate the data array against the schema - $validator = new ServerSideValidator($schema, $this->ci->translator); - if (!$validator->validate($dataArray)) { - $ms->addValidationErrors($validator); - return $response->withStatus(400); - } - - // The data is now validaded. Instead or switching back the array to dot notation, - // we can use the `$data` that's still intact. The validator doesn't change the data - // Next, update each config - foreach ($data as $key => $value) { - - // We need to access the $schemaData to find if we need to cache this one - $cached = (isset($schemaData['config'][$key]['cached'])) ? $schemaData['config'][$key]['cached'] : true; - - // Set the config using the manager - $this->manager->set($key, $value, $cached); - } - - //Success message! - $ms->addMessageTranslated("success", "SITE.CONFIG.SAVED"); - return $response->withJson([], 200, JSON_PRETTY_PRINT); - } -} diff --git a/main/app/sprinkles/ConfigManager/src/Database/Migrations/v100/SettingsTable.php b/main/app/sprinkles/ConfigManager/src/Database/Migrations/v100/SettingsTable.php deleted file mode 100644 index 182dbfb..0000000 --- a/main/app/sprinkles/ConfigManager/src/Database/Migrations/v100/SettingsTable.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * UF Config Manager - * - * @link https://github.com/lcharette/UF_ConfigManager - * @copyright Copyright (c) 2016 Louis Charette - * @license https://github.com/lcharette/UF_ConfigManager/blob/master/LICENSE (MIT License) - */ -namespace UserFrosting\Sprinkle\ConfigManager\Database\Migrations\v100; - -use UserFrosting\System\Bakery\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Schema\Builder; - -/** - * Settings table migration - * @extends Migration - */ -class SettingsTable extends Migration -{ - /** - * {@inheritDoc} - */ - public function up() - { - if (!$this->schema->hasTable('settings')) { - $this->schema->create('settings', function (Blueprint $table) { - $table->increments('id'); - $table->string('key'); - $table->string('value')->nullable(); - $table->boolean('cached')->default(1); - $table->timestamps(); - - $table->engine = 'InnoDB'; - $table->collation = 'utf8_unicode_ci'; - $table->charset = 'utf8'; - }); - } - } - - /** - * {@inheritDoc} - */ - public function down() - { - $this->schema->drop('settings'); - } -}
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/src/Database/Migrations/v101/SettingsPermissions.php b/main/app/sprinkles/ConfigManager/src/Database/Migrations/v101/SettingsPermissions.php deleted file mode 100644 index c3928d9..0000000 --- a/main/app/sprinkles/ConfigManager/src/Database/Migrations/v101/SettingsPermissions.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * UF Config Manager - * - * @link https://github.com/lcharette/UF_ConfigManager - * @copyright Copyright (c) 2016 Louis Charette - * @license https://github.com/lcharette/UF_ConfigManager/blob/master/LICENSE (MIT License) - */ -namespace UserFrosting\Sprinkle\ConfigManager\Database\Migrations\v101; - -use UserFrosting\System\Bakery\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Schema\Builder; -use UserFrosting\Sprinkle\Account\Database\Models\Permission; -use UserFrosting\Sprinkle\Account\Database\Models\Role; - -/** - * Settings permissions migration - * @extends Migration - */ -class SettingsPermissions extends Migration -{ - /** - * {@inheritDoc} - */ - public $dependencies = [ - '\UserFrosting\Sprinkle\Account\Database\Migrations\v400\PermissionsTable', - '\UserFrosting\Sprinkle\ConfigManager\Database\Migrations\v100\SettingsTable' - ]; - - /** - * {@inheritDoc} - */ - public function up() - { - // Check if permission exist - $permissionExist = Permission::where('slug', 'update_site_config')->first(); - if ($permissionExist) { - $this->io->warning("\nPermission slug `update_site_config` already exist. Skipping..."); - return; - } - - // Add default permissions - $permission = new Permission([ - 'slug' => 'update_site_config', - 'name' => 'Update site configuration', - 'conditions' => 'always()', - 'description' => 'Edit site configuration from the UI' - ]); - $permission->save(); - - $roleSiteAdmin = Role::where('slug', 'site-admin')->first(); - if ($roleSiteAdmin) { - $roleSiteAdmin->permissions()->attach([ - $permission->id - ]); - } - } - - /** - * {@inheritDoc} - */ - public function down() - { - $permissions = Permission::where('slug', 'update_site_config')->get(); - foreach ($permissions as $permission) { - $permission->delete(); - } - } -}
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/src/Database/Models/Config.php b/main/app/sprinkles/ConfigManager/src/Database/Models/Config.php deleted file mode 100644 index 53a85ca..0000000 --- a/main/app/sprinkles/ConfigManager/src/Database/Models/Config.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * UF Settings - * - * @link https://github.com/lcharette/UF_Settings - * @copyright Copyright (c) 2016 Louis Charette - * @license - */ -namespace UserFrosting\Sprinkle\ConfigManager\Database\Models; - -use \Illuminate\Database\Capsule\Manager as Capsule; -use UserFrosting\Sprinkle\Core\Database\Models\Model; - -/** - * Settings class. - * - * @extends Model - */ -class Config extends Model { - - /** - * @var string The name of the table for the current model. - */ - protected $table = "settings"; - - /** - * @var array The fields of the table for the current model. - */ - protected $fillable = [ - "key", - "value", - "cache" - ]; - - /** - * @var bool Enable timestamps for Users. - */ - public $timestamps = true; - - /** - * Create a new Project object. - * - */ - public function __construct($properties = []) - { - parent::__construct($properties); - } - - /** - * Model's relations - * Each of those should be in delete ! - * - */ - - /** - * Model's parent relation - * - */ - - /** - * Delete this group from the database, along with any linked user and authorization rules - * - */ - public function delete() - { - // Delete the main object - $result = parent::delete(); - return $result; - } -}
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/src/ServicesProvider/ServicesProvider.php b/main/app/sprinkles/ConfigManager/src/ServicesProvider/ServicesProvider.php deleted file mode 100644 index 93187b1..0000000 --- a/main/app/sprinkles/ConfigManager/src/ServicesProvider/ServicesProvider.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * Gaston (http://gaston.bbqsoftwares.com) - * - * @link https://github.com/lcharette/GASTON - * @copyright Copyright (c) 2016 Louis Charette - * @license - */ -namespace UserFrosting\Sprinkle\ConfigManager\ServicesProvider; - -use UserFrosting\Sprinkle\ConfigManager\Util\ConfigManager; - -/** - * ConfigManagerServicesProvider class. - * Registers services for the ConfigManager sprinkle, such as configManager, etc. - */ -class ServicesProvider -{ - /** - * Register configManager services. - * - * @param Container $container A DI container implementing ArrayAccess and container-interop. - */ - public function register($container) - { - $container['configManager'] = function ($c) { - $c->db; - return new ConfigManager($c); - }; - } -} diff --git a/main/app/sprinkles/ConfigManager/src/Util/ConfigManager.php b/main/app/sprinkles/ConfigManager/src/Util/ConfigManager.php deleted file mode 100644 index e935487..0000000 --- a/main/app/sprinkles/ConfigManager/src/Util/ConfigManager.php +++ /dev/null @@ -1,243 +0,0 @@ -<?php -/** - * Gaston (http://gaston.bbqsoftwares.com) - * - * @link https://github.com/lcharette/GASTON - * @copyright Copyright (c) 2016 Louis Charette - * @license - */ -namespace UserFrosting\Sprinkle\ConfigManager\Util; - -use UserFrosting\Sprinkle\Core\Facades\Debug; -use UserFrosting\Sprinkle\ConfigManager\Database\Models\Config; -use UserFrosting\Support\Exception\FileNotFoundException; -use UserFrosting\Support\Exception\JsonException; -use UserFrosting\Support\Repository\Loader\YamlFileLoader; -use Interop\Container\ContainerInterface; - -/** - * GastonServicesProvider class. - * Registers services for the account sprinkle, such as currentUser, etc. - */ -class ConfigManager -{ - /** - * @var ContainerInterface The global container object, which holds all your services. - */ - protected $ci; - - /** - * __construct function. - * - * @access public - * @param ContainerInterface $ci - * @return void - */ - public function __construct(ContainerInterface $ci) - { - $this->ci = $ci; - } - - /** - * __invoke function. - * Invoke the ConfigManager middleware, merging the db config with the file based one - * - * @access public - * @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request - * @param \Psr\Http\Message\ResponseInterface $response PSR7 response - * @param callable $next Next middleware - * @return \Psr\Http\Message\ResponseInterface - */ - public function __invoke($request, $response, $next) - { - $this->ci->config->mergeItems(null, $this->fetch()); - return $next($request, $response); - } - - /** - * fetch function. - * Fetch all the config from the db and uses the - * cache container to store most of thoses setting in the cache system - * - * @access public - * @return void - */ - public function fetch() { - - $cache = $this->ci->cache; - - // Case n° 1 we don't have cached content. We load everything - // Case n° 2 we have cached content, pull that and load the non chanched things to it - if (($cached_settings = $cache->get('UF_config')) === null) - { - $settingsCollection = Config::all(); - $settings = $this->collectionToArray($settingsCollection); - - // Save in cache. The settings that are not cached are not included - $cache->forever('UF_config', $this->collectionToArray($settingsCollection, false)); - } - else - { - // We have the cached values, we need to grab the non cached ones - $settingsCollection = Config::where('cached', 0); - $settings = array_merge_recursive($cached_settings, $this->collectionToArray($settingsCollection)); - } - - return $settings; - } - - /** - * delete function. - * Removes a configuration option - * - * @access public - * @param string $key The setting's name - * @return bool Success - */ - public function delete($key) { - - // Get the desired key - if (!$setting = Config::where('key', $key)->first()) { - return false; - } - - // Delete time - $setting->delete(); - - // Remove from current laod - unset($this->ci->config[$key]); - - // Delete cache - if ($setting->cached) - { - $this->ci->cache->forget('UF_config'); - } - - return true; - } - - /** - * set function. - * Sets a setting's value - * - * @access public - * @param string $key The setting's name - * @param string $value The new value - * @param bool $cached (default: true) Whether this variable should be cached or if it - * changes too frequently to be efficiently cached. - * @return bool True if the value was changed, false otherwise - */ - public function set($key, $value, $cached = true) { - return $this->set_atomic($key, false, $value, $cached); - } - - /** - * set_atomic function. - * Sets a setting's value only if the old_value matches the - * current value or the setting does not exist yet. - * - * @access public - * @param string $key The setting's name - * @param string $old_value Current configuration value or false to ignore - * the old value - * @param string $new_value The new value - * @param bool $cached (default: true) Whether this variable should be cached or if it - * changes too frequently to be efficiently cached. - * @return bool True if the value was changed, false otherwise - */ - public function set_atomic($key, $old_value, $new_value, $cached = true) { - - // Get the desired key - $setting = Config::where('key', $key)->first(); - - if ($setting) { - - if ($old_value === false || $setting->value == $old_value) { - - $setting->value = $new_value; - $setting->save(); - - } else { - return false; - } - - } else { - $setting = new Config([ - 'key' => $key, - 'value' => $new_value, - 'cached' => $cached - ]); - $setting->save(); - } - - if ($cached) - { - $this->ci->cache->forget('UF_config'); - } - - $this->ci->config[$key] = $new_value; - return true; - } - - /** - * getAllShemas function. - * Get all the config schemas available - * - * @access public - * @return void - */ - public function getAllShemas() { - - $configSchemas = []; - - $loader = new YamlFileLoader([]); - - // Get all the location where we can find config schemas - $paths = array_reverse($this->ci->locator->findResources('schema://config', true, false)); - - // For every location... - foreach ($paths as $path) { - - // Get a list of all the schemas file - $files_with_path = glob($path . "/*.json"); - - // Load every found files - foreach ($files_with_path as $file) { - - // Load the file content - $schema = $loader->loadFile($file); - - // Get file name - $filename = basename($file, ".json"); - - //inject file name - $schema['filename'] = $filename; - - // Add to list - $configSchemas[$filename] = $schema; - } - } - - return $configSchemas; - } - - - /** - * collectionToArray function. - * This function Expand the db dot notation single level array - * to a multi-dimensional array - * - * @access private - * @param Collection $Collection Eloquent collection - * @return array - */ - private function collectionToArray($Collection, $include_noncached = true) { - $settings_array = array(); - foreach ($Collection as $setting) { - if ($include_noncached || $setting->cached) { - array_set($settings_array, $setting->key, $setting->value); - } - } - return $settings_array; - } -}
\ No newline at end of file diff --git a/main/app/sprinkles/ConfigManager/templates/pages/ConfigManager.html.twig b/main/app/sprinkles/ConfigManager/templates/pages/ConfigManager.html.twig deleted file mode 100644 index ebfb251..0000000 --- a/main/app/sprinkles/ConfigManager/templates/pages/ConfigManager.html.twig +++ /dev/null @@ -1,64 +0,0 @@ -{% extends "pages/abstract/dashboard.html.twig" %} - -{% block page_title %}{{ translate('SITE.CONFIG.MANAGER') }}{% endblock %} -{% block page_description %}{{ translate('SITE.CONFIG.PAGEDESC') }}{% endblock %} - -{% block body_matter %} - <div class="row"> - <div class="col-lg-3"> - <div class="box box-primary"> - <div class="box-header"> - <h3 class="box-title">Menu</h3> - </div> - <div class="box-body"> - <ul id="configMenu" class="nav nav-pills nav-stacked"> - {% for schema in schemas %} - <li role="presentation" {% if loop.first %} class="active"{% endif %}><a href="#configPanel-{{ schema.filename }}" data-target="configPanel-{{ schema.filename }}">{{ translate(schema.name) }}</a></li> - {% endfor %} - </ul> - </div> - </div> - </div> - <div class="col-lg-9"> - {% for schema in schemas %} - <div id="configPanel-{{ schema.filename }}" class="box box-primary" {% if not loop.first %} style="display: none;"{% endif %}> - <form method="post" action="{{schema.formAction}}" class="form-horizontal"> - <div class="box-header"> - <h3 class="box-title">{{ translate(schema.name) }}</h3> - </div> - <div class="box-body"> - {% if schema.desc %}<p>{{ translate(schema.desc) }}</p>{% endif %} - {% include "forms/csrf.html.twig" %} - <div class="form-alerts"></div> - {% include 'FormGenerator/FormGenerator.html.twig' with {fields: schema.fields, 'formLayout': 'horizontal'} %} - </div> - <div class="box-footer text-center"> - <button type="reset" class="btn btn-default">{{translate('RESET')}}</button> - <button type="submit" class="btn btn-primary js-submit">{{translate('SAVE')}}</button> - </div> - </form> - </div> - {% endfor %} - </div> - </div> -{% endblock %} -{% block scripts_page %} - - <script> - $(document).ready(function () { - $("[id^=configPanel-]").ConfigManager({ - menu : $("#configMenu"), - validators : { - {% for schema in schemas %} - "configPanel-{{ schema.filename }}" : {{schema.validators | raw}}, - {% endfor %} - } - }); - }); - </script> - - <!-- Include form widgets JS --> - {{ assets.js('js/ConfigManager') | raw }} - {{ assets.js('js/form-widgets') | raw }} - -{% endblock %} diff --git a/main/app/sprinkles/admin/routes/posts.php b/main/app/sprinkles/admin/routes/posts.php index 2168818..ebc2cda 100644 --- a/main/app/sprinkles/admin/routes/posts.php +++ b/main/app/sprinkles/admin/routes/posts.php @@ -6,10 +6,6 @@ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License) */ -use Slim\Http\Request; -use Slim\Http\Response; -use Slim\Http\UploadedFile; - /** * Routes for posting. */ diff --git a/main/app/sprinkles/admin/src/Controller/PostController.php b/main/app/sprinkles/admin/src/Controller/PostController.php index e191207..a3015f7 100644 --- a/main/app/sprinkles/admin/src/Controller/PostController.php +++ b/main/app/sprinkles/admin/src/Controller/PostController.php @@ -39,7 +39,7 @@ class PostController extends SimpleController $authorizer = $this->ci->authorizer; $currentUser = $this->ci->currentUser; - if (!$authorizer->checkAccess($currentUser, 'uri_dashboard')) { + if (!$authorizer->checkAccess($currentUser, 'post_image')) { throw new ForbiddenException(); } diff --git a/main/app/sprinkles/admin/templates/navigation/sidebar-menu.html.twig b/main/app/sprinkles/admin/templates/navigation/sidebar-menu.html.twig index bde2674..e6d4a7c 100644 --- a/main/app/sprinkles/admin/templates/navigation/sidebar-menu.html.twig +++ b/main/app/sprinkles/admin/templates/navigation/sidebar-menu.html.twig @@ -35,9 +35,4 @@ <a href="{{site.uri.public}}/groups"><i class="fa fa-users fa-fw"></i> <span>{{ translate("GROUP", 2) }}</span></a> </li> {% endif %} - {% if checkAccess('update_site_config') %} - <li> - <a href="{{site.uri.public}}/settings"><i class="fa fa-gears fa-fw"></i> <span>{{ translate("SITE.CONFIG.MANAGER") }}</span></a> - </li> - {% endif %} {% endblock %}
\ No newline at end of file diff --git a/main/app/sprinkles/core/asset-bundles.json b/main/app/sprinkles/core/asset-bundles.json index 68f26fe..8ab6c15 100644 --- a/main/app/sprinkles/core/asset-bundles.json +++ b/main/app/sprinkles/core/asset-bundles.json @@ -50,7 +50,7 @@ "SiteAssets/js/modernizr.js", "SiteAssets/js/linkify.js", "SiteAssets/js/encryption.js", - "SiteAssets/js/slick.js", + "SiteAssets/js/swiper.js", "SiteAssets/js/console.image.js", "SiteAssets/js/main.js" ], @@ -97,7 +97,7 @@ }, "css/main-site": { "styles": [ - "SiteAssets/css/slick.css", + "SiteAssets/css/swiper.css", "SiteAssets/css/main.css" ], "options": { diff --git a/main/app/sprinkles/core/assets/SiteAssets/css/slick.css b/main/app/sprinkles/core/assets/SiteAssets/css/swiper.css index 5910f93..5910f93 100644 --- a/main/app/sprinkles/core/assets/SiteAssets/css/slick.css +++ b/main/app/sprinkles/core/assets/SiteAssets/css/swiper.css diff --git a/main/app/sprinkles/core/assets/SiteAssets/js/slick.js b/main/app/sprinkles/core/assets/SiteAssets/js/swiper.js index 5c668f2..5c668f2 100644 --- a/main/app/sprinkles/core/assets/SiteAssets/js/slick.js +++ b/main/app/sprinkles/core/assets/SiteAssets/js/swiper.js diff --git a/main/build/before_install.sh b/main/build/before_install.sh deleted file mode 100644 index 37d7524..0000000 --- a/main/build/before_install.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# Inspired by ownCloud´s before_install.sh script <3 -# - -WORKDIR=$PWD -DB=$1 - -echo "Work directory: $WORKDIR" -echo "Database: $DB" - -# -# set up mysql -# -if [ "$DB" == "mysql" ] ; then - echo "Setting up mysql ..." - mysql -u root -e "CREATE DATABASE userfrosting;" - mysql -u root -e "GRANT ALL ON userfrosting.* TO 'travis'@'localhost';" - printf "UF_MODE=\"dev\"\nDB_DRIVER=\"mysql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"3306\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"travis\"\nDB_PASSWORD=\"\"\n" > app/.env -fi - -# -# set up pgsql -# -if [ "$DB" == "pgsql" ] ; then - echo "Setting up pgsql ..." - psql -c "CREATE DATABASE userfrosting;" -U postgres - psql -c "GRANT ALL PRIVILEGES ON DATABASE userfrosting TO postgres;" -U postgres - printf "UF_MODE=\"dev\"\nDB_DRIVER=\"pgsql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"5432\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"postgres\"\nDB_PASSWORD=\"\"\n" > app/.env -fi - -# -# set up sqlite -# -if [ "$DB" == "sqlite" ] ; then - echo "Setting up sqlite ..." - touch userfrosting.db - printf "UF_MODE=\"dev\"\nDB_DRIVER=\"sqlite\"\nDB_NAME=\"userfrosting.db\"\n" > app/.env -fi diff --git a/main/webserver-configs/htaccess.txt b/main/webserver-configs/htaccess.txt deleted file mode 100644 index 8abe84a..0000000 --- a/main/webserver-configs/htaccess.txt +++ /dev/null @@ -1,185 +0,0 @@ -# Enable this line to temporarily disable the Apache rewrite cache. -#Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate" - -# Tell PHP that we are using Apache -SetEnv SERVER_TYPE Apache - -<IfModule mod_rewrite.c> - - # Tell PHP that the mod_rewrite module is ENABLED. - SetEnv HTTP_MOD_REWRITE On - - RewriteEngine On - - # Uncomment the next two lines to forward all HTTP to HTTPS - #RewriteCond %{HTTPS} !=on - #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] - - # Forward all www. to non-www. Remove this rule if you want both available. - RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] - RewriteRule ^(.*)$ http://%1/$1 [R=301,L] - - # Remove trailing slash from any non-directory path (canonicalization) - GET requests only - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_METHOD} =GET - RewriteCond %{REQUEST_URI} (.+)/$ - RewriteRule ^ %1 [L,R=301] - - # Dynamically rewrite base directory (see http://stackoverflow.com/questions/31062479/301-redirect-urls-that-are-also-being-rewritten) - RewriteCond $0#%{REQUEST_URI} ^([^#]*)#(.*)\1$ - RewriteRule ^.*$ - [E=BASE:%2] - - # Forward any requested URLs that specifically contain index.php (see http://stackoverflow.com/questions/31062479/301-redirect-urls-that-are-also-being-rewritten) - RewriteCond %{THE_REQUEST} /index\.php [NC] - RewriteRule ^index\.php(?:/(.*))?$ %{ENV:BASE}$1 [L,R=301,NC,NE] - - # Send the URI to index.php (Slim routing) - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [QSA,L] - -</IfModule> - -# Deny access to any php.ini files -<Files php.ini> - Order allow,deny - Deny from all -</Files> - -# Gzip Compression -<IfModule mod_deflate.c> - # Force compression for mangled headers. - # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping - <IfModule mod_setenvif.c> - <IfModule mod_headers.c> - SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding - RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding - </IfModule> - </IfModule> - - # Compress all output labeled with one of the following MIME-types - # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` - # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines - # as `AddOutputFilterByType` is still in the core directives). - - <IfModule mod_filter.c> - AddOutputFilterByType DEFLATE application/atom+xml \ - application/javascript \ - application/json \ - application/rss+xml \ - application/vnd.ms-fontobject \ - application/x-font-ttf \ - application/x-web-app-manifest+json \ - application/xhtml+xml \ - application/xml \ - font/opentype \ - image/svg+xml \ - image/x-icon \ - text/css \ - text/html \ - text/plain \ - text/x-component \ - text/xml - </IfModule> - -</IfModule> - -# ---------------------------------------------------------------------- -# | Expires headers - enable this if you want browsers to cache content | -# ---------------------------------------------------------------------- - -# Serve resources with far-future expires headers. -# -# (!) If you don't control versioning with filename-based -# cache busting, you should consider lowering the cache times -# to something like one week. -# -# https://httpd.apache.org/docs/current/mod/mod_expires.html - -#<IfModule mod_expires.c> -# -# ExpiresActive on -# ExpiresDefault "access plus 1 month" -# -# # CSS -# -# ExpiresByType text/css "access plus 1 hour" -# -# -# # Data interchange -# -# ExpiresByType application/atom+xml "access plus 1 hour" -# ExpiresByType application/rdf+xml "access plus 1 hour" -# ExpiresByType application/rss+xml "access plus 1 hour" -# -# ExpiresByType application/json "access plus 0 seconds" -# ExpiresByType application/ld+json "access plus 0 seconds" -# ExpiresByType application/schema+json "access plus 0 seconds" -# ExpiresByType application/vnd.geo+json "access plus 0 seconds" -# ExpiresByType application/xml "access plus 0 seconds" -# ExpiresByType text/xml "access plus 0 seconds" -# -# -# # Favicon (cannot be renamed!) and cursor images -# -# ExpiresByType image/vnd.microsoft.icon "access plus 1 week" -# ExpiresByType image/x-icon "access plus 1 week" -# -# # HTML -# -# ExpiresByType text/html "access plus 0 seconds" -# -# -# # JavaScript -# -# ExpiresByType application/javascript "access plus 1 hour" -# ExpiresByType application/x-javascript "access plus 1 hour" -# ExpiresByType text/javascript "access plus 1 hour" -# -# -# # Manifest files -# -# ExpiresByType application/manifest+json "access plus 1 week" -# ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" -# ExpiresByType text/cache-manifest "access plus 0 seconds" -# -# -# # Media files -# -# ExpiresByType audio/ogg "access plus 1 month" -# ExpiresByType image/bmp "access plus 1 month" -# ExpiresByType image/gif "access plus 1 month" -# ExpiresByType image/jpeg "access plus 1 month" -# ExpiresByType image/png "access plus 1 month" -# ExpiresByType image/svg+xml "access plus 1 month" -# ExpiresByType image/webp "access plus 1 month" -# ExpiresByType video/mp4 "access plus 1 month" -# ExpiresByType video/ogg "access plus 1 month" -# ExpiresByType video/webm "access plus 1 month" -# -# -# # Web fonts -# -# # Embedded OpenType (EOT) -# ExpiresByType application/vnd.ms-fontobject "access plus 1 month" -# ExpiresByType font/eot "access plus 1 month" -# -# # OpenType -# ExpiresByType font/opentype "access plus 1 month" -# -# # TrueType -# ExpiresByType application/x-font-ttf "access plus 1 month" -# -# # Web Open Font Format (WOFF) 1.0 -# ExpiresByType application/font-woff "access plus 1 month" -# ExpiresByType application/x-font-woff "access plus 1 month" -# ExpiresByType font/woff "access plus 1 month" -# -# # Web Open Font Format (WOFF) 2.0 -# ExpiresByType application/font-woff2 "access plus 1 month" -# -# -# # Other -# -# ExpiresByType text/x-cross-domain-policy "access plus 1 week" -# -#</IfModule> diff --git a/main/webserver-configs/nginx.conf b/main/webserver-configs/nginx.conf deleted file mode 100644 index 354c683..0000000 --- a/main/webserver-configs/nginx.conf +++ /dev/null @@ -1,127 +0,0 @@ -## UserFrosting sample nginx configuration file. -## See https://learn.userfrosting.com/going-live/vps-production-environment/application-setup#configure-the-webserver-nginx- - -## Redirect HTTP to HTTPS -## Enable this block once you've set up SSL. This will redirect all HTTP requests to HTTPS. -#server { -# listen 80; -# server_name example.com; -# return 301 https://$host$request_uri; -#} - -## Main server configuration -server { - ## Non-SSL configuration. Not recommended for production! - listen 80; - ## Defines the script/file to look for when a request is made to the index of your server name. - index index.php index.html index.htm; - - ## Begin - Server Info - ## Document root directory for your project. Should be set to the directory that contains your index.php. - root /usr/share/nginx/project/public; - server_name example.com; - ## End - Server Info - - ## SSL configuration - ## It is STRONGLY RECOMMENDED that you use SSL for all traffic to your UF site. - ## Otherwise, you are potentially leaking your users' sensitive info, including passwords! - ## See https://letsencrypt.org/ to find out how to get a free, trusted SSL cert for your site. - # - #listen 443 ssl http2; - #listen [::]:443 ssl http2; - ## Certificate paths (example for letsencrypt) - #ssl_certificate /etc/letsencrypt/live/<cert name>/fullchain.pem; - #ssl_certificate_key /etc/letsencrypt/live/<cert name>/privkey.pem; - ## Disable SSLv3(enabled by default since nginx 0.8.19) since it's less secure then TLS http://en.wikipedia.org/wiki/Secure_Sockets_Layer#SSL_3.0 - #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ## Enable session resumption to enable low latency for repeat visitors. - #ssl_session_cache shared:SSL:50m; - #ssl_session_timeout 5m; - ## Enables server-side protection from BEAST attacks - #ssl_prefer_server_ciphers on; - ## Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits - #ssl_dhparam /etc/nginx/dhparam.pem; # google will tell you how to make this - ## Ciphers chosen for forward secrecy and compatibility - #ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; - ## Enable ocsp stapling (mechanism by which a site can convey certificate revocation information to visitors in a privacy-preserving, scalable manner) - #resolver 8.8.8.8; - #ssl_stapling on; - #ssl_trusted_certificate /etc/letsencrypt/live/<cert name>/fullchain.pem; # same as your ssl_certificate path - ## Config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security - #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; - ## End - SSL configuration - - access_log /var/log/nginx/access.log; - - add_header X-Frame-Options SAMEORIGIN; - add_header X-Content-Type-Options nosniff; - ## This header enables the Cross-site scripting (XSS) filter built into most recent web browsers. - add_header X-XSS-Protection "1; mode=block"; #optional - - ## Begin - Pagespeed - ## See https://learn.userfrosting.com/going-live/vps-production-environment/additional-recommendations - ## for information on compiling nginx with the Pagespeed module. - #pagespeed on; - #pagespeed FileCachePath /var/ngx_pagespeed_cache; - #pagespeed Disallow "*.svg*"; - ## Add additional filters here - #pagespeed EnableFilters prioritize_critical_css; - ## Ensure requests for pagespeed optimized resources go to the pagespeed - ## handler and no extraneous headers get set. - #location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; } - #location ~ "^/ngx_pagespeed_static/" { } - #location ~ "^/ngx_pagespeed_beacon" { } - ## End - Pagespeed - - ## Begin - Let's Encrypt - ## Allow URLs for certbot acme challenge - location ~ /.well-known { - allow all; - } - ## End - Let's Encrypt - - ## Begin - Handle PHP requests - location ~ \.(php)$ { - # Throw away any requests to execute PHP scripts in other directories - # See http://cnedelcu.blogspot.com/2010/05/nginx-php-via-fastcgi-important.html for why this is needed - location ~ \..*/.*\.php$ { - return 404; - } - # regex to split $uri to $fastcgi_script_name and $fastcgi_path - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_keep_conn on; - # For FPM (PHP 7) - fastcgi_pass unix:/run/php/php7.0-fpm.sock; - # For FPM (PHP 5.x) - #fastcgi_pass unix:/var/run/php5-fpm.sock; - # For traditional PHP FastCGI (php5-cgi or php7.0-cgi) - #fastcgi_pass 127.0.0.1:9000; - # For HHVM - #fastcgi_pass unix:/var/run/hhvm/hhvm.sock; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } - ## End - Handle PHP requests - - ## Begin - Caching static files - location ~* \.(png|gif|jpg|jpeg|svg|ico|css|js|woff|ttf|otf|woff2|eot)$ { - include /etc/nginx/mime.types; - expires max; - - index index.php; - try_files $uri $uri/ /index.php?$query_string; - } - ## End - Caching static files - - ## Begin - Index - ## for subfolders, simply adjust: - ## `location /subfolder {` - ## and the rewrite to use `/subfolder/index.php` - location / { - include /etc/nginx/mime.types; - index index.php; - try_files $uri $uri/ /index.php?$query_string; - } - ## End - Index -} diff --git a/main/webserver-configs/web.config b/main/webserver-configs/web.config deleted file mode 100644 index 96b3a00..0000000 --- a/main/webserver-configs/web.config +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Unlike apache and *ngix, IIS will likely require additional configuration that cannot be safely defined, or defined at all in a web.config file. - If odd behaviour occurs: - 1. Ensure web.config settings are being applied, as IIS can be configured to ignore specific web.config settings. - 2. If there is an IIS error page, try the suggested solutions. - 3. See if anyone on the web has encountered the same issue, and try the suggested solutions. - 4. And as a last resort, ask in the UserFrosting chat support channel. http://chat.userfrosting.com --> -<configuration> - <system.webServer> - <!-- Most default installs of PHP in IIS only accept GET and POST HTTP verbs. - If using the account functionality of UserFrosting, additional HTTP verbs will need to be added to the PHP handler. - Specifically, PUT and DELETE are required. - Sample PHP handler definition follows. - <handlers> - <add name="PHP_via_FastCGI" path="*.php" verb="GET,POST,PUT,DELETE" modules="FastCgiModule" scriptProcessor="path/to/php/directory/php-cgi.exe" resourceType="Either" /> - </handlers>--> - <rewrite> - <!-- Rules to clean url, and ensure requests are handled by PHP when appropriate. --> - <rules> - <!-- Clear any inherited rules --> - <clear /> - <!-- Dynamically rewrite base directory to remove index.php from url. --> - <rule name="Remove .../index.php/... from url"> - <match url="^index\.php/(.*)$" /> - <action type="Redirect" redirectType="Permanent" url="{R:1}" /> - </rule> - <!-- Remove trailing slash from any non-directory path (canonicalization) - GET requests only. --> - <rule name="Remove trailing slash"> - <match url="(.*)/$" /> - <conditions> - <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> - </conditions> - <action type="Redirect" redirectType="Permanent" url="{R:1}" /> - </rule> - <!-- Send the URI to index.php (Slim routing) if url maps to neither a directory, or file. --> - <rule name="Rewrite to index.php" stopProcessing="true"> - <match url=".*" /> - <conditions> - <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> - <add input="{REQUEST_FILEDIR}" matchType="IsDirectory" negate="true" /> - </conditions> - <action type="Rewrite" url="index.php" /> - </rule> - </rules> - </rewrite> - <!-- Set index.php as default document, and clear inherited defaults. --> - <defaultDocument enabled="true"> - <files> - <clear /> - <add value="index.php" /> - </files> - </defaultDocument> - <!-- Whitelist specific static file types --> - <staticContent> - <!-- Clear inherited rules --> - <clear /> - <!-- Set content expiration time (31 days for every static file listed) --> - <!--<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="31.00:00:00" />--> - <!-- Atom feeds --> - <mimeMap fileExtension=".atom" mimeType="application/atom+xml" /> - <mimeMap fileExtension=".xml" mimeType="application/atom+xml, application/rss+xml, application/xhtml+xml, application/xml, text/xml" /> - <!-- JS --> - <mimeMap fileExtension=".js" mimeType="application/js" /> - <!-- JSON --> - <mimeMap fileExtension=".json" mimeType="application/json" /> - <!-- EOT font --> - <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> - <!-- TTF fonts --> - <mimeMap fileExtension=".ttf" mimeType="application/x-font-ttf" /> - <!-- Web App Manifest --> - <mimeMap fileExtension=".webapp" mimeType="application/x-web-app-manifest+json" /> - <!-- XHTML --> - <mimeMap fileExtension=".xhtml" mimeType="application/xhtml+xml" /> - <mimeMap fileExtension=".xht" mimeType="application/xhtml+xml" /> - <mimeMap fileExtension=".html" mimeType="application/xhtml+xml" /> - <mimeMap fileExtension=".htm" mimeType="application/xhtml+xml" /> - <!-- Images --> - <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> - <mimeMap fileExtension=".png" mimeType="image/png" /> - <mimeMap fileExtension=".ico" mimeType="image/x-icon" /> - <!-- WOFF/2 fonts --> - <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> - <mimeMap fileExtension=".woff2" mimeType="font/woff2" /> - <!-- CSS --> - <mimeMap fileExtension=".css" mimeType="text/css" /> - <!-- Plain text --> - <mimeMap fileExtension=".txt" mimeType="text/plain" /> - <!-- HTML Component --> - <mimeMap fileExtension=".htc" mimeType="text/x-component" /> - </staticContent> - </system.webServer> -</configuration>
\ No newline at end of file |