Added Create Custom, Random, Gmail Generation
This commit is contained in:
54
app/Http/Controllers/AppController.php
Normal file
54
app/Http/Controllers/AppController.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ZEmail;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AppController extends Controller
|
||||
{
|
||||
public function mailbox($email = null) {
|
||||
if ($email) {
|
||||
if (json_decode(config('app.settings.configuration_settings'))->enable_create_from_url) {
|
||||
ZEmail::createCustomEmailFull($email);
|
||||
}
|
||||
return redirect()->route('mailbox');
|
||||
}
|
||||
if (!ZEmail::getEmail()) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
return $this->app();
|
||||
}
|
||||
|
||||
public function app() {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
||||
private function getStringBetween($string, $start, $end) {
|
||||
$string = ' ' . $string;
|
||||
$ini = strpos($string, $start);
|
||||
if ($ini == 0) return '';
|
||||
$ini += strlen($start);
|
||||
$len = strpos($string, $end, $ini) - $ini;
|
||||
return substr($string, $ini, $len);
|
||||
}
|
||||
private function setHeaders($page) {
|
||||
$header = $page->header;
|
||||
foreach ($page->meta ? unserialize($page->meta) : [] as $meta) {
|
||||
if ($meta['name'] == 'canonical') {
|
||||
$header .= '<link rel="canonical" href="' . $meta['content'] . '" />';
|
||||
} else if (str_contains($meta['name'], 'og:')) {
|
||||
$header .= '<meta property="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
|
||||
} else {
|
||||
$header .= '<meta name="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
|
||||
}
|
||||
}
|
||||
$page->header = $header;
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user