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

View File

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

View File

@ -1,4 +1,3 @@
<div id="installer">
<?php <?php
/* /*
@ -10,35 +9,34 @@
require_once( __DIR__ . "/install.php" ); require_once( __DIR__ . "/install.php" );
$path = rtrim( str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']), "/"); $path = rtrim( str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']), "/");
$workspace = is_writable($path . "/workspace"); $workspace = is_writable($path . "/workspace");
$data = is_writable($path . "/data"); $data = is_writable($path . "/data");
$plugins = is_writable($path . "/plugins"); $plugins = is_writable($path . "/plugins");
$themes = is_writable($path . "/themes"); $themes = is_writable($path . "/themes");
$workspace = is_writable($path . "/workspace"); $workspace = is_writable($path . "/workspace");
$conf = $path . '/config.php'; $conf = $path . '/config.php';
$config = is_writable(file_exists($conf) ? $conf : $path); $config = is_writable(file_exists($conf) ? $conf : $path);
$date = new DateTime(); $date = new DateTime();
$timeZone = $date->getTimezone()->getName(); $timeZone = $date->getTimezone()->getName();
if (ini_get('register_globals') == 1) { if ( ini_get('register_globals') == 1) {
$register = true; $register = true;
} else { } else {
$register = false; $register = false;
} }
if (ini_get('newrelic.enabled') == 1) { if ( ini_get('newrelic.enabled') == 1 ) {
$newrelic = true; $newrelic = true;
} else { } else {
$newrelic = false; $newrelic = false;
} }
$query = $_SERVER['QUERY_STRING']; $query = $_SERVER['QUERY_STRING'];
$autocomplete = array( $autocomplete = array(
'username' => '', 'username' => '',
'password' => '', 'password' => '',
@ -55,66 +53,115 @@ $autocomplete = array(
'dbtype' => 'mysql', 'dbtype' => 'mysql',
); );
if (!empty($query)) { if ( ! empty( $query ) ) {
$params = explode('&', $query); $params = explode('&', $query);
foreach ($params as $param) { foreach( $params as $param ) {
$param = explode('=', $param);
if (array_key_exists($param[0], $autocomplete)) { $param = explode( '=', $param );
if( array_key_exists( $param[0], $autocomplete ) ) {
$autocomplete[$param[0]] = urldecode($param[1]); $autocomplete[$param[0]] = urldecode($param[1]);
} }
} }
} }
if (!$workspace || !$data || !$config || $register || $newrelic) { ?>
?> <div id="installer">
<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 <?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"> <form id="install">
<h1><?php i18n("Initial Setup"); ?></h1> <h1><?php i18n("Initial Setup"); ?></h1>
<label><?php i18n("Dependencies"); ?></label> <label><?php i18n("Dependencies"); ?></label>
<div id="dependencies"> <div id="dependencies">
<?php foreach ([ <?php foreach ([
@ -132,9 +179,9 @@ if ($newrelic) {
$class_name = ($status == 'required') ? 'error' : 'warning'; $class_name = ($status == 'required') ? 'error' : 'warning';
?> ?>
<div class="<?php echo $class_name; ?>"><span class="icon-cancel"></span> <?=$dep?></div> <div class="<?php echo $class_name; ?>"><span class="icon-cancel"></span> <?=$dep?></div>
<?php <?php
} }
} ?> } ?>
</div> </div>
<input type="hidden" name="path" value="<?php echo($path); ?>"> <input type="hidden" name="path" value="<?php echo($path); ?>">
@ -324,88 +371,88 @@ if ($newrelic) {
</div> </div>
<script> <script>
$(function(){ $(function(){
$('html, body').css('overflow', 'auto'); $('html, body').css('overflow', 'auto');
// Automatically select first timezone with the appropriate GMT offset // Automatically select first timezone with the appropriate GMT offset
function getTimeZoneString() { function getTimeZoneString() {
var num = new Date().getTimezoneOffset(); var num = new Date().getTimezoneOffset();
if (num === 0) { if (num === 0) {
return "GMT"; return "GMT";
} else { } else {
var hours = Math.floor(num / 60); var hours = Math.floor(num / 60);
var minutes = Math.floor((num - (hours * 60))); var minutes = Math.floor((num - (hours * 60)));
if (hours < 10) hours = "0" + Math.abs(hours); if (hours < 10) hours = "0" + Math.abs(hours);
if (minutes < 10) minutes = "0" + Math.abs(minutes); if (minutes < 10) minutes = "0" + Math.abs(minutes);
return "GMT" + (num < 0 ? "+" : "-") + hours + ":" + minutes; return "GMT" + (num < 0 ? "+" : "-") + hours + ":" + minutes;
} }
} }
var timezone = getTimeZoneString(); var timezone = getTimeZoneString();
$("[name=timezone] option").each(function() { $("[name=timezone] option").each(function() {
if($(this).text().indexOf(timezone) > -1) $("[name=timezone]").val($(this).val()); 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"; input.type = "text";
} else { } else {
input.type = "password"; input.type = "password";
} }
}); });
$('#install').on('submit',function(e){ $('#install').on('submit',function(e){
e.preventDefault(); e.preventDefault();
// Check empty fields // Check empty fields
empty_fields = false; empty_fields = false;
$('input').each(function(){ $('input').each(function(){
if($(this).val()=='' && $(this).attr('name')!='path'){ empty_fields = true; } 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 // Check password
password_match = true; password_match = true;
if($('input[name="password"]').val()!=$('input[name="password_confirm"]').val()){ if($('input[name="password"]').val()!=$('input[name="password_confirm"]').val()){
password_match = false; password_match = false;
} }
// Check Path // Check Path
check_path = true; check_path = true;
projectPath = ''; projectPath = '';
if($('input[name="project_path"]').length) { if($('input[name="project_path"]').length) {
projectPath = $('input[name="project_path"]').val(); projectPath = $('input[name="project_path"]').val();
} }
if ( projectPath.indexOf("/") == 0 ) { if ( projectPath.indexOf("/") == 0 ) {
check_path = confirm('Do you really want to create project with absolute path "' + projectPath + '"?'); 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){ if(!empty_fields && password_match && check_path){
$.post('components/install/install.php',$('#install').serialize(),function( data ) { $.post('components/install/install.php',$('#install').serialize(),function( data ) {
if( data == 'success' ){ if( data == 'success' ){
window.location.reload(); window.location.reload();
} else { } else {
data = JSON.parse( data ); data = JSON.parse( data );
console.log( data.error ); console.log( data.error );
alert( "An Error Occurred\n" + data.message ); alert( "An Error Occurred\n" + data.message );
} }
}); });
} }
}); });
}); });
</script> </script>

View File

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

View File

@ -347,7 +347,7 @@ class User {
public static function CleanUsername( $username ) { 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; float: right;
position: relative; position: relative;
top: -30px; margin: -30px 8px 0 0;
} }
/* FORMS */ /* FORMS */