0.3.16
This commit is contained in:
parent
57ca1b9546
commit
b227731762
@ -4,6 +4,48 @@
|
||||
* Tree view
|
||||
*/
|
||||
|
||||
function initializeEditable(){
|
||||
|
||||
// Port Description
|
||||
$('#inline-portDescription').editable({
|
||||
display: function(value){
|
||||
$(this).text(value);
|
||||
},
|
||||
pk: 1,
|
||||
mode: 'inline',
|
||||
showbuttons: false,
|
||||
onblure: 'submit',
|
||||
url: 'backend/process_port.php',
|
||||
params: function(params){
|
||||
|
||||
var objID = $(document).data('clickedObjID');
|
||||
var objFace = $(document).data('clickedObjFace');
|
||||
var objDepth = $(document).data('clickedObjPartitionDepth');
|
||||
var portID = $(document).data('clickedObjPortID');
|
||||
var data = {
|
||||
'action': 'portDescription',
|
||||
'objID': objID,
|
||||
'objFace': objFace,
|
||||
'objDepth': objDepth,
|
||||
'portID': portID,
|
||||
'value': params.value
|
||||
};
|
||||
params.data = JSON.stringify(data);
|
||||
return params;
|
||||
},
|
||||
success: function(responseJSON) {
|
||||
var response = JSON.parse(responseJSON);
|
||||
if (response.active == 'inactive'){
|
||||
window.location.replace("/");
|
||||
} else if ($(response.error).size() > 0){
|
||||
displayError(response.error);
|
||||
} else {
|
||||
$('#alertMsg').empty();
|
||||
}
|
||||
}
|
||||
}).editable('option', 'disabled', true);
|
||||
}
|
||||
|
||||
function makeAddCabButtonClickable(addCabButton){
|
||||
$(addCabButton).click(function(event){
|
||||
event.preventDefault();
|
||||
@ -299,6 +341,13 @@ function retrievePortOptions(objID, objFace, partitionDepth, portID){
|
||||
if($(responseJSON.error).size() > 0) {
|
||||
displayError(responseJSON.error);
|
||||
} else {
|
||||
|
||||
// Port description
|
||||
$('#inline-portDescription')
|
||||
.editable('option', 'value', responseJSON.success.portDescription)
|
||||
.editable('option', 'disabled', false);
|
||||
|
||||
// Port populated
|
||||
$('#checkboxPopulated').prop("checked", responseJSON.success.populatedChecked);
|
||||
$('#checkboxPopulated').prop("disabled", responseJSON.success.populatedDisabled);
|
||||
|
||||
@ -477,9 +526,19 @@ function getFloorplanObjectPeerTable(){
|
||||
|
||||
function selectObject(parentObject){
|
||||
var objID = $('#objID').val();
|
||||
if($('#objFace').length && $('#objDepth').length && $('#portID').length) {
|
||||
var objFace = $('#objFace').val();
|
||||
var objDepth = $('#objDepth').val();
|
||||
var portID = $('#portID').val();
|
||||
var selection = $('#port-4-'+objID+'-'+objFace+'-'+objDepth+'-'+portID);
|
||||
} else {
|
||||
var selection = $(parentObject).find('[data-template-object-id='+objID+'][data-object-face=0]').children('.selectable:first');
|
||||
}
|
||||
$(selection).click();
|
||||
$('#objID').remove();
|
||||
$('#objFace').remove();
|
||||
$('#objDepth').remove();
|
||||
$('#portID').remove();
|
||||
}
|
||||
|
||||
function portDesignation(elem, action, flag) {
|
||||
@ -735,6 +794,8 @@ $( document ).ready(function() {
|
||||
// requires jquery.drawConnections.js
|
||||
initializeCanvas();
|
||||
|
||||
initializeEditable();
|
||||
|
||||
// Export to Viso button
|
||||
$('#buttonVisioExport').on('click', function(){
|
||||
window.open('/backend/export-visio.php');
|
||||
@ -818,9 +879,10 @@ $( document ).ready(function() {
|
||||
}
|
||||
|
||||
var data = {
|
||||
action: 'portPopulated',
|
||||
objID: objID,
|
||||
objFace: objFace,
|
||||
partitionDepth: objDepth,
|
||||
objDepth: objDepth,
|
||||
portID: objPort,
|
||||
portPopulated: portPopulated
|
||||
}
|
||||
@ -828,7 +890,7 @@ $( document ).ready(function() {
|
||||
data = JSON.stringify(data);
|
||||
|
||||
// Retrieve the selected port's path
|
||||
$.post('backend/process_port_populated.php', {data:data}, function(response){
|
||||
$.post('backend/process_port.php', {data:data}, function(response){
|
||||
var responseJSON = JSON.parse(response);
|
||||
if($(responseJSON.error).size() > 0) {
|
||||
displayError(responseJSON.error);
|
||||
|
||||
191
backend/process_port.php
Executable file
191
backend/process_port.php
Executable file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
define('QUADODO_IN_SYSTEM', true);
|
||||
require_once '../includes/header.php';
|
||||
$qls->Security->check_auth_page('user.php');
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||
require_once('../includes/Validate.class.php');
|
||||
$validate = new Validate($qls);
|
||||
|
||||
if ($validate->returnData['active'] == 'inactive') {
|
||||
echo json_encode($validate->returnData);
|
||||
return;
|
||||
}
|
||||
|
||||
$data = json_decode($_POST['data'], true);
|
||||
validate($data, $validate);
|
||||
|
||||
if (!count($validate->returnData['error'])){
|
||||
|
||||
$action = $data['action'];
|
||||
$objID = $data['objID'];
|
||||
$objFace = $data['objFace'];
|
||||
$objDepth = $data['objDepth'];
|
||||
$portID = $data['portID'];
|
||||
|
||||
switch($action) {
|
||||
|
||||
case 'portPopulated';
|
||||
|
||||
$portPopulated = $data['portPopulated'];
|
||||
|
||||
if($portPopulated) {
|
||||
$qls->SQL->insert(
|
||||
'app_populated_port',
|
||||
array(
|
||||
'object_id',
|
||||
'object_face',
|
||||
'object_depth',
|
||||
'port_id'
|
||||
),
|
||||
array(
|
||||
$objID,
|
||||
$objFace,
|
||||
$objDepth,
|
||||
$portID
|
||||
)
|
||||
);
|
||||
|
||||
// Log history
|
||||
$portName = $qls->App->generateObjectPortName($objID, $objFace, $objDepth, $portID);
|
||||
$actionString = 'Marked port as populated: <strong>'.$portName.'</strong>';
|
||||
$qls->App->logAction(2, 2, $actionString);
|
||||
|
||||
} else {
|
||||
$qls->SQL->delete(
|
||||
'app_populated_port',
|
||||
array(
|
||||
'object_id' => array('=', $objID),
|
||||
'AND',
|
||||
'object_face' => array('=', $objFace),
|
||||
'AND',
|
||||
'object_depth' => array('=', $objDepth),
|
||||
'AND',
|
||||
'port_id' => array('=', $portID)
|
||||
)
|
||||
);
|
||||
|
||||
// Log history
|
||||
$portName = $qls->App->generateObjectPortName($objID, $objFace, $objDepth, $portID);
|
||||
$actionString = 'Marked port as unpopulated: <strong>'.$portName.'</strong>';
|
||||
$qls->App->logAction(3, 2, $actionString);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'portDescription';
|
||||
|
||||
$descriptionNew = $data['value'];
|
||||
$portName = $qls->App->generateObjectPortName($objID, $objFace, $objDepth, $portID);
|
||||
|
||||
// Store original description
|
||||
if(isset($qls->App->portDescriptionArray[$objID][$objFace][$objDepth][$portID])) {
|
||||
|
||||
$portDescription = $qls->App->portDescriptionArray[$objID][$objFace][$objDepth][$portID];
|
||||
$descriptionID = $portDescription['id'];
|
||||
$descriptionOrig = $portDescription['description'];
|
||||
|
||||
if($descriptionNew == '') {
|
||||
|
||||
$qls->SQL->delete('app_port_description', array('id' => array('=', $descriptionID)));
|
||||
$actionVerb = 3;
|
||||
$actionString = 'Deleted port description: <strong>'.$portName.'</strong> - <strong>'.$descriptionOrig.'</strong>';
|
||||
} else {
|
||||
|
||||
$qls->SQL->update('app_port_description', array('description' => $descriptionNew), array('id' => array('=', $descriptionID)));
|
||||
$actionVerb = 2;
|
||||
$actionString = 'Changed port description: <strong>'.$portName.'</strong> - from <strong>'.$descriptionOrig.'</strong> to <strong>'.$descriptionNew.'</strong>';
|
||||
}
|
||||
} else {
|
||||
|
||||
if($descriptionNew != '') {
|
||||
// Write new description
|
||||
$qls->SQL->insert(
|
||||
'app_port_description',
|
||||
array(
|
||||
'object_id',
|
||||
'object_face',
|
||||
'object_depth',
|
||||
'port_id',
|
||||
'description'
|
||||
),
|
||||
array(
|
||||
$objID,
|
||||
$objFace,
|
||||
$objDepth,
|
||||
$portID,
|
||||
$descriptionNew
|
||||
)
|
||||
);
|
||||
|
||||
$actionVerb = 1;
|
||||
$actionString = 'Added port description: <strong>'.$portName.'</strong> - <strong>'.$descriptionNew.'</strong>';
|
||||
}
|
||||
}
|
||||
|
||||
$qls->App->logAction(3, $actionVerb, $actionString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo json_encode($validate->returnData);
|
||||
return;
|
||||
}
|
||||
|
||||
function validate($data, &$validate){
|
||||
|
||||
$action = $data['action'];
|
||||
$objID = $data['objID'];
|
||||
$objFace = $data['objFace'];
|
||||
$objDepth = $data['objDepth'];
|
||||
$objPortID = $data['portID'];
|
||||
|
||||
//Validate object ID
|
||||
$validate->validateObjectID($objID);
|
||||
|
||||
//Validate object face
|
||||
$validate->validateObjectFace($objFace);
|
||||
|
||||
//Validate partition depth
|
||||
$validate->validatePartitionDepth($objDepth);
|
||||
|
||||
//Validate port ID
|
||||
$validate->validatePortID($objPortID, 'port ID');
|
||||
|
||||
//Validate endpoint port trunked
|
||||
$portArray = array(
|
||||
array($objID, $objFace, $objDepth, $objPortID)
|
||||
);
|
||||
$validate->validateTrunkedEndpoint($portArray);
|
||||
|
||||
// Validate action
|
||||
$actionArray = array(
|
||||
'portPopulated',
|
||||
'portDescription'
|
||||
);
|
||||
$ref = 'action';
|
||||
if($validate->validateInArray($action, $actionArray, $ref)) {
|
||||
|
||||
switch($action) {
|
||||
|
||||
case 'portPopulated':
|
||||
|
||||
// Validate port populated
|
||||
$portPopulatedFlag = $data['portPopulated'];
|
||||
$validate->validateTrueFalse($portPopulatedFlag, 'port populated flag');
|
||||
|
||||
break;
|
||||
|
||||
case 'portDescription':
|
||||
|
||||
// Validate port description
|
||||
$portDescription = $data['value'];
|
||||
$validate->validateText($portDescription, 'port description');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
@ -1,101 +0,0 @@
|
||||
<?php
|
||||
define('QUADODO_IN_SYSTEM', true);
|
||||
require_once '../includes/header.php';
|
||||
$qls->Security->check_auth_page('user.php');
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||
require_once('../includes/Validate.class.php');
|
||||
$validate = new Validate($qls);
|
||||
|
||||
if ($validate->returnData['active'] == 'inactive') {
|
||||
echo json_encode($validate->returnData);
|
||||
return;
|
||||
}
|
||||
|
||||
$data = json_decode($_POST['data'], true);
|
||||
validate($data, $validate);
|
||||
|
||||
if (!count($validate->returnData['error'])){
|
||||
$objectID = $data['objID'];
|
||||
$objectFace = $data['objFace'];
|
||||
$partitionDepth = $data['partitionDepth'];
|
||||
$portID = $data['portID'];
|
||||
$portPopulated = $data['portPopulated'];
|
||||
|
||||
if($portPopulated) {
|
||||
$qls->SQL->insert(
|
||||
'app_populated_port',
|
||||
array(
|
||||
'object_id',
|
||||
'object_face',
|
||||
'object_depth',
|
||||
'port_id'
|
||||
),
|
||||
array(
|
||||
$objectID,
|
||||
$objectFace,
|
||||
$partitionDepth,
|
||||
$portID
|
||||
)
|
||||
);
|
||||
|
||||
// Log history
|
||||
$portName = $qls->App->generateObjectPortName($objectID, $objectFace, $partitionDepth, $portID);
|
||||
$actionString = 'Marked port as populated: <strong>'.$portName.'</strong>';
|
||||
$qls->App->logAction(2, 2, $actionString);
|
||||
|
||||
} else {
|
||||
$qls->SQL->delete(
|
||||
'app_populated_port',
|
||||
array(
|
||||
'object_id' => array('=', $objectID),
|
||||
'AND',
|
||||
'object_face' => array('=', $objectFace),
|
||||
'AND',
|
||||
'object_depth' => array('=', $partitionDepth),
|
||||
'AND',
|
||||
'port_id' => array('=', $portID)
|
||||
)
|
||||
);
|
||||
|
||||
// Log history
|
||||
$portName = $qls->App->generateObjectPortName($objectID, $objectFace, $partitionDepth, $portID);
|
||||
$actionString = 'Marked port as unpopulated: <strong>'.$portName.'</strong>';
|
||||
$qls->App->logAction(3, 2, $actionString);
|
||||
}
|
||||
}
|
||||
echo json_encode($validate->returnData);
|
||||
return;
|
||||
}
|
||||
|
||||
function validate($data, &$validate){
|
||||
|
||||
$objID = $data['objID'];
|
||||
$objFace = $data['objFace'];
|
||||
$objDepth = $data['partitionDepth'];
|
||||
$objPortID = $data['portID'];
|
||||
|
||||
//Validate object ID
|
||||
$validate->validateObjectID($objID);
|
||||
|
||||
//Validate object face
|
||||
$validate->validateObjectFace($objFace);
|
||||
|
||||
//Validate partition depth
|
||||
$validate->validatePartitionDepth($objDepth);
|
||||
|
||||
//Validate port ID
|
||||
$validate->validatePortID($objPortID, 'port ID');
|
||||
|
||||
//Validate endpoint port trunked
|
||||
$portArray = array(
|
||||
array($objID, $objFace, $objDepth, $objPortID)
|
||||
);
|
||||
$validate->validateTrunkedEndpoint($portArray);
|
||||
|
||||
//Validate port populated
|
||||
$validate->validateTrueFalse($data['portPopulated'], 'port populated flag');
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
@ -12,10 +12,10 @@ if($_SERVER['REQUEST_METHOD'] == 'GET'){
|
||||
foreach($qls->App->objectArray as $object) {
|
||||
if(strpos(strtolower($object['name']), strtolower($term)) !== false) {
|
||||
$obj = $qls->App->objectArray[$object['id']];
|
||||
$label = 'Explore - '.$obj['nameString'];
|
||||
$label = 'Explore - '.$qls->App->unConvertHyphens($obj['nameString']);
|
||||
$objID = $object['id'];
|
||||
$parentID = $object['env_tree_id'];
|
||||
$value = 'explore-'.$objID.'-'.$parentID;
|
||||
$value = 'explore-'.$parentID.'-'.$objID;
|
||||
array_push($autoCompleteData, array('label'=>$label, 'value'=>$value));
|
||||
}
|
||||
}
|
||||
@ -37,13 +37,31 @@ if($_SERVER['REQUEST_METHOD'] == 'GET'){
|
||||
foreach($qls->App->envTreeArray as $location) {
|
||||
if(strpos(strtolower($location['name']), strtolower($term)) !== false) {
|
||||
$locationID = $location['id'];
|
||||
$treePathString = $qls->App->buildTreePathString($locationID);
|
||||
$treePathString = $qls->App->unConvertHyphens($qls->App->buildTreePathString($locationID));
|
||||
$label = 'Environment - '.$treePathString;
|
||||
$value = 'environment-'.$locationID;
|
||||
array_push($autoCompleteData, array('label'=>$label, 'value'=>$value));
|
||||
}
|
||||
}
|
||||
|
||||
// Port Description
|
||||
foreach($qls->App->portDescriptionAllArray as $portDescription) {
|
||||
if(strpos(strtolower($portDescription['description']), strtolower($term)) !== false) {
|
||||
$objID = $portDescription['object_id'];
|
||||
$objFace = $portDescription['object_face'];
|
||||
$objDepth = $portDescription['object_depth'];
|
||||
$portID = $portDescription['port_id'];
|
||||
|
||||
$obj = $qls->App->objectArray[$objID];
|
||||
$parentID = $obj['env_tree_id'];
|
||||
|
||||
$portName = $qls->App->unConvertHyphens($qls->App->generateObjectPortName($objID, $objFace, $objDepth, $portID));
|
||||
$label = 'Port - '.$portName;
|
||||
$value = 'port-'.$parentID.'-'.$objID.'-'.$objFace.'-'.$objDepth.'-'.$portID;
|
||||
array_push($autoCompleteData, array('label'=>$label, 'value'=>$value));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($autoCompleteData);
|
||||
|
||||
} else if(isset($_GET['select'])) {
|
||||
@ -51,23 +69,30 @@ if($_SERVER['REQUEST_METHOD'] == 'GET'){
|
||||
$value = $_GET['select'];
|
||||
$data = explode('-', $value);
|
||||
$appFunction = $data[0];
|
||||
$subjectID = $data[1];
|
||||
|
||||
if($appFunction == 'explore') {
|
||||
$parentID = $data[2];
|
||||
header('Location: /explore.php?objID='.$subjectID.'&parentID='.$parentID);
|
||||
$parentID = $data[1];
|
||||
$objID = $data[2];
|
||||
header('Location: /explore.php?parentID='.$parentID.'&objID='.$objID);
|
||||
exit();
|
||||
} else if($appFunction == 'template') {
|
||||
header('Location: /templates.php?templateID='.$subjectID);
|
||||
$templateID = $data[1];
|
||||
header('Location: /templates.php?templateID='.$templateID);
|
||||
exit();
|
||||
} else if($appFunction == 'environment') {
|
||||
header('Location: /environment.php?nodeID='.$subjectID);
|
||||
$nodeID = $data[1];
|
||||
header('Location: /environment.php?nodeID='.$nodeID);
|
||||
exit();
|
||||
} else if($appFunction == 'port') {
|
||||
$parentID = $data[1];
|
||||
$objID = $data[2];
|
||||
$objFace = $data[3];
|
||||
$objDepth = $data[4];
|
||||
$portID = $data[5];
|
||||
header('Location: /explore.php?parentID='.$parentID.'&objID='.$objID.'&objFace='.$objFace.'&objDepth='.$objDepth.'&portID='.$portID);
|
||||
exit();
|
||||
}
|
||||
|
||||
} else if(isset($_GET['search'])) {
|
||||
$searchTerm = $_GET['search'];
|
||||
echo 'Search Term: '.$searchTerm.'<br><br>This function is in progress<br>Last updated: 4-May-2019';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,13 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||
|
||||
$peerPortArray = array();
|
||||
|
||||
// Retrieve port description
|
||||
if(isset($qls->App->portDescriptionArray[$objID][$objFace][$objDepth][$objPort])) {
|
||||
$portDescription = $qls->App->portDescriptionArray[$objID][$objFace][$objDepth][$objPort]['description'];
|
||||
} else {
|
||||
$portDescription = '';
|
||||
}
|
||||
|
||||
// Retrieve peer port ID
|
||||
if(isset($qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort])) {
|
||||
$port = $qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort];
|
||||
@ -92,7 +99,8 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||
'portOptions' => $portOptions,
|
||||
'peerPortArray' => $peerPortArray,
|
||||
'populatedChecked' => $populatedChecked,
|
||||
'populatedDisabled' => $populatedDisabled
|
||||
'populatedDisabled' => $populatedDisabled,
|
||||
'portDescription' => $portDescription
|
||||
);
|
||||
|
||||
$validate->returnData['success'] = $returnData;
|
||||
|
||||
10
explore.php
10
explore.php
@ -287,6 +287,16 @@ $qls->Security->check_auth_page('user.php');
|
||||
<input id="checkboxPopulated" type="checkbox" disabled>
|
||||
<label for="checkboxPopulated">Populated</label>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="objectDetailAlignRight">
|
||||
<strong>Description:  </strong>
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" id="inline-portDescription" data-type="text"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</blockquote>
|
||||
</div>
|
||||
|
||||
@ -282,6 +282,21 @@ var $qls;
|
||||
$this->mediaCategoryTypeArray[$row['value']] = $row;
|
||||
}
|
||||
|
||||
// Generate port description object
|
||||
$this->portDescriptionArray = array();
|
||||
$this->portDescriptionAllArray = array();
|
||||
$query = $this->qls->SQL->select('*', 'app_port_description');
|
||||
while($row = $this->qls->SQL->fetch_assoc($query)) {
|
||||
|
||||
$objID = $row['object_id'];
|
||||
$objFace = $row['object_face'];
|
||||
$objDepth = $row['object_depth'];
|
||||
$portID = $row['port_id'];
|
||||
|
||||
$this->portDescriptionArray[$objID][$objFace][$objDepth][$portID] = $row;
|
||||
$this->portDescriptionAllArray[$row['id']] = $row;
|
||||
}
|
||||
|
||||
$this->inventoryArray = array();
|
||||
$this->inventoryAllArray = array();
|
||||
$this->inventoryByIDArray = array();
|
||||
|
||||
@ -579,6 +579,7 @@ var $qls;
|
||||
|
||||
$this->update_queries();
|
||||
$this->last_query[] = $query;
|
||||
error_log('Debug: '.$query);
|
||||
mysqli_query($this->connection, $query) or die(mysqli_errno($this->connection) . ': ' . mysqli_error($this->connection));
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +104,8 @@ var $qls;
|
||||
$this->update_0313_to_0314();
|
||||
} else if($this->currentVersion == '0.3.14') {
|
||||
$this->update_0314_to_0315();
|
||||
} else if($this->currentVersion == '0.3.15') {
|
||||
$this->update_0315_to_0316();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -112,6 +114,50 @@ var $qls;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update from version 0.3.15 to 0.3.16
|
||||
* @return Boolean
|
||||
*/
|
||||
function update_0315_to_0316() {
|
||||
$incrementalVersion = '0.3.16';
|
||||
|
||||
// Set app version to 0.3.16
|
||||
$this->qls->SQL->update('app_organization_data', array('version' => $incrementalVersion), array('id' => array('=', 1)));
|
||||
|
||||
// Update password hash
|
||||
$query = $this->qls->SQL->query("SHOW COLUMNS FROM `qls_users` LIKE 'pwl'");
|
||||
if(!$this->qls->SQL->num_rows($query)) {
|
||||
|
||||
// Add pwl column
|
||||
$this->qls->SQL->alter('users', 'add', 'pwl', 'tinyint', true, 0);
|
||||
|
||||
// Grow password field to support changes in password_hash()
|
||||
$this->qls->SQL->query('ALTER TABLE `qls_users` CHANGE `password` `password` varchar(255)');
|
||||
|
||||
// Convert password hash
|
||||
$query = $this->qls->SQL->select('*', 'users');
|
||||
while($row = $this->qls->SQL->fetch_assoc($query)) {
|
||||
|
||||
$rowID = $row['id'];
|
||||
$password = $row['password'];
|
||||
$passwordHash = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
$this->qls->SQL->update('users', array('password' => $passwordHash, 'pwl' => true), array('id' => array('=', $rowID)));
|
||||
}
|
||||
}
|
||||
|
||||
// Add object port type
|
||||
$objectPortTypeColumns = array('value', 'name', 'category_type_id', 'defaultOption');
|
||||
$objectPortTypeValues = array(8, 'ST', 2, 0);
|
||||
$this->qls->SQL->insert('shared_object_portType', $objectPortTypeColumns, $objectPortTypeValues);
|
||||
|
||||
// Add cable connector type
|
||||
$connectorPortTypeColumns = array('value', 'name', 'defaultOption');
|
||||
$connectorPortTypeValues = array(8, 'ST', 0);
|
||||
$this->qls->SQL->insert('shared_cable_connectorType', $connectorPortTypeColumns, $connectorPortTypeValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update from version 0.3.14 to 0.3.15
|
||||
* @return Boolean
|
||||
|
||||
@ -130,27 +130,16 @@ var $qls;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the user's username from the database
|
||||
$users_result = $this->qls->SQL->select('*',
|
||||
'users',
|
||||
array('id' =>
|
||||
array(
|
||||
'=',
|
||||
$userID
|
||||
)
|
||||
)
|
||||
);
|
||||
$users_row = $this->qls->SQL->fetch_array($users_result);
|
||||
|
||||
$new_password = (isset($_POST['new_password']) && $this->validate_password($_POST['new_password'])) ? $this->qls->Security->make_safe($_POST['new_password']) : false;
|
||||
$new_password_confirm = (isset($_POST['new_password_confirm']) && $_POST['new_password_confirm'] == $_POST['new_password']) ? true : false;
|
||||
|
||||
if ($new_password !== false && $new_password_confirm !== false) {
|
||||
$password_hash = $this->generate_password_hash($new_password, $users_row['code']);
|
||||
|
||||
$password_hash = password_hash($new_password, PASSWORD_DEFAULT);
|
||||
|
||||
// Update the database
|
||||
$this->qls->SQL->update('users',
|
||||
array('password' => $password_hash),
|
||||
array('password' => $password_hash, 'pwl' => 0),
|
||||
array('id' =>
|
||||
array(
|
||||
'=',
|
||||
@ -408,17 +397,20 @@ var $qls;
|
||||
* @param string $user_code - The user's activation code
|
||||
* @return bool
|
||||
*/
|
||||
function compare_passwords($input_password, $real_password, $user_code) {
|
||||
// Generate the hash to compare them
|
||||
$input_hash = $this->generate_password_hash($input_password, $user_code);
|
||||
function compare_passwords($input_password, $real_password, $user_code, $pwl) {
|
||||
|
||||
// Actually compare them
|
||||
if ($input_hash == $real_password) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
if($pwl) {
|
||||
// Generate the legacy hash
|
||||
$input_hash = $this->generate_password_hash($input_password, $user_code);
|
||||
$password = $input_hash;
|
||||
} else {
|
||||
$password = $input_password;
|
||||
}
|
||||
|
||||
$passwordHash = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
return password_verify($password, $real_password);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -434,7 +426,7 @@ var $qls;
|
||||
|
||||
if ($user_info['id'] != '') {
|
||||
if ($user_info['tries'] < $this->qls->config['max_tries']) {
|
||||
if ($this->compare_passwords($password, $user_info['password'], $user_info['code'])) {
|
||||
if ($this->compare_passwords($password, $user_info['password'], $user_info['code'], $user_info['pwl'])) {
|
||||
if ($user_info['blocked'] == 'no') {
|
||||
// They need to be active
|
||||
if ($user_info['active'] == 'yes') {
|
||||
@ -507,7 +499,7 @@ var $qls;
|
||||
}
|
||||
}
|
||||
|
||||
function initialize_session($user_info, $auth_token_salt) {
|
||||
function initialize_session($user_info, $auth_token_salt) {
|
||||
$username = $user_info['username'];
|
||||
$password = $auth_token_salt;
|
||||
|
||||
@ -711,7 +703,7 @@ function initialize_session($user_info, $auth_token_salt) {
|
||||
// All the values that go with the columns
|
||||
$values = array(
|
||||
$username,
|
||||
$this->generate_password_hash($password, $generated_code),
|
||||
password_hash($password, PASSWORD_DEFAULT),
|
||||
$generated_code,
|
||||
'no',
|
||||
0,
|
||||
|
||||
@ -8,6 +8,21 @@ if($_SERVER['REQUEST_METHOD'] == 'GET'){
|
||||
echo '<input id="objID" type="hidden" value="'.$objID.'">';
|
||||
}
|
||||
|
||||
if(isset($_GET['objFace'])) {
|
||||
$objFace = $_GET['objFace'];
|
||||
echo '<input id="objFace" type="hidden" value="'.$objFace.'">';
|
||||
}
|
||||
|
||||
if(isset($_GET['objDepth'])) {
|
||||
$objDepth = $_GET['objDepth'];
|
||||
echo '<input id="objDepth" type="hidden" value="'.$objDepth.'">';
|
||||
}
|
||||
|
||||
if(isset($_GET['portID'])) {
|
||||
$portID = $_GET['portID'];
|
||||
echo '<input id="portID" type="hidden" value="'.$portID.'">';
|
||||
}
|
||||
|
||||
if(isset($_GET['parentID'])) {
|
||||
$parentID = $_GET['parentID'];
|
||||
echo '<input id="parentID" type="hidden" value="'.$parentID.'">';
|
||||
|
||||
@ -439,6 +439,7 @@ var $install_error = array();
|
||||
$user_code = sha1(sha1($c_hash[0] . $c_hash[1] . $c_hash[2] . $c_hash[3]) . sha1($c_hash[4] . $c_hash[5]) . md5($c_hash[6] . $c_hash[7] . $c_hash[8] . sha1($c_hash[9])) . $password . $email);
|
||||
|
||||
// Password generation
|
||||
/*
|
||||
$hash[] = md5($password);
|
||||
$hash[] = md5($password . $user_code);
|
||||
$hash[] = md5($password) . sha1($user_code . $password) . md5(md5($password));
|
||||
@ -446,6 +447,8 @@ var $install_error = array();
|
||||
$hash[] = md5($hash[3] . $hash[0] . $hash[1] . $hash[2] . sha1($hash[3] . $hash[2]));
|
||||
$hash[] = sha1($hash[0] . $hash[1] . $hash[2] . $hash[3]) . md5($hash[4] . $hash[4]) . sha1($user_code);
|
||||
$final_hash = sha1($hash[0] . $hash[1] . $hash[2] . $hash[3] . $hash[4] . $hash[5] . md5($user_code));
|
||||
*/
|
||||
$final_hash = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
$masks = array(
|
||||
"'Admin',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1",
|
||||
@ -683,7 +686,8 @@ var $install_error = array();
|
||||
"3, 'SC', 0",
|
||||
"4, 'Label', 0",
|
||||
"5, 'MPO-12', 0",
|
||||
"6, 'MPO-24', 0"
|
||||
"6, 'MPO-24', 0",
|
||||
"7, 'ST', 0"
|
||||
);
|
||||
|
||||
// Add cable connector type
|
||||
@ -812,7 +816,8 @@ var $install_error = array();
|
||||
"4, 'SFP', 4, 0",
|
||||
"5, 'QSFP', 4, 0",
|
||||
"6, 'MPO-12', 2, 0",
|
||||
"7, 'MPO-24', 2, 0"
|
||||
"7, 'MPO-24', 2, 0",
|
||||
"8, 'ST', 2, 0"
|
||||
);
|
||||
|
||||
// Add object port type
|
||||
|
||||
@ -60,6 +60,7 @@ CREATE TABLE `{database_prefix}users`(
|
||||
`treeSort` tinyint(4) DEFAULT '0' NOT NULL,
|
||||
`treeSortAdj` tinyint(4) DEFAULT '0' NOT NULL,
|
||||
`objSort` tinyint(4) DEFAULT '0' NOT NULL,
|
||||
`pwl` tinyint(4) DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX `users_idx` (`username`),
|
||||
INDEX `users_idx2` (`code`),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user