diff --git a/README.md b/README.md index 4b6684a89..2036919df 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ See instructions to run Wallos below. 0 9 * * * php /var/www/html/endpoints/cronjobs/sendnotifications.php >> /var/log/cron/sendnotifications.log 2>&1 */2 * * * * php /var/www/html/endpoints/cronjobs/sendverificationemails.php >> /var/log/cron/sendverificationemail.log 2>&1 */2 * * * * php /var/www/html/endpoints/cronjobs/sendresetpasswordemails.php >> /var/log/cron/sendresetpasswordemails.log 2>&1 +0 */6 * * * php /var/www/html/endpoints/cronjobs/checkforupdates.php >> /var/log/cron/checkforupdates.log 2>&1 ``` 5. If your web root is not `/var/www/html/` adjust the cronjobs above accordingly. diff --git a/admin.php b/admin.php index 414de6ca8..73c3bd57c 100644 --- a/admin.php +++ b/admin.php @@ -352,6 +352,21 @@ class="one-third" value="" /> +

+
+
+ + + + + + + +
+
+ +
+
diff --git a/endpoints/cronjobs/checkforupdates.php b/endpoints/cronjobs/checkforupdates.php index 32bcb64e7..e33b39656 100644 --- a/endpoints/cronjobs/checkforupdates.php +++ b/endpoints/cronjobs/checkforupdates.php @@ -1,10 +1,11 @@ [ - 'header' => "User-Agent: MyApp\r\n" + 'header' => "User-Agent: Wallos\r\n" ] ]; @@ -27,4 +28,13 @@ $db->exec("UPDATE admin SET latest_version = '$latestVersion'"); + +if (php_sapi_name() !== 'cli') { + include __DIR__ . '/../../includes/version.php'; + if (version_compare($latestVersion, $version) > 0) { + echo "New version available: $latestVersion"; + } else { + echo "No new version available, currently on $version"; + } +} ?> \ No newline at end of file diff --git a/endpoints/cronjobs/sendcancellationnotifications.php b/endpoints/cronjobs/sendcancellationnotifications.php index c24350871..0856e8b77 100644 --- a/endpoints/cronjobs/sendcancellationnotifications.php +++ b/endpoints/cronjobs/sendcancellationnotifications.php @@ -3,6 +3,7 @@ use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; +require_once 'validate.php'; require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php'; require __DIR__ . '/../../libs/PHPMailer/PHPMailer.php'; @@ -16,7 +17,9 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) { $userId = $userToNotify['id']; - echo "For user: " . $userToNotify['username'] . "
"; + if (php_sapi_name() !== 'cli') { + echo "For user: " . $userToNotify['username'] . "
"; + } $emailNotificationsEnabled = false; $gotifyNotificationsEnabled = false; @@ -110,7 +113,9 @@ // If no notifications are enabled, no need to run if (!$notificationsEnabled) { - echo "Notifications are disabled. No need to run.
"; + if (php_sapi_name() !== 'cli') { + echo "Notifications are disabled. No need to run.
"; + } continue; } else { // Get all currencies @@ -460,7 +465,9 @@ } } else { - echo "Nothing to notify.
"; + if (php_sapi_name() !== 'cli') { + echo "Nothing to notify.
"; + } } } diff --git a/endpoints/cronjobs/sendnotifications.php b/endpoints/cronjobs/sendnotifications.php index 1298b399f..0c5a5b331 100644 --- a/endpoints/cronjobs/sendnotifications.php +++ b/endpoints/cronjobs/sendnotifications.php @@ -3,14 +3,17 @@ use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; +require_once 'validate.php'; require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php'; require __DIR__ . '/../../libs/PHPMailer/PHPMailer.php'; require __DIR__ . '/../../libs/PHPMailer/SMTP.php'; require __DIR__ . '/../../libs/PHPMailer/Exception.php'; -$date = new DateTime('now'); -echo "\n" . $date->format('Y-m-d') . " " . $date->format('H:i:s') . "
\n"; +if (php_sapi_name() == 'cli') { + $date = new DateTime('now'); + echo "\n" . $date->format('Y-m-d') . " " . $date->format('H:i:s') . "
\n"; +} // Get all user ids $query = "SELECT id, username FROM user"; @@ -19,7 +22,9 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) { $userId = $userToNotify['id']; - echo "\nFor user: " . $userToNotify['username'] . "
"; + if (php_sapi_name() !== 'cli') { + echo "\nFor user: " . $userToNotify['username'] . "
"; + } $days = 1; $emailNotificationsEnabled = false; @@ -145,7 +150,9 @@ // If no notifications are enabled, no need to run if (!$notificationsEnabled) { - echo "Notifications are disabled. No need to run.
"; + if (php_sapi_name() !== 'cli') { + echo "Notifications are disabled. No need to run.
"; + } continue; } else { // Get all currencies @@ -573,7 +580,9 @@ } else { - echo "Nothing to notify.
"; + if (php_sapi_name() !== 'cli') { + echo "Nothing to notify.
"; + } } } diff --git a/endpoints/cronjobs/sendresetpasswordemails.php b/endpoints/cronjobs/sendresetpasswordemails.php index 901d625f7..c25c41f4b 100644 --- a/endpoints/cronjobs/sendresetpasswordemails.php +++ b/endpoints/cronjobs/sendresetpasswordemails.php @@ -3,6 +3,7 @@ use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; +require_once 'validate.php'; require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php'; $query = "SELECT * FROM admin"; @@ -72,10 +73,16 @@ } } else { // There are no SMTP settings + if (php_sapi_name() !== 'cli') { + echo "SMTP settings are not configured. Please configure SMTP settings in the admin page."; + } exit(); } } else { // There are no password reset emails to be sent + if (php_sapi_name() !== 'cli') { + echo "There are no password reset emails to be sent."; + } exit(); } diff --git a/endpoints/cronjobs/sendverificationemails.php b/endpoints/cronjobs/sendverificationemails.php index 1322f130c..aab55bda8 100644 --- a/endpoints/cronjobs/sendverificationemails.php +++ b/endpoints/cronjobs/sendverificationemails.php @@ -3,6 +3,7 @@ use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; +require_once 'validate.php'; require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php'; $query = "SELECT * FROM admin"; @@ -11,7 +12,10 @@ $admin = $result->fetchArray(SQLITE3_ASSOC); if ($admin['require_email_verification'] == 0) { - die("Email verification is not required."); + if (php_sapi_name() !== 'cli') { + echo "Email verification is not required."; + } + die(); } $query = "SELECT * FROM email_verification WHERE email_sent = 0"; @@ -75,10 +79,16 @@ } } else { // There are no SMTP settings + if (php_sapi_name() !== 'cli') { + echo "SMTP settings are not configured. Please configure SMTP settings in the admin page."; + } exit(); } } else { // There are no verification emails to be sent + if (php_sapi_name() !== 'cli') { + echo "No verification emails to be sent."; + } exit(); } diff --git a/endpoints/cronjobs/updateexchange.php b/endpoints/cronjobs/updateexchange.php index 40f61969a..3af408be3 100644 --- a/endpoints/cronjobs/updateexchange.php +++ b/endpoints/cronjobs/updateexchange.php @@ -1,8 +1,14 @@ format('Y-m-d') . " " . $date->format('H:i:s') . "
\n"; +} + $query = "SELECT id, username FROM user"; $stmt = $db->prepare($query); $usersToUpdateExchange = $stmt->execute(); diff --git a/endpoints/cronjobs/updatenextpayment.php b/endpoints/cronjobs/updatenextpayment.php index 70ad02806..308b86274 100644 --- a/endpoints/cronjobs/updatenextpayment.php +++ b/endpoints/cronjobs/updatenextpayment.php @@ -1,7 +1,13 @@ format('Y-m-d') . " " . $date->format('H:i:s') . "
\n"; +} + $currentDate = new DateTime(); $currentDateString = $currentDate->format('Y-m-d'); diff --git a/endpoints/cronjobs/validate.php b/endpoints/cronjobs/validate.php new file mode 100644 index 000000000..d22dbdae9 --- /dev/null +++ b/endpoints/cronjobs/validate.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/includes/i18n/de.php b/includes/i18n/de.php index 398aa08b7..c36d16faa 100644 --- a/includes/i18n/de.php +++ b/includes/i18n/de.php @@ -316,6 +316,7 @@ "latest_version" => "Neueste Version", "on_current_version" => "Sie verwenden die neueste Version von Wallos.", "show_update_notification" => "Benachrichtigung über Updates auf dem Dashboard anzeigen", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "E-Mail verifiziert", "email_verification_failed" => "E-Mail konnte nicht verifiziert werden", diff --git a/includes/i18n/el.php b/includes/i18n/el.php index b0c3bf44f..6f65ba553 100644 --- a/includes/i18n/el.php +++ b/includes/i18n/el.php @@ -316,6 +316,7 @@ "latest_version" => "Τελευταία Έκδοση", "on_current_version" => "Χρησιμοποιείτε την τελευταία έκδοση του Wallos.", "show_update_notification" => "Εμφάνιση ειδοποίησης για ενημερώσεις στο dashboard", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "Το email επιβεβαιώθηκε", "email_verification_failed" => "Η επαλήθευση email απέτυχε", diff --git a/includes/i18n/en.php b/includes/i18n/en.php index 6e84637ea..a1f1b06af 100644 --- a/includes/i18n/en.php +++ b/includes/i18n/en.php @@ -316,6 +316,7 @@ "latest_version" => "Latest Version", "on_current_version" => "You're running the latest version of Wallos.", "show_update_notification" => "Show notification for updates on the dashboard", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "Email verified successfully", "email_verification_failed" => "Email verification failed", diff --git a/includes/i18n/es.php b/includes/i18n/es.php index 2ce4ef698..2187da141 100644 --- a/includes/i18n/es.php +++ b/includes/i18n/es.php @@ -316,6 +316,7 @@ "latest_version" => "Última Versión", "on_current_version" => "Está utilizando la última versión de Wallos.", "show_update_notification" => "Mostrar notificación de actualizaciones en el dashboard", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "Correo electrónico verificado", "email_verification_failed" => "Error al verificar el correo electrónico", diff --git a/includes/i18n/fr.php b/includes/i18n/fr.php index cba8f0704..e3a42b591 100644 --- a/includes/i18n/fr.php +++ b/includes/i18n/fr.php @@ -316,6 +316,7 @@ "latest_version" => "Dernière version", "on_current_version" => "Vous utilisez la dernière version de Wallos.", "show_update_notification" => "Afficher la notification de mise à jour sur le tableau de bord", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "Votre adresse courriel a été vérifiée avec succès", "email_verification_failed" => "La vérification de l'adresse courriel a échoué", diff --git a/includes/i18n/it.php b/includes/i18n/it.php index ff441ef26..19fdfa6ae 100644 --- a/includes/i18n/it.php +++ b/includes/i18n/it.php @@ -335,6 +335,7 @@ "latest_version" => "Ultima versione", "on_current_version" => "Stai utilizzando l'ultima versione di Wallos.", "show_update_notification" => "Mostra notifica di aggiornamento sulla dashboard", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "L'indirizzo email è stato verificato con successo", diff --git a/includes/i18n/jp.php b/includes/i18n/jp.php index 5c9be3c2e..a84d8c81f 100644 --- a/includes/i18n/jp.php +++ b/includes/i18n/jp.php @@ -309,6 +309,7 @@ "latest_version" => "最新バージョン", "on_current_version" => "最新バージョンのWallosを使用しています。", "show_update_notification" => "ダッシュボードに更新通知を表示する", + "cronjobs" => "クロンジョブズ", // Email Verification "email_verified" => "メールアドレスが確認されました", "email_verification_failed" => "メールアドレスの確認に失敗しました", diff --git a/includes/i18n/ko.php b/includes/i18n/ko.php index d1eff9fb4..59efc08ae 100644 --- a/includes/i18n/ko.php +++ b/includes/i18n/ko.php @@ -317,6 +317,7 @@ "latest_version" => "최신 버전", "on_current_version" => "최신 버전의 Wallos를 사용 중입니다.", "show_update_notification" => "대시보드에 업데이트 알림 표시", + "cronjobs" => "크론잡", // Email Verification "email_verified" => "이메일 인증 완료", "email_verification_failed" => "이메일 인증 실패", diff --git a/includes/i18n/pl.php b/includes/i18n/pl.php index fa402cbe7..fb5da2896 100644 --- a/includes/i18n/pl.php +++ b/includes/i18n/pl.php @@ -316,6 +316,7 @@ "latest_version" => "Najnowsza wersja", "on_current_version" => "Używasz najnowszej wersji Wallos.", "show_update_notification" => "Pokaż powiadomienie o aktualizacjach na dashboardzie", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "E-mail został zweryfikowany", "email_verification_failed" => "Weryfikacja e-maila nie powiodła się", diff --git a/includes/i18n/pt.php b/includes/i18n/pt.php index ad2895c0e..1622572ef 100644 --- a/includes/i18n/pt.php +++ b/includes/i18n/pt.php @@ -316,6 +316,7 @@ "latest_version" => "Última Versão", "on_current_version" => "Está a usar a versão mais recente do Wallos.", "show_update_notification" => "Mostrar notificação de atualizações no dashboard", + "Cronjobs" => "Cronjobs", // Email Verification "email_verified" => "Email verificado", "email_verification_failed" => "Verificação de email falhou", diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.php index aa054e17c..040418ccb 100644 --- a/includes/i18n/pt_br.php +++ b/includes/i18n/pt_br.php @@ -316,6 +316,7 @@ "latest_version" =>"Última versão", "on_current_version" => "Você está na última versão do Wallos.", "show_update_notification" => "Mostrar notificação de atualização no dashboard", + "Cronjobs" => "Cronjobs", // Email Verification "email_verified" => "Email verificado", "email_verification_failed" => "Falha na verificação do email", diff --git a/includes/i18n/ru.php b/includes/i18n/ru.php index fb78e8771..b8be5bba4 100644 --- a/includes/i18n/ru.php +++ b/includes/i18n/ru.php @@ -316,6 +316,7 @@ "latest_version" => "Последняя версия", "on_current_version" => "Вы используете последнюю версию Wallos.", "show_update_notification" => "Показывать уведомление об обновлениях на дашборде", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "Ваш адрес электронной почты подтвержден. Теперь вы можете войти.", "email_verification_failed" => "Не удалось подтвердить ваш адрес электронной почты.", diff --git a/includes/i18n/sl.php b/includes/i18n/sl.php index c1960c790..16145e081 100644 --- a/includes/i18n/sl.php +++ b/includes/i18n/sl.php @@ -309,6 +309,7 @@ "latest_version" => "Najnovejša različica", "on_current_version" => "Uporabljate najnovejšo različico Wallos.", "show_update_notification" => "Prikaži obvestilo o posodobitvah na dashboardu", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "E-pošta je bila uspešno preverjena", "email_verification_failed" => "Preverjanje e-pošte ni uspelo", diff --git a/includes/i18n/sr.php b/includes/i18n/sr.php index 3f17d6278..1e04ac3cd 100644 --- a/includes/i18n/sr.php +++ b/includes/i18n/sr.php @@ -316,6 +316,7 @@ "latest_version" => "Најновија верзија", "on_current_version" => "Користите најновију верзију Wallos-а.", "show_update_notification" => "Прикажи обавештење о ажурирањима на dashboardu", + "cronjobs" => "Цроњобс", // Email Verification "email_verified" => "Е-пошта је верификована", "email_verification_failed" => "Верификација е-поште није успела", diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.php index fd0e30afc..4f42e82b0 100644 --- a/includes/i18n/sr_lat.php +++ b/includes/i18n/sr_lat.php @@ -316,6 +316,7 @@ "latest_version" => "Najnovija verzija", "on_current_version" => "Koristite najnoviju verziju Wallos-a.", "show_update_notification" => "Prikaži obaveštenje o ažuriranjima na dashboardu", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "E-pošta je uspešno verifikovana", "email_verification_failed" => "Verifikacija e-pošte nije uspela", diff --git a/includes/i18n/tr.php b/includes/i18n/tr.php index c589c2528..1c5baf6a5 100644 --- a/includes/i18n/tr.php +++ b/includes/i18n/tr.php @@ -316,6 +316,7 @@ "latest_version" => "En Son Sürüm", "on_current_version" => "Wallos'un en son sürümünü kullanıyorsunuz.", "show_update_notification" => "Gösterge panelinde güncelleme bildirimini göster", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "E-posta doğrulandı", "email_verification_failed" => "E-posta doğrulaması başarısız oldu", diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.php index 3ded75a24..aee47e3cc 100644 --- a/includes/i18n/zh_cn.php +++ b/includes/i18n/zh_cn.php @@ -334,6 +334,7 @@ "latest_version" => "最新版本", "on_current_version" => "您正在运行最新版本的 Wallos。", "show_update_notification" => "在仪表板上显示更新通知", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "电子邮件已验证", diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.php index 11a79223d..be1e81163 100644 --- a/includes/i18n/zh_tw.php +++ b/includes/i18n/zh_tw.php @@ -316,6 +316,7 @@ "latest_version" => "最新版本", "on_current_version" => "您正在運行最新版本的 Wallos。", "show_update_notification" => "在儀表板上顯示更新通知", + "cronjobs" => "Cronjobs", // Email Verification "email_verified" => "電子郵件已驗證", "email_verification_failed" => "電子郵件驗證失敗", diff --git a/includes/version.php b/includes/version.php index 3dadda18d..d5d110e22 100644 --- a/includes/version.php +++ b/includes/version.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/scripts/admin.js b/scripts/admin.js index 8a267515a..b7a00d9f4 100644 --- a/scripts/admin.js +++ b/scripts/admin.js @@ -314,4 +314,22 @@ function toggleUpdateNotification() { }) .catch(error => showErrorMessage('Error:', error)); +} + +function executeCronJob(job) { + const url = `endpoints/cronjobs/${job}.php`; + const resultTextArea = document.getElementById('cronjobResult'); + + fetch(url) + .then(response => { + return response.text(); + }) + .then(data => { + const formattedData = data.replace(//gi, '\n'); + resultTextArea.value = formattedData; + }) + .catch(error => { + console.error('Fetch error:', error); + showErrorMessage('Error:', error); + }); } \ No newline at end of file diff --git a/startup.sh b/startup.sh index 46d08756f..7400b1799 100644 --- a/startup.sh +++ b/startup.sh @@ -43,5 +43,8 @@ crontab -d -u root # Run updateexchange.php /usr/local/bin/php /var/www/html/endpoints/cronjobs/updateexchange.php +# Run checkforupdates.php +/usr/local/bin/php /var/www/html/endpoints/cronjobs/checkforupdates.php + # Keep the container running indefinitely (this won't exit) tail -f /dev/null \ No newline at end of file diff --git a/styles/styles.css b/styles/styles.css index caff7e223..7db731549 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -1054,6 +1054,14 @@ header #avatar { flex-basis: 50%; } +.inline { + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 15px; + margin-bottom: 20px; +} + @media (max-width: 768px) { .form-group .inline .mobile-split-50 { flex-basis: 50%;