Skip to content

Commit

Permalink
add project files
Browse files Browse the repository at this point in the history
  • Loading branch information
alishahidi committed Apr 29, 2022
0 parents commit f4a12e2
Show file tree
Hide file tree
Showing 75 changed files with 5,835 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
TOKEN=geFromApp
CRYPT_TOKEN=genFromApp

# Database
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=app
DB_USERNAME=root
DB_PASSWORD=

MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=ex
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# apantos
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/Http/.DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions app/Http/Controllers/Captcha/CaptchaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Captcha;

use App\Http\Controllers\Controller;
use System\Security\Security;

class CaptchaController extends Controller
{
public function get()
{
return Security::buildCaptcha();
}
}
7 changes: 7 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Http\Controllers;

class Controller{

}
16 changes: 16 additions & 0 deletions app/Http/Controllers/File/ImageController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Http\Controllers\File;

use App\Http\Controllers\Controller;
use App\Http\Services\ImageUpload;

class ImageController extends Controller
{

public function upload()
{
$image = ImageUpload::dateFormatUploadEditor("file");
echo json_encode(['location' => asset($image)]);
}
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Home/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;

class HomeController extends Controller
{

public function index()
{
echo "aaa";
}
}
1 change: 1 addition & 0 deletions app/Http/Helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- cerate -->
39 changes: 39 additions & 0 deletions app/Http/Services/ImageUpload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Http\Services;

use Ramsey\Uuid\Uuid;
use System\Request\Request;

class ImageUpload
{
public static function dateFormatUploadAndFit($fileName, $dir, $width, $height)
{
$request = new Request();
$dirSep = DIRECTORY_SEPARATOR;
$path = "images{$dirSep}{$dir}{$dirSep}" . date("Y{$dirSep}M{$dirSep}d");
$uuid = Uuid::uuid4()->toString();
$name = date("Y_m_d_M_i_s_") . $uuid;
return $request->uploadImage($fileName, $path, $name, [$width, $height]);
}

public static function uploadAndFit($fileName, $dir, $width, $height)
{
$request = new Request();
$dirSep = DIRECTORY_SEPARATOR;
$path = "images{$dirSep}{$dir}{$dirSep}";
$uuid = Uuid::uuid4()->toString();
$name = date("Y_m_d_M_i_s_") . $uuid;
return $request->uploadImage($fileName, $path, $name, [$width, $height]);
}

public static function dateFormatUploadEditor($fileName)
{
$request = new Request();
$dirSep = DIRECTORY_SEPARATOR;
$path = "editor{$dirSep}" . date("Y{$dirSep}M{$dirSep}d");
$uuid = Uuid::uuid4()->toString();
$name = date("Y_m_d_M_i_s_") . $uuid;
return $request->uploadImage($fileName, $path, $name);
}
}
85 changes: 85 additions & 0 deletions app/Http/Services/Mail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace App\Http\Services;

use System\Config\Config;
use System\Notify\Notify;

class Mail
{
// ex
public static function sendTemplateMail($to, $link, $title, $subtitle, $img)
{
$template = '
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="x-apple-disable-message-reformatting">
<title></title>
<!--[if mso]>
<noscript>
<xml>
<o:OfficeDocumentSettings>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<![endif]-->
<style>
* {
direction: rtl;
text-align: right;
word-wrap: break-word;
margin: 0 auto;
font-family: Roboto;
}
</style>
</head>
<body style="margin:0;padding:0;" dir="rtl">
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
<tr>
<td align="center" style="padding:0;">
<table role="presentation" style="width:602px;border-collapse:collapse;border:1px solid #cccccc;border-spacing:0;text-align:left;">
<tr>
<td align="center" style="background:#70bbd9; background-image: url('. asset($img) .');height: 250px;width: 100%;background-position: center;background-size: cover;background-repeat: no-repeat;">
</td>
</tr>
<tr>
<td style="padding:36px 30px 42px 30px;">
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
<tr>
<td style="padding:0 0 36px 0;color:#153643;">
<h1 style="font-size:24px;margin:0 0 20px 0;">'. $title .'</h1>
<p style="margin:0 0 12px 0;font-size:14.5px;line-height:24px;">'. $subtitle .'</p>
<p style="margin:0;font-size:14.5px;line-height:24px;"><a href="' . $link . '" style="color:#ee4c50;text-decoration:underline;">فعالسازی اکانت کاربری</a></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:30px;background:#333;">
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;font-size:9px;">
<tr>
<td style="padding:0;width:50%;" align="left">
<p style="margin:0;font-size:14px;line-height:14.5px;color:#ffffff;text-align:center;">
' . Config::get("app.APP_TITLE") . '
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
';

Notify::sendMail($to, $title . "-" . Config::get("app.APP_TITLE"), $template);
}
}
18 changes: 18 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Providers;

use App\Ads;
use App\News;
use App\User;
use System\View\Composer;

class AppServiceProvider extends Provider
{
public function boot()
{
return Composer::view("app.index", function () {
//
});
}
}
7 changes: 7 additions & 0 deletions app/Providers/Provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Providers;

abstract class Provider{
abstract public function boot();
}
33 changes: 33 additions & 0 deletions app/Providers/SessionServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace App\Providers;

class SessionServiceProvider extends Provider
{
private function clearSetSessionService($mainSessionName, $tmpSessionName)
{
if (isset($_SESSION[$tmpSessionName])) unset($_SESSION[$tmpSessionName]);
if (isset($_SESSION[$mainSessionName])) {
$_SESSION[$tmpSessionName] = $_SESSION[$mainSessionName];
unset($_SESSION[$mainSessionName]);
};
}

private function initialOldSession()
{
$tmp = [];
$tmp = !isset($_GET) ? $tmp : array_merge($tmp, $_GET);
$tmp = !isset($_POST) ? $tmp : array_merge($tmp, $_POST);
$_SESSION["old"] = $tmp;
unset($tmp);
}

public function boot()
{
session_start();
$this->clearSetSessionService("old", "tmp_old");
$this->clearSetSessionService("flash", "tmp_flash");
$this->clearSetSessionService("error", "tmp_error");
$this->initialOldSession();
}
}
11 changes: 11 additions & 0 deletions bootstrap/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Bootstrap;

class Bootstrap
{
public function __construct()
{
new \System\Application\Application();
}
}
20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"autoload": {
"psr-4": {
"App\\": "app/",
"System\\": "system/"
}
},
"require": {
"symfony/var-dumper": "^5.3",
"ramsey/uuid": "^4.2",
"intervention/image": "^2.6",
"firebase/php-jwt": "^5.4",
"vlucas/phpdotenv": "^5.3",
"defuse/php-encryption": "^2.3",
"symfony/polyfill": "^1.23",
"phpmailer/phpmailer": "^6.5",
"gregwar/captcha": "^1.1",
"morilog/jalali": "^3.2"
}
}
Loading

0 comments on commit f4a12e2

Please sign in to comment.