Пример #1
0
 public static function addFriend($id_from, $id_to)
 {
     $mail = new Mail();
     $user_name_sender = Users::find('id', $id_from);
     if (!$user_name_sender) {
         return;
     }
     $user_name_sender = $user_name_sender->nickname;
     $user = Users::find('id', $id_to);
     if (!$user) {
         return;
     }
     $from = Config::getField('MAIL_FROM');
     $from = [$from['mail'] => $from['name']];
     $to = explode('@', $user->mail);
     $to = [$user->mail => $to[0]];
     $mail->send($from, $to, 'TITLE', Translate::getMails(null, 'account/friend_add', 'Demande reçu', ['user_name_sender' => $user_name_sender]));
 }
Пример #2
0
 public static function init()
 {
     $url = isset($_GET['url']) ? $_GET['url'] : '/';
     $path = __DIR__ . '/../../app/routes.php';
     require "{$path}";
     try {
         Router::parse($url);
     } catch (RouterException $e) {
         if (isset($_GET['url']) && $_GET['url'] == 'error/404') {
             throw new \Exception('Too many Redirects');
         }
         if (Config::getField('DEV_ENV')) {
             throw new RouterException($e->getMessage(), 0, $e);
         } else {
             if (headers_sent()) {
                 throw new \Exception('Headers already sent !');
             }
             header('location: /error/404');
             exit;
         }
     }
 }
Пример #3
0
 public function addFrom($from, $alias = '')
 {
     if ($alias === '') {
         if (is_string($from)) {
             $alias = $from;
         } else {
             $alias = Config::randomString(3);
         }
     }
     $this->table = array_merge($this->table, [$alias => ['type' => 'from', 'table' => $from]]);
     return $this;
 }
Пример #4
0
 public function newPassword()
 {
     Users::redirectIf(true);
     try {
         $user = Users::findOrFail('mail', Helper::post('mail'));
         $pass = Config::randomString(8);
         $user->password = password_hash($pass, PASSWORD_BCRYPT);
         $user->save();
         Users::resendPassword($user, $pass);
     } catch (\Exception $e) {
         Session::setFlash('danger', '', 'Aucun compte trouvée avec cette adresse email !');
     }
     Router::redirect('user.signin');
 }
Пример #5
0
<?php

use EasyHQ\Config;
?>
# Vérification de l'adresse mail

Pour confirmer votre adresse mail merci de cliquer sur le lien suivant :
<?php 
echo Config::getField('HOST');
?>
verify/<?php 
echo $key;
?>

Si celui-ci ne fonctionne pas, vous pouvez copier l'adresse pour la coller dans votre navigateur.

Cordialement,
Admin easyHQ
Пример #6
0
 public function __construct($mode = BaseModel::MODE_UPDATE)
 {
     $this->db = Database::get();
     $this->short_class_name = Config::getClassName($this->class_name);
     $this->mode = $mode;
 }
Пример #7
0
<?php

header('Content-Type: text/html; charset=utf-8');
require __DIR__ . '/vendor/autoload.php';
use EasyHQ\Config;
use EasyHQ\Translate;
use EasyHQ\Router\Router;
Config::setup();
/* Define language */
$language = 'fr_FR';
if (!isset($_GET['lang'])) {
    if (isset($_COOKIE['language'])) {
        if (Translate::checkLang($_COOKIE['language'])) {
            $language = $_COOKIE['language'];
        }
    }
} else {
    $language = Translate::getLang($_GET['lang']);
    setcookie('language', $language, time() + 7 * 24 * 3600, '/', null, false, true);
    $go = isset($_GET['url']) ? $_GET['url'] : '';
    header("location: /{$go}");
}
Translate::setup($language);
Router::init();