"; echo "document.location='".$link."';"; echo ""; } function js_replace($link) { echo ""; } function js_alert($mesaj) { echo ""; } function writeError($text, $sql="") { echo "$text ($sql)"; } function query($sql_sentence) { $res=mysql_query($sql_sentence) or die(writeError(mysql_error(), $sql_sentence)); return $res; } function fetch($result, $type="") { return ($type=="")?mysql_fetch_array($result):mysql_fetch_array($result, $type); } function num($result) { return mysql_num_rows($result); } function simplify($denumire, $delimitator="-", $limit=true) { $chrPermise="qwertyuiopasdfghjklzxcvbnm1234567890 "; $arrChr=array(); for($i=0; $i31) $result=false; if (($luna=="04" || $luna=="06" || $luna=="09" || $luna=="11") && $zi>30) $result=false; if ($luna=="02" && $zi>29) $result=false; return $result; } function validateEmail($email) { if(ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$", $email)) return true; else return false; } function scrieDataRom($data) { $luna=date("n", $data); $theLuna=""; switch ($luna) { case "1": $theLuna="Ianuarie"; break; case "2": $theLuna="Februarie"; break; case "3": $theLuna="Martie"; break; case "4": $theLuna="Aprilie"; break; case "5": $theLuna="Mai"; break; case "6": $theLuna="Iunie"; break; case "7": $theLuna="Iulie"; break; case "8": $theLuna="August"; break; case "9": $theLuna="Septembrie"; break; case "10": $theLuna="Octombrie"; break; case "11": $theLuna="Noiembrie"; break; case "12": $theLuna="Decembrie"; break; } return date("d", $data)." ".$theLuna." ".date("Y", $data); } function br2nl($string) { return str_replace("
", "", $string); } function breakString($string, $nr) { return (strlen($string)>$nr)?substr($string, 0, $nr)." ...":$string; } function encode($str) { $result=""; for ($i=0; $i < strlen($str); $i++) { $result.=bin2hex($str[$i]); } return $result; } function decode($str) { $result=""; for ($i=0; $i < strlen($str); $i=$i+2) { $result.=chr(hexdec($str[$i].$str[$i+1])); } return $result; } function empty_array($array) { $array=array(); } function get_full_url() { return "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; } function p_r($array) { echo "
";
	print_r($array);
	echo "
"; } function spatiereRr($temp='', $nr_caractere) { $q=explode(" ",$temp); $y=""; foreach($q as $temp1) { $x=$temp1; $t=$nr_caractere; while(strlen($x)>$t) { $y.=substr($x,0,$t)." "; $x=substr($x,$t); } $y.=$x." "; } return $y; } function str_prepare($string) { if (!get_magic_quotes_gpc()) return trim(addslashes($string)); else return trim($string); } function str_display($str, $IF=0) { if($IF==1) return htmlspecialchars(stripslashes($str)); elseif($IF==0) return stripslashes($str); } function get_is_set($var) { return (isset($var) && is_numeric($var) && !empty($var)); } function testWebsite($adresa) { if(substr($adresa, 0, 7) == "http://") return $adresa; else return "http://".$adresa; } function adaugaWatermark($img, $wm) { $watermark=imagecreatefrompng($wm); $watermark_width=imagesx($watermark); $watermark_height=imagesy($watermark); $image=imagecreatetruecolor($watermark_width, $watermark_height); $image=imagecreatefromjpeg($img); $size=getimagesize($img); $dest_x=ceil(($size[0]-$watermark_width)/2); $dest_y=ceil(($size[1]-$watermark_height)/2); imagecopyresampled($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height); imagejpeg($image, $img, 100); imagedestroy($image); imagedestroy($watermark); } function scrieSeparator($nr_spatii, $desp) { return scrieSpatii($nr_spatii).$desp.scrieSpatii($nr_spatii); } function substrReloaded($text, $length=230, $final="...") { $text=trim($text); $txtl=strlen($text); if($txtl>$length) { for($i=1; $text[$length-$i]!=" "; $i++) { if($i==$length) { return substr($text, 0, $length).$final; } } for(; $text[$length-$i]=="," || $text[$length-$i]=="." || $text[$length-$i]==" "; $i++) {;} $text=substr($text, 0, $length-$i+1).$final; } return $text; } function resetArrayKeys($array, $leadingZero=true) { $result=array(); $index=1; foreach($array as $key=>$value) { if($leadingZero) $result[]=$value; else $result[$index++]=$value; } return $result; } function applyColor($arg, $color="#000") { return "".$arg.""; } function cautaFisier($cale, $prefix, $arrayExtensii) { $fisiere=citeste_fisiere($cale); $temp=array(); $gasit=false; foreach($fisiere as $fis) { if($gasit===false) { $extensieFisier=get_file_extension($fis); $denumireFisier=str_replace(".".$extensieFisier, "", $fis); if($denumireFisier==$prefix && in_array($extensieFisier, $arrayExtensii)) { $gasit=true; $temp=array("nume"=>$denumireFisier, "ext"=>$extensieFisier); } } } return $temp; } function js_goLink($linkGoTo) { ?> 0) { for($i=1; $i<=$nr_spatii; $i++) $result.="  "; return $result; } else return false; } function rmdirRecursiv($dir, $mode) { if ($handle=opendir($dir)) { while (false!==($file=readdir($handle))) { if ($file!=".." && $file!=".") { if (is_dir($dir.$file)) { rmdir_recursiv($dir.$file."/", false); rmdir($dir.$file); } else unlink($dir.$file); } } } if ($mode) rmdir($dir); } function removeExtension($filename) { $bucati=explode(".", $filename); $bucati[count($bucati)-1]=""; unset($bucati[count($bucati)-1]); return implode(".", $bucati); } function get_file_extension($filename) { $bucati=explode(".", $filename); return $bucati[count($bucati)-1]; } function formatOra($arg) { list($o,$m)=explode(':',$arg); $o=str_pad($o, 2, "0", STR_PAD_LEFT); $m=str_pad($m, 2, "0", STR_PAD_LEFT); return $o.':'.$m; } function sortAssocArray($array, $by, $order, $type) { // $array: the array you want to sort // $by: the associative array name that is one level deep // example: name // $order: ASC or DESC // $type: num or str $sortby = "sort$by"; $firstval = current($array); $vals = array_keys($firstval); foreach ($vals as $init) { $keyname = "sort$init"; $$keyname = array(); } foreach ($array as $key => $row) { foreach ($vals as $names) { $keyname = "sort$names"; $test = array(); $test[$key] = $row[$names]; $$keyname = array_merge($$keyname,$test); } } if ($order == "DESC") { if ($type == "num") array_multisort($$sortby,SORT_DESC, SORT_NUMERIC,$array); else array_multisort($$sortby,SORT_DESC, SORT_STRING,$array); } else { if ($type == "num") array_multisort($$sortby,SORT_ASC, SORT_NUMERIC,$array); else array_multisort($$sortby,SORT_ASC, SORT_STRING,$array); } return $array; } function unsetSession($variabila) { if(is_array($_SESSION[$variabila])) $_SESSION[$variabila]=array(); else $_SESSION[$variabila]=""; unset($_SESSION[$variabila]); } function generatePassword($length = 10) { $allowable_characters = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; $ps_len = strlen($allowable_characters); mt_srand((double)microtime()*1000000); $pass = ""; for($i = 0; $i < $length; $i++) { $pass .= $allowable_characters[mt_rand(0,$ps_len-1)]; } return $pass; } function scrieFlash_AC_FL($movie, $mode="", $w="", $h="") { if($w=="" || $h=="") { list($width, $height, $type, $attr)=getimagesize($movie.".swf"); } else { $width=$w; $height=$h; } $movie=str_replace("../", "", $movie); ?> daca nu exista nici un director din cale, le creeaza pe toate { $dirs=explode(DIRECTORY_SEPARATOR, $path); $path='../'; foreach($dirs as $dir) { $path.=DIRECTORY_SEPARATOR.$dir; if(!is_dir($path) && !mkdir($path, $mode)) { return false; } } return true; } function array_insert(&$array, $element, $position=null) { if(count($array)==0) { $array[]=$element; } elseif(is_numeric($position) && $position<0) { if((count($array)+position)<0) { $array=array_insert($array,$element,0); } else { $array[count($array)+$position]=$element; } } elseif(is_numeric($position) && isset($array[$position])) { $part1=array_slice($array, 0, $position); $part2=array_slice($array, $position); $array=array_merge($part1, array($position=>$element), $part2); foreach($array as $key=>$item) { if(is_null($item)) { unset($array[$key]); } } } elseif(is_null($position)) { $array[]=$element; } elseif(!isset($array[$position])) { $array[$position]=$element; } $array=array_merge($array); return $array; } function scrieFlash_FLV_new($film) { ?> 0) return frm_cal_ut2date(strtotime($date)); else return "-"; } function date2frm_cal_date($date){ return frm_cal_ut2date(strtotime($date)); } //converts unixtimestamp to calendar date function frm_cal_ut2date($ut, $format = "d/m/y"){ return date($format, $ut); //return preg_replace("/0([0-9]-)/Uis", "$1", date($format, $ut)); } function debug($msg, $caz) { } include "functii_specifice.php"; ?>