Beispiel #1
0
 *
 * License: http://www.bluethrust.com/license.php
 *
 */
if (!defined("SHOW_PROFILE_MAIN")) {
    exit;
}
include_once $prevFolder . "plugins/youtube/youtube.php";
include_once $prevFolder . "plugins/youtube/ytbuttoncss.php";
$ytObj = new Youtube($mysqli);
if ($ytObj->hasYoutube($memberInfo['member_id'])) {
    $ytInfo = $ytObj->get_info_filtered();
    if ($ytInfo['showsubscribe'] + $ytInfo['showvideos'] > 0) {
        echo "\n\t\t\t\t\t<div class='formTitle' style='position: relative; text-align: center; margin-top: 20px'>Youtube</div>\n\t\t\t\t\t\n\t\t\t\t\t<table class='profileTable' style='border-top-width: 0px'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='main' style='padding: 25px 0px'>\n\t\t\t\t\t\t\t<div id='loadingSpiralYTCache' class='loadingSpiral' style='padding-top: 0px'>\n\t\t\t\t\t\t\t\t<p align='center'>\n\t\t\t\t\t\t\t\t\t<img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/loading-spiral.gif'><br>Refreshing Data\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t";
        if ($ytInfo['showsubscribe'] == 1) {
            echo "\n\n\t\t\t\t\t<div id='ytInfoCard'>" . $ytObj->dispSubscribeButton() . "</div>\n\t\t\t\t\t<div style='font-style: italic; text-align: center; margin-top: 3px; margin-left: auto; margin-right: auto; margin-bottom: 25px; position: relative' class='main'>\n\t\t\t\t\t\tLast updated <span id='lastUpdateTime'>" . getPreciseTime($ytInfo['lastupdate']) . "</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t";
        }
        if ($ytInfo['showvideos'] > 0) {
            echo "\n\n\t\t\t\t\t<div id='ytVideosContainer' class='ytProfileVideos'>\n\t\t\t\t\t\t<div style='position: absolute'>\n\t\t\t\t\t\t";
            $result = $mysqli->query("SELECT * FROM " . $dbprefix . "youtube_videos WHERE youtube_id = '" . $ytInfo['youtube_id'] . "' ORDER BY youtubevideo_id LIMIT " . $ytInfo['showvideos']);
            while ($row = $result->fetch_assoc()) {
                echo "<div class='ytVideo'><a href='http://www.youtube.com/watch?v=" . $row['video_id'] . "' target='_blank'><img src='" . $row['thumbnail'] . "' width='185' height='104' style='border: 0px'><p class='main' style='padding-top: 2px; margin-top: 0px'>" . $row['title'] . "</a></p></div>";
            }
            echo "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t";
            echo "\n\t\t\t\t\t<div class='videoScroller'></div>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\tvar videoHeight = 0;\n\t\t\t\t\t\t\t\$('.ytVideo').each(function(index) {\n\t\t\t\t\t\t\t\tif(\$(this).height() > videoHeight) {\n\t\t\t\t\t\t\t\t\tvideoHeight = \$(this).height();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#ytVideosContainer').css('height', videoHeight+'px');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar maxScroll = \$('#ytVideosContainer')[0].scrollWidth-\$('#ytVideosContainer').width();\n\t\t\t\t\t\t\tif(maxScroll > 0) {\n\t\t\t\t\t\t\t\t\$('.videoScroller').slider({\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tmax: maxScroll,\n\t\t\t\t\t\t\t\t\tslide: function(event, ui) {\n\t\t\t\t\t\t\t\t\t\t\$('#ytVideosContainer').scrollLeft(\$(this).slider('option', 'value'));\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchange: function(event, ui) {\n\t\t\t\t\t\t\t\t\t\t\$('#ytVideosContainer').scrollLeft(\$(this).slider('option', 'value'));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\n\t\t\t\t\t\n\t\t\t\t";
        }
        echo "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\t\t\n\t\t\t\t";
        if (time() - $ytInfo['lastupdate'] > 1800) {
            echo "\n\t\t\t\t\t\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\n\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#loadingSpiralYTCache').show();\n\t\t\t\t\t\t\t\$('#ytInfoCard').fadeOut(250);\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "plugins/youtube/reloadcache.php', { yID: '" . $ytInfo['youtube_id'] . "' }, function(data) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tpostResult = JSON.parse(data);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(postResult['result'] == 'success') {\n\t\t\t\t\t\t\t\t\t\$('#ytInfoCard').html(postResult['html']);\n\t\t\t\t\t\t\t\t\t\$('#lastUpdateTime').html(postResult['time']);\n\t\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\$('#ytInfoCard').fadeIn(250);\n\t\t\t\t\t\t\t\t\$('#loadingSpiralYTCache').hide();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar bubbleRight = (\$('.ytBubble').width()*-1)-20;\n\t\t\t\t\t\t\t\t\$('.ytBubble').css('right', bubbleRight+'px');\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t</script>\n\t\t\t\t\n\t\t\t\t";
        }
    }
        }
    }
    $ytInfo = $ytObj->get_info_filtered();
    $checkVideos = array();
    if ($ytInfo['showvideos'] == 0) {
        $checkVideos[0] = " selected";
    } elseif ($ytInfo['showvideos'] == 1) {
        $checkVideos[1] = " selected";
    }
    $checkInfoCard = $ytInfo['showsubscribe'] == 1 ? " checked" : "";
    $checkAllowLogin = $ytInfo['allowlogin'] == 1 ? " checked" : "";
    echo "\n\t\t\t<div id='loadingSpiralDisconnect' class='loadingSpiral'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\t<img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/loading-spiral.gif'><br>Loading\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t<div id='connectedDiv'>\n\t\t\t<form action='" . $MAIN_ROOT . "members/console.php?cID=" . $_GET['cID'] . "' method='post'>\n\t\t\t<div class='formDiv'>\n\t\t\t";
    if ($dispError != "") {
        echo "\n\t\t\t<div class='errorDiv'>\n\t\t\t<strong>Unable to save Youtube settings because the following errors occurred:</strong><br><br>\n\t\t\t{$dispError}\n\t\t\t</div>\n\t\t\t";
    }
    echo "\n\t\t\t\n\t\t\t\t<table class='formTable'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t\t<div class='main dottedLine' style='margin-bottom: 20px; padding-bottom: 3px'>\n\t\t\t\t\t\t\t\t<b>Connected:</b>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t\t<div id='loadingSpiral' class='loadingSpiral' style='padding-top: 0px'>\n\t\t\t\t\t\t\t\t<p align='center'>\n\t\t\t\t\t\t\t\t\t<img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/loading-spiral.gif'><br>Refreshing Data\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div id='ytInfoCard'>" . $ytObj->dispSubscribeButton() . "</div>\n\t\t\t\t\t\t\t<div style='font-style: italic; text-align: center; margin-top: 3px; margin-left: auto; margin-right: auto; position: relative' class='main'>\n\t\t\t\t\t\t\t\tLast updated <span id='lastUpdateTime'>" . getPreciseTime($ytInfo['lastupdate']) . "</span>\n\t\t\t\t\t\t\t\t<p class='largeFont' style='font-style: normal; font-weight: bold' align='center'>\n\t\t\t\t\t\t\t\t\t<a style='cursor: pointer' id='btnDisconnect'>DISCONNECT ACCOUNT</a>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t\t<div class='main dottedLine' style='margin-bottom: 20px; padding-bottom: 3px'>\n\t\t\t\t\t\t\t\t<b>Profile Display Options:</b>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>Show Info Card: <a href='javascript:void(0)' onmouseover=\"showToolTip('An example of the Info Card is shown in the &quot;Connected&quot; section above.')\" onmouseout='hideToolTip()'>(?)</a></td>\n\t\t\t\t\t\t<td class='main'><input type='checkbox' name='showinfocard' value='1'" . $checkInfoCard . "></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>Video Display:</td>\n\t\t\t\t\t\t<td class='main'>\n\t\t\t\t\t\t\t<select name='showvideos' class='textBox'>\n\t\t\t\t\t\t\t\t<option value='0'" . $checkVideos[0] . ">Don't Show Videos</option>\n\t\t\t\t\t\t\t\t<option value='1'" . $checkVideos[1] . ">Most Recent Video</option>\n\t\t\t\t\t\t\t\t";
    for ($i = 2; $i <= 5; $i++) {
        $dispChecked = "";
        if ($ytInfo['showvideos'] == $i) {
            $dispChecked = " selected";
        }
        echo "<option value='" . $i . "'" . $dispChecked . ">" . $i . " Most Recent Videos</option>";
    }
    echo "\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2'><br>\n\t\t\t\t\t\t\t<div class='main dottedLine' style='margin-bottom: 2px; padding-bottom: 3px'>\n\t\t\t\t\t\t\t\t<b>Log In Options:</b>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div style='padding-left: 3px; margin-bottom: 15px'>\n\t\t\t\t\t\t\t\tCheck the box below to allow logging into this website through Youtube.\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>Allow Log In:</td>\n\t\t\t\t\t\t<td class='main'><input type='checkbox' name='allowlogin' value='1'" . $checkAllowLogin . "></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='main' colspan='2' align='center'><br>\n\t\t\t\t\t\t\t<input type='submit' name='submit' value='Save' class='submitButton'>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\n\t\t\t</div>\n\t\t\t</form>\n\t\t\t</div>\n\t\t\t\n\t\t\t<div id='disconnectDiv' style='display: none'>\n\t\t\t<p class='main' align='center'>\n\t\t\t\tAre you sure you want to disconnect your Youtube account?\n\t\t\t</p>\n\t\t</div>\n\t\t\n\t\t<script type='text/javascript'>\n\t\t\n\t\t\t\$(document).ready(function() {\n\t\t\t\n\t\t\t\t\$('#btnDisconnect').click(function() {\n\t\t\t\t\t\n\t\t\t\t\t\$('#disconnectDiv').dialog({\n\t\t\t\t\t\ttitle: 'Disconnect Youtube',\n\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t'Yes': function() {\n\t\t\t\t\t\t\t\t\$('#connectedDiv').fadeOut(250);\n\t\t\t\t\t\t\t\t\$('#loadingSpiralDisconnect').show();\n\t\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "plugins/youtube/disconnect.php', { }, function(data) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\$('#connectedDiv').html(data);\n\t\t\t\t\t\t\t\t\t\$('#loadingSpiralDisconnect').hide();\n\t\t\t\t\t\t\t\t\t\$('#connectedDiv').fadeIn(250);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'Cancel': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\t\$('.ui-dialog :button').blur();\n\t\t\t\t\n\t\t\t\t});\n\t\t\t\n\t\t\t});\n\t\t\n\t\t</script>\n\t\t\t\n\t\t";
    if (time() - $ytInfo['lastupdate'] > 1800) {
        echo "\n\t\t\t\t\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\n\t\t\t\t\t\t\$('#loadingSpiral').show();\n\t\t\t\t\t\t\$('#ytInfoCard').fadeOut(250);\n\t\t\t\t\t\n\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "plugins/youtube/reloadcache.php', { yID: '" . $ytInfo['youtube_id'] . "' }, function(data) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tpostResult = JSON.parse(data);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(postResult['result'] == 'success') {\n\t\t\t\t\t\t\t\t\$('#ytInfoCard').html(postResult['html']);\n\t\t\t\t\t\t\t\t\$('#lastUpdateTime').html(postResult['time']);\n\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#ytInfoCard').fadeIn(250);\n\t\t\t\t\t\t\t\$('#loadingSpiral').hide();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar bubbleRight = (\$('.ytBubble').width()*-1)-20;\n\t\t\t\t\t\t\t\$('.ytBubble').css('right', bubbleRight+'px');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t</script>\n\t\t\t\n\t\t\t";
    }
    if ($dispSuccess) {
        echo "\n\t\t\t\t<div id='successDiv' style='display: none'>\n\t\t\t\t\t<p align='center' class='main'>\n\t\t\t\t\t\tYoutube Connect Settings Saved!\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\n\t\t\t\t\t\t\$('#successDiv').dialog({\n\t\t\t\t\t\t\ttitle: 'Twitter Connect',\n\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\t'Ok': function() {\n\t\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('.ui-dialog :button').blur();\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t</script>\n\t\t\t";
    }
}
Beispiel #3
0
 * Bluethrust Clan Scripts v4
 * Copyright 2014
 *
 * Author: Bluethrust Web Development
 * E-mail: support@bluethrust.com
 * Website: http://www.bluethrust.com
 *
 * License: http://www.bluethrust.com/license.php
 *
 */
$prevFolder = "../../";
include "../../_setup.php";
include "youtube.php";
$ytObj = new Youtube($mysqli);
$arrReturn = array();
if (isset($_POST['yID']) && is_numeric($_POST['yID']) && $ytObj->select($_POST['yID'])) {
    $ytInfo = $ytObj->get_info_filtered();
    if (time() - $ytInfo['lastupdate'] > 1800) {
        $ytObj->reloadCache();
        $arrReturn['result'] = "success";
        $arrReturn['html'] = $ytObj->dispSubscribeButton();
        $arrReturn['time'] = getPreciseTime(time());
    } else {
        $arrReturn['result'] = "error";
        $arrReturn['message'] = "Reload Limit Reached";
    }
} else {
    $arrReturn['result'] = "error";
    $arrReturn['message'] = "Invalid yID";
}
echo json_encode($arrReturn);