public static function setStatus($user_id, $text) { $status = new PersonalStatus(); $status->owner = $user_id; $status->text = $text; $status->time_saved = sql_datetime(time()); return $status->store(); }
<?php /** * For normal users usage of chatrooms */ namespace cd; $session->requireLoggedIn(); switch ($this->owner) { case 'like': $status = PersonalStatus::get($this->child); if (!$status) { die('WEEH'); } if (Like::isLiked($status->id, STATUS, $session->id)) { die('LIKED'); } Like::set($status->id, STATUS, $session->id); redir('u/profile/' . $status->owner); break; default: echo 'No handler for view ' . $this->owner; }
function handleEditStatus($p) { $session = SessionHandler::getInstance(); if (!$session->id) { return; } PersonalStatus::setStatus($session->id, $p['status']); js_redirect('u/profile'); }
die('ECHKKP'); } if (Bookmark::exists(BOOKMARK_USERBLOCK, $session->id, $user_id)) { echo 'User has blocked you from access'; return; } if ($user_id != $session->id) { Visit::create(PROFILE, $user_id, $session->id); } echo '<h1>Profile for ' . $user->name . '</h1>'; if (UserHandler::isOnline($user_id)) { echo 'Last active ' . ago($user->time_last_active) . '<br/>'; } else { echo 'Offline<br/>'; } $status = PersonalStatus::getByOwner($user_id); if ($status && $status->text) { echo '<b>STATUS: ' . $status->text . '</b><br/>'; if ($session->id != $user_id) { if (!Like::isLiked($status->id, STATUS, $session->id)) { echo ahref('u/status/like/' . $status->id, 'Like') . '<br/>'; } else { echo 'You like this<br/>'; } } $other_likes = Like::getAllExcept($status->id, STATUS, $session->id); if ($other_likes) { echo '<h2>FIXME: properly display other likes</h2>'; d($other_likes); } }