-
✘✘✘ WIBUHAX0R1337 ✘✘✘
-
✘
PATCH :
/
var
/
www
/
clients
/
client4
/
web4
/
web
/
ris
/
includes
/
lib
/
Upload File:
files >> /var/www/clients/client4/web4/web/ris/includes/lib/Utilities.class.php
<?php class Utilities { /** * * @access public */ function getParam($name, $default='') { if ($this->getMethod($name) == "") { return $default; }else{ return $this->getMethod($name); } } /** * * @access private * @param name * @return */ function getMethod($name) { if (isset($_POST[$name])) { return $_POST[$name]; }else if (isset($_GET[$name])) { return $_GET[$name]; }else { return ""; } } function getSession($name, $default='') { if (!isset($_SESSION[$name])) { return $default; }else{ return $_SESSION[$name]; } } function loadScript($script) { global $g_cofig; print $g_config['ROOT_PATH']; include($g_config['ROOT_PATH'].'/load.php?filename=includes/lib/nat/'.$script); } function forwardPage($url, $delay=0) { print "<meta http-equiv=\"refresh\" content=\"$delay;url=$url\">"; } function showMessage($mess, $url='') { print "<script language = 'JavaScript'>\n"; print " mess = \"".$mess."\";\n"; print " alert(mess)\n"; print "</script>\n"; if ($url != '') { print "<meta http-equiv=\"refresh\" content=\"0;url=$url\">"; } } function redirect($sys) { return ""; } function setFormat($text, $char, $num) { return ""; } function setNumberFormat($num) { return number_format(sprintf("%01.1f", $num), 0, '.', ','); } function setMoneyFormat($num) { if ($num > 0) { return number_format(sprintf("%01.2f", $num), 2, '.', ','); }else if ($num < 0){ $num1 = number_format(sprintf("%01.2f", $num*(-1)), 2, '.', ','); return "-".$num1; }else{ return ""; } } function thumb($img_url, $w) { $html = ""; if (is_file($img_url)) { $html = '<img src="thumb.php?src='.$img_url.'&w='.$w.'" border="0" />'; } return $html; } function thumbx($img_url, $w) { $html = ""; if (is_file("../".$img_url)) { $html = '<img src="thumb.php?src='.$img_url.'&w='.$w.'" border="0" />'; } return $html; } function showImage($img_url, $max='200', $link=true, $br=true) { /* if (is_file($path)) { $html = '<img src="'.$path.'">'; $html .= '<br>'; } print $html; */ if (!is_file($img_url)) { return ""; } $currentimagesize = getimagesize($img_url); $image_width = $currentimagesize[0]; $image_height = $currentimagesize[1]; if ($image_width > $max || $image_height > $max) { if ($image_width > $max) { $sizefactor = (double)($max/$image_width); }else{ $sizefactor = (double)($max/$image_height); } }else{ $sizefactor = 1; } $newwidth = (int)($image_width * $sizefactor); $newheight = (int)($image_height * $sizefactor); $image = "<img src=\"".$img_url."\" width=".$newwidth." height=".$newheight." border=0 alt=\"\">"; if ($sizefactor != 1 && $link) { $html = "<a href='".$img_url."' target='_blank' title='ขยายภาพ'>"; $html .= $image; $html .= "</a>"; }else{ $html = $image; } $html = ($br)?$html.'<br>':$html; return $html; } function fileUpload($name, $path="./", $rewrite=false, $opt='FILE_NAME') { if (!is_dir($path)) { mkdir($path); } if (is_uploaded_file($_FILES[$name]['tmp_name'])) { $filename = $_FILES[$name]['name']; $f_ext = strrchr($filename, '.'); $f_name = substr($filename, 0, (strlen($filename)-strlen($f_ext))); if (!$rewrite) { $i=1; while (is_file($path.$filename)) { $filename = $f_name.'['.$i.']'.$f_ext; $i++; } } copy($_FILES[$name]['tmp_name'], $path.$filename); } else { $filename = ''; } switch ($opt) { case 'FILE_NAME'; $rev = $filename; break; case 'FILE_NAME_WITHOUT_EXTENSION'; $rev = $f_name; break; case 'FILE_EXTENSION'; $rev = $f_ext; break; } return $rev; } // for service method /** * */ function getScalarValue($obj, $type, $default="") { if (isset($obj) && ($obj->scalartyp()==$type)) { return $obj->scalarval(); }else{ return $default; } } function jsRemoveQuote($text) { $text = str_replace('"', '', $text); $text = str_replace("'", "\'", $text); return $text; } function clientScript($script) { print "<script language=\"JavaScript\">\n"; print $script; print "</script>\n"; } function toHTMLView($text) { $text_new = str_replace("\n", "<br>\n", $text); $text_new = str_replace(" ", " ", $text_new); return $text_new; } function toHTMLValue($text) { $text_new = str_replace('"', """, $text); return $text_new; } function linkFile($path, $text='เปิดดู', $type='', $size='', $target='_blank') { if (!is_file($path)) { return ""; } $html .= $this->getFileTypeIcon($type); $html .= '<a href="'.$path.'" target="'.$target.'">'; $html .= $text; $html .= '</a> '; $html .= '('.$this->getFileSizeFormat($size).')'; return $html; } function slinkFile($file, $text='เปิดดู', $type='', $size='', $target='_blank') { global $w_config; if (!is_file($w_config['S_DOWNLOAD_PATH'].$text)) { return ""; } $html .= $this->getFileTypeIcon($type); $html .= '<a href="sdownload.php?file='.md5($file).'" target="'.$target.'">'; $html .= $text; $html .= '</a> '; $html .= '('.$this->getFileSizeFormat($size).')'; return $html; } function getFileSizeFormat($sizeb) { $sizekb = $sizeb / 1024; $sizemb = $sizekb / 1024; $sizegb = $sizemb / 1024; $sizetb = $sizegb / 1024; $sizepb = $sizetb / 1024; if ($sizeb > 1) {$size = round($sizeb,2) . " b";} if ($sizekb > 1) {$size = round($sizekb,2) . " kb";} if ($sizemb > 1) {$size = round($sizemb,2) . " mb";} if ($sizegb > 1) {$size = round($sizegb,2) . " gb";} if ($sizetb > 1) {$size = round($sizetb,2) . " tb";} if ($sizepb > 1) {$size = round($sizepb,2) . " pb";} return $size; } function getFileTypeIcon($type, $path='pictures/icons/') { switch ($type) { case "image/gif"; $icon = "i_jpg.gif"; break; case "image/pjpeg"; $icon = "i_jpg.gif"; break; case "application/vnd.ms-excel"; $icon = "i_excel.gif"; break; case "application/pdf"; $icon = "i_pdf.gif"; break; case "application/msword"; $icon = "i_word.gif"; break; case "application/x-zip-compressed"; $icon = "i_zip.gif"; break; default; $icon = "i_file.gif"; break; } $html = '<img src="'.$path.$icon.'" hspace="2" align="absmiddle">'; return $html; } function optionInt($sel, $end, $start=0) { $html = ''; for ($i=$start; $i<=$end; $i++) { if ($i == $sel) { $html .= "<option value=\"".$i."\" selected>".$i."</option>\n"; }else{ $html .= "<option value=\"".$i."\">".$i."</option>\n"; } } return $html; } function optionIntRev($sel, $end, $start=0) { $html = ''; for ($i=$end; $i>=$start; $i--) { if ($i == $sel) { $html .= "<option value=\"".$i."\" selected>".$i."</option>\n"; }else{ $html .= "<option value=\"".$i."\">".$i."</option>\n"; } } return $html; } function optionArray($arr, $sel) { $html = ''; $keys = array_keys($arr); for ($i=0; $i<count($keys); $i++) { $key = $keys[$i]; if ($key == $sel) { $html .= "<option value=\"".$key."\" selected>".$arr[$key]."</option>\n"; }else{ $html .= "<option value=\"".$key."\">".$arr[$key]."</option>\n"; } } return $html; } function printTagCloud($tags,$url,$css) { $max_size = 32; //กำหนด ขนาด font ใหญ่ สุดที่นี่ $min_size = 12; // กำหนด ขนาด font เล็ก สุดที่นี่ ksort($tags); $max_qty = max(array_values($tags)); $min_qty = min(array_values($tags)); $spread = $max_qty - $min_qty; if ($spread == 0) { $spread = 1; } $step = ($max_size - $min_size) / ($spread); foreach ($tags as $key => $value) { $size = round($min_size + (($value - $min_qty) * $step)); $printTagCloud .= '<a href="'.$url. $key.'" style="font-size: ' . $size . 'px" title="' . $value . ' things tagged with ' . $key . '" class="'.$css.'">' . $key . '</a> '; } return $printTagCloud ; } function milike($cadena,$busca){ if($busca=="") return 1; $vi = split("%",$busca); $offset=0; for($n=0;$n<count($vi);$n++){ if($vi[$n]== ""){ if($vi[0]== ""){ $tieneini = 1; } } else { $newoff=strpos($cadena,$vi[$n],$offset); if($newoff!==false){ if(!$tieneini){ if($offset!=$newoff){ return false; } } if($n==count($vi)-1){ if($vi[$n] != substr($cadena,strlen($cadena)-strlen($vi[$n]), strlen($vi[$n]))){ return false; } } else { $offset = $newoff + strlen($vi[$n]); } } else { return false; } } } return true; } function url_exists($url) { $hdrs = @get_headers($url); return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) : false; } function email2image($email) { $html = ""; if ($email!='') { $email = str_replace("@", "(at)", $email); $email = str_replace(".", "(dot)", $email); $html = "<img src=\"/em2pic.php?e=".$email."\" align=\"top\">"; } return $html; } } ?>
2022 - 2023 Copyright By Lutfifakee || Padang Blackhat ♥