Skip to content
Snippets Groups Projects
Commit 13450df3 authored by Jared Hancock's avatar Jared Hancock
Browse files

Quiet erroneous lint errors in osTicket source

parent 8a56e5ad
Branches
Tags
No related merge requests found
...@@ -127,7 +127,7 @@ class FAQ { ...@@ -127,7 +127,7 @@ class FAQ {
/* Same as update - but mainly called after one or more setters are changed. */ /* Same as update - but mainly called after one or more setters are changed. */
function apply() { function apply() {
//XXX: set errors and add ->getErrors() & ->getError() //XXX: set errors and add ->getErrors() & ->getError()
return $this->update($this->ht, $errors); return $this->update($this->ht, $errors); # nolint
} }
function updateTopics($ids){ function updateTopics($ids){
......
...@@ -156,7 +156,7 @@ class Filter { ...@@ -156,7 +156,7 @@ class Filter {
$rule= array_merge($extra,array('w'=>$what, 'h'=>$how, 'v'=>$val)); $rule= array_merge($extra,array('w'=>$what, 'h'=>$how, 'v'=>$val));
$rule['filter_id']=$this->getId(); $rule['filter_id']=$this->getId();
return FilterRule::create($rule,$errors); return FilterRule::create($rule,$errors); # nolint
} }
function removeRule($what, $how, $val) { function removeRule($what, $how, $val) {
...@@ -420,7 +420,7 @@ class Filter { ...@@ -420,7 +420,7 @@ class Filter {
//Success with update/create...save the rules. We can't recover from any errors at this point. //Success with update/create...save the rules. We can't recover from any errors at this point.
# Don't care about errors stashed in $xerrors # Don't care about errors stashed in $xerrors
self::save_rules($id,$vars,$xerrors); self::save_rules($id,$vars,$xerrors); # nolint
return true; return true;
} }
......
...@@ -104,7 +104,11 @@ class Format { ...@@ -104,7 +104,11 @@ class Format {
$text=Format::clickableurls($text); $text=Format::clickableurls($text);
//Wrap long words... //Wrap long words...
$text=preg_replace_callback('/\w{75,}/',create_function('$matches','return wordwrap($matches[0],70,"\n",true);'),$text); $text=preg_replace_callback('/\w{75,}/',
create_function(
'$matches', # nolint
'return wordwrap($matches[0],70,"\n",true);'), # nolint
$text);
return nl2br($text); return nl2br($text);
} }
......
...@@ -50,8 +50,10 @@ class Mail_Parse { ...@@ -50,8 +50,10 @@ class Mail_Parse {
function splitBodyHeader() { function splitBodyHeader() {
if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s",$this->mime_message, $match)) { if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s",
$this->header=$match[1]; $this->mime_message,
$match)) { # nolint
$this->header=$match[1]; # nolint
} }
} }
/** /**
......
...@@ -15,37 +15,37 @@ ...@@ -15,37 +15,37 @@
**********************************************************************/ **********************************************************************/
class PageNate { class PageNate {
var $start; var $start;
var $limit; var $limit;
var $total; var $total;
var $page; var $page;
var $pages; var $pages;
function PageNate($total,$page,$limit=20,$url='') { function PageNate($total,$page,$limit=20,$url='') {
$this->total = intval($total); $this->total = intval($total);
$this->limit = max($limit, 1 ); $this->limit = max($limit, 1 );
$this->page = max($page, 1 ); $this->page = max($page, 1 );
$this->start = max((($page-1)*$this->limit),0); $this->start = max((($page-1)*$this->limit),0);
$this->pages = ceil( $this->total / $this->limit ); $this->pages = ceil( $this->total / $this->limit );
if (($this->limit > $this->total) || ($this->page>ceil($this->total/$this->limit))) { if (($this->limit > $this->total) || ($this->page>ceil($this->total/$this->limit))) {
$this->start = 0; $this->start = 0;
} }
if (($this->limit-1)*$this->start > $this->total) { if (($this->limit-1)*$this->start > $this->total) {
$this->start -= $this->start % $this->limit; $this->start -= $this->start % $this->limit;
} }
$this->setURL($url); $this->setURL($url);
} }
function setURL($url='',$vars=''){ function setURL($url='',$vars=''){
if($url){ if($url){
if(strpos($url,'?')===false) if(strpos($url,'?')===false)
$url=$url.'?'; $url=$url.'?';
}else{ }else{
$url=THISPAGE.'?'; $url=THISPAGE.'?';
} }
$this->url=$url.$vars; $this->url=$url.$vars;
} }
function getStart() { function getStart() {
return $this->start; return $this->start;
...@@ -64,34 +64,34 @@ class PageNate { ...@@ -64,34 +64,34 @@ class PageNate {
return ceil(($this->start+1)/$this->limit); return ceil(($this->start+1)/$this->limit);
} }
function showing() { function showing() {
$html = ''; $html = '';
$from= $this->start+1; $from= $this->start+1;
if ($this->start + $this->limit < $this->total) { if ($this->start + $this->limit < $this->total) {
$to= $this->start + $this->limit; $to= $this->start + $this->limit;
} else { } else {
$to= $this->total; $to= $this->total;
} }
$html="&nbsp;Showing&nbsp;&nbsp;"; $html="&nbsp;Showing&nbsp;&nbsp;";
if ($this->total > 0) { if ($this->total > 0) {
$html .= "$from - $to of " .$this->total; $html .= "$from - $to of " .$this->total;
}else{ }else{
$html .= " 0 "; $html .= " 0 ";
} }
return $html; return $html;
} }
function getPageLinks() { function getPageLinks() {
$html = ''; $html = '';
$file =$this->url; $file =$this->url;
$displayed_span = 5; $displayed_span = 5;
$total_pages = ceil( $this->total / $this->limit ); $total_pages = ceil( $this->total / $this->limit );
$this_page = ceil( ($this->start+1) / $this->limit ); $this_page = ceil( ($this->start+1) / $this->limit );
$last=$this_page-1; $last=$this_page-1;
$next=$this_page+1; $next=$this_page+1;
$start_loop = floor($this_page-$displayed_span); $start_loop = floor($this_page-$displayed_span);
$stop_loop = ceil($this_page + $displayed_span); $stop_loop = ceil($this_page + $displayed_span);
...@@ -107,14 +107,14 @@ class PageNate { ...@@ -107,14 +107,14 @@ class PageNate {
$html .= "\n<a href=\"$file&p=$lastspan\" ><strong>&laquo;</strong></a>"; $html .= "\n<a href=\"$file&p=$lastspan\" ><strong>&laquo;</strong></a>";
} }
for ($i=$start_loop; $i <= $stop_loop; $i++) { for ($i=$start_loop; $i <= $stop_loop; $i++) {
$page = ($i - 1) * $this->limit; $page = ($i - 1) * $this->limit;
if ($i == $this_page) { if ($i == $this_page) {
$html .= "\n<b>[$i]</b>"; $html .= "\n<b>[$i]</b>";
} else { } else {
$html .= "\n<a href=\"$file&p=$i\" ><b>$i</b></a>"; $html .= "\n<a href=\"$file&p=$i\" ><b>$i</b></a>";
} }
} }
if($stop_loop<$total_pages){ if($stop_loop<$total_pages){
$nextspan=($stop_loop+$displayed_span>$total_pages)?$total_pages-$displayed_span:$stop_loop+$displayed_span; $nextspan=($stop_loop+$displayed_span>$total_pages)?$total_pages-$displayed_span:$stop_loop+$displayed_span;
$html .= "\n<a href=\"$file&p=$nextspan\" ><strong>&raquo;</strong></a>"; $html .= "\n<a href=\"$file&p=$nextspan\" ><strong>&raquo;</strong></a>";
...@@ -122,8 +122,8 @@ class PageNate { ...@@ -122,8 +122,8 @@ class PageNate {
return $html; return $html;
} }
} }
?> ?>
...@@ -147,20 +147,21 @@ class Validator { ...@@ -147,20 +147,21 @@ class Validator {
$urlregex = "^(https?)\:\/\/"; $urlregex = "^(https?)\:\/\/";
// USER AND PASS (optional) // USER AND PASS (optional)
$urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?"; $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?"; # nolint
// HOSTNAME OR IP // HOSTNAME OR IP
$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*"; // http://x = allowed (ex. http://localhost, http://routerlogin) // http://x = allowed (ex. http://localhost, http://routerlogin)
$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*"; # nolint
//$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)+"; // http://x.x = minimum //$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)+"; // http://x.x = minimum
//$urlregex .= "([a-z0-9+\$_-]+\.)*[a-z0-9+\$_-]{2,3}"; // http://x.xx(x) = minimum //$urlregex .= "([a-z0-9+\$_-]+\.)*[a-z0-9+\$_-]{2,3}"; // http://x.xx(x) = minimum
//use only one of the above //use only one of the above
// PORT (optional) // PORT (optional)
$urlregex .= "(\:[0-9]{2,5})?"; $urlregex .= "(\:[0-9]{2,5})?";
// PATH (optional) // PATH (optional)
$urlregex .= "(\/([a-z0-9+\$_-]\.?)+)*\/?"; $urlregex .= "(\/([a-z0-9+\$_-]\.?)+)*\/?"; # nolint
// GET Query (optional) // GET Query (optional)
$urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)?"; $urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)?"; # nolint
// ANCHOR (optional) // ANCHOR (optional)
$urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?\$"; $urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?\$"; # nolint
return eregi($urlregex, $url)?true:false; return eregi($urlregex, $url)?true:false;
} }
......
...@@ -47,8 +47,9 @@ ...@@ -47,8 +47,9 @@
$version=0; $version=0;
if(preg_match('/(\d{1,2}\.\d{1,2}\.\d{1,2})/', if(preg_match('/(\d{1,2}\.\d{1,2}\.\d{1,2})/',
mysql_result(db_query('SELECT VERSION()'),0,0),$matches)) mysql_result(db_query('SELECT VERSION()'),0,0),
$version=$matches[1]; $matches)) # nolint
$version=$matches[1]; # nolint
return $version; return $version;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment