diff --git a/action.php b/action.php index e13f0a4..b26dd32 100644 --- a/action.php +++ b/action.php @@ -17,7 +17,6 @@ require_once "include/functions.php"; $srv = $user_settings['instance']; if (isset($_GET['action']) && $_GET['action'] == "settings"){ - //file_put_contents("settings.txt",var_export($_GET,true)); foreach($_GET as $key => $value){ switch($key){ diff --git a/include/2functions.php b/include/2functions.php deleted file mode 100644 index 0db1596..0000000 --- a/include/2functions.php +++ /dev/null @@ -1,738 +0,0 @@ -]*>)$i'; // refine this for better/more specific results - if (preg_match_all($pattern, $input, $matches)) { - list($dummy, $links) = ($matches); - return $links; - } - return false; -} - -function emoji($text, $size = 30, $srv) { - $data = json_decode(file_get_contents("https://$srv/api/v1/custom_emojis") , true) [0]['url']; - $u = explode("/", $data); - array_pop($u); - $url = implode("/", $u); - $text = str_replace("http:", "http;", $text); - $text = str_replace("https:", "https;", $text); - $text = preg_replace('~:([a-z0-9_]+):~', "", $text); - $text = str_replace("http;", "http:", $text); - $text = str_replace("https;", "https:", $text); - return $text; -} - -function emojify($string, $emojis, $size = 40) { - foreach ($emojis as $emoji) { - $string = str_replace(":" . $emoji['shortcode'] . ":", "" . $emoji[", $string); - } - return $string; -} - -function context($post) { - global $srv; - global $token; - - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, "https://$srv/api/v1/statuses/$post/context"); - if (!is_null($token)) { - curl_setopt($curl, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $token - )); - } - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - $result = curl_exec($curl); - curl_close($curl); - return $result; -} - -function averageColor($url) { - @$image = imagecreatefromstring(file_get_contents($url)); - - if (!$image) { - $mainColor = "CCCCCC"; - } - else { - $thumb = imagecreatetruecolor(1, 1); - imagecopyresampled($thumb, $image, 0, 0, 0, 0, 1, 1, imagesx($image) , imagesy($image)); - $mainColor = strtoupper(dechex(imagecolorat($thumb, 0, 0))); - } - - return $mainColor; -} - -function user_info($user) { - global $user_settings; - $info = api_get("accounts/" . $user); - $rel = api_get("accounts/relationships?id=" . $user); - return array( - $info, - $rel - ); -} - -function api_get($url) { - global $srv; - global $token; - - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, "https://$srv/api/v1/" . $url); - if (!is_null($token)) { - curl_setopt($curl, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $token - )); - } - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - $result = curl_exec($curl); - curl_close($curl); - return json_decode($result, true); -} - -function api_post($url, $array) { - global $srv; - global $token; - - $cSession = curl_init(); - curl_setopt($cSession, CURLOPT_HEADER, false); - curl_setopt($cSession, CURLOPT_POST, 1); - curl_setopt($cSession, CURLOPT_URL, "https://$srv/api/v1/" . $url); - if (!is_null($token)) { - curl_setopt($cSession, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $token - )); - } - curl_setopt($cSession, CURLOPT_POSTFIELDS, http_build_query($array)); - curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec($cSession); - curl_close($cSession); - - return json_decode($result, true); -} - -function api_delete($url, $array) { - global $srv; - global $token; - - $cSession = curl_init(); - curl_setopt($cSession, CURLOPT_HEADER, false); - curl_setopt($cSession, CURLOPT_POST, 1); - curl_setopt($cSession, CURLOPT_URL, "https://$srv/api/v1/" . $url); - curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, "DELETE"); - if (!is_null($token)) { - curl_setopt($cSession, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $token - )); - } - curl_setopt($cSession, CURLOPT_POSTFIELDS, http_build_query($array)); - curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec($cSession); - curl_close($cSession); - - return json_decode($result, true); -} - -function render_reply($item) { - global $user_settings; - global $logedin; - global $srv; - - $reply['mode'] = ""; - if (isset($item['type']) && $item['type'] == 'ancestor') { - $reply['mode'] = "ancestor"; - } - - $reply['id'] = $item['id']; - $reply['uid'] = $item['account']['id']; - $reply['name'] = emojify($item['account']['display_name'], $item['account']['emojis'], 15); - $reply['acct'] = $item['account']['acct']; - $reply['avatar'] = $item['account']['avatar']; - - $reply['menu'] = ""; - - $json['id'] = $item['id']; - $json['scope'] = $item['visibility']; - if ($logedin) { - $json['mentions'] = ""; - $array = $item["mentions"]; - $json['mentions'] = ($user_settings['acct'] == $item["account"]['acct'] ? "" : "@" . $item["account"]['acct']) . " "; - if (!empty($array)) { - foreach ($array as $mnt) { - if ($mnt['acct'] != $user_settings['acct']) { - $json['mentions'] .= "@" . $mnt['acct'] . " "; - } - } - } - } - $reply['json'] = json_encode($json); - - $reply['replyto'] = ($item['in_reply_to_id'] ? " " : ""); - $reply['text'] = processText($item); - - $public = ""; - $private = ""; - $unlisted = ""; - $direct = ""; - - $reply['date'] = " - " . date("d/m/y H:i", strtotime($item['created_at'])) . " - " . $$item['visibility'] . ""; - - $reply['media'] = ""; - if (!empty($item['media_attachments'])) { - $reply['media'] = "
"; - $images = count($item['media_attachments']); - $class = ($images > 1 ? "class='icon'" : ""); - foreach ($item['media_attachments'] as $file) { - $ext = explode(".", $file['url']); - $ext = end($ext); - $ext = explode("?", $ext) [0]; - if ($ext == 'mp4' || $ext == 'webm') { - $reply['media'] .= "
- "; - } - elseif ($ext == 'mp3' || $ext == 'ogg') { - $reply['media'] .= "
"; - } - else { - if ($item['sensitive'] == true && $user_settings['explicit'] != 'off') { - $reply['media'] .= "
"; - } - else { - $reply['media'] .= "
"; - - } - } - } - $reply['media'] .= "
"; - } - - - $reply['buttons'] = " - " . ($logedin ? "
" : "") . " -
" . $item['favourites_count'] . "
-
" . $item['reblogs_count'] . "
- "; - - $result = file_get_contents("templates/reply.txt"); - - foreach ($reply as $key => $elem) { - $result = str_replace(":$key:", $elem, $result); - } - - return $result; -} - -function favourite($post, $mode) { - $result = api_post(($mode == true ? "statuses/$post/favourite" : "statuses/$post/unfavourite"),array()); - - if (isset($result['favourites_count'])) { - return $result['favourites_count']; - } - else { - return "error"; - } -} - -function reblog($post, $mode) { - $result = api_post(($mode == true ? "statuses/$post/reblog" : "statuses/$post/unreblog"),array()); - if (isset($result['reblog']['reblogs_count'])) { - return $result['reblog']['reblogs_count']; - } - elseif (isset($result['reblogs_count'])) { - return $result['reblogs_count']; - } - else { - return "error"; - } -} - -function delpost($id) { - global $srv; - global $token; - - if (!is_null($token)) { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_URL, "https://$srv/api/v1/statuses/$id"); - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_setopt($curl, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $token - )); - - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - $result = curl_exec($curl); - curl_close($curl); - $result = json_decode($result, true); - if (empty($result)) { - return "1"; - } - else { - return "0"; - } - } -} - -function sendpost($text, $media, $reply, $markdown = false, $scope, $sensitive, $spoiler = false) { - global $srv; - global $token; - if (!is_null($token)) { - - $cSession = curl_init(); - curl_setopt($cSession, CURLOPT_URL, "https://$srv/api/v1/statuses"); - curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); - curl_setopt($cSession, CURLOPT_POST, 1); - curl_setopt($cSession, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $token - )); - $query = ""; - $query .= "status=" . urlencode(html_entity_decode($text, ENT_QUOTES)) . "&visibility=" . $scope;; - if (!is_null($reply) && $reply != "null") { - $query .= "&in_reply_to_id=" . $reply; - } - if ($markdown == true) { - $query .= "&content_type=text/markdown"; - } - if ($sensitive == 'true') { - $query .= "&sensitive=true"; - } - if ($spoiler == true) { - $query .= "&spoiler_text=" . $spoiler; - } - - if (!is_null($media)) { - foreach ($media as $mid) { - $query .= "&media_ids[]=" . $mid; - } - } - - file_put_contents("query.txt",var_export($query,true)); - - curl_setopt($cSession, CURLOPT_POSTFIELDS, $query); - $result = curl_exec($cSession); - curl_close($cSession); - return $result; - } - else { - return false; - } -} - -function uploadpic($file) { - global $srv; - global $token; - if (!is_null($token)) { - $mime = get_mime($file); - $info = pathinfo($file); - $name = $info['basename']; - $output = new CURLFile($file, $mime, $name); - - do { - $cSession = curl_init(); - curl_setopt($cSession, CURLOPT_URL, "https://$srv/api/v1/media"); - curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); - curl_setopt($cSession, CURLOPT_POST, 1); - curl_setopt($cSession, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $token - )); - curl_setopt($cSession, CURLOPT_POSTFIELDS, array( - 'file' => $output - )); - $result = curl_exec($cSession); - } while (empty($result)); - curl_close($cSession); - $array = json_decode($result, true); - - $ext = explode(".", $array['url']); - $ext = end($ext); - $ext = explode("?", $ext) [0]; - - if (in_array($ext, array( - 'jpg', - 'jpeg', - 'gif', - 'png', - 'svg' - ))) { - $file = $array['url']; - } - else { - $file = "img/doc.png"; - } - return json_encode(array( - $array['id'], - $file - )); - } - else { - return false; - } -} - -function register_app($instance) { - global $setting; - - $cSession = curl_init(); - curl_setopt($cSession, CURLOPT_URL, "https://$instance/api/v1/apps"); - curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true); - curl_setopt($cSession, CURLOPT_HEADER, false); - curl_setopt($cSession, CURLOPT_POST, 1); - curl_setopt($cSession, CURLOPT_POSTFIELDS, http_build_query(array( - 'client_name' => $setting['appname'], - 'redirect_uris' => $setting['url'], - 'scopes' => 'read write follow' - ))); - $result = curl_exec($cSession); - curl_close($cSession); - - return json_decode($result, true); -} - -function getnotif($id = false, $max = false) { - global $srv; - global $token; - global $user_settings; - $n = ""; - $notif = api_get("notifications?" . ($id == false ? "limit=9&" : "") . ($id != false ? ($max == true ? "max_id=$id" : "since_id=$id") : "")); - if (!empty($notif)) { - foreach ($notif as $post) { - $user = "" . emojify($post['account']['display_name'], $post['account']['emojis'], 10) . ""; - $preview = ""; - $buttons = ""; - $media = ""; - - switch ($post["type"]) { - case "mention": - if ($post['status']['in_reply_to_id'] == null) { - $type = ""; - $string = "mentioned you in a post"; - $preview = "" . emojify(strip_tags(trim($post['status']['content']) , '

') , $post['status']['emojis'], 15) . "
"; - $media = (!empty($post['status']['media_attachments']) ? "
" : ""); - } - else { - $type = ""; - $string = "replied to your post"; - $preview = "" . emojify(strip_tags(trim($post['status']['content']) , '

') , $post['status']['emojis'], 15) . "
"; - $media = (!empty($post['status']['media_attachments']) ? "
" : ""); - } - - $array = $post['status']["mentions"]; - $mentions = ($user_settings['acct'] == $post['status']['account']['acct'] ? "" : "@" . $post['status']['account']['acct']) . " "; - if (!empty($array)) { - foreach ($array as $mnt) { - if ($mnt['acct'] != $user_settings['acct']) { - $mentions .= "@" . $mnt['acct'] . " "; - } - } - } - - $buttons = "
-
-
-
"; - break; - - case "favourite": - $type = ""; - $string = "favourited your post"; - $preview = "" . (!empty($post['status']['content']) ? emojify(strip_tags(trim($post['status']['content']) , '

') , $post['status']['emojis'], 15) : "Favourited your image") . "
"; - $media = (!empty($post['status']['media_attachments']) ? "
" : ""); - break; - - case "reblog": - $type = ""; - $string = "reblogged your post"; - $preview = "" . (!empty($post['status']['content']) ? emojify(strip_tags(trim($post['status']['content']) , '

') , $post['status']['emojis'], 15) : "Reblogged your image") . "
"; - @$media = (!is_null($post['status']['media_attachments']) ? "
" : ""); - break; - - case "pleroma:emoji_reaction": - $type = ""; - $string = "favourited your post"; - $preview = "" . (!empty($post['status']['content']) ? emojify(strip_tags(trim($post['status']['content']) , '

') , $post['status']['emojis'], 15) : "Favourited your image") . "
"; - $media = (!empty($post['status']['media_attachments']) ? "
" : ""); - break; - - case "follow": - $type = ""; - $string = "started following you"; - break; - } - - $n .= " -
-
-
-
- $type $user - " . trim($preview) . " - $buttons -
- $media -
-
- "; - - } - return $n; - } -} - -function getnotes($thread) { - global $user_settings; - global $token; - global $srv; - global $setting; - global $logedin; - @$reb = array( - json_decode(file_get_contents("https://$srv/api/v1/statuses/" . $thread . "/reblogged_by") , true) - ); - @$fab = array( - json_decode(file_get_contents("https://$srv/api/v1/statuses/" . $thread . "/favourited_by") , true) - ); - $limit = (count($reb[0]) > count($fab[0]) ? count($reb[0]) - 1 : count($fab[0]) - 1); - - $notes = array(); - $index = 0; - - for ($i = 0;$i <= $limit;$i++) { - if (isset($reb[0][$i])) { - $notes[$index][0] = "reb"; - $notes[$index][1] = $reb[0][$i]; - $index++; - } - if (isset($fab[0][$i])) { - $notes[$index][0] = "fav"; - $notes[$index][1] = $fab[0][$i]; - $index++; - } - } - - return $notes; -} - -function getreplies($thread, $since = false) { - global $user_settings; - global $token; - global $srv; - global $setting; - global $logedin; - $context = json_decode(context($thread) , true); - $array = array(); - if (!empty($context['ancestors'])) { - if ($since == false) { - foreach ($context['ancestors'] as $elem) { - $elem['type'] = 'ancestor'; - $array[] = $elem; - } - } - } - $flag = 0; - if (!empty($context['descendants'])) { - foreach ($context['descendants'] as $elem) { - if (($since != false && $flag == 1) || $since == false) { - $elem['type'] = 'descendant'; - $array[] = $elem; - } - if ($since != false && $elem['id'] == $since) { - $flag = 1; - } - } - } - - $replies = array(); - - foreach ($array as $item) { - $reply['mode'] = ""; - if ($item['type'] == 'ancestor') { - $reply['mode'] = "ancestor"; - } - - $replies[] = array( - 'mode' => $reply['mode'], - 'content' => $item - ); - } - - return $replies; -} - -function timeline($query) { - global $token; - global $srv; - - $notes = ""; - $media = ($query['text'] == "on" ? "" : "&only_media=true"); - $next = ($query['next'] ? "&max_id=" . $query['next'] : ($query['since'] ? "&since_id=" . $query['since'] : "")); - - switch ($query['mode']) { - case "home": - $array = api_get("timelines/home?limit=25{$media}{$next}"); - break; - - case "federated": - $array = api_get("timelines/public?limit=25{$media}{$next}"); - break; - - case "tag": - $array = api_get("timelines/tag/" . $query['tag'] . "?limit=25{$media}{$next}"); - break; - - case "local": - $array = api_get("timelines/public?limit=25&local=true{$media}{$next}"); - break; - - case "user": - $array = api_get("accounts/" . $query['user'] . "/statuses?limit=25{$media}{$next}"); - break; - - case "thread": - $array = array( - api_get("statuses/" . $query['thread']) - ); - break; - - case "favourites": - $array = api_get("favourites?limit=25{$media}{$next}"); - break; - - case "direct": - $array = api_get("timelines/direct?limit=25{$next}"); - break; - - case "list": - $array = api_get("timelines/list/" . $query['list'] . "?limit=25{$next}"); - break; - - case "bookmarks": - $array = api_get("bookmarks?limit=25{$next}"); - break; - - case "account": - $info = api_get("accounts/verify_credentials"); - $array = api_get("accounts/" . $info['id'] . "/statuses?limit=25{$media}{$next}"); - break; - - default: - $array = api_get("timelines/public?limit=25{$media}{$next}"); - break; - } - - if (!is_array($array)) { - return false; - } - - $next = end($array) ['id']; - $thread = array(); - - foreach ($array as $elem) { - if ($query['replies'] == "on" || $query['mode'] == "thread") { - $thread[] = $elem; - } - else { - if ($elem['in_reply_to_id'] == null) { - $thread[] = $elem; - } - } - - } - - return array( - $thread, - $next - ); -} - -function processText($elem) { - global $user_settings; - require_once "vendor/simple_html_dom.php"; - $content = trim(html_entity_decode($elem['content'],ENT_QUOTES)); - - if (!empty($content)) { - $html = str_get_html($content); - foreach ($html->find('a') as $lnk) { - foreach ($elem['media_attachments'] as $f) { - if (is_numeric(strpos($f['description'],explode("…",$lnk->innertext)[0]))) { - $content = str_replace($lnk->outertext . "
", null, $content); - $content = str_replace("
" . $lnk->outertext, null, $content); - $content = str_replace($lnk->outertext, null, $content); - } - } - - if (is_numeric(strpos($lnk->href, $user_settings['instance'])) || in_array($lnk->class, array( - "u-url mention", - "hashtag" - )) || $lnk->rel == "tag") { - $content = str_replace($lnk->outertext, $lnk->innertext, $content); - } - else { - $prv = $lnk->outertext; - $lnk->target = '_blank'; - $lnk->class = 'link external'; - $content = str_replace($prv, $lnk->outertext, $content); - } - } - } - - $result = strip_tags($content, '

'); - $result = str_replace('
', '
', $result); - //$result = str_replace(''', "'", $result); - - foreach ($elem['mentions'] as $mention) { - $result = str_replace("@" . $mention['username'], "
@" . $mention['username'] . "", $result); - } - - //$result = preg_replace("/(?$1", $result); - $result = emojify($result, $elem['emojis']); - $result = preg_replace("/#([A-Za-z0-9\/\.]*)/", "#$1", $result); - - return $result; -} - -function get_mime($filename) { - $result = new finfo(); - - if (is_resource($result) === true) { - return $result->file($filename, FILEINFO_MIME_TYPE); - } - - return false; -} diff --git a/modules/2timeline.php b/modules/2timeline.php deleted file mode 100644 index 912191e..0000000 --- a/modules/2timeline.php +++ /dev/null @@ -1,297 +0,0 @@ - - -

- - " : ""); - - if ($logedin && $rel[0]['following']) { - $profile['top'] .= "Lists  - - "; - } - - if ($logedin) { - if ($rel[0]['following']) { - $label = " Following"; - $class = "unfollow"; - } - else { - if ($info['locked']) { - if ($rel[0]['requested']) { - $label = " Follow Requested"; - $class = "unfollow"; - } - else { - $label = " Request Follow"; - $class = "follow"; - } - } - else { - $label = " Follow"; - $class = "follow"; - } - } - $profile['top'] .= "$label"; - } - $profile['top'] .= "" . (in_array($info['id'], $user_settings['nsfw']) ? "NSFW " : "NSFW ") . ""; - - if ($logedin) { - $profile['bottom'] = " - " . ($info['locked'] ? " Locked" : "") . " - " . ($rel[0]['followed_by'] ? " Follows You" : "") . " - " . ($rel[0]['blocking'] ? " Blocked" : "") . " - " . ($rel[0]['muting'] ? " Muted" : "") . " - "; - } - else { - $profile['bottom'] = ""; - } - - $profile['avatar'] = $info['avatar']; - $profile['name'] = emojify($info['display_name'], $info['emojis'], 40); - $profile['acct'] = $info['acct']; - $profile['url'] = $info['url']; - $profile['note'] = emojify(trim($info['note']) , $info['emojis']); - $profile['statuses'] = $info['statuses_count']; - $profile['following'] = $info['following_count']; - $profile['followers'] = $info['followers_count']; - - foreach ($profile as $key => $value) { - $template = str_replace(":$key:", $value, $template); - } - - echo $template; -} -elseif (!isset($_GET['next']) && !isset($_GET['since'])) { - echo "
"; -} - -if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) { - echo "
Error loading the timeline. " . json_encode($thread) . "
"; -} -else { - $e = 0; - foreach ($thread as $elem) { - - $post = array(); - $post['pid'] = $elem['id']; - $post['replyto'] = ""; - $post['rt'] = ""; - - if ($elem['reblog'] != null) { - $post['name'] = "" . emojify($elem['reblog']['account']['display_name'], $elem['reblog']['account']['emojis'], 15) . ""; - - $post['replyto'] = "" . ($elem['reblog']['in_reply_to_id'] ? " " : "") . ""; - - //$post['rt'] = "[ by " . emojify($elem['account']['display_name'],$elem['account']['emojis'],15) . " ]"; - $post['rt'] = "[ by " . emojify($elem['account']['display_name'], $elem['account']['emojis'], 15) . "@" . explode("@", $elem['account']['acct']) [0] . " ]"; - - $elem = $elem['reblog']; - } - else { - $post['name'] = "" . emojify($elem['account']['display_name'], $elem['account']['emojis'], 20) . " (" . $elem['account']['acct'] . ") "; - - $post['replyto'] = "" . ($elem['in_reply_to_id'] ? " " : "") . ""; - } - - if (in_array($elem["account"]['id'], $user_settings['nsfw'])) { - $elem['sensitive'] = true; - } - - if ($user_settings['explicit'] == "hide" && $elem['sensitive'] == true && $tl['mode'] != "thread") { - continue; - } - if (@in_array($elem["pleroma"]['conversation_id'], $user_settings['hide'])) { - continue; - } - - $json['id'] = $elem['id']; - $json['scope'] = $elem['visibility']; - if ($logedin) { - $pos['mentions'] = ""; - $array = $elem["mentions"]; - $json['mentions'] = ($user_settings['acct'] == $elem["account"]['acct'] ? "" : "@" . $elem["account"]['acct']) . " "; - if (!empty($array)) { - foreach ($array as $mnt) { - if ($mnt['acct'] != $user_settings['acct']) { - $json['mentions'] .= "@" . $mnt['acct'] . " "; - } - } - } - } - $post['json'] = json_encode($json); - - $post['menu'] = ""; - - $post['text'] = processText($elem); - - $post['spoiler'] = (empty($elem['spoiler_text']) ? "" : "" . $elem['spoiler_text'] . "
"); - $post['media'] = ""; - - $urls = get_urls(strip_tags($elem['content'], '

')); - - if (!empty($urls)) { - foreach ($urls as $url) { - parse_str(parse_url($url, PHP_URL_QUERY) , $my_array_of_vars); - if (isset($my_array_of_vars['v'])) { - $post['media'] = ""; - } - } - } - - if (!empty($elem['media_attachments'])) { - if ($user_settings['attach'] != "off"){ - $images = count($elem['media_attachments']); - $class = ($images === 1 ? "" : ($images > 4 ? "class='smaller'" : "class='small'")); - foreach ($elem['media_attachments'] as $file) { - $ext = explode(".", $file['url']); - $ext = end($ext); - $ext = explode("?", $ext) [0]; - if ($ext == 'mp4' || $ext == 'webm') { - $post['media'] .= "
- "; - } - elseif ($ext == 'mp3' || $ext == 'ogg') { - $post['media'] .= "
"; - } - else { - if ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') { - $post['media'] .= "
"; - } - else { - //$post['media'] .= "
"; - $post['media'] .= "
"; - - } - } - } - } else { - $post['text'] .= "

\n"; - foreach ($elem['media_attachments'] as $file) { - $post['text'] .= "See attachment ".($elem['sensitive'] == true ? "(NSFW)" : "")."
\n"; - } - } - } - - $public = ""; - $private = ""; - $unlisted = ""; - $direct = ""; - - $post['footer'] = "
- " . date("d/m/y H:i", strtotime($elem['created_at'])) . " - " . $$elem['visibility'] . " -
-
- " . ($logedin ? "" : "") . " - - - -
"; - - $post['form'] = ($tl['mode'] == 'thread' && $logedin ? str_replace(array( - ":id:", - ":content:" - ) , array( - $elem['id'], - $json['mentions'] - ) , file_get_contents("templates/replyform.txt")) : ""); - - $post['ancestors'] = " "; - $post['descendants'] = " "; - - if ($tl['mode'] == 'thread') { - foreach ($replies as $e) { - if ($e['mode'] == 'ancestor') { - $post['ancestors'] .= render_reply($e['content']); - } - else { - $post['descendants'] .= render_reply($e['content']); - } - } - } - - $post['style'] = ""; //($tl['mode'] == "single" ? "display:none;" : ""); - $post['id'] = $elem['id']; - $post['avatar'] = $elem['account']['avatar']; - $post['notes'] = ""; - - if ($notes) { - foreach ($notes as $note) { - $post['notes'] .= ""; - } - } - - if ((empty($elem['media_attachments']) && $post['media'] == "") || (!(empty($elem['media_attachments']) && $post['media'] == "") && $user_settings['attach'] == "off")) { - $post['template'] = file_get_contents("templates/textpost.txt"); - } - else { - $post['template'] = file_get_contents("templates/post.txt"); - } - - foreach ($post as $key => $value) { - $post['template'] = str_replace(":$key:", $value, $post['template']); - } - echo $post['template']; - unset($post); - $e++; - } - if ((!isset($_GET['next']) || (isset($_GET['next']) && !isset($_GET['ajax']))) && !isset($_GET['since']) && !isset($_GET['thread'])) { - $query = http_build_query(array_filter(array( - 'user' => (isset($tl['user']) ? $tl['user'] : false) , - 'mode' => $tl['mode'] - ))); - - echo ""; - } -} -?> diff --git a/themes/amplifier/templates/2reply.txt b/themes/amplifier/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/amplifier/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/ancientbird/templates/2reply.txt b/themes/ancientbird/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/ancientbird/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/bythebook/templates/2reply.txt b/themes/bythebook/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/bythebook/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/chicago/templates/2reply.txt b/themes/chicago/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/chicago/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/cuatro/templates/2reply.txt b/themes/cuatro/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/cuatro/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/custom/templates/2reply.txt b/themes/custom/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/custom/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/default/templates/2reply.txt b/themes/default/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/default/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/monad/templates/2reply.txt b/themes/monad/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/monad/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file diff --git a/themes/phubbub/templates/2reply.txt b/themes/phubbub/templates/2reply.txt deleted file mode 100644 index f7e7ab9..0000000 --- a/themes/phubbub/templates/2reply.txt +++ /dev/null @@ -1 +0,0 @@ -
:name: (:acct:)
:menu:
:media: :replyto: :text:
:date: :buttons:
\ No newline at end of file