From f23eb03ec4e09a523ae59bc5c4bb3731548debb5 Mon Sep 17 00:00:00 2001 From: Ben Woodford Date: Fri, 27 Mar 2015 19:00:42 +0000 Subject: [PATCH 1/4] Hacky static stuff. --- integration/laraveladministrator.php | 41 ++++++++++++---------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/integration/laraveladministrator.php b/integration/laraveladministrator.php index 195aa5b..ddda294 100644 --- a/integration/laraveladministrator.php +++ b/integration/laraveladministrator.php @@ -1,5 +1,8 @@ boot(); //Boot the application's service providers. //get the admin check closure that should be supplied in the admin config - $permission = \Illuminate\Support\Facades\Config::get('administrator::administrator.permission'); - $hasPermission = $permission(); + //$permission = \Illuminate\Support\Facades\Config::get('administrator::administrator.permission'); + //$hasPermission = $permission(); + $hasPermission = true; self::$authenticated = $hasPermission; //start session if not started already @@ -88,29 +92,20 @@ static function runIntegration() { //if this is a simple true value, user is logged in if ($hasPermission == true) { - $configFactory = \Illuminate\Support\Facades\App::make('admin_config_factory'); - $modelName = \Illuminate\Support\Facades\Input::get('model'); - $fieldName = \Illuminate\Support\Facades\Input::get('field'); - - if(!empty($modelName) && !empty($fieldName)) { - - $modelConfig = $configFactory->make($modelName, true); - $modelConfigOptions = $modelConfig->getOption('edit_fields'); - $kcfinderOptions = $modelConfigOptions[$fieldName]["kcfinder"]; - - //allow users to use an option called 'enabled' instead of 'disabled' - if(isset($kcfinderOptions["enabled"])) { - $kcfinderOptions["disabled"] = !$kcfinderOptions["enabled"]; - } + $kcfinderOptions = array( + 'enabled' => true, + 'disabled' => false, + 'uploadURL' => '/uploads/files', + 'uploadPath' => public_path() . '/uploads/files', + ); //save all options to the session - foreach ($kcfinderOptions as $optKey => $optValue) { - $_SESSION['KCFINDER'][$optKey] = $optValue; - } + foreach ($kcfinderOptions as $optKey => $optValue) { + $_SESSION['KCFINDER'][$optKey] = $optValue; + } - self::$authenticated = !$_SESSION['KCFINDER']['disabled']; + self::$authenticated = !$_SESSION['KCFINDER']['disabled']; - } } else { //clean and reset the session variable From 6b5d606a247f6919dd4e90dffdc18b1920e7cd79 Mon Sep 17 00:00:00 2001 From: Ben Woodford Date: Sun, 29 Mar 2015 13:08:57 +0100 Subject: [PATCH 2/4] Due to how various tools handle files, "..png" throws errors in many an application (Laravel's vendor:publish for instance), "period.png" seems like a better choice. --- core/class/browser.php | 2 +- themes/dark/img/files/big/{..png => period.png} | Bin themes/dark/img/files/small/{..png => period.png} | Bin themes/default/img/files/big/{..png => period.png} | Bin 4 files changed, 1 insertion(+), 1 deletion(-) rename themes/dark/img/files/big/{..png => period.png} (100%) rename themes/dark/img/files/small/{..png => period.png} (100%) rename themes/default/img/files/big/{..png => period.png} (100%) diff --git a/core/class/browser.php b/core/class/browser.php index 0f648e4..e96634e 100644 --- a/core/class/browser.php +++ b/core/class/browser.php @@ -694,7 +694,7 @@ protected function sendDefaultThumb($file=null) { $thumb = "themes/{$this->config['theme']}/img/files/big/$ext.png"; } if (!isset($thumb) || !file_exists($thumb)) - $thumb = "themes/{$this->config['theme']}/img/files/big/..png"; + $thumb = "themes/{$this->config['theme']}/img/files/big/period.png"; header("Content-Type: image/png"); readfile($thumb); die; diff --git a/themes/dark/img/files/big/..png b/themes/dark/img/files/big/period.png similarity index 100% rename from themes/dark/img/files/big/..png rename to themes/dark/img/files/big/period.png diff --git a/themes/dark/img/files/small/..png b/themes/dark/img/files/small/period.png similarity index 100% rename from themes/dark/img/files/small/..png rename to themes/dark/img/files/small/period.png diff --git a/themes/default/img/files/big/..png b/themes/default/img/files/big/period.png similarity index 100% rename from themes/default/img/files/big/..png rename to themes/default/img/files/big/period.png From 145d741d448964e8c42cbe567571e59b02f3f7cf Mon Sep 17 00:00:00 2001 From: Ben Woodford Date: Sun, 29 Mar 2015 13:14:17 +0100 Subject: [PATCH 3/4] Revert "Hacky static stuff." This reverts commit f23eb03ec4e09a523ae59bc5c4bb3731548debb5. --- integration/laraveladministrator.php | 41 ++++++++++++++++------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/integration/laraveladministrator.php b/integration/laraveladministrator.php index ddda294..195aa5b 100644 --- a/integration/laraveladministrator.php +++ b/integration/laraveladministrator.php @@ -1,8 +1,5 @@ boot(); //Boot the application's service providers. //get the admin check closure that should be supplied in the admin config - //$permission = \Illuminate\Support\Facades\Config::get('administrator::administrator.permission'); - //$hasPermission = $permission(); - $hasPermission = true; + $permission = \Illuminate\Support\Facades\Config::get('administrator::administrator.permission'); + $hasPermission = $permission(); self::$authenticated = $hasPermission; //start session if not started already @@ -92,20 +88,29 @@ static function runIntegration() { //if this is a simple true value, user is logged in if ($hasPermission == true) { - $kcfinderOptions = array( - 'enabled' => true, - 'disabled' => false, - 'uploadURL' => '/uploads/files', - 'uploadPath' => public_path() . '/uploads/files', - ); + $configFactory = \Illuminate\Support\Facades\App::make('admin_config_factory'); + $modelName = \Illuminate\Support\Facades\Input::get('model'); + $fieldName = \Illuminate\Support\Facades\Input::get('field'); + + if(!empty($modelName) && !empty($fieldName)) { + + $modelConfig = $configFactory->make($modelName, true); + $modelConfigOptions = $modelConfig->getOption('edit_fields'); + $kcfinderOptions = $modelConfigOptions[$fieldName]["kcfinder"]; + + //allow users to use an option called 'enabled' instead of 'disabled' + if(isset($kcfinderOptions["enabled"])) { + $kcfinderOptions["disabled"] = !$kcfinderOptions["enabled"]; + } //save all options to the session - foreach ($kcfinderOptions as $optKey => $optValue) { - $_SESSION['KCFINDER'][$optKey] = $optValue; - } + foreach ($kcfinderOptions as $optKey => $optValue) { + $_SESSION['KCFINDER'][$optKey] = $optValue; + } - self::$authenticated = !$_SESSION['KCFINDER']['disabled']; + self::$authenticated = !$_SESSION['KCFINDER']['disabled']; + } } else { //clean and reset the session variable From 9b9b235052d27e64a2627694755a6d6531bd57b1 Mon Sep 17 00:00:00 2001 From: Ben Woodford Date: Sun, 29 Mar 2015 13:39:08 +0100 Subject: [PATCH 4/4] Forgot one of the files. --- .../default/img/files/small/{..png => period.png} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename themes/default/img/files/small/{..png => period.png} (100%) diff --git a/themes/default/img/files/small/..png b/themes/default/img/files/small/period.png similarity index 100% rename from themes/default/img/files/small/..png rename to themes/default/img/files/small/period.png