<?php //namespace Teranga; $title = elgg_echo('trip_companions'); $people = get_suggestions($vars['owner']->guid, $vars['friends'], $vars['groups']); $content = elgg_view('trip_companions/people', array('people' => $people)); $body = elgg_view_layout('content', array('title' => $title, 'filter' => false, 'content' => $content)); echo elgg_view_page($title, $body);
echo get_active_player(); } else { if ($_GET['fn'] === "get_player_positions") { header('Content-Type: application/json'); echo json_encode(get_player_positions()); } else { if ($_GET['fn'] === "update_player") { update_player($_GET['username'], $_GET['x'], $_GET['y']); } else { if ($_GET['fn'] === "make_suggestion") { header('Content-Type: application/json'); echo json_encode(make_suggestion($_GET['username'], $_GET['wep'], $_GET['loc'], $_GET['char'])); } else { if ($_GET['fn'] === "get_suggestions") { header('Content-Type: application/json'); echo json_encode(get_suggestions($_GET['username'])); } else { if ($_GET['fn'] === "show_card") { header('Content-Type: application/json'); echo show_card($_GET['username'], $_GET['player'], $_GET['card']); } else { if ($_GET['fn'] === "check_for_answer") { header('Content-Type: application/json'); echo json_encode(check_suggestion($_GET['suggestion_id'])); } else { if ($_GET['fn'] === "accuse") { accuse($_GET['username'], $_GET['character'], $_GET['location'], $_GET['weapon']); } else { if ($_GET['fn'] === "checkWin") { checkWin(); }
* Author: Rosana Montes Soldado * Universidad de Granada * Licence: CC-ByNCSA * Reference: Microproyecto CEI BioTIC Ref. 11-2015 * Project coordinator: @rosanamontes * Website: http://lsi.ugr.es/rosana * * File: people related with a user in a trip */ $widget = $vars['entity']; $friends = $widget->look_in_friends == 'no' ? 0 : 3; $groups = $widget->look_in_groups == 'no' ? 0 : 3; $num_display = $widget->num_display != null ? $widget->num_display : 3; if (!elgg_is_logged_in()) { echo elgg_echo('trip_companions:people:not:found'); return; } $people = get_suggestions(elgg_get_logged_in_user_guid(), $friends, $groups); // limit our number of people while (count($people) > $num_display) { array_pop($people); } echo elgg_view('trip_companions/people', array('people' => $people)); ?> <div class="clearfloat"></div> <div class="widget_more_wrapper"> <?php echo elgg_view('output/url', array('text' => elgg_echo('trip_companions:see:more'), 'href' => 'trip_companions')); ?> </div>
display_form(); } else { $errors = do_changes(); if ($errors == 0) { $logon_now_as = $uid; if (isset($savepass)) { setcookie("ltrLoginAs", $uid, time() + 2592000); } $sess->register("logon_now_as"); page_close(); display_done(); exit; } $suggestions = ""; if (($errors & ERR_USEREXISTS) != 0) { $suggestions = get_suggestions(strtolower($username)); } $uname = ""; if ($suggestions == "") { $uname = $username; } display_form($errors, $suggestions, $HTTP_POST_VARS['field_email'], $uname); } function display_done() { global $kat, $auth, $uid, $perm, $sess; if (!defined("COMMON_PERMISSIONS_INC")) { include "commonapi/common_permissions.inc"; } /* auth_preauth() will authenticatge the user since logon_now_as is registered and set to true
<?php $q = @$_GET['q']; $target = @$_GET['target']; $results = get_suggestions($q); echo !empty($results) ? print_results($results) : ""; function print_results($results) { global $target, $q; $response = "<ul>"; for ($i = 0; $i < count($results); $i++) { $url = @str_ireplace("%s", urlencode($results[$i]), $_GET['url']); $response .= '<li><a href="' . $url . '" target="' . $target . '">' . str_ireplace($q, $q . '<strong>', $results[$i]) . '</strong></a></li>'; } $response .= "</ul>"; return $response; } function get_suggestions($q) { $request_uri = 'http://google.com/complete/search?output=toolbar&q=' . urlencode($q); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request_uri); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $xml = json_decode(json_encode(new SimplexmlElement(curl_exec($ch))), true); curl_close($ch); $results = @$xml['CompleteSuggestion']; $result = array(); if (@$results['suggestion']) {