Esempio n. 1
0
 function GetAddressById($id)
 {
     global $realChars, $urlChars;
     $query = "SELECT * FROM archive WHERE id='{$id}'";
     $result = mysql_query($query);
     if (mysql_num_rows($result) > 0) {
         $row = mysql_fetch_array($result);
         return '/' . str_replace('-', '/', $row['date']) . '/' . UrlVars::real2url($row['name']);
     } else {
         return '';
     }
 }
Esempio n. 2
0
    $document->AddSubMenu();
    $query = "SELECT address FROM archive WHERE id='{$id}'";
    $result = mysql_query($query);
    if (mysql_num_rows($result) > 0) {
        $doc = mysql_fetch_array($result);
        $document->AddArchive($doc['address']);
    } else {
        $document->SetTitle("Oi oi oi!");
        $document->AddComments($id, 'after', $_POST, '', "Seda dokumenti mida te tahtsite kommenteerida kahjuks pole.");
    }
} else {
    $query = "SELECT * FROM archive WHERE id='{$id}'";
    $result = mysql_query($query);
    if (mysql_num_rows($result) > 0) {
        $doc = mysql_fetch_array($result);
        if ($doc['comments'] == 'Y') {
            $query = $commentator->GetQuery();
            $result = mysql_query($query);
            header("Location: /" . str_replace('-', '/', $doc['date']) . '/' . UrlVars::real2url($doc['name']));
            exit;
        } else {
            $document->SetTitle("Oi oi oi!");
            $document->AddComments($id, 'after', $_POST, '', "Seda dokumenti kahjuks ei saa kommenteerida.");
            $document->AddArchive($doc['address']);
        }
    } else {
        $document->SetTitle("Oi oi oi!");
        $document->AddComments($id, 'after', $_POST, '', "Seda dokumenti mida te tahtsite kommenteerida kahjuks pole.");
    }
}
$document->Out();
Esempio n. 3
0
$document = new Document();
$document->SetTitle("Arhiiv");
$document->AddMainMenu("Arhiiv");
$document->AddSubMenu();
$chapter = "<h1>Arhiiv</h1>\n";
$query = "SELECT * FROM archive WHERE category<>'Luuletused' AND category<>'Laulud' AND `order`=0 ORDER BY category, date DESC, name";
$result = mysql_query($query);
while ($doc = mysql_fetch_array($result)) {
    if ($doc['category'] != $old_category) {
        if (strlen($old_category) != 0) {
            $chapter .= "</ul>\n";
        }
        $chapter .= "<h2>{$doc['category']}</h2>\n";
        $chapter .= "<ul>\n";
        $old_category = $doc['category'];
    }
    $address = '/' . str_replace('-', '/', $doc['date']) . '/' . UrlVars::real2url($doc['name']);
    if ($doc['type'] == 'normal') {
        $class = '';
    } elseif ($doc['type'] == 'standalone') {
        $class = ' class="standalone"';
    } elseif ($doc['type'] == 'text/css') {
        $class = ' class="css"';
    } else {
        $class = ' class="file"';
    }
    $chapter .= "<li{$class}><a href=\"{$address}\">{$doc['name']}</a></li>\n";
}
$chapter .= "</ul>\n";
$document->AddBasicChapter($chapter, "Arhiiv");
$document->Out();
Esempio n. 4
0
require_once "urlvars.php";
header("Content-type: application/rss+xml");
echo <<<EOHTML
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Triinuleht - Viimased artiklid</title>
    <link>http://www.triin.net</link>
    <description>Triinulehe uudised</description>
    <language>et</language>

EOHTML;
$query = "SELECT * FROM archive ORDER BY `date` DESC LIMIT 15";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
    $address = "http://www.triin.net/" . str_replace('-', '/', $row['date']) . "/" . UrlVars::real2url($row['name']);
    $time = strtotime($row['date']);
    $time = date("D, j M Y H:i:s \\G\\M\\T", $time);
    echo <<<EOHTML
<item>
    <title>{$row['name']}</title>
    <link>{$address}</link>
    <pubDate>{$time}</pubDate>
    <dc:creator>Rene Saarsoo</dc:creator>
</item>

EOHTML;
}
echo <<<EOHTML
</channel>
</rss>
Esempio n. 5
0
 function GetId()
 {
     return str_replace('~', '', UrlVars::real2url($this->mTitle));
 }
Esempio n. 6
0
 function AddSubMenu($selected = '', $category = '', $groupId = 0)
 {
     if ($groupId > 0) {
         $heading = "Sisukord";
         $query = "SELECT * FROM archive WHERE groupid='{$groupId}' ORDER BY `order`";
     } elseif (strlen($category) > 0) {
         $heading = "Samal teemal";
         $query = "SELECT * FROM archive WHERE category='{$category}' AND `order`=0 ORDER BY date DESC, name";
     } else {
         $heading = "Viimased artiklid";
         $query = "SELECT * FROM archive ORDER BY date DESC, name LIMIT 15";
     }
     $result = mysql_query($query);
     while ($row = mysql_fetch_array($result)) {
         $menu[$row['name']] = '/' . str_replace('-', '/', $row['date']) . '/' . UrlVars::real2url($row['name']);
     }
     $this->mSubMenu = new Menu($menu, $heading, 'alammenyy', $selected);
 }