From ad39ec1dc37d44bcd92276b47ccb9ea2140af765 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 25 Feb 2015 11:25:10 -0800 Subject: [PATCH] Added markdown to EULA --- app/lang/en/admin/settings/general.php | 1 + app/models/Asset.php | 8 +- app/models/Category.php | 2 + app/models/Setting.php | 11 ++ app/views/backend/categories/edit.blade.php | 4 +- app/views/backend/settings/edit.blade.php | 1 + app/views/emails/accept-asset.blade.php | 2 +- composer.json | 3 +- composer.lock | 199 +++++++++++++------- 9 files changed, 155 insertions(+), 76 deletions(-) diff --git a/app/lang/en/admin/settings/general.php b/app/lang/en/admin/settings/general.php index 27a72d090c..2170679363 100755 --- a/app/lang/en/admin/settings/general.php +++ b/app/lang/en/admin/settings/general.php @@ -12,6 +12,7 @@ return array( 'display_checkout_date' => 'Display Checkout Date', 'display_eol' => 'Display EOL in table view', 'display_qr' => 'Display QR Codes', + 'eula_markdown' => 'This EULA allows Github flavored markdown.', 'header_color' => 'Header Color', 'info' => 'These settings let you customize certain aspects of your installation.', 'laravel' => 'Laravel Version', diff --git a/app/models/Asset.php b/app/models/Asset.php index 0fb953b018..f8759b6de8 100755 --- a/app/models/Asset.php +++ b/app/models/Asset.php @@ -210,20 +210,20 @@ class Asset extends Depreciable public function getEula() { + $Parsedown = new Parsedown(); + if ($this->model->category->eula_text) { - return $this->model->category->eula_text; + return $Parsedown->text(e($this->model->category->eula_text)); } elseif (Setting::getSettings()->default_eula_text) { - return Setting::getSettings()->default_eula_text; + return $Parsedown->text(e(Setting::getSettings()->default_eula_text)); } else { return null; } } - - /** ----------------------------------------------- BEGIN QUERY SCOPES diff --git a/app/models/Category.php b/app/models/Category.php index 341533c93c..9e6865e35a 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -33,4 +33,6 @@ class Category extends Elegant { return $this->hasMany('Model', 'category_id'); } + + } diff --git a/app/models/Setting.php b/app/models/Setting.php index 3931b4c862..eedcda7633 100755 --- a/app/models/Setting.php +++ b/app/models/Setting.php @@ -17,4 +17,15 @@ class Setting extends Elegant $app = App::getFacadeApplication(); return $app::VERSION; } + + public static function getDefaultEula() { + + $Parsedown = new Parsedown(); + if (Setting::getSettings()->default_eula_text) { + return $Parsedown->text(e(Setting::getSettings()->default_eula_text)); + } else { + return null; + } + + } } diff --git a/app/views/backend/categories/edit.blade.php b/app/views/backend/categories/edit.blade.php index 7e2b208689..780118bcfe 100755 --- a/app/views/backend/categories/edit.blade.php +++ b/app/views/backend/categories/edit.blade.php @@ -54,6 +54,8 @@
{{ Form::textarea('eula_text', Input::old('eula_text', $category->eula_text), array('class' => 'form-control')) }}

@lang('admin/categories/general.eula_text_help')

+

@lang('admin/settings/general.eula_markdown')

+ {{ $errors->first('eula_text', ':message') }}
@@ -115,7 +117,7 @@ diff --git a/app/views/emails/accept-asset.blade.php b/app/views/emails/accept-asset.blade.php index 54f9810f3a..2515a2370e 100755 --- a/app/views/emails/accept-asset.blade.php +++ b/app/views/emails/accept-asset.blade.php @@ -5,7 +5,7 @@

A new asset has been checked out to you. Please read the terms of use below, and click on the link at the bottom to confirm that you read and agree to the terms of use, and have received the asset.

-

{{ nl2br(e($eula)) }}

+

{{ $eula }}

I have read and agree to the terms of use, and have received this item.

diff --git a/composer.json b/composer.json index bb9728ed15..c9235206e6 100755 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "chumper/datatable": "dev-master", "bacon/bacon-qr-code": "dev-master", "intervention/image": "dev-master", - "league/csv": "~7.0" + "league/csv": "~7.0", + "erusev/parsedown": "dev-master" }, "require-dev": { "phpunit/phpunit": "*", diff --git a/composer.lock b/composer.lock index 9f37234681..9b4b4d8f76 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "184f0469476babea7ab1e609f265b691", + "hash": "87a0ca65213f42cd56a20d1409bb1a37", "packages": [ { "name": "bacon/bacon-qr-code", @@ -108,12 +108,12 @@ "source": { "type": "git", "url": "https://github.com/cartalyst/sentry.git", - "reference": "a93e6b952f1aea024777a65d913168580af6c8e5" + "reference": "d90507a5d08e9fa763d81960814095199fef920f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cartalyst/sentry/zipball/a93e6b952f1aea024777a65d913168580af6c8e5", - "reference": "a93e6b952f1aea024777a65d913168580af6c8e5", + "url": "https://api.github.com/repos/cartalyst/sentry/zipball/d90507a5d08e9fa763d81960814095199fef920f", + "reference": "d90507a5d08e9fa763d81960814095199fef920f", "shasum": "" }, "require": { @@ -125,7 +125,7 @@ "illuminate/http": ">=4.0.9,<4.2", "illuminate/session": ">=4.0.9,<4.2", "ircmaxell/password-compat": "1.0.*", - "mockery/mockery": "0.7.2" + "mockery/mockery": "0.9.*" }, "suggest": { "happydemon/txt": "Required Text helpers when using the Kohana implementation", @@ -200,7 +200,7 @@ "laravel", "security" ], - "time": "2015-02-06 21:27:56" + "time": "2015-02-25 01:32:57" }, { "name": "chumper/datatable", @@ -559,12 +559,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "f1004b8b336465fafd498ee6539cc2502d16f98f" + "reference": "0e11c342d167c75f083358fa7825657ea4ab10eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/f1004b8b336465fafd498ee6539cc2502d16f98f", - "reference": "f1004b8b336465fafd498ee6539cc2502d16f98f", + "url": "https://api.github.com/repos/doctrine/common/zipball/0e11c342d167c75f083358fa7825657ea4ab10eb", + "reference": "0e11c342d167c75f083358fa7825657ea4ab10eb", "shasum": "" }, "require": { @@ -624,7 +624,7 @@ "persistence", "spl" ], - "time": "2015-02-16 02:14:17" + "time": "2015-02-25 13:42:36" }, { "name": "doctrine/dbal", @@ -813,6 +813,45 @@ ], "time": "2014-09-09 13:34:57" }, + { + "name": "erusev/parsedown", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "65116c3cb0953447eac742aa4ea5fc4aaaa22db9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/65116c3cb0953447eac742aa4ea5fc4aaaa22db9", + "reference": "65116c3cb0953447eac742aa4ea5fc4aaaa22db9", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2015-02-08 23:04:08" + }, { "name": "filp/whoops", "version": "1.1.3", @@ -877,12 +916,12 @@ "source": { "type": "git", "url": "https://github.com/Intervention/image.git", - "reference": "a8c0e77447877a0a8591ff8e74ad0d14d3ca4c7e" + "reference": "68b0f68e06d9399fba8ca45bad1e9816c057774e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Intervention/image/zipball/a8c0e77447877a0a8591ff8e74ad0d14d3ca4c7e", - "reference": "a8c0e77447877a0a8591ff8e74ad0d14d3ca4c7e", + "url": "https://api.github.com/repos/Intervention/image/zipball/68b0f68e06d9399fba8ca45bad1e9816c057774e", + "reference": "68b0f68e06d9399fba8ca45bad1e9816c057774e", "shasum": "" }, "require": { @@ -925,7 +964,7 @@ "thumbnail", "watermark" ], - "time": "2015-02-03 15:44:48" + "time": "2015-02-20 15:44:29" }, { "name": "ircmaxell/password-compat", @@ -1138,12 +1177,12 @@ "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "959ede56075fec54891fad13744aeed6d42ad345" + "reference": "84cb30b4df632cbdb3a01bd2bd349f940ff55560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/959ede56075fec54891fad13744aeed6d42ad345", - "reference": "959ede56075fec54891fad13744aeed6d42ad345", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/84cb30b4df632cbdb3a01bd2bd349f940ff55560", + "reference": "84cb30b4df632cbdb3a01bd2bd349f940ff55560", "shasum": "" }, "require": { @@ -1177,6 +1216,7 @@ } ], "description": "Csv data manipulation made easy in PHP", + "homepage": "http://csv.thephpleague.com", "keywords": [ "csv", "export", @@ -1185,7 +1225,7 @@ "read", "write" ], - "time": "2015-02-18 16:45:52" + "time": "2015-02-24 11:11:39" }, { "name": "maximebf/debugbar", @@ -1249,12 +1289,12 @@ "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "f05ed3a44a8e40533d4cf60a0669db6b1887b499" + "reference": "bba433ac380c47523fab495a1322368381df0996" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f05ed3a44a8e40533d4cf60a0669db6b1887b499", - "reference": "f05ed3a44a8e40533d4cf60a0669db6b1887b499", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bba433ac380c47523fab495a1322368381df0996", + "reference": "bba433ac380c47523fab495a1322368381df0996", "shasum": "" }, "require": { @@ -1313,7 +1353,7 @@ "logging", "psr-3" ], - "time": "2015-02-11 14:20:33" + "time": "2015-02-25 16:48:53" }, { "name": "nesbot/carbon", @@ -1367,12 +1407,12 @@ "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "53eac36a3f7a116103f50dee0669451ccec35a44" + "reference": "e3bc5b564d2eaceae8ecb74ff8194efa6235a04f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53eac36a3f7a116103f50dee0669451ccec35a44", - "reference": "53eac36a3f7a116103f50dee0669451ccec35a44", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/e3bc5b564d2eaceae8ecb74ff8194efa6235a04f", + "reference": "e3bc5b564d2eaceae8ecb74ff8194efa6235a04f", "shasum": "" }, "require": { @@ -1404,7 +1444,7 @@ "parser", "php" ], - "time": "2015-02-13 17:03:18" + "time": "2015-02-24 20:43:12" }, { "name": "patchwork/utf8", @@ -1811,18 +1851,21 @@ "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "a634f4e901f5d20696020980cae70d8d94c6193d" + "reference": "1055ce82e84d5f0b8d0b06886d2f500c72ee044e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/a634f4e901f5d20696020980cae70d8d94c6193d", - "reference": "a634f4e901f5d20696020980cae70d8d94c6193d", + "url": "https://api.github.com/repos/symfony/Config/zipball/1055ce82e84d5f0b8d0b06886d2f500c72ee044e", + "reference": "1055ce82e84d5f0b8d0b06886d2f500c72ee044e", "shasum": "" }, "require": { "php": ">=5.3.9", "symfony/filesystem": "~2.3|~3.0.0" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0.0" + }, "type": "library", "extra": { "branch-alias": { @@ -1850,7 +1893,7 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2015-02-11 07:17:51" + "time": "2015-02-25 12:51:44" }, { "name": "symfony/console", @@ -2077,12 +2120,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "2dc33aff298b20ad099ac456034aebc5055f02fb" + "reference": "ce9246f87133be616f5db06b5e162f5210f95280" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/2dc33aff298b20ad099ac456034aebc5055f02fb", - "reference": "2dc33aff298b20ad099ac456034aebc5055f02fb", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/ce9246f87133be616f5db06b5e162f5210f95280", + "reference": "ce9246f87133be616f5db06b5e162f5210f95280", "shasum": "" }, "require": { @@ -2093,6 +2136,7 @@ "symfony/config": "~2.0,>=2.0.5|~3.0.0", "symfony/dependency-injection": "~2.6|~3.0.0", "symfony/expression-language": "~2.6|~3.0.0", + "symfony/phpunit-bridge": "~2.7|~3.0.0", "symfony/stopwatch": "~2.3|~3.0.0" }, "suggest": { @@ -2126,7 +2170,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2015-02-11 07:17:51" + "time": "2015-02-18 10:38:04" }, { "name": "symfony/filesystem", @@ -2135,17 +2179,20 @@ "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "cb5db1cf2440ceb68760ef0e70f9d1d4ba135444" + "reference": "d4ae276ad15d0ae17ae07bd8b7de1c5381217283" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/cb5db1cf2440ceb68760ef0e70f9d1d4ba135444", - "reference": "cb5db1cf2440ceb68760ef0e70f9d1d4ba135444", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/d4ae276ad15d0ae17ae07bd8b7de1c5381217283", + "reference": "d4ae276ad15d0ae17ae07bd8b7de1c5381217283", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0.0" + }, "type": "library", "extra": { "branch-alias": { @@ -2173,7 +2220,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2015-02-16 09:13:25" + "time": "2015-02-18 10:38:04" }, { "name": "symfony/finder", @@ -2534,17 +2581,20 @@ "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "2883cdac7f23a0355760e485d6906528ad1e9504" + "reference": "6669f15131da84d97851b8398a09d04cd604d223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/2883cdac7f23a0355760e485d6906528ad1e9504", - "reference": "2883cdac7f23a0355760e485d6906528ad1e9504", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/6669f15131da84d97851b8398a09d04cd604d223", + "reference": "6669f15131da84d97851b8398a09d04cd604d223", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0.0" + }, "type": "library", "extra": { "branch-alias": { @@ -2572,7 +2622,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "http://symfony.com", - "time": "2015-02-11 07:17:51" + "time": "2015-02-18 10:38:04" }, { "name": "symfony/translation", @@ -2637,17 +2687,20 @@ "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "32d9d37b10996006df9e298e05aee59dc53742af" + "reference": "6e1aeb472cbc5b229db87983f4ef502996ea0d1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/32d9d37b10996006df9e298e05aee59dc53742af", - "reference": "32d9d37b10996006df9e298e05aee59dc53742af", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6e1aeb472cbc5b229db87983f4ef502996ea0d1f", + "reference": "6e1aeb472cbc5b229db87983f4ef502996ea0d1f", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0.0" + }, "suggest": { "ext-symfony_debug": "" }, @@ -2685,7 +2738,7 @@ "debug", "dump" ], - "time": "2015-02-05 06:58:17" + "time": "2015-02-25 12:51:44" }, { "name": "symfony/yaml", @@ -2694,17 +2747,20 @@ "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "43aac3461a5679f486f7c96e4d7e780a59fec997" + "reference": "d04b39229628a0cc36ae5616db9c7f6f7119ac8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/43aac3461a5679f486f7c96e4d7e780a59fec997", - "reference": "43aac3461a5679f486f7c96e4d7e780a59fec997", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/d04b39229628a0cc36ae5616db9c7f6f7119ac8f", + "reference": "d04b39229628a0cc36ae5616db9c7f6f7119ac8f", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0.0" + }, "type": "library", "extra": { "branch-alias": { @@ -2732,7 +2788,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2015-02-11 07:17:51" + "time": "2015-02-18 10:38:04" } ], "packages-dev": [ @@ -2796,12 +2852,12 @@ "source": { "type": "git", "url": "https://github.com/padraic/mockery.git", - "reference": "a450aa28455781c7a72e50794b0f9d954cf8decb" + "reference": "2448c5b27f40d11db1f7bcee5a1188fef8ae490a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/a450aa28455781c7a72e50794b0f9d954cf8decb", - "reference": "a450aa28455781c7a72e50794b0f9d954cf8decb", + "url": "https://api.github.com/repos/padraic/mockery/zipball/2448c5b27f40d11db1f7bcee5a1188fef8ae490a", + "reference": "2448c5b27f40d11db1f7bcee5a1188fef8ae490a", "shasum": "" }, "require": { @@ -2853,7 +2909,7 @@ "test double", "testing" ], - "time": "2015-02-18 18:54:04" + "time": "2015-02-20 22:10:40" }, { "name": "phpdocumentor/reflection-docblock", @@ -2861,12 +2917,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "ff902a0beb121a13a4d3c604bd6778a25aeae07a" + "reference": "5a87e6edaa9927e301ed6b16d230d977d14f1386" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ff902a0beb121a13a4d3c604bd6778a25aeae07a", - "reference": "ff902a0beb121a13a4d3c604bd6778a25aeae07a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/5a87e6edaa9927e301ed6b16d230d977d14f1386", + "reference": "5a87e6edaa9927e301ed6b16d230d977d14f1386", "shasum": "" }, "require": { @@ -2877,7 +2933,8 @@ }, "suggest": { "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "erusev/parsedown": "~1.0", + "league/commonmark": "*" }, "type": "library", "extra": { @@ -2902,7 +2959,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-02-12 12:17:11" + "time": "2015-02-25 17:26:05" }, { "name": "phpspec/prophecy", @@ -3214,12 +3271,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "7c1de6a854a36ba330b352a005a4f5f928619f53" + "reference": "7b9e68dfc2fccb6b167b09a605152b0f5fd6d871" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7c1de6a854a36ba330b352a005a4f5f928619f53", - "reference": "7c1de6a854a36ba330b352a005a4f5f928619f53", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b9e68dfc2fccb6b167b09a605152b0f5fd6d871", + "reference": "7b9e68dfc2fccb6b167b09a605152b0f5fd6d871", "shasum": "" }, "require": { @@ -3258,6 +3315,9 @@ "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3278,7 +3338,7 @@ "testing", "xunit" ], - "time": "2015-02-09 06:38:12" + "time": "2015-02-24 09:18:59" }, { "name": "phpunit/phpunit-mock-objects", @@ -3405,12 +3465,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "6dc90302a4cdf8486c221a0ad3a4da53859fcfa5" + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6dc90302a4cdf8486c221a0ad3a4da53859fcfa5", - "reference": "6dc90302a4cdf8486c221a0ad3a4da53859fcfa5", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", "shasum": "" }, "require": { @@ -3422,7 +3482,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -3449,7 +3509,7 @@ "keywords": [ "diff" ], - "time": "2015-01-01 09:20:29" + "time": "2015-02-22 15:13:53" }, { "name": "sebastian/environment", @@ -3712,7 +3772,8 @@ "stability-flags": { "chumper/datatable": 20, "bacon/bacon-qr-code": 20, - "intervention/image": 20 + "intervention/image": 20, + "erusev/parsedown": 20 }, "prefer-stable": false, "prefer-lowest": false,