+----------------------------------------------------------------------+ | Authors: Martin Jansen <*****@*****.**> | +----------------------------------------------------------------------+ $Id: add.php 310096 2011-04-09 14:29:22Z clockwerx $ */ require_once "HTML/QuickForm2.php"; require_once "HTTP/Request2.php"; require_once "Net/URL2.php"; require_once 'pear-database-channel.php'; require_once 'HTML/QuickForm2/Renderer.php'; /** @todo Remove once these become available in QF2 */ require_once 'HTML/QuickForm2/Element/InputUrl.php'; require_once 'HTML/QuickForm2/Element/InputEmail.php'; require_once 'PEAR/ChannelFile.php'; auth_require('pear.admin'); if (empty($_REQUEST['channel']) || !channel::exists($_REQUEST['channel'])) { die("Invalid channel specified"); } $channel = $dbh->query("SELECT * FROM channels WHERE name = ?", array($_REQUEST['channel']))->fetchRow(DB_FETCHMODE_ASSOC); $chan = new PEAR_ChannelFile(); $tabs = array("List" => array("url" => "/channels/index.php", "title" => "List Sites."), "Add Site" => array("url" => "/channels/add.php", "title" => "Add your site.")); response_header("Channels :: Edit"); ?> <h1>Channels</h1> <?php print_tabbed_navigation($tabs); ?> <h2>Edit Channel</h2>
$project_link->addFilter("htmlspecialchars"); $project_link->addRule('required', "Please enter your project link"); $form->addElement("submit"); if ($form->validate()) { $url = new Net_URL2($project_name->getValue()); try { $req = new HTTP_Request2(); $dir = explode("/", $url->getPath()); if (!empty($dir)) { array_pop($dir); } $dir[] = 'channel.xml'; $url->setPath(implode("/", $dir)); $req->setURL($url->getURL()); channel::validate($req, $chan); if (channel::exists($project_name->getValue())) { throw new Exception("Already exists"); } $text = sprintf("[Channels] Please activate %s (%s) on the channel index.", $project_name->getValue(), $project_link->getValue()); $from = sprintf('"%s" <%s>', $contact_name->getValue(), $contact_email->getValue()); $logger = new Damblan_Log(); $observer = new Damblan_Log_Mail(); $observer->setRecipients(PEAR_WEBMASTER_EMAIL); $observer->setHeader("From", $from); $observer->setHeader("Subject", "Channel link submission"); $logger->attach($observer); $logger->log($text); // Add the channel to the DB, but not yet activated channel::add($project_name->getValue()); channel::edit($project_name->getValue(), $project_label->getValue(), $project_link->getValue(), $contact_name->getValue(), $contact_email->getValue()); echo "<div class=\"success\">Thanks for your submission. It will ";