diff --git a/.travis.yml b/.travis.yml index e11ea2a4e..d3b5d276d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,38 @@ +sudo: false + +notifications: + email: false + language: php +cache: + directories: + - $HOME/.composer/cache + php: - 5.4 - 5.5 - - 5.6 env: - - DB=mysql - - DB=pgsql + matrix: + - DB=mysql + - DB=pgsql + global: + - PHPCS=0 + +matrix: + fast_finish: true + + include: + - php: 5.6 + env: PHPCS=1 DB=mysql + - php: 5.6 + env: DB=pgsql before_script: - - composer install -d app -o + - composer self-update + - composer install -d app --prefer-dist -o + - sh -c "if [ '$PHPCS' = '1' ]; then app/Vendor/bin/phpcs --config-set installed_paths app/Vendor/cakephp/cakephp-codesniffer; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi" - chmod -R 777 ./app/tmp @@ -71,6 +93,4 @@ before_script: script: - ./app/Console/cake testsuite app All --stderr - -notifications: - email: false + - sh -c "if [ '$PHPCS' = '1' ]; then app/Vendor/bin/phpcs --standard=app/Test/ruleset.xml --warning-severity=8 -p app/Controller app/Model app/Lib app/Test app/View app/Plugin; fi" diff --git a/app/Config/bootstrap.php b/app/Config/bootstrap.php index 863211719..627c76ce7 100755 --- a/app/Config/bootstrap.php +++ b/app/Config/bootstrap.php @@ -220,7 +220,7 @@ * Add additional buttons to editor * @td document in namespace */ -Configure::write('Saito.markItUp.nextCssId', 10); +Configure::write('Saito.markItUp.nextCssId', 11); //= attach Saito event manager to Cake event manager App::uses('SaitoEventManager', 'Lib/Saito/Event'); diff --git a/app/Config/version.php b/app/Config/version.php index 2703ce321..61c2e9706 100644 --- a/app/Config/version.php +++ b/app/Config/version.php @@ -1,4 +1,4 @@ Security->unlockedActions = ['preview', 'solve', 'view']; $this->Auth->allow('feed', 'index', 'view', 'mix', 'update'); - if ($this->request->action === 'index') { - $this->_setAutoRefreshTime(); + switch ($this->request->action) { + case 'index': + $this->_setAutoRefreshTime(); + break; + case 'add': + case 'edit': + if ($this->Components->enabled('Security')) { + $this->Components->disable('Security'); + } } Stopwatch::stop('Entries->beforeFilter()'); diff --git a/app/Controller/SearchesController.php b/app/Controller/SearchesController.php index 3d09d3073..74565eb7f 100644 --- a/app/Controller/SearchesController.php +++ b/app/Controller/SearchesController.php @@ -41,7 +41,10 @@ public function simple() { // @todo pgsql $db = $this->Entry->getDataSource(); + // @codingStandardsIgnoreStart + // on 5.5 phpcs assumes this is the deprecated PHP MySQL extension if (!($db instanceof Mysql)) { + // @codingStandardsIgnoreEnd $this->redirect(['action' => 'advanced']); return; } diff --git a/app/Plugin/BbcodeParser/Lib/Editor.php b/app/Plugin/BbcodeParser/Lib/Editor.php index b52fb508a..83f2b43e3 100644 --- a/app/Plugin/BbcodeParser/Lib/Editor.php +++ b/app/Plugin/BbcodeParser/Lib/Editor.php @@ -56,6 +56,13 @@ public function getMarkupSet() { 'openWith' => '[spoiler]', 'closeWith' => '[/spoiler]' ], + 'Quote' => [ + 'name' => "", + 'className' => 'btn-markItUp-Quote', + 'title' => __('Cite'), + 'openWith' => '[quote]', + 'closeWith' => '[/quote]' + ], 'separator', 'Link' => array( 'name' => "", diff --git a/app/Plugin/BbcodeParser/Lib/Parser.php b/app/Plugin/BbcodeParser/Lib/Parser.php index 105f84e91..da61cfdab 100644 --- a/app/Plugin/BbcodeParser/Lib/Parser.php +++ b/app/Plugin/BbcodeParser/Lib/Parser.php @@ -54,7 +54,7 @@ class Parser extends \Saito\Markup\Parser { 'float' => [ 'type' => 'replacement', 'title' => 'float', - 'replacement' => '
{param}' + ] ], 'multimedia' => [ 'embed' => [ diff --git a/app/Plugin/BbcodeParser/Test/Case/Lib/BbcodeParserTest.php b/app/Plugin/BbcodeParser/Test/Case/Lib/BbcodeParserTest.php index 912ef99a8..553ffa24d 100755 --- a/app/Plugin/BbcodeParser/Test/Case/Lib/BbcodeParserTest.php +++ b/app/Plugin/BbcodeParser/Test/Case/Lib/BbcodeParserTest.php @@ -28,6 +28,13 @@ public function testBold() { $this->assertTags($result, $expected); } + public function testQuoteblock() { + $input = '[quote]foo bar[/quote]'; + $expected = array('blockquote' => array(), 'foo bar', '/blockquote'); + $result = $this->_Parser->parse($input); + $this->assertTags($result, $expected); + } + public function testEmphasis() { $input = '[i]italic[/i]'; $expected = array('em' => array(), 'italic', '/em'); @@ -412,7 +419,9 @@ public function testFlash() { public function testFloat() { $expected = [ - 'div' => ['class' => 'richtext-float'], + ['div' => ['class' => 'clearfix']], + '/div', + ['div' => ['class' => 'richtext-float']], 'text', '/div', 'more' @@ -619,25 +628,25 @@ public function testExternalImage() { // test for standard URIs $input = '[img]http://localhost/img/macnemo.png[/img]'; - $expected = ''; + $expected = ''; $result = $this->_Parser->parse($input); $this->assertEquals($expected, $result); // test for URIs without protocol $input = '[img]/somewhere/macnemo.png[/img]'; - $expected = ''; + $expected = ''; $result = $this->_Parser->parse($input); $this->assertEquals($expected, $result); // test scaling with 1 parameter $input = '[img=50]http://localhost/img/macnemo.png[/img]'; - $expected = ''; + $expected = ''; $result = $this->_Parser->parse($input); $this->assertEquals($expected, $result); // test scaling with 2 parameters $input = '[img=50x100]http://localhost/img/macnemo.png[/img]'; - $expected = ''; + $expected = ''; $result = $this->_Parser->parse($input); $this->assertEquals($expected, $result); diff --git a/app/Plugin/BbcodeParser/docs/help/eng/1-bbcodes.md b/app/Plugin/BbcodeParser/docs/help/eng/1-bbcodes.md index 14cdc3deb..d19af23f3 100755 --- a/app/Plugin/BbcodeParser/docs/help/eng/1-bbcodes.md +++ b/app/Plugin/BbcodeParser/docs/help/eng/1-bbcodes.md @@ -152,6 +152,8 @@ If activated `[embed]