#
# 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 $_USER;
global $db;
if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1;
$start = getStart($page);
$userInfo = $db->getUserInfo(false, $username);
if(!$userInfo) {
echo '';
echo __('Not found');
echo '';
require 'template/footer.php';
die;
}
if($_USER && $userInfo['ID'] != $_USER['ID'] && $userInfo['private'] == '1') {
if($db->checkFollowing($userInfo['ID'], $_USER['ID'])) {
define('VIEWABLE', 1);
}
} elseif($userInfo['private'] == '0') {
define('VIEWABLE', 1);
}
if($_USER && $_USER['username'] == $userInfo['username'] && !is_numeric($other)) {
header('Location: '.BASE.'mobile/notes/');
die;
}
if(!defined('VIEWABLE')) {
echo '';
echo __('Not allowed');
echo '';
echo '
';
echo __('You aren\'t allowed to see this user\'s profile.');
require 'template/footer.php';
die;
}
if(is_numeric($other)) {
if($db->checkNote($other, $userInfo['ID'])) {
echo '
- '.__('Note').'
';
showNoteMobile(array('id'=>intval($other)));
echo '
';
}
} else {
$result = $db->getNotes('archive', $start, NOTES_PER_PAGE, $userInfo['ID']);
$count = $db->countNotes('archive', $userInfo['ID']);
$tmp_string = __('%username\'s profile');
$string = str_replace('%username', $userInfo['username'], $tmp_string);
echo '';
if(count($result)) {
foreach ($result as $row) showNoteMobile($row);
} else {
echo '- ' . __('No notes were found') . '
';
}
echo '
';
}
?>