Skip to content

Commit

Permalink
Merge branch 'release/4.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlaefer committed Nov 18, 2015
2 parents 78faa94 + 55250d3 commit 7c0d652
Show file tree
Hide file tree
Showing 45 changed files with 699 additions and 387 deletions.
34 changes: 27 additions & 7 deletions .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
Expand Down Expand Up @@ -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"
2 changes: 1 addition & 1 deletion app/Config/bootstrap.php
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion app/Config/version.php
@@ -1,4 +1,4 @@
<?php
Configure::write('Saito.v', '4.7.5');
Configure::write('Saito.v', '4.8.0');

Configure::write('Saito.saitoHomepage', 'http://saito.siezi.com');
8 changes: 8 additions & 0 deletions app/Controller/AdminsController.php
Expand Up @@ -11,6 +11,14 @@ class AdminsController extends AppController {
public function admin_index() {
}

/**
* Show PHP-info
*
* @return void
*/
public function admin_phpinfo() {
}

public function admin_logs() {
// order here is output order in frontend
$_logsToRead = ['error', 'debug'];
Expand Down
11 changes: 9 additions & 2 deletions app/Controller/EntriesController.php
Expand Up @@ -692,8 +692,15 @@ public function beforeFilter() {
$this->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()');
Expand Down
3 changes: 3 additions & 0 deletions app/Controller/SearchesController.php
Expand Up @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions app/Plugin/BbcodeParser/Lib/Editor.php
Expand Up @@ -56,6 +56,13 @@ public function getMarkupSet() {
'openWith' => '[spoiler]',
'closeWith' => '[/spoiler]'
],
'Quote' => [
'name' => "<i class='fa fa-quote-left'></i>",
'className' => 'btn-markItUp-Quote',
'title' => __('Cite'),
'openWith' => '[quote]',
'closeWith' => '[/quote]'
],
'separator',
'Link' => array(
'name' => "<i class='fa fa-link'></i>",
Expand Down
8 changes: 7 additions & 1 deletion app/Plugin/BbcodeParser/Lib/Parser.php
Expand Up @@ -54,7 +54,7 @@ class Parser extends \Saito\Markup\Parser {
'float' => [
'type' => 'replacement',
'title' => 'float',
'replacement' => '<div class="richtext-float">{param}</div>'
'replacement' => '<div class="clearfix"></div><div class="richtext-float">{param}</div>'
],
// email
'email' => [
Expand Down Expand Up @@ -120,6 +120,12 @@ class Parser extends \Saito\Markup\Parser {
'type' => 'class',
'title' => 'urlWithAttributes'
],
// quotes
'quote' => [
'type' => 'replacement',
'title' => 'quote',
'replacement' => '<blockquote>{param}</blockquote>'
]
],
'multimedia' => [
'embed' => [
Expand Down
19 changes: 14 additions & 5 deletions app/Plugin/BbcodeParser/Test/Case/Lib/BbcodeParserTest.php
Expand Up @@ -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');
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -619,25 +628,25 @@ public function testExternalImage() {

// test for standard URIs
$input = '[img]http://localhost/img/macnemo.png[/img]';
$expected = '<img src="http://localhost/img/macnemo.png" alt="" />';
$expected = '<img src="http://localhost/img/macnemo.png" alt=""/>';
$result = $this->_Parser->parse($input);
$this->assertEquals($expected, $result);

// test for URIs without protocol
$input = '[img]/somewhere/macnemo.png[/img]';
$expected = '<img src="' . $this->_Helper->webroot . 'somewhere/macnemo.png" alt="" />';
$expected = '<img src="' . $this->_Helper->webroot . 'somewhere/macnemo.png" alt=""/>';
$result = $this->_Parser->parse($input);
$this->assertEquals($expected, $result);

// test scaling with 1 parameter
$input = '[img=50]http://localhost/img/macnemo.png[/img]';
$expected = '<img src="http://localhost/img/macnemo.png" width="50" alt="" />';
$expected = '<img src="http://localhost/img/macnemo.png" width="50" alt=""/>';
$result = $this->_Parser->parse($input);
$this->assertEquals($expected, $result);

// test scaling with 2 parameters
$input = '[img=50x100]http://localhost/img/macnemo.png[/img]';
$expected = '<img src="http://localhost/img/macnemo.png" width="50" height="100" alt="" />';
$expected = '<img src="http://localhost/img/macnemo.png" width="50" height="100" alt=""/>';
$result = $this->_Parser->parse($input);
$this->assertEquals($expected, $result);

Expand Down
4 changes: 3 additions & 1 deletion app/Plugin/BbcodeParser/docs/help/eng/1-bbcodes.md
Expand Up @@ -152,6 +152,8 @@ If activated `[embed]<URL>[/embed]` tries to embed the URL via [embed.ly](http:/

### Float ###

[float]content[/float]
[float]float this to the side[/float] main content
[float]another float[/float] main content

Floats the content to the side.
2 changes: 2 additions & 0 deletions app/Plugin/Embedly/Locale/deu/LC_MESSAGES/embedly.po
@@ -0,0 +1,2 @@
msgid "plugin.embedly.contentLink"
msgstr "Inhalt auf %s anschauen."
2 changes: 2 additions & 0 deletions app/Plugin/Embedly/Locale/eng/LC_MESSAGES/embedly.po
@@ -0,0 +1,2 @@
msgid "plugin.embedly.contentLink"
msgstr "See this content on %s."
7 changes: 7 additions & 0 deletions app/Plugin/Embedly/View/Helper/EmbedlyHelper.php
Expand Up @@ -52,6 +52,13 @@ public function embedly($string) {
}
$title .= $obj->title;
$out = $this->Html->link($title, $obj->url, ['escape' => $escape]);
} elseif ($obj->type === 'link' && isset($obj->url)) {
$title = __d(
'embedly',
'plugin.embedly.contentLink',
[$obj->provider_name]
);
$out = $this->Html->link($title, $obj->url);
}

return $out;
Expand Down
7 changes: 7 additions & 0 deletions app/Plugin/M/Controller/MsController.php
Expand Up @@ -23,6 +23,12 @@ public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index', 'manifest');

if ($this->request->action === 'clientLog') {
if ($this->Components->enabled('Security')) {
$this->Components->disable('Security');
}
}

Configure::write('Asset.timestamp', 'force');
}

Expand All @@ -37,6 +43,7 @@ public function clientLog() {
$this->autoRender = false;
if (isset($this->request->data['message'])) {
$message = $this->request->data['message'];
$message = substr($message, 0, 500);
echo CakeLog::error($message, 'mobile-client') ? 0 : 1;
} else {
echo 1;
Expand Down
25 changes: 13 additions & 12 deletions app/Plugin/M/View/Layouts/plugin-m.ctp
Expand Up @@ -21,18 +21,10 @@
};
</script>
<?= $this->element('custom_html_header') ?>
<?php
if ($isDebug) {
// $requireJsScript = 'main-prod';
$requireJsScript = 'main';
echo $this->RequireJs->scriptTag($requireJsScript, ['jsUrl' => 'm/dev/js/']);
?>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="-1">
<?php
} else {
echo $this->Html->script('M.../dist/js.js');
} ?>
<?php if ($isDebug) { ?>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="-1">
<?php } ?>
</head>
<body>
<div id="main">
Expand All @@ -43,5 +35,14 @@
</div>
</div>
<div id="card-bottom"></div>
<?php
if ($isDebug) {
// $requireJsScript = 'main-prod';
$requireJsScript = 'main';
echo $this->RequireJs->scriptTag($requireJsScript, ['jsUrl' => 'm/dev/js/']);
} else {
echo $this->Html->script('M.../dist/js.js');
}
?>
</body>
</html>
8 changes: 4 additions & 4 deletions app/Plugin/M/webroot/dist/common.css

Large diffs are not rendered by default.

58 changes: 28 additions & 30 deletions app/Plugin/M/webroot/dist/js.js

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions app/Test/Case/Controller/AdminsControllerTest.php
@@ -0,0 +1,38 @@
<?php

class AdminsControllerTest extends \Saito\Test\ControllerTestCase {

public $fixtures = [
'app.bookmark',
'app.category',
'app.esevent',
'app.esnotification',
'app.entry',
'app.setting',
'app.user',
'app.user_block',
'app.user_ignore',
'app.user_online',
'app.user_read',
'app.upload',
];

public function testPhpInfoNotAllowedAnon() {
$this->setExpectedException('ForbiddenException');
$this->testAction('/admin/admins/phpinfo');
}

public function testPhpInfoNotAllowedUser() {
$this->generate('Admins');
$this->_loginUser(3);
$this->setExpectedException('ForbiddenException');
$this->testAction('/admin/admins/phpinfo');
}

public function testPhpInfo() {
$this->generate('Admins');
$this->_loginUser(1);
$this->testAction('/admin/admins/phpinfo');
}

}
26 changes: 19 additions & 7 deletions app/Test/ruleset.xml
@@ -1,9 +1,21 @@
<?xml version="1.0"?>
<ruleset name="Saito">
<!-- include all CakePHP rules -->
<rule ref="CakePHP">
<!-- excludes "docblocks must have 0 indent"-rule -->
<exclude name="CakePHP.WhiteSpace.ScopeIndent"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
</ruleset>
<exclude-pattern>app/Test/Selenium</exclude-pattern>
<exclude-pattern>app/View/Themed</exclude-pattern>
<exclude-pattern>app/Plugin/Embedly</exclude-pattern>
<exclude-pattern>app/Plugin/Geshi</exclude-pattern>
<exclude-pattern>app/Plugin/FileUpload</exclude-pattern>
<exclude-pattern>app/Plugin/Install</exclude-pattern>
<exclude-pattern>app/Plugin/Markitup</exclude-pattern>
<exclude-pattern>app/Plugin/SaitoHelp/Vendor</exclude-pattern>
<exclude-pattern>app/Plugin/Search</exclude-pattern>
<exclude-pattern>app/Plugin/SimpleCaptcha</exclude-pattern>
<exclude-pattern>*/webroot/*</exclude-pattern>

<!-- include all CakePHP rules -->
<rule ref="CakePHP">
<!-- excludes "docblocks must have 0 indent"-rule -->
<exclude name="CakePHP.WhiteSpace.ScopeIndent"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
</ruleset>
7 changes: 6 additions & 1 deletion app/View/Admins/admin_index.ctp
Expand Up @@ -11,6 +11,11 @@
__('admin.sysInfo.cce', $this->Admin->badge(Cache::settings('_cake_core_')['engine'], '_cBadge')),
__('admin.sysInfo.cse', $this->Admin->badge(Cache::settings('default')['engine'], '_cBadge'))
];
$si[] = $this->Html->link(
__('PHP Info'),
['controller' => 'admins', 'action' => 'phpinfo', 'prefix' => 'admin']
);

echo $this->Html->nestedList($si)
?>
</div>
Expand All @@ -19,4 +24,4 @@
$this->Html->link(__('Empty Caches'),
['controller' => 'tools', 'action' => 'emptyCaches', 'admin' => true],
['class' => 'btn'])
?>
?>
15 changes: 15 additions & 0 deletions app/View/Admins/admin_phpinfo.ctp
@@ -0,0 +1,15 @@
<?php

$this->Html->addCrumb(__('admin.sysInfo.h'), '/admin');
$this->Html->addCrumb(__('PHP Info'), '/admin/admins/phpinfo');

echo $this->Html->tag('h1', __('PHP Info'));

ob_start();
phpinfo();
$info = ob_get_clean();
if (preg_match('/\<body\>(?P<body>.*)\<\/body\>/is', $info, $matches)) {
$body = $matches['body'];
$body = str_replace('<table ', '<table class="table table-striped table-bordered" ', $body);
echo $body;
}

0 comments on commit 7c0d652

Please sign in to comment.