Ejemplo n.º 1
0
 protected function loadApiOperations()
 {
     \EventController::callEvent(ApiOperation::EventName);
     $this->add(new TestApiOperation());
     $this->add(new TestApiOperationWithParams());
     $this->add(new TestApiWithACLOperation());
 }
Ejemplo n.º 2
0
 public function getInstance()
 {
     if (self::$instance === null) {
         $class_name = __CLASS__;
         self::$instance = new $class_name();
     }
     return self::$instance;
 }
Ejemplo n.º 3
0
 public function generate()
 {
     $parseData = \EventController::callFilter(self::EventName, $this->data->getValue());
     $view = new View($this->tpl->getValue());
     $view->addHelper(new ViewHelper());
     $view->set($parseData);
     $content = $view->render();
     $writer = new Writer($this->url->getValue());
     $writer->write($content);
 }
Ejemplo n.º 4
0
 public function prepareRequest()
 {
     parent::prepareRequest();
     if (!defined('CMS')) {
         define('CMS', 1);
     }
     // Activate CMS auth
     \CMS_Strings::getInstance()->setActiveLang('RUSSIAN');
     \EventController::callEvent('dashboardInit');
 }
Ejemplo n.º 5
0
 protected function action()
 {
     $this->searchPhrase = $this->getParam('request');
     $this->searchUsers();
     $this->searchSitemap();
     $results = \EventController::callEvent(self::EventName, [$this->searchPhrase, $this->results]);
     foreach ($results as $row) {
         $this->results = array_merge($this->results, $row);
     }
     return ['items' => $this->results];
 }
Ejemplo n.º 6
0
 public function testAddCustomListener()
 {
     \UsersLogin::login('root', self::PASSWORD);
     \EventController::addRuntimeEventListener(Search::EventName, function ($request) {
         $result = new SearchResultModel();
         $result->title = 'world!';
         $results = [$result];
         return $results;
     });
     $api = new Search(['request' => 'hello?']);
     $response = $api->exec();
     $this->assertEquals('world!', $response['items'][0]->title->getValue());
 }
Ejemplo n.º 7
0
 public static function signup($login, $password, $email, $aData)
 {
     self::validateLogin($login);
     self::validateEmail($email);
     // Проверка данных
     EventController::callEvent('users_registration_check_data', $login, $password, $email, $aData);
     // Проверка существования логина и почты
     self::checkLoginOrEmailExists($login, $email);
     $register = new SystemRegister('Applications/users/front-end/');
     // Если требуется подтвержденте
     if ($register->account_confirmation->value) {
         // Код подтверждения
         $aData['confirmation_code'] = self::getConfirmationCode();
     }
     //
     $aData['login'] = $login;
     $aData['email'] = $email;
     $user = new UserAccount($aData);
     $user->obj_password->setValue($password);
     $user->insert();
     // Добавлени в базу
     $aData['id'] = $user->id->getValue();
     $aData['password'] = $password;
     // Вызов события
     EventController::callEvent('users_registration_after_signup', $aData, $user);
     //
     // Если требуется подтверждение
     if ($register->account_confirmation->value) {
         // Высылка письма
         self::sendEmailConfirmation($aData);
     } else {
         UsersLogin::login($login, $password);
     }
     if ($register->account_registration_success_email->value) {
         // Высылка письма
         self::sendEmailRegistration($aData);
     }
     return $aData['id'];
 }
Ejemplo n.º 8
0
 protected function appendGlobalTemplateEventData($events)
 {
     array_unshift($events, 'get_global_template_data');
     foreach ($events as $row) {
         $tmpData = EventController::callEvent($row, $this->aParse);
         if (is_array($tmpData)) {
             foreach ($tmpData as $row) {
                 if (is_array($row)) {
                     $this->aParse = array_merge($this->aParse, $row);
                 }
             }
         }
     }
 }
Ejemplo n.º 9
0
 protected function autoloadMenuItems()
 {
     try {
         $menuItems = Configure::read(self::AutoloadMenuItemsConfigureKey);
     } catch (ConfigureException $e) {
         return;
     }
     $menuItems = \EventController::callFilter(self::FilterName, $menuItems);
     foreach ($menuItems as $item) {
         $this->items->add($item);
     }
 }
Ejemplo n.º 10
0
require_once dirname(__FILE__) . '/class.ace_connect.php';
require_once dirname(__FILE__) . '/class.ncurses_ui.php';
require_once dirname(__FILE__) . '/class.streams_mgr.php';
mb_internal_encoding('UTF-8');
// создаем коннект к acestream, запускаем клиентский сокет
// изначально был этот ключ
$key = 'n51LvQoTlJzNGaFxseRK-uvnvX-sD4Vm5Axwmc4UcoD-jruxmKsuJaH0eVgE';
// создает сокет сервера трансляций и управляет коннектами клиентов к демону
$pool = new ClientPool('0.0.0.0', $port = 8001);
// получает PID и выдает ссылку на трансляцию
$ace = new AceConnect($key);
// управляет трансляциями. заказывает их у Ace и раздает клиентам из pool
$streams = new StreamsManager($ace, $pool);
// при рефакторинге роль совершенно изменилась и не соответствует имени класса
// занимается отрисовкой ncurses интерфейса
$EVENTS = new EventController();
$EVENTS->init(' AcePHProxy v.' . ACEPHPROXY_VERSION . ' running on port ' . $port);
// мониторим новых клиентов, запускаем для них трансляцию или, если такая запущена, копируем данные из нее
// мониторим дисконнекты и убиваем трансляцию, если клиентов больше нет (пока можно сделать ее вечноживой)
// мониторим проблемы с трансляцией и делаем попытку ее перезапустить в случае чего
$last_check = 0;
$ctrlC = false;
if (!function_exists('pcntl_signal')) {
    $EVENTS->error('pcntl function not found. Ctrl+C will not work properly');
} else {
    $EVENTS->log('Setting up Ctrl+C', EventController::CLR_GREEN);
    declare (ticks=1000);
    function signalHandler()
    {
        global $ctrlC, $EVENTS;
        $ctrlC = true;
Ejemplo n.º 11
0
 /**
  *   Удаляет учетную запись
  * @return
  */
 public function delete()
 {
     $data = UsersDBManager::get($this->id->getValue());
     if (!empty($data['persistent'])) {
         return;
     }
     $granted = EventController::callFilter('users_account_before_delete', $this);
     // if granted then call standart removing
     if (!empty($granted)) {
         parent::delete($granted);
     } else {
         return;
     }
     EventController::callEvent('users_account_after_delete', $this);
 }
Ejemplo n.º 12
0
});
$routes->post('/team/:id/edit', function ($id) {
    TeamController::update($id);
});
$routes->post('/team/:id/destroy', function ($id) {
    TeamController::destroy($id);
});
$routes->post('/team/:id/join', function ($id) {
    TeamController::join($id);
});
$routes->get('/event', function () {
    EventController::index();
});
$routes->post('/event', function () {
    EventController::store();
});
$routes->get('/event/new', function () {
    EventController::create();
});
$routes->get('/event/:id', function ($id) {
    EventController::show($id);
});
$routes->get('/event/:id/edit', function ($id) {
    EventController::edit($id);
});
$routes->post('/event/:id/edit', function ($id) {
    EventController::update($id);
});
$routes->post('/event/:id/destroy', function ($id) {
    EventController::destroy($id);
});
Ejemplo n.º 13
0
 /**
  * 
  * @param array $data хеш массив в формате имя котрола, значение
  */
 public function setValues($data)
 {
     foreach ($data as $key => $row) {
         try {
             $control = $this->searchControlByName($key);
         } catch (Exception $e) {
             continue;
         }
         $control->setValue($row);
     }
     EventController::callEvent(self::EventName, $this);
 }
Ejemplo n.º 14
0
 /**
  *
  * @param unknown $code
  */
 public function confirm($code)
 {
     if (!empty($code)) {
         $oAccount = self::getByCode($code);
     }
     if (!empty($oAccount)) {
         $oAccount->confirmation_code = '';
         $oAccount->update();
         UsersLogin::forceLogin($oAccount);
         EventController::callEvent('users_registration_after_confirm', $oAccount);
         $bFailed = false;
         $this->addAlert('Аккаунт активирован');
         $this->jump('/');
     } else {
         $bFailed = true;
     }
     $this->aParse['pageMeta'] = UsersModule::getMeta(UsersRegistration::RegistrationConfigName);
     $this->aParse['isCodeEmpty'] = empty($code);
     $this->aParse['bFailed'] = $bFailed;
     $this->output('users/registration/confirm');
 }
Ejemplo n.º 15
0
 public static function cleanUp()
 {
     self::$aRuntimeEventListeners = [];
 }
Ejemplo n.º 16
0
 protected function changeLogin($password, $login)
 {
     $login = \Faid\DB::$connection->real_escape_string($login);
     $oUser = UsersLogin::getCurrentSession();
     if ($login == $oUser->login->getValue()) {
         return;
     }
     if ($this->register->get('front-end')->ignore_password_field->value == 0) {
         $isSamePassword = $this->checkPassword($password, $oUser);
         if (!$isSamePassword) {
             $this->addValidationError('updatePassword');
             return;
         }
     }
     $sql = 'SELECT * FROM `%s` WHERE `login` = "%s" and `id` <> %d';
     $sql = sprintf($sql, USERS_TABLE, $login, $oUser->id->getValue());
     //
     $aGet = DB::get($sql);
     // Ого! уже есть акк с таким емейлом, навиду подстава! ;)
     if (!empty($aGet)) {
         $this->addValidationError('updateLogin');
         return;
     }
     $old_login = $oUser->email->getValue();
     $oUser->login - setValue($login);
     $oUser->update();
     EventController::callEvent('users_after_update_login', $oUser, $old_login, $login);
     $this->addSuccess('updateLogin');
 }
Ejemplo n.º 17
0
 /**
  * Загружает из бд данные о пользователе и если он есть сохраняет в св-ве aUser
  */
 public function processUser()
 {
     try {
         $notAuthorizedAction = empty($this->user) || !$this->isAdmin($this->user);
         if ($notAuthorizedAction) {
             UsersLogin::logout();
             throw new \ForbiddenException('Access denied. Only administrators & auditors permitted');
         }
         EventController::callEvent(self::EventName, $this);
     } catch (Exception $e) {
         $this->user = null;
         throw $e;
     }
 }
Ejemplo n.º 18
0
    // SITEMAP constants
    define('SITEMAP_TABLE', 'sitemap');
    define('SITEMAP_SCRIPT_CHILD_TABLE', 'sitemap_scripts_child');
    define('SITEMAP_HISTORY_TABLE', 'sitemap_history');
    // Custom Config
    define('CCONFIG', 'cconfig');
    define('CCONFIG_SCHEMA_TABLE', 'custom_config_schema');
    define('CCONFIG_TABSHEETS_TABLE', 'custom_config_groups');
    define('CCONFIG_CONTROL_TABLE', 'custom_config_items');
    define('CCONFIG_CONTROLS_PATH', LIB_PATH . 'custom_config/controls/');
    //
    define('USERS', 'users');
    define('USERS_TABLE', 'users');
    // Core packages
    require_once LIB_PATH . 'kernel/extasy.php';
    //
    Trace::start();
    //
    Configure::write('Schedule.AutoloadScriptPath', APPLICATION_PATH . 'scheduleRestart.php');
    Configure::write('Exception.Handler', array('\\Extasy\\errors\\Handlers', 'onException'));
    Configure::write('Error.Handler', array('\\Extasy\\errors\\Handlers', 'onError'));
    Configure::write('FatalError.Handler', array('\\Extasy\\errors\\Handlers', 'onFatalError'));
    require_once LIB_PATH . 'ClassLocator.php';
    require_once LIB_PATH . 'Autoloader.php';
    \Extasy\Autoloader::startup();
    Debug::enable();
    \EventController::addRuntimeEventListener(\Extasy\Api\ApiOperation::EventName, function () {
        \Extasy\Audit\Api\ApiOperation::startUp();
        \Extasy\Users\UsersModule::initAPI();
    });
}
Ejemplo n.º 19
0
<?php

/* 
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_STATUS, array(Operator::getInstance(), "UpdateOperatorStatus"));
EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_STATUS, array(Operator::getInstance(), "updateOperatorOnlineStats"));
EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_PING, array(Operator::getInstance(), "updateOperatorOnlineStatsForThread"));
EventController::getInstance()->addEventListener(EventController::EVENT_OPERATOR_PING, array(ThreadProcessor::getInstance(), "ProcessThread"));
Ejemplo n.º 20
0
 /**
  *
  */
 public static function logout()
 {
     if (self::isLogined()) {
         EventController::callEvent('users_after_logout');
         try {
             $user = self::getCurrentUser();
             CMSLog::addMessage(__CLASS__, sprintf('User `%s` logged out', $user->login->getValue()));
         } catch (\Exception $e) {
             $short = 'Failed to logout user. Probably, there is an issue inside User Sesison';
             $full = sprintf("%s\r\n%s", $short, $e);
             Record::add(__CLASS__, $short, $full);
         }
     }
     self::unsetSession();
     self::$currentUser = null;
 }
Ejemplo n.º 21
0
<?php

include "wechat.class.php";
include "./controller/textController/TextController.php";
include "./controller/eventController/EventController.php";
include "./model/TextModel.php";
include "./model/EventModel.php";
include "./config/params.php";
$options = array('token' => '', 'encodingaeskey' => '', 'appid' => '', 'appsecret' => '');
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $textObj = new TextController($weObj);
        $reply = $textObj->replyIndex();
        $weObj->text($reply)->reply();
        break;
    case Wechat::MSGTYPE_EVENT:
        $eventObj = new EventController($weObj);
        $reply = $eventObj->replyIndex();
        //$weObj->text($reply)->reply();
        $weObj->news($reply)->reply();
        break;
    case Wechat::MSGTYPE_IMAGE:
        break;
    default:
        $weObj->text("help info")->reply();
}
Ejemplo n.º 22
0
 protected function initializeApis()
 {
     \EventController::addRuntimeEventListener(\Extasy\Api\ApiOperation::EventName, function () {
         $controller = \Extasy\Api\ApiController::getInstance();
         $controller->add(new \Extasy\Schedule\Api\Add());
         $controller->add(new \Extasy\Schedule\Api\Cancel());
         $controller->add(new \Extasy\Schedule\Api\Latests());
         $controller->add(new \Extasy\Schedule\Api\Restart());
         $controller->add(new \Extasy\Schedule\Api\RestartServer());
         $controller->add(new \Extasy\Schedule\Api\ServerStatus());
         $controller->add(new \Extasy\Schedule\Api\StopServer());
         $controller->add(new Search());
     });
 }
Ejemplo n.º 23
0
 * 
 * Данный файл является частью проекта Веб Мессенджер.
 * 
 * Все права защищены. (c) 2005-2009 ООО "ТОП".
 * Данное программное обеспечение и все сопутствующие материалы
 * предоставляются на условиях лицензии, доступной по адресу
 * http://webim.ru/license.html
 * 
 */
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.thread.php';
require_once '../classes/class.threadprocessor.php';
require_once '../classes/class.eventcontroller.php';
require_once '../classes/events_register.php';
ThreadProcessor::getInstance()->ProcessOpenThreads();
$o = Operator::getInstance();
$operator = $o->GetLoggedOperator(false);
$f = "i" . "s" . "Op" . "er" . "a" . "to" . "rsL" . "im" . "it" . "E" . "x" . "ce" . "ed" . "ed";
if ($o->{$f}()) {
    die;
}
$status = verify_param("status", "/^\\d{1,9}\$/", OPERATOR_STATUS_ONLINE);
EventController::getInstance()->dispatchEvent(EventController::EVENT_OPERATOR_STATUS, array($operator));
if ($status != 0) {
    $since = verify_param("since", "/^\\d{1,9}\$/", 0);
    $xml = Thread::getInstance()->buildPendingThreadsXml($since, $operator);
    Browser::SendXmlHeaders();
    echo $xml;
}
exit;
Ejemplo n.º 24
0
    if ($o->{$f}()) {
        die;
    }
}
$thread = Thread::getInstance()->GetThreadById($threadid);
if (empty($thread) || !isset($thread['token']) || $token != $thread['token']) {
    die("wrong thread in thread.php");
}
if ($isvisitor && !visitorHasAccess($thread)) {
    show_error("server: visitor has no access to the thread");
}
if ($isvisitor) {
    ThreadProcessor::getInstance()->ProcessThread($threadid, 'visitor_ping', array('istyping' => !empty($istyping)));
}
if (!$isvisitor && !$viewonly) {
    EventController::getInstance()->dispatchEvent(EventController::EVENT_OPERATOR_PING, array($threadid, 'operator_ping', array('istyping' => !empty($istyping), 'operatorid' => $operator['operatorid'])));
}
$operator = null;
if (!$isvisitor && !$viewonly) {
    $operator = Operator::getInstance()->GetLoggedOperator();
    $viewonly = $thread['operatorid'] != $operator['operatorid'] && !empty($thread['operatorid']);
}
//$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
$v = GetVisitorFromRequestAndSetCookie();
if ($act == "refresh") {
    $lastid = verify_param("lastid", "/^\\d{1,9}\$/", -1);
    if ($isvisitor && !empty($thread['operatorid'])) {
        setcookie('WEBIM_LAST_OPERATOR_ID', $thread['operatorid'], time() + 60 * 60 * 24 * 365, '/');
    }
    Thread::getInstance()->PrintThreadMessages($thread, $token, $lastid, $isvisitor, $outformat, $viewonly);
    exit;
Ejemplo n.º 25
0
<?php

include_once "controller/eventController.php";
$controller = new EventController();
$controller->invoke();
Ejemplo n.º 26
0
 public function update($id)
 {
     $aData = $_POST;
     $user = new UserAccount();
     $found = $user->get($id);
     if (empty($found)) {
         throw new \Exception("User not found");
     }
     \CMSLog::addMessage(__CLASS__, sprintf('User account `%s` updated', $user->login->getValue()));
     // Вызов проверки форм
     $result = \EventController::callFilter('users_admin_profile_check', $aData);
     if ($result) {
         $user->updateFromPost($result);
     }
     $msg = sprintf(self::msgUpdatedSuccessfully, htmlspecialchars($user->login->getValue()));
     $this->goToEditPage($msg, $user->id->getValue());
 }