# # 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; $module = MODULE; $params = PARAMS; if (!$_USER) { if ($params != 'public' && ($module != 'public')) header('Location: '.BASE.'home'); else $params = 'public'; } else { if ($module == 'public') $params = 'public'; } if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1; $start = getStart($page); define('TITLE', __('Notes')); if ($_USER['show_twits'] == '1') { if ($params == 'friends') $params = 'all'; elseif (empty($params)) $params = 'all'; } //We define AJAX_SECTION to tell JS to load AJAX of this section if (!$params) define('AJAX_SECTION', 'friends'); else define('AJAX_SECTION', strtolower($params)); //We define AJAX_PAGE to tell JS to load AJAX of this page define('AJAX_PAGE', (int)$page); //If ?status it's defined, then we fill the textarea with the content if ($_GET['note']) $getText = $_GET['note']; if(empty($params) || $params == 'friends') { if ($_USER['show_twits'] == '1') $params = 'all'; else $params = 'friends'; } switch ($params) { case 'private': $update = $db->updateUnreadPrivates($_USER['username']); case 'private_sent': $result = $db->getNotes($params, $start, NOTES_PER_PAGE, $_USER['ID'], $_USER['username']); $count = $db->countNotes($params, $_USER['username']); doNoteForm(true, false, $getText); break; case 'archive': case 'favorites': case 'twitter': case 'twitter_replies': $result = $db->getNotes($params, $start, NOTES_PER_PAGE, $_USER['ID'], false); if ($params == 'twitter_replies') $count = $db->countNotes('twitter_reply', $_USER['ID']); else $count = $db->countNotes($params, $_USER['ID']); doNoteForm(true, false, $getText); break; case 'delete': $db->deleteNote($_GET['id'], $_USER['ID']); header('Location: '.$_SERVER['HTTP_REFERER']); die; break; case 'public': $result = $db->getNotes('public', $start, NOTES_PER_PAGE, false, false, $_USER['ignored']); $count = $db->countNotes('public', '', $ignored); case 'replies': if (is_null($result)) $result = $db->getNotes('replies', $start, NOTES_PER_PAGE, $_USER['ID'], $_USER['username'], $_USER['ignored']); if (is_null($count)) $count = $db->countNotes('reply', $_USER['username'], $_USER['ignored']); case 'all': case 'friends': default: if (is_null($result)) $result = $db->getNotes($params, $start, NOTES_PER_PAGE, $_USER['ID'], false, $_USER['ignored']); if (is_null($count)) $count = $db->countNotes($params, $_USER['ID'], $_USER['ignored']); if ($_USER) { setUpdate(); doNoteForm(true, false, $getText); } break; } //We count the unread privates. Then we hightlight the private tab. $unread_privates = $db->countNotes('unread_private', $_USER['username']); if ($_USER) { $tabs = array('archive' => __('Archive'), 'replies' => __('Replies'), 'friends' => __('Friends'), 'private' => __('Private')); if (!empty($_USER['twitter_password'])) { $tabs['twitter'] = __('Twitter'); $style = '448px'; } else $style = '376px'; echo ''; } else { echo '
'.__('Public notes').'
'; } echo '
'; if ($_USER['show_twits']) { if ($params == 'twitter' || ($params == 'twitter_replies' || ($params == 'all'))) { if ($_USER['last_twitter_update']) echo '
'.showStatus(__('Twitter updated').' '.showTimeAgo($_USER['last_twitter_update']), 'ok'); else echo '
'.showStatus(__('Twitter not updated yet, wait...'), 'error'); } } if ($params == 'twitter' || ($params == 'twitter_replies')) { echo '
'; echo '
'.__('Following').' | '.__('Replies').'

'; } if ($params == 'private' || $params == 'private_sent') { echo '
'; echo '
'.__('Received').' | '.__('Sent').'

'; } echo '
'; if (!count($result)) echo showStatus(__('No notes were found'), 'warning'); else { foreach ($result as $note) showNote($note); } echo '
'; echo getPaginationString(BASE.'notes/'.$params, $count, $page); ?>