예제 #1
0
    $form->setConstants(array('sec_token' => $token));
}
$form->addElement('text', 'url', 'URL');
$form->addRule('url', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('url', '', 'maxlength', 254);
$form->addElement('textarea', 'description', get_lang('Description'));
//the first url with id = 1 will be always active
if (isset($_GET['url_id']) && $_GET['url_id'] != 1) {
    $form->addElement('checkbox', 'active', null, get_lang('Active'));
}
$defaults['url'] = 'http://';
$form->setDefaults($defaults);
$submit_name = get_lang('AddUrl');
if (isset($_GET['url_id'])) {
    $url_id = intval($_GET['url_id']);
    $num_url_id = UrlManager::url_id_exist($url_id);
    if ($num_url_id != 1) {
        header('Location: access_urls.php');
        exit;
    }
    $url_data = UrlManager::get_url_data_from_id($url_id);
    $form->addElement('hidden', 'id', $url_data['id']);
    $form->setDefaults($url_data);
    $submit_name = get_lang('AddUrl');
}
if (!api_is_multiple_url_enabled()) {
    header('Location: index.php');
    exit;
}
$tool_name = get_lang('AddUrl');
$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));