Files
Testing/js/act/get_youtube.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

252 lines
5.3 KiB
PHP

<?php header('Content-type: application/json');
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/cmeter/');
include(PATHTOINCLUDES."base.php");
include(PATHTOINCLUDES."recordset_yt.php");
$em="";
if(isset($_GET["offset"]))
{
$offset=$_GET["offset"];
}
else
{
$offset=0;
}
if($offset==""){$offset=0;}
$page=
/*
$sql="SELECT
`you_x_tube`.`id`,
`you_x_tube`.`vid_id`,
`you_x_tube`.`width`,
`you_x_tube`.`height`,
`you_x_tube`.`vid_desc`,
`you_x_tube`.`vid_title`
FROM
`you_x_tube`
WHERE `you_x_tube`.`youtube` = 'Y' AND `you_x_tube`.`vid_active` = 'Y'
ORDER BY `you_x_tube`.`thesort` ASC
LIMIT 3 OFFSET " .$offset;
*/
$sql="SELECT
`you_x_tube`.`id`,
`you_x_tube`.`vid_id`,
`you_x_tube`.`width`,
`you_x_tube`.`height`,
`you_x_tube`.`vid_desc`,
`you_x_tube`.`vid_title`
FROM
`you_x_tube`
WHERE `you_x_tube`.`youtube` = 'Y' AND `you_x_tube`.`vid_active` = 'Y' AND `you_x_tube`.`ytfeatured` <> 'Y'
ORDER BY RAND()
LIMIT 10";
$result=$database->database_query($sql) or $em=$em.$database->database_error();
$sql2="SELECT count(`you_x_tube`.`id`) AS yid FROM `you_x_tube` WHERE `you_x_tube`.`youtube` = 'Y' AND `you_x_tube`.`vid_active` = 'Y' LIMIT 27 OFFSET 0";
$rcount=$database->database_query($sql2);
$thecount = $database->database_result($rcount,0);
$database->database_free_result($rcount);
$sql3="SELECT
`you_x_tube`.`id`,
`you_x_tube`.`vid_id`,
`you_x_tube`.`width`,
`you_x_tube`.`height`,
`you_x_tube`.`vid_desc`,
`you_x_tube`.`vid_title`
FROM
`you_x_tube`
WHERE `you_x_tube`.`ytfeatured` = 'Y' AND `you_x_tube`.`vid_active` = 'Y'
LIMIT 1";
$result3=$database->database_query($sql3) or $em=$em.$database->database_error();
$rownum=0;
$thetubes="";
$currentids="";
while($f = $database->database_fetch_assoc($result3))
{
$ytimage="https://img.youtube.com/vi/".$f["vid_id"]."/0.jpg";
$ytvid="http://www.youtube.com/watch?v=".$f["vid_id"];
$thetubes=$thetubes."<div class=\"tubes-container\" id=\"tube_post_0\" style=\"background:white;\">
<div class=\"tubes-container-pad\" style=\"padding:2px 1px 2px 2px;\">
<h2 style=\"font-size:12px;line-height:14px;padding:0 0 3px 0;margin:0;color:black;text-align:center;\">Featured Video</h2>
<div style=\"position:relative;display:block;\">
<a class=\"jackbox\" href=\"".$ytvid."\" data-group=\"featured_youtube\" data-autoplay=\"true\" data-title=\"Featured YouTube Video\" data-description=\"\" style=\"\" ><div class=\"jackbox-hover jackbox-hover-black jackbox-hover-play\" style=\"width:262px;\"></div><img src=\"".$ytimage."\" style=\"padding:1px;background:#707070;border:none;width:260px;height:auto;\" /></a>
<div class=\"wall-clear\" style=\"height:2px;margin-top:-1px;clear:both;overflow:hidden;\">&nbsp;</div>
</div>
<div><span class=\"yt_vid_title\"> <a class=\"jackbox\" style=\"display:inline;font-size:12px;\" href=\"".$ytvid."\" data-group=\"fytube\" data-autoplay=\"true\" data-title=\"Featured YouTube Video\">".stripslashes($f['vid_title'])."</a></span>
</div>
<div class=\"yt_vid_desc\" style=\"font-size:10px;color:black;\">".stripslashes($f["vid_desc"])."</div>
<div class=\"wall-clear\" style=\"height:2px;margin-top:-1px;clear:both;overflow:hidden;\">&nbsp;</div>
</div>";
}
/*
while ($row = $database->database_fetch_assoc($result)) {
if($currentids==""){$currentids=$row["id"];}
else{$currentids=$currentids.",".$row["id"];}
$rownum=$rownum+1;
if($rownum % 2 != 0){$rc="#333";} else{$rc="#000";}
$ytimage="https://img.youtube.com/vi/".$row["vid_id"]."/1.jpg";
$thetubes=$thetubes."<div class=\"tubes-container\" id=\"tube_post_".$rownum."\" style=\"background:".$rc.";position:relative;\">
<div class=\"tubes-container-pad\" style=\"padding:2px 1px 2px 2px;\">
<span style=\"position:relative;display:block;float:left;height:60px;width:85px;padding:2px 1px 2px 1px;text-decoration:none;\">
<img src=\"".$ytimage."\" width=\"79\" height=\"60\" style=\"padding:1px;background:#707070;border:none;\" />
<a href=\"javascript:view_youtube('".$row["vid_id"]."') \" style=\"font-size:10px;text-decoration:none;\">
<img src=\"/images/play_button_sm.png\" width=\"30\" height=\"23\" style=\"position:absolute;bottom:1px;left:51px;width:30px;height:23px;border:none;\" /></a>
</span>
<div>
<span class=\"yt_vid_title\"><a href=\"javascript:view_youtube('".$row["vid_id"]."') \" style=\"font-size:10px;line-height:160% !important;\">".stripslashes($row['vid_title'])."</a></span>
</div>
<div class=\"yt_vid_desc\" style=\"font-size:10px;\">".stripslashes($row["vid_desc"])."</div>
<div class=\"wall-clear\" style=\"height:2px;margin-top:-1px;clear:both;overflow:hidden;\">&nbsp;</div>
</div>
</div>";
}
$thetubes=$thetubes."
<script type='text/javascript'>
ids='".$currentids."'
</script>
<div class='morelink'><a href=\"javascript:loadmoreyoutube('".$currentids."');\">More</a></div>
";*/
$limit=300;
$container="thetubes";
$page_url="/js/act/get_youtube.php";
$navaid=recordsetNav($thecount,$page_url,$container,$offset,$limit,0);
$navaid="<div class=\"navaid\" style=\"text-align:right;padding:1px 5px 1px 0;background:#000;font-size:10px;\">".$navaid."</div>";
$thetubes=$thetubes.$navaid;
$arr = array ('error'=>$em, 'thecontent'=>$thetubes);
echo json_encode($arr);
?>