/** * @return App */ public static function getInstance() { if (!isset(static::$instance)) { static::$instance = new self(); static::$instance->init(); } return static::$instance; }
public function checkTask($taskId, $watchDuration = -1) { $task = $this->taskDao->getTaskById($taskId); $isDone = false; $vkId = App::getUserId(); $url = $task->getUrl(); if (isset($task)) { switch ($task->getType()) { case Defines::TASK_TYPE_LIKE: $isDone = $this->vkService->isLiked($vkId, $url); break; case Defines::TASK_TYPE_GROUP: $isDone = $this->vkService->isGroupMember($vkId, $url); break; case Defines::TASK_TYPE_FRIEND: $isDone = $this->vkService->isFriend($vkId, $url); break; case Defines::TASK_TYPE_SHARE: $isDone = $this->vkService->isShare($vkId, $url); break; case Defines::TASK_TYPE_POLL: break; case Defines::TASK_TYPE_COMMENT: break; case Defines::TASK_TYPE_VIDEO: $isDone = $this->vkService->isWatchVideo($task, $watchDuration); break; } } if ($isDone) { $this->taskDao->doTask($task->getTaskId()); } return $isDone; }
public static function syncDictionaryItem(\PHPMailer $mail, $keyName, $lang = '', array $params = []) { $app = App::getInstance(); /** @var \LT\DAO\Dictionary $dictionaryDAO */ $dictionaryDAO = $app->container->get('LT\\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; }
public function getTasksFromOwner($type) { $bind = ['partnerId' => App::getPartnerId(), 'ownerId' => App::getUserId()]; $where = "partnerId = :partnerId AND ownerId = :ownerId"; if ($type != 'all') { $where .= ' AND `type` = :type'; $bind['type'] = $type; } return $this->db->select('tasks', $where, $bind); }
/** * @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; }
// 4 + e- - // 10 + e- - // 29 + e- - // 81 + e- - // 107 + e+ - // 112 + e- - // 113 + e- - // 114 + e- - // 115 + e- - // 126 + e- - // 136 + e+ - // 138 + e- - // 148 + e+ - // 169 + e+ - $config = Config::getInstance(); $app = App::getInstance(); $fromDate = new \DateTime('2015-08-19 10:00:00'); $toDate = new \DateTime('2015-08-19 10:00:00'); /** @var \LT\Services\PusherService $pusherService */ $pusherService = $app->container->get('LT\\Services\\PusherService'); /** @var \LT\Services\CoreService $coreService */ $coreService = $app->container->get('LT\\Services\\CoreService'); $interval = new \DateInterval('P1D'); $toDate->modify('+1 day'); $dateRange = new \DatePeriod($fromDate, $interval, $toDate); $start = microtime(true); foreach ($dateRange as $date) { $scopeStart = microtime(true); /** @var $date \DateTime */ $date->setTime(10, 0, 0); $newFromDate = clone $date;
<?php use LT\Helpers\App; $vkData = App::getSession()->vkData; $userData = App::getUserData(); $rating = isset($userData['rating']) ? $userData['rating'] : 0; $balance = isset($userData['balance']) ? $userData['balance'] : 0; ?> <table> <tbody> <tr> <td> <img src="<?php echo $vkData['photo_100']; ?> " class="image" width="50"> </td> <td align="left"> <b><?php echo $vkData['first_name'] . ' ' . $vkData['last_name']; ?> </b> <br><br> <a style="cursor: pointer;" ng-click="logout()">Выйти</a> </td> </tr> </tbody> </table> <hr>
<?php namespace { use LT\Helpers\App; $page = App::getCurrentPage(); if (!App::isLoggedUser()) { if (!in_array($page, ['index', 'terms-and-conditions'])) { App::setCurrentPage('index'); } //App::setCurrentPage('login'); } else { if (!in_array($page, ['task-list', 'my-tasks', 'terms-and-conditions'])) { App::setCurrentPage('task-list'); } // $currentPage = App::getCurrentPage(); // if not exist page // App::setCurrentPage('404'); } }
public function getUserData() { return $this->userDao->getUserData(App::getUserId()); }
</td> </tr> </tbody> </table> <?php use LT\Helpers\App; if (App::isLoggedUser()) { ?> <script src="/global/bower_components/jquery-ui/jquery-ui.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="/global/ng/app.js"></script> <?php } else { ?> <script src="/global/ng/app.js"></script> <?php } ?> <!-- angular --> <script src="/global/ng/factory/serverConnector.js"></script> <script src="/global/ng/factory/notification.js"></script> <!-- angular services --> <script src="/global/ng/service/userService.js"></script> <script src="/global/ng/service/taskService.js"></script>
<table style="height:100%;width:800px; border-collapse: collapse;"> <tbody> <tr> <?php if (\LT\Helpers\App::isLoggedUser()) { ?> <td valign="top" style="height:100%;width:25%;"> <div class="left_block"> <?php include dirname(__DIR__) . DIRECTORY_SEPARATOR . 'block' . DIRECTORY_SEPARATOR . 'left.php'; ?> </div> <?php include dirname(__DIR__) . DIRECTORY_SEPARATOR . 'block' . DIRECTORY_SEPARATOR . 'info.php'; ?> </td> <?php } ?> <td width="" valign="top" style="height:100%;width:75%;"> <div class="right_block"> <div class="title"><font color="#333333"> <center><b>Правила сайта Snebes.Ru</b></center> </font></div> <div class="line_block"> Сайт Snebes.Ru использует только официально предоставленные социальной сетью возможности для разработчиков.<br><br> Прочтите правила. В случае игнорирования Исполнителем/Рекламодателем данных Правил, либо же в случае невыполнения Правил, Администрация оставляет за собой право заблокировать, удалить или оштрафовать аккаунт нарушителя без предупреждения, со списанием всех средств, в свою пользу.
public static function init($skinDir = '', array $params = []) { if (empty($skinDir) && !empty($_SERVER['DOCUMENT_ROOT'])) { $skinDir = $_SERVER['DOCUMENT_ROOT']; } $globalConfig = []; static::$rootDir = dirname(dirname(__DIR__)); $globalConfigPath = static::$rootDir . DIRECTORY_SEPARATOR . 'config.php'; // only for test , delete on realise if ($skinDir == 'test') { $globalConfigPath = static::$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 = []; } } static::$skinRootDir = $skinDir; // for test if (empty(static::$skinRootDir)) { static::$skinRootDir = __DIR__; } // only for test , delete on realise if ($skinDir == 'test') { static::$skinRootDir = static::$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 self($config); App::getInstance(); }
$menu = (include 'menu.php'); ?> <div class="head_"> <div class="head_1"> <div class="head_2"> <div class="head_nav"> <div class="logo"> <img src="/img/logo.png"> </div> <?php foreach ($menu as $item) { ?> <a href="/page/<?php echo $item; ?> /" <?php echo $page == $item ? "class='head_nav_sellect'" : ""; ?> ><b><?php echo App::t($item); ?> </b></a> <?php } ?> </div> </div> </div> </div>
<?php use LT\Helpers\App; use LT\Helpers\Config; use LT\Helpers\Template; require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php'; Config::init(__DIR__); App::redirectHandler(); Template::init();