& Mat�as Parodi # # 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 . # ## define("SECURITY", 1); error_reporting(0); include('./config.php'); mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME); include('./includes/functions.php'); $atom_title = 'Jisko, microblogging a medida'; $atom_link['via_href'] = 'http://jisko.net/'; $atom_link['via_title'] = 'Jisko Web Site'; $atom_link['self_href'] = 'http://jisko.net/atom_generator.php'; $atom_author['name'] = 'Jisko'; $atom_author['uri'] = 'http://jisko.net/'; $atom_generator['uri'] = 'http://jisko.net/'; $atom_generator['version'] = '1.0'; $atom_generator['content'] = 'Jisko ATOMGenerator'; $atom_logo = 'http://jisko.net/images/feed.png'; $atom_id = 'http://jisko.net/atom_generator.php'; $atom_updated = 'http://jisko.net/atom_generator.php'; header('Content-type: application/atom+xml; charset="utf-8"', true); echo ' '. $atom_title . ' '. $atom_author['name'] . ' '. $atom_author['uri'] . ' '. $atom_generator['content'] . ' '. $atom_logo . ' '. $atom_id . ' ' . date('c') . ''; $username = safe_str($_GET["username"], true); $action = safe_str($_GET["action"], true); $sql = "SELECT `users`.`id_user` FROM `users` WHERE (`users`.`username` = '" . $username . "') LIMIT 1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); mysql_free_result($result); $id_user = $row['id_user']; if ($username != '') { switch ($action) { case 'general': $sql = " SELECT `notes`.*, `users`.`avatar`, `users`.`username` FROM `notes` INNER JOIN `users` ON `users`.`id_user` = `notes`.`id_user` WHERE ((`notes`.`id_user` = '" . $id_user . "') AND (`notes`.`type` != 'private')) ORDER BY `notes`.`date` DESC LIMIT " . $CONFIG['NOTES_2p'] . ";"; break; case 'replies': $sql = " SELECT `notes`.*, `users`.`avatar`, `users`.`username` FROM `notes` INNER JOIN `users` ON `users`.`id_user` = `notes`.`id_user` WHERE ((`notes`.`type` = 'reply') AND ((`notes`.`id_user` = '" . $id_user . "') OR (`notes`.`to` LIKE '" . $username . "'))) ORDER BY `notes`.`date` DESC LIMIT " . $CONFIG['NOTES_2p'] . ";"; break; case 'followers': $sql = " SELECT `notes`.*, `users`.`avatar`, `users`.`username` FROM `followers` INNER JOIN `notes` ON `notes`.`id_user` = `followers`.`id_follower` INNER JOIN `users` ON `users`.`id_user` = `followers`.`id_follower` WHERE ((`followers`.`id_user` = '" . $id_user . "') AND (`notes`.`type` != 'private')) ORDER BY `notes`.`date` DESC LIMIT " . $CONFIG['NOTES_2p'] . ";"; break; case 'favorites': $sql = " ( SELECT `notes`.*, `users`.`avatar`, `users`.`username` FROM `followers` INNER JOIN `notes` ON `notes`.`id_user` = `followers`.`id_follower` INNER JOIN `users` ON `users`.`id_user` = `followers`.`id_follower` WHERE ((`followers`.`id_user` = '" . $id_user . "') AND (`notes`.`type` != 'private')) ) UNION DISTINCT ( SELECT `notes`.*, `users`.`avatar`, `users`.`username` FROM `notes` INNER JOIN `users` ON `users`.`id_user` = `notes`.`id_user` WHERE ((`notes`.`id_user` = '" . $id_user . "') AND (`notes`.`type` != 'private')) ) ORDER BY `date` DESC LIMIT " . $CONFIG['NOTES_2p'] . ";"; break; default: $sql = " SELECT `notes`.*, `users`.`avatar`, `users`.`username` FROM `notes` INNER JOIN `users` ON `users`.`id_user` = `notes`.`id_user` WHERE ((`notes`.`id_user` = '" . $id_user . "') AND (`notes`.`type` != 'private')) ORDER BY `notes`.`date` DESC LIMIT " . $CONFIG['NOTES_2p'] . ";"; } } else { $sql = " SELECT `notes`.*, `users`.`avatar`, `users`.`username` FROM `notes` INNER JOIN `users` ON `users`.`id_user` = `notes`.`id_user` WHERE (`notes`.`type` != 'private') ORDER BY `notes`.`date` DESC LIMIT " . $CONFIG['NOTES_2p'] . ";"; } $result = mysql_query($sql); if (mysql_affected_rows() != 0) { while ($row = mysql_fetch_assoc($result)) { $note = html_entity_decode($row['note']); $avatar = 'images/avatar/' . $row['username'] . '/thumb_note.' . $row['avatar']; $avatar = (file_exists($avatar) === true) ? $avatar : 'images/avatar/default_note.png'; echo ' ' . $row['username'] . ' ' . $row['username'] . ' http://jisko.net/' . $row['username'] . '/ http://jisko.net/' . $row['username'] . '/' . $row['permalink'] . ' ' .date('c', $row['date']) . ' ' . date('c', $row['date']) . ' '; } mysql_free_result($result); } echo ''; ?>