strstr -> strpos fix by thomas koch

This commit is contained in:
Cornelius Weiß 2006-12-07 12:46:46 +00:00
parent 4421d6cf09
commit 4338f6726b
3 changed files with 22 additions and 21 deletions

View File

@ -70,7 +70,7 @@
{ {
$tname = &$name['name']; $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; (is_array($load_via) ? $load_via['name'] : $load_via).'.':'').$tname;
if (empty($tname) || !$this->read($name,'','',0,'',$load_via)) if (empty($tname) || !$this->read($name,'','',0,'',$load_via))
@ -148,7 +148,7 @@
function expand_name($name,$c,$row,$c_='',$row_='',$cont='') function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
{ {
$is_index_in_content = $name[0] == '@'; $is_index_in_content = $name[0] == '@';
if (@strstr($name,'$') !== False) if (strpos($name,'$') !== false)
{ {
if (!$cont) if (!$cont)
{ {

View File

@ -341,7 +341,7 @@ class so_sql
{ {
foreach(is_array($extra_cols) ? $extra_cols : array($extra_cols) as $col) 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; $cols[$col] = $col;
} }
} }
@ -514,7 +514,7 @@ class so_sql
{ {
$db_col = $col; $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 '; $cmp_op = ' LIKE ';
if ($criteria[$col]{0} == '!') 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); $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); 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 $num_rows = 0; // as spec. in max_matches in the user-prefs
if (is_array($start)) list($start,$num_rows) = $start; 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; $order_by = 'ORDER BY '.$order_by;
} }
@ -665,7 +665,7 @@ class so_sql
{ {
$mysql_calc_rows = 'SQL_CALC_FOUND_ROWS '; $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->db->select($this->table_name,'COUNT(*)',$query,__LINE__,__FILE__);
$this->total = $this->db->next_record() ? (int) $this->db->f(0) : false; $this->total = $this->db->next_record() ? (int) $this->db->f(0) : false;
@ -726,7 +726,7 @@ class so_sql
} }
else // only the specified columns 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) if (($db_col = array_search($col,$this->db_cols)) !== false)
{ {
$cols[$db_col] = $col; $cols[$db_col] = $col;
@ -742,7 +742,7 @@ class so_sql
{ {
foreach(is_array($extra_cols) ? $extra_cols : explode(',',$extra_cols) as $col) 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) if (($db_col = array_search($col,$this->db_cols)) !== false)
{ {
$cols[$db_col] = $col; $cols[$db_col] = $col;

View File

@ -253,8 +253,9 @@
} }
echo $GLOBALS['egw_info']['etemplate']['hook_content'].$html; echo $GLOBALS['egw_info']['etemplate']['hook_content'].$html;
if (!@$GLOBALS['egw_info']['etemplate']['hooked'] && if (!$GLOBALS['egw_info']['etemplate']['hooked'] &&
(!isset($_GET['menuaction']) || strstr($_SERVER['PHP_SELF'],'process_exec.php'))) (!isset($_GET['menuaction']) ||
strpos($_SERVER['PHP_SELF'],'process_exec.php')!==false))
{ {
if((int) $output_mode == 2) if((int) $output_mode == 2)
{ {
@ -597,7 +598,7 @@
} }
$rows[".$row"] .= $this->html->formatOptions($height,'height'); $rows[".$row"] .= $this->html->formatOptions($height,'height');
list($cl) = explode(',',$class); 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); $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); $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) { if ($this->rows == 1) {
return ''; // if only one row omit cell return ''; // if only one row omit cell
@ -921,8 +922,8 @@
$value = strlen($value) > 1 && !$cell['no_lang'] ? lang($value) : $value; $value = strlen($value) > 1 && !$cell['no_lang'] ? lang($value) : $value;
$value = nl2br($this->html->htmlspecialchars($value)); $value = nl2br($this->html->htmlspecialchars($value));
if ($activate_links) $value = $this->html->activate_links($value); if ($activate_links) $value = $this->html->activate_links($value);
if ($value != '' && $style && strstr($style,'b')) $value = $this->html->bold($value); if ($value != '' && $style && strpos($style,'b')!==false) $value = $this->html->bold($value);
if ($value != '' && $style && strstr($style,'i')) $value = $this->html->italic($value); if ($value != '' && $style && strpos($style,'i')!==false) $value = $this->html->italic($value);
$html .= $value; $html .= $value;
if ($help) if ($help)
{ {
@ -1326,7 +1327,7 @@
case 'image': // size: [link],[link_target],[imagemap],[link_popup] case 'image': // size: [link],[link_target],[imagemap],[link_popup]
$image = $value != '' ? $value : $name; $image = $value != '' ? $value : $name;
list($app,$img) = explode('/',$image,2); 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; $img = $image;
list($app) = explode('.',$this->name); list($app) = explode('.',$this->name);
@ -1514,8 +1515,8 @@
$label = lang($label); $label = lang($label);
} }
$accesskey = false; $accesskey = false;
if (($accesskey = $label && strstr($label,'&')) && $accesskey[1] != ' ' && $form_name != '' && if (($accesskey = $label && strpos($label,'&')!==false) && $accesskey[1] != ' ' && $form_name != '' &&
(($pos = strpos($accesskey,';')) === False || $pos > 5)) (($pos = strpos($accesskey,';')) === false || $pos > 5))
{ {
$label = str_replace('&'.$accesskey[1],'<u>'.$accesskey[1].'</u>',$label); $label = str_replace('&'.$accesskey[1],'<u>'.$accesskey[1].'</u>',$label);
$accesskey = $accesskey[1]; $accesskey = $accesskey[1];
@ -1525,9 +1526,9 @@
$label = $this->html->label($label,$label_for ? $this->form_name($cname,$label_for) : $label = $this->html->label($label,$label_for ? $this->form_name($cname,$label_for) :
$form_name.($set_val?"[$set_val]":''),$accesskey); $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) == ' ') elseif (($html = $label . ' ' . $html) == ' ')
{ {
@ -1608,7 +1609,7 @@
} }
// replace xajax calls to code in widgets, with the "etemplate" handler, // 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 // 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); $on = preg_replace("/^xajax_doXMLHTTP\('etemplate\.([a-z]+_widget\.[a-zA-Z0-9_]+)\'/",'xajax_doXMLHTTP(\''.$GLOBALS['egw_info']['flags']['currentapp'].'.\\1.etemplate\'',$on);
} }