diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index f24311419d..169811319a 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -902,3 +902,39 @@ function htmlSpecialString($string, $flags = '', $encoding = 'UTF-8') if(!$flags) $flags = defined('ENT_SUBSTITUTE') ? ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 : ENT_QUOTES; return htmlspecialchars($string, $flags, $encoding); } + +if (!function_exists('array_column')) +{ + function array_column(array $input, $columnKey, $indexKey = null) + { + $output = array(); + + foreach ($input as $row) { + $key = $value = null; + $keySet = $valueSet = false; + + if (null !== $indexKey && array_key_exists($indexKey, $row)) { + $keySet = true; + $key = (string) $row[$indexKey]; + } + + if (null === $columnKey) { + $valueSet = true; + $value = $row; + } elseif (\is_array($row) && \array_key_exists($columnKey, $row)) { + $valueSet = true; + $value = $row[$columnKey]; + } + + if ($valueSet) { + if ($keySet) { + $output[$key] = $value; + } else { + $output[] = $value; + } + } + } + + return $output; + } +} \ No newline at end of file diff --git a/module/bug/model.php b/module/bug/model.php index dabf556e08..c99469976d 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1901,7 +1901,7 @@ class bugModel extends model { $data->name = isset($executions[$executionID]) ? $executions[$executionID] : $this->lang->report->undefined; $data->title = $data->name; - if(mb_strlen($data->name) > $maxLength) $data->name = mb_substr($data->name, 0, $maxLength) . '...'; + if(mb_strlen($data->name, 'UTF-8') > $maxLength) $data->name = mb_substr($data->name, 0, $maxLength, 'UTF-8') . '...'; } return $datas; } diff --git a/module/convert/view/index.html.php b/module/convert/view/index.html.php index 7acb751d44..eb2fb5860b 100644 --- a/module/convert/view/index.html.php +++ b/module/convert/view/index.html.php @@ -1,29 +1,29 @@ - - * @package ZenTaoPMS - * @version $Id: index.html.php 4129 2013-01-18 01:58:14Z wwccss $ - */ -?> - -
{$lang->extension->unremovedFiles}
"; - echo join($removeCommands, '" . html::commonButton($lang->extension->viewAvailable, 'onclick=parent.location.href="' . inlink('browse', 'type=available') . '"') . '
'; ?> diff --git a/module/group/model.php b/module/group/model.php index 379decbf3b..967dd0e306 100644 --- a/module/group/model.php +++ b/module/group/model.php @@ -501,7 +501,7 @@ class groupModel extends model $data = new stdclass(); $data->group = $groupID; $data->account = $account; - $data->project = implode($programs[$account], ','); + $data->project = implode(',', $programs[$account]); $this->dao->replace(TABLE_USERGROUP)->data($data)->exec(); foreach($programs[$account] as $programID) diff --git a/module/testtask/model.php b/module/testtask/model.php index b72a34b67c..83cd58c946 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1953,9 +1953,9 @@ class testtaskModel extends model { $result->stepResults[0]['real'] = (string)$matchNode->$failure; } - elseif(isset($matchNode->$failure[0])) + elseif(isset($matchNode->{$failure}[0])) { - $result->stepResults[0]['real'] = (string)$matchNode->$failure[0]; + $result->stepResults[0]['real'] = (string)$matchNode->{$failure}[0]; } else { diff --git a/tools/compatibility/check.sh b/tools/compatibility/check.sh index 44e2acc02f..3150d746dc 100644 --- a/tools/compatibility/check.sh +++ b/tools/compatibility/check.sh @@ -1,3 +1,9 @@ +#!/usr/bin/env bash + +set -eu + +cd "$(dirname $0)" + php phpcs.phar --config-set installed_paths $PWD/PHPCompatibility > /dev/null; php ./phpcs.phar --standard=ruleset.xml --ignore=*.css ../../module;