@$text) + $DESTACADES; } guarda_destacades($DESTACADES); location("$PHP_SELF?data=$data"); } if (($fer == 'AMUNT' or $fer == 'AVALL') and isset($data)) { destacades_velluga($fer, $data); } } } $ls = explode("\n", trim(`/bin/ls -X -1 $basedir/2[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].jpg`)); if (($sls = sizeof($ls)) > 1) { $dirsfets = array(); foreach ($ls as $n => $basedir_file) { if ($n == $sls - 1) { break; } $file = substr($basedir_file, strlen($basedir) + 1); $any = substr($file, 0, 4); $mes = substr($file, 4, 2); $dia = substr($file, 6, 2); if (! isset($dirsfets["$any-$mes-$dia"])) { if (! file_exists("$any")) { mkdir("$any"); chmod("$any", 0777); } if (! file_exists("$any/$mes")) { mkdir("$any/$mes"); chmod("$any/$mes", 0777); } if (! file_exists("$any/$mes/$mes$dia")) { mkdir("$any/$mes/$mes$dia"); chmod("$any/$mes/$mes$dia", 0777); } $dirsfets["$any-$mes-$dia"] = true; } $subfile = substr($file, 4); rename("$basedir/$file", "$any/$mes/$mes$dia/$subfile"); } } $min_date = '200107061838'; $min_time = mktime(18, 38, 0, 7, 6, 2001); $amd = date('Ymd'); $anys = array(); for ($y = '2001'; $y <= date('Y'); $y++) { $anys[] = $y; } $mesos = array( '01','02','03','04','05','06','07','08','09', '10','11','12'); $dies = array( '01','02','03','04','05','06','07','08','09', '10','11','12','13','14','15','16','17','18','19', '20','21','22','23','24','25','26','27','28','29', '30','31'); $hores = array('00','01','02','03','04','05','06','07','08','09', '10','11','12','13','14','15','16','17','18','19', '20','21','22','23'); $minuts = array('00','01','02','03','04','05','06','07','08','09', '10','11','12','13','14','15','16','17','18','19', '20','21','22','23','24','25','26','27','28','29', '30','31','32','33','34','35','36','37','38','39', '40','41','42','43','44','45','46','47','48','49', '50','51','52','53','54','55','56','57','58','59'); if (! isset($any) and ! isset($data)) { $data = 0; } if (@$data == 0) { include_once 'ultima.php'; $data = ultima_foto(); } ?> end($anys)) $any = end($anys); $ts = mktime($hora, $minut, 0, $mes, $dia, $any); $data = date('YmdHi', $ts); $any = substr($data, 0, 4); $mes = substr($data, 4, 2); $dia = substr($data, 6, 2); $hora = substr($data, 8, 2); $minut = substr($data, 10, 2); echo ' Webcam
'; ?> 'dies', 'mes' => 'mesos', 'any' => 'anys', 'hora' => 'hores', 'minut' => 'minuts'); $trams2 = array( 'dia' => '7', 'mes' => '', 'any' => '', 'hora' => '6', 'minut' => '10'); $n = 0; foreach($trams as $var => $arr) { echo " "; } $sensefoto = true; if ($arr = foto($ts)) { $src = $arr[0]; $f = substr($src, 0, 4); // any $f .= '/' . substr($src, 4, 2); // mes $f .= '/' . substr($src, 4, 4); // mesdia $f .= '/' . substr($src, 4) . '.jpg'; if ($gsize = getimagesize($f)) { $sensefoto = false; $foto_width = $gsize[0]; $foto_height = $gsize[1]; $chk = substr(md5($src . 'dgfj'), 0, 6); $src = "img.php?img=$arr[0]$chk"; $titol = $arr[1]; $peufoto = diasemana($ts) . ', ' . datacatala($ts) . ' ' . date('H:i', $ts) . "
$titol"; } } if ($sensefoto) { $src = 'sensefoto.png'; $titol = date('d-m-Y H:i', $ts) . " No hi ha foto"; $peufoto = "Data cercada: " . date('d-m-Y H:i', $ts) . '
Foto inexistent'; $foto_width = 352; $foto_height = 288; } ?>foto anterior"; } else { $ant = "No hi ha més fotos"; } if ($s = foto_seg($ts)) { $seg = "foto següent"; } else { $seg = "foto següent"; } echo " "; ?>$avis"; } else { $avis = ''; } echo ""; echo " "; echo ""; echo ""; echo ""; } else { if ($data == $moment) { echo ""; } else { echo ""; } } } if ($password_sesio == $pw) { echo '
"; echo"$var "; if ($inc = $trams2[$var]) { echo"$inc $arr menys "; } echo "1 $var menys "; echo "1 $var més"; if ($inc = $trams2[$var]) { echo" $inc $arr més"; } echo "
\"$titol\"
$ant $peufoto $seg
$avis"; } echo "
[amunt][avall][borrar][$text]

Logout
'; } else { echo ''; } echo "
"; exit; ?> $text) { fwrite($h, "\$DESTACADES['$data'] = '" . addslashes($text) . "';\n"); } fwrite($h, "?>"); fclose($h); } function arr_avall($arr, $element) { $ret = array(); foreach ($arr as $num => $val) { if ($num == $element) { $guardat = $val; continue; } $ret[$num] = $val; if (isset($guardat)) { $ret[$element] = $guardat; unset($guardat); } } if (isset($guardat)) { $ret[$element] = $guardat; } return $ret; } ?> $val) { if ($num == $element) { $ret[$num] = $val; } if (isset($seguent)) { $ret[$seguent] = $seg_valor; unset($seguent); } $seguent = $num; $seg_valor = $val; } if (isset($seguent)) { $ret[$seguent] = $seg_valor; } return $ret; } function destacades_velluga($dir, $data) { $location = $GLOBALS['PHP_SELF'] . "?data=$data"; include 'destacades.php'; if (! isset($DESTACADES[$data])) location($location); if ($dir == 'AMUNT') { $DESTACADES = arr_amunt($DESTACADES, $data); } else { $DESTACADES = arr_avall($DESTACADES, $data); } guarda_destacades($DESTACADES); location($location); } function foto_seg($ts) { global $min_time; $max_any = date('Y'); $max_mes = date('m'); $max_dia = date('d'); $max_amd = date('Ymd'); $ts = max($ts, $min_time); $any_act = date('Y', $ts); $mes_act = date('m', $ts); $dia_act = date('d', $ts); $amdhm = date('YmdHi', $ts); $md = date('md', $ts); $mdhi = date('mdHi', $ts); $buscant = date('YmdHi', $ts) . '00.jpg'; for ($a = $any_act; $a <= $max_any; $a++) { if (! file_exists("$a/")) continue; for ($m = $mes_act; $m < 13; $m++) { $m = str_pad($m, 2, '0', STR_PAD_LEFT); if (! file_exists("$a/$m/")) continue; for ($d = $dia_act; $d < 32; $d++) { $d = str_pad($d, 2, '0', STR_PAD_LEFT); if ("$a$m$d" > $max_amd) return false; if (! file_exists($dir = "$a/$m/$m$d/")) continue; $ls = explode("\n", trim(`/bin/ls -X -1 $dir`)); foreach($ls as $f) { if ("$a$f" - $buscant >= 60) return $a . substr($f, 0, 8); } } $dia_act = "1"; } $mes_act = "1"; } return false; } ?>= $min_any; $a--) { if (! file_exists("$a/")) continue; for ($m = $mes_act; $m > 0; $m--) { $m = str_pad($m, 2, '0', STR_PAD_LEFT); if (! file_exists("$a/$m/")) continue; for ($d = $dia_act; $d > 0; $d--) { $d = str_pad($d, 2, '0', STR_PAD_LEFT); if ("$a$m$d" < $min_amd) return false; if (! file_exists($dir = "$a/$m/$m$d/")) continue; $ls = explode("\n", trim(`/bin/ls -r -X -1 $dir`)); foreach($ls as $f) { if ((int)"$a$f" < (int)$buscant) return $a . substr($f, 0, 8); } } $dia_act = "31"; } $mes_act = "12"; } return false; } function foto($ts) { global $dirs; static $sss = array('00','01','02','03','04','05','06','07','08','09', '10','11','12','13','14','15','16','17','18','19', '20','21','22','23','24','25','26','27','28','29', '30','31','32','33','34','35','36','37','38','39', '40','41','42','43','44','45','46','47','48','49', '50','51','52','53','54','55','56','57','58','59'); $any = date('Y', $ts); $mes = date('m', $ts); $md = date('md', $ts); $mdhi = date('mdHi', $ts); $ret = false; $base = "$any/$mes/$md/$mdhi"; foreach ($sss as $ss) { if (file_exists($f = "$base$ss.jpg") and filesize($f)) { $ret = $f; $ret = "$any$mdhi$ss"; break; } } if ($ret) { foreach($dirs as $dir => $titol) { if ("$any$mdhi" >= $dir) break; } return array($ret, $titol); } return false; } ?> 9999) $data = date('Y-m-d', $data); $mes = mes($data); list($a,$m,$d) = preg_split('~[/.-]~', $data); if ($m == 4 or $m == 8 or $m == 10) { $de = "d'"; }else{ $de = "de "; } $d = intval($d); if ($amb_prefix) { $prefix['d'][0] = 'del '; $prefix['d'][1] = 'de l\''; $prefix['e'][0] = 'el '; $prefix['e'][1] = 'l\''; if ($d == 1 or $d == 11) { $d = $prefix[$amb_prefix][1] . $d; }else{ $d = $prefix[$amb_prefix][0] . $d; } } if ($amb_any) { return "$d $de$mes de $a"; }else{ return "$d $de$mes"; } } function diasemana($data) { $semana = array('diumenge','dilluns','dimarts','dimecres','dijous','divendres','dissabte'); if ((int)$data > 9999) { return $semana[date('w', $data)]; }else{ list($a,$m,$d) = preg_split('~[/.-]~', $data); return $semana[date('w', mktime(0,0,0,$m, $d, $a))]; } } function location($location) { /* if (SID and ! strpos($location, SID)) { if (strpos($location, '?') !== false) { $location .= '&' . SID; } else { $location .= '?' . SID; } } */ if (strpos($location, '://')) { $uri = $location; } else { $actual = parse_url('http://' . $GLOBALS['HTTP_HOST'] . $GLOBALS['REQUEST_URI']); if ($location[0] == '/') { $nova = "$actual[scheme]://$actual[host]$location"; } else { $dir = dirname($actual['path']); if (substr($dir, -1) == '/') { $nova = "$actual[scheme]://$actual[host]$dir$location"; } else { $nova = "$actual[scheme]://$actual[host]$dir/$location"; } } $uri = $nova; } header("Location: $uri"); exit; } function hora_de_llum($ts) { $h = date('H', $ts); // hora $m = date('m', $ts); // mes $dst = date('I', $ts); //Daylight Savings Time $g = 'f'; // femení if ($h < 3) { $p = 'nit'; } elseif ($h < 6) { $p = 'matinada'; } elseif ($h < 12) { $g = 'm'; // masculí $p = 'matí'; } elseif ($h < 14) { $g = 'm'; // masculí $p = 'migdia'; } elseif ($h < 20) { $p = 'tarda'; } elseif ($h < 23) { $g = 'm'; // masculí $p = 'vespre'; } else { $p = 'nit'; } return $p; } ?>