Exemplo n.º 1
0
 /**
  * @return App
  */
 public static function getInstance()
 {
     if (!isset(static::$instance)) {
         static::$instance = new self();
         static::$instance->init();
     }
     return static::$instance;
 }
Exemplo n.º 2
0
 public static function syncDictionaryItem(\PHPMailer $mail, $keyName, $lang = '', array $params = [])
 {
     $app = App::getInstance();
     /** @var \MD\DAO\Dictionary $dictionaryDAO */
     $dictionaryDAO = $app->container->get('MD\\DAO\\Dictionary');
     $config = Config::getInstance();
     if (empty($lang)) {
         $lang = $config->currentLocale;
     }
     $params['name'] = $config->partnerName;
     $params['url'] = $config->getPartnerSiteUrl();
     $params['affiliateUrl'] = $config->partnerUrl;
     $params1 = [];
     foreach ($params as $key => $value) {
         $params1['{' . $key . '}'] = $value;
     }
     $params = $params1;
     $dictionary = $dictionaryDAO->getDictionaryItem($keyName, $lang);
     if (isset($dictionary)) {
         $mail->isHTML(true);
         $mail->Subject = strtr($dictionary->title, $params);
         $mail->Body = strtr($dictionary->content, $params);
     }
     return $mail;
 }
Exemplo n.º 3
0
 /**
  * @return AjaxResponse
  */
 protected function initResponse()
 {
     $ajaxResponse = new AjaxResponse();
     try {
         $app = App::getInstance();
         $ajaxResponse->status = true;
         $ajaxResponse->result = $app->callFromRequest($this->arguments);
     } catch (\Exception $e) {
         $ajaxResponse->status = false;
         $ajaxResponse->result = null;
         App::exceptionHandler($e);
     }
     $ajaxResponse->notification = Notification::getAll();
     return $ajaxResponse;
 }
Exemplo n.º 4
0
 public function logout()
 {
     $session = App::getSession();
     $session->isLogged = false;
 }
Exemplo n.º 5
0
<?php

use MD\Helpers\App;
if (App::isLoggedUser()) {
    $page = App::getCurrentPage();
    $menu = (include 'menu.php');
    ?>
    <!-- Left sidebar start -->
    <aside id="sidebar">

        <!-- Logo starts -->
        <a href="#" class="logo">
            <img src="/img/logo.png" alt="logo">
        </a>
        <!-- Logo ends -->

        <!-- Menu start -->
        <div id='menu'>
            <ul>
                <?php 
    foreach ($menu as $item) {
        ?>
                    <li <?php 
        echo $page == $item ? "class='highlight'" : "";
        ?>
 >
                        <a href='/doc/page/<?php 
        echo $item;
        ?>
' >
                            <div class="fs1" aria-hidden="true" data-icon="&#xe019;"></div>
Exemplo n.º 6
0
<?php

namespace {
    ini_set('memory_limit', '-1');
    ini_set('max_execution_time', 600);
    // 10m
    use MD\Helpers\App;
    use MD\Helpers\Config;
    use MD\Models\CronResult;
    require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php';
    Config::init(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))), ['useSession' => false]);
    //Config::init();
    $config = Config::getInstance();
    $app = App::getInstance();
    $cronResult = new CronResult();
    $cronResult->setPartnerId($config->partnerId);
    $cronResult->setStartDate(new \DateTime());
    $starMicroTime = microtime(true);
    $app->callCronFunction($cronResult, 'PaymentSystems');
    $app->callCronFunction($cronResult, 'Players');
    $app->callCronFunction($cronResult, 'PlayersActivityMain');
    $app->callCronFunction($cronResult, 'PlayersActivityCasino');
    $app->callCronFunction($cronResult, 'PlayersCasinoBonus');
    $app->callCronFunction($cronResult, 'PlayersExpenseMain');
    $app->callCronFunction($cronResult, 'BannerStat');
    $date = new \DateTime('-1 days');
    $date->setTime(10, 0, 0);
    $app->callCronFunction($cronResult, 'calculateCommission', 'MD\\Services\\CoreService', ['date' => $date], '');
    $executionTime = microtime(true) - $starMicroTime;
    $cronResult->setExecutionTime($executionTime);
    $app->call('MD\\DAO\\CronResult', 'saveCronResult', ['cronResult' => $cronResult]);
Exemplo n.º 7
0
 public static function init($skinDir = '', array $params = [])
 {
     if (empty($skinDir) && !empty($_SERVER['DOCUMENT_ROOT'])) {
         $skinDir = $_SERVER['DOCUMENT_ROOT'];
     }
     $globalConfig = [];
     self::$rootDir = dirname(dirname(__DIR__));
     $globalConfigPath = self::$rootDir . DIRECTORY_SEPARATOR . 'config.php';
     if ($skinDir == 'test') {
         // only for test , delete on realise
         $globalConfigPath = self::$rootDir . DIRECTORY_SEPARATOR . 'test_config.php';
     }
     if (file_exists($globalConfigPath)) {
         $globalConfig = (require $globalConfigPath);
         if (!is_array($globalConfig)) {
             $globalConfig = [];
         }
     }
     $skinConfig = [];
     $skinConfigPath = $skinDir . DIRECTORY_SEPARATOR . 'config.php';
     if (file_exists($skinConfigPath)) {
         $skinConfig = (require $skinConfigPath);
         if (!is_array($skinConfig)) {
             $skinConfig = [];
         }
     }
     self::$skinRootDir = $skinDir;
     if (empty(self::$skinRootDir)) {
         // for test
         self::$skinRootDir = __DIR__;
     }
     if ($skinDir == 'test') {
         // only for test , delete on realise
         self::$skinRootDir = self::$rootDir . '/skins/test';
     }
     $config = $globalConfig;
     if (!empty($params)) {
         $skinConfig = array_replace_recursive($skinConfig, $params);
     }
     if (!empty($skinConfig)) {
         $config = array_replace_recursive($globalConfig, $skinConfig);
     }
     static::$instance = new static($config);
     App::getInstance();
     //        self::$instance->initLocale();
     //        self::$instance->initReferralId();
 }
Exemplo n.º 8
0
<?php

use MD\Helpers\App;
use MD\Helpers\Config;
use MD\Helpers\Template;
require_once dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php';
Config::init(dirname(__DIR__));
App::redirectHandler();
Template::init();
Exemplo n.º 9
0
 public function updateUser(array $userData)
 {
     $user = new User($userData);
     $userId = $user->getUserId();
     if (empty($userId)) {
         return Notification::error('UserId is empty');
     }
     if (empty($user->getUserName())) {
         $user->setUserName('user' . App::getCounterNextIndex('user'));
     }
     $userTableUpdate = $this->db->update('users', $user->toArray(), 'userId = :userId', ['userId' => $userId]);
     if ($userTableUpdate) {
         switch ($user->getRole()) {
             case Defines::ROLE_DOCTOR:
                 $doctor = new User($userData);
                 return $this->db->update('doctors', $doctor->toArray(), 'doctorId = :userId', ['userId' => $userId]);
             case Defines::ROLE_CLIENT:
                 $client = new User($userData);
                 return $this->db->update('clients', $client->toArray(), 'clientId = :userId', ['userId' => $userId]);
         }
     }
     return false;
 }
Exemplo n.º 10
0
echo _('John Smith +123456789');
?>
"
                                   ng-model="editOrder.searchString" ng-change="parsSearchString()">
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-xs-12 form-group">
                            <label for="order-type"><?php 
echo _('Order Type');
?>
</label>
                            <select id="order-type" ng-model="editOrder.orderTypeId" class="form-control">
                                <?php 
foreach (\MD\Helpers\App::getOrderTypes() as $row) {
    ?>
                                    <option value="<?php 
    echo $row['orderTypeId'];
    ?>
"><?php 
    echo _($row['name']);
    ?>
</option>
                                <?php 
}
?>
                            </select>
                        </div>

                        <div class="col-xs-12 form-group">
Exemplo n.º 11
0
<?php

namespace {
    use MD\Helpers\App;
    if (!App::isLoggedUser()) {
        App::setCurrentPage('login');
    } else {
        // $currentPage = App::getCurrentPage();
        // if not exist page
        // App::setCurrentPage('404');
    }
}
Exemplo n.º 12
0
<?php

namespace {
    use MD\Helpers\App;
    use MD\Helpers\Defines;
    $menu = [];
    if (App::isLoggedUser()) {
        switch (App::getUserRole()) {
            case Defines::ROLE_ADMIN:
            case Defines::ROLE_SECRETARY:
            case Defines::ROLE_DOCTOR:
            case Defines::ROLE_CLIENT:
            default:
                $menu = ['index', 'doctors', 'clients', 'workingtimes', 'calendar1', 'edulik'];
                break;
        }
    }
    return $menu;
}
Exemplo n.º 13
0
use MD\Helpers\App;
use MD\Helpers\Config;
?>
<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
	<title><?php 
echo Config::getInstance()->partnerName;
?>
</title>

	<link rel="icon" href="/img/favicon.ico">

	<?php 
if (App::isLoggedUser()) {
    ?>
		<link rel="stylesheet" type="text/css" href="/style.css"/>
		<link rel="stylesheet" type="text/css" href="/global/css/datepicker/bootstrap-datepicker3.css">
		<link rel="stylesheet" type="text/css" href="/global/bower_components/jquery-ui/themes/start/jquery-ui.min.css">
		<?php 
    if (Config::getInstance()->environment == 'development') {
        ?>

		<?php 
    } else {
        ?>

		<?php 
    }
    ?>