Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2020-02-11 15:13:47 +08:00
24 changed files with 209 additions and 174 deletions
+1 -1
View File
@@ -61,4 +61,4 @@ CREATE TABLE `zt_cibuild` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES
('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=checkBuildStatus', '同步Jenkins任务状态', 'zentao', -1, 'normal', '0000-00-00 00:00:00');
('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=checkBuildStatus', '同步Jenkins任务状态', 'zentao', 1, 'normal', '0000-00-00 00:00:00');
-5
View File
@@ -319,11 +319,6 @@ class baseValidater
return self::checkInt($length, $min, $max);
}
public static function checkIsUrl($var)
{
return strlen(trim($var)) != 0;
}
/**
* 检查不为空。
* Not empty checking.
@@ -89,20 +89,18 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
);
foreach ($bits as $bit) {
if ($bit === '') continue;
if ($bit === '') {
continue;
}
// test for keyword
$lbit = ctype_lower($bit) ? $bit : strtolower($bit);
if (isset($lookup[$lbit]))
{
if (isset($lookup[$lbit])) {
$status = $lookup[$lbit];
if ($status == 'c')
{
if ($i == 0)
{
if ($status == 'c') {
if ($i == 0) {
$status = 'ch';
} else
{
} else {
$status = 'cv';
}
}
@@ -112,51 +110,46 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
// test for length
$r = $this->length->validate($bit, $config, $context);
if ($r !== false)
{
if ($r !== false) {
$measures[] = $r;
$i++;
}
// test for percentage
$r = $this->percentage->validate($bit, $config, $context);
if ($r !== false)
{
if ($r !== false) {
$measures[] = $r;
$i++;
}
}
if (!$i) return false; // no valid values were caught
if (!$i) {
return false;
} // no valid values were caught
$ret = array();
// first keyword
if ($keywords['h'])
{
if ($keywords['h']) {
$ret[] = $keywords['h'];
} elseif ($keywords['ch'])
{
} elseif ($keywords['ch']) {
$ret[] = $keywords['ch'];
$keywords['cv'] = false; // prevent re-use: center = center center
} elseif (count($measures))
{
} elseif (count($measures)) {
$ret[] = array_shift($measures);
}
if ($keywords['v'])
{
if ($keywords['v']) {
$ret[] = $keywords['v'];
} elseif ($keywords['cv'])
{
} elseif ($keywords['cv']) {
$ret[] = $keywords['cv'];
} elseif (count($measures))
{
} elseif (count($measures)) {
$ret[] = array_shift($measures);
}
if (empty($ret)) return false;
if (empty($ret)) {
return false;
}
return implode(' ', $ret);
}
}
@@ -37,15 +37,12 @@ class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
$done = array(); // segments we've finished
$ret = ''; // return value
foreach ($bits as $bit) {
foreach ($this->info as $propname => $validator)
{
if (isset($done[$propname]))
{
foreach ($this->info as $propname => $validator) {
if (isset($done[$propname])) {
continue;
}
$r = $validator->validate($bit, $config, $context);
if ($r !== false)
{
if ($r !== false) {
$ret .= $r . ' ';
$done[$propname] = true;
break;
@@ -35,7 +35,9 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
{
// regular pre-processing
$string = $this->parseCDATA($string);
if ($string === '') return false;
if ($string === '') {
return false;
}
// assumes URI doesn't have spaces in it
$bits = explode(' ', strtolower($string)); // bits to process
@@ -49,28 +51,27 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
$none = false;
foreach ($bits as $bit) {
if ($i >= 3) return;
// optimization bit
if ($bit === '') continue;
foreach ($caught as $key => $status)
{
if ($status !== false) continue;
if ($i >= 3) {
return;
} // optimization bit
if ($bit === '') {
continue;
}
foreach ($caught as $key => $status) {
if ($status !== false) {
continue;
}
$r = $this->info['list-style-' . $key]->validate($bit, $config, $context);
if ($r === false) continue;
if ($r === 'none')
{
if ($none)
{
if ($r === false) {
continue;
}
if ($r === 'none') {
if ($none) {
continue;
} else
{
} else {
$none = true;
}
if ($key == 'image')
{
if ($key == 'image') {
continue;
}
}
@@ -80,21 +81,30 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
}
}
if (!$i) return false;
if (!$i) {
return false;
}
$ret = array();
// construct type
if ($caught['type']) $ret[] = $caught['type'];
if ($caught['type']) {
$ret[] = $caught['type'];
}
// construct image
if ($caught['image']) $ret[] = $caught['image'];
if ($caught['image']) {
$ret[] = $caught['image'];
}
// construct position
if ($caught['position']) $ret[] = $caught['position'];
if (empty($ret)) return false;
if ($caught['position']) {
$ret[] = $caught['position'];
}
if (empty($ret)) {
return false;
}
return implode(' ', $ret);
}
}
@@ -32,44 +32,49 @@ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
{
$number = $this->parseCDATA($number);
if ($number === '') return false;
if ($number === '0') return '0';
if ($number === '') {
return false;
}
if ($number === '0') {
return '0';
}
$sign = '';
switch ($number[0])
{
switch ($number[0]) {
case '-':
if ($this->non_negative) return false;
if ($this->non_negative) {
return false;
}
$sign = '-';
case '+':
$number = substr($number, 1);
}
if (ctype_digit($number))
{
if (ctype_digit($number)) {
$number = ltrim($number, '0');
return $number ? $sign . $number : '0';
}
// Period is the only non-numeric character allowed
if (strpos($number, '.') === false) return false;
if (strpos($number, '.') === false) {
return false;
}
list($left, $right) = explode('.', $number, 2);
if ($left === '' && $right === '') return false;
if ($left !== '' && !ctype_digit($left)) return false;
if ($left === '' && $right === '') {
return false;
}
if ($left !== '' && !ctype_digit($left)) {
return false;
}
$left = ltrim($left, '0');
$right = rtrim($right, '0');
if ($right === '')
{
if ($right === '') {
return $left ? $sign . $left : '0';
} elseif (!ctype_digit($right))
{
} elseif (!ctype_digit($right)) {
return false;
}
return $sign . $left . '.' . $right;
@@ -30,18 +30,23 @@ class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
{
$string = $this->parseCDATA($string);
if ($string === '') return false;
if ($string === '') {
return false;
}
$length = strlen($string);
if ($length === 1) return false;
if ($string[$length - 1] !== '%') return false;
if ($length === 1) {
return false;
}
if ($string[$length - 1] !== '%') {
return false;
}
$number = substr($string, 0, $length - 1);
$number = $this->number_def->validate($number, $config, $context);
if ($number === false) return false;
if ($number === false) {
return false;
}
return "$number%";
}
}
@@ -24,17 +24,21 @@ class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
$string = strtolower($this->parseCDATA($string));
if ($string === 'none') return $string;
if ($string === 'none') {
return $string;
}
$parts = explode(' ', $string);
$final = '';
foreach ($parts as $part)
{
if (isset($allowed_values[$part])) $final .= $part . ' ';
foreach ($parts as $part) {
if (isset($allowed_values[$part])) {
$final .= $part . ' ';
}
}
$final = rtrim($final);
if ($final === '') return false;
if ($final === '') {
return false;
}
return $final;
}
}
@@ -46,15 +46,20 @@ class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform
*/
public function transform($attr, $config, $context)
{
if (!isset($attr[$this->attr])) return $attr;
if (!isset($attr[$this->attr])) {
return $attr;
}
$value = trim($attr[$this->attr]);
unset($attr[$this->attr]);
if (!$this->caseSensitive) $value = strtolower($value);
if (!isset($this->enumToCSS[$value])) return $attr;
if (!$this->caseSensitive) {
$value = strtolower($value);
}
if (!isset($this->enumToCSS[$value])) {
return $attr;
}
$this->prependCSS($attr, $this->enumToCSS[$value]);
return $attr;
}
@@ -15,13 +15,16 @@ class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
public function transform($attr, $config, $context)
{
// Abort early if we're using relaxed definition of name
if ($config->get('HTML.Attr.Name.UseCDATA')) return $attr;
if (!isset($attr['name'])) return $attr;
if ($config->get('HTML.Attr.Name.UseCDATA')) {
return $attr;
}
if (!isset($attr['name'])) {
return $attr;
}
$id = $this->confiscateAttr($attr, 'name');
if (isset($attr['id'])) return $attr;
if (isset($attr['id'])) {
return $attr;
}
$attr['id'] = $id;
return $attr;
}
@@ -27,14 +27,17 @@ class HTMLPurifier_AttrTransform_TargetBlank extends HTMLPurifier_AttrTransform
*/
public function transform($attr, $config, $context)
{
if (!isset($attr['href'])) return $attr;
if (!isset($attr['href'])) {
return $attr;
}
// XXX Kind of inefficient
$url = $this->parser->parse($attr['href']);
$scheme = $url->getSchemeObj($config, $context);
if ($scheme->browsable && !$url->isBenign($config, $context)) $attr['target'] = '_blank';
if ($scheme->browsable && !$url->isBenign($config, $context)) {
$attr['target'] = '_blank';
}
return $attr;
}
}
@@ -14,10 +14,12 @@ class HTMLPurifier_AttrTransform_Textarea extends HTMLPurifier_AttrTransform
public function transform($attr, $config, $context)
{
// Calculated from Firefox
if (!isset($attr['cols'])) $attr['cols'] = '22';
if (!isset($attr['rows'])) $attr['rows'] = '3';
if (!isset($attr['cols'])) {
$attr['cols'] = '22';
}
if (!isset($attr['rows'])) {
$attr['rows'] = '3';
}
return $attr;
}
}
@@ -45,8 +45,9 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
protected function _compileRegex()
{
$raw = str_replace(' ', '', $this->dtd_regex);
if ($raw{0} != '(') $raw = "($raw)";
if ($raw{0} != '(') {
$raw = "($raw)";
}
$el = '[#a-zA-Z0-9_.-]+';
$reg = $raw;
@@ -25,8 +25,9 @@ class HTMLPurifier_HTMLModule_Iframe extends HTMLPurifier_HTMLModule
*/
public function setup($config)
{
if ($config->get('HTML.SafeIframe')) $this->safe = true;
if ($config->get('HTML.SafeIframe')) {
$this->safe = true;
}
$this->addElement(
'iframe',
'Inline',
@@ -137,29 +137,25 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->element('th', 'Inline content');
$ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No');
$ret .= $this->end('tr');
if (!empty($def->excludes))
{
if (!empty($def->excludes)) {
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Excludes');
$ret .= $this->element('td', $this->listifyTagLookup($def->excludes));
$ret .= $this->end('tr');
}
if (!empty($def->attr_transform_pre))
{
if (!empty($def->attr_transform_pre)) {
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Pre-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre));
$ret .= $this->end('tr');
}
if (!empty($def->attr_transform_post))
{
if (!empty($def->attr_transform_post)) {
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Post-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post));
$ret .= $this->end('tr');
}
if (!empty($def->auto_close))
{
if (!empty($def->auto_close)) {
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Auto closed by');
$ret .= $this->element('td', $this->listifyTagLookup($def->auto_close));
@@ -170,7 +166,9 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->element('td', $this->listifyAttr($def->attr), array(), 0);
$ret .= $this->end('tr');
if (!empty($def->required_attr)) $ret .= $this->row('Required attributes', $this->listify($def->required_attr));
if (!empty($def->required_attr)) {
$ret .= $this->row('Required attributes', $this->listify($def->required_attr));
}
$ret .= $this->renderChildren($def->child);
}
@@ -190,22 +188,17 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->start('tr');
$elements = array();
$attr = array();
if (isset($def->elements))
{
if ($def->type == 'strictblockquote')
{
if (isset($def->elements)) {
if ($def->type == 'strictblockquote') {
$def->validateChildren(array(), $this->config, $context);
}
$elements = $def->elements;
}
if ($def->type == 'chameleon')
{
if ($def->type == 'chameleon') {
$attr['rowspan'] = 2;
} elseif ($def->type == 'empty')
{
} elseif ($def->type == 'empty') {
$elements = array();
} elseif ($def->type == 'table')
{
} elseif ($def->type == 'table') {
$elements = array_flip(
array(
'col',
@@ -220,8 +213,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
}
$ret .= $this->element('th', 'Allowed children', $attr);
if ($def->type == 'chameleon')
{
if ($def->type == 'chameleon') {
$ret .= $this->element(
'td',
@@ -240,8 +232,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
0
);
} elseif ($def->type == 'custom')
{
} elseif ($def->type == 'custom') {
$ret .= $this->element(
'td',
@@ -249,8 +240,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$def->dtd_regex
);
} else
{
} else {
$ret .= $this->element(
'td',
'<em>' . ucfirst($def->type) . '</em>: ' .
@@ -272,10 +262,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
{
ksort($array);
$list = array();
foreach ($array as $name => $discard)
{
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue;
foreach ($array as $name => $discard) {
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) {
continue;
}
$list[] = $name;
}
return $this->listify($list);
@@ -306,10 +296,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
{
ksort($array);
$list = array();
foreach ($array as $name => $obj)
{
if ($obj === false) continue;
foreach ($array as $name => $obj) {
if ($obj === false) {
continue;
}
$list[] = "$name&nbsp;=&nbsp;<i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
}
return $this->listify($list);
+3 -3
View File
@@ -1,6 +1,9 @@
<?php
class scm
{
public $commitCommandRegx = '/\s*([a-z]+)\s+((?:build)|(?:story)|(?:task)|(?:bug))\s+#((?:\d|,)+)\s*/i';
public $tagCommandRegx = '/build[\-_]#((?:\d|,)+)/i';
public $engine;
public function setEngine($repo)
@@ -73,9 +76,6 @@ class scm
return $this->engine->getCommits($version, $count, $branch);
}
public $commitCommandRegx = '/\s*([a-z]+)\s+((?:build)|(?:story)|(?:task)|(?:bug))\s+#((?:\d|,)+)\s*/i';
public $tagCommandRegx = '/build[\-_]#((?:\d|,)+)/i';
/**
* Parse the comment of git, extract object id list from it.
*
+6 -4
View File
@@ -27,9 +27,9 @@ class ci extends control
common::setMenuVars($this->lang->ci->menu, $key, $repoID);
}
if(common::hasPriv('ci', 'createJob') and strpos(',browsejob,', $this->methodName) > -1) {
$this->lang->modulePageActions = html::a(helper::createLink('ci', 'createJob'), "<i class='icon icon-plus'></i> " . $this->lang->ci->create, '', "class='btn btn-primary'");
}
// if(common::hasPriv('ci', 'createJob') and strpos(',browsejob,', $this->methodName) > -1) {
// $this->lang->modulePageActions = html::a(helper::createLink('ci', 'createJob'), "<i class='icon icon-plus'></i> " . $this->lang->ci->create, '', "class='btn btn-primary'");
// }
}
/**
@@ -68,6 +68,7 @@ class ci extends control
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->method = 'browseJob';
$this->display();
}
@@ -191,7 +192,8 @@ class ci extends control
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->module = 'ci';
$this->view->method = 'browseBuild';
$this->display();
}
+2
View File
@@ -5,6 +5,8 @@ $lang->ci->at = ' at ';
$lang->ci->jenkins = 'Jenkins';
$lang->ci->repo = 'Repo';
$lang->ci->job = 'Job';
$lang->ci->task = 'Job';
$lang->ci->history = 'Build';
$lang->ci->browse = 'View';
$lang->ci->create = 'Create';
$lang->ci->edit = 'Edit';
+2 -4
View File
@@ -5,6 +5,8 @@ $lang->ci->at = '于';
$lang->ci->jenkins = 'Jenkins';
$lang->ci->repo = '版本库';
$lang->ci->job = '构建';
$lang->ci->task = '任务';
$lang->ci->history = '历史';
$lang->ci->browse = '浏览';
$lang->ci->create = '创建';
$lang->ci->edit = '编辑';
@@ -18,10 +20,6 @@ $lang->job->edit = '编辑构建任务';
$lang->job->exeNow = '立即执行';
$lang->job->delete = '删除构建任务';
$lang->job->confirmDelete = '确认删除该构建任务吗?';
$lang->job->repo = '构建状态';
$lang->job->buildStatus = '构建状态';
$lang->job->buildStatus = '构建状态';
$lang->job->buildStatus = '构建状态';
$lang->job->buildTime = '构建时间';
+12 -8
View File
@@ -12,16 +12,20 @@
?>
<?php include '../../common/view/header.html.php'; ?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<div class="page-title">
<strong>
<?php echo $lang->job->browseBuild; ?>
</strong>
</div>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php
$buildName = $build ? " <span class='label label-danger'>Build:{$build->name}</span>" : '';
echo html::a($this->inlink('browsejob', ""), "<span class='text'>{$lang->ci->task}</span>", '', "class='btn btn-link" . ('browseJob' == $method ? ' btn-active-text' : '') . "'");
echo html::a($this->inlink('browsebuild', ""), "<span class='text'>{$lang->ci->history}</span>", '', "class='btn btn-link" . ('browseBuild' == $method ? ' btn-active-text' : '') . "'");
?>
</div>
<div class="btn-toolbar pull-right">
<?php echo html::a(helper::createLink('ci', "browseJob", ""), "<i class='icon icon-back icon-sm'></i> ". $lang->goback, '', "class='btn btn-secondary'");?>
<?php
if(common::hasPriv('ci', 'createJob')) {
common::printLink('ci', 'createJob', "", "<i class='icon icon-plus'></i> " . $lang->ci->create, '', "class='btn btn-primary'");
}
?>
</div>
</div>
+18 -1
View File
@@ -13,6 +13,23 @@
<?php include '../../common/view/header.html.php';?>
<?php js::set('confirmDelete', $lang->job->confirmDelete); ?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php
$buildName = $build ? " <span class='label label-danger'>Build:{$build->name}</span>" : '';
echo html::a($this->inlink('browsejob', ""), "<span class='text'>{$lang->ci->task}</span>", '', "class='btn btn-link" . ('browseJob' == $method ? ' btn-active-text' : '') . "'");
echo html::a($this->inlink('browsebuild', ""), "<span class='text'>{$lang->ci->history}</span>", '', "class='btn btn-link" . ('browseBuild' == $method ? ' btn-active-text' : '') . "'");
?>
</div>
<div class="btn-toolbar pull-right">
<?php
if(common::hasPriv('ci', 'createJob')) {
common::printLink('ci', 'createJob', "", "<i class='icon icon-plus'></i> " . $lang->ci->create, '', "class='btn btn-primary'");
}
?>
</div>
</div>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<form class='main-table' id='ajaxForm' method='post'>
@@ -26,7 +43,7 @@
<?php common::printOrderLink('name', $orderBy, $vars, $lang->job->name); ?></th>
<th class='w-200px text-left'>
<?php common::printOrderLink('repo', $orderBy, $vars, $lang->job->repo); ?></th>
<?php common::printOrderLink('repo', $orderBy, $vars, $lang->ci->repo); ?></th>
<th class='w-150px text-left'><?php echo $lang->job->triggerType; ?></th>
<th class='w-200px text-left'>
+1 -1
View File
@@ -29,7 +29,7 @@
<td colspan="2" ></td>
</tr>
<tr>
<th><?php echo $lang->job->repo; ?></th>
<th><?php echo $lang->ci->repo; ?></th>
<td><?php echo html::select('repo', $repoList, '',
"onchange='repoTypeChanged(this.value)' class='form-control chosen'"); ?></td>
+1 -1
View File
@@ -29,7 +29,7 @@
<td colspan="2" ></td>
</tr>
<tr>
<th><?php echo $lang->job->repo; ?></th>
<th><?php echo $lang->ci->repo; ?></th>
<td><?php echo html::select('repo', $repoList, $job->repoType,
"onchange='repoTypeChanged(this.value)' class='form-control chosen'"); ?></td>
+1 -3
View File
@@ -207,9 +207,7 @@ class cron extends control
if(isset($params['moduleName']) and isset($params['methodName']))
{
$this->app->loadConfig($params['moduleName']);
$paramArr = explode(",", $params['parm']);
$output = $this->fetch($params['moduleName'], $params['methodName'], $paramArr);
$output = $this->fetch($params['moduleName'], $params['methodName']);
}
}
elseif(isset($crons[$id]) and $crons[$id]->type == 'system')