<commit_before><?php
require_once '../../../videos/configuration.php';

require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/functions.php';

if (!empty($_GET['type'])) {
    if ($_GET['type'] == 'audio') {
        $_SESSION['type'] = 'audio';
    } else if ($_GET['type'] == 'video') {
        $_SESSION['type'] = 'video';
    } else {
        $_SESSION['type'] = "";
        unset($_SESSION['type']);
    }
}

require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/video_ad.php';

if (empty($_GET['page'])) {
    $_GET['page'] = 1;
} else {
    $_GET['page'] = intval($_GET['page']);
}
$_POST['rowCount'] = 4;
$half = floor($_POST['rowCount'] / 2);
$_POST['current'] = $_GET['page'];
$_POST['sort']['created'] = 'desc';
$videos = Video::getAllVideos("viewableNotAd");
foreach ($videos as $key => $value) {
    $videos[$key] = Video::getVideo($value['id']);
    $name = empty($value['name']) ? $value['user'] : $value['name'];
    $videos[$key]['creator'] = '<div class="pull-left"><img src="' . User::getPhoto($value['users_id']) . '" alt="" class="img img-responsive img-circle" style="max-width: 50px;"/></div><div class="commentDetails" style="margin-left:60px;"><div class="commenterName"><strong><a href="' . $global['webSiteRootURL'] . 'channel/' . $value['users_id'] . '/">' . $name . '</a></strong><br><span class="text-muted">' . humanTiming(strtotime($value['videoCreation'])) . '</span></div></div>';
}
$count = 0;
if (!empty($videos)) {
    foreach ($videos as $video) {
        $count++;
        $ad = Video_ad::getAdFromCategory($video['categories_id']);
        $img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
        $playNowVideo = $video;
        $transformation = "{rotate:" . $video['rotation'] . ", zoom: " . $video['zoom'] . "}";
        if ($video['rotation'] === "90" || $video['rotation'] === "270") {
            $aspectRatio = "9:16";
            $vjsClass = "vjs-9-16";
            $embedResponsiveClass = "embed-responsive-9by16";
        } else {
            $aspectRatio = "16:9";
            $vjsClass = "vjs-16-9";
            $embedResponsiveClass = "embed-responsive-16by9";
        }

        if (!empty($ad)) {
            $playNowVideo = $ad;
            $logId = Video_ad::log($ad['id']);
        }
        if ($video['type'] !== "audio") {
            $poster = "{$global['webSiteRootURL']}videos/{$video['filename']}.jpg";
        } else {
            $poster = "{$global['webSiteRootURL']}view/img/audio_wave.jpg";
        }
        ?>
        <div class="row fbRow">
            <div class="col-md-10 col-md-offset-1 list-group-item">
                <div class="clear clearfix"><?php echo $video['creator']; ?> </div>
                <h2><?php echo $video['title']; ?></h2>
                <div><?php echo nl2br(textToLink($video['description'])); ?></div>
                <div class="main-video embed-responsive <?php
        echo $embedResponsiveClass;
        if (!empty($logId)) {
            echo " ad";
        }
        ?>">
                     <?php
                         if ($video['type'] === "embed") {
                             ?>
                        <div class="embed-responsive embed-responsive-16by9" id="mainVideo<?php echo $video['id']; ?>" >
                            <iframe id="iframe<?php echo $video['id']; ?>" class="embed-responsive-item" src="<?php echo parseVideos($video['videoLink']) ?>"></iframe>
                        </div>
                        <?php
                    } else {
                        ?>
                        <video poster="<?php echo $poster; ?>" controls crossorigin 
                               class="embed-responsive-item video-js vjs-default-skin <?php echo $vjsClass; ?> vjs-big-play-centered" 
                               id="mainVideo<?php echo $video['id']; ?>"  data-setup='{ "aspectRatio": "<?php echo $aspectRatio; ?>" }'>
                            <source src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $playNowVideo['filename']; ?>.mp4" type="video/mp4"><commit_msg>auto Play and Pause embed videos<commit_after><?php
require_once '../../../videos/configuration.php';

require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/functions.php';

if (!empty($_GET['type'])) {
    if ($_GET['type'] == 'audio') {
        $_SESSION['type'] = 'audio';
    } else if ($_GET['type'] == 'video') {
        $_SESSION['type'] = 'video';
    } else {
        $_SESSION['type'] = "";
        unset($_SESSION['type']);
    }
}

require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/video_ad.php';

if (empty($_GET['page'])) {
    $_GET['page'] = 1;
} else {
    $_GET['page'] = intval($_GET['page']);
}
$_POST['rowCount'] = 4;
$half = floor($_POST['rowCount'] / 2);
$_POST['current'] = $_GET['page'];
$_POST['sort']['created'] = 'desc';
$videos = Video::getAllVideos("viewableNotAd");
foreach ($videos as $key => $value) {
    $videos[$key] = Video::getVideo($value['id']);
    $name = empty($value['name']) ? $value['user'] : $value['name'];
    $videos[$key]['creator'] = '<div class="pull-left"><img src="' . User::getPhoto($value['users_id']) . '" alt="" class="img img-responsive img-circle" style="max-width: 50px;"/></div><div class="commentDetails" style="margin-left:60px;"><div class="commenterName"><strong><a href="' . $global['webSiteRootURL'] . 'channel/' . $value['users_id'] . '/">' . $name . '</a></strong><br><span class="text-muted">' . humanTiming(strtotime($value['videoCreation'])) . '</span></div></div>';
}
$count = 0;
if (!empty($videos)) {
    foreach ($videos as $video) {
        $count++;
        $ad = Video_ad::getAdFromCategory($video['categories_id']);
        $img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
        $playNowVideo = $video;
        $transformation = "{rotate:" . $video['rotation'] . ", zoom: " . $video['zoom'] . "}";
        if ($video['rotation'] === "90" || $video['rotation'] === "270") {
            $aspectRatio = "9:16";
            $vjsClass = "vjs-9-16";
            $embedResponsiveClass = "embed-responsive-9by16";
        } else {
            $aspectRatio = "16:9";
            $vjsClass = "vjs-16-9";
            $embedResponsiveClass = "embed-responsive-16by9";
        }

        if (!empty($ad)) {
            $playNowVideo = $ad;
            $logId = Video_ad::log($ad['id']);
        }
        if ($video['type'] !== "audio") {
            $poster = "{$global['webSiteRootURL']}videos/{$video['filename']}.jpg";
        } else {
            $poster = "{$global['webSiteRootURL']}view/img/audio_wave.jpg";
        }
        ?>
        <div class="row fbRow">
            <div class="col-md-10 col-md-offset-1 list-group-item">
                <div class="clear clearfix"><?php echo $video['creator']; ?> </div>
                <h2><?php echo $video['title']; ?></h2>
                <div><?php echo nl2br(textToLink($video['description'])); ?></div>
                <div class="main-video embed-responsive <?php
        echo $embedResponsiveClass;
        if (!empty($logId)) {
            echo " ad";
        }
        ?>">
                     <?php
                         if ($video['type'] === "embed") {
                             ?>
                        <div class="embed-responsive embed-responsive-16by9" id="mainVideo<?php echo $video['id']; ?>" >
                            <iframe id="iframe<?php echo $video['id']; ?>" class="embed-responsive-item" src="<?php echo parseVideos($video['videoLink']) ?>?enablejsapi=1"></iframe>
                        </div>
                        <?php
                    } else {
                        ?>
                        <video poster="<?php echo $poster; ?>" controls crossorigin 
                               class="embed-responsive-item video-js vjs-default-skin <?php echo $vjsClass; ?> vjs-big-play-centered" 
                               id="mainVideo<?php echo $video['id']; ?>"  data-setup='{ "aspectRatio": "<?php echo $aspectRatio; ?>" }'>
                            <source src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $playNowVideo['filename']; ?>.mp4" type="video/mp4">
{'fraction_non_alphanumeric': 0.21823368596220136, 'fraction_numerical': 0.011292048020920004, 'mean_word_length': 2.479735318444996, 'pattern_counts': {'":': 2, '<': 93, '<?xml version=': 0, '>': 95, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7298306', 'n_tokens_mistral': 2674, 'n_tokens_neox': 2571, 'n_words': 448}