public static function silent($user) { // Make sure the user doesn't exist if (is_numeric($user)) { if ($userData = User::get($user, "uni_id")) { return true; } } else { if ($userData = User::getIDByHandle($user)) { return true; } } // Get User Data from Auth $packet = array("user" => $user, "columns" => "uni_id, handle, display_name"); if ($response = API_Connect::to("auth", "UserData", $packet)) { return self::register((int) $response['uni_id'], $response['handle'], $response['display_name'], ""); } return false; }
public static function logActivity() { // Not ready yet API_Connect::to("karma", "KarmaActivityAPI", array("uni_id" => Me::$id, "site_handle" => SITE_HANDLE, "action" => "view")); }
} // Make sure the content exists if ($contentData = Database::selectOne("SELECT id, uni_id, url, url_slug FROM content_entries WHERE id=? LIMIT 1", array((int) $_POST['contentID']))) { // Prepare Values $contentID = (int) $contentData['id']; $authorID = (int) $contentData['uni_id']; // If the entry was aggregated from another site if ($contentData['url']) { // Prepare the Packet $packet = array("uni_id" => Me::$id, "url_slug" => $contentData['url_slug'], "type" => "boost"); if (isset($_POST['voteType'])) { $packet["voteType"] = (int) $_POST['voteType']; } $articleSite = Database::selectValue("SELECT site_handle FROM network_data WHERE site_url=?", array($contentData['url'])); // Run the API $response = API_Connect::to($articleSite, "TrackerAPI", $packet); echo json_encode($response); exit; } // Run the Content Track Handler $contentTrack = new ContentTrack($contentID, Me::$id); switch ($_POST['type']) { case "boost": $contentTrack->voteUp(); break; case "nooch": $success = false; $noochCount = 0; if ($authorID != Me::$id) { // Check if the user has already triple nooched $noochCount = Database::selectValue("SELECT nooch FROM content_tracking_users WHERE uni_id=? AND content_id=? LIMIT 1", array(Me::$id, $contentID));
if (isset($_POST['send_email'])) { // Email a verification letter AppVerification::sendVerification($uniID); Alert::success("Email Sent", "The account was created successfully! A verification email has been sent to " . $_POST['email'] . "!"); } else { Alert::success("User Added", "The account was created successfully!"); } } } // Create the account if ($uniID) { $pass = Database::query("INSERT INTO users_handles (handle, uni_id) VALUES (?, ?)", array($_POST['handle'], $uniID)); if (Database::endTransaction($pass)) { // Create the ProfilePic for this Account $packet = array("uni_id" => $uniID, "title" => $_POST['display_name']); $response = API_Connect::to("profile_picture", "SetDefaultPic", $packet); // Reset Values $_POST['handle'] = ""; $_POST['display_name'] = ""; $_POST['email'] = ""; $_POST['password'] = ""; } } else { Database::endTransaction(false); Alert::error("Process Error", "An error has occurred while processing this registration.", 1); } } } else { $_POST['email'] = isset($_POST['email']) ? Sanitize::email($_POST['email']) : ""; $_POST['password'] = isset($_POST['password']) ? Sanitize::safeword($_POST['password']) : ""; $_POST['handle'] = isset($_POST['handle']) ? Sanitize::variable($_POST['handle']) : "";