Esempio n. 1
0
 protected function request_get(array $args = array())
 {
     Params::put(Params::KEY_CACHE_ID, time());
     $this->getTemplateEngine()->clearAllCompiles();
     header('Location: /');
     exit;
 }
Esempio n. 2
0
 protected function sendResponse()
 {
     global $linkList;
     $this->addResponseData('linkList', $linkList);
     $this->addResponseData('clearUri', current(explode('#', current(explode('?', $_SERVER['REQUEST_URI'], 2)), 2)));
     $categoryList = $this->repositoryFactory->getCategoryRepository()->query()->addSortField('order')->addSortField('title')->getEntity();
     $this->addResponseData('categoryList', $categoryList);
     $this->addResponseData('cache_id', Params::get(Params::KEY_CACHE_ID, '1'));
     $this->addResponseData('userData', array('id' => $this->user->data()->id, 'login' => $this->user->data()->login, 'email' => $this->user->data()->email, 'role' => $this->user->data()->role));
     parent::sendResponse();
 }
Esempio n. 3
0
File: init.php Progetto: Ajuz/hinter
<?php

require_once __DIR__ . '/settings.php';
require_once __DIR__ . '/vendor/autoload.php';
use Maradik\User\UserCurrent;
use Maradik\User\UserRepository;
use Maradik\Hinter\Core\RepositoryFactory;
use Maradik\Hinter\Core\Params;
$db = new PDO("{$database_s['driver']}:host={$database_s['host']};dbname={$database_s['database']};charset=UTF8", $database_s['username'], $database_s['password']);
$user = new UserCurrent(new UserRepository($db, $table_s['user'], $database_s['prefix']), $general_s['enctryptsalt']);
$user->init();
$repositoryFactory = new RepositoryFactory($db, $database_s['prefix'], $table_s['category'], $table_s['mainquestion'], $table_s['mainanswer'], $table_s['secondquestion'], $table_s['secondanswer'], $table_s['relationanswers'], $table_s['param'], $table_s['file'], $general_s['upload_dir']);
Params::setRepository($repositoryFactory->getParamRepository());
Esempio n. 4
0
 /**
  * Постинг сообщения ВКонтакте
  * 
  * @param $message Текст сообщения
  * @param array $attachments Массив вложений к сообщению
  */
 protected function vkPostMessage($message, array $attachments)
 {
     /**
      * API syntax:
      * http://vk.com/dev/wall.post
      */
     $result = $this->vkCallMethod("wall.post", array('message' => $message, 'attachments' => implode(',', $attachments), 'owner_id' => Params::get('vk_wallpost_owner_id'), 'friends_only' => Params::get('vk_wallpost_friends_only', 0), 'from_group' => Params::get('vk_wallpost_from_group', 1), 'signed' => Params::get('vk_wallpost_signed', 0), 'v' => 5.21));
     if ($result !== false) {
         if (isset($result->response->post_id) && !empty($result->response->post_id)) {
             $this->addResponseMessage('Message posted to VK.COM successfully!');
         } else {
             $this->setResponseCode(HttpResponseCode::INTERNAL_SERVER_ERROR);
             $this->addResponseMessage("Error occured on posting message to VK.COM!", self::MESS_ERROR);
         }
     } else {
         $this->setResponseCode(HttpResponseCode::INTERNAL_SERVER_ERROR);
         $this->addResponseMessage('Error occured when send request to VK.COM!', self::MESS_ERROR);
     }
 }