From b22773176290781ef9cf98b6c4fa8668772601f9 Mon Sep 17 00:00:00 2001 From: Garrett Date: Wed, 5 May 2021 04:25:03 +0000 Subject: [PATCH] 0.3.16 --- assets/pages/jquery.explore.js | 68 ++++++++- backend/process_port.php | 191 ++++++++++++++++++++++++++ backend/process_port_populated.php | 101 -------------- backend/process_search.php | 47 +++++-- backend/retrieve_port_details.php | 10 +- explore.php | 10 ++ includes/App.class.php | 15 ++ includes/MySQLie.class.php | 1 + includes/Update.class.php | 46 +++++++ includes/User.class.php | 46 +++---- includes/content-build-serverData.php | 15 ++ install/Install.class.php | 11 +- install/schemas/mysql.sql | 1 + 13 files changed, 416 insertions(+), 146 deletions(-) create mode 100755 backend/process_port.php delete mode 100755 backend/process_port_populated.php diff --git a/assets/pages/jquery.explore.js b/assets/pages/jquery.explore.js index 54311ec..a180b12 100755 --- a/assets/pages/jquery.explore.js +++ b/assets/pages/jquery.explore.js @@ -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(); - var selection = $(parentObject).find('[data-template-object-id='+objID+'][data-object-face=0]').children('.selectable:first'); + 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); diff --git a/backend/process_port.php b/backend/process_port.php new file mode 100755 index 0000000..2839f47 --- /dev/null +++ b/backend/process_port.php @@ -0,0 +1,191 @@ +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: '.$portName.''; + $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: '.$portName.''; + $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: '.$portName.' - '.$descriptionOrig.''; + } else { + + $qls->SQL->update('app_port_description', array('description' => $descriptionNew), array('id' => array('=', $descriptionID))); + $actionVerb = 2; + $actionString = 'Changed port description: '.$portName.' - from '.$descriptionOrig.' to '.$descriptionNew.''; + } + } 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: '.$portName.' - '.$descriptionNew.''; + } + } + + $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; +} +?> diff --git a/backend/process_port_populated.php b/backend/process_port_populated.php deleted file mode 100755 index 1c30fb3..0000000 --- a/backend/process_port_populated.php +++ /dev/null @@ -1,101 +0,0 @@ -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: '.$portName.''; - $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: '.$portName.''; - $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; -} -?> diff --git a/backend/process_search.php b/backend/process_search.php index ed58f90..57d5617 100755 --- a/backend/process_search.php +++ b/backend/process_search.php @@ -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.'

This function is in progress
Last updated: 4-May-2019'; } } diff --git a/backend/retrieve_port_details.php b/backend/retrieve_port_details.php index d11314f..6b3ddbf 100755 --- a/backend/retrieve_port_details.php +++ b/backend/retrieve_port_details.php @@ -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; diff --git a/explore.php b/explore.php index 0f912d0..ea3a54d 100755 --- a/explore.php +++ b/explore.php @@ -287,6 +287,16 @@ $qls->Security->check_auth_page('user.php'); + + + + + +
+ Description:   + + +
diff --git a/includes/App.class.php b/includes/App.class.php index fc62a87..67e1158 100755 --- a/includes/App.class.php +++ b/includes/App.class.php @@ -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(); diff --git a/includes/MySQLie.class.php b/includes/MySQLie.class.php index dae357a..bf75110 100755 --- a/includes/MySQLie.class.php +++ b/includes/MySQLie.class.php @@ -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)); } diff --git a/includes/Update.class.php b/includes/Update.class.php index 5137276..93295d6 100755 --- a/includes/Update.class.php +++ b/includes/Update.class.php @@ -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 diff --git a/includes/User.class.php b/includes/User.class.php index 5be1bee..8aae91c 100755 --- a/includes/User.class.php +++ b/includes/User.class.php @@ -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); - - // Actually compare them - if ($input_hash == $real_password) { - return true; - } - else { - return false; + function compare_passwords($input_password, $real_password, $user_code, $pwl) { + + 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, diff --git a/includes/content-build-serverData.php b/includes/content-build-serverData.php index bb9cd6c..9f34123 100755 --- a/includes/content-build-serverData.php +++ b/includes/content-build-serverData.php @@ -8,6 +8,21 @@ if($_SERVER['REQUEST_METHOD'] == 'GET'){ echo ''; } + if(isset($_GET['objFace'])) { + $objFace = $_GET['objFace']; + echo ''; + } + + if(isset($_GET['objDepth'])) { + $objDepth = $_GET['objDepth']; + echo ''; + } + + if(isset($_GET['portID'])) { + $portID = $_GET['portID']; + echo ''; + } + if(isset($_GET['parentID'])) { $parentID = $_GET['parentID']; echo ''; diff --git a/install/Install.class.php b/install/Install.class.php index 7a3ee5a..cce962d 100755 --- a/install/Install.class.php +++ b/install/Install.class.php @@ -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,7 +447,9 @@ 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", "'{$default_mask_name}',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", @@ -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 diff --git a/install/schemas/mysql.sql b/install/schemas/mysql.sql index 879ddb3..ef112db 100755 --- a/install/schemas/mysql.sql +++ b/install/schemas/mysql.sql @@ -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`),