|
|
|
<?php
|
|
|
|
|
|
|
|
function conv_data($od,$lang){
|
|
|
|
$tmp=explode("-",substr($od,0,10));
|
|
|
|
switch($lang){
|
|
|
|
case "IT":
|
|
|
|
case "FR":
|
|
|
|
case "ES":
|
|
|
|
$stres = $tmp[2]."/".$tmp[1]."/".$tmp[0]."";
|
|
|
|
break;
|
|
|
|
case "DE":
|
|
|
|
$stres = $tmp[2].".".$tmp[1].".".$tmp[0]."";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$stres=$od;
|
|
|
|
}
|
|
|
|
return $stres;
|
|
|
|
}
|
|
|
|
|
|
|
|
function conv_date($od){
|
|
|
|
$tmp=explode("-",substr($od,0,10));
|
|
|
|
$stres = $tmp[2]."/".$tmp[1]."/".$tmp[0]."";
|
|
|
|
return $stres;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function convert($stringa){
|
|
|
|
$strres = $stringa;
|
|
|
|
$strres = str_replace("'","'",$strres);
|
|
|
|
return stripslashes(nl2br($strres));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function convert_mce($stringa){
|
|
|
|
$strres = $stringa;
|
|
|
|
$strres = str_replace("'","'",$strres);
|
|
|
|
return stripslashes($strres);
|
|
|
|
}
|
|
|
|
|
|
|
|
function conv_url($text){
|
|
|
|
$entities = array('+','%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
|
|
|
$replacements = array('-','_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_',);
|
|
|
|
return str_replace($entities, $replacements, urlencode($text));
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_filesize($path){
|
|
|
|
return filesize(realpath($_SERVER["DOCUMENT_ROOT"])."".$path);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function save_photo($foto,$basepath,$id){
|
|
|
|
|
|
|
|
$filename = $foto;
|
|
|
|
// Get new sizes
|
|
|
|
list($width, $height) = getimagesize($filename);
|
|
|
|
$percent=800/$width;
|
|
|
|
$newwidth = $width * $percent;
|
|
|
|
$newheight = $height * $percent;
|
|
|
|
|
|
|
|
// Load
|
|
|
|
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
|
|
|
|
|
|
|
switch(exif_imagetype($filename)){
|
|
|
|
case 1:
|
|
|
|
$source = imagecreatefromgif($filename);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
$source = imagecreatefromjpeg($filename);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
$source = imagecreatefrompng($filename);
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
// Resize
|
|
|
|
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
|
|
|
|
|
|
|
// Output
|
|
|
|
imagejpeg($thumb, $basepath."$id.jpg");
|
|
|
|
// echo $basepath."$id.jpg";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function item_file($file){
|
|
|
|
|
|
|
|
@include 'params.inc';
|
|
|
|
|
|
|
|
$size = get_filesize($file['path']."/".$file['filename']);
|
|
|
|
if($size > 1000){$size = ($size/1000)."Mb";}else{$size = $size."Kb";}
|
|
|
|
|
|
|
|
echo "<div class=\"item\"><a href=\"".$BASE_URL."".$file['path']."/".$file['filename']."\" target=\"_blank\"><div class=\" row\">
|
|
|
|
<div class=\"title col-6 col-sm-8\">".$file['title']."</div>
|
|
|
|
<div class=\"size col-2\">".$size."</div>
|
|
|
|
<div class=\"date text-right col-4 col-sm-2\">".date("d/m/Y", filemtime($file['path']."/".$file['filename']))."</div>
|
|
|
|
</div></a></div>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|