function twitter_parse_tags($input, $entities = false) { $out = $input; //Linebreaks. Some clients insert \n for formatting. $out = nl2br($out); // Use the Entities to replace hyperlink URLs // http://dev.twitter.com/pages/tweet_entities if ($entities) { if ($entities->urls) { foreach ($entities->urls as $urls) { if ($urls->expanded_url != "") { $display_url = $urls->expanded_url; } else { $display_url = $urls->url; } $url = $urls->url; $parsed_url = parse_url($url); if (empty($parsed_url['scheme'])) { $url = 'http://' . $url; } if (setting_fetch('gwt') == 'on') { $encoded = urlencode($url); $link = "http://google.com/gwt/n?u={$encoded}"; } else { $link = $url; } $link_html = '<a href="' . $link . '" target="' . get_target() . '">' . $display_url . '</a>'; $url = $urls->url; // Replace all URLs *UNLESS* they have already been linked (for example to an image) $pattern = '#((?<!href\\=(\'|\\"))' . preg_quote($url, '#') . ')#i'; $out = preg_replace($pattern, $link_html, $out); } } if ($entities->hashtags) { foreach ($entities->hashtags as $hashtag) { $text = $hashtag->text; $pattern = '/(^|\\s)([##]+)(' . $text . ')/iu'; $link_html = ' <a href="hash/' . $text . '">#' . $text . '</a> '; $out = preg_replace($pattern, $link_html, $out, 1); } } } else { // If Entities haven't been returned (usually because of search or a bio) use Autolink // Create an array containing all URLs $urls = Twitter_Extractor::create($input)->extractURLs(); // Hyperlink the URLs if (setting_fetch('gwt') == 'on') { foreach ($urls as $url) { $encoded = urlencode($url); $out = str_replace($url, "<a href='http://google.com/gwt/n?u={$encoded}' target='" . get_target() . "'>{$url}</a>", $out); } } else { $out = Twitter_Autolink::create($out)->addLinksToURLs(); } // Hyperlink the # $out = Twitter_Autolink::create($out)->setTarget('')->addLinksToHashtags(); } // Hyperlink the @ and lists $out = Twitter_Autolink::create($out)->setTarget('')->addLinksToUsernamesAndLists(); // Emails $tok = strtok($out, " \n\t\n\r"); // Tokenise the string by whitespace while ($tok !== false) { // Go through all the tokens $at = stripos($tok, "@"); // Does the string contain an "@"? if ($at && $at > 0) { // @ is in the string & isn't the first character $tok = trim($tok, "?.,!\"\\'"); // Remove any trailing punctuation if (filter_var($tok, FILTER_VALIDATE_EMAIL)) { // Use the internal PHP email validator $email = $tok; $out = str_replace($email, "<a href=\"mailto:{$email}\">{$email}</a>", $out); // Create the mailto: link } } $tok = strtok(" \n\t\n\r"); // Move to the next token } // Add Emoticons :-) if (setting_fetch('emoticons') != 'off') { $out = emoticons($out); } //Return the completed string return $out; }
?> "><?php } echo stripslashes($data['name']); if ($data['showEmail'] == 1) { ?> </a><?php } ?> wrote <?php $date = new DateTime($data['time']); echo 'on ' . $date->format("l") . " the " . $date->format("jS") . " around " . $date->format("h:s a") . "</div>"; $message = ubb(nl2br(stripslashes(htmlentities(valid($data['message']))))); echo '<div class="content">'; if ($data['enableEmoticons'] == 1) { echo emoticons($message); } if ($data['enableEmoticons'] == 0) { echo $message; } echo '</div>'; ?> </div> <?php } echo '</div>'; echo "<div id='pagination'>"; if ($pid > 1) { echo " <a href='?page=" . $_GET['page'] . "&page-id=1#pagination'><<</a> "; echo " "; $previous = $pid - 1;
function loop($id_usr, $type, $userloop, $follow, $tabnumber, $id_group) { include './inc/config.php'; $connuni = @mysql_connect($host, $user, $pass); @mysql_select_db($db, $connuni); echo "<!-- START TAB " . $tabnumber . " -->"; echo "<div id=\"country" . $tabnumber . "\" class=\"tabcontent\">\n\t<div id=\"statuses\">"; //Choose type! if ($type == "Public timeline") { $sql0 = "SELECT status_id,user_id,status, DATE_FORMAT(date_set,'%M %e, %Y @ %l:%i:%s %p') AS ds FROM mt_statuses ORDER BY date_set DESC"; } elseif ($type == "Following") { $long = strlen($follow); //echo $long; $long_m = $long - 1; //echo $long_m; $follow_m = substr($follow, -$long, $long_m); //echo $follow_m; $sql0 = "SELECT status_id,user_id,status, DATE_FORMAT(date_set,'%M %e, %Y @ %l:%i:%s %p') AS ds FROM mt_statuses WHERE user_id IN (" . avoid_injection($follow_m) . ") ORDER BY date_set DESC"; //This is to show user updates with following option to show OR user_id='$id_usr' } elseif ($type == "User") { $usern = name_hide($userloop); $sql0 = "SELECT status_id,user_id,status, DATE_FORMAT(date_set,'%M %e, %Y @ %l:%i:%s %p') AS ds FROM mt_statuses WHERE user_id='" . avoid_injection($userloop) . "' OR status LIKE '%@" . avoid_injection($usern) . "%' ORDER BY date_set DESC"; } /*For all*/ /*get page*/ $registros = 15; $pagina = $_GET["pagina"]; if (!$pagina) { $inicio = 0; $pagina = 1; } else { $inicio = ($pagina - 1) * $registros; } /*end get page*/ $r0 = mysql_query($sql0, $connuni) or die('La consulta falló:' . mysql_error($enlace)); $total_registros = mysql_num_rows($r0); if ($type == "User") { $usern = name_hide($userloop); $query = "SELECT status_id,user_id,status, DATE_FORMAT(date_set,'%M %e, %Y @ %l:%i:%s %p') AS ds FROM mt_statuses WHERE user_id='" . avoid_injection($userloop) . "' OR status LIKE '%@" . avoid_injection($usern) . "%' ORDER BY date_set DESC LIMIT {$inicio}, {$registros}"; } elseif ($type == "Following") { $long = strlen($follow); //echo $long; $long_m = $long - 1; //echo $long_m; $follow_m = substr($follow, -$long, $long_m); //echo $follow_m; $query = "SELECT status_id,user_id,status, DATE_FORMAT(date_set,'%M %e, %Y @ %l:%i:%s %p') AS ds FROM mt_statuses WHERE user_id IN (" . avoid_injection($follow_m) . ") ORDER BY date_set DESC LIMIT {$inicio}, {$registros}"; //This is to show user updates with following option to show OR user_id='$id_usr' } elseif ($type == "Public timeline") { $query = "SELECT status_id,user_id,status, DATE_FORMAT(date_set,'%M %e, %Y @ %l:%i:%s %p') AS ds FROM mt_statuses ORDER BY date_set DESC LIMIT {$inicio}, {$registros}"; } $result = mysql_query($query, $connuni) or die(mysql_error() . ': ' . $query); $total_paginas = ceil($total_registros / $registros); //This table was for pagination but I changed it for another one without js //Page links an title echo "<table width=\"445\"><thead>\n\t\n\t<tr>\n\t<td>"; if ($id_group != "") { echo "<form style=\"float: right;margin-top: 3px; margin-right: 3px; position: absolute;\" action=\"\" name=\"delete_group\" method=\"post\">"; echo "<input type=\"image\" src=\"" . $pth . "inc/icons/gr_dl.png\" name=\"delete_group_id\" value=\"" . $id_group . "\">"; echo "</form>"; $des = "SELECT group_desc, members FROM mt_group WHERE id_group='" . avoid_injection($id_group) . "'"; $resultdes = mysql_query($des, $connuni) or die(mysql_error() . ': ' . $query); while ($row = mysql_fetch_assoc($resultdes)) { echo "<div style=\"margin-left: 25px;\">"; echo $row["group_desc"]; $members_message = explode(",", $row["members"]); $b = 0; while ($members_message[$b]) { $namem = name_hide($members_message[$b]); $group_replie .= "@" . $namem . " "; $b = $b + 1; } echo " <a href=\"#\" style=\"border: 0px;float: right;\" onclick=\"insertAtCaret('status','" . $group_replie . "');\"><img border=0 src=\"./inc/icons/group_go.png\"></a>"; echo "</div>"; } } echo "</td></tr></thead><tbody>"; //loop while ($row = mysql_fetch_assoc($result)) { echo '<tr><td> <div class="status-box"> <div style="float: left; width: 430px;">'; echo "<form style=\"float: right;\" action=\"\" method=\"post\">"; if ($id_usr == $row['user_id']) { echo "<input type=\"image\" src=\"" . $pth . "inc/icons/dl.png\" name=\"status_id\" value=\"" . $row["status_id"] . "\">"; } echo "</form>"; echo "<form style=\"float: right;\" action=\"\" method=\"post\">"; if ($id_usr != $row['user_id']) { if (strstr($follow, $row['user_id']) == true) { } else { echo "<input type=\"image\" src=\"" . $pth . "inc/icons/+.png\" name=\"status_id_mas\" value=\"" . $row["user_id"] . "\">"; } } echo "</form>"; echo "<form style=\"float: right; "; if (strstr($follow, $row['user_id']) == true) { } else { echo "margin-top: 12px; margin-right: -9px;"; } echo "\" action=\"\" method=\"post\">"; if ($id_usr != $row['user_id']) { if (strstr($follow, $row['user_id']) == true) { echo "<input type=\"image\" src=\"" . $pth . "inc/icons/-.png\" name=\"status_id_menos\" value=\"" . $row["user_id"] . "\">"; } else { } } echo "</form>"; //avatar if (gravatar($row['user_id']) == "yes") { $grav_correo = correo($row["user_id"]); echo "<a class=\"avatar\" href=\"index.php?user="******"user_id"] . "\">"; echo "<img width=\"48\" height=\"48\" align=\"left\" style=\"margin-right: 5px;\" border=\"1\" src=\""; echo getGravatarUrl($grav_correo, $defImg, "80", "G"); echo "\" alt=\"Gravatar\"></a>"; } else { if (file_exists("./avatar/" . $row['user_id'] . ".jpg") == true) { echo "<a class=\"avatar\" href=\"index.php?user="******"user_id"] . "\">"; echo '<img align="left" width="48" height="48" style="margin-right: 5px;" border=\\"1\\" src="' . $pth . 'avatar/', $row['user_id'], '.jpg"></a>'; } else { echo "<a class=\"avatar\" href=\"index.php?user="******"user_id"] . "\">"; echo '<img align="left" width="48" height="48" style="margin-right: 5px;" border=\\"1\\" src="' . $defImg . '"></a>'; } } //user echo "<b>"; echo "<a href=\"#\" onclick=\"insertAtCaret('status','@"; name($row['user_id']); echo " ');\">"; name($row['user_id']); echo "</a>"; echo " </b>"; //sms //echo replies(emoticons(replace_urls(stripslashes($row['status'])))) $status = replace_urls(stripslashes($row['status'])); $status = replace_unu($status); $status = emoticons($status); $status = channels($status); echo replies($status); echo '</div><span class="time">', $row['ds'], '</span>'; echo " <a href=\"index.php?user="******"\" style=\"border: 0px;\">\n\t<img style=\"border: 0px;\" src=\"" . $pth . "inc/icons/u.png\" alt=\"u\"/></a> \n\t<a href=\"#\" style=\"border: 0px;\" onclick=\"insertAtCaret('status','@"; name($row['user_id']); echo " ');\">\n\t<img style=\"border: 0px;\" src=\"" . $pth . "inc/icons/r.png\" alt=\"r\"/></a>"; //echo "<img src=\"inc/icons/d.png\" alt=\"d\"/> //<img src=\"inc/icons/f.png\" alt=\"f\"/> "; echo "</div></td></tr>"; } ?> <!-- foot table with link pages buttoms--> </tbody> <tfoot> <td> <center> <?php if ($pagina - 1 > 0) { if ($type == "User") { echo "<a id=\"nuevo\" href=\"index.php?user="******"&pagina=" . ($pagina - 1) . "\"> Newer </a>"; } else { echo "<a id=\"nuevo\" href=\"index.php?pagina=" . ($pagina - 1) . "\"> Newer </a>"; } } else { if ($type == "User") { echo "<a id=\"nuevorss\" href=\"rss.php?user="******"\"> Rss </a>"; } else { echo "<a id=\"nuevorss\" href=\"rss.php\"> Rss </a>"; } } if ($pagina + 1 <= $total_paginas) { if ($type == "User") { echo "<a id=\"viejo\" href=\"index.php?user="******"&pagina=" . ($pagina + 1) . "\"> Older </a>"; } else { echo "<a id=\"viejo\" href=\"index.php?pagina=" . ($pagina + 1) . "\"> Older </a>"; } } else { } ?> </center> </td> </tfoot> </table> </div> <br><br> <div style="clear: both;"></div> <!-- END TAB <?php echo $tabnumber; ?> --> </div> <?php }