<?php require_once "admin-mode.php"; require_once "mysqlconnect.php"; require_once "document.php"; if (!is_admin_mode()) { header("Location: /"); exit; } $document = new Document(); $document->SetTitle("Admin: Lisamise tulemus"); $document->AddMainMenu(); $document->AddSubMenu(); $hash = sha1($_POST['pass']); $query = "INSERT INTO `archive` \n( `id` , \n`name` , \n`address` , \n`date` , \n`next` , \n`previous` , \n`groupid` , \n`order` , \n`type` , \n`category` , \n`comments` ) \nVALUES (\n'', \n'{$_POST['name']}', \n'{$_POST['address']}', \nCURDATE( ) , \n'0', \n'0', \n'0', \n'0', \n'{$_POST['type']}', \n'{$_POST['category']}', \n'{$_POST['comments']}'\n);"; mysql_query($query); $chapter = <<<EOHTML <h1>Admin: Lisamine õnnestus</h1> <dl> <dt>Nimi</dt><dd>{$_POST['nimi']}</dd> <dt>Aadress</dt><dd>{$_POST['address']}</dd> <dt>Tüüp</dt><dd>{$_POST['type']}</dd> <dt>Kategooria</dt>{$_POST['category']}<dd></dd> <dt>Kommentaarid</dt><dd>{$_POST['comments']}</dd> </dl> EOHTML; $document->AddBasicChapter($chapter, "Admin:_Lisamise_tulemus"); $document->Out();
<?php require_once "admin-mode.php"; require_once "document.php"; if (!is_admin_mode()) { header("Location: /"); exit; } $document = new Document(); $document->SetTitle("Admin: Viimased kommentaarid"); $document->AddMainMenu(); $document->AddSubMenu(); function commentToHtml($comment) { $date = datetime_to_est($comment['datetime'], true); if (strlen($comment['homepage']) > 0) { $name = "<a href=\"{$comment['homepage']}\" title=\"kommenteerija koduleht\">{$comment['name']}</a>"; } else { $name = $comment['name']; } return <<<EOHTML <div id="kommentaar_{$comment['id']}"> {$comment['text']} <p class="autor"> Teema: {$comment['article']}<br /> {$date} {$name} ({$comment['email']}).<br /> <b><a href="?delete={$comment['id']}">Kustuta</a></b> </p> </div> EOHTML; }
<?php require_once "mysqlconnect.php"; require_once "document.php"; require_once "urlvars.php"; $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"'; }
<?php require_once 'commentator.php'; require_once 'document.php'; require_once 'urlvars.php'; foreach ($_POST as $key => $value) { $_POST[$key] = stripslashes($value); } $document = new Document(); $id = (int) $_POST['id']; if ($_POST['submit'] == 'Eelvaade') { $document->SetTitle("Kommentaari eelvaade"); $send = false; } else { $send = true; } $commentator = new Commentator($_POST); if ($commentator->Parse()) { $document->AddComments($id, 'after', $_POST, $commentator->mFormattedComment); } else { $document->SetTitle("Vigane kommentaar!"); $document->AddComments($id, 'after', $_POST, '', $commentator->mError); $send = false; } if (!$send) { $document->AddMainMenu(); $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);
<?php require_once "mysqlconnect.php"; require_once "document.php"; $document = new Document(); $document->SetTitle("Looming"); $document->AddMainMenu("Looming"); $document->AddSubMenu(); $chapter = "<h1>Looming</h1>\n"; $query = "SELECT * FROM archive WHERE category='Luuletused' OR 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";
<?php require_once "admin-mode.php"; require_once "mysqlconnect.php"; require_once "document.php"; if (!is_admin_mode()) { header("Location: /"); exit; } $document = new Document(); $document->SetTitle("Admin: Uue artikli lisamine"); $document->AddMainMenu(); $document->AddSubMenu(); $chapter = <<<EOHTML <h1>Admin: Uue artikli lisamine</h1> <form action="add-article.php" method="post"> <fieldset> <legend>Nimed</legend> <p><label for="af_name">Pealkiri</label> <input type="text" name="name" id="af_name" /></p> <p><label for="af_address">Aadress</label> <input type="text" name="address" id="af_address" value="archive/" /></p> </fieldset> <fieldset> <legend>Tüüp</legend> <select name="type"> <option value="normal">normal</option>
<?php require_once "mysqlconnect.php"; require_once "document.php"; $document = new Document(); $document->SetTitle("Kontakt"); $document->AddMainMenu("Kontakt"); $document->AddSubMenu(); $chapter = <<<EOHTML <h1>Kontakt</h1> <div class="pilt"> <img src="/archive/mina.jpg" alt="Minu pilt" /> <p>Mina, oma eduka sportlaskarjääri tipphetkel?</p> </div> <p>No põhimõtteliselt, kui keegi väga soovib, siis võib ta ju mulle kirjutada ja joonistada. Aadress on igatahes nüüd välja jagatud ja saab näha, kas sünnib sellest halba/head. Ega must mingit head kirjasõpra vast ei tule, nii et parem ärge selles suunas kohe proovima hakakegi.</p> <p>Aga kui on midagi seoses sellesama Trinoloogialehega või triinudega, siis see on kõik päris kindlasti alati teretulnud.</p> <p>Seda pilti siin tuleb ühtlasi võtta kui hoiatust, et te ei kipuks kuidagi pimesi minuga kohtuma, ja et te päris selgesti näeksite, et mina ei kuulu triinude hulka.</p> <p>Olge tublid!</p>
<?php require_once "mysqlconnect.php"; require_once "document.php"; $document = new Document(); $document->SetTitle("Trinoloogialeht"); $document->AddMainMenu("Hiljutine"); $document->AddSubMenu(); $query = "SELECT * FROM archive WHERE type='normal' ORDER BY date DESC LIMIT 3"; $result = mysql_query($query); while ($doc = mysql_fetch_array($result)) { $query = "SELECT COUNT(*) FROM comments WHERE articleid='{$doc['id']}'"; $result2 = mysql_query($query); $com = mysql_fetch_array($result2); $url = '/' . str_replace('-', '/', $doc['date']) . '/' . UrlVars::real2url($doc['name']); if ($doc['comments'] == 'Y') { $url .= '#kommentaarid'; } $document->AddArchive($doc['address'], $com[0], $url, $doc['comments']); } $document->Out();
<?php require_once "admin-mode.php"; require_once "document.php"; // When user enters correct information, log in if (isset($_POST["user"]) && isset($_POST["pass"])) { if ($_POST["user"] == ADMIN_USER && md5($_POST["pass"]) == ADMIN_PASS) { $_SESSION["user"] = $_POST["user"]; $_SESSION["admin"] = true; } } $document = new Document(); $document->SetTitle("Admin: Login"); $document->AddMainMenu(); $document->AddSubMenu(); $login_page = <<<EOHTML <h1>Admin: Login</h1> <form action="login.php" method="post"> <fieldset> <legend>Autentimine</legend> <p><label for="af_pass">Kasutaja</label> <input type="text" name="user" id="af_user" /></p> <p><label for="af_pass">Parool</label> <input type="password" name="pass" id="af_pass" /></p> </fieldset> <input type="submit" value="Sisene" /> </form>