Modified in input icon class, Removed debug code, Modified regex expressions,

This commit is contained in:
xevidos 2019-04-16 12:52:41 -04:00
parent 9b452b33bd
commit 7b95a73088
7 changed files with 410 additions and 371 deletions

View File

@ -1008,8 +1008,6 @@
return;
}
//console.log( codiad.active.position_timer, path, JSON.stringify( position ) );
$.ajax({
type: 'POST',
url: codiad.active.controller + '?action=save_position',
@ -1020,7 +1018,6 @@
success: function( data ) {
codiad.active.position_timer = Date.now();
//console.log( "called save position: ", data );
},
});
}, 500);
@ -1039,8 +1036,6 @@
for( let i = codiad.editor.instances.length;i--; ) {
//console.log( codiad.editor.instances[i].getSession().path, path, ( codiad.editor.instances[i].getSession().path == path ) );
if( codiad.editor.instances[i].getSession().path == path ) {
editor = codiad.editor.instances[i];
@ -1069,8 +1064,6 @@
cursor = this.getPosition();
}
console.log( "setting position", cursor );
editor.scrollToLine( cursor.row, true, true, function() {});
editor.moveCursorTo( cursor.row, cursor.column );
},

View File

@ -774,7 +774,7 @@ class Filemanager extends Common {
* trying to rename or delete it, allow the actual file name.
*/
$invalid_characters = preg_match( '/[^A-Za-z0-9\-\._\/\ ]/', $path );
$invalid_characters = preg_match( '/[^A-Za-z0-9\-\._@\/\ ]/', $path );
if( $invalid_characters && ! ( $_GET['action'] == "modify" || $_GET['action'] == "delete" ) ) {

View File

@ -88,7 +88,7 @@ class Install {
function clean_username( $username ) {
return strtolower( preg_replace( '#[^A-Za-z0-9' . preg_quote( '-_@. ').']#', '', $username ) );
return strtolower( preg_replace( '/[^\w\-\._@]/', '-', $username ) );
}
function create_config() {
@ -162,7 +162,7 @@ define("WSURL", BASE_URL . "/workspace");
if ( ! $this->is_abs_path( $project_path ) ) {
$project_path = str_replace( " ", "_", preg_replace( '/[^\w-\.]/', '', $project_path ) );
$project_path = preg_replace( '/[^\w-._@]/', '-', $project_path );
if( ! is_dir( $this->workspace . "/" . $project_path ) ) {
mkdir( $this->workspace . "/" . $project_path );

View File

@ -1,4 +1,3 @@
<div id="installer">
<?php
/*
@ -10,35 +9,34 @@
require_once( __DIR__ . "/install.php" );
$path = rtrim( str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']), "/");
$workspace = is_writable($path . "/workspace");
$data = is_writable($path . "/data");
$plugins = is_writable($path . "/plugins");
$themes = is_writable($path . "/themes");
$workspace = is_writable($path . "/workspace");
$conf = $path . '/config.php';
$config = is_writable(file_exists($conf) ? $conf : $path);
$date = new DateTime();
$timeZone = $date->getTimezone()->getName();
if (ini_get('register_globals') == 1) {
if ( ini_get('register_globals') == 1) {
$register = true;
} else {
$register = false;
}
if (ini_get('newrelic.enabled') == 1) {
if ( ini_get('newrelic.enabled') == 1 ) {
$newrelic = true;
} else {
$newrelic = false;
}
$query = $_SERVER['QUERY_STRING'];
$autocomplete = array(
'username' => '',
'password' => '',
@ -55,66 +53,115 @@ $autocomplete = array(
'dbtype' => 'mysql',
);
if (!empty($query)) {
if ( ! empty( $query ) ) {
$params = explode('&', $query);
foreach ($params as $param) {
$param = explode('=', $param);
if (array_key_exists($param[0], $autocomplete)) {
foreach( $params as $param ) {
$param = explode( '=', $param );
if( array_key_exists( $param[0], $autocomplete ) ) {
$autocomplete[$param[0]] = urldecode($param[1]);
}
}
}
if (!$workspace || !$data || !$config || $register || $newrelic) {
?>
<h1><?php i18n("Installation Error"); ?></h1>
<p><?php i18n("Please make sure the following exist and are writeable:"); ?></p>
<div class="install_issues">
<p>[SYSTEM]/config.php - <?php if ($config) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
} ?></p>
<p>[SYSTEM]/workspace - <?php if ($workspace) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
} ?></p>
<p>[SYSTEM]/plugins - <?php if ($plugins) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
} ?></p>
<p>[SYSTEM]/themes - <?php if ($themes) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
} ?></p>
<p>[SYSTEM]/data - <?php if ($data) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
} ?></p>
</div>
<?php if ($register || $newrelic) { ?>
<p><?php i18n("Please make sure these environmental variables are set:"); ?></p>
<div class="install_issues">
<?php if ($register) {
echo '<p>register_globals: Off</p>';
}
if ($newrelic) {
echo '<p>newrelic.enabled: Off</p>';
} ?>
</div>
<?php } ?>
<button onclick="window.location.reload();">Re-Test</button>
?>
<div id="installer">
<?php
} else {
if ( ! $workspace || ! $data || ! $config || $register || $newrelic ) {
?>
<h1><?php i18n("Installation Error");?></h1>
<p><?php i18n("Please make sure the following exist and are writeable:");?></p>
<div class="install_issues">
<p>
[SYSTEM]/config.php -
<?php
if( $config ) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
}
?>
</p>
<p>
[SYSTEM]/workspace -
<?php
if ( $workspace ) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
}
?>
</p>
<p>
[SYSTEM]/plugins -
<?php
if( $plugins ) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
}
?>
</p>
<p>
[SYSTEM]/themes -
<?php
if( $themes ) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
}
?>
</p>
<p>
[SYSTEM]/data -
<?php
if( $data ) {
echo '<font style="color:green">PASSED</font>';
} else {
echo '<font style="color:red">ERROR</font>';
}
?>
</p>
</div>
<?php
if( $register || $newrelic ) {
?>
<p><?php i18n("Please make sure these environmental variables are set:");?></p>
<div class="install_issues">
<?php
if( $register ) {
echo '<p>register_globals: Off</p>';
}
if( $newrelic ) {
echo '<p>newrelic.enabled: Off</p>';
}
?>
</div>
<?php
}
?>
<button onclick="window.location.reload();">Re-Test</button>
<?php
} else {
?>
<form id="install">
<h1><?php i18n("Initial Setup"); ?></h1>
<label><?php i18n("Dependencies"); ?></label>
<div id="dependencies">
<?php foreach ([
@ -132,9 +179,9 @@ if ($newrelic) {
$class_name = ($status == 'required') ? 'error' : 'warning';
?>
<div class="<?php echo $class_name; ?>"><span class="icon-cancel"></span> <?=$dep?></div>
<?php
<?php
}
} ?>
} ?>
</div>
<input type="hidden" name="path" value="<?php echo($path); ?>">
@ -324,88 +371,88 @@ if ($newrelic) {
</div>
<script>
$(function(){
$(function(){
$('html, body').css('overflow', 'auto');
$('html, body').css('overflow', 'auto');
// Automatically select first timezone with the appropriate GMT offset
function getTimeZoneString() {
var num = new Date().getTimezoneOffset();
if (num === 0) {
return "GMT";
} else {
var hours = Math.floor(num / 60);
var minutes = Math.floor((num - (hours * 60)));
// Automatically select first timezone with the appropriate GMT offset
function getTimeZoneString() {
var num = new Date().getTimezoneOffset();
if (num === 0) {
return "GMT";
} else {
var hours = Math.floor(num / 60);
var minutes = Math.floor((num - (hours * 60)));
if (hours < 10) hours = "0" + Math.abs(hours);
if (minutes < 10) minutes = "0" + Math.abs(minutes);
if (hours < 10) hours = "0" + Math.abs(hours);
if (minutes < 10) minutes = "0" + Math.abs(minutes);
return "GMT" + (num < 0 ? "+" : "-") + hours + ":" + minutes;
}
}
var timezone = getTimeZoneString();
$("[name=timezone] option").each(function() {
if($(this).text().indexOf(timezone) > -1) $("[name=timezone]").val($(this).val());
})
return "GMT" + (num < 0 ? "+" : "-") + hours + ":" + minutes;
}
}
var timezone = getTimeZoneString();
$("[name=timezone] option").each(function() {
if($(this).text().indexOf(timezone) > -1) $("[name=timezone]").val($(this).val());
})
$(".hide_field").click( function( e ) {
$(".hide_field").click( function( e ) {
let input = e.target.parentElement.querySelector( 'input' );
let input = e.target.parentElement.querySelector( 'input' );
if( input.type == "password" ) {
if( input.type == "password" ) {
input.type = "text";
} else {
input.type = "text";
} else {
input.type = "password";
}
});
input.type = "password";
}
});
$('#install').on('submit',function(e){
e.preventDefault();
$('#install').on('submit',function(e){
e.preventDefault();
// Check empty fields
// Check empty fields
empty_fields = false;
$('input').each(function(){
if($(this).val()=='' && $(this).attr('name')!='path'){ empty_fields = true; }
});
empty_fields = false;
$('input').each(function(){
if($(this).val()=='' && $(this).attr('name')!='path'){ empty_fields = true; }
});
if(empty_fields){ alert('All fields must be filled out'); }
if(empty_fields){ alert('All fields must be filled out'); }
// Check password
password_match = true;
if($('input[name="password"]').val()!=$('input[name="password_confirm"]').val()){
password_match = false;
}
// Check password
password_match = true;
if($('input[name="password"]').val()!=$('input[name="password_confirm"]').val()){
password_match = false;
}
// Check Path
check_path = true;
projectPath = '';
if($('input[name="project_path"]').length) {
projectPath = $('input[name="project_path"]').val();
}
// Check Path
check_path = true;
projectPath = '';
if($('input[name="project_path"]').length) {
projectPath = $('input[name="project_path"]').val();
}
if ( projectPath.indexOf("/") == 0 ) {
check_path = confirm('Do you really want to create project with absolute path "' + projectPath + '"?');
}
if ( projectPath.indexOf("/") == 0 ) {
check_path = confirm('Do you really want to create project with absolute path "' + projectPath + '"?');
}
if(!password_match){ alert('The passwords entered do not match'); }
if(!password_match){ alert('The passwords entered do not match'); }
if(!empty_fields && password_match && check_path){
$.post('components/install/install.php',$('#install').serialize(),function( data ) {
if(!empty_fields && password_match && check_path){
$.post('components/install/install.php',$('#install').serialize(),function( data ) {
if( data == 'success' ){
window.location.reload();
} else {
data = JSON.parse( data );
console.log( data.error );
alert( "An Error Occurred\n" + data.message );
}
});
}
if( data == 'success' ){
window.location.reload();
} else {
data = JSON.parse( data );
console.log( data.error );
alert( "An Error Occurred\n" + data.message );
}
});
}
});
});
});
});
</script>

View File

@ -176,7 +176,6 @@
},
success: function( data ) {
console.log( `Update Option ( ${option} ): ` + data );
_self.settings = null;
},
error: function(jqXHR, textStatus, errorThrown) {

View File

@ -347,7 +347,7 @@ class User {
public static function CleanUsername( $username ) {
return strtolower( preg_replace( '#[^A-Za-z0-9' . preg_quote( '-_@. ').']#', '', $username ) );
return strtolower( preg_replace( '/[^\w\-\._@]/', '-', $username ) );
}
//////////////////////////////////////////////////////////////////

View File

@ -134,7 +134,7 @@ a:hover,a:active {;
float: right;
position: relative;
top: -30px;
margin: -30px 8px 0 0;
}
/* FORMS */