added premium promotion, dropmail.php, dropattach.php, minor update of other files
This commit is contained in:
@@ -66,6 +66,10 @@ class Action extends Component
|
||||
|
||||
private function showAlert($type, $message): void
|
||||
{
|
||||
$check = json_decode(config('app.settings.configuration_settings'))->email_limit;
|
||||
if (strpos($message, $check) !== false) {
|
||||
$this->dispatch('promotePremium');
|
||||
}
|
||||
$this->dispatch('showAlert', ['type' => $type, 'message' => $message]);
|
||||
}
|
||||
|
||||
|
||||
24
cleanCron.php
Normal file
24
cleanCron.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
// Adjust this path if your file location is different
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// Bootstrap the Laravel application
|
||||
$app = require_once __DIR__ . '/bootstrap/app.php';
|
||||
|
||||
// Make the Console Kernel instance
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
|
||||
try {
|
||||
// Run the Artisan command 'ping'
|
||||
$exitCode = $kernel->call('cleanMail');
|
||||
|
||||
// Get the output of the command
|
||||
$output = $kernel->output();
|
||||
|
||||
echo "Artisan command 'schedule:run' executed successfully. Exit code: $exitCode\n";
|
||||
echo "Output:\n$output";
|
||||
|
||||
} catch (\Exception $e) {
|
||||
echo "Error running Artisan command: " . $e->getMessage();
|
||||
}
|
||||
41
dropattach.php
Normal file
41
dropattach.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
function deleteFiles($dir) {
|
||||
// Open the directory
|
||||
if ($handle = opendir($dir)) {
|
||||
// Loop through each file in the directory
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
$filePath = $dir . DIRECTORY_SEPARATOR . $file;
|
||||
// If it's a directory, recursively call deleteFiles
|
||||
if (is_dir($filePath)) {
|
||||
deleteFiles($filePath);
|
||||
} else {
|
||||
// It's a file, attempt to delete it
|
||||
if (unlink($filePath)) {
|
||||
echo "File '$file' deleted successfully.<br>";
|
||||
} else {
|
||||
echo "Error deleting file '$file'.<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Close the directory handle
|
||||
closedir($handle);
|
||||
// Attempt to remove the directory itself
|
||||
if (rmdir($dir)) {
|
||||
echo "Directory '$dir' deleted successfully.<br>";
|
||||
} else {
|
||||
echo "Error deleting directory '$dir'.<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$folderPath = '/home/u146541135/domains/zemail.me/public_html/public/tmp/attachments/';
|
||||
|
||||
// Ensure the folder path exists and is a directory
|
||||
if (is_dir($folderPath)) {
|
||||
deleteFiles($folderPath);
|
||||
} else {
|
||||
echo "Folder '$folderPath' does not exist or is not a directory.";
|
||||
}
|
||||
?>
|
||||
51
dropmail.php
Normal file
51
dropmail.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
set_time_limit(0);
|
||||
|
||||
$newTimezone = 'Europe/London';
|
||||
date_default_timezone_set($newTimezone);
|
||||
|
||||
$imapDB = json_decode(config('app.settings.imap_settings'), true);
|
||||
|
||||
// Mailbox credentials
|
||||
$hostname = '{'.$imapDB['host'].':'.$imapDB['premium_port'].'/ssl}INBOX';
|
||||
$username = $imapDB['username'];
|
||||
$password = $imapDB['password'];
|
||||
|
||||
// Connect to mailbox
|
||||
$inbox = imap_open($hostname, $username, $password);
|
||||
|
||||
// Check for connection errors
|
||||
if (!$inbox) {
|
||||
die('Could not connect to mailbox: ' . imap_last_error());
|
||||
}
|
||||
|
||||
// Get current time in Unix timestamp
|
||||
$current_time = time();
|
||||
|
||||
// Search for messages older than one day
|
||||
$search_criteria = 'BEFORE "' . date('d-M-Y', strtotime('-3 hours', $current_time)) . '"';
|
||||
$messages = imap_search($inbox, $search_criteria);
|
||||
|
||||
$batch_size = 10;
|
||||
$deleted_count = 0;
|
||||
|
||||
if ($messages) {
|
||||
$chunks = array_chunk($messages, $batch_size);
|
||||
foreach ($chunks as $chunk) {
|
||||
foreach ($chunk as $message_number) {
|
||||
imap_delete($inbox, $message_number);
|
||||
}
|
||||
imap_expunge($inbox);
|
||||
$deleted_count += count($chunk);
|
||||
}
|
||||
echo $deleted_count . ' messages older than specified time have been deleted.';
|
||||
} else {
|
||||
echo 'No messages older than specified time found in mailbox.';
|
||||
}
|
||||
|
||||
// Close mailbox connection
|
||||
imap_close($inbox);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -11,12 +11,12 @@ $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
|
||||
try {
|
||||
// Run the Artisan command 'ping'
|
||||
$exitCode = $kernel->call('ping');
|
||||
$exitCode = $kernel->call('schedule:run');
|
||||
|
||||
// Get the output of the command
|
||||
$output = $kernel->output();
|
||||
|
||||
echo "Artisan command 'ping' executed successfully. Exit code: $exitCode\n";
|
||||
echo "Artisan command 'schedule:run' executed successfully. Exit code: $exitCode\n";
|
||||
echo "Output:\n$output";
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -217,3 +217,24 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
const fetchInterval = setInterval(fetchStoreEmail, 10000);
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener('promotePremium', function () {
|
||||
setTimeout(() => {
|
||||
const event = new CustomEvent('modal-show', {
|
||||
detail: {
|
||||
name: 'premium',
|
||||
scope: null
|
||||
}
|
||||
});
|
||||
const showText = document.getElementById('premium-modal-limit');
|
||||
showText.classList.remove('hidden');
|
||||
const text1 = document.getElementById('focus-modal-text1');
|
||||
text1.classList.remove('text-accent');
|
||||
text1.classList.add('text-amber-500');
|
||||
const text2 = document.getElementById('focus-modal-text2');
|
||||
text2.classList.remove('text-accent');
|
||||
text2.classList.add('text-amber-500');
|
||||
document.dispatchEvent(event);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
@@ -126,6 +126,26 @@
|
||||
</flux:tooltip>
|
||||
</flux:modal.trigger>
|
||||
</div>
|
||||
@auth
|
||||
<flux:menu.separator />
|
||||
<button type="button" x-on:click="window.location.href = '{{ route('dashboard') }}'" class="premium-btn mt-2 w-full">
|
||||
<span class="crown"></span>
|
||||
<span class="crown-bg1"></span>
|
||||
<span class="crown-bg2"></span>
|
||||
<span class="btn-text">Login</span>
|
||||
</button>
|
||||
@endauth
|
||||
@guest
|
||||
<flux:menu.separator />
|
||||
<flux:modal.trigger name="premium">
|
||||
<button type="button" class="premium-btn mt-2 w-full">
|
||||
<span class="crown"></span>
|
||||
<span class="crown-bg1"></span>
|
||||
<span class="crown-bg2"></span>
|
||||
<span class="btn-text">Get Premium</span>
|
||||
</button>
|
||||
</flux:modal.trigger>
|
||||
@endguest
|
||||
</flux:menu>
|
||||
</flux:dropdown>
|
||||
</flux:navbar>
|
||||
@@ -174,8 +194,13 @@
|
||||
<flux:modal name="premium" class="min-w-[22rem]" class="bg-pricing-modal">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<div id="premium-modal-limit" class="mt-10 w-full justify-center hidden">
|
||||
<p class=" font-mono text-amber-500 text-center">
|
||||
Looks like you have the daily email generation limit, consider subscribing and access to premium features
|
||||
</p>
|
||||
</div>
|
||||
<!-- From Uiverse.io by themrsami -->
|
||||
<div class="max-w-[300px] w-full pt-5 px-5 pb-4 bg-zinc-100 dark:bg-zinc-900 rounded-3xl">
|
||||
<div class="w-full pt-5 px-5 pb-4 bg-zinc-100 dark:bg-zinc-900 rounded-3xl">
|
||||
<div class="text-center mb-6">
|
||||
<h5 class="text-2xl font-semibold text-gray-500 mb-3">Zemail Premium</h5>
|
||||
<span class="block text-5xl font-bold text-accent mb-3">${{ config('app.plans')[0]->price ?? 10 }}</span>
|
||||
@@ -198,7 +223,11 @@
|
||||
</li>
|
||||
<li class="flex mb-4 items-center">
|
||||
<flux:icon.check />
|
||||
<span class="ml-2 text-accent wrap-normal">Up to 100 addresses at the same time</span>
|
||||
<span id="focus-modal-text1" class="ml-2 text-accent wrap-normal">Unlimited email addresses on public domains</span>
|
||||
</li>
|
||||
<li class="flex mb-4 items-center">
|
||||
<flux:icon.check />
|
||||
<span id="focus-modal-text2" class="ml-2 text-accent wrap-normal">Up to 100 email addresses daily on premium domains</span>
|
||||
</li>
|
||||
<li class="flex mb-4 items-center">
|
||||
<flux:icon.check />
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<div class="flex justify-center items-center">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 p-1">
|
||||
|
||||
@foreach(config('app.blogs') as $blog)
|
||||
@foreach(collect(config('app.blogs'))->take(6) as $blog)
|
||||
<a href="{{ route('blog', $blog->slug) }}">
|
||||
<div class="flex items-center">
|
||||
<div class="group relative mx-auto w-96 overflow-hidden rounded-[16px] dark:bg-zinc-800 bg-zinc-200 p-[1px] ease-in-out hover:bg-gradient-to-r hover:from-zinc-600 hover:via-zinc-800 hover:to-zinc-700">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="flex justify-center items-center">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 p-1">
|
||||
|
||||
@foreach(config('app.blogs') as $i => $blog)
|
||||
@foreach(collect(config('app.blogs'))->reverse() as $i => $blog)
|
||||
<a href="{{ route('blog', $blog->slug) }}">
|
||||
<div class="flex items-center">
|
||||
<div class="group relative mx-auto w-96 overflow-hidden rounded-[16px] dark:bg-zinc-800 bg-zinc-200 p-[1px] ease-in-out hover:bg-gradient-to-r hover:from-zinc-600 hover:via-zinc-800 hover:to-zinc-700">
|
||||
|
||||
@@ -8,17 +8,17 @@ Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
|
||||
Schedule::call(function () {
|
||||
Email::fetchProcessStoreEmail();
|
||||
})->everyMinute();
|
||||
//Schedule::call(function () {
|
||||
// Email::fetchProcessStoreEmail();
|
||||
//})->everyMinute();
|
||||
|
||||
Schedule::call(function () {
|
||||
Email::deleteBulkAttachments();
|
||||
})->daily();
|
||||
|
||||
Schedule::call(function () {
|
||||
Email::deleteBulkMailboxes();
|
||||
})->everyMinute();
|
||||
//Schedule::call(function () {
|
||||
// Email::deleteBulkMailboxes();
|
||||
//})->everyMinute();
|
||||
|
||||
Schedule::call(function () {
|
||||
Email::deleteMessagesFromDB();
|
||||
@@ -31,3 +31,8 @@ Schedule::call(function () {
|
||||
Schedule::call(function () {
|
||||
Email::cleanMailbox();
|
||||
});
|
||||
|
||||
Artisan::command('cleanMail', function (){
|
||||
$this->comment(Email::cleanMailbox());
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user