From 0e78dce54d5fcb69d6919674f1d5b6d090d52291 Mon Sep 17 00:00:00 2001 From: Mathieu Aubin Date: Tue, 5 Jul 2016 01:06:34 -0400 Subject: [PATCH 01/14] Apache Security Fix Denies access to all dotfiles on Apache webserver. --- public/.htaccess | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/.htaccess b/public/.htaccess index 04e08bafe..e2ed529bd 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -13,3 +13,10 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] + +# Restrict access to DotFiles (like .htaccess, .env, .gitignore....) +# Do not remove if you are running Apache web server. + + Order allow,deny + Deny from all + From f9afc49708b29a939be7d8d0f588adefd4eeb3db Mon Sep 17 00:00:00 2001 From: Mathieu Aubin Date: Tue, 5 Jul 2016 01:07:29 -0400 Subject: [PATCH 02/14] Apache Security Fix Denies access to dotfiles on Apache webserver --- .htaccess | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 000000000..bf7ee9cf9 --- /dev/null +++ b/.htaccess @@ -0,0 +1,6 @@ +# Restrict access to DotFiles (like .htaccess, .env, .gitignore....) +# Do not remove if you are running Apache web server. + + Order allow,deny + Deny from all + From 0966db385ca62b53fd90cace89edfa3afa26654c Mon Sep 17 00:00:00 2001 From: Sujit Prasad Date: Tue, 5 Jul 2016 02:35:52 -0400 Subject: [PATCH 03/14] Applied fixes from StyleCI --- app/Http/Controllers/Api/v1/InstallerApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/v1/InstallerApiController.php b/app/Http/Controllers/Api/v1/InstallerApiController.php index 60855d60b..a4d82c4b2 100644 --- a/app/Http/Controllers/Api/v1/InstallerApiController.php +++ b/app/Http/Controllers/Api/v1/InstallerApiController.php @@ -98,7 +98,7 @@ class InstallerApiController extends Controller $ENV['QUEUE_DRIVER'] = 'sync'; $config = ''; - + foreach ($ENV as $key => $val) { $config .= "{$key}={$val}\n"; } From ea4b2e9ce9b674dd0efa995e2598fe1ba28e37da Mon Sep 17 00:00:00 2001 From: Mathieu Aubin Date: Thu, 7 Jul 2016 02:01:28 -0400 Subject: [PATCH 04/14] Proper plugins/filebrowser/plugin.js File had been badly copy/pasted resulting in bad javascript... Following shows a bit of the problem... Also updated source to 2016 as per -- https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/filebrowser/plugin.js --- public/lb-faveo/plugins/filebrowser/plugin.js | 1100 +++++++++-------- 1 file changed, 570 insertions(+), 530 deletions(-) diff --git a/public/lb-faveo/plugins/filebrowser/plugin.js b/public/lb-faveo/plugins/filebrowser/plugin.js index a0d13d5de..1d342880d 100644 --- a/public/lb-faveo/plugins/filebrowser/plugin.js +++ b/public/lb-faveo/plugins/filebrowser/plugin.js @@ -1,533 +1,573 @@ - /* - Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. - For licensing, see LICENSE.html or http://ckeditor.com/license +/** + * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license */ - - /** - * @fileOverview The "filebrowser" plugin that adds support for file uploads and - * browsing. - * - * When a file is uploaded or selected inside the file browser, its URL is - * inserted automatically into a field defined in the filebrowser - * attribute. In order to specify a field that should be updated, pass the tab ID and - * the element ID, separated with a colon.

- * - * Example 1: (Browse) - * - *
-  * {
-  * 	type : 'button',
-  * 	id : 'browse',
-  * 	filebrowser : 'tabId:elementId',
-  * 	label : editor.lang.common.browseServer
-  * }
-  * 
- * - * If you set the filebrowser attribute for an element other than - * the fileButton, the Browse action will be triggered.

- * - * Example 2: (Quick Upload) - * - *
-  * {
-  * 	type : 'fileButton',
-  * 	id : 'uploadButton',
-   * 	filebrowser : 'tabId:elementId',
-   * 	label : editor.lang.common.uploadSubmit,
-   * 	'for' : [ 'upload', 'upload' ]
-   * }
-   * 
- * - * If you set the filebrowser attribute for a fileButton - * element, the QuickUpload action will be executed.

- * - * The filebrowser plugin also supports more advanced configuration performed through - * a JavaScript object. - * - * The following settings are supported: - * - *
    - *
  • actionBrowse or QuickUpload.
  • - *
  • target – the field to update in the tabId:elementId format.
  • - *
  • params – additional arguments to be passed to the server connector (optional).
  • - *
  • onSelect – a function to execute when the file is selected/uploaded (optional).
  • - *
  • url – the URL to be called (optional).
  • - *
- * - * Example 3: (Quick Upload) - * - *
-   * {
-   * 	type : 'fileButton',
-   * 	label : editor.lang.common.uploadSubmit,
-   * 	id : 'buttonId',
- 64  * 	filebrowser :
- 65  * 	{
- 66  * 		action : 'QuickUpload', // required
- 67  * 		target : 'tab1:elementId', // required
- 68  * 		params : // optional
- 69  * 		{
- 70  * 			type : 'Files',
- 71  * 			currentFolder : '/folder/'
- 72  * 		},
- 73  * 		onSelect : function( fileUrl, errorMessage ) // optional
- 74  * 		{
- 75  * 			// Do not call the built-in selectFuntion.
- 76  * 			// return false;
- 77  * 		}
- 78  * 	},
- 79  * 	'for' : [ 'tab1', 'myFile' ]
- 80  * }
- 81  * 
- 82 * - 83 * Suppose you have a file element with an ID of myFile, a text - 84 * field with an ID of elementId and a fileButton. - 85 * If the filebowser.url attribute is not specified explicitly, - 86 * the form action will be set to filebrowser[DialogWindowName]UploadUrl - 87 * or, if not specified, to filebrowserUploadUrl. Additional parameters - 88 * from the params object will be added to the query string. It is - 89 * possible to create your own uploadHandler and cancel the built-in - 90 * updateTargetElement command.

- 91 * - 92 * Example 4: (Browse) - 93 * - 94 *
- 95  * {
- 96  * 	type : 'button',
- 97  * 	id : 'buttonId',
- 98  * 	label : editor.lang.common.browseServer,
- 99  * 	filebrowser :
-100  * 	{
-101  * 		action : 'Browse',
-102  * 		url : '/ckfinder/ckfinder.html&type=Images',
-103  * 		target : 'tab1:elementId'
-104  * 	}
-105  * }
-106  * 
-107 * -108 * In this example, when the button is pressed, the file browser will be opened in a -109 * popup window. If you do not specify the filebrowser.url attribute, -110 * filebrowser[DialogName]BrowseUrl or -111 * filebrowserBrowseUrl will be used. After selecting a file in the file -112 * browser, an element with an ID of elementId will be updated. Just -113 * like in the third example, a custom onSelect function may be defined. -114 */ - ( function() - { - /* -118 * Adds (additional) arguments to given url. -119 * -120 * @param {String} -121 * url The url. -122 * @param {Object} -123 * params Additional parameters. -124 */ - function addQueryString( url, params ) - { - var queryString = []; - - if ( !params ) - return url; - else - { - for ( var i in params ) - queryString.push( i + "=" + encodeURIComponent( params[ i ] ) ); - } - - return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" ); - } - - /* -141 * Make a string's first character uppercase. -142 * -143 * @param {String} -144 * str String. -145 */ - function ucFirst( str ) - { - str += ''; - var f = str.charAt( 0 ).toUpperCase(); - return f + str.substr( 1 ); - } - - /* -154 * The onlick function assigned to the 'Browse Server' button. Opens the -155 * file browser and updates target field when file is selected. -156 * -157 * @param {CKEDITOR.event} -158 * evt The event object. -159 */ - function browseServer( evt ) - { - var dialog = this.getDialog(); - var editor = dialog.getParentEditor(); - - editor._.filebrowserSe = this; - - var width = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowWidth' ] - || editor.config.filebrowserWindowWidth || '80%'; - var height = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowHeight' ] - || editor.config.filebrowserWindowHeight || '70%'; - - var params = this.filebrowser.params || {}; - params.CKEditor = editor.name; - params.CKEditorFuncNum = editor._.filebrowserFn; - if ( !params.langCode ) - params.langCode = editor.langCode; - + +/** + * @fileOverview The "filebrowser" plugin that adds support for file uploads and + * browsing. + * + * When a file is uploaded or selected inside the file browser, its URL is + * inserted automatically into a field defined in the filebrowser + * attribute. In order to specify a field that should be updated, pass the tab ID and + * the element ID, separated with a colon.

+ * + * Example 1: (Browse) + * + *
+ * {
+ * 	type : 'button',
+ * 	id : 'browse',
+ * 	filebrowser : 'tabId:elementId',
+ * 	label : editor.lang.common.browseServer
+ * }
+ * 
+ * + * If you set the filebrowser attribute for an element other than + * the fileButton, the Browse action will be triggered.

+ * + * Example 2: (Quick Upload) + * + *
+ * {
+ * 	type : 'fileButton',
+ * 	id : 'uploadButton',
+ * 	filebrowser : 'tabId:elementId',
+ * 	label : editor.lang.common.uploadSubmit,
+ * 	'for' : [ 'upload', 'upload' ]
+ * }
+ * 
+ * + * If you set the filebrowser attribute for a fileButton + * element, the QuickUpload action will be executed.

+ * + * The filebrowser plugin also supports more advanced configuration performed through + * a JavaScript object. + * + * The following settings are supported: + * + *
    + *
  • actionBrowse or QuickUpload.
  • + *
  • target – the field to update in the tabId:elementId format.
  • + *
  • params – additional arguments to be passed to the server connector (optional).
  • + *
  • onSelect – a function to execute when the file is selected/uploaded (optional).
  • + *
  • url – the URL to be called (optional).
  • + *
+ * + * Example 3: (Quick Upload) + * + *
+ * {
+ * 	type : 'fileButton',
+ * 	label : editor.lang.common.uploadSubmit,
+ * 	id : 'buttonId',
+ * 	filebrowser :
+ * 	{
+ * 		action : 'QuickUpload', // required
+ * 		target : 'tab1:elementId', // required
+ * 		params : // optional
+ * 		{
+ * 			type : 'Files',
+ * 			currentFolder : '/folder/'
+ * 		},
+ * 		onSelect : function( fileUrl, errorMessage ) // optional
+ * 		{
+ * 			// Do not call the built-in selectFuntion.
+ * 			// return false;
+ * 		}
+ * 	},
+ * 	'for' : [ 'tab1', 'myFile' ]
+ * }
+ * 
+ * + * Suppose you have a file element with an ID of myFile, a text + * field with an ID of elementId and a fileButton. + * If the filebowser.url attribute is not specified explicitly, + * the form action will be set to filebrowser[DialogWindowName]UploadUrl + * or, if not specified, to filebrowserUploadUrl. Additional parameters + * from the params object will be added to the query string. It is + * possible to create your own uploadHandler and cancel the built-in + * updateTargetElement command.

+ * + * Example 4: (Browse) + * + *
+ * {
+ * 	type : 'button',
+ * 	id : 'buttonId',
+ * 	label : editor.lang.common.browseServer,
+ * 	filebrowser :
+ * 	{
+ * 		action : 'Browse',
+ * 		url : '/ckfinder/ckfinder.html&type=Images',
+ * 		target : 'tab1:elementId'
+ * 	}
+ * }
+ * 
+ * + * In this example, when the button is pressed, the file browser will be opened in a + * popup window. If you do not specify the filebrowser.url attribute, + * filebrowser[DialogName]BrowseUrl or + * filebrowserBrowseUrl will be used. After selecting a file in the file + * browser, an element with an ID of elementId will be updated. Just + * like in the third example, a custom onSelect function may be defined. + */ + +( function() { + // Default input element name for CSRF protection token. + var TOKEN_INPUT_NAME = 'ckCsrfToken'; + + // Adds (additional) arguments to given url. + // + // @param {String} + // url The url. + // @param {Object} + // params Additional parameters. + function addQueryString( url, params ) { + var queryString = []; + + if ( !params ) + return url; + else { + for ( var i in params ) + queryString.push( i + '=' + encodeURIComponent( params[ i ] ) ); + } + + return url + ( ( url.indexOf( '?' ) != -1 ) ? '&' : '?' ) + queryString.join( '&' ); + } + + // Make a string's first character uppercase. + // + // @param {String} + // str String. + function ucFirst( str ) { + str += ''; + var f = str.charAt( 0 ).toUpperCase(); + return f + str.substr( 1 ); + } + + // The onlick function assigned to the 'Browse Server' button. Opens the + // file browser and updates target field when file is selected. + // + // @param {CKEDITOR.event} + // evt The event object. + function browseServer() { + var dialog = this.getDialog(); + var editor = dialog.getParentEditor(); + + editor._.filebrowserSe = this; + + var width = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowWidth' ] || editor.config.filebrowserWindowWidth || '80%'; + var height = editor.config[ 'filebrowser' + ucFirst( dialog.getName() ) + 'WindowHeight' ] || editor.config.filebrowserWindowHeight || '70%'; + + var params = this.filebrowser.params || {}; + params.CKEditor = editor.name; + params.CKEditorFuncNum = editor._.filebrowserFn; + if ( !params.langCode ) + params.langCode = editor.langCode; + var url = addQueryString( this.filebrowser.url, params ); // TODO: V4: Remove backward compatibility (#8163). - editor.popup( url, width, height, editor.config.filebrowserWindowFeatures || editor.config.fileBrowserWindowFeatures ); - } - - /* -184 * The onlick function assigned to the 'Upload' button. Makes the final -185 * decision whether form is really submitted and updates target field when -186 * file is uploaded. -187 * -188 * @param {CKEDITOR.event} -189 * evt The event object. -190 */ - function uploadFile( evt ) - { - var dialog = this.getDialog(); - var editor = dialog.getParentEditor(); - - editor._.filebrowserSe = this; - - // If user didn't select the file, stop the upload. - if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getInputElement().$.value ) - return false; - - if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getAction() ) - return false; - - return true; - } - - /* -209 * Setups the file element. -210 * -211 * @param {CKEDITOR.ui.dialog.file} -212 * fileInput The file element used during file upload. -213 * @param {Object} -214 * filebrowser Object containing filebrowser settings assigned to -215 * the fileButton associated with this file element. -216 */ - function setupFileElement( editor, fileInput, filebrowser ) - { - var params = filebrowser.params || {}; - params.CKEditor = editor.name; - params.CKEditorFuncNum = editor._.filebrowserFn; - if ( !params.langCode ) - params.langCode = editor.langCode; - - fileInput.action = addQueryString( filebrowser.url, params ); - fileInput.filebrowser = filebrowser; - } - - /* -230 * Traverse through the content definition and attach filebrowser to -231 * elements with 'filebrowser' attribute. -232 * -233 * @param String -234 * dialogName Dialog name. -235 * @param {CKEDITOR.dialog.definitionObject} -236 * definition Dialog definition. -237 * @param {Array} -238 * elements Array of {@link CKEDITOR.dialog.definition.content} -239 * objects. -240 */ - function attachFileBrowser( editor, dialogName, definition, elements ) - { - var element, fileInput; - - for ( var i in elements ) - { - element = elements[ i ]; - - if ( element.type == 'hbox' || element.type == 'vbox' || element.type == 'fieldset' ) - attachFileBrowser( editor, dialogName, definition, element.children ); - - if ( !element.filebrowser ) - continue; - - if ( typeof element.filebrowser == 'string' ) - { - var fb = - { - action : ( element.type == 'fileButton' ) ? 'QuickUpload' : 'Browse', - target : element.filebrowser - }; - element.filebrowser = fb; - } - - if ( element.filebrowser.action == 'Browse' ) - { - var url = element.filebrowser.url; - if ( url === undefined ) - { - url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'BrowseUrl' ]; - if ( url === undefined ) - url = editor.config.filebrowserBrowseUrl; - } - - if ( url ) - { - element.onClick = browseServer; - element.filebrowser.url = url; - element.hidden = false; - } - } - else if ( element.filebrowser.action == 'QuickUpload' && element[ 'for' ] ) - { - url = element.filebrowser.url; - if ( url === undefined ) - { - url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'UploadUrl' ]; - if ( url === undefined ) - url = editor.config.filebrowserUploadUrl; - } - - if ( url ) - { - var onClick = element.onClick; - element.onClick = function( evt ) - { - // "element" here means the definition object, so we need to find the correct - // button to scope the event call - var sender = evt.sender; - if ( onClick && onClick.call( sender, evt ) === false ) - return false; - - return uploadFile.call( sender, evt ); - }; - - element.filebrowser.url = url; - element.hidden = false; - setupFileElement( editor, definition.getContents( element[ 'for' ][ 0 ] ).get( element[ 'for' ][ 1 ] ), element.filebrowser ); - } - } - } - } - - /* -315 * Updates the target element with the url of uploaded/selected file. -316 * -317 * @param {String} -318 * url The url of a file. -319 */ - function updateTargetElement( url, sourceElement ) - { - var dialog = sourceElement.getDialog(); - var targetElement = sourceElement.filebrowser.target || null; - - // If there is a reference to targetElement, update it. - if ( targetElement ) - { - var target = targetElement.split( ':' ); - var element = dialog.getContentElement( target[ 0 ], target[ 1 ] ); - if ( element ) - { - element.setValue( url ); - dialog.selectPage( target[ 0 ] ); - } - } - } - - /* -339 * Returns true if filebrowser is configured in one of the elements. -340 * -341 * @param {CKEDITOR.dialog.definitionObject} -342 * definition Dialog definition. -343 * @param Stri344 * tabId The tab id where element(s) can be found. -345 * @param String -346 * elementId The element id (or ids, separated with a semicolon) to check. -347 */ - function isConfigured( definition, tabId, elementId ) - { - if ( elementId.indexOf( ";" ) !== -1 ) - { - var ids = elementId.split( ";" ); - for ( var i = 0 ; i < ids.length ; i++ ) - { - if ( isConfigured( definition, tabId, ids[i] ) ) - return true; - } - return false; - } - - var elementFileBrowser = definition.getContents( tabId ).get( elementId ).filebrowser; - return ( elementFileBrowser && elementFileBrowser.url ); - } - - function setUrl( fileUrl, data ) - { - var dialog = this._.filebrowserSe.getDialog(), - targetInput = this._.filebrowserSe[ 'for' ], - onSelect = this._.filebrowserSe.filebrowser.onSelect; - - if ( targetInput ) - dialog.getContentElement( targetInput[ 0 ], targetInput[ 1 ] ).reset(); - - if ( typeof data == 'function' && data.call( this._.filebrowserSe ) === false ) - return; - - if ( onSelect && onSelect.call( this._.filebrowserSe, fileUrl, data ) === false ) - return; - - // The "data" argument may be used to pass the error message to the editor. - if ( typeof data == 'string' && data ) - alert( data ); - - if ( fileUrl ) - updateTargetElement( fileUrl, this._.filebrowserSe ); - } - - CKEDITOR.plugins.add( 'filebrowser', - { - init : function( editor, pluginPath ) - { - editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUrl, editor ); - editor.on( 'destroy', function () { CKEDITOR.tools.removeFunction( this._.filebrowserFn ); } ); - } - } ); - - CKEDITOR.on( 'dialogDefinition', function( evt ) - { - var definition = evt.data.definition, - element; - // Associate filebrowser to elements with 'filebrowser' attribute. - for ( var i in definition.contents ) - { - if ( ( element = definition.contents[ i ] ) ) - { - attachFileBrowser( evt.editor, evt.data.name, definition, element.elements ); - if ( element.hidden && element.filebrowser ) - { - element.hidden = !isConfigured( definition, element[ 'id' ], element.filebrowser ); - } - } - } - } ); - - } )(); - - /** -418 * The location of an external file browser that should be launched when the Browse Server -419 * button is pressed. If configured, the Browse Server button will appear in the -420 * Link, Image, and Flash dialog windows. -421 * @see The File Browser/Uploader documentation. -422 * @name CKEDITOR.config.filebrowserBrowseUrl -423 * @since 3.0 -424 * @type String -425 * @default '' (empty string = disabled) -426 * @example -427 * config.filebrowserBrowseUrl = '/browser/browse.php'; -428 */ - - /** -431 * The location of the script that handles file uploads. -432 * If set, the Upload tab will appear in the Link, Image, -433 * and Flash dialog windows. -434 * @name CKEDITOR.config.filebrowserUploadUrl -435 * @see The File Browser/Uploader documentation. -436 * @since 3.0 -437 * @type String -438 * @default '' (empty string = disabled) -439 * @example -440 * config.filebrowserUploadUrl = '/uploader/upload.php'; -441 */ - - /** -444 * The location of an external file browser that should be launched when the Browse Server -445 * button is pressed in the Image dialog window. -446 * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserBrowseUrl}. -447 * @name CKEDITOR.config.filebrowserImageBrowseUrl -448 * @since 3.0 -449 * @type String -450 * @default '' (empty string = disabled) -451 * @example -452 * config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images'; -453 */ - - /** -456 * The location of an external file browser that should be launched when the Browse Server -457 * button is pressed in the Flash dialog window. -458 * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserBrowseUrl}. -459 * @name CKEDITOR.config.filebrowserFlashBrowseUrl -460 * @since 3.0 -461 * @type String -462 * @default '' (empty string = disabled) -463 * @example -464 * config.filebrowserFlashBrowseUrl = '/browser/browse.php?type=Flash'; -465 */ - - /** -468 * The location of the script that handles file uploads in the Image dialog window. -469 * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserUploadUrl}. -470 * @name CKEDITOR.config.filebrowserImageUploadUrl -471 * @since 3.0 -472 * @type String -473 * @default '' (empty string = disabled) -474 * @example -475 * config.filebrowserImageUploadUrl = '/uploader/upload.php?type=Images'; -476 */ - - /** -479 * The location of the script that handles file uploads in the Flash dialog window. -480 * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserUploadUrl}. -481 * @name CKEDITOR.config.filebrowserFlashUploadUrl -482 * @since 3.0 -483 * @type String -484 * @default '' (empty string = disabled) -485 * @example -486 * config.filebrowserFlashUploadUrl = '/uploader/upload.php?type=Flash'; -487 */ - - /** -490 * The location of an external file browser that should be launched when the Browse Server -491 * button is pressed in the Link tab of the Image dialog window. -492 * If not set, CKEditor will use {@link CKEDITOR.config.filebrowserBrowseUrl}. -493 * @name CKEDITOR.config.filebrowserImageBrowseLinkUrl -494 * @since 3.2 -495 * @type String -496 * @default '' (empty string = disabled) -497 * @example -498 * config.filebrowserImageBrowseLinkUrl = '/browser/browse.php'; -499 */ - - /** -502 * The features to use in the file browser popup window. -503 * @name CKEDITOR.config.filebrowserWindowFeatures -504 * @since 3.4.1 -505 * @type String -506 * @default 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes' -507 * @example -508 * config.filebrowserWindowFeatures = 'resizable=yes,scrollbars=no'; -509 */ - - /** -512 * The width of the file browser popup window. It can be a number denoting a value in -513 * pixels or a percent string. -514 * @name CKEDITOR.config.filebrowserWindowWidth -515 * @type Number|String -516 * @default '80%' -517 * @example -518 * config.filebrowserWindowWidth = 750; -519 * @example -520 * config.filebrowserWindowWidth = '50%'; -521 */ - - /** -524 * The height of the file browser popup window. It can be a number denoting a value in -525 * pixels or a percent string. -526 * @name CKEDITOR.config.filebrowserWindowHeight -527 * @type Number|String -528 * @default '70%' -529 * @example -530 * config.filebrowserWindowHeight = 580; -531 * @example -532 * config.filebrowserWindowHeight = '50%'; -533 */ - \ No newline at end of file + editor.popup( url, width, height, editor.config.filebrowserWindowFeatures || editor.config.fileBrowserWindowFeatures ); + } + + // Appends token preventing CSRF attacks to the form of provided file input. + // + // @since 4.5.6 + // @param {CKEDITOR.dom.element} fileInput + function appendToken( fileInput ) { + var tokenElement; + var form = new CKEDITOR.dom.element( fileInput.$.form ); + + if ( form ) { + // Check if token input element already exists. + tokenElement = form.$.elements[ TOKEN_INPUT_NAME ]; + + // Create new if needed. + if ( !tokenElement ) { + tokenElement = new CKEDITOR.dom.element( 'input' ); + tokenElement.setAttributes( { + name: TOKEN_INPUT_NAME, + type: 'hidden' + } ); + + form.append( tokenElement ); + } else { + tokenElement = new CKEDITOR.dom.element( tokenElement ); + } + + tokenElement.setAttribute( 'value', CKEDITOR.tools.getCsrfToken() ); + } + } + + // The onlick function assigned to the 'Upload' button. Makes the final + // decision whether form is really submitted and updates target field when + // file is uploaded. + // + // @param {CKEDITOR.event} + // evt The event object. + function uploadFile() { + var dialog = this.getDialog(); + var editor = dialog.getParentEditor(); + + editor._.filebrowserSe = this; + + // If user didn't select the file, stop the upload. + if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getInputElement().$.value ) + return false; + + if ( !dialog.getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getAction() ) + return false; + + return true; + } + + // Setups the file element. + // + // @param {CKEDITOR.ui.dialog.file} + // fileInput The file element used during file upload. + // @param {Object} + // filebrowser Object containing filebrowser settings assigned to + // the fileButton associated with this file element. + function setupFileElement( editor, fileInput, filebrowser ) { + var params = filebrowser.params || {}; + params.CKEditor = editor.name; + params.CKEditorFuncNum = editor._.filebrowserFn; + if ( !params.langCode ) + params.langCode = editor.langCode; + + fileInput.action = addQueryString( filebrowser.url, params ); + fileInput.filebrowser = filebrowser; + } + + // Traverse through the content definition and attach filebrowser to + // elements with 'filebrowser' attribute. + // + // @param String + // dialogName Dialog name. + // @param {CKEDITOR.dialog.definitionObject} + // definition Dialog definition. + // @param {Array} + // elements Array of {@link CKEDITOR.dialog.definition.content} + // objects. + function attachFileBrowser( editor, dialogName, definition, elements ) { + if ( !elements || !elements.length ) + return; + + var element; + + for ( var i = elements.length; i--; ) { + element = elements[ i ]; + + if ( element.type == 'hbox' || element.type == 'vbox' || element.type == 'fieldset' ) + attachFileBrowser( editor, dialogName, definition, element.children ); + + if ( !element.filebrowser ) + continue; + + if ( typeof element.filebrowser == 'string' ) { + var fb = { + action: ( element.type == 'fileButton' ) ? 'QuickUpload' : 'Browse', + target: element.filebrowser + }; + element.filebrowser = fb; + } + + if ( element.filebrowser.action == 'Browse' ) { + var url = element.filebrowser.url; + if ( url === undefined ) { + url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'BrowseUrl' ]; + if ( url === undefined ) + url = editor.config.filebrowserBrowseUrl; + } + + if ( url ) { + element.onClick = browseServer; + element.filebrowser.url = url; + element.hidden = false; + } + } else if ( element.filebrowser.action == 'QuickUpload' && element[ 'for' ] ) { + url = element.filebrowser.url; + if ( url === undefined ) { + url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'UploadUrl' ]; + if ( url === undefined ) + url = editor.config.filebrowserUploadUrl; + } + + if ( url ) { + var onClick = element.onClick; + element.onClick = function( evt ) { + // "element" here means the definition object, so we need to find the correct + // button to scope the event call + var sender = evt.sender; + if ( onClick && onClick.call( sender, evt ) === false ) + return false; + + if ( uploadFile.call( sender, evt ) ) { + var fileInput = sender.getDialog().getContentElement( this[ 'for' ][ 0 ], this[ 'for' ][ 1 ] ).getInputElement(); + + // Append token preventing CSRF attacks. + appendToken( fileInput ); + return true; + } + + + return false; + }; + + element.filebrowser.url = url; + element.hidden = false; + setupFileElement( editor, definition.getContents( element[ 'for' ][ 0 ] ).get( element[ 'for' ][ 1 ] ), element.filebrowser ); + } + } + } + } + + // Updates the target element with the url of uploaded/selected file. + // + // @param {String} + // url The url of a file. + function updateTargetElement( url, sourceElement ) { + var dialog = sourceElement.getDialog(); + var targetElement = sourceElement.filebrowser.target || null; + + // If there is a reference to targetElement, update it. + if ( targetElement ) { + var target = targetElement.split( ':' ); + var element = dialog.getContentElement( target[ 0 ], target[ 1 ] ); + if ( element ) { + element.setValue( url ); + dialog.selectPage( target[ 0 ] ); + } + } + } + + // Returns true if filebrowser is configured in one of the elements. + // + // @param {CKEDITOR.dialog.definitionObject} + // definition Dialog definition. + // @param String + // tabId The tab id where element(s) can be found. + // @param String + // elementId The element id (or ids, separated with a semicolon) to check. + function isConfigured( definition, tabId, elementId ) { + if ( elementId.indexOf( ';' ) !== -1 ) { + var ids = elementId.split( ';' ); + for ( var i = 0; i < ids.length; i++ ) { + if ( isConfigured( definition, tabId, ids[ i ] ) ) + return true; + } + return false; + } + + var elementFileBrowser = definition.getContents( tabId ).get( elementId ).filebrowser; + return ( elementFileBrowser && elementFileBrowser.url ); + } + + function setUrl( fileUrl, data ) { + var dialog = this._.filebrowserSe.getDialog(), + targetInput = this._.filebrowserSe[ 'for' ], + onSelect = this._.filebrowserSe.filebrowser.onSelect; + + if ( targetInput ) + dialog.getContentElement( targetInput[ 0 ], targetInput[ 1 ] ).reset(); + + if ( typeof data == 'function' && data.call( this._.filebrowserSe ) === false ) + return; + + if ( onSelect && onSelect.call( this._.filebrowserSe, fileUrl, data ) === false ) + return; + + // The "data" argument may be used to pass the error message to the editor. + if ( typeof data == 'string' && data ) + alert( data ); // jshint ignore:line + + if ( fileUrl ) + updateTargetElement( fileUrl, this._.filebrowserSe ); + } + + CKEDITOR.plugins.add( 'filebrowser', { + requires: 'popup', + init: function( editor ) { + editor._.filebrowserFn = CKEDITOR.tools.addFunction( setUrl, editor ); + editor.on( 'destroy', function() { + CKEDITOR.tools.removeFunction( this._.filebrowserFn ); + } ); + } + } ); + + CKEDITOR.on( 'dialogDefinition', function( evt ) { + // We require filebrowser plugin to be loaded. + if ( !evt.editor.plugins.filebrowser ) + return; + + var definition = evt.data.definition, + element; + // Associate filebrowser to elements with 'filebrowser' attribute. + for ( var i = 0; i < definition.contents.length; ++i ) { + if ( ( element = definition.contents[ i ] ) ) { + attachFileBrowser( evt.editor, evt.data.name, definition, element.elements ); + if ( element.hidden && element.filebrowser ) + element.hidden = !isConfigured( definition, element.id, element.filebrowser ); + + } + } + } ); + +} )(); + +/** + * The location of an external file manager that should be launched when the **Browse Server** + * button is pressed. If configured, the **Browse Server** button will appear in the + * **Link**, **Image**, and **Flash** dialog windows. + * + * Read more in the [documentation](#!/guide/dev_file_browse_upload) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserBrowseUrl = '/browser/browse.php'; + * + * @since 3.0 + * @cfg {String} [filebrowserBrowseUrl='' (empty string = disabled)] + * @member CKEDITOR.config + */ + +/** + * The location of the script that handles file uploads. + * If set, the **Upload** tab will appear in the **Link**, **Image**, + * and **Flash** dialog windows. + * + * Read more in the [documentation](#!/guide/dev_file_browse_upload) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserUploadUrl = '/uploader/upload.php'; + * + * **Note:** This is a configuration setting for a [file browser/uploader](#!/guide/dev_file_browse_upload). + * To configure [uploading dropped or pasted files](#!/guide/dev_file_upload) use the {@link CKEDITOR.config#uploadUrl} + * configuration option. + * + * @since 3.0 + * @cfg {String} [filebrowserUploadUrl='' (empty string = disabled)] + * @member CKEDITOR.config + */ + +/** + * The location of an external file manager that should be launched when the **Browse Server** + * button is pressed in the **Image** dialog window. + * + * If not set, CKEditor will use {@link CKEDITOR.config#filebrowserBrowseUrl}. + * + * Read more in the [documentation](#!/guide/dev_file_manager_configuration-section-adding-file-manager-scripts-for-selected-dialog-windows) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images'; + * + * @since 3.0 + * @cfg {String} [filebrowserImageBrowseUrl='' (empty string = disabled)] + * @member CKEDITOR.config + */ + +/** + * The location of an external file browser that should be launched when the **Browse Server** + * button is pressed in the **Flash** dialog window. + * + * If not set, CKEditor will use {@link CKEDITOR.config#filebrowserBrowseUrl}. + * + * Read more in the [documentation](#!/guide/dev_file_manager_configuration-section-adding-file-manager-scripts-for-selected-dialog-windows) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserFlashBrowseUrl = '/browser/browse.php?type=Flash'; + * + * @since 3.0 + * @cfg {String} [filebrowserFlashBrowseUrl='' (empty string = disabled)] + * @member CKEDITOR.config + */ + +/** + * The location of the script that handles file uploads in the **Image** dialog window. + * + * If not set, CKEditor will use {@link CKEDITOR.config#filebrowserUploadUrl}. + * + * Read more in the [documentation](#!/guide/dev_file_manager_configuration-section-adding-file-manager-scripts-for-selected-dialog-windows) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserImageUploadUrl = '/uploader/upload.php?type=Images'; + * + * **Note:** This is a configuration setting for a [file browser/uploader](#!/guide/dev_file_browse_upload). + * To configure [uploading dropped or pasted files](#!/guide/dev_file_upload) use the {@link CKEDITOR.config#uploadUrl} + * or {@link CKEDITOR.config#imageUploadUrl} configuration option. + * + * @since 3.0 + * @cfg {String} [filebrowserImageUploadUrl='' (empty string = disabled)] + * @member CKEDITOR.config + */ + +/** + * The location of the script that handles file uploads in the **Flash** dialog window. + * + * If not set, CKEditor will use {@link CKEDITOR.config#filebrowserUploadUrl}. + * + * Read more in the [documentation](#!/guide/dev_file_manager_configuration-section-adding-file-manager-scripts-for-selected-dialog-windows) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserFlashUploadUrl = '/uploader/upload.php?type=Flash'; + * + * @since 3.0 + * @cfg {String} filebrowserFlashUploadUrl='' (empty string = disabled)] + * @member CKEDITOR.config + */ + +/** + * The location of an external file manager that should be launched when the **Browse Server** + * button is pressed in the **Link** tab of the **Image** dialog window. + * + * If not set, CKEditor will use {@link CKEDITOR.config#filebrowserBrowseUrl}. + * + * Read more in the [documentation](#!/guide/dev_file_manager_configuration-section-adding-file-manager-scripts-for-selected-dialog-windows) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserImageBrowseLinkUrl = '/browser/browse.php'; + * + * @since 3.2 + * @cfg {String} [filebrowserImageBrowseLinkUrl='' (empty string = disabled)] + * @member CKEDITOR.config + */ + +/** + * The features to use in the file manager popup window. + * + * config.filebrowserWindowFeatures = 'resizable=yes,scrollbars=no'; + * + * @since 3.4.1 + * @cfg {String} [filebrowserWindowFeatures='location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes'] + * @member CKEDITOR.config + */ + +/** + * The width of the file manager popup window. It can be a number denoting a value in + * pixels or a percent string. + * + * Read more in the [documentation](#!/guide/dev_file_manager_configuration-section-file-manager-window-size) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserWindowWidth = 750; + * + * config.filebrowserWindowWidth = '50%'; + * + * @cfg {Number/String} [filebrowserWindowWidth='80%'] + * @member CKEDITOR.config + */ + +/** + * The height of the file manager popup window. It can be a number denoting a value in + * pixels or a percent string. + * + * Read more in the [documentation](#!/guide/dev_file_manager_configuration-section-file-manager-window-size) + * and see the [SDK sample](http://sdk.ckeditor.com/samples/fileupload.html). + * + * config.filebrowserWindowHeight = 580; + * + * config.filebrowserWindowHeight = '50%'; + * + * @cfg {Number/String} [filebrowserWindowHeight='70%'] + * @member CKEDITOR.config + */ From d9626e72e7c610c58f2b9f80b444607d5fd3d4c6 Mon Sep 17 00:00:00 2001 From: Old-Fart Date: Mon, 11 Jul 2016 18:46:49 -0400 Subject: [PATCH 05/14] Updates .htaccess files Adds more security related directives --- .htaccess | 16 +++++++++++++++- public/.htaccess | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.htaccess b/.htaccess index bf7ee9cf9..92656d2c3 100644 --- a/.htaccess +++ b/.htaccess @@ -1,6 +1,20 @@ +# Very simple security for apache webserver - do not remove. +# # Restrict access to DotFiles (like .htaccess, .env, .gitignore....) -# Do not remove if you are running Apache web server. Order allow,deny Deny from all + +# Restrict access to system files + + Order allow,deny + Deny from all + + +# Uncomment to restrict access to release text files +# +# Order allow,deny +# Deny from all +# + diff --git a/public/.htaccess b/public/.htaccess index e2ed529bd..e678ac5b2 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -4,7 +4,7 @@ RewriteEngine On - + # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] @@ -15,8 +15,20 @@ # Restrict access to DotFiles (like .htaccess, .env, .gitignore....) -# Do not remove if you are running Apache web server. Order allow,deny Deny from all + +# Restrict access to system files + + Order allow,deny + Deny from all + + +# Uncomment to restrict access to release text files +# +# Order allow,deny +# Deny from all +# + From c53b01e48a2f6509b0d621abd74b21248e4e186c Mon Sep 17 00:00:00 2001 From: Old-Fart Date: Mon, 11 Jul 2016 19:04:41 -0400 Subject: [PATCH 06/14] Removes error_log removes environment dependant file error_log --- public/error_log | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 public/error_log diff --git a/public/error_log b/public/error_log deleted file mode 100644 index 9b86c3f82..000000000 --- a/public/error_log +++ /dev/null @@ -1,10 +0,0 @@ -[24-Jul-2015 12:08:05 UTC] PHP Warning: Uncaught exception 'ErrorException' with message 'Undefined variable: router' in /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php:260 -Stack trace: -#0 /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php(260): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/home/faveohelp...', 260, Array) -#1 [internal function]: App\Providers\RouteServiceProvider->{closure}(Object(Illuminate\Routing\Router)) -#2 /home/faveohelpdesk/public_html/demo/local/vendor/laravel/framework/src/Illuminate/Routing/Router.php(352): call_user_func(Object(Closure), Object(Illuminate\Routing\Router)) -#3 /home/faveohelpdesk/public_html/demo/local/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(213): Illuminate\Routing\Router->group(Array, Object(Closure)) -#4 /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php(277): Illuminate\Support\Facades\Facade::__callStatic('group', Array) -#5 /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php(277): Ill in /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php on line 260 -[24-Jul-2015 12:08:05 UTC] PHP Fatal error: Call to a member function get() on a non-object in /home/faveohelpdesk/public_html/demo/local/app/Http/routes.php on line 260 -[27-Jul-2015 10:50:41 UTC] PHP Parse error: syntax error, unexpected end of file in /home/faveohelpdesk/public_html/demo/local/storage/framework/views/dfc79cb1d1ad74c39ab1adc75b4db873 on line 214 From 7b326677f22f0ff5c76022079864df14a60e4127 Mon Sep 17 00:00:00 2001 From: Old-Fart Date: Tue, 12 Jul 2016 02:13:18 -0400 Subject: [PATCH 07/14] Fixes broken links Fixes broken links to plugin by adding lb-faveo/ directory to templates --- .../themes/default1/layouts/blank.blade.php | 20 +++++++------- .../themes/default1/layouts/kb.blade.php | 26 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/resources/views/themes/default1/layouts/blank.blade.php b/resources/views/themes/default1/layouts/blank.blade.php index 064037893..7e1e2f39f 100644 --- a/resources/views/themes/default1/layouts/blank.blade.php +++ b/resources/views/themes/default1/layouts/blank.blade.php @@ -4,7 +4,7 @@ SUPPORT CENTER | CLIENT PANEL - + @@ -13,21 +13,21 @@ - - + + - + - +
- +
@yield('PageHeader') @yield('breadcrumbs') @@ -131,15 +131,15 @@ - + - + {{-- // --}} - + - + @yield('FooterInclude') diff --git a/resources/views/themes/default1/layouts/kb.blade.php b/resources/views/themes/default1/layouts/kb.blade.php index efbadd99e..d8ac70519 100644 --- a/resources/views/themes/default1/layouts/kb.blade.php +++ b/resources/views/themes/default1/layouts/kb.blade.php @@ -11,23 +11,23 @@ - - + + - + - + {{-- jquery ui css --}} - +
  • @if(Auth::user()->profile_pic) User Image - @else + @else User Image @endif

    @@ -165,7 +165,7 @@ if ($company != null) {

  • - +
    @@ -194,15 +194,15 @@ if ($company != null) { - + - + - + @@ -258,8 +258,8 @@ $(function() { - - + + + + diff --git a/resources/views/themes/default1/admin/layout/admin.blade.php b/resources/views/themes/default1/admin/layout/admin.blade.php index f9bec7622..4f0eaf3ff 100644 --- a/resources/views/themes/default1/admin/layout/admin.blade.php +++ b/resources/views/themes/default1/admin/layout/admin.blade.php @@ -30,10 +30,10 @@ - + {{-- // --}} - {{-- // --}} + {{-- // --}} @@ -401,7 +401,7 @@ $(function () { $("textarea").wysihtml5(); }); // $(function(){ -// $("#checkUpdate").on('click',function(){ +// $("#checkUpdate").on('click',function(){ // $.ajax({ // type: "GET", // url: "{!! URL::route('version-check') !!}", diff --git a/resources/views/themes/default1/agent/layout/agent.blade.php b/resources/views/themes/default1/agent/layout/agent.blade.php index 4b221b295..dda88f87d 100644 --- a/resources/views/themes/default1/agent/layout/agent.blade.php +++ b/resources/views/themes/default1/agent/layout/agent.blade.php @@ -28,7 +28,7 @@ - + @@ -52,7 +52,7 @@ first(); if ($company != null) { - + } $replacetop = 0; $replacetop = \Event::fire('service.desk.agent.topbar.replace', array()); @@ -90,7 +90,7 @@
  • {!! Lang::get('lang.users') !!}
  • {!! Lang::get('lang.tickets') !!}
  • {!! Lang::get('lang.tools') !!}
  • - @else + @else @endif @@ -171,12 +171,12 @@ @if(Auth::user()) User Image - @endif + @endif
    @@ -366,10 +366,10 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->where( {!! Lang::get('lang.copyright') !!} © {!! date('Y') !!} {!! $company->company_name !!}. {!! Lang::get('lang.all_rights_reserved') !!}. {!! Lang::get('lang.powered_by') !!} Faveo - {{-- // --}} + {{-- // --}} - + {{-- // --}} @@ -392,10 +392,10 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->where( - + {{-- // --}} - + @@ -410,7 +410,7 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->where( - + - - - + + + @yield('HeadInclude') @@ -74,7 +74,7 @@ @else User Image @endif - @endif + @endif