public function storeRequest($vks_id)
 {
     try {
         $vks = Vks::with('tech_support_requests')->findOrFail($vks_id);
     } catch (Exception $e) {
         $this->error('404');
     }
     $request = $this->request->request;
     $this->validator->validate(['Сообщение' => [$request->get('user_message'), 'max(255)'], 'Точка' => [$request->get('att_id'), 'required|int']]);
     //if no passes
     if (!$this->validator->passes()) {
         $this->backWithData($this->validator->errors()->all());
     }
     $request_new = new TechSupportRequest(array('att_id' => $request->get('att_id'), 'vks_id' => $vks->id, 'owner_id' => App::$instance->user->id, 'user_message' => $request->get('user_message'), 'status' => $vks->status == VKS_STATUS_APPROVED ? TechSupportRequest::STATUS_READY_FOR_SEND : TechSupportRequest::STATUS_WAIT_VKS_DECISION));
     $flag = false;
     if (count($vks->tech_support_requests)) {
         foreach ($vks->tech_support_requests as $request) {
             if ($request_new->att_id == $request->att_id) {
                 $flag = true;
             }
         }
     }
     if (!$flag) {
         $request_new->save();
     }
     App::$instance->MQ->setMessage("Запрос успешно создан");
     ST::redirectToRoute('TechSupport/showRequests/' . $vks->id);
 }
 public function store()
 {
     Token::checkToken();
     $xml = new SimpleXMLElement('<root/>');
     //        dump($this->request->request->get('modules'));
     //        die;
     if ($this->request->request->has('modules')) {
         foreach ($this->request->request->get('modules') as $module) {
             $this->validator->validate(['name' => [$module['name'], 'required|max(255)'], 'description' => [$module['description'], 'required|max(560)'], 'help' => [$module['help'], 'required|max(1000)'], 'value' => [$module['value'], 'between(0,1)']]);
             //if no passes
             if (!$this->validator->passes()) {
                 $this->putUserDataAtBackPack($this->request);
                 App::$instance->MQ->setMessage($this->validator->errors()->all());
                 ST::redirect("back");
             }
             $srvXml = $xml->addChild('module');
             $srvXml->addAttribute('name', $module['name']);
             $srvXml->addAttribute('description', $module['name']);
             $srvXml->addAttribute('help', $module['help']);
             $srvXml->addAttribute('value', intval($module['value']));
         }
     }
     $xml->asXML("config/modules-cfg.xml");
     App::$instance->MQ->setMessage('Список обновлен');
     App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'Изменен список модулей системы');
     ST::redirect("back");
 }
 public function run()
 {
     //add counter
     $params = count($this->params) ? "/" . implode("/", $this->params) : "";
     $mskTime = date_create()->setTimezone(new DateTimeZone(App::$instance->opt->ca_timezone));
     Counter::create(['origin' => MY_NODE, 'ip' => App::$instance->user->ip, 'request' => $this->controller . "/" . $this->action . urlencode($params), 'type' => ST::isAjaxRequest() ? REQUEST_AJAX : REQUEST_REGULAR, 'created_at' => $mskTime, 'updated_at' => $mskTime]);
     call_user_func_array(array(new $this->controller(), $this->action), $this->params);
 }
 private function isDefaultUserIteractBlock($id)
 {
     Auth::isAdminOrDie(App::$instance);
     if (in_array($id, [1])) {
         App::$instance->MQ->setMessage('Нелья редактировать системныe записи');
         ST::redirect("back");
     }
 }
 public function unmark($caVksId)
 {
     Auth::isAdminOrDie(App::$instance);
     foreach (AdminCaNote::where('vks_id', $caVksId)->get() as $caVks) {
         $caVks->delete();
     }
     App::$instance->MQ->setMessage("У ВКС ЦА {$caVksId} удален флаг");
     ST::redirect('back');
 }
 function show()
 {
     //        $this->render("test/
     $s = ST::microtime_float();
     $start = '2015-11-30';
     $end = '2016-01-11';
     $events = Vks::where('start_date_time', ">=", $start)->where('start_date_time', '<=', $end)->where('status', VKS_STATUS_APPROVED)->get();
     $e = ST::microtime_float();
     print $e - $s;
 }
 public function logout()
 {
     global $_TB_IDENTITY;
     if (Auth::isLogged(App::$instance)) {
         setcookie(md5("logged" . $_TB_IDENTITY[App::$instance->user->origin]['serviceName']), false, time() - 3600, '/', Null, 0);
     } else {
         App::$instance->MQ->setMessage('Вы не авторизированы');
     }
     ST::redirectToRoute("Index/index");
 }
示例#8
0
 static function isAdminOrDie($init)
 {
     if ($init->user->isLogged && ($init->user->role == ROLE_ADMIN || $init->user->role == ROLE_ADMIN_MODERATOR)) {
         return true;
     } else {
         App::$instance->log->logWrite(LOG_SECURITY, "Restricted access: Try to enter admin only allowed zone");
         ST::routeToErrorPage('only-admin');
         exit;
     }
 }
 public function search($phrase)
 {
     if (ST::isAjaxRequest()) {
         $vksWSC = new Vks_controller();
         $result = [];
         $result['ws'] = Vks::where("id", $phrase)->whereIn('status', [VKS_STATUS_APPROVED, VKS_STATUS_PENDING])->take(1)->get();
         foreach ($result['ws'] as $vks) {
             $vksWSC->humanize($vks);
         }
         print json_encode($result);
     }
 }
 static function MenuChanger()
 {
     if (Auth::isAdmin(App::$instance)) {
         ST::deployTemplate('menus/admin.inc');
     } else {
         ST::deployTemplate('menus/user.inc');
     }
     //под меню добавить слушателя сообщений
     ExceptionHandler::messageException();
     //выдать путь для js, $init должен быть инициирован выше
     ST::setVarPhptoJS(App::$instance->opt->appHttpPath, "appHttpPath");
 }
 public function isExist($key)
 {
     $result = false;
     if (file_exists(self::SAVE_PATH . App::$instance->user->id . "_" . $key)) {
         $result = true;
     }
     if (!ST::isAjaxRequest()) {
         return $result;
     } else {
         print json_encode($result);
     }
 }
 public function sendDeleteMail($vks, $toRequester = true)
 {
     $vks->link = ST::linkToVksPage($vks->id, false, true);
     $vksArray = $vks->toArray();
     $message = App::$instance->twig->render('mails/v2/vks-delete.twig', array('vks' => $vksArray, 'http_path' => HTTP_BASE_PATH, 'appHttpPath' => NODE_HTTP_PATH));
     if (!$toRequester) {
         Mail::sendMailToStack($vks->owner->email, "Ваша ВКС #{$vks['id']} аннулирована", $message);
     } else {
         Mail::sendMailToStack(App::$instance->user->email, "ВКС #{$vks['id']} аннулирована", $message);
     }
     App::$instance->log->logWrite(LOG_MAIL_SENDED, "VKS WS #{$vks['id']} аннулирована");
 }
 public function delete($id)
 {
     Auth::isAdminOrDie(App::$instance);
     if ($id == 1) {
         App::$instance->MQ->setMessage("Это удалить нельзя, просто переименуйте как вам нужно");
         ST::redirect('back');
     }
     $department = Department::findorFail($id);
     $department->delete();
     App::$instance->MQ->setMessage("Успешно удалено");
     App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'Подразделение удалено' . $department->name);
     ST::redirectToRoute('Departments/index');
 }
 function put($adress, $theme, $message)
 {
     $this->validator->validate(['address' => [$adress, 'required|max(160)'], 'theme' => [$theme, 'required|max(512)'], 'message' => [$message, 'required']]);
     //if no passes
     if (!$this->validator->passes()) {
         foreach ($this->validator->errors()->all() as $message) {
             App::$instance->log->logWrite(LOG_MAIL_SENDED, $message);
         }
         return false;
     }
     $mailToStack = new MailStack();
     $mailToStack->address = $adress;
     $mailToStack->theme = ST::cleanUpText($theme);
     $mailToStack->message = ST::cleanUpText($message);
     $mailToStack->owner_ip = 0;
     $mailToStack->save();
     return true;
 }
示例#15
0
 static function checkToken()
 {
     return true;
     if (!isset($_SESSION['token']) || is_null($_SESSION['token']) || is_null(Request::createFromGlobals()->get('csrf_token'))) {
         throw new RuntimeException("Bad Token initialization");
     }
     $flag = false;
     foreach ($_SESSION['token'] as $key => $token) {
         if ($token === Request::createFromGlobals()->get('csrf_token')) {
             $flag = true;
             //drop this token
             unset($_SESSION['token'][$key]);
         }
     }
     if ($flag) {
         return true;
     } else {
         ST::routeToErrorPage('bad-token');
     }
 }
示例#16
0
 public function ask($file, $key)
 {
     $result = null;
     if (file_exists(NODE_REAL_PATH . "config/" . $file . ".xml")) {
         $helpfile = (object) simplexml_load_file(NODE_REAL_PATH . "config/" . $file . ".xml");
         foreach ($helpfile as $element) {
             if (strval($element->name) == $key) {
                 $result = "<div style='font-size: 16px;'>" . strval($element->content) . "</div>";
                 if (isset($element->image)) {
                     $result = "<div class='text-center'><image style='width:95%;' src='" . $element->image . "'/></div>" . $result;
                 }
             }
         }
     }
     if (ST::isAjaxRequest()) {
         print json_encode([$result]);
     } else {
         return $result;
     }
 }
示例#17
0
 function __construct()
 {
     if (isset($_GET['r'])) {
         //разбить запрос
         $splitReq = explode('/', $_GET['r']);
         //получить имя файла, достать последний массив из конца сстроки запроса
         $this->filename = array_pop($splitReq);
         //все остальное в массиве, это путь к файлу
         $this->sect = $splitReq;
         //process request
         $this->processRequest();
     } else {
         if (isset($_GET['route'])) {
             $frontController = new FrontController();
             $frontController->run();
             exit;
         }
         ST::redirectToRoute("Index/index");
     }
 }
 function pushToStack($vks_id, $force = false)
 {
     try {
         $vks = Vks::approved()->notEnded()->findOrFail($vks_id);
     } catch (Exception $e) {
         $this->error('404');
     }
     if (!OutlookCalendarRequest::where('user_id', App::$instance->user->id)->where('vks_id', $vks->id)->count()) {
         OutlookCalendarRequest::create(array('user_id' => App::$instance->user->id, 'vks_id' => $vks->id, 'request_type' => OutlookCalendarRequest::REQUEST_TYPE_NEW, 'send_status' => OutlookCalendarRequest::SEND_STATUS_REQUIRED));
         App::$instance->log->logWrite(LOG_OTHER_EVENTS, "New Outlook request create for " . App::$instance->user->login . ', vks: ' . $vks->id);
         App::$instance->MQ->setMessage("Приглашение сформировано, ожидайте, отправка будет произведена в течении 2х минут");
     } else {
         if ($force) {
             $reSend = OutlookCalendarRequest::where('user_id', App::$instance->user->id)->where('vks_id', $vks->id)->first();
             $reSend->send_status = OutlookCalendarRequest::SEND_STATUS_REQUIRED;
             $reSend->save();
             App::$instance->log->logWrite(LOG_OTHER_EVENTS, "New Outlook request create for " . App::$instance->user->login . ', vks: ' . $vks->id);
             App::$instance->MQ->setMessage("Приглашение сформировано, ожидайте, отправка будет произведена в течении 2х минут");
         } else {
             App::$instance->MQ->setMessage("Приглашение уже отправлялось в ваш календарь, <a class='confirmation' href='" . ST::route('OutlookCalendarRequest/pushToStack/' . $vks->id . '/forced') . "'>Отправить еще раз</a>");
         }
     }
     ST::redirect('back');
 }
示例#19
0
    ?>
            <table class="table table-bordered">

                <th>#ВКС</th>
                <th>Название</th>
                <th>Дата\время</th>
                <th>Точка</th>
                <th>Статус</th>
                <th>Создано</th>
                <?php 
    $c = 1;
    foreach ($calls as $call) {
        ?>
                    <tr>
                        <td><?php 
        echo ST::linkToVksPage($call->vks->id, true);
        ?>
</td>
                        <td><?php 
        echo $call->vks->title;
        ?>
</td>
                        <td>
                            <?php 
        echo date_create($call->vks->date)->format("d.m.Y");
        ?>
,
                            <?php 
        echo date_create($call->vks->start_date_time)->format("H:i");
        ?>
                            - <?php 
示例#20
0
<!--">Инициаторы</a> </li>-->
            <li><a href="<?php 
echo ST::route("Settings/editCodeDelivery");
?>
"><h3
                        style="margin-top: -15px;"><span
                            class="glyphicon glyphicon-globe"></span></h3>Шаблоны выдачи кодов подключения</a></li>
            <li><a href="<?php 
echo ST::route("BlockedTime/index");
?>
"><h3 style="margin-top: -15px;"><span
                            class="glyphicon glyphicon-time"></span></h3>Блокировки</a></li>
            <li><a href="<?php 
echo ST::route("Settings/managePublicMessage");
?>
"><h3 style="margin-top: -15px;"><span
                            class="glyphicon glyphicon-comment"></span></h3>Публичное сообщение</a></li>
            <li><a href="<?php 
echo ST::route("Settings/manageHelp");
?>
"><h3 style="margin-top: -15px;"><span
                            class="glyphicon glyphicon-question-sign"></span></h3>Подсказки на формах</a></li>
            <li><a href="<?php 
echo ST::route("Settings/editOther");
?>
"><h3 style="margin-top: -15px;"><span
                            class="glyphicon glyphicon-cog"></span></h3>Разное</a></li>

        </ul>
    </div>
<?php

ST::deployTemplate('heads/ui_timepicker.inc');
RenderEngine::MenuChanger();
?>

<div class="container">
    <div class="col-md-12 text-center">
        <br><br><br><br>
        <h1 class="text-muted">Ошибка</h1>
        <span class="text-muted" style="font-size: 160px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">401</span>

        <h1 class="text-muted">Недостаточно прав для доступа</h1>
        <hr>
        <h4 class="text-center"><?php 
echo !Auth::isLogged(App::$instance) ? "<a href='" . ST::routeToCa('AuthNew/login') . "'>Войти в систему</a> " : '';
?>
</h4>
    </div>
</div>
示例#22
0
</div>
<div class="col-lg-6">

        <h4>Изменить блокировку в работе системы
        <span class="pull-right"><a class="btn btn-info" href="<?php 
echo ST::route('BlockedTime/copy/' . $block->id);
?>
" title="Копировать"><span class="glyphicon glyphicon-duplicate"></span></a></span> </h4>

    <div class="clearfix"></div>
    <hr>
    <form class="form-horizontal" method="post" action="<?php 
echo ST::route('BlockedTime/update/' . $block->id);
?>
">
        <?php 
include_once CORE_REPOSITORY_REAL_PATH . 'views/settings/blockedtime/_form.php';
?>
        <div class="form-group">
            <div class="col-sm-offset-3 col-sm-9">
                <button type="submit" class="btn btn-success btn-lg">Изменить</button>
                <a href="<?php 
echo ST::route('BlockedTime/delete/' . $block->id);
?>
"
                   class="btn confirmation btn-danger btn-sm">Удалить блокировку</a>
            </div>
        </div>
    </form>
</div>
示例#23
0
<?php

ST::deployTemplate('heads/ui_timepicker.inc');
RenderEngine::MenuChanger();
//dump($_SESSION);
//Token::makeToken();
//dump($_SESSION);
$backPack = ST::lookAtBackPack();
$backPack = $backPack->request;
?>
<div class='container'>
    <div class=' col-md-offset-2 col-md-8'>
        <div class='col-md-offset-3 col-md-8'>

            <form class='form-horizontal' method='post' action="<?php 
echo ST::route('User/store');
?>
">
                <div class='form-group'>
                    <h3>Регистрация нового пользователя</h3><hr>
                </div>
                <?php 
echo Token::castTokenField();
?>
                <div class='form-group'>
                    <label>Логин:</label>
                    <input class='form-control' name='login' value="<?php 
echo $backPack->has('login') ? $backPack->get('login') : Null;
?>
" "/>
                    <span class="help-block">*Должен совпадать с адресом корпоративной почты (В  сегменте Alpha) (прим.: tomarov@ab.srb.local), на этот адрес мы отправим письмо для подтверждения регистрации</span>
示例#24
0
<?php

ST::deployTemplate('heads/ui_timepicker.inc');
RenderEngine::MenuChanger();
$backPack = ST::lookAtBackPack();
?>
<div class="container">
    <div class="col-lg-6 col-lg-offset-3">
        <form class="form-horizontal" method='post' action="<?php 
echo ST::route("Settings/storeServersLoad");
?>
">
            <?php 
echo Token::castTokenField();
?>
            <?php 
$c = 1;
foreach ($servers as $server) {
    ?>

                <div class="form-group">
                    <label for="">Название</label>
                    <input class="form-control" name="server[<?php 
    echo $c;
    ?>
][alias]"
                           value="<?php 
    echo $backPack->request->get('server')[$c]['alias'] ? $backPack->request->get('server')[$c]['alias'] : $server['alias'];
    ?>
"/>
                </div>
 public function storeHelp()
 {
     Token::checkToken();
     $xml = new SimpleXMLElement('<root/>');
     if ($this->request->request->has('help')) {
         foreach ($this->request->request->get('help') as $help) {
             $this->validator->validate([$help['humanized'] => [$help['content'], 'required|max(320)']]);
             //if no passes
             if (!$this->validator->passes()) {
                 $this->putUserDataAtBackPack($this->request);
                 App::$instance->MQ->setMessage($this->validator->errors()->all());
                 ST::redirect("back");
             }
             $srvXml = $xml->addChild('element');
             $srvXml->addChild('humanized', $help['humanized']);
             $srvXml->addChild('name', $help['name']);
             $srvXml->addChild('content', $help['content']);
         }
         $xml->asXML("config/help_standart.xml");
         App::$instance->MQ->setMessage('Список обновлен');
         App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'изменены сообщения помощи');
     } else {
         App::$instance->MQ->setMessage('Нет обязательного параметра');
     }
     return ST::redirectToRoute('index/index');
 }
示例#26
0
<?php

Auth::isAdminOrDie(App::$instance);
ST::deployTemplate('heads/ui_timepicker.inc');
ST::setUserCss('attendance/style.css');
ST::setUserCss('attendance/manage-style.css');
RenderEngine::MenuChanger();
//dump($data['backPack']->parent_id);
//dump($data);
?>
<script>
    $(document).ready(function () {
        showOnly(".show10-1", 5);
        showOnly(".show10-2", 5);
    })
</script>
<div class="container">
    <div class="col-lg-1 col-sm-offset-2"><a class="btn btn-default"
                                             href="?route=AttendanceNew/show/<?php 
echo $data['backPack']->parent_id;
?>
">
            Назад</a></div>
    <div class="col-md-6 block-border-shadow-normal-padding left-border padding25">
        <h4>Редактировать точку/контейнер</h4>
        <hr>
        <div class="alert alert-danger">Свойтво "техническая поддержка" используется в экспериментальном режиме и пока нигде не используется</div>
        <form class="form-horizontal" method="post" action="?route=AttendanceNew/update/<?php 
echo $data['backPack']->id;
?>
">
 public function askAtDateTime(DateTime $startDateTime, DateTime $endDateTime, $vks_blocked_type)
 {
     $blocks = BlockedTime::where('end_at', ">=", $startDateTime)->where('start_at', '<=', $endDateTime)->where('vks_type_blocked', intval($vks_blocked_type))->get();
     if (ST::isAjaxRequest()) {
         print json_encode($blocks);
     } else {
         return $blocks;
     }
 }
示例#28
0
<?php

include_once CORE_REPOSITORY_REAL_PATH . "views/main.php";
ST::setUserCss('attendance/style.css');
ST::setUserCss('attendance/manage-style.css');
$p = new Select2Assert();
$p->init();
$points = ST::lookAtBackPack();
$points = $points->request;
?>
<div class="container">
    <div class="col-lg-1"><a class="btn btn-default" href="?route=AttendanceNew/show/<?php 
echo $data['rootId'];
?>
"> Назад</a>
    </div>
    <div class="col-md-11  block-border-shadow-normal-padding left-border padding25">
        <h4>Создать точку/контейнер</h4>
        <hr>
        <div class="alert alert-danger">Свойтво "техническая поддержка" используется в экспериментальном режиме и пока нигде не используется</div>
        <div class="">
            <button class="btn btn-info add-point-row" type="button">+ Запись</button>
        </div>
        <form class="form-horizontal" method="post" action="?route=AttendanceNew/store">
            <table class="table table-bordered" id="point-table" data-number="<?php 
echo $points->get('point') ? count($points->get('point')) : 1;
?>
">
                <th>Имя</th>
                <th>ip*</th>
                <th>Тип</th>
<?php

ST::deployTemplate('heads/ui_timepicker.inc');
RenderEngine::MenuChanger();
?>

<div class="container">
    <div class="col-md-12 text-center">
        <br><br><br><br>
        <h1 class="text-muted">Ошибка</h1>
        <span class="text-muted" style="font-size: 160px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">409</span>

        <h1 class="text-muted">Запрашиваемую ВКС редактировать запрещено</h1>
        <hr>
        <h4 class="text-center"><a href="<?php 
echo ST::route('Index/index');
?>
">Вернуться на главную</a></h4>
    </div>
</div>
示例#30
0
                        <div class="col-lg-8">
                            <input class='form-control' type='password'
                                   name='password'>
                        </div>
                    </div>

                    <div class='form-group'>
                        <div class="col-lg-8 col-lg-offset-2">
                            <div class="checkbox">
                                <label>
                                    <input type='checkbox' name='remMeVks'>Запомнить меня
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class='form-group'>
                        <div class="col-lg-8 col-lg-offset-2">
                            <button class='btn btn-success btn-lg' type="submit">Войти</button>
                            <a class='btn btn-link' href="<?php 
echo ST::route('AuthNew/showRecallPwd');
?>
">Не помню пароль</a>
                        </div>
                    </div>
            </form>
        </div>
    </div>
</div>