function edit_channel_name() { global $smarty; for ($i = 0; $i < count($_POST['cha_id']); $i++) { $cha_name = strict($_POST['cha_name'][$i]); $cha_id = strict($_POST['cha_id'][$i]); $obj = new channel(); $obj->set_value('cha_name', $cha_name); $obj->set_where('cha_id = ' . $cha_id); $obj->edit(); } $smarty->assign('info_text', '修改频道标题成功'); $smarty->assign('link_text', '返回上一页'); $smarty->assign('link_href', url(array('channel' => 'super', 'mod' => 'channel_name'))); }
$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 "; echo "exists and is valid.";