{source}
<!-- You can place html anywhere within the source tags -->
<script language="javascript" type="text/javascript">
// You can place JavaScript like this
</script>
<?php
// You can place PHP like this
if ($handle = opendir( "/var/www/vhosts/aske.gr/httpdocs/site/images/pdfs/dimosieyseis/2013/")) {
$i=0;
/* This is the correct way to loop over the directory. */
print "";
while (false !== ($file = readdir($handle))) {
if (substr($file,strlen($file)-4,4)=='.pdf') {
$fil[$i]="images/pdfs/dimosieyseis/2013/". $file;
$content = file_get_contents("/var/www/vhosts/aske.gr/httpdocs/site/images/pdfs/dimosieyseis/2013/" . $file);
$xmp_data_start = strrpos($content, '<x:xmpmeta');
$xmp_data_end = strrpos($content, '</x:xmpmeta>');
$xmp_length = $xmp_data_end - $xmp_data_start;
$xmp_data = substr($content, $xmp_data_start, $xmp_length + 12);
$flag[$i]=true;
$flag1[$i]=true;
$flag2[$i]=true;
$dcdescrsta=strpos($xmp_data, '<dc:description>')+16;
if (strpos($xmp_data, '<dc:description>')) {
$dcdescrend=strpos($xmp_data, '</dc:description>');
$dcddata=substr($xmp_data,$dcdescrsta,$dcdescrend-$dcdescrsta);
$rdflis=strpos($dcddata, '<rdf:li');
$rdflisfc=strpos($dcddata,">",$rdflis)+1;
$rdflie=strpos($dcddata, '</rdf:li>')-1;
$perigrafi[$i]=substr($dcddata,$rdflisfc,$rdflie-$rdflisfc+1);
} else {$flag[$i]=false;}
$dcdescrsta=strpos($xmp_data, '<dc:creator>')+12;
if (strpos($xmp_data, '<dc:creator>')) {
$dcdescrend=strpos($xmp_data, '</dc:creator>');
$dcddata=substr($xmp_data,$dcdescrsta,$dcdescrend-$dcdescrsta);
$rdflis=strpos($dcddata, '<rdf:li');
$rdflisfc=strpos($dcddata,">",$rdflis)+1;
$rdflie=strpos($dcddata, '</rdf:li>')-1;
$perigrafi1[$i]=substr($dcddata,$rdflisfc,$rdflie-$rdflisfc+1);
} else {
$flag1[$i]=false;
}
$dcdescrsta=strpos($xmp_data, '<dc:title>')+10;
if (strpos($xmp_data, '<dc:title>')) {
$dcdescrend=strpos($xmp_data, '</dc:title>');
$dcddata=substr($xmp_data,$dcdescrsta,$dcdescrend-$dcdescrsta);
$rdflis=strpos($dcddata, '<rdf:li');
$rdflisfc=strpos($dcddata,">",$rdflis)+1;
$rdflie=strpos($dcddata, '</rdf:li>')-1;
$perigrafi2[$i]=substr($dcddata,$rdflisfc,$rdflie-$rdflisfc+1);
} else {$flag2[$i]=false;}
$i++;
}
}
}
$k=$i;
$i=0;
$dat=array();
$timestamp=array();
while ($i<$k) {
$hmero=split("/",$perigrafi[$i]);
$dat[] = array('index'=> $i, 'timestamp' => strtotime($hmero[1] . "/" . $hmero[0] . "/" . $hmero[2]));
$i++;
}
foreach ($dat as $key => $row) {
$timestamp[$key] = $row['timestamp'];
$index[$key] = $row['index'];
}
$i=0;
array_multisort($timestamp, SORT_DESC, $dat);
foreach ($dat as $key => $row) {
$timestamp[$key] = $row['timestamp'];
$index[$key] = $row['index'];
}
$i=0;
print "<table cellpadding=\"0\" cellpadding=\"0\">";
if ($k>0) {while ($i<$k) {
//TITLOS
if ($flag[$index[$i]] || $flag2[$index[$i]]) {print "<tr>\n";}
if ($flag2[$index[$i]]) {print "<td width=\"500\"><a style=\"font-size:18px;line-height:40px\" href=\"" . $subdir . $fil[$index[$i]] . "\">" . $perigrafi2[$index[$i]] . "</a></td>\n";}
//Συγγραφέας
if ($flag1[$index[$i]]) {print "<td width=\"200\" align=\"center\">". $perigrafi1[$index[$i]] . "</td>\n";}
//HMEROMHNIA
if ($flag[$index[$i]]) {print "<td width=\"100\">" .$perigrafi[$index[$i]] . "</td> \n";}
//if ($flag[$index[$i]] || $flag1[$index[$i]] || $flag2[$index[$i]]) {print "\n";}
if ($flag[$index[$i]] ||$flag1[$index[$i]] || $flag2[$index[$i]]) {print "</tr>\n";}
//if ($flag[$index[$i]] ) {print "</tr>";}
$i++;
}
}
print "</table>";
?>
{/source}