From 4338f6726bfbb38b3808d250a2f54e6785ee2503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Thu, 7 Dec 2006 12:46:46 +0000 Subject: [PATCH] strstr -> strpos fix by thomas koch --- etemplate/inc/class.boetemplate.inc.php | 4 ++-- etemplate/inc/class.so_sql.inc.php | 14 +++++++------- etemplate/inc/class.uietemplate.inc.php | 25 +++++++++++++------------ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/etemplate/inc/class.boetemplate.inc.php b/etemplate/inc/class.boetemplate.inc.php index 52dc9742cc..de2b715498 100644 --- a/etemplate/inc/class.boetemplate.inc.php +++ b/etemplate/inc/class.boetemplate.inc.php @@ -70,7 +70,7 @@ { $tname = &$name['name']; } - $tname = (@strstr($tname,'.') === False && !empty($tname) ? + $tname = (strpos($tname,'.') === false && !empty($tname) ? (is_array($load_via) ? $load_via['name'] : $load_via).'.':'').$tname; if (empty($tname) || !$this->read($name,'','',0,'',$load_via)) @@ -148,7 +148,7 @@ function expand_name($name,$c,$row,$c_='',$row_='',$cont='') { $is_index_in_content = $name[0] == '@'; - if (@strstr($name,'$') !== False) + if (strpos($name,'$') !== false) { if (!$cont) { diff --git a/etemplate/inc/class.so_sql.inc.php b/etemplate/inc/class.so_sql.inc.php index 65807e3792..778c915146 100644 --- a/etemplate/inc/class.so_sql.inc.php +++ b/etemplate/inc/class.so_sql.inc.php @@ -341,7 +341,7 @@ class so_sql { foreach(is_array($extra_cols) ? $extra_cols : array($extra_cols) as $col) { - if (stristr($col,'as')) $col = preg_replace('/^.*as *([a-z0-9_]+) *$/i','\\1',$col); + if (FALSE!==stripos($col,'as')) $col = preg_replace('/^.*as *([a-z0-9_]+) *$/i','\\1',$col); $cols[$col] = $col; } } @@ -514,7 +514,7 @@ class so_sql { $db_col = $col; } - if ($wildcard || strstr($criteria[$col],'*') || strstr($criteria[$col],'?') || $criteria[$col]{0} == '!') + if ($wildcard || strpos($criteria[$col],'*')!==false || strpos($criteria[$col],'?')!==false || $criteria[$col]{0} == '!') { $cmp_op = ' LIKE '; if ($criteria[$col]{0} == '!') @@ -524,7 +524,7 @@ class so_sql } $query[] = $db_col.$cmp_op.$this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$criteria[$col]).$wildcard); } - elseif (strstr($db_col,'.')) // we have a table-name specified + elseif (strpos($db_col,'.')!==false) // we have a table-name specified { list($table,$only_col) = explode('.',$db_col); @@ -616,7 +616,7 @@ class so_sql $num_rows = 0; // as spec. in max_matches in the user-prefs if (is_array($start)) list($start,$num_rows) = $start; - if ($order_by && !stristr($order_by,'ORDER BY') && !stristr($order_by,'GROUP BY')) + if ($order_by && stripos($order_by,'ORDER BY')===false && stripos($order_by,'GROUP BY')===false) { $order_by = 'ORDER BY '.$order_by; } @@ -665,7 +665,7 @@ class so_sql { $mysql_calc_rows = 'SQL_CALC_FOUND_ROWS '; } - elseif (!$need_full_no_count && (!$join || stristr($join,'LEFT JOIN'))) + elseif (!$need_full_no_count && (!$join || stripos($join,'LEFT JOIN')!==false)) { $this->db->select($this->table_name,'COUNT(*)',$query,__LINE__,__FILE__); $this->total = $this->db->next_record() ? (int) $this->db->f(0) : false; @@ -726,7 +726,7 @@ class so_sql } else // only the specified columns { - if (stristr($col,'as')) $col = preg_replace('/^.*as +([a-z0-9_]+) *$/i','\\1',$col); + if (stripos($col,'as')!==false) $col = preg_replace('/^.*as +([a-z0-9_]+) *$/i','\\1',$col); if (($db_col = array_search($col,$this->db_cols)) !== false) { $cols[$db_col] = $col; @@ -742,7 +742,7 @@ class so_sql { foreach(is_array($extra_cols) ? $extra_cols : explode(',',$extra_cols) as $col) { - if (stristr($col,'as ')) $col = preg_replace('/^.*as +([a-z0-9_]+) *$/i','\\1',$col); + if (stripos($col,'as ')!==false) $col = preg_replace('/^.*as +([a-z0-9_]+) *$/i','\\1',$col); if (($db_col = array_search($col,$this->db_cols)) !== false) { $cols[$db_col] = $col; diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 029849c91c..39b34ff15e 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -253,8 +253,9 @@ } echo $GLOBALS['egw_info']['etemplate']['hook_content'].$html; - if (!@$GLOBALS['egw_info']['etemplate']['hooked'] && - (!isset($_GET['menuaction']) || strstr($_SERVER['PHP_SELF'],'process_exec.php'))) + if (!$GLOBALS['egw_info']['etemplate']['hooked'] && + (!isset($_GET['menuaction']) || + strpos($_SERVER['PHP_SELF'],'process_exec.php')!==false)) { if((int) $output_mode == 2) { @@ -597,7 +598,7 @@ } $rows[".$row"] .= $this->html->formatOptions($height,'height'); list($cl) = explode(',',$class); - if ($cl == '@' || $cl && strstr($cl,'$') !== false) + if ($cl == '@' || $cl && strpos($cl,'$') !== false) { $cl = $this->expand_name($cl,0,$r,$content['.c'],$content['.row'],$content); } @@ -809,7 +810,7 @@ { $cell['size'] = $this->expand_name($cell['size'],$show_c,$show_row,$content['.c'],$content['.row'],$content); } - if ($cell['disabled'] && $readonlys[$name] !== false || $readonly && $cell['type'] == 'button' && $cell['size'] && !strstr($cell['size'],',')) + if ($cell['disabled'] && $readonlys[$name] !== false || $readonly && $cell['type'] == 'button' && $cell['size'] && strpos($cell['size'],',')===false) { if ($this->rows == 1) { return ''; // if only one row omit cell @@ -921,8 +922,8 @@ $value = strlen($value) > 1 && !$cell['no_lang'] ? lang($value) : $value; $value = nl2br($this->html->htmlspecialchars($value)); if ($activate_links) $value = $this->html->activate_links($value); - if ($value != '' && $style && strstr($style,'b')) $value = $this->html->bold($value); - if ($value != '' && $style && strstr($style,'i')) $value = $this->html->italic($value); + if ($value != '' && $style && strpos($style,'b')!==false) $value = $this->html->bold($value); + if ($value != '' && $style && strpos($style,'i')!==false) $value = $this->html->italic($value); $html .= $value; if ($help) { @@ -1326,7 +1327,7 @@ case 'image': // size: [link],[link_target],[imagemap],[link_popup] $image = $value != '' ? $value : $name; list($app,$img) = explode('/',$image,2); - if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strstr($img,'/')) + if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img,'/')!==false) { $img = $image; list($app) = explode('.',$this->name); @@ -1514,8 +1515,8 @@ $label = lang($label); } $accesskey = false; - if (($accesskey = $label && strstr($label,'&')) && $accesskey[1] != ' ' && $form_name != '' && - (($pos = strpos($accesskey,';')) === False || $pos > 5)) + if (($accesskey = $label && strpos($label,'&')!==false) && $accesskey[1] != ' ' && $form_name != '' && + (($pos = strpos($accesskey,';')) === false || $pos > 5)) { $label = str_replace('&'.$accesskey[1],''.$accesskey[1].'',$label); $accesskey = $accesskey[1]; @@ -1525,9 +1526,9 @@ $label = $this->html->label($label,$label_for ? $this->form_name($cname,$label_for) : $form_name.($set_val?"[$set_val]":''),$accesskey); } - if ($type == 'radio' || $type == 'checkbox' || $label && strstr($label,'%s')) // default for radio is label after the button + if ($type == 'radio' || $type == 'checkbox' || $label && strpos($label,'%s')!==false) // default for radio is label after the button { - $html = strstr($label,'%s') ? str_replace('%s',$html,$label) : $html.' '.$label; + $html = strpos($label,'%s')!==false ? str_replace('%s',$html,$label) : $html.' '.$label; } elseif (($html = $label . ' ' . $html) == ' ') { @@ -1608,7 +1609,7 @@ } // replace xajax calls to code in widgets, with the "etemplate" handler, // this allows to call widgets with the current app, otherwise everyone would need etemplate run rights - if (strstr($on,"xajax_doXMLHTTP('etemplate.")) + if (strpos($on,"xajax_doXMLHTTP('etemplate.")!==false) { $on = preg_replace("/^xajax_doXMLHTTP\('etemplate\.([a-z]+_widget\.[a-zA-Z0-9_]+)\'/",'xajax_doXMLHTTP(\''.$GLOBALS['egw_info']['flags']['currentapp'].'.\\1.etemplate\'',$on); }