// http://www.lovemachineinc.com require_once "class/frontend.class.php"; require_once "class/UserInfo.php"; $front = Frontend::getInstance(); if (!$front->isUserLoggedIn()) { $front->getUser()->askUserToAuthenticate(); } if (isset($_GET['user'])) { $user = urldecode($_GET['user']); $userInfo = new UserInfo(); if (strpos($user, '@')) { $userInfo->loadUserByUsername($user, $front->getCompany()->getid()); } else { $userInfo->loadUserByNickname($user, $front->getCompany()->getid()); } if (!$userInfo->getId()) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); die("Object Not Found. Error 404"); } } else { die('No user data provided'); } /*********************************** HTML layout begins here *************************************/ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US" > <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>SendLove | User info</title> <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" /> <link href="css/tofor.css" rel="stylesheet" type="text/css" />
/** * Given a result record from a Execute call, it will fill in the * fields of the object, so that we don't have to repeat the same * code too many times */ function _fillUserInformation($query_result, $extraInfo = false) { $userInfo = new UserInfo($query_result["user"], $query_result["password"], $query_result["email"], $query_result["about"], $query_result["full_name"], $query_result["resource_picture_id"], unserialize($query_result["properties"]), $query_result["id"]); if ($extraInfo) { // load this data if explicitely required! $userBlogs = $this->getUsersBlogs($userInfo->getId()); $userInfo->setBlogs($userBlogs); } // set some permissions //$userInfo->setSiteAdmin($this->perms->isSiteAdmin( $userInfo->getId())); $userInfo->setSiteAdmin($query_result["site_admin"]); $userInfo->setStatus($query_result["status"]); return $userInfo; }
function getNicknameByUsername() { require_once 'class/UserInfo.php'; if (isset($_REQUEST['username'])) { $user = urldecode($_REQUEST['username']); $userInfo = new UserInfo(); $userInfo->loadUserByUsername($user, 1); if ($userInfo->getId()) { respond(array('success' => true, 'nickname' => $userInfo->getNickname())); } } respond(array('success' => false, 'params' => '')); }