/** * change some attributes of an anchor * * @see shared/anchor.php * * @param array of (name, value) * @return TRUE on success, FALSE otherwise */ function set_values($fields) { // add our id $fields['id'] = $this->item['id']; // save in the database return Sections::put_attributes($fields); }
Logger::error(i18n::s('You are not allowed to perform this operation in demonstration mode.')); // stop robots } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' && Surfer::may_be_a_robot()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('Please prove you are not a robot.')); // process submitted data } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { // ensure the section has a private handle if (!isset($item['handle']) || !$item['handle']) { $item['handle'] = md5(mt_rand()); // save in the database $fields = array(); $fields['id'] = $item['id']; $fields['handle'] = $item['handle']; $fields['silent'] = 'Y'; Sections::put_attributes($fields); } // track anonymous surfers Surfer::track($_REQUEST); // message subject $subject = ''; if (isset($_REQUEST['subject'])) { $subject = strip_tags($_REQUEST['subject']); } // recipient(s) address(es) $to = ''; if (isset($_REQUEST['to'])) { $to = $_REQUEST['to']; } // make an array of recipients if (!is_array($to)) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Sections::get_url($item['id'], 'own'))); } // permission denied to authenticated user Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // do the job } elseif (!count($context['error'])) { // look for the user through his nick name if (isset($_REQUEST['assigned_name']) && ($user = Users::get($_REQUEST['assigned_name']))) { $_REQUEST['anchor'] = 'user:'******'id']; } // transfer ownership if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'set' && isset($_REQUEST['anchor'])) { // assign a user, and also update his watch list $attributes = array('id' => $item['id'], 'owner_id' => $user['id']); Sections::put_attributes($attributes); Members::assign($_REQUEST['anchor'], 'section:' . $item['id']); Members::assign('section:' . $item['id'], $_REQUEST['anchor']); $context['text'] .= '<p>' . sprintf(i18n::s('Current owner is %s'), Users::get_link($user['full_name'], $user['email'], $user['id'])) . '</p>'; // name current owner } elseif (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) { $context['text'] .= '<p>' . sprintf(i18n::s('Current owner is %s'), Users::get_link($owner['full_name'], $owner['email'], $owner['id'])) . '</p>'; } // delegate to another person $context['text'] .= '<p style="margin-top: 2em;">' . i18n::s('To transfer ownership to another person, type some letters of the name you are looking for.') . '</p>'; // the form to link additional users $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . '<input type="text" name="assigned_name" id="assigned_name" size="45" maxlength="255" />' . '<input type="hidden" name="id" value="' . encode_field($item['id']) . '" />' . '<input type="hidden" name="action" value="set" />' . ' <input type="submit" id="submit_button" value="' . i18n::s('Submit') . '" style="display: none;" />' . '</p></form>' . "\n"; // enable autocompletion Page::insert_script('$(function() {' . "\n" . ' $("#name").focus();' . "\n" . ' Yacs.autocomplete_names("assigned_name",true, "", function(data) { $("#submit_button").show().click(); });' . "\n" . '});' . "\n"); // back to the anchor page $links = array();