Viewing file: crud_helper.php (2.22 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php /* CRUD */ function CRUD($link, $act){
if (strpos("01",$act)===false) die("ชนิดของ Link ต้องเป็น0 1 เท่านั้น"); $flg = false; if ($act){ return $link; }else{ $link=trim($link); $s = strtolower($link); //---------------------------------------------------------------- //find image name // $input="images/del.gif"; // $output = "images/delgrey.gif"; // use explode fn // $this->createGreyFromGifJpg($input, $output); //--------------------------------------------------------------- //rename imagename.gif to imagenamegrey.gif $pGif = strpos($s,".gif"); if ($pGif===false){ }else{ $ss = substr_replace($link, "grey", $pGif).substr($link, $pGif); $link = $ss; $s = strtolower($link); }
//rename imagename.jpg to imagenamegrey.jpg $pJpg = strpos($s,".jp"); if ($pJpg===false){ }else{ $ss = substr_replace($link, "grey", $pJpg).substr($link, $pJpg); $link = $ss; $s = strtolower($link); } //add disabled to input tag $pos = strpos($s,"input"); if ($pos===false){ }else{ $ss = substr_replace($link, "input disabled", $pos).substr($link, $pos+5); $link = $ss; $s = strtolower($link); } //change onclick-->onklick $pOnClick = strpos($s,"onclick"); if ($pOnClick===false){ }else{ $ss = substr_replace($link, "onklick", $pOnClick).substr($link, $pOnClick+7); $link = $ss; $s = strtolower($link); } //////////// //disable tag A $pHref = strpos($s,"href"); if ($pHref===false){ }else{ $ss = substr_replace($link, "href1", $pHref).substr($link, $pHref+4); $link = $ss; $s = strtolower($link); } // disable anchor $pAnc = strpos($s,"anchor"); if ($pAnc===false){ }else{ $pAnchor = strpos($s,"<img"); $ss = substr($s, $pAnchor); $pBAnchor = strpos($ss,"/>"); $link = substr($ss,0,$pBAnchor); $s = strtolower($link); }
//disable text between tag A and not have tag img $pImg = strpos($s,"<img")===false; if ($pImg===false){ if (substr($s,0,2)=="<a"){ $p1 = strpos($link,">"); $p2 = strpos($link,"</"); $ss = "<font color=#999999>".substr($link, $p1+1,$p2)."</font>"; $link = $ss; $s = strtolower($link); } } return $link; } }
?>
|