Ejemplo n.º 1
0
$project_link->addRule('required', "Please enter your project link");
$is_active = $form->addElement("checkbox", 'is_active', array('checked' => $channel["is_active"] ? 'checked' : ''));
$is_active->setLabel("Active?");
$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);
        channel::edit($channel['name'], $project_label->getValue(), $project_link->getValue(), $contact_name->getValue(), $contact_email->getValue());
        if ($is_active->getValue()) {
            channel::activate($channel['name']);
        } else {
            channel::deactivate($channel['name']);
        }
        echo "<div class=\"success\">Changes saved</div>\n";
    } catch (Exception $exception) {
        echo '<div class="errors">';
        switch ($exception->getMessage()) {
            case "Invalid channel site":
            case "Empty channel.xml":
                echo "The submitted URL does not ";
                echo "appear to point to a valid channel site.  You will ";
                echo "have to make sure that <tt>/channel.xml</tt> at least ";