# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . global $db; global $_USER; global $_PROFILE; if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1; $start = getStart($page); $user = MODULE; $userInfo = $db->getUserInfo(false, $user); $_PROFILE = $userInfo; if (!$userInfo) { header('HTTP/1.0 404 Not Found'); define('TITLE', __('Not found')); echo '

'.__('Not found').'

'; echo __('The page you\'re looking for doesn\'t exists.'); die; } else { if ($_USER && ($_USER['username'] == $userInfo['username'])) { if (!is_numeric(PARAMS)) header('Location: '.BASE.'notes'); else define('VIEWABLE', 1); } else { if ($userInfo['private'] == '1') { if ($_USER) { if ($db->checkFollowing($userInfo['ID'], $_USER['ID'])) { define('VIEWABLE', 1); } } } else define('VIEWABLE', 1); } define('SEEING_PROFILE', $userInfo['username']); $string = str_replace('%username', $userInfo['username'], __('%username\'s profile')); define('TITLE', $string); if (!defined('VIEWABLE')) { echo '

'.__('Not allowed').'

'; echo __('You aren\'t allowed to see this user\'s profile.'); die; } else { $user = $_PROFILE['username']; //If the user is ignoring somebody, we set $ignored with the array, if not, we set 'false' if ($_USER['ignored']) $ignored = $_USER['ignored']; else $ignored = false; switch (PARAMS) { case 'replies': $module = 'replies'; $result = $db->getNotes('replies', $start, NOTES_PER_PAGE, false, $_PROFILE['username'], $ignored); $count = $db->countNotes('reply', $_PROFILE['username'], $ignored); break; case 'friends': $module = 'friends'; $result = $db->getNotes('friendsof', $start, NOTES_PER_PAGE, $_PROFILE['ID'], false, $ignored); $count = $db->countNotes('friendsof', $_PROFILE['ID'], $ignored); break; case 'favorites': $module = 'favorites'; $result = $db->getNotes('favorites', $start, NOTES_PER_PAGE, $_PROFILE['ID']); $count = $db->countNotes('favorites', $_PROFILE['ID']); break; case 'followers': $module = 'followers'; if (!$_PROFILE['show_followers']) { echo showStatus(__('You are not allowed'), 'warning'); } else { if (isset($_GET['p'])) $page = $_GET['p']; else $page = 1; $start = getStart($page); $result = $db->getFollowers($_PROFILE['ID'], $start, NOTES_PER_PAGE); if (count($result) == 1) $string = __("%s's %i follower"); else $string = __("%s's %i followers"); echo '
'.str_replace('%s', $_PROFILE['username'], str_replace('%i', $db->countFollowers($_PROFILE['ID']), $string)).'
'; echo '
'; if (count($result) == 0) echo showStatus(__('No users were found'), 'warning'); foreach ($result as $followers) showUser($followers['ID'], true); echo '
'; echo getPaginationString('followers', $db->countFollowers($_PROFILE['ID']), $page, NOTES_PER_PAGE, 1, '?p='); } break; case 'following': $module = 'following'; if (isset($_GET['p'])) $page = $_GET['p']; else $page = 1; $start = getStart($page); $result = $db->getFollowing($_PROFILE['ID'], $start, NOTES_PER_PAGE); if (count($result) == 1) $string = __("%s is following %i user"); else $string = __("%s is following %i users"); echo '
'.str_replace('%s', $_PROFILE['username'], str_replace('%i', $db->countFollowing($_PROFILE['ID']), $string)).'
'; echo '
'; if (count($result) == 0) echo showStatus(__('No users were found'), 'warning'); foreach ($result as $followers) showUser($followers['ID']); echo '
'; echo getPaginationString('following', $db->countFollowing($_PROFILE['ID']), $page, NOTES_PER_PAGE, 1, '?p='); break; default: if (is_numeric(PARAMS)) { $module = 'permalink'; $count = 1; } else { $module = 'default'; $result = $db->getNotes('archive', $start, NOTES_PER_PAGE, $_PROFILE['ID'], false, $ignored); $count = $db->countNotes('archive', $_PROFILE['ID']); } break; } if (($module != 'followers') && ($module != 'following')) { if ($module == 'permalink') { //define('HIDE_PERMALINK_ICON', 1); if ($db->checkNote(PARAMS, $_PROFILE['ID'])) showNote(array('id'=>intval(PARAMS)), false , false, true); } else { if ($_USER) doNoteForm(true); if (($_USER && (!in_array($_PROFILE['ID'], $_USER['ignored']))) || (!$_USER)) { echo ''; echo '
'; } } if ($_USER && (in_array($_PROFILE['ID'], $_USER['ignored']))) { if ($module != 'permalink') echo showStatus(__('You are ignoring this user'), 'warning'); } else { if ($count == 0) echo showStatus(__('No notes were found'), 'warning'); else { echo '
'; if($result) foreach ($result as $note) showNote($note); echo '
'; echo getPaginationString(BASE.$_PROFILE['username'].'/'.PARAMS, $count, $page); } } } } } ?>