diff --git a/db/update11.7.sql b/db/update11.7.sql index a18644bde1..f177f5c124 100644 --- a/db/update11.7.sql +++ b/db/update11.7.sql @@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `zt_repofiles` ( KEY `revision` (`revision`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -ALTER TABLE `zt_bug` CHANGE `caseVersion` `caseVersion` smallint(6) NOT NULL AFTER `case`; +ALTER TABLE `zt_bug` CHANGE `caseVersion` `caseVersion` smallint(6) NOT NULL DEFAULT 1 AFTER `case`; ALTER TABLE `zt_bug` ADD `repo` mediumint(8) unsigned NOT NULL AFTER `result`; ALTER TABLE `zt_bug` ADD `lines` varchar(10) COLLATE 'utf8_general_ci' NOT NULL AFTER `repo`; ALTER TABLE `zt_bug` ADD `v1` varchar(40) COLLATE 'utf8_general_ci' NOT NULL AFTER `lines`; diff --git a/db/update12.1.sql b/db/update12.1.sql index bb00237b73..28415da435 100644 --- a/db/update12.1.sql +++ b/db/update12.1.sql @@ -7,24 +7,23 @@ CREATE TABLE `zt_tag` ( `repo` mediumint(9) NOT NULL, `name` varchar(40) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `zt_jenkins` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `id` smallint(8) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, - `account` varchar(255) DEFAULT NULL, - `serviceUrl` varchar(255) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `account` varchar(30) DEFAULT NULL, + `password` varchar(30) NOT NULL, + `encrypt` varchar(30) NOT NULL DEFAULT 'plain', `token` varchar(255) DEFAULT NULL, - `desc` text NOT NULL, `createdBy` varchar(30) NOT NULL, `createdDate` datetime NOT NULL, `editedBy` varchar(30) NOT NULL, `editedDate` datetime NOT NULL, `deleted` enum('0','1') NOT NULL DEFAULT '0', - `password` varchar(30) NOT NULL, - `encrypt` varchar(30) NOT NULL DEFAULT 'plain', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `zt_cijob` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, @@ -49,7 +48,7 @@ CREATE TABLE `zt_cijob` ( `lastExec` datetime DEFAULT NULL, `lastStatus` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `zt_cibuild` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, @@ -63,7 +62,7 @@ CREATE TABLE `zt_cibuild` ( `updateDate` datetime NOT NULL, `deleted` enum('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=75 DEFAULT CHARSET=utf8; +) 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'); diff --git a/db/zentao.sql b/db/zentao.sql index cfa4035efa..47d577b5c8 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -1,7 +1,3 @@ -CREATE DATABASE `zentao_zhonghe_testing` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; - -use zentao_zhonghe_testing; - -- DROP TABLE IF EXISTS `zt_action`; CREATE TABLE IF NOT EXISTS `zt_action` ( `id` mediumint(8) unsigned NOT NULL auto_increment, @@ -93,7 +89,7 @@ CREATE TABLE IF NOT EXISTS `zt_bug` ( `duplicateBug` mediumint(8) unsigned NOT NULL, `linkBug` varchar(255) NOT NULL, `case` mediumint(8) unsigned NOT NULL, - `caseVersion` smallint(6) NOT NULL, + `caseVersion` smallint(6) NOT NULL DEFAULT 1, `result` mediumint(8) unsigned NOT NULL, `repo` mediumint(8) unsigned NOT NULL, `entry` varchar(255) NOT NULL, @@ -1111,24 +1107,23 @@ CREATE TABLE `zt_tag` ( `repo` mediumint(9) NOT NULL, `name` varchar(40) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `zt_jenkins` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `id` smallint(8) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, - `account` varchar(255) DEFAULT NULL, - `serviceUrl` varchar(255) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `account` varchar(30) DEFAULT NULL, + `password` varchar(30) NOT NULL, + `encrypt` varchar(30) NOT NULL DEFAULT 'plain', `token` varchar(255) DEFAULT NULL, - `desc` text NOT NULL, `createdBy` varchar(30) NOT NULL, `createdDate` datetime NOT NULL, `editedBy` varchar(30) NOT NULL, `editedDate` datetime NOT NULL, `deleted` enum('0','1') NOT NULL DEFAULT '0', - `password` varchar(30) NOT NULL, - `encrypt` varchar(30) NOT NULL DEFAULT 'plain', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `zt_cijob` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, @@ -1153,7 +1148,7 @@ CREATE TABLE `zt_cijob` ( `lastExec` datetime DEFAULT NULL, `lastStatus` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `zt_cibuild` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, @@ -1167,7 +1162,7 @@ CREATE TABLE `zt_cibuild` ( `updateDate` datetime NOT NULL, `deleted` enum('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=75 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES ('*', '*', '*', '*', '*', '', '监控定时任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00'), diff --git a/lib/purifier/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php b/lib/purifier/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php index f95de5bbfe..e1db6d333e 100644 --- a/lib/purifier/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php +++ b/lib/purifier/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php @@ -89,18 +89,20 @@ 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'; } } @@ -110,46 +112,51 @@ 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); } } diff --git a/lib/purifier/HTMLPurifier/AttrDef/CSS/Border.php b/lib/purifier/HTMLPurifier/AttrDef/CSS/Border.php index bd310ff231..63dda3e4f5 100644 --- a/lib/purifier/HTMLPurifier/AttrDef/CSS/Border.php +++ b/lib/purifier/HTMLPurifier/AttrDef/CSS/Border.php @@ -37,12 +37,15 @@ 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; diff --git a/lib/purifier/HTMLPurifier/AttrDef/CSS/ListStyle.php b/lib/purifier/HTMLPurifier/AttrDef/CSS/ListStyle.php index b4cce9a9df..89d7c7e405 100644 --- a/lib/purifier/HTMLPurifier/AttrDef/CSS/ListStyle.php +++ b/lib/purifier/HTMLPurifier/AttrDef/CSS/ListStyle.php @@ -35,9 +35,7 @@ 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 @@ -51,27 +49,28 @@ 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; } } @@ -81,30 +80,21 @@ 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 ($caught['position']) $ret[] = $caught['position']; + + if (empty($ret)) return false; - if (empty($ret)) { - return false; - } return implode(' ', $ret); } } diff --git a/lib/purifier/HTMLPurifier/AttrDef/CSS/Number.php b/lib/purifier/HTMLPurifier/AttrDef/CSS/Number.php index c78f6c9dfb..989364944d 100644 --- a/lib/purifier/HTMLPurifier/AttrDef/CSS/Number.php +++ b/lib/purifier/HTMLPurifier/AttrDef/CSS/Number.php @@ -32,49 +32,44 @@ 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; diff --git a/lib/purifier/HTMLPurifier/AttrDef/CSS/Percentage.php b/lib/purifier/HTMLPurifier/AttrDef/CSS/Percentage.php index aac1a6f5fc..7609b6e3f3 100644 --- a/lib/purifier/HTMLPurifier/AttrDef/CSS/Percentage.php +++ b/lib/purifier/HTMLPurifier/AttrDef/CSS/Percentage.php @@ -30,23 +30,18 @@ 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%"; } } diff --git a/lib/purifier/HTMLPurifier/AttrDef/CSS/TextDecoration.php b/lib/purifier/HTMLPurifier/AttrDef/CSS/TextDecoration.php index 3992de0e60..3df498b9d9 100644 --- a/lib/purifier/HTMLPurifier/AttrDef/CSS/TextDecoration.php +++ b/lib/purifier/HTMLPurifier/AttrDef/CSS/TextDecoration.php @@ -24,21 +24,17 @@ 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; } } diff --git a/lib/purifier/HTMLPurifier/AttrTransform/EnumToCSS.php b/lib/purifier/HTMLPurifier/AttrTransform/EnumToCSS.php index e2bfbf0072..10f14099d7 100644 --- a/lib/purifier/HTMLPurifier/AttrTransform/EnumToCSS.php +++ b/lib/purifier/HTMLPurifier/AttrTransform/EnumToCSS.php @@ -46,20 +46,15 @@ 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 (!$this->caseSensitive) $value = strtolower($value); + + if (!isset($this->enumToCSS[$value])) return $attr; - if (!isset($this->enumToCSS[$value])) { - return $attr; - } $this->prependCSS($attr, $this->enumToCSS[$value]); return $attr; } diff --git a/lib/purifier/HTMLPurifier/AttrTransform/Name.php b/lib/purifier/HTMLPurifier/AttrTransform/Name.php index a874d0f7ae..3a30305c01 100644 --- a/lib/purifier/HTMLPurifier/AttrTransform/Name.php +++ b/lib/purifier/HTMLPurifier/AttrTransform/Name.php @@ -15,16 +15,13 @@ 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; } diff --git a/lib/purifier/HTMLPurifier/AttrTransform/TargetBlank.php b/lib/purifier/HTMLPurifier/AttrTransform/TargetBlank.php index f66dcf8c4e..6ea2c6ef20 100644 --- a/lib/purifier/HTMLPurifier/AttrTransform/TargetBlank.php +++ b/lib/purifier/HTMLPurifier/AttrTransform/TargetBlank.php @@ -27,17 +27,14 @@ 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; } } diff --git a/lib/purifier/HTMLPurifier/AttrTransform/Textarea.php b/lib/purifier/HTMLPurifier/AttrTransform/Textarea.php index 182fdda74f..b17a9f6058 100644 --- a/lib/purifier/HTMLPurifier/AttrTransform/Textarea.php +++ b/lib/purifier/HTMLPurifier/AttrTransform/Textarea.php @@ -14,12 +14,10 @@ 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; } } diff --git a/lib/purifier/HTMLPurifier/ChildDef/Custom.php b/lib/purifier/HTMLPurifier/ChildDef/Custom.php index 1047cd8e8b..cc819fc748 100644 --- a/lib/purifier/HTMLPurifier/ChildDef/Custom.php +++ b/lib/purifier/HTMLPurifier/ChildDef/Custom.php @@ -45,9 +45,8 @@ 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; diff --git a/lib/purifier/HTMLPurifier/HTMLModule/Iframe.php b/lib/purifier/HTMLPurifier/HTMLModule/Iframe.php index 2c9bdc5803..afa491d4d3 100644 --- a/lib/purifier/HTMLPurifier/HTMLModule/Iframe.php +++ b/lib/purifier/HTMLPurifier/HTMLModule/Iframe.php @@ -25,9 +25,8 @@ 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', diff --git a/lib/purifier/HTMLPurifier/Printer/HTMLDefinition.php b/lib/purifier/HTMLPurifier/Printer/HTMLDefinition.php index 679d19ba3a..728462bee7 100644 --- a/lib/purifier/HTMLPurifier/Printer/HTMLDefinition.php +++ b/lib/purifier/HTMLPurifier/Printer/HTMLDefinition.php @@ -137,25 +137,29 @@ 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)); @@ -166,9 +170,7 @@ 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); } @@ -188,17 +190,22 @@ 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', @@ -213,7 +220,8 @@ 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', @@ -232,7 +240,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer 0 ); - } elseif ($def->type == 'custom') { + } elseif ($def->type == 'custom') + { $ret .= $this->element( 'td', @@ -240,7 +249,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer $def->dtd_regex ); - } else { + } else + { $ret .= $this->element( 'td', '' . ucfirst($def->type) . ': ' . @@ -262,10 +272,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); @@ -296,10 +306,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 = " . $this->getClass($obj, 'AttrDef_') . ''; } return $this->listify($list); diff --git a/lib/scm/scm.class.php b/lib/scm/scm.class.php index 5e2c30782e..47bb839220 100644 --- a/lib/scm/scm.class.php +++ b/lib/scm/scm.class.php @@ -104,19 +104,19 @@ class scm $entityIds = $matches[3][$i]; $currArr = $allCommands[$entityType][$action]; - if (empty($currArr)) { - $currArr = []; - } + if (empty($currArr)) $currArr = []; + $newArr = explode(",", $entityIds); $allCommands[$entityType][$action] = array_keys(array_flip($currArr) + array_flip($newArr)); - if ($entityType === 'story') { + if ($entityType === 'story') + { $stories = array_merge($stories, $newArr); - } - if ($entityType === 'task') { + } else if ($entityType === 'task') + { $tasks = array_merge($tasks, $newArr); - } - if ($entityType === 'bug') { + } else if ($entityType === 'bug') + { $bugs = array_merge($bugs, $newArr); } @@ -144,9 +144,8 @@ class scm { $entityIds = $matches[1]; - if (empty($taskToBuild)) { - $taskToBuild = []; - } + if (empty($taskToBuild)) $taskToBuild = []; + $newArr = explode(",", $entityIds); $jobToBuild = array_keys(array_flip($taskToBuild) + array_flip($newArr)); } diff --git a/module/ci/model.php b/module/ci/model.php index c667c7c7df..7e02393f7f 100644 --- a/module/ci/model.php +++ b/module/ci/model.php @@ -74,16 +74,19 @@ class ciModel extends model ->autoCheck() ->exec(); - if ($job->triggerType === 'schedule') { + if ($job->triggerType === 'schedule') + { $jobId = $this->dao->lastInsertID(); $arr = explode(":", $job->scheduleTime); $hour = $arr[0]; $min = $arr[1]; - if ($job->scheduleDay == 'everyDay') { + if ($job->scheduleDay == 'everyDay') + { $days = '1-7'; - } else if ($job->scheduleDay == 'workDay') { + } else if ($job->scheduleDay == 'workDay') + { $days = '1-5'; } @@ -125,7 +128,8 @@ class ciModel extends model ->where('id')->eq($id) ->exec(); - if ($job->triggerType === 'schedule') { + if ($job->triggerType === 'schedule') + { $command = 'moduleName=ci&methodName=exeJob&parm=' . $id; $arr = explode(":", $job->scheduleTime); @@ -133,9 +137,11 @@ class ciModel extends model $min = $arr[1]; $jobId = $this->dao->lastInsertID(); - if ($job->scheduleDay == 'everyDay') { + if ($job->scheduleDay == 'everyDay') + { $days = '1-7'; - } else if ($job->scheduleDay == 'workDay') { + } else if ($job->scheduleDay == 'workDay') + { $days = '2-6'; } @@ -161,15 +167,13 @@ class ciModel extends model */ public function exeJob($jobID) { - $po = $this->dao->select('job.id jobId, job.name jobName, job.repo, job.jenkinsJob, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.account,jenkins.token,jenkins.password') + $job = $this->dao->select('job.id jobId, job.name jobName, job.repo, job.jenkinsJob, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.account,jenkins.token,jenkins.password') ->from(TABLE_CI_JOB)->alias('job') ->leftJoin(TABLE_JENKINS)->alias('jenkins')->on('job.jenkins=jenkins.id') ->where('job.id')->eq($jobID) ->fetch(); - if (!$po) { - return false; - } + if (!$job) return false; $jenkinsServer = $po->serviceUrl; $jenkinsUser = $po->account; @@ -274,7 +278,8 @@ class ciModel extends model $queueUrl = sprintf('%s/queue/item/%s/api/json', $jenkinsServer, $po->queueItem); $response = common::http($queueUrl); - if (strripos($response,"404") > -1) { // queue expired, use another api + if (strripos($response,"404") > -1) + { // queue expired, use another api $infoUrl = sprintf('%s/job/%s/%s/api/json', $jenkinsServer, $po->jenkinsJob, $po->queueItem); $response = common::http($infoUrl); $buildInfo = json_decode($response); @@ -286,7 +291,8 @@ class ciModel extends model $logs = json_decode($response); $this->dao->update(TABLE_CI_BUILD)->set('logs')->eq($response)->where('id')->eq($po->id)->exec(); - } else { + } else + { $queueInfo = json_decode($response); if (!empty($queueInfo->executable)) { diff --git a/module/ci/view/browsejob.html.php b/module/ci/view/browsejob.html.php index 80f9b673c6..3f9e5b01cb 100644 --- a/module/ci/view/browsejob.html.php +++ b/module/ci/view/browsejob.html.php @@ -54,7 +54,8 @@ common::printIcon('ci', 'browseBuild', "jobID=$id", '', 'list', 'file-text'); common::printIcon('ci', 'editJob', "jobID=$id", '', 'list', 'edit'); - if (common::hasPriv('ci', 'deleteJob')) { + if (common::hasPriv('ci', 'deleteJob')) + { $deleteURL = $this->createLink('ci', 'deleteJob', "jobID=$id&confirm=yes"); echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"jobList\", confirmDelete)", '', '', "title='{$lang->job->delete}' class='btn'"); } diff --git a/module/git/model.php b/module/git/model.php index fd45df8aa0..4715e2fb6f 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -103,7 +103,8 @@ class gitModel extends model $allCommands = []; foreach ($logs as $log) { $this->printLog("parsing log {$log->revision}"); - if ($log->revision == $savedRevision) { + if ($log->revision == $savedRevision) + { $this->printLog("{$log->revision} alread parsed, commit it"); continue; } @@ -152,12 +153,14 @@ class gitModel extends model $arriveLastTag = false; $jobToBuild = []; foreach ($tags as $tag) { - if (!empty($savedTag) && $tag === $savedTag) { // get the last build tag position + if (!empty($savedTag) && $tag === $savedTag) // get the last build tag position + { $arriveLastTag = true; continue; } - if (!empty($savedTag) && !$arriveLastTag) { // not get + if (!empty($savedTag) && !$arriveLastTag) // not get + { continue; } diff --git a/module/jenkins/view/browse.html.php b/module/jenkins/view/browse.html.php index 5a2866dfb9..cd3b5c9d2d 100644 --- a/module/jenkins/view/browse.html.php +++ b/module/jenkins/view/browse.html.php @@ -36,7 +36,8 @@ createLink('jenkins', 'delete', "jenkinsID=$id&confirm=yes"); echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"jenkinsList\", confirmDelete)", '', '', "title='{$lang->jenkins->delete}' class='btn'"); } diff --git a/module/repo/js/create.js b/module/repo/js/create.js index 9538c69367..808e0ec8dd 100644 --- a/module/repo/js/create.js +++ b/module/repo/js/create.js @@ -4,12 +4,14 @@ $(function() }); function scmChanged(scm) { - if(scm == 'Git') { + if(scm == 'Git') + { $('.account-fields').addClass('hidden'); $('.tips-git').removeClass('hidden'); $('.tips-svn').addClass('hidden'); - } else { + } else + { $('.account-fields').removeClass('hidden'); $('.tips-git').addClass('hidden'); diff --git a/module/repo/js/edit.js b/module/repo/js/edit.js index 9538c69367..808e0ec8dd 100644 --- a/module/repo/js/edit.js +++ b/module/repo/js/edit.js @@ -4,12 +4,14 @@ $(function() }); function scmChanged(scm) { - if(scm == 'Git') { + if(scm == 'Git') + { $('.account-fields').addClass('hidden'); $('.tips-git').removeClass('hidden'); $('.tips-svn').addClass('hidden'); - } else { + } else + { $('.account-fields').removeClass('hidden'); $('.tips-git').addClass('hidden'); diff --git a/module/repo/view/maintain.html.php b/module/repo/view/maintain.html.php index 828bdd3491..be8ee41ff9 100644 --- a/module/repo/view/maintain.html.php +++ b/module/repo/view/maintain.html.php @@ -37,7 +37,8 @@ createLink('repo', 'delete', "repoID=$id&confirm=yes"); echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"repoList\", confirmDelete)", '', '', "title='{$lang->repo->delete}' class='btn'"); } diff --git a/module/svn/model.php b/module/svn/model.php index 3ccc123633..a2547bce46 100644 --- a/module/svn/model.php +++ b/module/svn/model.php @@ -103,7 +103,8 @@ class svnModel extends model $allCommands = []; foreach ($logs as $log) { $this->printLog("parsing log {$log->revision}"); - if ($log->revision == $savedRevision) { + if ($log->revision == $savedRevision) + { $this->printLog("{$log->revision} alread parsed, commit it"); continue; } @@ -152,7 +153,8 @@ class svnModel extends model if(!empty($tags)) { $jobToBuild = []; foreach ($tags as $tag) { - if ($savedTags[$tag]) { // old + if ($savedTags[$tag]) // old + { continue; } @@ -348,9 +350,8 @@ class svnModel extends model public function getRepoTags($repo) { $path = $repo->path; - if (substr($path, -1) != '/') { - $path .= '/'; - } + if (substr($path, -1) != '/') $path .= '/'; + $path = str_replace("/trunk/","/tags/", $path); $parsedTags = array(); @@ -360,9 +361,7 @@ class svnModel extends model exec($cmd, $list, $return); foreach($list as $line) { - if (substr($path, -1) == '/') { - $line = substr($line, 0, strlen($line) - 1); - } + if (substr($path, -1) == '/') $line = substr($line, 0, strlen($line) - 1); $parsedTags[] = $line; } diff --git a/www/js/misc/highlight/export.html b/www/js/misc/highlight/export.html index 86ac892848..5512354a7b 100755 --- a/www/js/misc/highlight/export.html +++ b/www/js/misc/highlight/export.html @@ -42,9 +42,11 @@ Copyright (c) Vladimir Gubarkov } function copyToBuffer(textToCopy) { - if (window.clipboardData) { // IE + if (window.clipboardData) + { // IE window.clipboardData.setData("Text", textToCopy); - } else if (window.netscape) { // FF + } else if (window.netscape) + { // FF // from http://developer.mozilla.org/en/docs/Using_the_Clipboard netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);