function run() { admPageHeader("Create new journo"); ?> <h2>Create new Journo</h2> <?php $action = get_http_var('action', ''); $params = $this->get_params(); if ($action == '') { $this->emit_form($params); } else { if ($action == 'preview') { $errs = $this->validate($params); $this->emit_form($params, $errs, $errs ? false : true); } else { if ($action == 'back') { $errs = $this->validate($params); $this->emit_form($params, $errs); } else { if ($action == 'do_it') { $errs = $this->validate($params); if (!$errs) { // thunderbirds are go. $this->create_journo($params); } else { $this->emit_form($params, $errs); } } } } } admPageFooter(); }
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(); } }
public static function dispatch() { $action = get_http_var('action'); $r = null; if ($action == 'update') { $r = WeblinkWidget::fetch_from_httpvars(); } else { $id = get_http_var('id'); $r = WeblinkWidget::fetch_one($id); } $w = new WeblinkWidget($r); // 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("Web Link", "WeblinkWidget::emit_head_js"); print "<h2>Web Link</h2>\n"; $w->emit_full(); admPageFooter(); } }
function template($vars) { extract($vars); admPageHeader("Submitted Articles", "extra_head"); ?> <h2>Submitted Articles</h2> <p>Submitted articles needing admin attention</p> <form action="/adm/submitted_articles" method="GET"> <table> <?php echo $filterform->as_table(); ?> </table> <input type="submit" name="submit" value="Go" /> </form> <?php if ($filterform->is_valid()) { ?> <p class="paginator"><?php echo $paginator->render(); ?> <?php echo $paginator->total; ?> matching</p> <?php foreach ($widgets as $w) { $w->emit_full(); } ?> <p class="paginator"><?php echo $paginator->render(); ?> <?php echo $paginator->total; ?> matching</p> <?php } admPageFooter(); }
public static function dispatch() { // TODO: check adm permissions!!! $id = get_http_var('id'); $action = get_http_var('action'); $err = SubmittedArticle::fetch_single($id); $w = new SubmittedArticleWidget($err); // 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("Submitted Article", "SubmittedArticleWidget::emit_head_js"); print "<h2>Submitted article</h2>\n"; $w->emit_full(); admPageFooter(); } }
function template($vars) { $tabulator = new Tabulator(array(new Column('id', array('sortable' => TRUE)), new Column('pubdate', array('sortable' => TRUE)), new LinkColumn('publication', array('sortable' => TRUE, 'text' => 'pub_name', 'href' => 'pub_home_url')), new ArtColumn('title', array('sortable' => TRUE)), new Column('byline', array('sortable' => TRUE)))); // article_admin_link($a) extract($vars); admPageHeader(); ?> <h2>Show articles</h2> <form action="articles" method="GET"> <table> <?php echo $filter->as_table(); ?> </table> <input type="submit" name="submit" value="go" /> </form> <?php if ($arts) { ?> <p class="paginator"><?php echo $paginator->render(); ?> <?php echo $paginator->total; ?> articles</p> <table class="results"> <?php echo $tabulator->as_table($arts); ?> </table> <p class="paginator"><?php echo $paginator->render(); ?> <?php echo $paginator->total; ?> articles</p> <?php } ?> <?php admPageFooter(); }
function template_html($params, $rows) { admPageHeader("Canned Queries"); ?> <h2><?php echo $this->name; ?> </h2> <p><?php echo $this->desc; ?> </p> <?php if (isset($this->longdesc)) { ?> <p><?php echo $this->longdesc; ?> </p> <?php } $this->emit_params_form($params); if (!is_null($rows)) { Tabulate($rows, $this->columns()); } admPageFooter(); }
function show_publication($pub_id) { $pub = db_getRow("SELECT * FROM organisation WHERE id=?", $pub_id); if (!$pub) { admPageHeader("Publications", "extra_head"); ?> <p>Bad pub_id: not found</p> <?php admPageFooter(); return; } $aliases = db_getAll("SELECT * FROM pub_alias WHERE pub_id=?", $pub_id); $domains = db_getAll("SELECT * FROM pub_domain WHERE pub_id=?", $pub_id); $email_formats = db_getAll("SELECT * FROM pub_email_format WHERE pub_id=?", $pub_id); $phones = db_getAll("SELECT * FROM pub_phone WHERE pub_id=?", $pub_id); admPageHeader($pub['prettyname'], "extra_head"); ?> <h2><?php echo $pub['prettyname']; ?> </h2> <table> <tbody> <tr> <th>id</th><td><?php echo $pub['id']; ?> </td> </tr> <tr> <th>prettyname</th><td><?php echo $pub['prettyname']; ?> </td> </tr> <tr> <th>shortname</th><td><?php echo $pub['shortname']; ?> </td> </tr> <tr> <th>home_url</th><td><a href="<?php echo $pub['home_url']; ?> "><?php echo $pub['home_url']; ?> </a></td> </tr> <tr> <th>aliases</th><td> <?php foreach ($aliases as $alias) { ?> <?php echo $alias['alias']; ?> <br/> <?php } ?> </td> </tr> <tr> <th>domains</th><td> <?php foreach ($domains as $domain) { ?> <a href="http://<?php echo $domain['domain']; ?> "><?php echo $domain['domain']; ?> </a><br/> <?php } ?> </td> </tr> </tbody> </table> <?php admPageFooter(); }
function ExtraHead() { WeblinkWidget::emit_head_js(); } $statusnames = array('i' => 'i - Inactive', 'a' => 'a - Active', 'h' => 'h - Hidden'); $ref = strtolower(get_http_var('ref', '')); $journo_id = get_http_var('journo_id'); if ($ref) { $journo_id = db_getOne("SELECT id FROM journo WHERE ref=?", $ref); } $action = get_http_var('action'); $journo_name = 'Journos'; if ($journo_id) { $journo_name = db_getOne("SELECT prettyname FROM journo WHERE id=?", $journo_id); } admPageHeader($journo_name, "ExtraHead"); switch ($action) { case 'list': /* List journos */ print "<h2>Journalists</h2>\n"; EmitJournoFilterForm(); EmitJournoList(); break; case 'change_status': ChangeJournoStatus($journo_id, get_http_var('status')); EmitJourno($journo_id); break; case "add_link": AddWeblink($journo_id, get_http_var('url'), get_http_var('desc')); EmitJourno($journo_id); break;
<?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(); }
<?php // page for managing user accounts // 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/person.php'; require_once '../phplib/adm.php'; admPageHeader("User Accounts"); $person_id = get_http_var('person_id'); $action = get_http_var('action', $person_id ? 'view' : 'find'); ?> <h2>User Accounts</h2> <a href="/adm/useraccounts?action=find">Find account</a> | <a href="/adm/useraccounts?action=create">Create a new account</a> <?php if ($action == 'view') { // view an individual account emit_details($person_id); } elseif ($action == 'addperm') { // add a permission do_addperm(); } elseif ($action == 'removeperm') { // remove a permission do_removeperm(); } elseif ($action == 'removealert') { // remove an alert do_removealert();
function template_completed($vars) { extract($vars); admPageHeader("Split Journo"); ?> <h2>Split completed</h2> <div class="action_summary"> <ul> <?php foreach ($actions as $action) { ?> <li><?php echo $action; ?> </li> <?php } ?> </ul> <?php admPageFooter(); }
<?php // page for managing users claiming journo profiles // 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/person.php'; require_once '../phplib/adm.php'; require_once '../phplib/journo.php'; admPageHeader("Profile claims"); $action = get_http_var('action'); switch ($action) { case 'approve': do_ApproveClaim(); do_ComposeWelcomeEmail(); break; case 'deny': do_DenyClaim(); break; case 'edit_welcome_email': do_ComposeWelcomeEmail(); break; case 'send_welcome_email': do_SendWelcomeEmail(); break; } ShowPendingClaims(); admPageFooter();
<?php // admin page for managing submitted other 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 'otherarticle_widget.php'; admPageHeader("Other Articles", "ExtraHead"); $status = get_http_var('status', 'unapproved'); ?> <h2>Other articles</h2> <p>Submitted articles from outlets we don't cover</p> <form method="post" action=""> Show: <select name="status"> <option <?php echo $status == '' ? 'selected ' : ''; ?> value="">All</option> <option <?php echo $status == 'unapproved' ? 'selected ' : ''; ?> value="unapproved">Unapproved</option> <option <?php echo $status == 'approved' ? 'selected ' : ''; ?>
<?php // token.php // admin page for looking up login tokens // i.e. missing confirmation email etc... // 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/rabx.php'; require_once '../phplib/adm.php'; $email = get_http_var('email', ''); $action = get_http_var('action'); admPageHeader(); print "<h2>Look up confirmation tokens</h2>\n"; switch ($action) { case 'toklookup': EmitTokenLookupForm($email); if ($email) { print "<hr>\n"; LookupToken($email); } break; default: EmitTokenLookupForm($email); break; } admPageFooter(); /********************************/
<?php // sigh... stupid php include-path trainwreck... chdir(dirname(dirname(__FILE__))); require_once '../conf/general'; require_once '../../phplib/db.php'; require_once '../phplib/adm.php'; require_once '../phplib/admmodels.php'; $id = get_http_var("id", null); $journo_id = get_http_var("journo_id", null); if (is_null($journo_id)) { $journo_id = db_getOne("SELECT journo_id FROM journo_education WHERE id=?", $id); } $journo = db_getRow("SELECT * FROM journo WHERE id=?", $journo_id); admPageHeader($journo['ref'] . " Education Info"); $action = get_http_var('_action'); if ($action == 'update' || $action == 'create') { // form has been submitted $obj = new Education(); $obj->fromHTTPVars($_POST); /* print"<hr/><pre><code>\n"; print_r( $_POST ); print "--------\n"; print_r( $obj ); print"</code></pre><hr/>\n"; */ $obj->save(); ?> <div class="info">Saved.</div> <?php
function template($vars) { extract($vars); admPageHeader(); ?> <h2>scrape article(s)</h2> <form action="/adm/scrape" method="GET"> <table> <?php echo $urls_form->as_table(); ?> </table> <input type="submit" name="submit" value="go" /> </form> <?php if ($urls_form->is_valid()) { ?> <h3>Result: <?php echo $summary; ?> </h3> <?php if (!is_null($art)) { ?> <div style="border: 1px solid black;"> <h4><a href="<?php echo article_url($art['id']); ?> "><?php echo $art['title']; ?> </a> [<a href="<?php echo article_adm_url($art['id']); ?> ">adm</a>]<h4> <?php echo $art['srcorgname']; ?> , <?php echo $art['pretty_pubdate']; ?> <br/> url: <a href="<?php echo $art['permalink']; ?> "><?php echo $art['permalink']; ?> </a><br/> attributed to: <?php if (sizeof($art['journos']) > 0) { ?> <ul> <?php foreach ($art['journos'] as $j) { ?> <li><a href="/<?php echo $j['ref']; ?> "><?php echo $j['ref']; ?> </a> <small>[<a href="/adm/<?php echo $j['ref']; ?> ">adm</a>]</small></li> <?php } ?> </ul> <?php } else { ?> - nobody -<br/> <?php } ?> </div> <?php } ?> <?php if (!is_null($return_code)) { ?> <h3>raw scraper output (returncode=<?php echo $return_code; ?> ):</h3> <div> <code> <pre> <?php echo admMarkupPlainText($raw_output); ?> </pre> </code> </div> <?php } } admPageFooter(); ?> <?php }
<?php // sigh... stupid php include-path trainwreck... chdir(dirname(dirname(__FILE__))); require_once '../conf/general'; require_once '../../phplib/db.php'; require_once '../phplib/adm.php'; require_once '../phplib/admmodels.php'; $id = get_http_var("id", null); $journo_id = get_http_var("journo_id", null); if (is_null($journo_id)) { $journo_id = db_getOne("SELECT journo_id FROM journo_awards WHERE id=?", $id); } $journo = db_getRow("SELECT * FROM journo WHERE id=?", $journo_id); admPageHeader($journo['ref'] . " Award Info"); $action = get_http_var('_action'); if ($action == 'update' || $action == 'create') { // form has been submitted $obj = new Award(); $obj->fromHTTPVars($_POST); /* print"<hr/><pre><code>\n"; print_r( $_POST ); print "--------\n"; print_r( $obj ); print"</code></pre><hr/>\n"; */ $obj->save(); ?> <div class="info">Saved.</div> <?php
function template($vars) { extract($vars); admPageHeader(); if (is_null($art_id)) { ?> <h2>Create Article</h2> <?php } else { ?> <h2>Edit Article</h2> go to <a href="<?php echo article_url($art_id); ?> ">public page</a>, <a href="<?php echo article_adm_url($art_id); ?> ">admin page</a> <?php } ?> <form action="/adm/editarticle" method="POST"> <table> <?php echo $form->as_table(); ?> </table> <input type="submit" name="submit" value="Submit" /> </form> <?php admPageFooter(); }
if( txt ) { txt = markdownSearch( txt, from+".."+to ); $('#content').replaceSelection( txt ); $('#content').setSelection( sel.start, sel.start+txt.length ); } e.preventDefault(); } ); } ); </script> <?php } // handy default if ($action == '' && get_http_var('id')) { $action = 'edit'; } admPageHeader("Edit news", "extra_head"); switch ($action) { case 'create': ?> <h2>Post New</h2><?php $post = newsBlankPost(); newsEdit($post); break; case 'edit': $id = get_http_var('id'); $post = db_getRow("SELECT * FROM news WHERE id=?", $id); newsEdit($post); break; case 'Preview': $post = newsFromHTTPVars(); newsPreview($post);
<?php // admin page for managing submitted web links for journos // 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 'weblink_widget.php'; admPageHeader("Web Links", "ExtraHead"); $status = get_http_var('status', 'unapproved'); ?> <h2>Web Links</h2> <p>Web links for journos</p> <form method="post" action=""> Show: <select name="status"> <option <?php echo $status == '' ? 'selected ' : ''; ?> value="">All</option> <option <?php echo $status == 'unapproved' ? 'selected ' : ''; ?> value="unapproved">Unapproved</option> <option <?php echo $status == 'approved' ? 'selected ' : ''; ?>