From 6a990be52058ea5394694bdee4ebb676bcf3f9d8 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 30 Apr 2007 05:42:05 +0000 Subject: [PATCH] worked around stupid php5.2 empty haystack warnings --- phpgwapi/inc/class.asyncservice.inc.php | 4 ++-- phpgwapi/inc/class.bolink.inc.php | 6 +++--- phpgwapi/inc/class.browser.inc.php | 10 +++++----- phpgwapi/inc/class.common.inc.php | 2 +- phpgwapi/inc/class.contacts.inc.php | 2 +- phpgwapi/inc/class.egw_framework.inc.php | 2 +- phpgwapi/inc/class.jscalendar.inc.php | 2 +- phpgwapi/inc/class.network.inc.php | 2 +- phpgwapi/inc/class.phpmailer.inc.php | 2 +- phpgwapi/inc/class.smtp.php | 2 +- phpgwapi/inc/class.translation.inc.php | 2 +- phpgwapi/inc/class.xml.inc.php | 3 +-- phpgwapi/templates/idots/class.idots_framework.inc.php | 2 +- 13 files changed, 20 insertions(+), 21 deletions(-) diff --git a/phpgwapi/inc/class.asyncservice.inc.php b/phpgwapi/inc/class.asyncservice.inc.php index cbbc887761..b2a9ad1377 100644 --- a/phpgwapi/inc/class.asyncservice.inc.php +++ b/phpgwapi/inc/class.asyncservice.inc.php @@ -183,7 +183,7 @@ foreach($time as $t) { - if (strstr($t,'-') !== False && strstr($t,'/') === False) + if (strpos($t,'-') !== False && strpos($t,'/') === False) { list($min,$max) = $arr = explode('-',$t); @@ -638,7 +638,7 @@ $times['error'] .= $line; } } - elseif (strstr($line,$this->cronline) !== False) + elseif (strpos($line,$this->cronline) !== False) { $cron_units = array('min','hour','day','month','dow'); foreach($cron_units as $n => $u) diff --git a/phpgwapi/inc/class.bolink.inc.php b/phpgwapi/inc/class.bolink.inc.php index c3798b7f5c..4bf97bb271 100644 --- a/phpgwapi/inc/class.bolink.inc.php +++ b/phpgwapi/inc/class.bolink.inc.php @@ -300,7 +300,7 @@ class bolink extends solink { if (is_array($id)) { - if (!strstr($app_link_id,':')) $app_link_id = $this->temp_link_id($app2,$id2); // create link_id of temporary link, if not given + if (strpos($app_link_id,':') === false) $app_link_id = $this->temp_link_id($app2,$id2); // create link_id of temporary link, if not given if (isset($id[$app_link_id]) && is_array($id[$app_link_id])) // check for unlinked-marker { @@ -697,7 +697,7 @@ class bolink extends solink @reset($this->link_pathes); while ((list($valid,$trans) = @each($this->link_pathes)) && !$tfname) { // check case-insensitive for WIN etc. - $check = $valid[0] == '\\' || strstr(':',$valid) ? 'eregi' : 'ereg'; + $check = $valid[0] == '\\' || strpos(':',$valid) !== false ? 'eregi' : 'ereg'; $valid2 = str_replace('\\','/',$valid); //echo "

attach_file: ereg('".$this->send_file_ips[$valid]."', '$file[ip]')=".ereg($this->send_file_ips[$valid],$file['ip'])."

\n"; if ($check('^('.$valid2.')(.*)$',$file['path'],$parts) && @@ -870,7 +870,7 @@ class bolink extends solink */ function is_win_path($path) { - return $path[0] == '\\' || strstr($path,':'); + return $path{0} == '\\' || $path{1} == ':'; } /** diff --git a/phpgwapi/inc/class.browser.inc.php b/phpgwapi/inc/class.browser.inc.php index f7ff2f2d7b..68e98328b9 100644 --- a/phpgwapi/inc/class.browser.inc.php +++ b/phpgwapi/inc/class.browser.inc.php @@ -76,23 +76,23 @@ /* Determine platform */ - if(strstr($HTTP_USER_AGENT,'Win')) + if(strpos($HTTP_USER_AGENT,'Win') !== false) { $this->BROWSER_PLATFORM='Win'; } - elseif(strstr($HTTP_USER_AGENT,'Mac')) + elseif(strpos($HTTP_USER_AGENT,'Mac') !== false) { $this->BROWSER_PLATFORM='Mac'; } - elseif(strstr($HTTP_USER_AGENT,'Linux')) + elseif(strpos($HTTP_USER_AGENT,'Linux') !== false) { $this->BROWSER_PLATFORM='Linux'; } - elseif(strstr($HTTP_USER_AGENT,'Unix')) + elseif(strpos($HTTP_USER_AGENT,'Unix') !== false) { $this->BROWSER_PLATFORM='Unix'; } - elseif(strstr($HTTP_USER_AGENT,'Beos')) + elseif(strpos($HTTP_USER_AGENT,'Beos') !== false) { $this->BROWSER_PLATFORM='Beos'; } diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index 0f4346c88f..9db7cd0e17 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -777,7 +777,7 @@ while ($f = readdir($d)) { $ext = strtolower(strrchr($f,'.')); - if (($ext == '.gif' || $ext == '.png') && strstr($f,'navbar') === False) + if (($ext == '.gif' || $ext == '.png') && strpos($f,'navbar') === False) { return True; } diff --git a/phpgwapi/inc/class.contacts.inc.php b/phpgwapi/inc/class.contacts.inc.php index e1595cbbef..04b250e61b 100644 --- a/phpgwapi/inc/class.contacts.inc.php +++ b/phpgwapi/inc/class.contacts.inc.php @@ -130,7 +130,7 @@ class contacts extends bocontacts $fields = explode(',',$fields); } if (!$order) $order = $fields ? $fields[0] : 'org_name,n_family,n_given'; - if ($order && !strstr($order,'_')) $order = 'contact_'.$order; + if ($order && strpos($order,'_') === false) $order = 'contact_'.$order; //echo '

contacts::search('.($cquery ? $cquery.'*' : $query).','.print_r($fields,true).",'$order $sort','','".($cquery ? '' : '%')."',false,'OR',".(!$limit ? 'false' : "array($start,$limit)").",".print_r($sfilter,true).");

\n"; $rows =& $this->search($cquery ? $cquery.'*' : $query,$fields,$order.($sort ? ' '.$sort : ''),'', diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 4794a7b3c4..7c413e02a6 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -448,7 +448,7 @@ class egw_framework if ($data['status'] == 4) { $apps[$app]['target'] = ' target="'.$app.'" onClick="'."if (this != '') { window.open(this+'". - (strstr($apps[$app]['url'],'?') ? '&' : '?'). + (strpos($apps[$app]['url'],'?') !== false ? '&' : '?'). "referer='+encodeURI(location),this.target,'width=800,height=600,scrollbars=yes,resizable=yes'); return false; } else { return true; }".'"'; } elseif(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) diff --git a/phpgwapi/inc/class.jscalendar.inc.php b/phpgwapi/inc/class.jscalendar.inc.php index 14d14c8283..cc70265a4a 100644 --- a/phpgwapi/inc/class.jscalendar.inc.php +++ b/phpgwapi/inc/class.jscalendar.inc.php @@ -215,7 +215,7 @@ Calendar.setup( $fields[$n] = $i; break; } - if (strstr($long_name,$fields[$n]) == $long_name) // partcial match => multibyte saver + if (@strstr($long_name,$fields[$n]) == $long_name) // partcial match => multibyte saver { $partcial_match = $i; } diff --git a/phpgwapi/inc/class.network.inc.php b/phpgwapi/inc/class.network.inc.php index 013d8a55c7..8be2ca64c4 100644 --- a/phpgwapi/inc/class.network.inc.php +++ b/phpgwapi/inc/class.network.inc.php @@ -185,7 +185,7 @@ function gethttpsocketfile($file,$user='',$passwd='',$string=False) { $server = str_replace('http://','',$file); - $file = strstr($server,'/'); + $file = @strstr($server,'/'); $server = str_replace($file,'',$server); //allows for access to http-auth pages - added by Dave Hall diff --git a/phpgwapi/inc/class.phpmailer.inc.php b/phpgwapi/inc/class.phpmailer.inc.php index 82ce0974d5..a4a8bb39ef 100644 --- a/phpgwapi/inc/class.phpmailer.inc.php +++ b/phpgwapi/inc/class.phpmailer.inc.php @@ -566,7 +566,7 @@ class PHPMailer // Retry while there is no connection while($index < count($hosts) && $connection == false) { - if(strstr($hosts[$index], ":")) + if(strpos($hosts[$index], ":") !== false) list($host, $port) = explode(":", $hosts[$index]); else { diff --git a/phpgwapi/inc/class.smtp.php b/phpgwapi/inc/class.smtp.php index 5eda180619..cb7b021c23 100644 --- a/phpgwapi/inc/class.smtp.php +++ b/phpgwapi/inc/class.smtp.php @@ -317,7 +317,7 @@ class SMTP # headers. $field = substr($lines[0],0,strpos($lines[0],":")); $in_headers = false; - if(!empty($field) && !strstr($field," ")) { + if(!empty($field) && strpos($field," ") === false) { $in_headers = true; } diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php index 3e74ec4431..69436580a8 100644 --- a/phpgwapi/inc/class.translation.inc.php +++ b/phpgwapi/inc/class.translation.inc.php @@ -349,7 +349,7 @@ { $data = &$this->charsets[$charset = strtolower($this->db->f('charset'))]; $lang = $this->langs[$this->db->f('lang')].' ('.$this->db->f('lang').')'; - if ($distinct || strstr($data,$lang) === false) + if ($distinct || strpos($data,$lang) === false) { $data .= ($data ? ', ' : $charset.': ').$lang; } diff --git a/phpgwapi/inc/class.xml.inc.php b/phpgwapi/inc/class.xml.inc.php index 31893581c0..efd56fc1e7 100644 --- a/phpgwapi/inc/class.xml.inc.php +++ b/phpgwapi/inc/class.xml.inc.php @@ -3310,8 +3310,7 @@ class XML function prestr ( $string, $delimiter ) { // Return the substring. - return substr($string, 0, strlen($string) - strlen(strstr($string, - "$delimiter"))); + return substr($string, 0, strlen($string) - strlen(@strstr($string,$delimiter))); } /** diff --git a/phpgwapi/templates/idots/class.idots_framework.inc.php b/phpgwapi/templates/idots/class.idots_framework.inc.php index ba6729676e..1a1752579b 100644 --- a/phpgwapi/templates/idots/class.idots_framework.inc.php +++ b/phpgwapi/templates/idots/class.idots_framework.inc.php @@ -770,7 +770,7 @@ function _sidebox_menu_item($item_link='',$item_text='') $var['item_link'] = $item_link['link']; if ($item_link['target']) { - if (strstr($item_link['target'], 'target=')) { + if (strpos($item_link['target'], 'target=') !== false) { $var['target'] = $item_link['target']; } else { $var['target'] = ' target="' . $item_link['target'] . '"';