Skip to content

Commit

Permalink
2.11.20 Adding view account profile
Browse files Browse the repository at this point in the history
  • Loading branch information
webpwnized committed Sep 30, 2024
1 parent b2ae097 commit 2239e55
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/set-up-database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1281,28 +1281,26 @@ function format($pMessage, $pLevel ) {
if (!is_dir(pathinfo($lPasswordFilePath, PATHINFO_DIRNAME))) {
throw new Exception("Oh no. Trying to create a text version of the accounts file did not work out. The directory " . $lPasswordFilePath . " does not exist.");
}

if (!is_writable(pathinfo($lAccountXMLFilePath, PATHINFO_DIRNAME))) {
throw new Exception("Oh no. Trying to create a text version of the accounts file did not work out. The directory " . $lPasswordFilePath . " is not writable.");
}
if (!is_writable(pathinfo($lPasswordFilePath, PATHINFO_DIRNAME))) {
throw new Exception("Oh no. Trying to create a text version of the accounts file did not work out. The directory " . $lPasswordFilePath . " is not writable.");
}

// XML File Writing
try {
if (is_writable(pathinfo($lAccountXMLFilePath, PATHINFO_DIRNAME))) {
file_put_contents($lAccountXMLFilePath, $lAccountsXML);
echo format("Wrote accounts to " . $lAccountXMLFilePath, "S");
} else {
throw new Exception("Oh snap. Trying to create an XML version of the accounts file did not work out.");
}
file_put_contents($lAccountXMLFilePath, $lAccountsXML);
echo format("Wrote accounts to " . $lAccountXMLFilePath, "S");
} catch (Exception $e) {
echo format("Could not write accounts XML to " . $lAccountXMLFilePath . " - " . $e->getMessage(), "W");
echo format("Using default version of accounts.xml", "W");
}

// Text File Writing
try {
if (is_writable(pathinfo($lPasswordFilePath, PATHINFO_DIRNAME))) {
file_put_contents($lPasswordFilePath, $lAccountsText);
echo format("Wrote accounts to " . $lPasswordFilePath, "S");
} else {
throw new Exception("Oh snap. Trying to create a text version of the accounts file did not work out.");
}
file_put_contents($lPasswordFilePath, $lAccountsText);
echo format("Wrote accounts to " . $lPasswordFilePath, "S");
} catch (Exception $e) {
echo format("Could not write accounts text to " . $lPasswordFilePath . " - " . $e->getMessage(), "W");
echo format("Using default version of accounts.txt", "W");
Expand Down

0 comments on commit 2239e55

Please sign in to comment.