Viewing file: index.php (26.39 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/********************************************************************************
- MemHT Portal -
Copyright (C) 2007-2008 by Miltenovik Manojlo
http://www.memht.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your opinion) 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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, see <http://www.gnu.org/licenses/> (GPLv2)
or write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA02110-1301, USA.
********************************************************************************/
if (!defined("_LOAD_PAGE_")) {
die("<table style='padding: 2px; border: 1px solid #999; background-color: #EEE; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>Error:</b> This file cannot be opened directly!</td></tr></table>");
}
$op = (isset($_GET['op'])) ? inCode($_GET['op']) : "" ;
$ok = (isset($_GET['ok'])) ? inCode($_GET['ok']) : false ;
$id = (isset($_GET['id'])) ? intval($_GET['id']) : 0 ;
$tag = (isset($_GET['tag'])) ? inCode($_GET['tag']) : "" ;
$rank = (isset($_GET['rank'])) ? intval($_GET['rank']) : 0 ;
$pg = (isset($_GET['pg'])) ? intval($_GET['pg']) : 1 ;
$ofsppg = 10; //Items per page
$ofsbgn = ($pg*$ofsppg)-$ofsppg;
openTable();
$config = getConfig($dblink->get_list("SELECT * FROM memht_youtube_config"));
echo "<table width='100%' cellpadding='0' cellspacing='0' align='right'><tr><td width='99%'></td><td style='padding-right:4px;'><div class='box'><a href='index.php?page=youtube&op=browse' title='"._BROWSE_."'>"._BROWSE_."</a></div></td><td><div class='box'><a href='index.php?page=youtube&op=search' title='"._SEARCH_."'>"._SEARCH_."</a></div></td></tr></table><div style='clear:both;'><div>\n";
switch ($op) {
default:
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>";
echo "<tr>";
echo "<td valign='top' style='padding-right:8px;'>";
//New
if ($result = $dblink->get_list("SELECT * FROM memht_youtube_videos WHERE enabled=1 ORDER BY id DESC LIMIT 6")) {
echo "<div style='margin-top:10px; font-size:120%;'><b>"._NEWVIDEOS_."</b></div><hr class='box' style='padding:0; margin:2px 0 0 0;'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
$n = 0;
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$videoid = outCode($row['videoid']);
$hits = intval($row['hits']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,$config['thumbnail']);
$thumbnail = "<img src='$thumbnail' border='0' width='130' height='97' alt='Thumbnail' class='box' style='margin:0;'>";
if ($n==0) { echo "<tr>\n"; }
echo "<td align='center' style='padding-top:6px;'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td>\n";
if ($n>=2) { echo "</tr>\n"; $n = 0; } else { $n++; }
}
echo "</table>\n";
}
//Random
if ($result = $dblink->get_list("SELECT *,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank FROM memht_youtube_videos AS v WHERE v.enabled=1 ORDER BY RAND() LIMIT 3")) {
echo "<div style='margin-top:10px; font-size:120%;'><b>"._RANDOM_."</b></div><hr class='box' style='padding:0; margin:2px 0 6px 0;'>";
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$description = outCode($row['description']);
if ($description=="") { $description = "-"; }
$videoid = outCode($row['videoid']);
$author = outCode($row['author']);
$hits = intval($row['hits']);
$rank = intval($row['rank']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='63' height='50' alt='Thumbnail' class='box' style='margin:0;'>";
echo "<div style='margin-top:6px; padding-bottom:6px;' class='underlined'>";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr>";
echo "<td width='1%' valign='top'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td>\n";
echo "<td valign='top' style='padding:0 6px;' width='55%'><div style='margin-bottom:10px;'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\"><b>$title</b></a></div><div><i>$description</i></div></td>\n";
echo "<td class='box' style='padding:0; margin:0; width:1px;'></td>\n";
echo "<td valign='top' style='padding:0 6px;'>";
echo "<div>"._AUTHOR_.": <i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></div>";
echo "<div style='margin:4px 0;'>"._VIEWS_.": <i>$hits</i></div>";
echo "<div><img src='templates/".$siteConfig['template']."/images/stars/$rank.png' border='0' alt='$rank'></div>";
echo "</td>\n";
echo "</tr></table>\n";
echo "</div>";
}
}
//Comments
if ($result = $dblink->get_list("SELECT * FROM memht_comments WHERE whr=20 AND moderate=0 ORDER BY id DESC LIMIT 5")) {
echo "<div style='margin-top:10px; font-size:120%;'><b>"._LASTCOMMENTS_."</b></div><hr class='box' style='padding:0; margin:2px 0 6px 0;'>";
foreach ($result as $row) {
$wid = intval($row['wid']);
$name = outCode($row['name']);
$text = outCode($row['text']);
echo "<div class='tpl_comments_box'>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td valign='top'><a href='index.php?page=youtube&op=show&id=$wid' title=\"$name\"><span class='tpl_comments_title'><b>$name</b></span></a><div class='tpl_comments_body'>$text</div></td></tr></table>\n";
echo "</div>\n";
}
}
echo "</td>";
echo "<td valign='top' width='36%'>";
//Top
if ($result = $dblink->get_list("SELECT *,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank FROM memht_youtube_videos AS v WHERE v.enabled=1 AND v.id!=$id ORDER BY hits DESC LIMIT 5")) {
$n = 0;
echo "<div style='margin-top:10px; font-size:120%;'><b>"._MOSTVISITED_."</b></div><hr class='box' style='padding:0; margin:2px 0 0 0;'>";
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$videoid = outCode($row['videoid']);
$author = outCode($row['author']);
$hits = intval($row['hits']);
$rank = intval($row['rank']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='95' height='75' alt='Thumbnail' class='box' style='margin:0;'>";
$class = ($n++<4) ? " class='underlined'" : "" ;
echo "<div style='margin-top:6px; padding-bottom:6px;'{$class}>";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td width='1%'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td><td style='padding-left:4px;' valign='top'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\"><b>$title</b></a>";
echo "<div style='margin:2px 0;'>"._AUTHOR_.": <i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></div>";
echo "<div>"._VIEWS_.": <i>$hits</i></div>";
echo "<div style='margin-top:2px;'><img src='templates/".$siteConfig['template']."/images/stars/$rank.png' border='0' alt='$rank'></div>"; echo "</td><tr></table>";
echo "</div>";
}
}
echo "</td>";
echo "</tr>";
echo "</table>";
break;
case "show":
if ($row = $dblink->get_row("SELECT *,DATE_FORMAT(v.date, '".$siteConfig['timestamp']."') as date,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank FROM memht_youtube_videos AS v WHERE v.id=$id AND enabled=1")) {
$dblink->query("UPDATE memht_youtube_videos SET hits=hits+1 WHERE id=$id AND enabled=1");
$oid = $id;
$title = outCode($row['title']);
$description = outCode($row['description']);
$date = $row['date'];
$videoid = outCode($row['videoid']);
$width = intval($row['width']);
$height = intval($row['height']);
$hits = intval($row['hits'])+1;
$author = outCode($row['author']);
$rank = intval($row['rank']);
if ($description=="") { $description = "-"; }
if ($width==0 OR $height==0) {
$width = intval($config['width']);
$height = intval($config['height']);
}
$patterns = array('{{W}}','{{H}}','{{VIDEOID}}');
$replaces = array($width,$height,$videoid);
$player = str_replace($patterns,$replaces,outCode($config['code']));
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='41' height='34' alt='Thumbnail' align='left' class='box' style='margin:3px 6px 0 2px;'>";
echo "<div style='margin-bottom:2px; font-size:140%;'><b>$title</b></div>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>";
echo "<tr>";
echo "<td valign='top' width='1%'>";
echo $player;
echo "<div class='box' style='margin:6px 0 0 0;'>";
echo "<table width='100%'><tr><td>";
if (file_exists("templates/".$siteConfig['template']."/images/stars/off.gif")) {
$offimg = "templates/".$siteConfig['template']."/images/stars/off.gif";
} else {
$offimg = "images/rate/off.gif";
}
if (file_exists("templates/".$siteConfig['template']."/images/stars/on.gif")) {
$onimg = "templates/".$siteConfig['template']."/images/stars/on.gif";
} else {
$onimg = "images/rate/on.gif";
}
$offstars = 5-$rank;
for ($i=1;$i<=5;$i++) {
$rankimg = ($i<=$rank) ? $onimg : $offimg ;
echo "<a href='index.php?page=youtube&op=vote&id=$id&rank=$i' title='header=["._UVOTE_."] body=[$i]'><img src='$rankimg' border='0' alt='$i'></a>";
}
echo "</td><td align='right' style='font-size:120%;'><b>"._VIEWS_.":</b> $hits</td></tr></table>";
echo "</div>";
echo "<div class='box' style='margin:6px 0 0 0; font-size:120%;'>";
//Tag system
echo "<img src='images/tag.gif' border='0' alt='Tags' align='left'> ";
if ($result = $dblink->get_list("SELECT tag FROM memht_youtube_tags WHERE cid=$id ORDER BY tag")) {
$tagstr = array();
foreach ($result as $row) {
$tag = outCode($row['tag']);
echo "<a href=\"index.php?page=youtube&op=related&tag=".urlencode($tag)."\" title=\"$tag\">$tag</a> ";
$tagstr[] = "t.tag='$tag'";
}
$tagstr = " AND (".implode(" OR ",$tagstr).")";
} else {
echo "-";
$tagstr = "";
}
echo "</div>";
echo "<div style='margin-top:10px;'></div>";
if ($siteConfig['usecomments']==1) {
//Comments
include_once("inc/class/comments.class.php");
$cc = new comments();
$cc->whr = 20;
$cc->wid = $id;
$cc->show();
}
echo "</td>";
echo "<td valign='top' style='padding-left:8px;'>";
echo "<div class='box' style='margin:0;'>{$thumbnail}"._AUTHOR_.": <b><i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></b><br>"._DATE_.": <i>$date</i><hr class='box' style='padding:0; margin:4px 0;'>$description</div>";
echo "<div class='box' style='margin:6px 0;'><div class='info'>"._YOUTUBEEMBEDCODE_.":</div><input type='text' value='".htmlspecialchars($player)."' style='width:240px;' onClick='javascript:this.select();' readonly></div>";
?>
<!-- AddThis Bookmark Button BEGIN -->
<script type="text/javascript">
addthis_url = '<?php echo $siteConfig['site_url']."/index.php?page=youtube&op=show&id=$id"; ?>';
addthis_title = '<?php echo $title; ?>';
addthis_pub = 'memht';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12"></script>
<!-- AddThis Bookmark Button END -->
<?php
//Other videos from the same author
if ($result = $dblink->get_list("SELECT *,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank FROM memht_youtube_videos AS v WHERE v.author='".inCode($author)."' AND v.enabled=1 AND v.id!=$id ORDER BY RAND() LIMIT 2")) {
$n = 0;
echo "<div style='margin-top:10px; font-size:120%;'><b>"._OTHERVIDEOSFROM_." <i>$author</i></b></div><hr class='box' style='padding:0; margin:2px 0 0 0;'>";
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$videoid = outCode($row['videoid']);
$author = outCode($row['author']);
$hits = intval($row['hits']);
$rank = intval($row['rank']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='95' height='75' alt='Thumbnail' class='box' style='margin:0;'>";
$class = ($n++<1) ? " class='underlined'" : "" ;
echo "<div style='margin-top:6px; padding-bottom:6px;'{$class}>";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td width='1%'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td><td style='padding-left:4px;' valign='top'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\"><b>$title</b></a>";
echo "<div style='margin:2px 0;'>"._AUTHOR_.": <i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></div>";
echo "<div>"._VIEWS_.": <i>$hits</i></div>";
echo "<div style='margin-top:2px;'><img src='templates/".$siteConfig['template']."/images/stars/$rank.png' border='0' alt='$rank'></div>";
echo "</td><tr></table>";
echo "</div>";
}
}
//Related videos
if ($tagstr!="" AND $result = $dblink->get_list("SELECT *,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank,COUNT(*) AS tot FROM memht_youtube_tags AS t JOIN memht_youtube_videos AS v ON t.cid=v.id WHERE t.cid!=$oid AND v.enabled=1{$tagstr} GROUP BY t.cid DESC ORDER BY RAND() LIMIT 5")) {
echo "<div style='margin-top:10px; font-size:120%;'><b>"._RELATEDVIDEOS_."</b></div><hr class='box' style='padding:0; margin:2px 0 0 0;'>";
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$videoid = outCode($row['videoid']);
$author = outCode($row['author']);
$hits = intval($row['hits']);
$tot = intval($row['tot']);
$rank = intval($row['rank']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='95' height='75' alt='Thumbnail' class='box' style='margin:0;'>";
echo "<div style='margin-top:6px; padding-bottom:6px;' class='underlined'>";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td width='1%'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td><td style='padding-left:4px;' valign='top'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\"><b>$title</b></a>";
echo "<div style='margin:2px 0;'>"._AUTHOR_.": <i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></div>";
echo "<div>"._VIEWS_.": <i>$hits</i></div>";
echo "<div style='margin-top:2px;'><img src='templates/".$siteConfig['template']."/images/stars/$rank.png' border='0' alt='$rank'></div>";
echo "</td><tr></table>";
echo "</div>";
}
}
echo "</td>";
echo "</tr>";
echo "</table>";
} else {
echo "<div align='center' id='errorText'><b>"._VIDEONOTFOUND_."!</b></div>";
}
break;
case "related":
if (!empty($tag)) {
if ($result = $dblink->get_list("SELECT *,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank FROM memht_youtube_tags AS t JOIN memht_youtube_videos AS v ON t.cid=v.id WHERE v.enabled=1 AND t.tag='$tag' GROUP BY t.cid DESC ORDER BY v.id DESC LIMIT $ofsbgn,$ofsppg")) {
echo "<div style='margin-top:10px; font-size:120%;'><b>"._RELATEDV_."</b>: $tag</div><hr class='box' style='padding:0; margin:2px 0 6px 0;'>";
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$description = outCode($row['description']);
if ($description=="") { $description = "-"; }
$videoid = outCode($row['videoid']);
$author = outCode($row['author']);
$hits = intval($row['hits']);
$rank = intval($row['rank']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='130' height='97' alt='Thumbnail' class='box' style='margin:0;'>";
echo "<div style='padding-bottom:6px; margin-bottom:6px;' class='underlined'>";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr>";
echo "<td width='1%'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td>\n";
echo "<td valign='top' style='padding:0 6px;' width='55%'><div style='margin-bottom:10px; font-size:140%;'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\"><b>$title</b></a></div><div class='box'>$description</div></td>\n";
echo "<td class='box' style='padding:0; margin:0; width:1px;'></td>\n";
echo "<td valign='top' style='padding:0 6px;'>";
echo "<div>"._AUTHOR_.": <i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></div>";
echo "<div style='margin:4px 0;'>"._VIEWS_.": <i>$hits</i></div>";
echo "<div><img src='templates/".$siteConfig['template']."/images/stars/$rank.png' border='0' alt='$rank'></div>";
echo "</td>\n";
echo "</tr></table>\n";
echo "</div>";
}
//Pages
include_once("inc/class/paginationSystem.class.php");
$ps = new paginationSystem();
$ps->items = $ofsppg;
$ps->actpg = $pg;
$ps->query = "SELECT *,COUNT(*) AS tot FROM memht_youtube_tags AS t JOIN memht_youtube_videos AS v ON t.cid=v.id WHERE v.enabled=1 AND t.tag='$tag' GROUP BY t.cid DESC";
$ps->url = "index.php?page=youtube&op=related&tag=".mem_urlencode($tag)."&pg={{N}}";
$ps->show();
} else {
echo "<div align='center' id='errorText'><b>"._EMPTY_."</b></div>";
}
} else {
echo "<div align='center' id='errorText'><b>"._NOTAGSPEC_."</b></div>";
}
break;
case "vote":
if ($ok OR !(extension_loaded('gd') AND $siteConfig['graphic_check']==1)) {
@session_start();
if ((isset($_POST['post_code_page']) AND isset($_SESSION['chk_rank']) AND strtolower($_POST['post_code_page'])==strtolower($_SESSION['chk_rank'])) OR !(extension_loaded('gd') AND $siteConfig['graphic_check']==1)) {
if ($dblink->get_num("SELECT id FROM memht_ratings WHERE whr=20 AND wid=$id AND ip='".$visitorInfo['ip']."'")==0) {
$dblink->query("INSERT INTO memht_ratings (id,whr,wid,vote,ip) VALUES (null,'20','$id','$rank','".$visitorInfo['ip']."')");
echo "<meta http-equiv='refresh' content='0;URL=".$siteConfig['site_url']."/index.php?page=youtube&op=show&id=$id'>";
} else {
echo "<div align='center' id='errorText'><b>"._ALREADYVOTED_."</b></div>";
echo "<meta http-equiv='refresh' content='3;URL=".$siteConfig['site_url']."/index.php?page=youtube&op=show&id=$id'>";
}
} else {
echo "<div align='center' id='errorText'><b>"._WRONGSECCODE_."</b></div>";
}
} else {
echo "<div align='center'><table border='0' class='box'>\n";
echo "<form name='vote' method='post' action='index.php?page=youtube&op=vote&id=$id&rank=$rank&ok=true'>";
echo "<tr><td><img src='".$siteConfig['site_url']."/imgCode.php?name=chk_rank&nc=".md5(time()+rand())."' title='header=["._SECURITY_CODE_."] body=["._SECURITY_CODE_TEXT_."]' alt='Captcha'></td></tr>\n";
echo "<tr><td valign='top'><div align='left'><input type='text' name='post_code_page' size='10' maxlength='255'> <input type='submit' name='Submit' value='"._UVOTE_."'></div></td></tr>\n";
echo "</form>\n";
echo "</table></div>\n";
}
break;
case "browse":
if ($result = $dblink->get_list("SELECT *,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank FROM memht_youtube_videos AS v WHERE v.enabled=1 ORDER BY v.id DESC LIMIT $ofsbgn,$ofsppg")) {
echo "<div style='margin-top:10px; font-size:120%;'><b>"._BROWSE_."</b></div><hr class='box' style='padding:0; margin:2px 0 6px 0;'>";
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$description = outCode($row['description']);
if ($description=="") { $description = "-"; }
$videoid = outCode($row['videoid']);
$author = outCode($row['author']);
$hits = intval($row['hits']);
$rank = intval($row['rank']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='130' height='97' alt='Thumbnail' class='box' style='margin:0;'>";
echo "<div style='padding-bottom:6px; margin-bottom:6px;' class='underlined'>";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr>";
echo "<td width='1%'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td>\n";
echo "<td valign='top' style='padding:0 6px;' width='55%'><div style='margin-bottom:10px; font-size:140%;'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\"><b>$title</b></a></div><div class='box'>$description</div></td>\n";
echo "<td class='box' style='padding:0; margin:0; width:1px;'></td>\n";
echo "<td valign='top' style='padding:0 6px;'>";
echo "<div>"._AUTHOR_.": <i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></div>";
echo "<div style='margin:4px 0;'>"._VIEWS_.": <i>$hits</i></div>";
echo "<div><img src='templates/".$siteConfig['template']."/images/stars/$rank.png' border='0' alt='$rank'></div>";
echo "</td>\n";
echo "</tr></table>\n";
echo "</div>";
}
//Pages
include_once("inc/class/paginationSystem.class.php");
$ps = new paginationSystem();
$ps->items = $ofsppg;
$ps->actpg = $pg;
$ps->query = "SELECT id FROM memht_youtube_videos WHERE enabled=1";
$ps->url = "index.php?page=youtube&op=browse&pg={{N}}";
$ps->show();
} else {
echo "<div align='center' id='errorText'><b>"._EMPTY_."</b></div>";
}
break;
case "search":
echo "<div style='margin-top:10px; font-size:120%;'><b>"._SEARCH_."</b></div><hr class='box' style='padding:0; margin:2px 0 6px 0;'>";
if (!$ok) {
echo "<form name='cerca' id='cerca' action='index.php?page=youtube&op=search&ok=true' method='post'>\n";
echo "<div align='center' style='margin-top:10px;'><input name='query' type='text' size='30' maxlength='255'> <input type='submit' name='Submit' value='"._SEARCH_."'></div>\n";
echo "</form>\n";
} else {
$query = (isset($_POST['query'])) ? inCode($_POST['query']) : "" ;
if ($result = $dblink->get_list("SELECT *,(SELECT ROUND(SUM(vote)/COUNT(id)) AS irank FROM memht_ratings WHERE whr=20 AND wid=v.id) AS rank FROM memht_youtube_videos AS v WHERE v.title LIKE '%$query%' LIMIT 10")) {
foreach ($result as $row) {
$id = intval($row['id']);
$title = outCode($row['title']);
$description = outCode($row['description']);
if ($description=="") { $description = "-"; }
$videoid = outCode($row['videoid']);
$author = outCode($row['author']);
$hits = intval($row['hits']);
$rank = intval($row['rank']);
$thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail']));
$thumbnail = "<img src='$thumbnail' border='0' width='130' height='97' alt='Thumbnail' class='box' style='margin:0;'>";
echo "<div style='padding-bottom:6px; margin-bottom:6px;' class='underlined'>";
echo "<table width='100%' cellpadding='0' cellspacing='0'><tr>";
echo "<td width='1%'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\">$thumbnail</a></td>\n";
echo "<td valign='top' style='padding:0 6px;' width='55%'><div style='margin-bottom:10px; font-size:140%;'><a href='index.php?page=youtube&op=show&id=$id' title=\"$title\"><b>$title</b></a></div><div class='box'>$description</div></td>\n";
echo "<td class='box' style='padding:0; margin:0; width:1px;'></td>\n";
echo "<td valign='top' style='padding:0 6px;'>";
echo "<div>"._AUTHOR_.": <i><a href='index.php?page=users&op=userInfo&usert=$author' title='$author'>$author</a></i></div>";
echo "<div style='margin:4px 0;'>"._VIEWS_.": <i>$hits</i></div>";
echo "<div><img src='templates/".$siteConfig['template']."/images/stars/$rank.png' border='0' alt='$rank'></div>";
echo "</td>\n";
echo "</tr></table>\n";
echo "</div>";
}
} else {
echo "<div align='center' id='errorText' class='box'><b>"._NORES_."</b></div>";
}
}
break;
}
closeTable();
function getConfig($result) {
$config = array();
foreach ($result as $row) {
$config[$row['key']] = $row['value'];
}
return $config;
}
?>
|