| version 1.21, 2002/10/29 16:17:57 |
version 1.22, 2002/10/29 16:54:47 |
|
|
| * http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.20 2002/10/29 15:25:03 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.21 2002/10/29 16:17:57 nepto Exp $ */ |
| |
|
| /* phpMyEdit intro {{{ */ |
/* phpMyEdit intro {{{ */ |
| /* |
/* |
|
|
| return $ret; |
return $ret; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| function htmlDisplay($field, $str, $usemask = true, $usecodec = true, $disallow_empty = true) /* {{{ */ |
function htmlDisplay($field, $str, $usemask = true, $usecodec = true, $disallow_empty = true, $escape = true) /* {{{ */ |
| { |
{ |
| // undo the add slashes |
// undo the add slashes |
| $str = stripslashes($str); |
$str = stripslashes($str); |
| |
|
| // if there's a field mask, use it as first arg to sprintf |
// if there's a field mask, use it as first arg to sprintf |
| if (isset($field['mask']) && $usemask) { |
if (isset($field['mask']) && $usemask) { |
| $str = sprintf($field['mask'],$str); |
$str = sprintf($field['mask'], $str); |
| } |
} |
| if ($usecodec) { |
if ($usecodec) { // if db codec is in effect, use it |
| // if db codec is in effect, use it |
isset($field['dbdecode']) && $str = eval('return '.$field['dbdecode'].'(\''.$str.'\');'); |
| if (isset($field['dbdecode'])) { |
$escape && $str = htmlspecialchars($str); |
| $str = htmlspecialchars(eval('return '.$field['dbdecode'].'(\''.$str.'\');')); |
|
| } else { |
|
| $str = htmlspecialchars($str); |
|
| } |
|
| } |
} |
| if ($disallow_empty) { |
if ($disallow_empty) { |
| strlen($str) <= 0 && $str = ' '; |
strlen($str) <= 0 && $str = ' '; |
|
|
| { |
{ |
| echo '<td>'; |
echo '<td>'; |
| if ($this->is_values2($k, $row["qf$k"])) { |
if ($this->is_values2($k, $row["qf$k"])) { |
| echo $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']]; |
echo nl2br($this->htmlDisplay($k, $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']], true, true, true, false)); |
| } else if ($row["qf$k"] == '') { |
|
| echo ' '; |
|
| } else { |
} else { |
| echo nl2br($this->htmlDisplay($this->fdd[$k], $row["qf$k"])); |
echo nl2br($this->htmlDisplay($this->fdd[$k], $row["qf$k"])); |
| } |
} |
|
|
| : ''; |
: ''; |
| isset($this->fdd[$k]['URLprefix']) && $urllink = $this->fdd[$k]['URLprefix'].$urllink; |
isset($this->fdd[$k]['URLprefix']) && $urllink = $this->fdd[$k]['URLprefix'].$urllink; |
| isset($this->fdd[$k]['URLpostfix']) && $urllink .= $this->fdd[$k]['URLpostfix']; |
isset($this->fdd[$k]['URLpostfix']) && $urllink .= $this->fdd[$k]['URLpostfix']; |
| $urllink = htmlspecialchars($urllink); |
if (strlen($urllink) <= 0 || strlen($urldisp) <= 0) { |
| $urldisp = htmlspecialchars($urldisp); |
echo ' '; |
| echo '<a '.$target.'class="pme_a_u" href="'.$urllink.'">'.$urldisp.'</a>'; |
} else { |
| |
$urllink = htmlspecialchars($urllink); |
| |
$urldisp = htmlspecialchars($urldisp); |
| |
echo '<a '.$target.'class="pme_a_u" href="'.$urllink.'">'.$urldisp.'</a>'; |
| |
} |
| } elseif (isset($this->fdd[$k]['datemask'])) { |
} elseif (isset($this->fdd[$k]['datemask'])) { |
| // display date according to a mask if any |
// display date according to a mask if any |
| //echo $this->mdate_set($row[$k],$this->fdd[$k]['type'],$this->fdd[$k]['datemask']); |
//echo $this->mdate_set($row[$k],$this->fdd[$k]['type'],$this->fdd[$k]['datemask']); |
|
|
| } else { |
} else { |
| // it's a normal field |
// it's a normal field |
| if ($this->is_values2($k, $row["qf$k"])) { |
if ($this->is_values2($k, $row["qf$k"])) { |
| $shortdisp = $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']]; |
$escape_flag = false; |
| //$shortdisp .= ' ('.$row['qf'.$k.'_idx'].')'; |
$shortdisp = $this->fdd[$k]['values2'][$row['qf'.$k.'_idx']]; |
| !isset($shortdisp) && $shortdisp = ''; |
|
| echo $shortdisp; |
|
| } else { |
} else { |
| |
$escape_flag = true; |
| $shortdisp = $row["qf$k"]; |
$shortdisp = $row["qf$k"]; |
| if ($this->fdd[$k]['strip_tags']) { |
if ($this->fdd[$k]['strip_tags']) { |
| $shortdisp = strip_tags($shortdisp); |
$shortdisp = strip_tags($shortdisp); |
|
|
| $shortdisp = ereg_replace("[\r\n\t ]+",' ',$shortdisp); |
$shortdisp = ereg_replace("[\r\n\t ]+",' ',$shortdisp); |
| $shortdisp = substr($shortdisp,0,$this->fdd[$k]['trimlen']-3).'...'; |
$shortdisp = substr($shortdisp,0,$this->fdd[$k]['trimlen']-3).'...'; |
| } |
} |
| echo nl2br($this->htmlDisplay($this->fdd[$k], $shortdisp)); |
|
| } |
} |
| |
echo nl2br($this->htmlDisplay($this->fdd[$k], $shortdisp, true, true, true, $escape_flag)); |
| } |
} |
| } else { |
} else { |
| // it's hidden or a password |
// it's hidden or a password |