Style details

Changed many function calls to the new util class
master
ravenlp 2008-11-06 03:45:19 +00:00
parent d75749027c
commit 8e141a5239
8 changed files with 45 additions and 45 deletions

View File

@ -57,8 +57,8 @@ if ($user->isAdmin()) {
$_POST["description"] = addslashes($_POST["description"]); $_POST["description"] = addslashes($_POST["description"]);
} }
$_POST["title"] = removeBadTags($_POST["title"],true); $_POST["title"] = util::removeBadTags($_POST["title"],true);
$_POST["description"] = removeBadTags($_POST["description"]); $_POST["description"] = util::removeBadTags($_POST["description"]);
if ($tumble->addPost($_POST)) { if ($tumble->addPost($_POST)) {
$input = array("{type}"); $input = array("{type}");

View File

@ -29,9 +29,9 @@ fieldset{ border:none; margin:0; padding:0;}
/*********** LAYOUT *************/ /*********** LAYOUT *************/
body{ background: #e0e0e0; text-align:center; font-family:"Trebuchet Ms", Verdana, Tahoma; font-size:1em;} body{ background-color: #e0e0e0; text-align:center; font-family:"Trebuchet Ms", Verdana, Tahoma; font-size:1em;}
#cont{ width:600px; margin:30px auto 20px auto; text-align:left; border: 1px solid #999;} #cont{ width:600px; margin:30px auto 20px auto; text-align:left; border: 1px solid #999; background-color: #FFF; padding:10px 0 0 0;}
#head{ background: #fff url(images/head_bg.png) bottom center no-repeat; position: relative; padding:10px 0 20px 20px; height:73px;} #head{ background: #fff url(images/head_bg.png) bottom center no-repeat; position: relative; padding:10px 0 20px 20px; height:73px;}
h1 a{ display:block; height:77px; width:161px; background:#fff url(images/gelato-logo.png) top left no-repeat; text-indent:-9999px; overflow:hidden;} h1 a{ display:block; height:77px; width:161px; background:#fff url(images/gelato-logo.png) top left no-repeat; text-indent:-9999px; overflow:hidden;}
@ -119,7 +119,7 @@ fieldset.install input.txt{width:468px;}
.post .audio{} .post .audio{}
#foot { border-top:1px solid #999999; color:#000000; font-size:10px; padding:5px 10px; text-align:center;} #foot { border-top:1px solid #999999; color:#000000; font-size:10px; padding:5px 10px; text-align:center; background-color: #e0e0e0;}
#footer a { color: #000; } #footer a { color: #000; }

View File

@ -40,20 +40,20 @@ if ($user->isAuthenticated()) {
if(isset($_POST["btnAdd"])){ if(isset($_POST["btnAdd"])){
unset($_POST["btnAdd"]); unset($_POST["btnAdd"]);
$_POST['type'] = type2Number($_POST['type']); $_POST['type'] = util::type2Number($_POST['type']);
if ($_POST["type"]=="2") { // is Photo type if ($_POST["type"]=="2") { // is Photo type
if (isset($_POST["url"]) && $_POST["url"]!="") { if (isset($_POST["url"]) && $_POST["url"]!="") {
$photoName = getFileName($_POST["url"]); $photoName = util::getFileName($_POST["url"]);
if (!$tumble->savePhoto($_POST["url"])) { if (!$tumble->savePhoto($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?photo=false"); header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
die(); die();
} }
$_POST["url"] = "../uploads/".sanitizeName($photoName); $_POST["url"] = "../uploads/".util::sanitizeName($photoName);
} }
if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) { if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".util::sanitizeName($_FILES['photo']['name']) ) ) {
$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']); $_POST["url"] = "../uploads/".util::sanitizeName($_FILES['photo']['name']);
} }
unset($_POST["photo"]); unset($_POST["photo"]);
@ -62,7 +62,7 @@ if ($user->isAuthenticated()) {
if ($_POST["type"]=="7") { // is MP3 type if ($_POST["type"]=="7") { // is MP3 type
set_time_limit(300); set_time_limit(300);
$mp3Name = getFileName($_POST["url"]); $mp3Name = util::getFileName($_POST["url"]);
if (!$tumble->saveMP3($_POST["url"])) { if (!$tumble->saveMP3($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false"); header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false");
die(); die();
@ -84,8 +84,8 @@ if ($user->isAuthenticated()) {
$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"])); $_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
*/ */
$_POST["title"] = removeBadTags($_POST["title"],true); $_POST["title"] = util::removeBadTags($_POST["title"],true);
$_POST["description"] = removeBadTags($_POST["description"]); $_POST["description"] = util::removeBadTags($_POST["description"]);
if (isset($_POST["id_post"]) and is_numeric($_POST["id_post"]) and $_POST["id_post"]>0) { if (isset($_POST["id_post"]) and is_numeric($_POST["id_post"]) and $_POST["id_post"]>0) {
$tumble->modifyPost($_POST, $_POST["id_post"]); $tumble->modifyPost($_POST, $_POST["id_post"]);
@ -249,7 +249,7 @@ if ($user->isAuthenticated()) {
$row['Body'] = $register["description"]; $row['Body'] = $register["description"];
break; break;
case "2": case "2":
$fileName = "../uploads/".getFileName($register["url"]); $fileName = "../uploads/".util::getFileName($register["url"]);
$x = @getimagesize($fileName); $x = @getimagesize($fileName);
if ($x[0] > 100) if ($x[0] > 100)
@ -270,7 +270,7 @@ if ($user->isAuthenticated()) {
break; break;
case "4": case "4":
if($conf->shorten_links) if($conf->shorten_links)
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]); $register["url"] = util::_file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"]; $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
$row['URL'] = $register["url"]; $row['URL'] = $register["url"];

View File

@ -18,7 +18,7 @@ if ($user->isAdmin()) {
if(isset($_POST["btnsubmit"])) { if(isset($_POST["btnsubmit"])) {
unset($_POST["btnsubmit"]); unset($_POST["btnsubmit"]);
$_POST["url_installation"] = (endsWith($_POST["url_installation"], "/")) ? substr($_POST["url_installation"], 0, strlen($_POST["url_installation"])-1) : $_POST["url_installation"] ; $_POST["url_installation"] = (util::endsWith($_POST["url_installation"], "/")) ? substr($_POST["url_installation"], 0, strlen($_POST["url_installation"])-1) : $_POST["url_installation"] ;
$tumble->saveSettings($_POST); $tumble->saveSettings($_POST);
} else { } else {
?> ?>

View File

@ -113,7 +113,7 @@
{if {$Posts_Number}} {if {$Posts_Number}}
{block {$rows} as {$row}} {block {$rows} as {$row}}
<div class="entry"> <div class="entry">
<div class="info"><span class="compact"><a href="{$row.Permalink}">Link</a>&nbsp;<a href="{conf.urlGelato}/admin/index.php?edit={$row.Id_Post}" title="{__('Edit this post')}" class="help"><img src="{conf.urlGelato}/admin/css/images/edit.png" alt=""/></a>&nbsp;<a href="{conf.urlGelato}/admin/index.php?delete={$row.Id_Post}" title="{__('Delete this post')}" class="help"><img src="{conf.urlGelato}/admin/css/images/delete.png" alt="" title="" /></a></span> <div class="info"><span class="compact"><a href="{$row.Permalink}">Link</a>&nbsp;<a href="{conf.urlGelato}/admin/index.php?edit={$row.Id_Post}" title="{__('Edit this post')}" class="help"><img src="{conf.urlGelato}/admin/css/images/edit.png" alt=""/></a>&nbsp;<a href="{conf.urlGelato}/admin/index.php?delete={$row.Id_Post}" title="{__('Delete this post')}" class="help"><img src="{conf.urlGelato}/admin/css/images/delete.png" alt="" title="" onclick="return confirm('{__('Delete this post, really?')}');"/></a></span>
<p>{$row.Date_Added}</p> <p>{$row.Date_Added}</p>
</div> </div>
<div class="post"> <div class="post">

View File

@ -13,7 +13,7 @@
<div id="photo_url"> <div id="photo_url">
<label for="description">Photo URL</label> <label for="description">Photo URL</label>
<br /><input class="input-text" type="text" name="url" id="url" size="80" value="{editUrl}" /> <br /><input class="input-text" type="text" name="url" id="url" value="{editUrl}" style="width:400px"/>
<div style="font-size:11px; color:#666; margin-top:5px;"> <div style="font-size:11px; color:#666; margin-top:5px;">
<a href="#" class="linkFrm">Use a upload form instead</a> <a href="#" class="linkFrm">Use a upload form instead</a>
</div> </div>

View File

@ -142,7 +142,7 @@ class gelato {
} }
function saveMP3($remoteFileName) { function saveMP3($remoteFileName) {
if (getMP3File($remoteFileName)) { if (util::getMP3File($remoteFileName)) {
return true; return true;
} else { } else {
return false; return false;
@ -150,7 +150,7 @@ class gelato {
} }
function savePhoto($remoteFileName) { function savePhoto($remoteFileName) {
if (getPhotoFile($remoteFileName)) { if (util::getPhotoFile($remoteFileName)) {
return true; return true;
} else { } else {
return false; return false;
@ -158,38 +158,38 @@ class gelato {
} }
function getVideoPlayer($url) { function getVideoPlayer($url) {
if (isYoutubeVideo($url)) { if (util::isYoutubeVideo($url)) {
$id_video = getYoutubeVideoUrl($url); $id_video = util::getYoutubeVideoUrl($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.youtube.com/v/".$id_video."\"><param name=\"movie\" value=\"http://www.youtube.com/v/".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.youtube.com/v/".$id_video."\"><param name=\"movie\" value=\"http://www.youtube.com/v/".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isVimeoVideo($url)) { } elseif (util::isVimeoVideo($url)) {
$id_video = getVimeoVideoUrl($url); $id_video = util::getVimeoVideoUrl($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\"><param name=\"movie\" value=\"http://www.vimeo.com/moogaloop.swf?clip_id=".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isDailymotionVideo($url)) { } elseif (util::isDailymotionVideo($url)) {
$id_video = getDailymotionVideoUrl($url); $id_video = util::getDailymotionVideoUrl($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.dailymotion.com/swf/".$id_video."\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.dailymotion.com/swf/".$id_video."\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/".$id_video."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isYahooVideo($url)) { } elseif (util::isYahooVideo($url)) {
$id_video = getYahooVideoCode($url); $id_video = util::getYahooVideoCode($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"event_function=YAHOO.yv.Player.SWFInterface&amp;id=".$id_video[1]."&amp;vid=".$id_video[0]."&amp;onsite=1&amp;site=video.yahoo.com&amp;page=792730258&amp;lang=en-US&amp;intl=us\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"event_function=YAHOO.yv.Player.SWFInterface&amp;id=".$id_video[1]."&amp;vid=".$id_video[0]."&amp;onsite=1&amp;site=video.yahoo.com&amp;page=792730258&amp;lang=en-US&amp;intl=us\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isSlideSharePresentation($url)) { } elseif (util::isSlideSharePresentation($url)) {
$id_video = getSlideSharePresentationCode($url); $id_video = util::getSlideSharePresentationCode($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.slideshare.net/swf/player.swf?presentationId=".$id_video[0]."&amp;doc=".$id_video[1]."&amp;inContest=0&amp;startSlide=1\"><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://www.slideshare.net/swf/player.swf?presentationId=".$id_video[0]."&amp;doc=".$id_video[1]."&amp;inContest=0&amp;startSlide=1\"><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isGoogleVideoUrl($url)) { } elseif (util::isGoogleVideoUrl($url)) {
$id_video = getGoogleVideoCode($url); $id_video = util::getGoogleVideoCode($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\"><param name=\"movie\" value=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\"><param name=\"movie\" value=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isMTVVideoUrl($url)) { } elseif (util::isMTVVideoUrl($url)) {
$id_video = getMTVVideoCode($url); $id_video = util::getMTVVideoCode($url);
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:".$id_video."\"><param name=\"movie\" value=\"http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:".$id_video."\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"never\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:".$id_video."\"><param name=\"movie\" value=\"http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:".$id_video."\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"never\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} else { } else {
return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video, MTV or SlideShare)"; return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video, MTV or SlideShare)";
} }
} }
function getMp3Player($url) { function getMp3Player($url) {
if (isMP3($url)) { if (util::isMP3($url)) {
$playerUrl = $conf->urlGelato."/admin/scripts/player.swf?soundFile=".$url; $playerUrl = $conf->urlGelato."/admin/scripts/player.swf?soundFile=".$url;
return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"" . $playerUrl . "\" width=\"290\" height=\"24\"><param name=\"movie\" value=\"" . $playerUrl . "\" /><param name=\"quality\" value=\"high\" /><param name=\"menu\" value=\"false\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"" . $playerUrl . "\" width=\"290\" height=\"24\"><param name=\"movie\" value=\"" . $playerUrl . "\" /><param name=\"quality\" value=\"high\" /><param name=\"menu\" value=\"false\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isGoEar($url)) { } elseif (util::isGoEar($url)) {
return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://www.goear.com/files/external.swf\" width=\"366\" height=\"130\"><param name=\"movie\" value=\"http://www.goear.com/files/external.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"file=".getGoEarCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://www.goear.com/files/external.swf\" width=\"366\" height=\"130\"><param name=\"movie\" value=\"http://www.goear.com/files/external.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"file=".getGoEarCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} elseif (isOdeo($url)) { } elseif (util::isOdeo($url)) {
return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://media.odeo.com/flash/odeo_player.swf?v=3\" width=\"366\" height=\"75\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"type=audio&amp;id=".getOdeoCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://media.odeo.com/flash/odeo_player.swf?v=3\" width=\"366\" height=\"75\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"type=audio&amp;id=".getOdeoCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} else { } else {
return "This URL is not an MP3 file."; return "This URL is not an MP3 file.";

View File

@ -60,9 +60,9 @@ $theme = new themes;
$register = $tumble->getPost($id_post); $register = $tumble->getPost($id_post);
if (empty($register["title"])) { if (empty($register["title"])) {
if (!empty($register["description"])) { if (!empty($register["description"])) {
$page_title_data = trimString($register["description"], $page_title_len); $page_title_data = util::trimString($register["description"], $page_title_len);
} else { } else {
$page_title_data = type2Text($register["type"]); $page_title_data = util::type2Text($register["type"]);
} }
} else { } else {
$page_title_data = $register["title"]; $page_title_data = $register["title"];
@ -123,7 +123,7 @@ $theme = new themes;
$row['Body'] = $register["description"]; $row['Body'] = $register["description"];
break; break;
case "2": case "2":
$fileName = "uploads/".getFileName($register["url"]); $fileName = "uploads/".util::getFileName($register["url"]);
$x = @getimagesize($fileName); $x = @getimagesize($fileName);
if ($x[0] > 500) { if ($x[0] > 500) {
$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"]; $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
@ -144,7 +144,7 @@ $theme = new themes;
break; break;
case "4": case "4":
if($conf->shorten_links){ if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]); $register["url"] = util::_file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
} }
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"]; $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
@ -219,7 +219,7 @@ $theme = new themes;
$row['Body'] = $register["description"]; $row['Body'] = $register["description"];
break; break;
case "2": case "2":
$fileName = "uploads/".getFileName($register["url"]); $fileName = "uploads/".util::getFileName($register["url"]);
$x = @getimagesize($fileName); $x = @getimagesize($fileName);
if ($x[0] > 500) { if ($x[0] > 500) {
@ -241,7 +241,7 @@ $theme = new themes;
break; break;
case "4": case "4":
if($conf->shorten_links){ if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]); $register["url"] = util::_file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
} }
$row['URL'] = $register["url"]; $row['URL'] = $register["url"];
$row['Name'] = $register["title"]; $row['Name'] = $register["title"];
@ -268,9 +268,9 @@ $theme = new themes;
if (empty($register["title"])) { if (empty($register["title"])) {
if (!empty($register["description"])) { if (!empty($register["description"])) {
$postTitle = trimString($register["description"]); $postTitle = util::trimString($register["description"]);
} else { } else {
$postTitle = type2Text($register["type"]); $postTitle = util::type2Text($register["type"]);
} }
} else { } else {
$postTitle = $register["title"]; $postTitle = $register["title"];