Skip to content

Commit

Permalink
add lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoey2936 committed Jun 1, 2024
1 parent 13bbce2 commit 7bf48d9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint
on:
push:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: lint
run: |
cd src
find . -name "*.php" -exec php -l {} \;
curl -sSfL https://github.com/wapmorgan/PhpDeprecationDetector/releases/download/"$(git ls-remote --tags https://github.com/wapmorgan/PhpDeprecationDetector | cut -d/ -f3 | grep -v v1 | sort -V | tail -1)"/phpdd-"$(git ls-remote --tags https://github.com/wapmorgan/PhpDeprecationDetector | cut -d/ -f3 | grep -v v1 | sort -V | tail -1)".phar -o phpdd.phar
chmod +x phpdd.phar
find . -name "*.php" -exec ./phpdd.phar -n {} \;
curl -sSfL https://github.com/vimeo/psalm/releases/latest/download/psalm.phar -o psalm.phar
chmod +x psalm.phar
./psalm.phar --no-cache
20 changes: 20 additions & 0 deletions src/psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<file name="config.php" />
<directory name="functions" />
<directory name="public" />
<directory name="require" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
4 changes: 2 additions & 2 deletions src/public/auth/login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
header("Location: /", true, 307);
exit();
} else {
require_once __DIR__ . "/../../../functions/email.php";
require_once __DIR__ . "/../../../functions/totp.php";
session_unset(); ?>
<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -57,7 +59,6 @@ function login($msg): void
if (!array_key_exists("email", $_POST) || !array_key_exists("pswd", $_POST)) {
login("none");
} else {
require_once __DIR__ . "/../../../functions/email.php";
$_SESSION["LOGIN_TIME"] = time();
$query = $db->prepare("SELECT * FROM auth WHERE email=:email");
$query->bindValue(":email", $_POST["email"]);
Expand All @@ -78,7 +79,6 @@ function login($msg): void
sendMail($_POST["email"], "Failed Login", $_SERVER["REMOTE_ADDR"] . " failed to login into your account.");
login("mtotp");
} else {
require_once __DIR__ . "/../../../functions/totp.php";
if ($_POST["totp"] === totp($queryresult["totp"])) {
sendMail($_POST["email"], "New Login", $_SERVER["REMOTE_ADDR"] . " logged into your account");
$_SESSION["AUTH_EMAIL"] = $_POST["email"];
Expand Down

0 comments on commit 7bf48d9

Please sign in to comment.