public static function dispatch()
    {
        $id = get_http_var('id');
        $action = get_http_var('action');
        $sql = <<<EOT
SELECT m.id,m.journo_id, j.ref, j.prettyname, j.oneliner, m.url, m.submitted, m.reason
    FROM missing_articles m LEFT JOIN journo j ON m.journo_id=j.id
    WHERE m.id=?;
EOT;
        $row = db_getRow($sql, $id);
        $w = new MissingArticleWidget($row);
        // perform whatever action has been requested
        $w->perform($action);
        // is request ajax?
        $ajax = get_http_var('ajax') ? true : false;
        if ($ajax) {
            $w->emit_core();
        } else {
            // not an ajax request, so output a full page
            admPageHeader("Missing Article", "MissingArticleWidget::emit_head_js");
            print "<h2>Missing article</h2>\n";
            $w->emit_full();
            admPageFooter();
        }
    }
Пример #2
0
<?php

// missingarticles.php
// admin page for scraping submitted articles
// sigh... stupid php include-path trainwreck...
chdir(dirname(dirname(__FILE__)));
require_once '../conf/general';
require_once '../phplib/misc.php';
require_once '../../phplib/db.php';
require_once '../../phplib/utility.php';
require_once '../phplib/adm.php';
require_once 'missingarticle_widget.php';
admPageHeader("Missing Articles", "ExtraHead");
?>
<h2>Missing articles</h2>
<p>User-submitted articles we <em>should</em> be able to scrape...</p>
<?php 
$sql = "SELECT m.id,m.journo_id, j.ref, j.prettyname, j.oneliner, m.url, m.submitted, m.reason\n    FROM missing_articles m LEFT JOIN journo j ON m.journo_id=j.id\n    ORDER BY submitted DESC";
$rows = db_getAll($sql);
foreach ($rows as $r) {
    $w = new MissingArticleWidget($r);
    $w->emit_full();
}
admPageFooter();
function ExtraHead()
{
    MissingArticleWidget::emit_head_js();
}