1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00

Login updates

This commit is contained in:
DanieL 2022-12-29 10:57:01 -03:00
parent cf276977e2
commit 49d1a93ad0
14 changed files with 838 additions and 710 deletions

View file

@ -222,7 +222,7 @@ Options All -Indexes
RewriteRule ^deleteUser$ objects/userDelete.json.php [NC,L]
RewriteRule ^recoverPass$ objects/userRecoverPass.php [NC,L]
RewriteRule ^saveRecoverPassword$ objects/userRecoverPassSave.json.php [NC,L]
RewriteRule ^signUp$ view/signUp.php [NC,L]
RewriteRule ^signUp$ view/userSignUp.php [NC,L]
RewriteRule ^createUser$ objects/userCreate.json.php [NC,L]

View file

@ -9302,7 +9302,7 @@ function getIncludeFileContent($filePath, $varsArray = array()) {
function getIncludeFileContentV1($filePath, $varsArray = array()) {
global $global, $config;
foreach ($varsArray as $key => $value) {
$$key = $value;
eval("\${$key} = \$value;");
}
/*
if(doesPHPVersioHasOBBug()){

View file

@ -1195,6 +1195,7 @@ Click <a href=\"{link}\">here</a> to join our live.";
}
public static function getAllControlls($key, $live_servers_id = 0, $iconsOnly = false, $btnClass = '') {
global $global;
if (!Live::canManageLiveFromLiveKey($key, User::getId())) {
return '';
}
@ -1208,20 +1209,7 @@ Click <a href=\"{link}\">here</a> to join our live.";
$btn .= self::getButton("record_start", $key, $live_servers_id, $iconsOnly, '', $btnClass);
$btn .= self::getButton("record_stop", $key, $live_servers_id, $iconsOnly, '', $btnClass);
$btn .= "</div>";
$btn .= "<script>
$(document).ready(function () {
setInterval(function () {
if (isOnlineLabel || $('.liveOnlineLabel.label-success').length) {
$('body').addClass('isLiveOnline');
$('#liveControls').slideDown();
} else {
$('body').removeClass('isLiveOnline');
$('#liveControls').slideUp();
}
}, 1000);
});
</script>";
$btn .= "<script src=\"{$global['webSiteRootURL']}plugin/Live/view/isOnlineLabel.js\"></script>";
return $btn;
}

View file

@ -0,0 +1,12 @@
$(document).ready(function () {
setInterval(function () {
if (typeof isOnlineLabel !== 'undefined' && (isOnlineLabel || $('.liveOnlineLabel.label-success').length)) {
$('body').addClass('isLiveOnline');
$('#liveControls').slideDown();
} else {
$('body').removeClass('isLiveOnline');
$('#liveControls').slideUp();
}
}, 1000);
});

View file

@ -17,35 +17,33 @@ $key = '';
$live_servers_id = '';
$live_index = '';
$users_id = User::getId();
if (!empty($_REQUEST['key'])) {
$key = $_REQUEST['key'];
$live_servers_id = @$_REQUEST['live_servers_id'];
$live_index = @$_REQUEST['live_index'];
} else if (User::isLogged()) {
$lth = LiveTransmitionHistory::getLatestFromUser($users_id);
$key = $lth['key'];
$live_servers_id = $lth['live_servers_id'];
$live_index = $lth['live_index'];
}
if (!empty($key)) {
$isLive = 1;
setLiveKey($key, $live_servers_id, $live_index);
if (!empty(LiveTransmitionHistory::isLive($key, $live_servers_id))) {
$bodyClass = 'isLiveOnline';
}
if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
$html .= 'loginFromRequest ';
if (User::isLogged()) {
$html .= 'is Logged ';
} else {
$html .= 'is NOT Logged ';
}
if (User::isLogged()) {
if (!empty($_REQUEST['key'])) {
$key = $_REQUEST['key'];
$live_servers_id = @$_REQUEST['live_servers_id'];
$live_index = @$_REQUEST['live_index'];
} else if (User::isLogged()) {
$lth = LiveTransmitionHistory::getLatestFromUser($users_id);
$key = $lth['key'];
$live_servers_id = $lth['live_servers_id'];
$live_index = $lth['live_index'];
}
if (!empty($key)) {
$isLive = 1;
setLiveKey($key, $live_servers_id, $live_index);
if (!empty(LiveTransmitionHistory::isLive($key, $live_servers_id))) {
$bodyClass = 'isLiveOnline';
}
}
} else if (User::isLogged()) {
if (isLive()) {
//var_dump($livet, $getLiveKey, isLive());exit;
if (AVideoPlugin::isEnabledByName('Chat2')) {
@ -98,14 +96,16 @@ if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
//$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/Live/view/menuRight.php');
//var_dump($lt);exit;
}
if (AVideoPlugin::isEnabledByName('SendRecordedToEncoder')) {
$html .= '<!-- SendRecordedToEncoder start -->';
$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/SendRecordedToEncoder/actionButtonLive.php');
$html .= '<!-- SendRecordedToEncoder end -->';
}
}
} else {
$html .= 'nothing to do ';
if (User::isLogged()) {
$html .= 'is Logged ';
} else {
$html .= 'is NOT Logged ';
}
header("Location: {$global['webSiteRootURL']}plugin/MobileManager/loginPage.php");
exit;
}
?>
<!DOCTYPE html>
@ -142,7 +142,7 @@ if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
#recorderToEncoderActionButtons.closed .hideWhenClosed{
display: none !important;
}
#recorderToEncoderActionButtons.closed .showWhenClosed,
#recorderToEncoderActionButtons.closed .showWhenClosed,
.isLiveOnline #closeRecorderButtons{
display: inline-block !important;
}
@ -152,20 +152,11 @@ if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
<body style="background-color: transparent; <?php echo $bodyClass; ?>">
<?php
echo $html;
if (AVideoPlugin::isEnabledByName('SendRecordedToEncoder')) {
echo '<!-- SendRecordedToEncoder start -->';
include $global['systemRootPath'] . 'plugin/SendRecordedToEncoder/actionButtonLive.php';
echo '<!-- SendRecordedToEncoder end -->';
}
?>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
window.addEventListener("flutterInAppWebViewPlatformReady", function (event) {
window.flutter_inappwebview.callHandler('AVideoMobileLiveStreamer', 'Loaded app');
});
function socketLiveONCallback(json) {
console.log('socketLiveONCallback MobileManager', json);
if ((json.users_id == '<?php echo User::getId(); ?>' && json.live_transmitions_history_id) || (!empty(json.key) && json.key == '<?php echo @$_REQUEST['key']; ?>')) {

View file

@ -0,0 +1,84 @@
<?php
global $global, $config;
$global['isIframe'] = 1;
// is online
// recorder
// live users
$global['ignoreUserMustBeLoggedIn'] = 1;
if (!isset($global['systemRootPath'])) {
$configFile = '../../videos/configuration.php';
require_once $configFile;
}
if (!empty($_REQUEST['logoff'])) {
User::logoff();
}
$html = '';
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
User::loginFromRequest();
}
if (User::isLogged()) {
$html .= getIncludeFileContent($global['systemRootPath'] . 'plugin/MobileManager/userButtons.php');
} else {
if (!empty($_REQUEST['SignUp'])) {
$html .= getIncludeFileContent($global['systemRootPath'] . 'view/userSignUpBody.php');
} else {
$redirectUri = "{$global['webSiteRootURL']}plugin/MobileManager/loginPage.php";
if (empty($signUpURL)) {
$signUpURL = addQueryStringParameter($redirectUri, 'SignUp', 1);
}
$html .= getIncludeFileContent($global['systemRootPath'] . 'view/userLogin.php', array('signUpURL' => $signUpURL, '_GET[\'redirectUri\']' => $redirectUri, 'hideRememberMe' => 1));
}
}
?>
<!DOCTYPE html>
<html lang="">
<head>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<style>
#accessibility-toolbar, footer, #socket_info_container{
display: none !important;
}
body {
padding: 0;
}
.liveUsersLabel{
position: fixed;
top: 10px !important;
}
.liveUsersLabel{
left: 20px !important;
}
#recorderToEncoderActionButtons{
position: absolute;
top: 40px;
left: 0;
width: 100%;
}
.showWhenClosed, #closeRecorderButtons{
display: none;
}
#recorderToEncoderActionButtons.closed .recordLiveControlsDiv,
#recorderToEncoderActionButtons.closed .hideWhenClosed{
display: none !important;
}
#recorderToEncoderActionButtons.closed .showWhenClosed,
.isLiveOnline #closeRecorderButtons{
display: inline-block !important;
}
</style>
</head>
<body style="background-color: transparent; <?php echo $bodyClass; ?>">
<?php
echo $html;
?>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html>

View file

@ -0,0 +1,19 @@
<?php
global $global;
?>
<div style=" display: inline-grid;
height: 100vh;
width: 100vw;">
<button class="btn btn-danger btn-lg btn-block h1" onclick="sendAVideoMobileLiveStreamerMessage('goLive', '1');" style="font-size: 32px;">
<i class="fas fa-broadcast-tower"></i> <?php echo __('Go Live'); ?>
</button>
<button class="btn btn-primary btn-lg btn-block h1" onclick="document.location = '<?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/?logoff=1'" style="font-size: 32px;">
<i class="fas fa-sign-out-alt"></i> <?php echo __('Logoff'); ?>
</button>
</div>
<script>
$(function () {
sendAVideoMobileLiveStreamerMessage('loginJS', {site:"<?php echo $global['webSiteRootURL']; ?>", user:"<?php echo User::getUserName(); ?>", pass:"<?php echo User::getUserPass(); ?>"});
//sendAVideoMobileLiveStreamerMessage('saveSessionUser', {site:"<?php echo $global['webSiteRootURL']; ?>", user:"<?php echo User::getUserName(); ?>", pass:"<?php echo User::getUserPass(); ?>"});
});
</script>

View file

@ -44,7 +44,7 @@ try {
if (!height) {
height = $('body').height();
}
parent.postMessage({ height: height }, '*');
parent.postMessage({height: height}, '*');
}
}, false);
@ -71,12 +71,12 @@ if (urlParams.has('debug')) {
}
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
if(typeof String.prototype.replaceAll === "undefined") {
if (typeof String.prototype.replaceAll === "undefined") {
console.log('replaceAll is undefined');
String.prototype.replaceAll = function(match, _replace) {
return this.replace(new RegExp(escapeRegExp(match), 'g'), _replace);
String.prototype.replaceAll = function (match, _replace) {
return this.replace(new RegExp(escapeRegExp(match), 'g'), _replace);
}
}
@ -461,7 +461,7 @@ async function mouseEffect() {
var gif = $(this).find(".thumbsGIF");
var jpg = $(this).find(".thumbsJPG");
try {
gif.lazy({ effect: 'fadeIn' });
gif.lazy({effect: 'fadeIn'});
setTimeout(function () {
gif.height(jpg.height());
gif.width(jpg.width());
@ -568,9 +568,9 @@ async function addViewFromCookie() {
var addView_playerCurrentTime = Cookies.get('addView_playerCurrentTime');
var addView_seconds_watching_video = Cookies.get('addView_seconds_watching_video');
if (!addView_PHPSESSID || addView_PHPSESSID === 'false' ||
!addView_videos_id || addView_videos_id === 'false' ||
!addView_playerCurrentTime || addView_playerCurrentTime === 'false' ||
!addView_seconds_watching_video || addView_seconds_watching_video === 'false') {
!addView_videos_id || addView_videos_id === 'false' ||
!addView_playerCurrentTime || addView_playerCurrentTime === 'false' ||
!addView_seconds_watching_video || addView_seconds_watching_video === 'false') {
return false;
}
//console.log('addViewFromCookie', addView_videos_id, addView_playerCurrentTime, addView_seconds_watching_video);
@ -621,7 +621,7 @@ function getPlayerButtonIndex(name) {
async function copyToClipboard(text) {
$('body').append('<textarea id="elementToCopyAvideo" style="filter: alpha(opacity=0);-moz-opacity: 0;-khtml-opacity: 0; opacity: 0;position: absolute;z-index: -9999;top: 0;left: 0;pointer-events: none;"></textarea>');
$('#elementToCopyAvideo').css({ 'top': mouseY, 'left': 0 }).fadeIn('slow');
$('#elementToCopyAvideo').css({'top': mouseY, 'left': 0}).fadeIn('slow');
$('#elementToCopyAvideo').val(text);
$('#elementToCopyAvideo').focus();
$('#elementToCopyAvideo').select();
@ -870,7 +870,7 @@ async function showMuteTooltip() {
$("#mainVideo .vjs-volume-panel").attr("data-toggle", "tooltip");
$("#mainVideo .vjs-volume-panel").attr("data-placement", "top");
$("#mainVideo .vjs-volume-panel").attr("title", "Click to activate the sound");
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip({ container: '.vjs-control-bar', html: true });
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip({container: '.vjs-control-bar', html: true});
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip('show');
$("#mainVideo .vjs-volume-panel").click(function () {
//console.log("remove unmute tooltip");
@ -1019,9 +1019,9 @@ function formatBytes(bytes, decimals) {
if (bytes == 0)
return '0 Bytes';
var k = 1024,
dm = decimals <= 0 ? 0 : decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
dm = decimals <= 0 ? 0 : decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
@ -1175,31 +1175,31 @@ function isAutoplayEnabled() {
consoleLog("isAutoplayEnabled always autoplay live contents");
return true;
} else
if ($("#autoplay").length) {
autoplay = $("#autoplay").is(":checked");
consoleLog("isAutoplayEnabled #autoplay said " + ((autoplay) ? "Yes" : "No"));
setAutoplay(autoplay);
return autoplay;
} else if (
if ($("#autoplay").length) {
autoplay = $("#autoplay").is(":checked");
consoleLog("isAutoplayEnabled #autoplay said " + ((autoplay) ? "Yes" : "No"));
setAutoplay(autoplay);
return autoplay;
} else if (
typeof Cookies !== 'undefined' &&
typeof Cookies.get('autoplay') !== 'undefined'
) {
if (Cookies.get('autoplay') === 'true' || Cookies.get('autoplay') == true) {
consoleLog("isAutoplayEnabled Cookie said Yes ");
setAutoplay(true);
return true;
} else {
consoleLog("isAutoplayEnabled Cookie said No ");
setAutoplay(false);
return false;
}
) {
if (Cookies.get('autoplay') === 'true' || Cookies.get('autoplay') == true) {
consoleLog("isAutoplayEnabled Cookie said Yes ");
setAutoplay(true);
return true;
} else {
if (typeof autoplay !== 'undefined') {
consoleLog("isAutoplayEnabled autoplay said " + ((autoplay) ? "Yes" : "No"));
setAutoplay(autoplay);
return autoplay;
}
consoleLog("isAutoplayEnabled Cookie said No ");
setAutoplay(false);
return false;
}
} else {
if (typeof autoplay !== 'undefined') {
consoleLog("isAutoplayEnabled autoplay said " + ((autoplay) ? "Yes" : "No"));
setAutoplay(autoplay);
return autoplay;
}
}
setAutoplay(false);
consoleLog("isAutoplayEnabled Default is No ");
return false;
@ -1318,7 +1318,7 @@ function avideoAlertOnceForceConfirm(title, msg, type) {
}
function _avideoToast(msg, icon) {
var options = { text: msg, hideAfter: 7000 };
var options = {text: msg, hideAfter: 7000};
if (icon) {
options.icon = icon;
}
@ -1512,7 +1512,7 @@ function avideoWindowIframe(url) {
html += '</div>';
html += '</div>';
$('body').append(html);
$("#draggable").draggable({ handle: ".panel-heading", containment: "parent" });
$("#draggable").draggable({handle: ".panel-heading", containment: "parent"});
//$( "div, p" ).disableSelection();
$("#draggable").resizable();
}
@ -1740,7 +1740,7 @@ function avideoTooltip(selector, text) {
$(selector).attr('title', text);
$(selector).attr('data-toggle', 'tooltip');
$(selector).attr('data-original-title', text);
$(selector).tooltip({ html: true });
$(selector).tooltip({html: true});
}
function fixAdSize() {
@ -1748,8 +1748,8 @@ function fixAdSize() {
if (ad_container.length) {
height = ad_container.css('height');
width = ad_container.css('width');
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'height': height });
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'width': width });
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'height': height});
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'width': width});
}
}
@ -1871,11 +1871,11 @@ function clearCache(showPleaseWait, FirstPage, sessionOnly) {
function validURL(str) {
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+:]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+:]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
return !!pattern.test(str);
}
@ -2129,11 +2129,11 @@ function removeDuplicatedGetParam(_url) {
return _url;
}
var params = queryParam.split('&'),
results = {};
results = {};
for (var i = 0; i < params.length; i++) {
var temp = params[i].split('='),
key = temp[0],
val = temp[1];
key = temp[0],
val = temp[1];
results[key] = val;
}
@ -2151,11 +2151,11 @@ function removeGetParam(_url, parameter) {
return _url;
}
var params = queryParam.split('&'),
results = {};
results = {};
for (var i = 0; i < params.length; i++) {
var temp = params[i].split('='),
key = temp[0],
val = temp[1];
key = temp[0],
val = temp[1];
if (key !== parameter) {
results[key] = val;
}
@ -2193,7 +2193,7 @@ function readFileCroppie(input, crop) {
function getCroppie(uploadCropObject, callback, width, height) {
//console.log('getCroppie 1', uploadCropObject);
var ret = uploadCropObject.croppie('result', { type: 'base64', size: { width: width, height: height }, format: 'png' }).then(function (resp) {
var ret = uploadCropObject.croppie('result', {type: 'base64', size: {width: width, height: height}, format: 'png'}).then(function (resp) {
////console.log('getCroppie 2 ' + callback, resp);
eval(callback + "(resp);");
}).catch(function (err) {
@ -2209,7 +2209,7 @@ async function setToolTips() {
return false;
}
try {
$(selector).not('.alreadyTooltip').tooltip({ container: 'body', html: true });
$(selector).not('.alreadyTooltip').tooltip({container: 'body', html: true});
$(selector).not('.alreadyTooltip').on('click', function () {
var t = this;
setTimeout(function () {
@ -2241,17 +2241,17 @@ function avideoSocketIsActive() {
function isMediaSiteURL(url) {
if (validURL(url)) {
if (url.match(/youtube/i) ||
url.match(/youtu\.be/i) ||
url.match(/vimeo/i) ||
url.match(/dailymotion/i) ||
url.match(/metacafe/i) ||
url.match(/vid\.me/i) ||
url.match(/rutube\.ru/i) ||
url.match(/ok\.ru/i) ||
url.match(/streamable/i) ||
url.match(/twitch/i) ||
url.match(/evideoEmbed/i) ||
url.match(/videoEmbeded/i)) {
url.match(/youtu\.be/i) ||
url.match(/vimeo/i) ||
url.match(/dailymotion/i) ||
url.match(/metacafe/i) ||
url.match(/vid\.me/i) ||
url.match(/rutube\.ru/i) ||
url.match(/ok\.ru/i) ||
url.match(/streamable/i) ||
url.match(/twitch/i) ||
url.match(/evideoEmbed/i) ||
url.match(/videoEmbeded/i)) {
return true;
}
}
@ -2268,7 +2268,7 @@ function changeVideoStatus(videos_id, status) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/videoStatus.json.php',
data: { "id": [videos_id], "status": status },
data: {"id": [videos_id], "status": status},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
@ -2372,65 +2372,65 @@ function downloadURL(url, filename) {
var loaded = 0;
var contentLength = 0;
fetch(url)
.then(response => {
avideoToastSuccess('Download Start');
const contentEncoding = response.headers.get('content-encoding');
const contentLength = response.headers.get(contentEncoding ? 'x-file-size' : 'content-length');
if (contentLength === null) {
throw Error('Response size header unavailable');
}
.then(response => {
avideoToastSuccess('Download Start');
const contentEncoding = response.headers.get('content-encoding');
const contentLength = response.headers.get(contentEncoding ? 'x-file-size' : 'content-length');
if (contentLength === null) {
throw Error('Response size header unavailable');
}
const total = parseInt(contentLength, 10);
let loaded = 0;
return new Response(
new ReadableStream({
start(controller) {
const reader = response.body.getReader();
read();
function read() {
reader.read().then(({ done, value }) => {
if (done) {
controller.close();
return;
}
loaded += value.byteLength;
var percentageLoaded = Math.round(loaded / total * 100);
////console.log(percentageLoaded);
modal.setProgress(percentageLoaded);
modal.setText('Downloading ... ' + percentageLoaded + '%');
controller.enqueue(value);
const total = parseInt(contentLength, 10);
let loaded = 0;
return new Response(
new ReadableStream({
start(controller) {
const reader = response.body.getReader();
read();
}).catch(error => {
console.error(error);
controller.error(error)
})
}
}
})
);
})
.then(response => response.blob())
.then(blob => {
const urlFromBlob = window.URL.createObjectURL(blob);
console.log('downloadURL', url, filename, blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = urlFromBlob;
// the filename you want
a.download = filename;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
modal.hidePleaseWait();
avideoToastSuccess('Download complete ' + filename);
})
.catch(function (err) {
//avideoAlertError('Error on download ');
console.log(err);
addQueryStringParameter(url, 'download', 1);
addQueryStringParameter(url, 'title', filename);
document.location = url;
});
function read() {
reader.read().then(({ done, value }) => {
if (done) {
controller.close();
return;
}
loaded += value.byteLength;
var percentageLoaded = Math.round(loaded / total * 100);
////console.log(percentageLoaded);
modal.setProgress(percentageLoaded);
modal.setText('Downloading ... ' + percentageLoaded + '%');
controller.enqueue(value);
read();
}).catch(error => {
console.error(error);
controller.error(error)
})
}
}
})
);
})
.then(response => response.blob())
.then(blob => {
const urlFromBlob = window.URL.createObjectURL(blob);
console.log('downloadURL', url, filename, blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = urlFromBlob;
// the filename you want
a.download = filename;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
modal.hidePleaseWait();
avideoToastSuccess('Download complete ' + filename);
})
.catch(function (err) {
//avideoAlertError('Error on download ');
console.log(err);
addQueryStringParameter(url, 'download', 1);
addQueryStringParameter(url, 'title', filename);
document.location = url;
});
}
var downloadURLOrAlertErrorInterval;
@ -2457,9 +2457,9 @@ function downloadURLOrAlertError(jsonURL, data, filename, FFMpegProgress) {
avideoAlertInfo(response.msg);
}
if (
isMobile()
//|| /cdn.ypt.me/.test(response.url)
) {
isMobile()
//|| /cdn.ypt.me/.test(response.url)
) {
window.open(response.url, '_blank');
avideoToastInfo('Opening file');
//document.location = response.url
@ -2646,7 +2646,7 @@ function getCursorPos(input) {
len++;
}
rng.setEndPoint("StartToStart", input.createTextRange());
for (var pos = { start: 0, end: len }; rng.compareEndPoints("EndToStart", rng) > 0; rng.moveEnd("character", -1)) {
for (var pos = {start: 0, end: len}; rng.compareEndPoints("EndToStart", rng) > 0; rng.moveEnd("character", -1)) {
pos.start++;
pos.end++;
}
@ -2693,10 +2693,10 @@ function addAtMention(selector) {
$(selector).on("keydown", function (event) {
if (!$(this).autocomplete("instance").menu.active) {
if (
event.keyCode === SpaceKeyCode ||
event.keyCode === $.ui.keyCode.TAB ||
event.keyCode === $.ui.keyCode.ENTER ||
event.keyCode === $.ui.keyCode.ESCAPE) {
event.keyCode === SpaceKeyCode ||
event.keyCode === $.ui.keyCode.TAB ||
event.keyCode === $.ui.keyCode.ENTER ||
event.keyCode === $.ui.keyCode.ESCAPE) {
$(this).autocomplete("close");
}
} else {
@ -2705,77 +2705,77 @@ function addAtMention(selector) {
}
}
})
.autocomplete({
minLength: 2,
source: function (request, response) {
.autocomplete({
minLength: 2,
source: function (request, response) {
var pos = getCursorPos($(selector)[0]);
stringStart = request.term.substring(0, pos.end);
var pos = getCursorPos($(selector)[0]);
stringStart = request.term.substring(0, pos.end);
var term = stringStart.split(/\s+/).pop();
//console.log('autocomplete', request.term, term, AtMatcher.test(term));
if (AtMatcher.test(term)) {
$.ajax({
url: webSiteRootURL + "objects/mention.json.php",
data: {
term: term
},
success: function (data) {
response(data);
}
});
} else {
var term = stringStart.split(/\s+/).pop();
//console.log('autocomplete', request.term, term, AtMatcher.test(term));
if (AtMatcher.test(term)) {
$.ajax({
url: webSiteRootURL + "objects/mention.json.php",
data: {
term: term
},
success: function (data) {
response(data);
}
});
} else {
return false;
}
},
focus: function () {
// prevent value inserted on focus
return false;
}
},
focus: function () {
// prevent value inserted on focus
return false;
},
select: function (event, ui) {
addAtMentionActive = true;
setTimeout(function () {
addAtMentionActive = false;
}, 200);
if (emojioneArea) {
this.value = $(emojioneArea).data("emojioneArea").getText();
}
//console.log('addAtMention', this, this.value);
var pos = getCursorPos($(selector)[0]);
stringStart = this.value.substring(0, pos.end);
stringEnd = this.value.substring(pos.end);
var terms = stringStart.split(/\s+/);
// remove the current input
var word = terms.pop();
// add the selected item
//terms.push('@' + ui.item.value);
// add placeholder to get the comma-and-space at the end
//terms.push("");
replace = '@' + ui.item.value;
this.value = replaceLast(word, '@' + ui.item.value, stringStart) + stringEnd;
if (emojioneArea) {
$(emojioneArea).data("emojioneArea").setText(this.value);
},
select: function (event, ui) {
addAtMentionActive = true;
setTimeout(function () {
contentEditableElement = document.getElementsByClassName("emojionearea-editor")[0];
range = document.createRange();//Create a range (a range is a like the selection but invisible)
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
selection = window.getSelection();//get the selection object (allows you to change selection)
selection.removeAllRanges();//remove any selections already made
selection.addRange(range);//make the range you have just created the visible selection
}, 50);
}
return false;
},
create: function () {
$(this).data('ui-autocomplete')._renderItem = function (ul, item) {
return $('<li>' + item.label + '</li>').appendTo(ul); // customize your HTML
};
},
position: { collision: "flip" }
});
addAtMentionActive = false;
}, 200);
if (emojioneArea) {
this.value = $(emojioneArea).data("emojioneArea").getText();
}
//console.log('addAtMention', this, this.value);
var pos = getCursorPos($(selector)[0]);
stringStart = this.value.substring(0, pos.end);
stringEnd = this.value.substring(pos.end);
var terms = stringStart.split(/\s+/);
// remove the current input
var word = terms.pop();
// add the selected item
//terms.push('@' + ui.item.value);
// add placeholder to get the comma-and-space at the end
//terms.push("");
replace = '@' + ui.item.value;
this.value = replaceLast(word, '@' + ui.item.value, stringStart) + stringEnd;
if (emojioneArea) {
$(emojioneArea).data("emojioneArea").setText(this.value);
setTimeout(function () {
contentEditableElement = document.getElementsByClassName("emojionearea-editor")[0];
range = document.createRange();//Create a range (a range is a like the selection but invisible)
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
selection = window.getSelection();//get the selection object (allows you to change selection)
selection.removeAllRanges();//remove any selections already made
selection.addRange(range);//make the range you have just created the visible selection
}, 50);
}
return false;
},
create: function () {
$(this).data('ui-autocomplete')._renderItem = function (ul, item) {
return $('<li>' + item.label + '</li>').appendTo(ul); // customize your HTML
};
},
position: {collision: "flip"}
});
}
/*
async function selectAElements() {
@ -3036,8 +3036,8 @@ function fixAdSize() {
if (ad_container.length) {
height = ad_container.css('height');
width = ad_container.css('width');
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'height': height });
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'width': width });
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'height': height});
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'width': width});
}
}
@ -3322,7 +3322,7 @@ function passStrengthCheck(selector) {
} else {
strengthMsg.push('Special chars');
}
return { strength: strength, strengthMsg: strengthMsg };
return {strength: strength, strengthMsg: strengthMsg};
}
function passStrengthCheckInput(selector) {
@ -3467,7 +3467,7 @@ async function setVideoSuggested(videos_id, isSuggested) {
return new Promise((resolve, reject) => {
$.ajax({
url: webSiteRootURL + 'objects/videoSuggest.php',
data: { "id": videos_id, "isSuggested": isSuggested },
data: {"id": videos_id, "isSuggested": isSuggested},
type: 'post',
success: function (data) {
modal.hidePleaseWait();
@ -3686,16 +3686,36 @@ function addScript(src) {
function avideoLogoff(redirect) {
sendAVideoMobileLiveStreamerMessage('logoff', '');
if(redirect){
if (redirect) {
document.location = webSiteRootURL + 'logoff';
}
}
function sendAVideoMobileLiveStreamerMessage(type, value) {
if (typeof window.AVideoMobileLiveStreamer !== 'undefined') {
window.AVideoMobileLiveStreamer.postMessage({ type: type, value: value });
async function sendAVideoMobileLiveStreamerMessage(type, value){
if (typeof window.flutter_inappwebview !== 'undefined') {
if (typeof window.flutter_inappwebview.callHandler == 'function') {
for (i = 0; i < 10; i++) {
response = await window.flutter_inappwebview.callHandler('AVideoMobileLiveStreamer' + i, {type: type, value: value, instanceIndex: i});
if(response!==null){
console.log('sendAVideoMobileLiveStreamerMessage executed', i, response, type, value);
break;
}else{
console.log('sendAVideoMobileLiveStreamerMessage not found', i, type, value);
}
}
} else {
console.log('sendAVideoMobileLiveStreamerMessage will try again', type, value);
setTimeout(function () {
sendAVideoMobileLiveStreamerMessage(type, value);
}, 1000);
}
} else {
console.log('sendAVideoMobileLiveStreamerMessage error', type, value);
}
}
window.addEventListener("flutterInAppWebViewPlatformReady", function (event) {
sendAVideoMobileLiveStreamerMessage('APPIsReady', 1);
});
function getUser() {
var url = webSiteRootURL + 'plugin/API/get.json.php?APIName=user';

View file

@ -1,355 +0,0 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
if (User::isLogged()) {
header("Location: {$global['webSiteRootURL']}user");
exit;
}
//$json_file = url_get_contents("{$global['webSiteRootURL']}plugin/CustomizeAdvanced/advancedCustom.json.php");
// convert the string to a json object
//$advancedCustom = _json_decode($json_file);
if (!empty($advancedCustomUser->disableNativeSignUp)) {
die(__("Sign Up Disabled"));
}
$agreement = AVideoPlugin::loadPluginIfEnabled("SignUpAgreement");
$redirectUri = getRedirectUri($global['webSiteRootURL']);
$siteRedirectUri = "{$global['webSiteRootURL']}user";
$siteRedirectUri = addQueryStringParameter($siteRedirectUri, 'redirectUri', $redirectUri);
if (isValidURL(@$_GET['siteRedirectUri'])) {
$siteRedirectUri = $_GET['siteRedirectUri'];
}
if(!empty($advancedCustomUser->afterSignUpGoToURL) && isValidURL($advancedCustomUser->afterSignUpGoToURL)){
$loginURL = "{$global['webSiteRootURL']}user";
$loginURL = addQueryStringParameter($loginURL, 'redirectUri', $advancedCustomUser->afterSignUpGoToURL);
$loginURL = addQueryStringParameter($loginURL, 'comebackhere', 1);
$siteRedirectUri = $loginURL;
}
$siteRedirectUri = addQueryStringParameter($siteRedirectUri, 'success', _($advancedCustomUser->signupWelcomeAlert));
?>
<!DOCTYPE html>
<html lang="<?php echo getLanguage(); ?>">
<head>
<title><?php echo __("Sign Up") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
CustomizeUser::autoIncludeBGAnimationFile();
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container">
<br>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-2"></div>
<div class="col-xs-12 col-sm-12 col-lg-8">
<div class="panel panel-default <?php
echo getCSSAnimationClassAndStyle();
getCSSAnimationClassAndStyleAddWait(0.5);
?>">
<div class="panel-heading tabbable-line">
<ul class="nav nav-tabs" id="signupNavTabs">
<li class="nav-item active" id="sinupBasic">
<a class="nav-link " href="#" data-toggle="tab" onclick="showCompanyFields(false)">
<i class="fas fa-user"></i>
<?php echo __("Sign Up"); ?>
</a>
</li>
<?php
if (empty($advancedCustomUser->disableCompanySignUp)) {
?>
<li class="nav-item" id="sinupCompany">
<a class="nav-link " href="#" data-toggle="tab" onclick="showCompanyFields(true)">
<i class="fas fa-building"></i>
<?php echo __("Company Sign Up"); ?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content" id="signupTabContent">
<div class="tab-pane active" id="signupRegular" >
<form id="updateUserForm" onsubmit="">
<div class="form-group">
<div class="col-md-12 inputGroupContainer">
<div class="input-group">
<?php
if (!empty($advancedCustomUser->messageToAppearAboveSignUpBox->value)) {
echo $advancedCustomUser->messageToAppearAboveSignUpBox->value;
}
?>
</div>
</div>
</div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputName"><?php echo __("Name"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<input id="inputName" placeholder="<?php echo __("Name"); ?>" name="name" class="form-control" type="text" value="" required >
</div>
</div>
</div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputUser"><?php echo!empty($advancedCustomUser->forceLoginToBeTheEmail) ? __("E-mail") : __("User"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="inputUser" placeholder="<?php echo!empty($advancedCustomUser->forceLoginToBeTheEmail) ? "me@example.com" : __("User"); ?>" class="form-control" type="<?php echo empty($advancedCustomUser->forceLoginToBeTheEmail) ? "text" : "email"; ?>" value="" name="user" required >
</div>
</div>
</div>
<?php
if (empty($advancedCustomUser->forceLoginToBeTheEmail)) {
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputEmail"><?php echo __("E-mail"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input id="inputEmail" placeholder="<?php echo __("E-mail"); ?>" name="email" class="form-control" type="email" value="" required >
</div>
</div>
</div>
<?php }
?>
<?php
if (empty($advancedCustomUser->doNotShowPhoneOnSignup)) {
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="phone"><?php echo __("Phone"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="fas fa-phone"></i></span>
<input id="phone" placeholder="<?php echo __("Phone"); ?>" name="phone" class="form-control" type="text" value="" >
</div>
</div>
</div>
<?php }
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputPassword"><?php echo __("New Password"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<?php
getInputPassword("inputPassword", 'class="form-control" autocomplete="off" ', __("New Password"));
?>
</div>
</div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputPasswordConfirm"><?php echo __("Confirm New Password"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<?php
getInputPassword("inputPasswordConfirm", 'class="form-control" autocomplete="off" ', __("Confirm New Password"));
?>
</div>
</div>
<div class="clearfix"></div>
<?php
if (empty($advancedCustomUser->disableCompanySignUp)) {
$extra_info_fields = Users_extra_info::getAllActive(0, true);
echo '<!-- Show CompanySignUp -->';
echo '<input id="is_company" name="is_company" type="hidden" value="0" >';
} else {
$extra_info_fields = Users_extra_info::getAllActive();
echo '<!-- DO NOT Show CompanySignUp -->';
}
//var_dump($extra_info_fields);
foreach ($extra_info_fields as $value) {
if (Users_extra_info::isCompanyOnlyField($value['status'])) {
$class = 'companyField';
$style = 'display: none;';
?>
<div class="row form-group <?php echo $class; ?>" style="<?php echo $style; ?>">
<?php echo Users_extra_info::typeToHTML($value, 'col-sm-4 control-label hidden-xs', 'col-sm-8 inputGroupContainer'); ?>
</div>
<?php
} else {
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>" >
<?php echo Users_extra_info::typeToHTML($value, 'col-sm-4 control-label hidden-xs', 'col-sm-8 inputGroupContainer'); ?>
</div>
<?php
}
?>
<div class="clearfix"></div>
<?php
}
?>
<div class="clearfix"></div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<?php
if (!empty($agreement)) {
$agreement->getSignupCheckBox();
}
?>
</div>
<div class="clearfix"></div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="captchaText"><?php echo __("Type the code"); ?></label>
<div class="col-sm-8 inputGroupContainer captcha">
<?php
$capcha = getCaptcha();
echo $capcha['content'];
?>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="panel-footer">
<button class="btn btn-primary btn-block btn-lg <?php echo getCSSAnimationClassAndStyle(); ?>" onclick="$('#updateUserForm').submit();" ><i class="fas fa-user-plus"></i> <?php echo __("Sign Up"); ?></button>
<?php
if (!empty($redirectUri)) {
?>
<a href="<?php echo $redirectUri; ?>" class="btn btn-default btn-block btn-xs <?php echo getCSSAnimationClassAndStyle(); ?>" ><i class="fas fa-times"></i> <?php echo __("Cancel"); ?></a>
<?php
}
?>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-2"></div>
</div>
<script>
function showCompanyFields(show) {
$('#signupNavTabs .nav-item').removeClass('active');
if (show) {
$('#sinupCompany').addClass('active');
$('.companyField').slideDown();
$('#is_company').val(<?php echo User::$is_company_status_WAITINGAPPROVAL; ?>);
} else {
$('#sinupBasic').addClass('active');
$('.companyField').slideUp();
$('#is_company').val(0);
}
}
function validateSignupForm() {
var errorFound = false;
var errorClass = 'has-error';
$('#updateUserForm .input-group').removeClass(errorClass);
$('#updateUserForm input').each(function () {
console.log('found', $(this).attr('name'));
if ($(this).prop('required') && $(this).is(":visible")) {
if ($(this).attr('type') === 'checkbox') {
if (!$(this).is(':checked')) {
$(this).closest('.input-group').addClass(errorClass);
errorFound = 'Confirmation Required';
return false;
}
} else {
console.log('is required', $(this).attr('name'));
if (empty($(this).val())) {
$(this).closest('.input-group').addClass(errorClass);
var label = $("label[for='" + $(this).attr('id') + "']").text();
if (!label) {
label = $(this).attr('name');
}
errorFound = label + ' is required';
return false;
}
}
}
});
console.log(errorFound);
if (errorFound) {
avideoAlertError(errorFound);
return false;
}
// Password doesn't match
if (!$('#inputPassword').val().match(/[0-9a-z]+/i)) {
$('#inputPassword').closest('.input-group').addClass(errorClass);
avideoAlertError("<?php echo __("Your password cannot be blank"); ?>");
return false;
}
if(!checkIfPasswordsMatch()){
avideoAlertError("<?php echo __("Your password does not match!"); ?>");
return false;
}
if ($('#inputEmail').is(":visible") && !isEmailValid($('#inputEmail').val())) {
if (!isEmailValid($('#inputUser').val())) {
$('#inputEmail').closest('.input-group').addClass(errorClass);
avideoAlertError("<?php echo __("You must specify a valid email"); ?>");
return false;
}
}
if (!$('#inputUser').val().match(/^[0-9a-z@._-]{3,}$/i) && !isEmailValid($('#inputUser').val()) ) {
$('#inputUser').closest('.input-group').addClass(errorClass);
avideoAlertError("<?php echo __("Invalid user"); ?>");
return false;
}
return true;
}
function checkIfPasswordsMatch(){
var errorClass = 'has-error';
var inputPasswordConfirm = $('#inputPasswordConfirm').val();
var inputPassword = $('#inputPassword').val();
$('#inputPassword').closest('.input-group').removeClass(errorClass);
$('#inputPasswordConfirm').closest('.input-group').removeClass(errorClass);
if(inputPasswordConfirm !== inputPassword){
$('#inputPassword').closest('.input-group').addClass(errorClass);
$('#inputPasswordConfirm').closest('.input-group').addClass(errorClass);
return false;
}
return true;
}
$(document).ready(function () {
$('#inputPasswordConfirm').keyup(function () {
checkIfPasswordsMatch();
});
passStrengthCheckInputKeyUp('#inputPassword');
$('#updateUserForm').submit(function (evt) {
evt.preventDefault();
if (validateSignupForm()) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/userCreate.json.php?PHPSESSID=<?php echo session_id(); ?>',
data: $('#updateUserForm').serialize(),
type: 'post',
success: function (response) {
avideoResponse(response);
if (!response.error) {
window.location.href = '<?php echo $siteRedirectUri; ?>';
} else {
modal.hidePleaseWait();
}
}
});
return false;
}
});
});
</script>
</div><!--/.container-->
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html>

View file

@ -8,11 +8,6 @@ require_once $global['systemRootPath'] . 'objects/user.php';
if (User::isLogged()) {
redirectIfRedirectUriIsSet();
}
$tags = User::getTags(User::getId());
$tagsStr = '';
foreach ($tags as $value) {
$tagsStr .= "<span class=\"label label-{$value->type} fix-width\">{$value->text}</span>";
}
//$json_file = url_get_contents("{$global['webSiteRootURL']}plugin/CustomizeAdvanced/advancedCustom.json.php");
// convert the string to a json object
//$advancedCustom = _json_decode($json_file);
@ -35,74 +30,11 @@ foreach ($tags as $value) {
<?php include $global['systemRootPath'] . 'view/include/navbar.php'; ?>
<div class="container-fluid">
<?php
if (User::isLogged()) {
$user = new User("");
$user->loadSelfUser();
if (!empty($_REQUEST['basicInfoOnly'])) {
include $global['systemRootPath'] . './view/userBasicInfo.php';
} else {
?>
<div class="row">
<div>
<div class="panel panel-default" id="userTabsPanel">
<div class="panel-heading tabbable-line">
<div class="pull-right">
<?php echo $tagsStr; ?>
</div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#basicInfo" id="aBasicInfo"><?php echo __("Basic Info") ?></a></li>
<?php if (empty($advancedCustomUser->disablePersonalInfo)) { ?>
<li><a data-toggle="tab" href="#personalInfo" id="aPersonalInfo"><?php echo __("Personal Info") ?></a></li>
<?php } ?>
<?php echo AVideoPlugin::profileTabName($user->getId()); ?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div id="basicInfo" class="tab-pane fade in active" style="padding: 10px 0;">
<?php include $global['systemRootPath'] . './view/userBasicInfo.php'; ?>
</div>
<?php if (empty($advancedCustomUser->disablePersonalInfo)) { ?>
<div id="personalInfo" class="tab-pane fade" style="padding: 10px 0;">
<?php
include $global['systemRootPath'] . './view/userPersonalInfo.php';
?>
</div>
<?php } ?>
<?php echo AVideoPlugin::profileTabContent($user->getId()); ?>
</div>
</div>
</div>
</div>
</div>
<?php
}
} else {
include $global['systemRootPath'] . './view/userLogin.php';
}
?>
<?php include $global['systemRootPath'] . 'view/userLogin.php'; ?>
</div><!--/.container-->
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
$(document).ready(function () {
<?php
if (!empty($_REQUEST['tab'])) {
$tab = preg_replace('/[^a-z0-9_-]/i', '', $_REQUEST['tab']);
?>
$('#userTabsPanel a[href="#<?php echo $tab; ?>"]').trigger('click');
<?php
}
?>
});
</script>
</body>
</html>

72
view/userBody.php Normal file
View file

@ -0,0 +1,72 @@
<?php
if (User::isLogged()) {
$tags = User::getTags(User::getId());
$tagsStr = '';
foreach ($tags as $value) {
$tagsStr .= "<span class=\"label label-{$value->type} fix-width\">{$value->text}</span>";
}
$user = new User("");
$user->loadSelfUser();
if (!empty($_REQUEST['basicInfoOnly'])) {
include $global['systemRootPath'] . './view/userBasicInfo.php';
} else {
?>
<div class="row">
<div>
<div class="panel panel-default" id="userTabsPanel">
<div class="panel-heading tabbable-line">
<div class="pull-right hidden-md hidden-sm hidden-xs">
<?php echo $tagsStr; ?>
</div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#basicInfo" id="aBasicInfo"><?php echo __("Basic Info") ?></a></li>
<?php if (empty($advancedCustomUser->disablePersonalInfo)) { ?>
<li><a data-toggle="tab" href="#personalInfo" id="aPersonalInfo"><?php echo __("Personal Info") ?></a></li>
<?php } ?>
<?php echo AVideoPlugin::profileTabName($user->getId()); ?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div id="basicInfo" class="tab-pane fade in active" style="padding: 10px 0;">
<?php include $global['systemRootPath'] . './view/userBasicInfo.php'; ?>
</div>
<?php if (empty($advancedCustomUser->disablePersonalInfo)) { ?>
<div id="personalInfo" class="tab-pane fade" style="padding: 10px 0;">
<?php
include $global['systemRootPath'] . './view/userPersonalInfo.php';
?>
</div>
<?php } ?>
<?php echo AVideoPlugin::profileTabContent($user->getId()); ?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<script>
$(document).ready(function () {
<?php
if (!empty($_REQUEST['tab'])) {
$tab = preg_replace('/[^a-z0-9_-]/i', '', $_REQUEST['tab']);
?>
$('#userTabsPanel a[href="#<?php echo $tab; ?>"]').trigger('click');
<?php
}
?>
});
</script>
<?php
} else {
include $global['systemRootPath'] . './view/userLogin.php';
}
?>

View file

@ -1,15 +1,5 @@
<?php
CustomizeUser::autoIncludeBGAnimationFile();
?>
<br>
<style>
.loginPage{
}
</style>
<?php
if (empty($_COOKIE) && empty($_GET['cookieLogin'])) {
// TODO implement a popup login for cross domain cookie block
}
if (empty($_GET['redirectUri'])) {
if (!empty($_SERVER["HTTP_REFERER"])) {
// if comes from the streamer domain
@ -18,6 +8,15 @@ if (empty($_GET['redirectUri'])) {
}
}
}
if (empty($signUpURL)) {
$signUpURL = "{$global['webSiteRootURL']}signUp";
if (isValidURL($_GET['redirectUri'])) {
$signUpURL = addQueryStringParameter($signUpURL, 'redirectUri', $_GET['redirectUri']);
}
}
?>
<br>
<?php
if (empty($_COOKIE) && get_browser_name() !== 'Other (Unknown)') {
?>
<div style="padding: 10px;">
@ -65,6 +64,7 @@ if (empty($_COOKIE) && get_browser_name() !== 'Other (Unknown)') {
?>">
<div class="panel-heading">
<?php
//var_dump($_GET['redirectUri'], getRedirectUri());
if (emptyHTML($advancedCustomUser->messageReplaceWelcomeBackLoginBox->value)) {
?>
<h2 class="<?php echo getCSSAnimationClassAndStyle(); ?>">
@ -84,7 +84,7 @@ if (empty($_COOKIE) && get_browser_name() !== 'Other (Unknown)') {
?>
</div>
<?php
}else{
} else {
echo $advancedCustomUser->messageReplaceWelcomeBackLoginBox->value;
}
?>
@ -114,17 +114,23 @@ if (empty($_COOKIE) && get_browser_name() !== 'Other (Unknown)') {
<div class="form-group captcha" style="<?php echo User::isCaptchaNeed() ? "" : "display: none;" ?>" id="captchaForm">
<?php echo $captcha['content']; ?>
</div>
<div class="form-group <?php echo getCSSAnimationClassAndStyle(); ?>" >
<div class="col-xs-4 text-right">
<label for="inputRememberMe" ><?php echo __("Remember me"); ?></label>
</div>
<div class="col-xs-8" >
<div class="material-switch" data-toggle="tooltip" title="<?php echo __("Check this to stay signed in"); ?>">
<input id="inputRememberMe" class="form-control" type="checkbox">
<label for="inputRememberMe" class="label-success" ></label>
<?php
if (empty($hideRememberMe)) {
?>
<div class="form-group <?php echo getCSSAnimationClassAndStyle(); ?>" >
<div class="col-xs-4 text-right">
<label for="inputRememberMe" ><?php echo __("Remember me"); ?></label>
</div>
<div class="col-xs-8" >
<div class="material-switch" data-toggle="tooltip" title="<?php echo __("Check this to stay signed in"); ?>">
<input id="inputRememberMe" class="form-control" type="checkbox">
<label for="inputRememberMe" class="label-success" ></label>
</div>
</div>
</div>
</div>
<?php
}
?>
<!-- Button -->
<div class="form-group <?php echo getCSSAnimationClassAndStyle(); ?>" >
<div class="col-md-12">
@ -145,7 +151,7 @@ if (empty($_COOKIE) && get_browser_name() !== 'Other (Unknown)') {
?>
<div class="row <?php echo getCSSAnimationClassAndStyle(); ?>" data-toggle="tooltip" title="<?php echo __("Are you new here?"); ?>">
<div class="col-md-12">
<a href="<?php echo $global['webSiteRootURL']; ?>signUp?redirectUri=<?php print $_GET['redirectUri'] ?? ""; ?>"
<a href="<?php echo $signUpURL; ?>"
class="btn btn-primary btn-block"><i class="fas fa-plus"></i> <?php echo __("Sign up"); ?></a>
</div>
</div>
@ -167,8 +173,6 @@ if (empty($_COOKIE) && get_browser_name() !== 'Other (Unknown)') {
<?php
}
?>
<?php
$login = AVideoPlugin::getLogin();
$totalLogins = 0;
@ -292,10 +296,10 @@ if (!empty($advancedCustomUser->forceLoginToBeTheEmail)) {
modal.showPleaseWait();
loginFormActive();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/login.json.php',
url: webSiteRootURL+'objects/login.json.php',
data: {"user": $('#inputUser').val(), "pass": $('#inputPassword').val(), "rememberme": $('#inputRememberMe').is(":checked"), "captcha": <?php echo $captcha['captchaText']; ?>, "redirectUri": "<?php print $_GET['redirectUri'] ?? ""; ?>"},
type: 'post',
success: function (response) {
success: async function (response) {
if (!response.isLogged) {
modal.hidePleaseWait();
if (response.error) {
@ -314,6 +318,7 @@ if (!empty($advancedCustomUser->forceLoginToBeTheEmail)) {
url = addGetParam(url, 'PHPSESSID', response.PHPSESSID);
}
console.log('Login success', url);
await sendAVideoMobileLiveStreamerMessage('saveSessionUser', {site:webSiteRootURL, user:$('#inputUser').val(), pass:$('#inputPassword').val()});
document.location = url;
}
}
@ -323,7 +328,7 @@ if (!empty($advancedCustomUser->forceLoginToBeTheEmail)) {
_forgotPass();
});
});
<?php $captcha2 = User::getCaptchaForm(); ?>
<?php $captcha2 = User::getCaptchaForm(); ?>
function _forgotPass() {
var user = $('#inputUser').val();
if (!user) {

45
view/userSignUp.php Normal file
View file

@ -0,0 +1,45 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
if (User::isLogged()) {
header("Location: {$global['webSiteRootURL']}user");
exit;
}
?>
<!DOCTYPE html>
<html lang="<?php echo getLanguage(); ?>">
<head>
<title><?php echo __("Sign Up") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?></title>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
CustomizeUser::autoIncludeBGAnimationFile();
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container">
<br>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-2"></div>
<div class="col-xs-12 col-sm-12 col-lg-8">
<?php
include $global['systemRootPath'] . 'view/userSignUpBody.php';
?>
</div>
<div class="col-xs-12 col-sm-12 col-md-2"></div>
</div>
</div><!--/.container-->
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
?>
</body>
</html>

315
view/userSignUpBody.php Normal file
View file

@ -0,0 +1,315 @@
<?php
//$json_file = url_get_contents("{$global['webSiteRootURL']}plugin/CustomizeAdvanced/advancedCustom.json.php");
// convert the string to a json object
//$advancedCustom = _json_decode($json_file);
if (!empty($advancedCustomUser->disableNativeSignUp)) {
die(__("Sign Up Disabled"));
}
$agreement = AVideoPlugin::loadPluginIfEnabled("SignUpAgreement");
$redirectUri = getRedirectUri($global['webSiteRootURL']);
$siteRedirectUri = "{$global['webSiteRootURL']}user";
$siteRedirectUri = addQueryStringParameter($siteRedirectUri, 'redirectUri', $redirectUri);
if (isValidURL(@$_GET['siteRedirectUri'])) {
$siteRedirectUri = $_GET['siteRedirectUri'];
}
if (!empty($advancedCustomUser->afterSignUpGoToURL) && isValidURL($advancedCustomUser->afterSignUpGoToURL)) {
$loginURL = "{$global['webSiteRootURL']}user";
$loginURL = addQueryStringParameter($loginURL, 'redirectUri', $advancedCustomUser->afterSignUpGoToURL);
$loginURL = addQueryStringParameter($loginURL, 'comebackhere', 1);
$siteRedirectUri = $loginURL;
}
$siteRedirectUri = addQueryStringParameter($siteRedirectUri, 'success', _($advancedCustomUser->signupWelcomeAlert));
?>
<div class="panel panel-default <?php
echo getCSSAnimationClassAndStyle();
getCSSAnimationClassAndStyleAddWait(0.5);
?>">
<div class="panel-heading tabbable-line">
<ul class="nav nav-tabs" id="signupNavTabs">
<li class="nav-item active" id="sinupBasic">
<a class="nav-link " href="#" data-toggle="tab" onclick="showCompanyFields(false)">
<i class="fas fa-user"></i>
<?php echo __("Sign Up"); ?>
</a>
</li>
<?php
if (empty($advancedCustomUser->disableCompanySignUp)) {
?>
<li class="nav-item" id="sinupCompany">
<a class="nav-link " href="#" data-toggle="tab" onclick="showCompanyFields(true)">
<i class="fas fa-building"></i>
<?php echo __("Company Sign Up"); ?>
</a>
</li>
<?php
}
?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content" id="signupTabContent">
<div class="tab-pane active" id="signupRegular" >
<form id="updateUserForm" onsubmit="">
<div class="form-group">
<div class="col-md-12 inputGroupContainer">
<div class="input-group">
<?php
if (!empty($advancedCustomUser->messageToAppearAboveSignUpBox->value)) {
echo $advancedCustomUser->messageToAppearAboveSignUpBox->value;
}
?>
</div>
</div>
</div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputName"><?php echo __("Name"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<input id="inputName" placeholder="<?php echo __("Name"); ?>" name="name" class="form-control" type="text" value="" required >
</div>
</div>
</div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputUser"><?php echo!empty($advancedCustomUser->forceLoginToBeTheEmail) ? __("E-mail") : __("User"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="inputUser" placeholder="<?php echo!empty($advancedCustomUser->forceLoginToBeTheEmail) ? "me@example.com" : __("User"); ?>" class="form-control" type="<?php echo empty($advancedCustomUser->forceLoginToBeTheEmail) ? "text" : "email"; ?>" value="" name="user" required >
</div>
</div>
</div>
<?php
if (empty($advancedCustomUser->forceLoginToBeTheEmail)) {
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputEmail"><?php echo __("E-mail"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input id="inputEmail" placeholder="<?php echo __("E-mail"); ?>" name="email" class="form-control" type="email" value="" required >
</div>
</div>
</div>
<?php }
?>
<?php
if (empty($advancedCustomUser->doNotShowPhoneOnSignup)) {
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="phone"><?php echo __("Phone"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="fas fa-phone"></i></span>
<input id="phone" placeholder="<?php echo __("Phone"); ?>" name="phone" class="form-control" type="text" value="" >
</div>
</div>
</div>
<?php }
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputPassword"><?php echo __("New Password"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<?php
getInputPassword("inputPassword", 'class="form-control" autocomplete="off" ', __("New Password"));
?>
</div>
</div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="inputPasswordConfirm"><?php echo __("Confirm New Password"); ?></label>
<div class="col-sm-8 inputGroupContainer">
<?php
getInputPassword("inputPasswordConfirm", 'class="form-control" autocomplete="off" ', __("Confirm New Password"));
?>
</div>
</div>
<div class="clearfix"></div>
<?php
if (empty($advancedCustomUser->disableCompanySignUp)) {
$extra_info_fields = Users_extra_info::getAllActive(0, true);
echo '<!-- Show CompanySignUp -->';
echo '<input id="is_company" name="is_company" type="hidden" value="0" >';
} else {
$extra_info_fields = Users_extra_info::getAllActive();
echo '<!-- DO NOT Show CompanySignUp -->';
}
//var_dump($extra_info_fields);
foreach ($extra_info_fields as $value) {
if (Users_extra_info::isCompanyOnlyField($value['status'])) {
$class = 'companyField';
$style = 'display: none;';
?>
<div class="row form-group <?php echo $class; ?>" style="<?php echo $style; ?>">
<?php echo Users_extra_info::typeToHTML($value, 'col-sm-4 control-label hidden-xs', 'col-sm-8 inputGroupContainer'); ?>
</div>
<?php
} else {
?>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>" >
<?php echo Users_extra_info::typeToHTML($value, 'col-sm-4 control-label hidden-xs', 'col-sm-8 inputGroupContainer'); ?>
</div>
<?php
}
?>
<div class="clearfix"></div>
<?php
}
?>
<div class="clearfix"></div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<?php
if (!empty($agreement)) {
$agreement->getSignupCheckBox();
}
?>
</div>
<div class="clearfix"></div>
<div class="row form-group <?php echo getCSSAnimationClassAndStyle(); ?>">
<label class="col-sm-4 control-label hidden-xs" for="captchaText"><?php echo __("Type the code"); ?></label>
<div class="col-sm-8 inputGroupContainer captcha">
<?php
$capcha = getCaptcha();
echo $capcha['content'];
?>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="panel-footer">
<button class="btn btn-primary btn-block btn-lg <?php echo getCSSAnimationClassAndStyle(); ?>" onclick="$('#updateUserForm').submit();" ><i class="fas fa-user-plus"></i> <?php echo __("Sign Up"); ?></button>
<?php
if (!empty($redirectUri)) {
?>
<a href="<?php echo $redirectUri; ?>" class="btn btn-default btn-block btn-xs <?php echo getCSSAnimationClassAndStyle(); ?>" ><i class="fas fa-times"></i> <?php echo __("Cancel"); ?></a>
<?php
}
?>
</div>
</div>
<script>
function showCompanyFields(show) {
$('#signupNavTabs .nav-item').removeClass('active');
if (show) {
$('#sinupCompany').addClass('active');
$('.companyField').slideDown();
$('#is_company').val(<?php echo User::$is_company_status_WAITINGAPPROVAL; ?>);
} else {
$('#sinupBasic').addClass('active');
$('.companyField').slideUp();
$('#is_company').val(0);
}
}
function validateSignupForm() {
var errorFound = false;
var errorClass = 'has-error';
$('#updateUserForm .input-group').removeClass(errorClass);
$('#updateUserForm input').each(function () {
console.log('found', $(this).attr('name'));
if ($(this).prop('required') && $(this).is(":visible")) {
if ($(this).attr('type') === 'checkbox') {
if (!$(this).is(':checked')) {
$(this).closest('.input-group').addClass(errorClass);
errorFound = 'Confirmation Required';
return false;
}
} else {
console.log('is required', $(this).attr('name'));
if (empty($(this).val())) {
$(this).closest('.input-group').addClass(errorClass);
var label = $("label[for='" + $(this).attr('id') + "']").text();
if (!label) {
label = $(this).attr('name');
}
errorFound = label + ' is required';
return false;
}
}
}
});
console.log(errorFound);
if (errorFound) {
avideoAlertError(errorFound);
return false;
}
// Password doesn't match
if (!$('#inputPassword').val().match(/[0-9a-z]+/i)) {
$('#inputPassword').closest('.input-group').addClass(errorClass);
avideoAlertError("<?php echo __("Your password cannot be blank"); ?>");
return false;
}
if (!checkIfPasswordsMatch()) {
avideoAlertError("<?php echo __("Your password does not match!"); ?>");
return false;
}
if ($('#inputEmail').is(":visible") && !isEmailValid($('#inputEmail').val())) {
if (!isEmailValid($('#inputUser').val())) {
$('#inputEmail').closest('.input-group').addClass(errorClass);
avideoAlertError("<?php echo __("You must specify a valid email"); ?>");
return false;
}
}
if (!$('#inputUser').val().match(/^[0-9a-z@._-]{3,}$/i) && !isEmailValid($('#inputUser').val())) {
$('#inputUser').closest('.input-group').addClass(errorClass);
avideoAlertError("<?php echo __("Invalid user"); ?>");
return false;
}
return true;
}
function checkIfPasswordsMatch() {
var errorClass = 'has-error';
var inputPasswordConfirm = $('#inputPasswordConfirm').val();
var inputPassword = $('#inputPassword').val();
$('#inputPassword').closest('.input-group').removeClass(errorClass);
$('#inputPasswordConfirm').closest('.input-group').removeClass(errorClass);
if (inputPasswordConfirm !== inputPassword) {
$('#inputPassword').closest('.input-group').addClass(errorClass);
$('#inputPasswordConfirm').closest('.input-group').addClass(errorClass);
return false;
}
return true;
}
$(document).ready(function () {
$('#inputPasswordConfirm').keyup(function () {
checkIfPasswordsMatch();
});
passStrengthCheckInputKeyUp('#inputPassword');
$('#updateUserForm').submit(function (evt) {
evt.preventDefault();
if (validateSignupForm()) {
modal.showPleaseWait();
$.ajax({
url: webSiteRootURL + 'objects/userCreate.json.php?PHPSESSID=<?php echo session_id(); ?>',
data: $('#updateUserForm').serialize(),
type: 'post',
success: function (response) {
avideoResponse(response);
if (!response.error) {
window.location.href = '<?php echo $siteRedirectUri; ?>';
} else {
modal.hidePleaseWait();
}
}
});
return false;
}
});
});
</script>