function wiki_get_username($author) { $extension = explode(" ", $author); $num = count($extension) - 1; $num2 = count($extension) - 2; $num3 = count($extension) - 3; $num4 = count($extension) - 4; if (record_exists("user", 'firstname', addslashes($extension[$num4]), 'lastname', addslashes($extension[$num3]))) { $info = get_user_info_from_db('firstname', addslashes($extension[$num4]), 'lastname', addslashes($extension[$num3])); } else { $info->username = '******'; } return $info->username; }
/** * * * */ function bookmarks_print_item($item, $cmid, $userids = '', $commands = false, $options = '') { $link = bookmarks_get_link($item->linkid); echo '<div class="bookmark"> <h3 class="name"><a class="previewlink" title="' . $link->url . '" href="link.php?id=' . $cmid . '&url=' . urlencode($link->url) . '">' . $item->name . '</a></h3>'; if ($commands) { echo '<div class="commands"> <a class="edit" href="edit.php?id=' . $cmid . '&item=' . $item->id . '">[' . get_string('edit', 'forum') . ']</a> / <a class="rm" href="del.php?id=' . $cmid . '&item=' . $item->id . '">[' . get_string('delete') . ']</a> </div>'; } echo '<p class="notes">' . $item->description . '</p>'; $tags = bookmarks_get_item_tags($item->id); if (!empty($tags)) { echo '<div class="meta">'; echo get_string('tags') . ':'; foreach ($tags as $tag) { echo '<a class="tag" href="view.php?id=' . $cmid . '&action=search&query=' . urlencode('tag:' . $tag->name) . '">' . $tag->name . '</a>'; } echo '</div>'; } echo '<div class="meta">'; if ($options == 'detailed') { $usr = get_user_info_from_db('id', $item->userid); echo get_string('savedby', 'bookmarks') . $usr->lastname . ', ' . $usr->firstname; } else { $cm = get_coursemodule_from_id('bookmarks', $cmid); $countall = bookmarks_count_all_bookmarks($link->url); $countpart = bookmarks_count_all_accessible_bookmarks($link->url, $cm->instance, $userids); if ($countall > 1) { echo get_string('savedby', 'bookmarks') . $countall . ' (<a href="view.php?id=' . $cmid . '&action=search&query=' . urlencode('url:' . $link->url) . '&options=detailed">' . $countpart . ' ' . get_string('people', 'bookmarks') . '</a>)'; } else { echo get_string('savedby', 'bookmarks') . $countall . ' (<a href="view.php?id=' . $cmid . '&action=search&query=' . urlencode('url:' . $link->url) . '&options=detailed">' . $countpart . ' ' . get_string('person', 'bookmarks') . '</a>)'; } echo ' \\ ' . get_string('seen', 'bookmarks') . ' ' . $link->hits . ' ' . get_string('times', 'bookmarks'); } echo '</div>'; echo '</div>'; }
public function updateUser($PHPMOODLEWSSESSID, $username, $firstname, $lastname, $email) { if (!$this->isAuthenticated()) { return MOODLEWS_VIOLENCE; } $user = get_user_info_from_db('username', $username); if (0 < $user->id) { $user->confirmed = 1; $user->username = $username; $user->firstname = $firstname; $user->lastname = $lastname; $user->email = $email; $id = update_record($this->users_table, $user); if ($id) { return MOODLEWS_SUCCESS; } } return MOODLEWS_ERROR; }