Exemple #1
0
ob_start();
if (isset($_GET['id'])) {
    $id = isset($_GET['id']) ? $_GET['id'] : 0;
    $article = new Article($id);
    $album = new Album($article->albumId());
    // Create album for this article if it doesn't exist yet.
    if (!$album->id()) {
        $album->setSystem(true);
        $album->setTitle($article->title());
        $album->save();
        $article->setAlbumId($album->id());
        if ($article->id()) {
            $article->save();
        }
    }
    echo $article->form();
    if ($album->id()) {
        echo $album->form();
    }
} else {
    echo "<table>\n";
    echo "<thead>\n";
    echo "<tr>\n";
    echo "<td colspan=\"3\"><a href=\"?id=0\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"New\"></a></td>\n";
    echo "<td colspan=\"2\">" . _("Create a new article") . "</td>\n";
    echo "</tr>\n";
    echo "<tr><th></th><th></th><th></th><th>URL</th><th>Title</th></tr>\n";
    echo "</thead>\n";
    echo "<tbody>\n";
    $q = "SELECT a.id FROM articles a LEFT JOIN objects o ON o.object_id=a.object_id LEFT JOIN sections s ON s.id=o.section_id WHERE s.type='articles' ORDER BY o.ctime desc LIMIT 25";
    $rs = $db->query($q);
Exemple #2
0
ob_start();
if (isset($_GET['id'])) {
    $id = isset($_GET['id']) ? $_GET['id'] : 0;
    $article = new Article($id);
    $album = new Album($article->albumId());
    // Create album for this page if it doesn't exist yet.
    if (!$album->id()) {
        $album->setSystem(true);
        $album->setTitle($article->title());
        $album->save();
        $article->setAlbumId($album->id());
        if ($article->id()) {
            $article->save();
        }
    }
    echo $article->form(false, 'pages');
    if ($album->id()) {
        echo $album->form();
    }
} else {
    $q = "SELECT a.id FROM articles a LEFT JOIN objects o ON o.object_id=a.object_id LEFT JOIN sections s ON s.id=o.section_id WHERE o.section_id=0 OR s.type='pages' ORDER BY s.base_uri ASC, FIELD(a.cname, 'index') ASC";
    $pages = $db->getObjectIds($q);
    echo "<ul>";
    echo "<li>";
    echo "<a href=\"?id=0\"><img src=\"/kiki/img/iconic/black/pen_alt_fill_16x16.png\" alt=\"New\"> " . _("Create a new page") . "</a>\n";
    echo "</li>";
    echo "</ul>";
    echo "<table>\n";
    echo "<thead>\n";
    echo "<tr><th></th><th></th><th></th></th><th colspan=\"2\">URL</th><th>Title</th></tr>\n";
    echo "</thead>\n";