Skip to content

Commit

Permalink
Merge pull request #60 from thecodingaviator/functioncomments
Browse files Browse the repository at this point in the history
css comments and function headers
  • Loading branch information
gordoncd authored Jul 24, 2023
2 parents ded87fe + bd7fa42 commit b62fb79
Show file tree
Hide file tree
Showing 18 changed files with 885 additions and 655 deletions.
12 changes: 12 additions & 0 deletions mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

/**
* Sends an email using PHPMailer.
*
* @param string $subject: The subject of the email.
* @param string $content: The content of the email.
* @param string $recipient: The recipient's email address.
* @param string $password: The sender's email password.
*
* @return bool Returns true if the mail was successfully sent, false otherwise.
*
* @throws Exception If there is an error while sending the email.
*/
function sendMail($subject, $content, $recipient, $password){
$mail = new PHPMailer(true);
try {
Expand Down
24 changes: 24 additions & 0 deletions modify.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
$institution = $user['Institution'];
}

/**
* Updates a user's info in the database.
*
* @param string $password The user's password.
* @param string $email The user's new email.
* @param string $phone The user's new phone number.
* @param string $title The user's new job title.
* @param MySQLi $conn A MySQLi connection object to the database.
*
* @global string $update_status A message indicating the status of the profile update.
*
* @return void
*/
function changeUserInfo($password, $email, $phone, $title, $conn)
{
$user_id = $_SESSION['user_id'];
Expand Down Expand Up @@ -66,6 +79,17 @@ function changeUserInfo($password, $email, $phone, $title, $conn)
}
}

/**
* Updates a user's password in the database.
*
* @param string $current_password The user's current password.
* @param string $new_password The user's new password.
* @param MySQLi $conn A MySQLi connection object to the database.
*
* @global string $update_status A message indicating the status of the password update.
*
* @return void
*/
function updatePassword($current_password, $new_password, $conn)
{
//retrieve user info
Expand Down
12 changes: 12 additions & 0 deletions record_RD.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
//Last modified: 07/24/2023
//Purpose: Record Research Data to operational drive


/**
* Inserts a new record into the `C3DataMasterTest` table in the database using the data from a form submission.
*
* @param MySQLi $conn The MySQLi connection object to the database.
* @param array $post_data The array of form data to be inserted into the database.
* @param string $user_id The user's id.
*
* @return string $error The error message, if any error occurred while inserting the data into the database. Empty if no errors occurred.
*
* @throws PDOException If there is an error executing the SQL statement.
*/
function fieldsToDataMasterSQL($conn, $post_data, $user_id)
{
$error = "";
Expand Down
8 changes: 7 additions & 1 deletion resetpassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

include "utils/config.php";
include "mail.php";
function generateTemporaryPassword()

/**
* Generates a temporary password consisting of 8 alphanumeric characters.
*
* @return string Returns a temporary password.
*/
function generateTemporaryPassword() : string
{
$length = 8;
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
Expand Down
122 changes: 67 additions & 55 deletions utils/css/dashboard-common.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions utils/css/dashboard.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


/* dashboard welcome row formatting */
.welcome-row{
display: flex;
align-items: center;
Expand Down
Loading

0 comments on commit b62fb79

Please sign in to comment.