Пример #1
0
 $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 ";
             echo "exists and is valid.";
             break;
         default:
             echo $exception->getMessage();
             break;