# # 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; define('MBASE', BASE . 'mobile/'); define('NO_GUI', 1); import('mobile'); $module = PARAMS; $other = EXTRA; if(empty($module)) $module = 'home'; $iphone_ui = array('iPhone', 'iPod', 'Nokia5800', 'NokiaN97', 'Android'); if (preg_match('/('.implode('|', $iphone_ui).')/', $_SERVER['HTTP_USER_AGENT'])) { require 'mobile/iphone/template/header.php'; switch ($module) { case 'login': if (!$_USER) require 'mobile/iphone/login.php'; else header('Location: '.MBASE.'notes'); break; case 'notes': case 'home': require 'mobile/iphone/notes.php'; break; case 'post': require 'mobile/iphone/post.php'; break; case 'statuses': require 'mobile/iphone/statuses.php'; break; case 'user': if (EXTRA) { $userInfo = $db->getUserInfo(false, EXTRA); if (!$userInfo) header('Location: '.MBASE.'notes'); else { if ($_USER) { if ($_USER['username'] == $userInfo['username']) header('Location: '.MBASE.'notes'); else require 'mobile/iphone/user.php'; } else require 'mobile/iphone/user.php'; } } else header('Location: '.MBASE.'notes'); break; case 'report': if (EXTRA) { $userInfo = $db->getUserInfo(false, EXTRA); if (!$userInfo) header('Location: '.MBASE.'notes'); else { if ($_USER) { if ($_USER['username'] == $userInfo['username']) header('Location: '.MBASE.'notes'); else require 'mobile/iphone/report.php'; } else require 'mobile/iphone/report.php'; } } else header('Location: '.MBASE.'notes'); break; case 'reportok': if (EXTRA) { $userInfo = $db->getUserInfo(false, EXTRA); if (!$userInfo) header('Location: '.MBASE.'notes'); else { if ($_USER) { if ($_USER['username'] == $userInfo['username']) header('Location: '.MBASE.'notes'); else { global $mailing; $mailing->reportAbuse(EXTRA); header('Location: '.MBASE.'notes'); } } else header('Location: '.MBASE.'notes'); } } else header('Location: '.MBASE.'notes'); break; case 'friends': require 'mobile/iphone/users.php'; break; default: $username = trim($module); require 'mobile/iphone/user.php'; break; } require 'mobile/iphone/template/footer.php'; } else { require 'mobile/template/header.php'; switch ($module) { case 'login': require 'mobile/login.php'; break; case 'public': require 'mobile/public.php'; break; case 'notes': case 'home': if($_USER) require 'mobile/notes.php'; else require 'mobile/public.php'; break; case 'follow': require 'mobile/follow.php'; break; default: $username = trim($module); require 'mobile/user.php'; break; } require 'mobile/template/footer.php'; } ?>