Support for PHP Built-in in web server
This commit is contained in:
parent
9d16a4b754
commit
f3bf006b90
|
@ -1,7 +0,0 @@
|
||||||
# Bludit
|
|
||||||
|
|
||||||
If you are reading this, you must enable rewrite module.
|
|
||||||
|
|
||||||
Documentation:
|
|
||||||
- http://docs.bludit.com/en/getting-started/requirements
|
|
||||||
- http://docs.bludit.com/en/troubleshooting/browser-returns-not-found
|
|
|
@ -469,7 +469,7 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html class="uk-height-1-1 uk-notouch">
|
<html class="uk-height-1-1 uk-notouch">
|
||||||
<head>
|
<head>
|
||||||
<base href="admin/themes/default/">
|
<base href="kernel/admin/themes/default/">
|
||||||
<meta charset="<?php echo CHARSET ?>">
|
<meta charset="<?php echo CHARSET ?>">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
background: #1F5FC4;
|
background: #1F5FC4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uk-form legend {
|
||||||
|
width: 70% !important;
|
||||||
|
}
|
||||||
|
|
||||||
.uk-navbar-nav > li > a {
|
.uk-navbar-nav > li > a {
|
||||||
border: none;
|
border: none;
|
||||||
height: 70px;
|
height: 70px;
|
Before Width: | Height: | Size: 1005 B After Width: | Height: | Size: 1005 B |
|
@ -207,4 +207,64 @@ class HTML {
|
||||||
echo $html;
|
echo $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function profileUploader($username)
|
||||||
|
{
|
||||||
|
global $L;
|
||||||
|
|
||||||
|
$html = '
|
||||||
|
<div id="jsprogressBar" class="uk-progress uk-hidden">
|
||||||
|
<div class="uk-progress-bar" style="width: 0%;">0%</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="upload-drop" class="uk-placeholder uk-text-center">
|
||||||
|
<a class="uk-form-file"><i class="uk-icon-cloud-upload uk-margin-small-right"></i>'.$L->g('Upload Image').'<input id="upload-select" type="file"></a>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
$html .= '
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$(function()
|
||||||
|
{
|
||||||
|
var progressbar = $("#jsprogressBar");
|
||||||
|
var bar = progressbar.find(".uk-progress-bar");
|
||||||
|
var settings =
|
||||||
|
{
|
||||||
|
type: "json",
|
||||||
|
action: "'.HTML_PATH_ADMIN_ROOT.'ajax/uploader",
|
||||||
|
allow : "*.(jpg|jpeg|gif|png)",
|
||||||
|
params: {"type":"profilePicture", "username":"'.$username.'"},
|
||||||
|
|
||||||
|
loadstart: function() {
|
||||||
|
bar.css("width", "0%").text("0%");
|
||||||
|
progressbar.removeClass("uk-hidden");
|
||||||
|
},
|
||||||
|
|
||||||
|
progress: function(percent) {
|
||||||
|
percent = Math.ceil(percent);
|
||||||
|
bar.css("width", percent+"%").text(percent+"%");
|
||||||
|
},
|
||||||
|
|
||||||
|
allcomplete: function(response) {
|
||||||
|
bar.css("width", "100%").text("100%");
|
||||||
|
setTimeout(function() { progressbar.addClass("uk-hidden"); }, 250);
|
||||||
|
$("#jsimageList").prepend("<option value=\'"+response.filename+"\' selected=\'selected\'>"+response.filename+"</option>");
|
||||||
|
},
|
||||||
|
|
||||||
|
notallowed: function(file, settings) {
|
||||||
|
alert("'.$L->g('Supported image file types').' "+settings.allow);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var select = UIkit.uploadSelect($("#upload-select"), settings);
|
||||||
|
var drop = UIkit.uploadDrop($("#upload-drop"), settings);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
|
echo $html;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
HTML::title(array('title'=>$L->g('Edit user'), 'icon'=>'user'));
|
HTML::title(array('title'=>$L->g('Edit user'), 'icon'=>'user'));
|
||||||
|
|
||||||
|
echo '<div class="uk-grid">';
|
||||||
|
echo '<div class="uk-width-8-10">';
|
||||||
|
|
||||||
HTML::formOpen(array('id'=>'edit-user-profile-form','class'=>'uk-form-horizontal'));
|
HTML::formOpen(array('id'=>'edit-user-profile-form','class'=>'uk-form-horizontal'));
|
||||||
|
|
||||||
// Security token
|
// Security token
|
||||||
|
@ -92,6 +95,13 @@ if( ($Login->role()==='admin') && ($_user['username']!='admin') ) {
|
||||||
|
|
||||||
HTML::formClose();
|
HTML::formClose();
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
|
echo '<div class="uk-width-2-10" style="margin-top: 50px;">';
|
||||||
|
echo '<img id="jsprofilePicture" class="uk-border-rounded" src="'.HTML_PATH_UPLOADS_PROFILES.$_user['username'].'.jpg" alt="profile picture">';
|
||||||
|
HTML::profileUploader($_user['username']);
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script>
|
<script>
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="login-form">
|
<div class="login-form">
|
||||||
|
|
||||||
<form method="post" action="<?php echo HTML_PATH_ADMIN_ROOT.'login-email' ?>" class="uk-form" autocomplete="off">
|
<form method="post" action="" class="uk-form" autocomplete="off">
|
||||||
|
|
||||||
<input type="hidden" id="jstoken" name="tokenCSRF" value="<?php $Security->printToken() ?>">
|
<input type="hidden" id="jstoken" name="tokenCSRF" value="<?php $Security->printToken() ?>">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="login-form">
|
<div class="login-form">
|
||||||
|
|
||||||
<form method="post" action="<?php echo HTML_PATH_ADMIN_ROOT.'login' ?>" class="uk-form" autocomplete="off">
|
<form method="post" action="" class="uk-form" autocomplete="off">
|
||||||
|
|
||||||
<input type="hidden" id="jstoken" name="tokenCSRF" value="<?php $Security->printToken() ?>">
|
<input type="hidden" id="jstoken" name="tokenCSRF" value="<?php $Security->printToken() ?>">
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<?php header('Content-Type: application/json');
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Type
|
||||||
|
$type = Sanitize::html($_POST['type']);
|
||||||
|
|
||||||
// Source
|
// Source
|
||||||
$source = $_FILES['files']['tmp_name'][0];
|
$source = $_FILES['files']['tmp_name'][0];
|
||||||
|
@ -24,12 +29,19 @@ if(empty($tmpName)) {
|
||||||
$tmpName = $filename.'.'.$fileExtension;
|
$tmpName = $filename.'.'.$fileExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($type=='profilePicture') {
|
||||||
|
$username = Sanitize::html($_POST['username']);
|
||||||
|
$tmpName = $username.'.jpg';
|
||||||
|
|
||||||
|
move_uploaded_file($source, PATH_UPLOADS_PROFILES.$tmpName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
move_uploaded_file($source, PATH_UPLOADS.$tmpName);
|
move_uploaded_file($source, PATH_UPLOADS.$tmpName);
|
||||||
|
}
|
||||||
|
|
||||||
exit(json_encode(array(
|
exit(json_encode(array(
|
||||||
'status'=>0,
|
'status'=>0,
|
||||||
'filename'=>$tmpName,
|
'filename'=>$tmpName
|
||||||
'date'=>date("F d Y H:i:s.", filemtime(PATH_UPLOADS.$tmpName))
|
|
||||||
)));
|
)));
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -35,7 +35,8 @@ define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||||
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||||
define('PATH_ADMIN', PATH_ROOT.'admin'.DS);
|
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
|
||||||
|
define('PATH_ADMIN', PATH_KERNEL.'admin'.DS);
|
||||||
define('PATH_ADMIN_THEMES', PATH_ADMIN.'themes'.DS);
|
define('PATH_ADMIN_THEMES', PATH_ADMIN.'themes'.DS);
|
||||||
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN.'controllers'.DS);
|
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN.'controllers'.DS);
|
||||||
define('PATH_ADMIN_VIEWS', PATH_ADMIN.'views'.DS);
|
define('PATH_ADMIN_VIEWS', PATH_ADMIN.'views'.DS);
|
||||||
|
@ -168,10 +169,13 @@ define('HTML_PATH_THEME_CSS', HTML_PATH_THEME.'css/');
|
||||||
define('HTML_PATH_THEME_JS', HTML_PATH_THEME.'js/');
|
define('HTML_PATH_THEME_JS', HTML_PATH_THEME.'js/');
|
||||||
define('HTML_PATH_THEME_IMG', HTML_PATH_THEME.'img/');
|
define('HTML_PATH_THEME_IMG', HTML_PATH_THEME.'img/');
|
||||||
|
|
||||||
define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'admin/themes/'.$Site->adminTheme().'/');
|
|
||||||
define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/');
|
|
||||||
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/');
|
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/');
|
||||||
|
define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'kernel/admin/themes/'.$Site->adminTheme().'/');
|
||||||
|
define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/');
|
||||||
|
define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/');
|
||||||
|
|
||||||
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'content/uploads/');
|
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'content/uploads/');
|
||||||
|
define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS.'profiles/');
|
||||||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
|
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
|
||||||
|
|
||||||
define('JQUERY', HTML_PATH_ADMIN_THEME_JS.'jquery.min.js');
|
define('JQUERY', HTML_PATH_ADMIN_THEME_JS.'jquery.min.js');
|
||||||
|
|
Loading…
Reference in New Issue