Exemple #1
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>eRONA: Meine Feeds</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css.css" rel="stylesheet" type="text/css" />
<?php 
readfile(".metas");
?>
</head>
<body>
<table>
<?php 
getFeeds("meine");
$feeds = getSimilar($_GET['s']);
$feeds_gefunden = FALSE;
echo "<h3><i>" . urldecode($_GET['t']) . "</i> ähnliche Feeds</h3>\n";
echo '<span class="liste">';
echo '<table>';
for ($i = 0; $i < count($feeds) - 1; $i++) {
    $abo = 1;
    $sql = "SELECT " . $feeds[$i]['id'] . " IN (" . $_SESSION['feed_liste'] . ")";
    $res = mysql_query($sql);
    if (!($row = @mysql_fetch_row($res))) {
        $abo = 1;
    } else {
        $abo = $row[0];
    }
    if ($abo == 0) {
        $feeds_gefunden = TRUE;
    die("reference file must be specified\n");
}
$refFile = $_SERVER['argv'][1];
if (!file_exists($refFile)) {
    die("Reference file does not exist\n");
}
$refFileInfo = pathinfo($refFile);
if (!is_numeric($refFileInfo['filename'])) {
    die("Reference file name expected to be numeric\n");
}
$refFileDate = strtotime($refFileInfo['filename']);
$consecutiveMissedDays = 0;
$date = $refFileDate;
$files = array($refFile);
while ($consecutiveMissedDays < 5) {
    $result = getSimilar($refFileInfo['dirname'], date('Ymd', $date), array_slice($files, -3));
    if (!$result || 0 == count($result)) {
        $consecutiveMissedDays++;
    } else {
        $consecutiveMissedDays = 0;
        $file = $result[0];
        echo "{$file}\n";
        array_push($files, $file);
        $similarDir = $refFileInfo['dirname'] . '/similar/' . $refFileInfo['filename'];
        if (!file_exists($similarDir)) {
            mkdir($similarDir, 0777, true);
        }
        $info = pathinfo($file);
        //echo $file.' --> '.$similarDir.'/'.$info['basename']."\n";
        copy($file, $similarDir . '/' . $info['basename']);
    }