# # 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 . function showNoteMobile($row) { global $db; global $_USER; if($row['type'] == 'twitter' || $row['type'] == 'twitter_reply') return showTwitMobile($row['id']); $noteInfo = $db->getNoteCombined($row['id']); if(!$noteInfo) return false; extract($noteInfo); if($type == 'private') { if( strtolower(trim($_USER['username'])) !== strtolower(trim($to)) ) { if($user_id != $_USER['ID']) return false; } } $note = utf8_htmlentities($note); $note = preg_replace_callback('/\[(\*|\/|_|\-)(.+)\]/U', create_function('$matches', ' switch ($matches[1]) { case "*": return "" . $matches[2] . ""; case "/": return "" . $matches[2] . ""; case "_": return "" . $matches[2] . ""; case "-": return "" . $matches[2] . ""; } '), $note); $note = preg_replace('#https?://[^.\s]+\.[^\s]+#ix', '$0', $note); if ($twitter) $note = preg_replace('/(\s|\A)(@){1}(\w+)/', '$1$2$3', $note); else $note = preg_replace('/(\s|\A)(@){1}(\w+)/', '$1$2$3', $note); //if($type == 'private') $note = preg_replace('/(\s|\A)(!){1}(\w+)/', '$1$2$3', $note); echo ''; echo ''.$username.''; echo ' '.$note.''; echo ' '.showTimeAgo($timestamp).''; echo "\n"; } function showNoteMobileiPhone($row, $reducedAjax = false) { global $db; global $_USER; if($row['type'] == 'twitter' || $row['type'] == 'twitter_reply') return showTwitMobileiPhone($row['id'], $reducedAjax); if ($reducedAjax) $return = array(); $noteInfo = $db->getNoteCombined($row['id']); if(!$noteInfo) return false; extract($noteInfo); if($type == 'private') { if( strtolower(trim($_USER['username'])) !== strtolower(trim($to)) ) { if($user_id != $_USER['ID']) return false; } } $note = utf8_htmlentities($note); $note = preg_replace_callback('/\[(\*|\/|_|\-)(.+)\]/U', create_function('$matches', ' switch ($matches[1]) { case "*": return "" . $matches[2] . ""; case "/": return "" . $matches[2] . ""; case "_": return "" . $matches[2] . ""; case "-": return \'\' . $matches[2] . \'\'; } '), $note); //Fixing a XSS issue reported by @kosugi $note = str_replace('<', '<', $note); $note = preg_replace('#https?://[^.\s]+\.[^\s]+#ix', '$0', $note); if ($twitter) $note = preg_replace('/(\s|\A)(@){1}(\w+)/', '$1$2$3', $note); else $note = preg_replace('/(\s|\A)(@){1}(\w+)/', '$1$2$3', $note); //if($type == 'private') $note = preg_replace('/(\s|\A)(!){1}(\w+)/', '$1$2$3', $note); if ($reducedAjax) { $return['text'] = $note; $return['id'] = $ID; $return['time_ago'] = showTimeAgo($timestamp); $return['username'] = $username; if (preg_match("/@\b".$_USER['username']."\b/i", $note) == 1) $return['replying'] = true; if ($attached_file) $return['attached_file'] = $attached_file; return $return; } else { echo ''; echo ''.$username.''; echo ' '.put_smileys(trim(stripslashes($note))); echo ' '.showTimeAgo($timestamp).''."\n"; } } function showTwitMobile ($noteID) { global $db; global $_USER; $noteInfo = $db->getTwit($noteID); extract($noteInfo); $note = preg_replace('#https?://[^.\s]+\.[^\s]+#ix', '$0', $note); $note = stripslashes($note); $note = preg_replace('/(\s|\A)(@|!){1}(\w+)/', '$1$2$3', $note); $serial = unserialize(stripslashes($serial)); extract($serial); echo '
  • '; echo ''.$username.' (twitter)'; echo ' '.$note.''; echo ' '.showTimeAgo($timestamp).'
  • '; echo "\n"; } function showTwitMobileiPhone ($noteID, $reducedAjax = false) { global $db; global $_USER; $noteInfo = $db->getTwit($noteID); extract($noteInfo); if ($reducedAjax) $return = array(); $note = preg_replace('/(?:[\w^_]{3,}:\/\/)(?:(?:[\w^_]{2,}\.)?[\w\-]{2,}(?:\.[\w^_]{2,})+){1}[^\s\[\]\(\)<>,";\.]*(?:\.\w+)*[^\s\[\]\(\)<>,";\.]*/', '$0', $note); $note = stripslashes($note); $note = preg_replace('/(\s|\A)(@|!){1}(\w+)/', '$1$2$3', $note); $serial = unserialize(stripslashes($serial)); extract($serial); if ($reducedAjax) { $return['text'] = $note.' '; $return['id'] = $ID; $return['time_ago'] = showTimeAgo($timestamp); $return['username'] = $username; if (preg_match("/@\b".$_USER['username']."\b/i", $note) == 1) $return['replying'] = true; if ($attached_file) $return['attached_file'] = $attached_file; return $return; } else { echo ''; echo ''.$username.' (twitter)'; echo ' '.$note; echo ' '.showTimeAgo($timestamp).''."\n"; } } /* PAGINATION (DIGG-STYLE PAGINATION BY STRANGER STUDIOS) */ function getPaginationStringMobile($targetStart, $totalitems, $page, $limit = NOTES_PER_PAGE, $adjacents = 1, $pagestring = "?page=") { $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = $page + 2; //lastpage is = total items / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 $pagination = ""; if($lastpage > 1) { $pagination .= "
    1) $pagination .= "<"; else $pagination .= "<"; //pages if ($lastpage < 7 + ($adjacents * 2)) { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } elseif($lastpage >= 7 + ($adjacents * 2)) { if($page < 1 + ($adjacents * 3)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } else { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $lastpage - (1 + ($adjacents * 3)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } } if ($page < $counter - 1) $pagination .= ">"; else $pagination .= ">"; $pagination .= "
    \n"; } return $pagination; } function getPaginationStringMobileiPhone($type) { return ''; } ?>