$fields = array(); $fields['host_name'] = i18n::s('www.yacs.fr'); if (Servers::get($fields['host_name'])) { $text .= sprintf(i18n::s('An entry already exists for server %s'), $fields['host_name']) . BR . "\n"; } else { $fields['title'] = 'yacs'; $fields['description'] = i18n::c('The origin server for the YACS system'); $fields['main_url'] = 'http://www.yacs.fr/'; $fields['submit_feed'] = 'Y'; $fields['feed_url'] = 'http://www.yacs.fr/feeds/rss.php'; $fields['submit_ping'] = 'Y'; $fields['ping_url'] = 'http://www.yacs.fr/services/ping.php'; $fields['submit_search'] = 'N'; $fields['search_url'] = 'http://www.yacs.fr/services/search.php'; $fields['submit_monitor'] = 'N'; $fields['monitor_url'] = 'http://www.yacs.fr/services/ping.php'; if ($error = Servers::post($fields)) { $text .= $error; } else { $text .= sprintf(i18n::s('A record has been created for server %s'), $fields['host_name']) . BR . "\n"; } } // report on actions performed if ($included) { echo $text; } else { $context['text'] .= $text; $menu = array('servers/' => i18n::s('Back to servers')); $context['text'] .= Skin::build_list($menu, 'menu_bar'); render_skin(); }
Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // anonymous users are invited to log in or to register } elseif (!Surfer::is_logged()) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Servers::get_url($id, 'edit'))); } elseif (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // an error occured } elseif (count($context['error'])) { $item = $_REQUEST; $with_form = TRUE; // process uploaded data } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { // display the form on error if ($error = Servers::post($_REQUEST)) { Logger::error($error); $item = $_REQUEST; $with_form = TRUE; // reward the poster for new posts } elseif (!$item['id']) { // the follow-up page $next = $context['url_to_home'] . $context['url_to_root'] . Servers::get_url(SQL::get_last_id($context['connection'])); // the action $action = 'server:create'; // increment the post counter of the surfer Users::increment_posts(Surfer::get_id()); // forward to the updated page Safe::redirect($next); // update of an existing server } else {