<style type="text/css">
.videoModifiers {
    padding: 5px 0px;
    border-bottom: 1px solid #ccc;
    text-align: center;
}
.videoModifiers div.first {
    border-left: 0px;
    padding: 0px 10px 0px 2px;
}
.videoModifiers div.subcategory {
    border-left: 1px solid #ccc;
    padding: 0px 10px;
    font-size: 11px;
    display: inline;
}
#video-description b {
    color: #000;
}
#toolbelt-container {
    overflow: hidden;
    -moz-transition: height 0.2s ease-in;
    -o-transition: height 0.2s ease-in;
    -webkit-transition: height 0.2s ease-in;
}
.facets {
    color: #666;
    margin-top: 2px;
    margin-bottom: 0.5em;
    line-height: 13px;
    font-size: 11px;
}
.metadata-separator {
    color: #ccc;
    display: inline;
}
.viewcount, .video-count {
    color: #333;
    font-weight: bold;
}
.video-description {
    max-height: 2.4em;
    overflow: hidden;
    height: unset;
    margin-top: 5px;
    margin-bottom: 0.5em;
}
.video-long-title {
    height: unset;
}
.single-line-lego-list {
    height: 17px;
    overflow: hidden;
}
.single-line-lego-list li {
    margin-bottom: 1em;
    display: inline-block;
}
.single-line-lego-list .yt-badge-std {
    margin-right: 5px;
}
a.yt-badge-std {
    color: #fff !important;
    background-color: #99adeb;
    border: 1px solid #99adeb;
}
.yt-badge-std, .yt-badge-ypc, .yt-badge-new, .yt-badge-live, .yt-badge-playlist {
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1.5em;
    padding: 0 3px;
    margin-right: 1px;
    display: inline;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
}
a.yt-badge-std:hover {
    border-color: #4f69d5;
    text-decoration: none;
}
.playlist-videos li {
    list-style-type: none;
}
.tiny-video-icon {
    background: no-repeat url(/img/www-master-vflzoneYu.png) -196px -138px;
    height: 8px;
    width: 10px;
    margin-right: 5px;
}
.playlist-video {
    font-size: 11px;
    height: 2em;
    line-height: 2em;
}
.playlist-extra-thumb-inner, .playlist-extra-thumb-outer {
    font-size: 0;
    padding: 0 0 4px 0;
}
.ux-thumb, .ux-thumb-128, .ux-thumb-288, .ux-thumb-224, .ux-thumb-184, .ux-thumb-96, .ux-thumb-q-96, .ux-thumb-64, .ux-thumb-88, .ux-thumb-60, .ux-thumb-36, .ux-thumb-29, .ux-thumb-26, .ux-thumb-126, .ux-thumb-169, .ux-thumb-279, .ux-thumb-77, .ux-thumb-66, .ux-thumb-50, .playlist-extra-thumb-outer, .playlist-extra-thumb-inner {
    display: inline-block;
    _display: inline;
    _zoom: 1;
    padding: 4px;
    background: #fff;
    overflow: hidden;
    border: 1px solid #d3d3d3;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    _line-height: 0;
}
.result-item-thumb, #results-main-content .result-item .ux-thumb-wrap.result-item-thumb {
    float: left;
}
#results-main-content .playlist-extra-thumb-inner .ux-thumb-wrap, #results-main-content .playlist-video .ux-thumb-wrap {
    float: none;
}
.playlist-extra-thumb-inner, .playlist-extra-thumb-outer {
    font-size: 0;
    padding: 0 0 4px 0;
}
.playlist-extra-thumb-inner .video-thumb, .ux-thumb-wrap .video-thumb {
    vertical-align: bottom;
}
.video-thumb {
    background-color: white;
    position: relative;
}
.ux-thumb-128, .ux-thumb-128 .clip {
    height: 72px;
}
.ux-thumb-128, .ux-thumb-128 .clip, .ux-thumb-128 img {
    width: 128px;
}
.video-thumb .clip {
    position: relative;
    overflow: hidden;
    display: block;
}
.ux-thumb-128 .clip img {
    top: -12px;
}
.video-thumb .clip img {
    position: absolute;
    display: block;
    left: 0;
}
.playlist-extra-thumb-inner, .playlist-extra-thumb-inner .ux-thumb-wrap {
    margin: -1px;
    margin-top: -2px;
    margin-bottom: 0px;
}
.v128WrapperOuter {
    width: 128px;
    padding: 4px;
    background: #fff;
    overflow: hidden;
    border: 1px solid #d3d3d3;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
}
.v128WrapperInner {
    overflow: hidden;
    width: 128px;
    height: 72px;
    position: relative;
}
.vimg128 {
    margin-top: -12px;
    width: 128px;
    height: 96px;
}
.browseListView .v128WideEntry {
    margin-top: 3px;
}
.browseListView .v128WideEntry {
    float: left;
}
.video-time {
    margin-top: -30px;
    margin-right: 0;
}
.v128WrapperInner .quicklist-inlist {
    text-align: left;
    padding-left: 5px;
    background-color: #a0cd5b;
    font-size: 11px;
    height: 29px;
    margin-bottom: 1px;
    font-weight: bold;
    color: #000;
    -moz-opacity: 0.8;
    -webkit-opacity: 0.8;
    opacity: 0.8;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
    position: absolute;
    top: 43px;
}
.v128WrapperInner .quicklist-inlist {
    width: 123px;
}
.v128WrapperInner .video-actions {
    right: 0;
    bottom: 0;
}
.v128WrapperOuter:hover .video-actions {
    opacity: 1;
}
.v128WrapperOuter:hover .video-time {
    opacity: 0;
}
</style>
<script>
function hide(e) {
    document.getElementById(e +'-box').outerHTML = "";
}
</script>

<div id="search-settings-clr" class="hid"></div>
<div id="search-section-header" class="search-section-header-toolbelt">
    
    <script>
    function toggleToolbelt(){
        if (document.getElementById('toolbelt-container').style.height == "0px") {
            document.getElementById('search-option-expander').classList.add('collapsed');
            document.getElementById('toolbelt-container').style.height = "122px";
        }
        else {
            document.getElementById('search-option-expander').classList.remove('collapsed');
            document.getElementById('toolbelt-container').style.height = "0px";
        }
    }
    </script>
    <div id="search-option-expander" class="floatL" onclick="toggleToolbelt();">
        <button class="master-sprite search-option-expander-icon"></button>
        <a href="#" onclick="return false;"><?= $LANGS['searchoptions'] ?></a>
    </div>

    <div class="name" style="float:right;">
        <?php if ($_GET["t"] == "Search All" || $_GET["t"] == "Search Videos"): ?>
            <span class="search-query"> “<?= $SearchQuery ?>”</span> <?= str_replace("{t}","<b>$Total_Amount</b>",str_replace("{r}","<b>$Current_Page_Num - $Last_Page_Num</b>",$LANGS['resultcount'])) ?>
        <?php else: ?>
            <span class="search-query"> “<?= $SearchQuery ?>”</span> <?= str_replace("{t}","<b>$Amount</b>",str_replace("{r}","<b>$Current_Page_Num - $Last_Page_Num</b>",$LANGS['resultcount'])) ?>
        <?php endif ?>
    


    </div>


        <div class="clear"></div>
        <div id="toolbelt-top">
          <div id="toolbelt-container" style="height: 0px;">
      <div class="search-option-box search-option-box-first">
        <div class="search-option-label">
<?= $LANGS['resulttype'] ?>:
        </div>
        <?php if ($_GET["t"] == "Search All") : ?>
        <div class="search-option"><?= $LANGS['all'] ?></div>
        <?php else : ?>
        <div class="search-option"><a href="/results?search=<?= $_GET["search"] ?>&t=Search+All"><?= $LANGS['all'] ?></a></div>
        <?php endif ?>

        <?php if ($_GET["t"] == "Search Videos") : ?>
        <div class="search-option"><?= $LANGS['videos'] ?></div>
        <?php else : ?>
        <div class="search-option"><a href="/results?search=<?= $_GET["search"] ?>&t=Search+Videos"><?= $LANGS['videos'] ?></a></div>
        <?php endif ?>

        <?php if ($_GET["t"] == "Search Users") : ?>
        <div class="search-option"><?= $LANGS['channels'] ?></div>
        <?php else : ?>
        <div class="search-option"><a href="/results?search=<?= $_GET["search"] ?>&t=Search+Users"><?= $LANGS['channels'] ?></a></div>
        <?php endif ?>

        <?php if ($_GET["t"] == "Search Playlists") : ?>
        <div class="search-option"><?= $LANGS['playlists'] ?></div>
        <?php else : ?>
        <div class="search-option"><a href="/results?search=<?= $_GET["search"] ?>&t=Search+Playlists"><?= $LANGS['playlists'] ?></a></div>
        <?php endif ?>
      </div>
    
<?php if ($_GET["t"] == "Search Videos" || $_GET["t"] == "Search All") : ?>
      <div class="search-option-box">
        <div class="search-option-label">
<?= $LANGS['sortby'] ?>:
        </div>
        <?php if (!isset($_GET['order'])): ?>
          <div class="search-option"><?= $LANGS['relevance'] ?></div>
        <?php else: ?>
          <div class="search-option"><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=<?= $_GET['t'] ?><?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['relevance'] ?></a></div>
        <?php endif ?>

        <?php if (isset($_GET['order']) && $_GET['order'] == "date"): ?>
          <div class="search-option"><?= $LANGS['newest'] ?></div>
        <?php else: ?>
          <div class="search-option"><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=<?= $_GET['t'] ?>&order=date<?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['newest'] ?></a></div>
        <?php endif ?>

        <?php if (isset($_GET['order']) && $_GET['order'] == "views"): ?>
          <div class="search-option"><?= $LANGS['viewcount'] ?></div>
        <?php else: ?>
          <div class="search-option"><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=<?= $_GET['t'] ?>&order=views<?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['viewcount'] ?></a></div>
        <?php endif ?>

        <?php if (isset($_GET['order']) && $_GET['order'] == "rating"): ?>
          <div class="search-option"><?= $LANGS['searchrating'] ?></div>
        <?php else: ?>
          <div class="search-option"><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=<?= $_GET['t'] ?>&order=rating<?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['searchrating'] ?></a></div>
        <?php endif ?>
        </div>
      
      <div class="search-option-box">
        <div class="search-option-label">
<?= $LANGS['uploaded'] ?>:
        </div>
          <div class="search-option">
    <?php if (!isset($_GET['uploaded'])): ?><?= $LANGS['anytime'] ?>
    <?php else: ?><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['anytime'] ?></a>
    <?php endif ?>
        </div>

          <div class="search-option">
    <?php if (isset($_GET['uploaded']) && $_GET['uploaded'] == "d"): ?><?= $LANGS['timetoday'] ?>
    <?php else: ?><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?>&uploaded=d<?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['timetoday'] ?></a>
    <?php endif ?>
  </div>

          <div class="search-option">
    <?php if (isset($_GET['uploaded']) && $_GET['uploaded'] == "w"): ?><?= $LANGS['timeweek'] ?>
    <?php else: ?><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?>&uploaded=w<?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['timeweek'] ?></a>
    <?php endif ?>
  </div>

          <div class="search-option">
    <?php if (isset($_GET['uploaded']) && $_GET['uploaded'] == "m"): ?><?= $LANGS['timemonth'] ?>
    <?php else: ?><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?>&uploaded=m<?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['timemonth'] ?></a>
    <?php endif ?>
  </div>

      </div>
      
      
      <div class="search-option-box">
        <div class="search-option-label">
<?= $LANGS['duration'] ?>:
        </div>
          <div class="search-option">
    <?php if (!isset($_GET['length'])): ?><?= $LANGS['all'] ?>
    <?php else: ?>
        <a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?><?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?>" onclick=""><?= $LANGS['all'] ?></a>
    <?php endif ?>
  </div>

          <div class="search-option">
    <?php if (isset($_GET['length']) && $_GET['length'] == "s"): ?><?= $LANGS['durshort'] ?>
    <?php else: ?>
        <a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?><?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?>&length=s" onclick=""><?= $LANGS['durshort'] ?></a>
    <?php endif ?>
  </div>

          <div class="search-option">
    <?php if (isset($_GET['length']) && $_GET['length'] == "l"): ?><?= $LANGS['durlong'] ?>
    <?php else: ?>
        <a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?><?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?>&length=l" onclick=""><?= $LANGS['durlong'] ?></a>
    <?php endif ?>
  </div>

      </div>
      
      <div class="search-option-box">
        <div class="search-option-label">
<?= $LANGS['features'] ?>:
        </div>
          <div class="search-option">
    <?php if (!isset($_GET['type'])): ?><?= $LANGS['all'] ?>
    <?php else: ?>
        <a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?><?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>" onclick=""><?= $LANGS['all'] ?></a>
    <?php endif ?>
  </div>

          <div class="search-option">
    <?php if (isset($_GET['type']) && $_GET['type'] == "hd"): ?>HD
    <?php else: ?>
        <a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?><?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?>&type=hd<?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>">HD</a>
    <?php endif ?>
  </div>

          <div class="search-option">
    <?php if (isset($_GET['type']) && $_GET['type'] == "partner"): ?><?= $LANGS['partnervideos'] ?>
    <?php else: ?>
        <a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Videos<?php if (isset($_GET['order'])):?>&order=<?= $_GET['order'] ?><?php endif ?><?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?>&type=partner<?php if (isset($_GET['length'])):?>&length=<?= $_GET['length'] ?><?php endif ?>"><?= $LANGS['partnervideos'] ?></a>
    <?php endif ?>
  </div>

      </div>
<?php endif ?>
<?php if ($_GET["t"] == "Search Users"): ?>
<div class="search-option-box">
        <div class="search-option-label">
<?= $LANGS['sortby'] ?>:
        </div>
        <?php if (!isset($_GET['order'])): ?>
          <div class="search-option"><?= $LANGS['relevance'] ?></div>
        <?php else: ?>
          <div class="search-option"><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Users<?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?>"><?= $LANGS['relevance'] ?></a></div>
        <?php endif ?>

        <?php if (isset($_GET['order']) && $_GET['order'] == "subscribers"): ?>
          <div class="search-option"><?= $LANGS['cstatsubs'] ?></div>
        <?php else: ?>
          <div class="search-option"><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Users&order=subscribers<?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?>"><?= $LANGS['cstatsubs'] ?></a></div>
        <?php endif ?>

        <?php if (isset($_GET['order']) && $_GET['order'] == "views"): ?>
          <div class="search-option"><?= $LANGS['viewcount'] ?></div>
        <?php else: ?>
          <div class="search-option"><a href="/results?search=<?= urlencode((string) $_GET["search"]) ?>&t=Search+Users&order=views<?php if (isset($_GET['uploaded'])):?>&uploaded=<?= $_GET['uploaded'] ?><?php endif ?><?php if (isset($_GET['type'])):?>&type=<?= $_GET['type'] ?><?php endif ?>"><?= $LANGS['viewcount'] ?></a></div>
        <?php endif ?>
        </div>
<?php endif ?>
 

      <div class="clear"></div>
      <div id="search-advanced-form" class="hid">
        <div class="search-setting-inner alignC"><?= $LANGS['loading'] ?></div>
      </div>

  </div>

        </div>

    <div class="clear"></div>
</div>
<div id="searchMainContent">
    <?php if ($_GET["t"] == "Search All") : ?>
                    <?php if ($Videos_Amount > 0) : ?>
     <div id="video_grid" class="marT10 browseListView">
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tbody>
                <?php $Count = 0; ?>
                <tr valign="top"><td>
                    <?php if ((!isset($_GET['p']) || $_GET['p'] == 1) && !isset($_GET['order']) && !isset($_GET['uploaded']) && !isset($_GET['type'])): ?>
                    <?php foreach ($Users as $User) : ?>
                        <div class="membersGridView" style="float: left;width: 100%;">
                        <div class="memberContainer" style="margin:0;width: 100%;">
                        <div class="memberBoxGrid">
                        <div class="user-thumb-large">
                            <a href="/user/<?= $User["username"] ?>"><img src="<?= avatar($User["username"]) ?>" alt="<?= displayname($User["username"]) ?>"></a>
                        </div>
                        </div>
                   <div class="video-main-content" id="video-main-content" style="padding: 4px;">
                    <div class="video-title video-title-results">
                        <div class="video-long-title">
                            <a id="video-long-title" style="font-weight: normal;" href="/user/<?= $User["username"] ?>" title="<?= displayname($User["username"]) ?>" rel="nofollow"><?= make_text_bold(title($User["username"])) ?></a></div>
                    </div>
    
                    <div id="channel-description" class="video-description"><?= make_text_bold(nl2br((string) about($User["username"]))) ?></div>
                    <p class="facets">
                    <?php if ($LANGS['numberformat'] == 1): ?><?= number_format($User["subscribers"]) ?><?php else: ?><?= ($User["subscribers"]) ?><?php endif ?> <?= $LANGS['cstatsubs'] ?>
                    <span class="metadata-separator">|</span>  <span class="video-count"><?php if ($LANGS['numberformat'] == 1): ?><?= number_format($User['videos']) ?><?php else: ?><?= ($User['videos']) ?><?php endif ?> <?= $LANGS['cstatvideos'] ?></span>
                      </p>
                </div>
                </div> 
            </div>
            <div style="clear:both"></div>
                    <?php endforeach ?>
                    <?php foreach ($Playlists as $Playlist) : ?>
                <?php
                    $PlVideos = $DB->execute("SELECT url FROM playlists_videos WHERE playlist_id = :ID ORDER BY position ASC",false,array(":ID" => $Playlist["id"]));
                    $Videos_Count = $DB->execute("SELECT count(url) as amount FROM playlists_videos WHERE playlist_id = :ID", true, [":ID" => $Playlist["id"]])["amount"];
                    if ($PlVideos) {
                        if (isset($PlVideos[0])) {
                            $_VIDEO1 = new Video($PlVideos[0]["url"],$DB);
                            if ($_VIDEO1->exists()) {
                                $_VIDEO1->get_info();
                            } 
                            $Duration = $_VIDEO1->Info['length'];
                            $Thumb = $_VIDEO1->Info['url'];
                        }

                        if (isset($PlVideos[1])) {
                            $_VIDEO2 = new Video($PlVideos[1]["url"],$DB);
                            if ($_VIDEO2->exists()) {
                                $_VIDEO2->get_info();
                            } 
                            if (!isset($PlVideos[0])) {
                                $Duration = $_VIDEO2->Info['length'];
                                $Thumb = $_VIDEO2->Info['url'];
                            }
                        }
                        if (isset($PlVideos[2])) {
                            $_VIDEO3 = new Video($PlVideos[2]["url"],$DB);
                            if ($_VIDEO3->exists()) {
                                $_VIDEO3->get_info();
                            } 
                            if (!isset($PlVideos[0]) && !isset($PlVideos[1])) {
                                $Duration = $_VIDEO3->Info['length'];
                                $Thumb = $_VIDEO3->Info['url'];
                            }
                        }
                    } else {
                        $_VIDEO1 = false;
                        $_VIDEO2 = false;
                        $_VIDEO3 = false;
                    }

                ?>
                <div class="playlist-cell" style="width:auto">
                    <div class="playlist-alt-query">
        </div>
        <div class="playlist-entry yt-uix-hovercard">



        <div class="playlist-main-thumb">
            <div class="playlist-extra-thumb-outer result-item-thumb"><div class="playlist-extra-thumb-inner"><a href="/view_playlist?id=<?= $Playlist["id"] ?>" class="ux-thumb-wrap"><span class="video-thumb ux-thumb-128 "><span class="clip"><img onload="tn_load(1)" title="<?= $Playlist['title'] ?>" <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] .'/u/thmp/'.$Thumb.'.jpg')): ?>src="/u/thmp/<?= $Thumb ?>.jpg"<?php else: ?>src="/img/nothump.png"<?php endif ?>></span></span></a></div></div>
        </div>

        <div class="playlist-main-content" id="playlist-main-content-<?= $Playlist['id'] ?>">



            <div class="playlist-title playlist-title-results">
                <div class="playlist-short-title">
                    <a id="playlist-short-title-<?= $Playlist['id'] ?>" href="/view_playlist?p=<?= $Playlist['id'] ?>" class="yt-uix-hovercard-target" title="<?= $Playlist['title'] ?>" rel="nofollow"><?= make_text_bold($Playlist['title']) ?></a> 
                </div>
                <div class="playlist-long-title">
                    <span><a id="playlist-long-title-<?= $Playlist['id'] ?>" style="font-weight: normal;" href="/view_playlist?id=<?= $Playlist['id'] ?>" class="yt-uix-hovercard-target" title="<?= $Playlist['title'] ?>" rel="nofollow"><?= make_text_bold($Playlist['title']) ?></a></span>
                </div>
            </div>


            <div class="playlist-videos">
                <ul>
                    <?php if (isset($PlVideos[0]) && $_VIDEO1->exists()): ?>
                    <li>
                    <div class="playlist-video">
                        <img class="tiny-video-icon" src="/img/pixel.gif" alt=""><span><a class="hLink" title="<?= $_VIDEO1->Info['title'] ?>" href="/watch?v=<?= $_VIDEO1->Info['url'] ?>&pl=<?= $Playlist['id'] ?>"><?= make_text_bold($_VIDEO1->Info['title']) ?></a></span>
                    </div>
                    </li>
                <?php endif?>
                <?php if (isset($PlVideos[1]) && $_VIDEO2->exists()): ?>
                    <li>
                    <div class="playlist-video">
                        <img class="tiny-video-icon" src="/img/pixel.gif" alt=""><span><a class="hLink" title="<?= $_VIDEO2->Info['title'] ?>" href="/watch?v=<?= $_VIDEO2->Info['url'] ?>&pl=<?= $Playlist['id'] ?>"><?= make_text_bold($_VIDEO2->Info['title']) ?></a></span>
                    </div>
                    </li>
                    <?php endif?>
                    <?php if (isset($PlVideos[2]) && $_VIDEO3->exists()): ?>
                    <li>
                    <div class="playlist-video">
                        <img class="tiny-video-icon" src="/img/pixel.gif" alt=""><span><a class="hLink" title="<?= $_VIDEO3->Info['title'] ?>" href="/watch?v=<?= $_VIDEO3->Info['url'] ?>&pl=<?= $Playlist['id'] ?>"><?= make_text_bold($_VIDEO3->Info['title']) ?></a></span>
                    </div>
                    </li>
                    <?php endif?>
                </ul>
            </div>
            <p class="facets">
                <span class="username-prepend">by</span> <a href="/user/<?= $Playlist['by_user'] ?>"><?= displayname($Playlist['by_user']) ?></a>
            <span class="metadata-separator">|</span>  <span class="video-count"><?= $Videos_Count ?> videos</span>
              </p>
            <ul class="single-line-lego-list">
                <li><a href="/view_playlist?id=<?= $Playlist["id"] ?>" class="yt-badge-std"><?= mb_strtoupper((string) $LANGS['playlist']) ?></a></li>
              </ul>
        </div> 


        <div class="playlist-clear-list-left"></div>


    </div>
    </div>  
       
<div class="vlclear"></div>
            <?php endforeach ?>
        <?php endif ?>
        <?php foreach ($Videos as $Video) : ?>
        <?php $Count++ ?>
        <div class="vlcell">
            
    <div class="video-cell">
            <div class="video-entry">
                <?= load_thumbnail($Video["url"]) ?>
                <div class="video-main-content" id="video-main-content">
                    <div class="video-title video-title-results">
                        <div class="video-long-title">
                            <a id="video-long-title" style="font-weight: normal;" href="<?= $Video["link"] ?>" title="<?= mb_substr((string) $Video["title"],0,128) ?>" rel="nofollow"><?= make_text_bold(mb_substr((string) $Video["title"],0,128)) ?></a>
                        </div>
                    </div>
    
                    <div id="video-description" class="video-description">
                        <?php if($Video["description"]) : ?>
    <?= make_text_bold(short_title($Video["description"], 128)) ?>
    <?php else : ?><?= $LANGS['nodesc'] ?><?php endif ?>
                    </div>
                    <p class="facets">
                        <span class="username-prepend">by</span> <a href="/user/<?=$Video["uploaded_by"]?>"><?= displayname($Video["uploaded_by"]) ?></a>
                    <span class="metadata-separator">|</span>  <span class="date-added"><?= get_time_ago($Video["uploaded_on"]) ?></span>
                    <span class="metadata-separator">|</span>  <span class="viewcount"><?php if ($LANGS['numberformat'] == 1): ?><?= number_format($Video["views"]) ?><?php else: ?><?= ($Video["views"]) ?><?php endif ?> <?= $LANGS['videoviews'] ?></span>

                    </p>
                    <?php if ($Video['hd'] == 1): ?>
                    <ul class="single-line-lego-list">
                          <li><a href="<?= $Video["link"] ?>" class="yt-badge-std">HD</a></li>
                    </ul>
                    <?php endif ?>
                </div>
                <div class="video-clear-list-left"></div>
            </div>
        </div>


        </div>
        <div class="vlclear"></div>
 <?php if ($Count == 4) : ?>
 </td>
    </tr>
<tr valign="top"><td>
    <?php $Count = 0 ?>
                    <?php endif ?>
                    <?php endforeach ?>
</tbody>
</table>
</div>
        <div class="searchFooterBox">       <div class="pagingDiv">

        <?php
        if (isset($_GET["order"])) { $Order = "&order=".$_GET["order"]; } else {$Order = "";}
        if (isset($_GET["uploaded"])) { $Uploaded = "&uploaded=".$_GET["uploaded"]; } else {$Uploaded = "";}
        if (isset($_GET["type"])) { $Type = "&type=".$_GET["type"]; } else {$Type = "";}
         $_PAGINATION->new_show_pages_videos("search=".urlencode($_GET["search"])."&t=Search+All".$Order.$Uploaded.$Type) ?>
        
        </div>
</div>
<?php else: ?>
<div style="margin-top: 10px">
                    <div id="warn-box" class="yt-alert yt-alert-warn yt-rounded" style="width: 590px;margin: 5px 0;">
        <div class="yt-alert-icon"></div>
        <div class="yt-alert-close" onclick="hide('warn');"><div class="yt-alert-close-icon"></div></div>
        <div id="" class="yt-alert-content">
                <?= $LANGS['noresultsfoundfor'] ?> <span>“<?= $SearchQuery ?>”</span>

        </div>
        <div class="clear"></div>
    </div>

        </div>
<?php endif ?>
<?php elseif ($_GET["t"] == "Search Videos") : ?>
                    <?php if ($Videos_Amount > 0) : ?>
     <div id="video_grid" class="marT10 browseListView">
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tbody>
                <?php $Count = 0; ?>
                <tr valign="top"><td>
        <?php foreach ($Videos as $Video) : ?>
        <?php $Count++ ?>
        <div class="vlcell">
            
    <div class="video-cell">
            <div class="video-entry">
                <?= load_thumbnail($Video["url"]) ?>
                <div class="video-main-content" id="video-main-content">
                    <div class="video-title video-title-results">
                        <div class="video-long-title">
                            <a id="video-long-title" style="font-weight: normal;" href="<?= $Video["link"] ?>" title="<?= mb_substr((string) $Video["title"],0,128) ?>" rel="nofollow"><?= make_text_bold(mb_substr((string) $Video["title"],0,128)) ?></a>
                        </div>
                    </div>
    
                    <div id="video-description" class="video-description">
                        <?php if($Video["description"]) : ?>
    <?= make_text_bold(short_title($Video["description"], 128)) ?>
    <?php else : ?><?= $LANGS['nodesc'] ?><?php endif ?>
                    </div>
                    <p class="facets">
                        <span class="username-prepend">by</span> <a href="/user/<?=$Video["uploaded_by"]?>"><?= displayname($Video["uploaded_by"]) ?></a>
                    <span class="metadata-separator">|</span>  <span class="date-added"><?= get_time_ago($Video["uploaded_on"]) ?></span>
                    <span class="metadata-separator">|</span>  <span class="viewcount"><?php if ($LANGS['numberformat'] == 1): ?><?= number_format($Video["views"]) ?><?php else: ?><?= ($Video["views"]) ?><?php endif ?> <?= $LANGS['videoviews'] ?></span>
                    </p>
                    <?php if ($Video['hd'] == 1): ?>
                    <ul class="single-line-lego-list">
                          <li><a href="<?= $Video["link"] ?>" class="yt-badge-std">HD</a></li>
                    </ul>
                    <?php endif ?>
                </div>
                <div class="video-clear-list-left"></div>
            </div>
        </div>


        </div>
        <div class="vlclear"></div>
 <?php if ($Count == 4) : ?>
 </td>
    </tr>
<tr valign="top"><td>
    <?php $Count = 0 ?>
                    <?php endif ?>
                    <?php endforeach ?>
</tbody>
</table>
</div>
        <div class="searchFooterBox">       <div class="pagingDiv">

        <?php
        if (isset($_GET["order"])) { $Order = "&order=".$_GET["order"]; } else {$Order = "";}
        if (isset($_GET["uploaded"])) { $Uploaded = "&uploaded=".$_GET["uploaded"]; } else {$Uploaded = "";}
        if (isset($_GET["type"])) { $Type = "&type=".$_GET["type"]; } else {$Type = "";}
         $_PAGINATION->new_show_pages_videos("search=".urlencode($_GET["search"])."&t=Search+Videos".$Order.$Uploaded.$Type) ?>
        
        </div>
</div>
<?php else: ?>
<div style="margin-top: 10px">
                    <div id="warn-box" class="yt-alert yt-alert-warn yt-rounded" style="width: 590px;margin: 5px 0;">
        <div class="yt-alert-icon"></div>
        <div class="yt-alert-close" onclick="hide('warn');"><div class="yt-alert-close-icon"></div></div>
        <div id="" class="yt-alert-content">
                <?= $LANGS['novideosfoundfor'] ?> <span>“<?= $SearchQuery ?>”</span>

        </div>
        <div class="clear"></div>
    </div>

        </div>
<?php endif ?>            
    <?php elseif ($_GET["t"] == "Search Playlists") : ?>
        <?php if ($Playlists) : ?>
        <div id="video_grid" class="marT10 browseListView">
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tbody>
                <tr valign="top"><td>
                                    <?php foreach ($Playlists as $Playlist) : ?>
                <?php
                    $PlVideos = $DB->execute("SELECT url FROM playlists_videos WHERE playlist_id = :ID ORDER BY position ASC",false,array(":ID" => $Playlist["id"]));
                    $Videos_Count = $DB->execute("SELECT count(url) as amount FROM playlists_videos WHERE playlist_id = :ID", true, [":ID" => $Playlist["id"]])["amount"];
                    if ($PlVideos) {
                        if (isset($PlVideos[0])) {
                            $_VIDEO1 = new Video($PlVideos[0]["url"],$DB);
                            if ($_VIDEO1->exists()) {
                                $_VIDEO1->get_info();
                            } 
                            $Duration = $_VIDEO1->Info['length'];
                            $Thumb = $_VIDEO1->Info['url'];
                        }

                        if (isset($PlVideos[1])) {
                            $_VIDEO2 = new Video($PlVideos[1]["url"],$DB);
                            if ($_VIDEO2->exists()) {
                                $_VIDEO2->get_info();
                            } 
                            if (!isset($PlVideos[0])) {
                                $Duration = $_VIDEO2->Info['length'];
                                $Thumb = $_VIDEO2->Info['url'];
                            }
                        }
                        if (isset($PlVideos[2])) {
                            $_VIDEO3 = new Video($PlVideos[2]["url"],$DB);
                            if ($_VIDEO3->exists()) {
                                $_VIDEO3->get_info();
                            } 
                            if (!isset($PlVideos[0]) && !isset($PlVideos[1])) {
                                $Duration = $_VIDEO3->Info['length'];
                                $Thumb = $_VIDEO3->Info['url'];
                            }
                        }
                    } else {
                        $_VIDEO1 = false;
                        $_VIDEO2 = false;
                        $_VIDEO3 = false;
                    }

                ?>
                <div class="playlist-cell" style="width:auto">
                    <div class="playlist-alt-query">
        </div>
        <div class="playlist-entry yt-uix-hovercard">



        <div class="playlist-main-thumb">
            <div class="playlist-extra-thumb-outer result-item-thumb"><div class="playlist-extra-thumb-inner"><a href="/view_playlist?id=<?= $Playlist["id"] ?>" class="ux-thumb-wrap"><span class="video-thumb ux-thumb-128 "><span class="clip"><img onload="tn_load(1)" title="<?= $Playlist['title'] ?>" <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] .'/u/thmp/'.$Thumb.'.jpg')): ?>src="/u/thmp/<?= $Thumb ?>.jpg"<?php else: ?>src="/img/nothump.png"<?php endif ?>></span></span></a></div></div>
        </div>

        <div class="playlist-main-content" id="playlist-main-content-<?= $Playlist['id'] ?>">



            <div class="playlist-title playlist-title-results">
                <div class="playlist-short-title">
                    <a id="playlist-short-title-<?= $Playlist['id'] ?>" href="/view_playlist?p=<?= $Playlist['id'] ?>" class="yt-uix-hovercard-target" title="<?= $Playlist['title'] ?>" rel="nofollow"><?= make_text_bold($Playlist['title']) ?></a> 
                </div>
                <div class="playlist-long-title">
                    <span><a id="playlist-long-title-<?= $Playlist['id'] ?>" style="font-weight: normal;" href="/view_playlist?id=<?= $Playlist['id'] ?>" class="yt-uix-hovercard-target" title="<?= $Playlist['title'] ?>" rel="nofollow"><?= make_text_bold($Playlist['title']) ?></a></span>
                </div>
            </div>


            <div class="playlist-videos">
                <ul>
                    <?php if (isset($PlVideos[0]) && $_VIDEO1->exists()): ?>
                    <li>
                    <div class="playlist-video">
                        <img class="tiny-video-icon" src="/img/pixel.gif" alt=""><span><a class="hLink" title="<?= $_VIDEO1->Info['title'] ?>" href="/watch?v=<?= $_VIDEO1->Info['url'] ?>&pl=<?= $Playlist['id'] ?>"><?= make_text_bold($_VIDEO1->Info['title']) ?></a></span>
                    </div>
                    </li>
                <?php endif?>
                <?php if (isset($PlVideos[1]) && $_VIDEO2->exists()): ?>
                    <li>
                    <div class="playlist-video">
                        <img class="tiny-video-icon" src="/img/pixel.gif" alt=""><span><a class="hLink" title="<?= $_VIDEO2->Info['title'] ?>" href="/watch?v=<?= $_VIDEO2->Info['url'] ?>&pl=<?= $Playlist['id'] ?>"><?= make_text_bold($_VIDEO2->Info['title']) ?></a></span>
                    </div>
                    </li>
                    <?php endif?>
                    <?php if (isset($PlVideos[2]) && $_VIDEO3->exists()): ?>
                    <li>
                    <div class="playlist-video">
                        <img class="tiny-video-icon" src="/img/pixel.gif" alt=""><span><a class="hLink" title="<?= $_VIDEO3->Info['title'] ?>" href="/watch?v=<?= $_VIDEO3->Info['url'] ?>&pl=<?= $Playlist['id'] ?>"><?= make_text_bold($_VIDEO3->Info['title']) ?></a></span>
                    </div>
                    </li>
                    <?php endif?>
                </ul>
            </div>
            <p class="facets">
                <span class="username-prepend">by</span> <a href="/user/<?= $Playlist['by_user'] ?>"><?= displayname($Playlist['by_user']) ?></a>
            <span class="metadata-separator">|</span>  <span class="video-count"><?= $Videos_Count ?> videos</span>
              </p>
            <ul class="single-line-lego-list">
                <li><a href="/view_playlist?id=<?= $Playlist["id"] ?>" class="yt-badge-std"><?= mb_strtoupper((string) $LANGS['playlist']) ?></a></li>
              </ul>
        </div> 


        <div class="playlist-clear-list-left"></div>


    </div>
    </div>  
       
<div class="vlclear"></div>
<?php endforeach ?>
</td>
</tr>
</tbody>
</table>

        <div class="searchFooterBox">       <div class="pagingDiv">
            <?php $_PAGINATION->new_show_pages_videos("search=".urlencode((string) $_GET["search"])."&t=Search+Playlists") ?> 
        
        </div>
</div>
<?php else : ?>
<div style="margin-top: 10px">
                    <div id="warn-box" class="yt-alert yt-alert-warn yt-rounded" style="width: 590px;margin: 5px 0;">
        <div class="yt-alert-icon"></div>
        <div class="yt-alert-close" onclick="hide('warn');"><div class="yt-alert-close-icon"></div></div>
        <div id="" class="yt-alert-content">
                <?= $LANGS['noresultsfoundfor'] ?> <span>“<?= $SearchQuery ?>”</span>

        </div>
        <div class="clear"></div>
    </div>

        </div>
<?php endif ?>
<?php elseif ($_GET["t"] == "Search Users") : ?>
    <?php if ($Users) : ?>
        <div id="video_grid" class="membersGridView">
        <div class="padB5">
        </div>
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tbody>
        <?php $Count = 0; ?>
        <tr valign="top">
        <?php foreach ($Users as $User) : ?>
        <?php $Count++ ?>
        <td>
        <div class="memberContainer">
            <div class="memberBoxList">
                <div class="user-thumb-large">
                    <a href="/user/<?= $User["username"] ?>"><img src="<?= avatar($User["username"]) ?>" alt="<?= displayname($User["username"]) ?>"></a>
                </div>
            </div>
            <div class="vldescbox">
                <div class="vltitle">
                                <a href="/user/<?= $User["username"] ?>"><?= displayname($User["username"]) ?></a>

                </div>
            </div>
            <div class="vlclearalt"></div>
            <div class="memberBoxGrid">
                <div class="user-thumb-large">
                    <a href="/user/<?= $User["username"] ?>"><img src="<?= avatar($User["username"]) ?>" alt="<?= $User["username"] ?>"></a>
                </div>
            </div>
            <span class="vlfacets">
                <div class="memberBoxTypeContainer"></div>
                <div class="memberStat"><span class="channel-sub-count"><?= $User["subscribers"] ?><span class="channel-text-break-grid"></span> <?= $LANGS['cstatsubs'] ?></span></div><br>
                    <div class="memberStat"><span class="channel-view-count"><?php if ($LANGS['numberformat'] == 1): ?><?= number_format($User["video_views"]) ?><?php else: ?><?= ($User["video_views"]) ?><?php endif ?><span class="channel-text-break-grid"></span><span class="channel-text-break-grid"></span> <?= $LANGS['cstatviews'] ?></span></div>
            </span>
        </div> 

<?php unset($Avatar) ?>
 <?php if ($Count == 4) : ?>
 </td>
    </tr>
<tr valign="top">
<?php $Count = 0 ?>
<?php endif ?>
<?php endforeach ?>
</tr>
</tbody>
</table>

       <div class="searchFooterBox">       <div class="pagingDiv">
            <?php $_PAGINATION->new_show_pages_videos("search=".urlencode((string) $_GET["search"])."&t=Search+Users") ?> 
        
        </div>
</div>
<?php else: ?>
<div style="margin-top: 10px">
                    <div id="warn-box" class="yt-alert yt-alert-warn yt-rounded" style="width: 590px;margin: 5px 0;">
        <div class="yt-alert-icon"></div>
        <div class="yt-alert-close" onclick="hide('warn');"><div class="yt-alert-close-icon"></div></div>
        <div id="" class="yt-alert-content">
                <?= $LANGS['noresultsfoundfor'] ?> <span>“<?= $SearchQuery ?>”</span>

        </div>
        <div class="clear"></div>
    </div>

        </div>
<?php endif ?>
<?php endif ?>
    
    


</div>

<div id="search-pva" style="padding-top:0">

        
    <!-- Begin ad tag -->
        <div id="ad_creative_1" class="ad-div">

          <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Vlare_Main -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-8433080377364721"
     data-ad-slot="6350738097"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

            <div class="alignC xsmallText grayText padT3">
                Advertisement
            </div>
        </div>

    <!-- End ad tag --></div>
<div class="clear"></div>
