Logger::error(i18n::s('No item has been found.')); // permission denied } elseif (!$permitted) { // anonymous users are invited to log in or to register if (!Surfer::is_logged()) { Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Categories::get_url($member, 'select'))); } // permission denied to authenticated user Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // build a form to associates some categories to this item } else { // actual update if (isset($_REQUEST['anchor']) && isset($_REQUEST['member'])) { // on error display the form again if ($error = Members::toggle($_REQUEST['anchor'], $_REQUEST['member'], isset($_REQUEST['father']) ? $_REQUEST['father'] : '')) { Logger::error($error); } } // the current list of linked categories $categories =& Members::list_categories_by_title_for_member($member, 0, CATEGORIES_LIST_SIZE, 'raw'); // the form to link additional categories if (!is_array($categories) || count($categories) < CATEGORIES_LIST_SIZE) { $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><div style="margin-bottom: 2em;">' . i18n::s('Select a category') . ' <select name="anchor">' . Categories::get_options($categories) . '</select>' . ' ' . Skin::build_submit_button(i18n::s('Categorize')) . '<input type="hidden" name="member" value="' . encode_field($member) . '">' . '</div></form>' . "\n"; } // the current list of linked categories if (count($categories)) { // display attached categories with unlink buttons $context['text'] .= '<p>' . i18n::s('All categories that have been associated to this page:') . '</p>'; // browse the list foreach ($categories as $category_id => $attributes) {
} // the title of the page $context['page_title'] = i18n::s('Watch list'); // not found if (!$item['id']) { include '../error.php'; // operation is restricted to logged users } elseif (!Surfer::get_id()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // you cannot watch yourself } elseif ($track == 'user:'******'Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // toggle membership status } elseif ($error = Members::toggle($track, 'user:'******'user:'******'page_title'] = i18n::s('The list of persons that you follow has been updated'); } else { $context['page_title'] = i18n::s('Your watch list has been updated'); } // follow-up commands $menu = array(); if (is_object($anchor) && $anchor->is_viewable()) { $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Done'), 'button'); } // the page now appears in the watch list