mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
parent
aecc6cf2d4
commit
59e0b41f81
7 changed files with 265 additions and 0 deletions
4
admin/customize_settings.php
Normal file
4
admin/customize_settings.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
include './customize_settings_native.php';
|
||||
include './customize_settings_plugin.php';
|
||||
?>
|
129
admin/customize_settings_native.php
Normal file
129
admin/customize_settings_native.php
Normal file
|
@ -0,0 +1,129 @@
|
|||
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/Croppie/croppie.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/Croppie/croppie.min.js" type="text/javascript"></script>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Title and Logo </div>
|
||||
<div class="panel-body">
|
||||
<form id="updateConfigForm">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
|
||||
<div class="col-md-8 inputGroupContainer">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
|
||||
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="col-md-4 control-label">
|
||||
<?php echo __("Your Logo"); ?> (250x70)
|
||||
</label>
|
||||
<div class="col-md-8 ">
|
||||
<div id="croppieLogo"></div>
|
||||
<a id="logo-btn" class="btn btn-default btn-xs btn-block"><?php echo __("Upload a logo"); ?></a>
|
||||
</div>
|
||||
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<button type="submit" class="btn btn-block btn-primary btn-lg" ><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var logoCrop;
|
||||
var logoSmallCrop;
|
||||
var theme;
|
||||
function readFile(input, c) {
|
||||
console.log("read file");
|
||||
if ($(input)[0].files && $(input)[0].files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
c.croppie('bind', {
|
||||
url: e.target.result
|
||||
}).then(function () {
|
||||
console.log('jQuery bind complete');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
reader.readAsDataURL($(input)[0].files[0]);
|
||||
} else {
|
||||
swal("Sorry - you're browser doesn't support the FileReader API");
|
||||
}
|
||||
}
|
||||
|
||||
var logoImgBase64;
|
||||
|
||||
$(document).ready(function () {
|
||||
// start croppie logo
|
||||
$('#logo').on('change', function () {
|
||||
readFile(this, logoCrop);
|
||||
});
|
||||
$('#logo-btn').on('click', function (ev) {
|
||||
$('#logo').trigger("click");
|
||||
});
|
||||
$('#logo-result-btn').on('click', function (ev) {
|
||||
logoCrop.croppie('result', {
|
||||
type: 'canvas',
|
||||
size: 'viewport'
|
||||
}).then(function (resp) {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
logoCrop = $('#croppieLogo').croppie({
|
||||
url: '<?php echo $global['webSiteRootURL'], $config->getLogo(); ?>',
|
||||
enableExif: true,
|
||||
enforceBoundary: false,
|
||||
mouseWheelZoom: false,
|
||||
viewport: {
|
||||
width: 250,
|
||||
height: 70
|
||||
},
|
||||
boundary: {
|
||||
width: 250,
|
||||
height: 70
|
||||
}
|
||||
});
|
||||
setTimeout(function () {
|
||||
logoCrop.croppie('setZoom', 1);
|
||||
}, 1000);
|
||||
|
||||
|
||||
$('#updateConfigForm').submit(function (evt) {
|
||||
evt.preventDefault();
|
||||
modal.showPleaseWait();
|
||||
$('#tabRegularLink').tab('show');
|
||||
|
||||
logoCrop.croppie('result', {
|
||||
type: 'canvas',
|
||||
size: 'viewport'
|
||||
}).then(function (resp) {
|
||||
logoImgBase64 = resp;
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>admin/customize_settings_nativeUpdate.json.php',
|
||||
data: {
|
||||
"logoImgBase64": logoImgBase64,
|
||||
"webSiteTitle": $('#inputWebSiteTitle').val(),
|
||||
},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if (response.status === "1") {
|
||||
swal("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your configurations has been updated!"); ?>", "success");
|
||||
} else {
|
||||
swal("<?php echo __("Sorry!"); ?>", "<?php echo __("Your configurations has NOT been updated!"); ?>", "error");
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
53
admin/customize_settings_nativeUpdate.json.php
Normal file
53
admin/customize_settings_nativeUpdate.json.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
header('Content-Type: application/json');
|
||||
global $global, $config;
|
||||
if(!isset($global['systemRootPath'])){
|
||||
require_once '../videos/configuration.php';
|
||||
}
|
||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
if (!User::isAdmin()) {
|
||||
die('{"error":"' . __("Permission denied") . '"}');
|
||||
}
|
||||
|
||||
require_once $global['systemRootPath'] . 'videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/functions.php';
|
||||
$config = new Configuration();
|
||||
$config->setWebSiteTitle($_POST['webSiteTitle']);
|
||||
$imagePath = "videos/userPhoto/";
|
||||
|
||||
//Check write Access to Directory
|
||||
if (!file_exists($global['systemRootPath'] . $imagePath)) {
|
||||
mkdir($global['systemRootPath'] . $imagePath, 0755, true);
|
||||
}
|
||||
|
||||
if (!is_writable($global['systemRootPath'] . $imagePath)) {
|
||||
$response = Array(
|
||||
"status" => 'error',
|
||||
"message" => 'No write Access'
|
||||
);
|
||||
print json_encode($response);
|
||||
return;
|
||||
}
|
||||
$response = array();
|
||||
if (!empty($_POST['logoImgBase64'])) {
|
||||
$fileData = base64DataToImage($_POST['logoImgBase64']);
|
||||
$fileName = 'logo.png';
|
||||
$photoURL = $imagePath . $fileName;
|
||||
$bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData);
|
||||
if ($bytes > 10) {
|
||||
$response = array(
|
||||
"status" => 'success',
|
||||
"url" => $global['systemRootPath'] . $photoURL
|
||||
);
|
||||
$config->setLogo($photoURL);
|
||||
} else {
|
||||
$response = array(
|
||||
"status" => 'error',
|
||||
"msg" => 'We could not save logo',
|
||||
"url" => $global['systemRootPath'] . $photoURL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
echo '{"status":"' . $config->save() . '", "respnseLogo": ' . json_encode($response) . '}';
|
75
admin/customize_settings_plugin.php
Normal file
75
admin/customize_settings_plugin.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<link href="<?php echo $global['webSiteRootURL']; ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css"/>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Customize Footer, About and Meta Description <div class="pull-right"><?php echo getPluginSwitch('Customize'); ?></div></div>
|
||||
<div class="panel-body">
|
||||
<?php
|
||||
if (!YouPHPTubePlugin::exists('Customize')) {
|
||||
?>
|
||||
<div class="alert alert-info">
|
||||
Truly customize your YouPHPTube and create a more professional video sharing site experience for your visitors by removing or replacing the footer, about page and Meta Description with your own.
|
||||
<a class="btn btn-info btn-sm btn-xs" href="https://www.youphptube.com/plugins/">Buy the Customize plugin now</a>
|
||||
</div>
|
||||
<?php
|
||||
return false;
|
||||
} else {
|
||||
|
||||
require_once $global['systemRootPath'] . 'plugin/Customize/Objects/ExtraConfig.php';
|
||||
|
||||
$ec = new ExtraConfig();
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form id="customizeForm">
|
||||
<div class="form-group">
|
||||
<label for="about" class="col-2 col-form-label">Text for About Page</label>
|
||||
<div class="col-10">
|
||||
<textarea id="about" placeholder="Enter the About text" style="width: 100%;"><?php echo $ec->getAbout(); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="footer" class="col-2 col-form-label">Text for Footer</label>
|
||||
<div class="col-10">
|
||||
<textarea id="footer" placeholder="Enter the footer text" style="width: 100%;"><?php echo $ec->getFooter(); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-2 col-form-label">MetaTag Description</label>
|
||||
<div class="col-10">
|
||||
<input class="form-control" type="text" placeholder="Description" id="description" value="<?php echo $ec->getDescription(); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success btn-block">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.js" type="text/javascript"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#about, #footer').wysihtml5({toolbar: {
|
||||
"html": true,
|
||||
"color": true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#customizeForm").submit(function (event) {
|
||||
event.preventDefault();
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Customize/page/editorSave.php',
|
||||
data: {"about": $('#about').val(), "footer": $('#footer').val(), "description": $('#description').val()},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
console.log(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -41,6 +41,7 @@ $menu = new MenuAdmin(__("Dashboard"), "fa fa-tachometer-alt", "dashboard");
|
|||
$itens[] = $menu;
|
||||
|
||||
$menu = new MenuAdmin(__("Settings"), "fa fa-wrench");
|
||||
$menu->addItem(new MenuAdmin(__("Remove Branding"), "far fa-edit", "customize_settings"));
|
||||
$menu->addItem(new MenuAdmin(__("General Settings"), "fas fa-cog", "general_settings"));
|
||||
$menu->addItem(new MenuAdmin(__("Site Settings"), "fas fa-sitemap", "site_settings"));
|
||||
$menu->addItem(new MenuAdmin(__("Social Login Settings"), "fas fa-sign-in-alt", "socialLogin_settings"));
|
||||
|
@ -99,6 +100,9 @@ switch ($_GET['page']) {
|
|||
case "design_player":
|
||||
$includeBody = $global['systemRootPath'] . 'admin/design_player.php';
|
||||
break;
|
||||
case "customize_settings":
|
||||
$includeBody = $global['systemRootPath'] . 'admin/customize_settings.php';
|
||||
break;
|
||||
case "storage_settings":
|
||||
$includeBody = $global['systemRootPath'] . 'admin/storage_settings.php';
|
||||
break;
|
||||
|
|
0
plugin/Gallery/functions.php
Executable file → Normal file
0
plugin/Gallery/functions.php
Executable file → Normal file
0
plugin/Gallery/view/BigVideo.php
Executable file → Normal file
0
plugin/Gallery/view/BigVideo.php
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue