function create_lilypond($params) { $res = ''; // sending query $query = sprintf('SELECT id,uuid,title,subtitle,composer,poet,style,piece,copyright,pages,idyoutube,epdfs FROM TbMsLilypond order by title asc'); $result = my_mysql_query($query); $res .= multi_accordion_start(); while ($row = $result->fetch_assoc()) { $id = $row['id']; $s_uuid = $row['uuid']; $s_title = val_or_na($row['title']); $s_subtitle = val_or_na($row['subtitle']); $s_composer = val_or_na($row['composer']); $s_poet = val_or_na($row['poet']); $s_style = val_or_na($row['style']); $s_piece = val_or_na($row['piece']); $s_copyright = val_or_na($row['copyright']); $s_pages = val_or_na($row['pages']); $s_epdfs = val_or_na($row['epdfs']); $link_ly = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-ly'); $link_pdf = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-pdf'); $link_ps = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-ps'); $link_midi = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-midi'); $link_wav = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-wav'); $link_mp3 = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-mp3'); $link_ogg = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-ogg'); $s_a_ly = '<a href=' . $link_ly . '>ly</a>'; $s_a_pdf = '<a href=' . $link_pdf . '>pdf</a>'; $s_a_ps = '<a href=' . $link_ps . '>ps</a>'; $s_a_midi = '<a href=' . $link_midi . '>midi</a>'; $s_a_wav = '<a href=' . $link_wav . '>wav</a>'; $s_a_mp3 = '<a href=' . $link_mp3 . '>mp3</a>'; $s_a_ogg = '<a href=' . $link_ogg . '>ogg</a>'; $s_idyoutube = $row['idyoutube']; $header = $s_title; if ($row['composer'] != NULL) { $header .= ' / ' . $s_composer; } if ($row['poet'] != NULL && $s_poet != $s_composer) { $header .= ', ' . $s_poet; } $body = ''; $body .= '<ul>'; if ($row['id'] != NULL) { $body .= '<li>id: ' . $id . '</li>'; } if ($row['title'] != NULL) { $body .= '<li>title: ' . $s_title . '</li>'; } if ($row['subtitle'] != NULL) { $body .= '<li>subtitle: ' . $s_subtitle . '</li>'; } if ($row['composer'] != NULL) { $body .= '<li>composer: ' . $s_composer . '</li>'; } if ($row['poet'] != NULL) { $body .= '<li>poet: ' . $s_poet . '</li>'; } if ($row['style'] != NULL) { $body .= '<li>style: ' . $s_style . '</li>'; } if ($row['piece'] != NULL) { $body .= '<li>piece: ' . $s_piece . '</li>'; } if ($row['copyright'] != NULL) { $body .= '<li>copyright: ' . $s_copyright . '</li>'; } if ($row['pages'] != NULL) { $body .= '<li>pages: ' . $s_pages . '</li>'; } if ($row['epdfs'] != NULL) { $body .= '<li>epdfs: ' . $s_epdfs . '</li>'; } $links = array(); # TODO: only add the links if I have the blobs... array_push($links, $s_a_ly); array_push($links, $s_a_pdf); array_push($links, $s_a_ps); array_push($links, $s_a_midi); array_push($links, $s_a_wav); array_push($links, $s_a_mp3); array_push($links, $s_a_ogg); # lets look and add links to the pngs... for ($i = 0; $i < $s_pages; $i++) { $j = $i + 1; $link = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-png' . $j); $link = '<a href=\'' . $link . '\'>png' . $j . '</a>'; array_push($links, $link); } for ($i = 0; $i < $s_epdfs; $i++) { $link = link_to_direct('GetRsBlob.php?slug=' . $s_uuid . '-epdf' . $i); $link = '<a href=\'' . $link . '\'>epdf' . $i . '</a>'; array_push($links, $link); } $body .= '<li>links: ' . join(', ', $links) . '</li>'; $body .= '<li>uuid: ' . $s_uuid . '</li>'; $body .= '</ul>'; # lets put a link to play the audio, currently it looks like the # audio plugin can only play mp3 so that's the only link that we # put... $body .= 'You can play the automatically generated mp3 file here...<br/>'; $body .= get_audio_player($link_mp3, $row['title'], $row['composer'], $row['poet']); if ($row['idyoutube'] != NULL) { $body .= 'Here is a youtube performance of this song that I like...<br/>'; $body .= embed_youtube($s_idyoutube, 0.5); } $res .= multi_accordion_entry($header, $body); } my_mysql_free_result($result); $res .= multi_accordion_end(); return $res; }
function ReplaceKeywords($Matches) { if ($Matches[2]) { $GoodStuff = $Matches[3]; } else { $GoodStuff = $Matches[4]; } if ($GoodStuff !== "") { switch (strtolower($Matches[1])) { case "total": switch (strtolower($GoodStuff)) { case "pages": $pageTotal = mysql_query("Select `ID` from `Wiki_Pages`"); $totalPages = mysql_num_rows($pageTotal); return number_format($totalPages); break; } break; case "ad": $position = strtolower($GoodStuff); if ($position == 'right') { $class = 'right'; } elseif ($position == 'left') { $class = 'left'; } $ID = uuid(); return "<div id='{$ID}' class='{$class}'><iframe id='scraper-friend' src='https://ads.wetfish.net/friendship/scraper.html' style='width:175px; height:640px; border:0; outline:0; overflow:hidden;' scrolling='no'></iframe></div>"; break; case "ads": $ID = uuid(); $ID2 = uuid(); return "<div id='{$ID}' class='left'><iframe id='scraper-friend' src='https://ads.wetfish.net/friendship/scraper.html' style='width:175px; height:640px; border:0; outline:0; overflow:hidden;' scrolling='no'></iframe></div>" . "<div id='{$ID2}' class='right'><iframe id='scraper-friend' src='https://ads.wetfish.net/friendship/scraper.html' style='width:175px; height:640px; border:0; outline:0; overflow:hidden;' scrolling='no'></iframe></div>"; break; case "pre": $GoodStuff = trim(str_replace(array("{", "}", '[', ']'), array("{", "}", '[', ']'), $GoodStuff)); return "<pre>{$GoodStuff}</pre>"; break; case "center": return "<center>{$GoodStuff}</center>"; break; case "magic": $Words = str_split_unicode(html_entity_decode($GoodStuff, false, 'UTF-8')); $Splitter = ''; foreach ($Words as $Word) { $magic .= "<span class='magic'>{$Word}</span>"; } return "<span class='brew'>{$GoodStuff}</span>"; break; case "color": $args = explode("|", $GoodStuff, 3); if (count($args) == 3) { if ($args[1]) { $args[1] = "background-color:{$args[1]}"; } return "<span style='color:{$args[0]}; {$args[1]}'>{$args[2]}</span>"; } elseif (count($args) == 2) { return "<span style='color:{$args[0]}'>{$args[1]}</span>"; } else { return $GoodStuff; } break; case "infobox": $args = explode("|", $GoodStuff, 3); if ($args[2]) { return "<div class='wiki-box' style='{$args[0]}'><div class='wiki-box-title'>{$args[1]}</div>{$args[2]}</div>"; } else { return "<div class='wiki-box'><div class='wiki-box-title'>{$args[0]}</div>{$args[1]}</div>"; } break; case "titlebox": $args = explode("|", $GoodStuff, 2); return "<header class='title-box'><h1>{$args[0]}</h1><span>{$args[1]}</span></header>"; break; case "box": $args = explode("|", $GoodStuff, 2); if ($args[1]) { return "<div class='wiki-box' style='{$args[0]}'>{$args[1]}</div>"; } else { return "<div class='wiki-box'>{$args[0]}</div>"; } break; case "title": return "<div class='wiki-box-title'>{$GoodStuff}</div>"; break; case "style": $args = explode("|", $GoodStuff, 2); $args[0] = preg_replace("/([\\s\n]| )+/", " ", $args[0]); return "<div style='{$args[0]}'>{$args[1]}</div>"; break; case "right": return "<div class='right'>{$GoodStuff}</div>"; break; case "left": return "<div class='left'>{$GoodStuff}</div>"; break; case "bold": case "b": return "<b>{$GoodStuff}</b>"; break; case "underline": case "u": return "<u>{$GoodStuff}</u>"; break; case "italic": case "italics": case "i": return "<i>{$GoodStuff}</i>"; break; case "strike": case "s": return "<span class='strike'>{$GoodStuff}</span>"; break; case "big": return "<span class='big'>{$GoodStuff}</span>"; break; case "medium": case "med": return "<span class='medium'>{$GoodStuff}</span>"; break; case "small": case "sml": return "<span class='small'>{$GoodStuff}</span>"; break; case "redirect": if (isset($_GET['random'])) { return "<meta http-equiv='refresh' content='1;url=/{$GoodStuff}/?random'>You're being brought to '{$GoodStuff}'..."; } else { return "<meta http-equiv='refresh' content='1;url=/{$GoodStuff}'>You're being brought to '{$GoodStuff}'..."; } break; case "heading": //return "<a name='".str_replace(array("<", ">", """, "'", "\", "`", " "), "", $GoodStuff)."'></a>$GoodStuff<hr />"; return "<div class='clear'>{$GoodStuff}</div><hr />"; break; case "subheading": //return "<a name='".str_replace(array("<", ">", """, "'", "\", "`", " "), "", $GoodStuff)."'></a>$GoodStuff<hr />"; return "{$GoodStuff}<hr />"; break; case "url": list($link, $text) = explode("|", $GoodStuff, 2); $link = trim($link); $text = trim($text); $url = parse_url($link); switch ($url['scheme']) { case "http": case "https": case "ftp": case "irc": if (empty($text)) { $text = $link; } return "<a href='{$link}' target='_blank'>{$text}</a>"; break; case "fish": $link = "https://wiki.wetfish.net/{$url['host']}"; if (empty($text)) { $text = $url['host']; } return "<a href='{$link}'>{$text}</a>"; break; default: if (empty($text)) { $text = $link; } return "<a href='http://{$link}' target='_blank'>{$text}</a>"; break; } break; case "image": case "img": //list($Link, $Size, $Position, $Border, $Text) = explode("|", $GoodStuff, 5); $args = explode('|', $GoodStuff, 6); $Link = trim($args[0]); $Border = trim($args[3]); $Text = trim($args[4]); $rand = trim($args[5]); $path = pathinfo($Link); // If a video extension was used if (preg_match('/^(webm|mp4|ogv)$/i', $path['extension'])) { // Output a special html5 player that behaves like a gif $options = array('autoplay' => true, 'controls' => false, 'muted' => true, 'loop' => true); return embed_html5($Link, $options); } // $args[1] = trim(str_replace('px', '', strtolower($args[1]))); // $args[2] = trim(str_replace('px', '', strtolower($args[2]))); $args[1] = trim($args[1]); $args[2] = trim($args[2]); if (empty($args[1])) { $args[1] = 0; } if (is_numeric($args[1]) and (is_string($args[2]) or empty($args[2]))) { $Size = $args[1]; $Position = $args[2]; } elseif (is_string($args[1]) and (is_numeric($args[2]) or empty($args[2]))) { $Size = $args[2]; $Position = $args[1]; } if (strtolower($Position) == "right" or strtolower($Position) == "left") { $Position = "float:{$Position};"; } elseif (strtolower($Position) == "border") { $Border = true; } elseif (empty($Text)) { $Text = $Position; } if ($Border) { $Border = "border: 4px solid #C17EE8; padding:4px; margin-bottom:16px; border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px;"; } else { unset($Border); } if (is_numeric($Size) and $Size < 1600 and $Size > 0 and strpos($Link, 'http://') === false) { $Info = pathinfo($Link); // Make sure the file actually exists if (!file_exists(__DIR__ . "/upload/{$Info['basename']}")) { // Display an icon if the image can't be loaded $ImageText = "<a href='#error' class='exempt'><img src='/upload/apple.gif' title='There was an error loading this image' border='0' /></a>"; } else { if (!file_exists(__DIR__ . "/upload/{$Size}_{$Info['basename']}")) { ResizeImage($Link, __DIR__ . "/upload/{$Size}_{$Info['basename']}", $Size); } $ImageText = "<a href='/{$Link}' class='exempt'><img src='/upload/{$Size}_{$Info['basename']}' border='0' /></a>"; } } else { if (strpos($Link, 'http://') === false && strpos($Link, 'https://') === false) { $Link = "/{$Link}"; } unset($Size); $URL = parse_url($Link); // Make sure wiki images exist if (preg_match("{^/upload}", $URL['path']) && !file_exists(__DIR__ . "{$URL['path']}")) { // Display an icon if the image can't be loaded $ImageText = "<a href='#error' class='exempt'><img src='/upload/apple.gif' title='There was an error loading this image' border='0' /></a>"; } else { if ($URL['host'] == "glitch.wetfish.net") { $class = "class='glitchme'"; } // This is a terrible hack and really should be expanded to parse and reconstruct the url if ($rand) { $rand = "&rand=" . mt_rand(); } // Lol I should finish this some time if (is_numeric($Size) and $Size < 1600 and $Size > 0) { $size = "style=''"; } $ImageText = "<img src='{$Link}{$rand}' {$class} />"; } } if ($Text) { $Text = "<div class='small'>{$Text}</div>"; } return "<div style='margin:0px 8px; display:inline-block; max-width:100%; {$Position} {$Border}'>{$ImageText} {$Text}</div>"; break; case "red": case "redtube": $URL = parse_url($GoodStuff); $Video = trim($URL['path'], '/'); return "<object height='344' width='434'> <param name='movie' value='https://embed.redtube.com/player/'> <param name='FlashVars' value='id={$Video}&style=redtube&autostart=false'> <embed src='https://embed.redtube.com/player/?id={$Video}&style=redtube' flashvars='autostart=false' pluginspage='https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' height='344' width='434' /> </object>"; break; case "motherless": $URL = parse_url($GoodStuff); if ($URL['host'] == "motherless.com") { $Video = trim($URL['path'], '/'); $Data = file_get_contents($GoodStuff); preg_match("/var __file_url = '(.*?)';/", $Data, $Filename); return "<embed type='application/x-shockwave-flash' src='https://motherless.com/flash/player.swf' style='' id='player' name='player' quality='high' allowfullscreen='true' allowscriptaccess='always' wmode='transparent' flashvars='file=https://members.motherless.com/movies/{$Filename['1']}.flv&image=https://motherless.com/thumbs/{$Video}.jpg&mute=false&streamer=lighttpd&link=https://motherless.com/{$Video}' width='680' height='560'>"; } break; case "video": $url = parse_url($GoodStuff); if (preg_match("/(^|\\.)youtube.com\$/i", $url['host'])) { return embed_youtube($GoodStuff); } if (preg_match("/(^|\\.)youtu.be\$/i", $url['host'])) { return embed_youtube($GoodStuff); } if (preg_match("/(^|\\.)vimeo.com\$/i", $url['host'])) { return embed_vimeo($GoodStuff); } if (preg_match("/(^|\\.)vine.co\$/i", $url['host'])) { return embed_vine($GoodStuff); } // Otherwise, it must be a html5 video! return embed_html5($GoodStuff); break; case "youtube": return embed_youtube($GoodStuff); break; case "vimeo": return embed_vimeo($GoodStuff); break; case "vine": return embed_vine($GoodStuff); break; case "playlist": $url = parse_url($GoodStuff); parse_str($url['query'], $query); return "<iframe width='640' height='360' src='https://www.youtube.com/embed/videoseries?list={$query['list']}&index={$query['index']}' frameborder='0' allowfullscreen></iframe>"; break; case "soundcloud": return embed_soundcloud($GoodStuff); break; case "ytcracker": return "<iframe width='100%' height='450' scrolling='no' frameborder='no' src='https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/users/2977873&color=ff5500&auto_play=false&hide_related=false&show_artwork=true'></iframe>"; break; case "load": case "embed": $URL = parse_url($GoodStuff); if (empty($URL['scheme'])) { $URL['scheme'] = "http"; } if (empty($URL['host'])) { $URL['host'] = "wiki.wetfish.net"; } if ($URL['path'] == 'index.php' or empty($URL['path']) or $URL['path'] == $_GET['SUPERdickPAGE'] or !empty($_GET['load'])) { $URL['path'] = 'yousosilly.php'; } if (empty($URL['query'])) { $Query = array(); foreach ($_GET as $Key => $Value) { if ($Key != 'SUPERdickPAGE') { $Query[] = "{$Key}=" . urlencode($Value); } } $URL['query'] = implode('&', $Query); } if (preg_match('/^.*\\.?wetfish.net$/i', $URL['host'])) { $ID = uuid(); if ($URL['host'] == 'danger.wetfish.net') { $URL['path'] = substr($URL['path'], 1); if (preg_match("/^[a-f0-9]+\$/", $URL['path'])) { $URL['query'] = "hash={$URL['path']}"; $URL['path'] = "view.php"; } } //return "<iframe src='{$URL['scheme']}://{$URL['host']}/{$URL['path']}?{$URL['query']}' style='height:0px; width:0px; display:none;'></iframe> /**/ if ($URL['host'] != "wiki.wetfish.net") { return "<div id='{$ID}'><script>\$('#{$ID}').load('/load.php?id={$ID}&url={$URL['scheme']}://{$URL['host']}/{$URL['path']}?" . urlencode($URL['query']) . "');</script></div>"; } else { return "<div id='{$ID}'><script>\$('#{$ID}').load('/{$URL['path']}?{$URL['query']}&load=true');</script></div>"; } /**/ //return "LOL GOOGLE HACKED WETFISH"; } break; case "music": list($Derp, $Delay) = explode("|", $GoodStuff, 2); $URL = parse_url($Derp); parse_str($URL['query'], $Query); if (strpos($Derp, 'http://') === false or strpos($Link, 'https://') === false or strpos($Derp, 'http://') !== false and preg_match('/^.*\\.?wetfish.net$/i', $URL['host'])) { if ($Delay) { $Unique = uuid(); $Delay *= 1000; $Javascript = "<script>setTimeout(\"\$('#{$Unique}').show()\", {$Delay})</script>"; return "{$Javascript}<embed id='{$Unique}' src='{$Derp}' width='0' height='0' autostart='true' loop='true' hidden='true' style='display:none;'></embed>"; } else { return "<embed src='{$GoodStuff}' width='0' height='0' autostart='true' loop='true' hidden='true'></embed>"; } } break; case "flash": list($url, $width, $height) = explode("|", $GoodStuff); return "<object width='{$width}' height='{$height}'><param name='movie' value='{$url}'><embed src='{$url}' width='{$width}' height='{$height}'></embed></object>"; break; case "drainbow": case "dblrainbow": case "doublerainbow": case "rainbow2": $Words = str_split_unicode(html_entity_decode($GoodStuff, ENT_QUOTES, 'UTF-8')); $Splitter = ''; foreach ($Words as $Word) { /* $RandomRed = rand(0, 255); $RandomGreen = rand(0, 255); $RandomBlue = rand(0, 255); $InvertedRed = 255 - $RandomRed; $InvertedGreen = 255 - $RandomGreen; $InvertedBlue = 255 - $RandomBlue; */ $rainbowCounter++; $randomHue = $rainbowCounter * 24 % 360; $randomSaturation = rand(0, 5) + 95; $randomLuminosity = rand(0, 24) + 44; $invertedHue = ($randomHue + 180) % 360; //background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue); //$Stuff .= "<span style='color:rgb($RandomRed, $RandomGreen, $RandomBlue); background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue);'>$Word</span>$Splitter"; $Stuff .= "<span style='font-size:110%; color:hsla({$randomHue}, {$randomSaturation}%, {$randomLuminosity}%, 0.8); text-shadow:1px 1px #000; background-color:hsla({$invertedHue}, {$randomSaturation}%, {$randomLuminosity}%, 0.6);'>" . $Word . "</span>{$Splitter}"; } return $Stuff; break; case "snow": return '<script type="text/javascript" src="/snowstorm.js"></script>'; break; case "rainbow": $Words = str_split_unicode(html_entity_decode($GoodStuff, ENT_QUOTES, 'UTF-8')); $Splitter = ''; foreach ($Words as $Word) { /* $RandomRed = rand(0, 255); $RandomGreen = rand(0, 255); $RandomBlue = rand(0, 255); $InvertedRed = 255 - $RandomRed; $InvertedGreen = 255 - $RandomGreen; $InvertedBlue = 255 - $RandomBlue; */ $rainbowCounter++; $randomHue = -1 * $rainbowCounter * 24 % 360; $randomSaturation = rand(0, 5) + 95; $randomLuminosity = rand(0, 24) + 44; $invertedHue = ($randomHue + 180) % 360; //background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue); //$Stuff .= "<span style='color:rgb($RandomRed, $RandomGreen, $RandomBlue); background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue);'>$Word</span>$Splitter"; $Stuff .= "<span style='font-size:110%; color:hsla({$randomHue}, {$randomSaturation}%, {$randomLuminosity}%, 0.8); text-shadow:1px 1px #000;'>" . $Word . "</span>{$Splitter}"; } return $Stuff; break; case "glitch": $Splitter = ' '; $Words = preg_split("/{$Splitter}/", $GoodStuff); if (count($Words) == 1) { $Words = str_split($GoodStuff); $Splitter = ''; } foreach ($Words as $Word) { $rainbowCounter++; $randomHue = rand(0, 360); $randomSaturation = rand(0, 5) + 95; $randomLuminosity = rand(0, 44) + 14; $invertedHue = ($randomHue + 180) % 360; $Stuff .= "<span style='font-size:110%; color:hsl({$randomHue}, {$randomSaturation}%, {$randomLuminosity}%); background-color:hsl({$invertedHue}, {$randomSaturation}%, {$randomLuminosity}%);'>{$Word}</span>{$Splitter}"; } return $Stuff; break; case "anchor": return "<a name='{$GoodStuff}'> </a>"; break; case "codepen": return embed_codepen($GoodStuff); break; case "fb": case "fishbux": list($amount, $image) = explode("|", $GoodStuff, 2); // Make sure image is an integer $image = (int) $image; // If none is set, generate a random image if (!$image) { $image = mt_rand(2, 4); } return "<div class='fishbux'> {$amount} <div class='wrap'><img src='/upload/fishbux/bux{$image}.gif'></div></div>"; break; } } else { // Self documenting! if ($Matches[1]) { return $Matches[1] . "[]"; } } }