Merge branch 'master' of github.com:humhub/humhub

This commit is contained in:
buddh4 2018-09-21 15:09:51 +02:00
commit fed8b93cb7
11 changed files with 26 additions and 22 deletions

View File

@ -9,6 +9,7 @@
namespace humhub\libs;
use yii\grid\Column;
use yii\helpers\Url;
use humhub\libs\Html;
/**
@ -99,6 +100,6 @@ class ActionColumn extends Column
$url[$this->modelIdAttribute] = $model->getAttribute($this->modelIdAttribute);
}
return \yii\helpers\Url::to($url);
return Url::to($url);
}
}

View File

@ -9,6 +9,7 @@
namespace humhub\libs;
use Yii;
use yii\validators\DateValidator;
/**
* Validates (user date format or database format) and converts it to an database date(-time) field
@ -16,7 +17,7 @@ use Yii;
* @see \yii\validators\DateValidator
* @author luke
*/
class DbDateValidator extends \yii\validators\DateValidator
class DbDateValidator extends DateValidator
{
/**

View File

@ -166,7 +166,6 @@ class DynamicConfig extends BaseObject
}
$config['components']['mailer'] = $mail;
// Remove old theme/view stuff
unset($config['components']['view']);
unset($config['components']['mailer']['view']);

View File

@ -61,8 +61,9 @@ class Helpers
public static function arrayCompVal($a, $b)
{
if (!is_array($a) || !is_array($b))
if (!is_array($a) || !is_array($b)) {
return false;
}
sort($a);
sort($b);
@ -147,7 +148,7 @@ class Helpers
*/
public static function getBytesOfIniValue($valueString)
{
if ($valueString === null || $valueString === "") {
if ($valueString === null || $valueString === '') {
return 0;
}
@ -222,15 +223,18 @@ class Helpers
*/
public static function same($a, $b)
{
if (!is_string($a) || !is_string($b))
if (!is_string($a) || !is_string($b)) {
return false;
}
$mb = function_exists('mb_strlen');
$length = $mb ? mb_strlen($a, '8bit') : strlen($a);
if ($length !== ($mb ? mb_strlen($b, '8bit') : strlen($b)))
if ($length !== ($mb ? mb_strlen($b, '8bit') : strlen($b))) {
return false;
}
$check = 0;
for ($i = 0; $i < $length; $i += 1)
for ($i = 0; $i < $length; $i += 1) {
$check |= (ord($a[$i]) ^ ord($b[$i]));
}
return $check === 0;
}

View File

@ -44,6 +44,7 @@ class JSONResponse
public function content($content)
{
$this->result['content'] = $content;
return $this;
}

View File

@ -17,7 +17,7 @@ class Markdown extends GithubMarkdown
protected function handleInternalUrls($url)
{
// Handle urls to file
if (substr($url, 0, 10) === "file-guid-") {
if (substr($url, 0, 10) === 'file-guid-') {
$guid = str_replace('file-guid-', '', $url);
$file = File::findOne(['guid' => $guid]);
if ($file !== null) {
@ -46,7 +46,6 @@ class Markdown extends GithubMarkdown
$internalLink = true;
}
$url = (empty($block['url'])) ? $baseUrl : $block['url'];
return Html::a($this->renderAbsy($block['text']), Html::decode($url), [

View File

@ -10,6 +10,7 @@ namespace humhub\libs;
use cebe\markdown\block\CodeTrait;
use cebe\markdown\block\HeadlineTrait;
use cebe\markdown\Parser;
/**
* MarkdownPreview generates a plain text (no HTML) of markdown.
@ -17,7 +18,7 @@ use cebe\markdown\block\HeadlineTrait;
*
* @since 0.11.1
*/
class MarkdownPreview extends \cebe\markdown\Parser
class MarkdownPreview extends Parser
{
use HeadlineTrait;
@ -146,11 +147,11 @@ REGEXP;
{
$result = '';
if(isset($block['text']) && isset($block['text'][0]) && isset($block['text'][0][1])) {
if (isset($block['text']) && isset($block['text'][0]) && isset($block['text'][0][1])) {
$result = $block['text'][0][1];
}
if(!empty($result) && isset($block['url']) && strrpos($block['url'], 'mention:') === 0) {
if (!empty($result) && isset($block['url']) && strrpos($block['url'], 'mention:') === 0) {
$result = '@'.$result;
}

View File

@ -8,13 +8,15 @@
namespace humhub\libs;
use yii\base\Event;
/**
* This event holds references to parameters which can be modified.
*
* @author luke
* @since 0.21
*/
class ParameterEvent extends \yii\base\Event
class ParameterEvent extends Event
{
/**

View File

@ -8,7 +8,6 @@
namespace humhub\libs;
class Sort
{
public static function sort(&$arr, $field = 'sortOrder')

View File

@ -11,7 +11,6 @@ namespace humhub\libs;
use DateTime;
use DateTimeZone;
/**
* TimezoneHelpers
*
@ -58,7 +57,6 @@ class TimezoneHelper
}
// sort timezone by timezone name
#ksort($timezone_offsets);
asort($timezone_offsets);
$timezone_list = [];
@ -71,10 +69,8 @@ class TimezoneHelper
$t = new DateTimeZone($timezone);
$c = new DateTime(null, $t);
#$current_time = Yii::$app->formatter->asTime($c, 'short'); #;
$current_time = $c->format('H:i');
#$timezone_list[$timezone] = $pretty_offset." - ".$current_time." - ".$timezone;
$timezone_list[$timezone] = $pretty_offset . ' - ' . $timezone;
}

View File

@ -17,6 +17,7 @@ use humhub\modules\space\models\Space;
use humhub\modules\user\components\ActiveQueryUser;
use humhub\modules\user\models\Follow;
use humhub\modules\user\models\User;
use humhub\components\Module;
use Yii;
/**
@ -302,14 +303,14 @@ class NotificationManager
}, $spaces);
// Update non selected membership spaces
\humhub\modules\space\models\Membership::updateAll(['send_notifications' => 0], [
Membership::updateAll(['send_notifications' => 0], [
'and',
['user_id' => $user->id],
['not in', 'space_id', $spaceIds]
]);
// Update non selected following spaces
\humhub\modules\user\models\Follow::updateAll(['send_notifications' => 0], [
Follow::updateAll(['send_notifications' => 0], [
'and',
['user_id' => $user->id],
['object_model' => Space::class],
@ -421,7 +422,7 @@ class NotificationManager
{
$result = [];
foreach (Yii::$app->moduleManager->getModules(['includeCoreModules' => true]) as $module) {
if ($module instanceof \humhub\components\Module && $module->hasNotifications()) {
if ($module instanceof Module && $module->hasNotifications()) {
$result = array_merge($result, $this->createNotifications($module->getNotifications()));
}
}