コード例 #1
0
ファイル: Log.php プロジェクト: procivam/hochu-bilet-v3
 function before()
 {
     parent::before();
     $this->_seo['h1'] = 'Лента событий';
     $this->_seo['title'] = 'Лента событий';
     $this->setBreadcrumbs('Лента событий', 'backend/' . Route::controller() . '/index');
     $this->limit = Config::get('limit_backend');
 }
コード例 #2
0
ファイル: Auth.php プロジェクト: procivam/hochu-bilet-v3
 function logoutAction()
 {
     if (!User::factory()->_admin) {
         HTTP::redirect('backend/' . Route::controller() . '/login');
     }
     User::factory()->logout();
     HTTP::redirect('backend/' . Route::controller() . '/login');
 }
コード例 #3
0
ファイル: Config.php プロジェクト: procivam/hochu-bilet-v3
 function editAction()
 {
     if ($_POST) {
         foreach ($_POST['FORM'] as $key => $value) {
             $res = Common::update($this->tablename, array('zna' => $value))->where('id', '=', $key)->execute();
         }
         Message::GetMessage(1, 'Вы успешно изменили данные!');
         HTTP::redirect('backend/' . Route::controller() . '/edit');
     }
     $result = DB::select()->from($this->tablename)->where('status', '=', 1)->order_by('sort')->find_all();
     $this->_toolbar = Widgets::get('Toolbar/EditSaveOnly');
     $this->_content = View::tpl(array('result' => $result, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/Edit');
 }
コード例 #4
0
ファイル: Base.php プロジェクト: procivam/hochu-bilet-v3
 public function access()
 {
     if (!User::info()) {
         return false;
     }
     $this->_access = User::caccess();
     if (in_array(Route::controller(), array('ajax', 'form')) or in_array(Route::action(), array('printTicket', 'print', 'createOrder')) or Route::controller() == 'orders' && Route::action() == 'delete') {
         return true;
     }
     if ($this->_access == 'no') {
         $this->no_access();
     }
     if ($this->_access == 'view' && Route::action() != 'index' && Route::action() != 'edit') {
         $this->no_access();
     }
 }
コード例 #5
0
 function editAction()
 {
     if ($_POST) {
         $post = $_POST['FORM'];
         $post['status'] = Arr::get($_POST, 'status', 0);
         $res = Common::update($this->tablename, $post)->where('id', '=', Arr::get($_POST, 'id'))->execute();
         if ($res) {
             Message::GetMessage(1, 'Вы успешно изменили данные!');
             HTTP::redirect('backend/' . Route::controller() . '/edit/' . (int) Route::param('id'));
         } else {
             Message::GetMessage(0, 'Не удалось изменить данные!');
         }
         $post['id'] = Arr::get($_POST, 'id');
         $result = Arr::to_object($post);
     } else {
         $result = DB::select()->from($this->tablename)->where('id', '=', (int) Route::param('id'))->find();
     }
     $this->_toolbar = Widgets::get('Toolbar/Edit');
     $this->_seo['h1'] = 'Редактирование';
     $this->_seo['title'] = 'Редактирование';
     $this->setBreadcrumbs('Редактирование', 'backend/' . Route::controller() . '/edit/' . (int) Route::param('id'));
     $this->_content = View::tpl(array('obj' => $result, 'tpl_folder' => $this->tpl_folder, 'tablename' => $this->tablename), $this->tpl_folder . '/Form');
 }
コード例 #6
0
ファイル: Afisha.php プロジェクト: procivam/hochu-bilet-v3
 function deleteImageAction()
 {
     $id = (int) Route::param('id');
     if (!$id) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     $page = DB::select()->from($this->tablename)->where('id', '=', $id)->find();
     if (!$page) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     Files::deleteImage($this->image, $page->image);
     DB::update($this->tablename)->set(array('image' => null))->where('id', '=', $id)->execute();
     Message::GetMessage(1, 'Данные удалены!');
     HTTP::redirect('backend/' . Route::controller() . '/edit/' . $id);
 }
コード例 #7
0
ファイル: Subscribe.php プロジェクト: procivam/hochu-bilet-v3
 function sendAction()
 {
     $emails = array();
     $list = array();
     if ($_POST) {
         $post = $_POST['FORM'];
         $subscribers = DB::select('email', 'hash', 'name')->from('subscribers')->where('status', '=', 1)->find_all();
         foreach ($subscribers as $obj) {
             if (filter_var($obj->email, FILTER_VALIDATE_EMAIL) and !in_array($obj->email, $emails)) {
                 $emails[] = $obj;
                 $list[] = $obj->email;
             }
         }
         if (!trim(Arr::get($post, 'subject'))) {
             Message::GetMessage(0, 'Поле "Тема" не может быть пустым!');
         } else {
             if (!trim(Arr::get($post, 'text'))) {
                 Message::GetMessage(0, 'Поле "Содержание" не может быть пустым!');
             } else {
                 if (empty($emails)) {
                     Message::GetMessage(0, 'Список выбраных E-Mail для рассылки пуст!');
                 } else {
                     $data = $post;
                     $data['count_emails'] = count($list);
                     $data['emails'] = implode(';', $list);
                     $res = Common::insert($this->tablename, $data)->execute();
                     foreach ($emails as $obj) {
                         $link = 'http://' . Arr::get($_SERVER, 'HTTP_HOST') . '/unsubscribe/hash/' . $obj->hash;
                         $from = array('{{unsubscribe}}', '{{user_name}}', '{{site}}', '{{date}}');
                         $to = array($link, $obj->name, Arr::get($_SERVER, 'HTTP_HOST'), date('d.m.Y'));
                         $message = str_replace($from, $to, Arr::get($post, 'text'));
                         $subject = str_replace($from, $to, Arr::get($post, 'subject'));
                         if (!Config::get('main.cron')) {
                             Email::send($subject, $message, $obj->email);
                         } else {
                             $data = array('subject' => $subject, 'text' => $message, 'email' => $obj->email);
                             $res = Common::insert(Config::get('main.tableCron'), $data)->execute();
                         }
                     }
                     Message::GetMessage(1, 'Письмо успешно разослано ' . $data['count_emails'] . ' подписчикам!');
                     HTTP::redirect('backend/' . Route::controller() . '/' . Route::action());
                 }
             }
         }
         $result = Arr::to_object($post);
     } else {
         $result = Arr::to_object(array('subscribers' => 1));
     }
     $this->_toolbar = Widgets::get('Toolbar/Subscribe');
     $this->_seo['h1'] = 'Отправка письма';
     $this->_seo['title'] = 'Отправка письма';
     $this->setBreadcrumbs('Отправка письма', 'backend/' . Route::controller() . '/add');
     $this->_content = View::tpl(array('obj' => $result, 'tpl_folder' => $this->tpl_folder, 'tablename' => $this->tablename), $this->tpl_folder . '/Send');
 }
コード例 #8
0
ファイル: Menu.php プロジェクト: procivam/hochu-bilet-v3
            ?>
/edit/<?php 
            echo $obj->id;
            ?>
" title="Редактировать"><i class="fa-pencil"></i> Редактировать</a>
											</li>
										<?php 
        }
        ?>
										<?php 
        if (Core\User::caccess() == 'edit') {
            ?>
											<li class="divider"></li>
											<li>
												<a onclick="return confirm('Это действие необратимо. Продолжить?');" href="/backend/<?php 
            echo \Core\Route::controller();
            ?>
/delete/<?php 
            echo $obj->id;
            ?>
" title="Удалить"><i class="fa-trash-o text-danger"></i> Удалить</a>
											</li>
										<?php 
        }
        ?>
		                            </ul>
		                        </li>
		                    </ul>
		                </td>
		            </tr>
				</table>
コード例 #9
0
ファイル: Control.php プロジェクト: procivam/hochu-bilet-v3
 function after_paymentAction()
 {
     if ($_POST) {
         $post = $_POST['FORM'];
         $post['status'] = Arr::get($_POST, 'status', 0);
         $res = Common::update($this->tablename, $post)->where('id', '=', Arr::get($_POST, 'id'))->execute();
         if ($res) {
             Message::GetMessage(1, 'Вы успешно изменили данные!');
             HTTP::redirect('backend/' . Route::controller() . '/' . Route::action());
         } else {
             Message::GetMessage(0, 'Не удалось изменить данные!');
         }
         $post['id'] = Arr::get($_POST, 'id');
         $result = Arr::to_object($post);
     } else {
         $result = DB::select()->from($this->tablename)->where('id', '=', 6)->find();
     }
     $this->_seo['h1'] = 'Управление страницей после оплаты';
     $this->_seo['title'] = 'Управление страницей после оплаты';
     $this->setBreadcrumbs('Управление страницей после оплаты', 'backend/' . Route::controller() . '/index');
     $this->_content = View::tpl(array('obj' => $result, 'tpl_folder' => $this->tpl_folder, 'tablename' => $this->tablename), $this->tpl_folder . '/Form');
 }
コード例 #10
0
ファイル: Contacts.php プロジェクト: procivam/hochu-bilet-v3
 function deleteAction()
 {
     $id = (int) Route::param('id');
     if (!$id) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     $page = DB::select()->from($this->tablename)->where('id', '=', $id)->find();
     if (!$page) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     DB::delete($this->tablename)->where('id', '=', $id)->execute();
     Message::GetMessage(1, 'Данные удалены!');
     HTTP::redirect('backend/' . Route::controller() . '/index');
 }
コード例 #11
0
ファイル: Items.php プロジェクト: procivam/hochu-bilet-v3
 function deleteAction()
 {
     $id = (int) Route::param('id');
     if (!$id) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     $page = DB::select()->from($this->tablename)->where('id', '=', $id)->find();
     if (!$page) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     $images = DB::select()->from('catalog_images')->where('catalog_id', '=', $id)->find_all();
     foreach ($images as $im) {
         @unlink(HOST . HTML::media('images/catalog/small/' . $im->image));
         @unlink(HOST . HTML::media('images/catalog/medium/' . $im->image));
         @unlink(HOST . HTML::media('images/catalog/big/' . $im->image));
         @unlink(HOST . HTML::media('images/catalog/original/' . $im->image));
     }
     DB::delete($this->tablename)->where('id', '=', $id)->execute();
     Message::GetMessage(1, 'Данные удалены!');
     HTTP::redirect('backend/' . Route::controller() . '/index');
 }
コード例 #12
0
ファイル: Admins.php プロジェクト: procivam/hochu-bilet-v3
 function archiveAction()
 {
     $id = (int) Route::param('id');
     $page = Model::getRow($id);
     if (!$page) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     if ($page->deleted) {
         Message::GetMessage(1, 'Данные уже в архиве!');
         HTTP::redirect('backend/archive/admins');
     }
     Model::update(Model::$table, array('deleted' => 1))->where('id', '=', $id)->execute();
     Message::GetMessage(1, 'Данные перемещены в архив!');
     HTTP::redirect('backend/' . Route::controller() . '/index');
 }
コード例 #13
0
ファイル: Roles.php プロジェクト: procivam/hochu-bilet-v3
 function deleteAction()
 {
     $id = (int) Route::param('id');
     $page = Model::getRow($id);
     if (!$page) {
         Message::GetMessage(0, 'Данные не существуют!');
         HTTP::redirect('backend/' . Route::controller() . '/index');
     }
     Model::delete($id);
     Message::GetMessage(1, 'Данные удалены!');
     HTTP::redirect('backend/' . Route::controller() . '/index');
 }
コード例 #14
0
ファイル: Route.php プロジェクト: procivam/hochu-bilet-v3
 /**
  *  Start site. Initialize controller
  */
 public function execute()
 {
     if (!file_exists(HOST . APPLICATION . '/Modules/Base.php')) {
         return Config::error();
     }
     require_once HOST . APPLICATION . '/Modules/Base.php';
     $module = ucfirst(Route::module());
     $controller = ucfirst(Route::controller());
     $action = Route::action();
     if (APPLICATION) {
         $path[] = str_replace('/', '', APPLICATION);
     }
     $path[] = 'Modules';
     if ($module) {
         $path[] = $module;
     }
     $path[] = 'Controllers';
     $path[] = $controller;
     if (file_exists(HOST . '/' . implode('/', $path) . '.php')) {
         return $this->start($path, $action);
     }
     unset($path[count($path) - 2]);
     if (file_exists(HOST . '/' . implode('/', $path) . '.php')) {
         return $this->start($path, $action);
     }
     return Config::error();
 }
コード例 #15
0
ファイル: User.php プロジェクト: procivam/hochu-bilet-v3
 /**
  * @return string
  */
 public function get_current_access()
 {
     if (!$this->_info) {
         return 'no';
     }
     $access = $this->_access;
     if ($this->_full_access || Route::controller() == 'auth' || Route::module() == 'ajax') {
         return $this->_current_access = 'edit';
     }
     if (!isset($access[Route::controller()]) || $access[Route::controller()] == 'no') {
         return $this->_current_access = 'no';
     }
     if ($access[Route::controller()] == 'view' && Route::action() != 'index' && Route::action() != 'edit') {
         return $this->_current_access = 'no';
     }
     if ($access[Route::controller()] == 'view' && Route::action() == 'edit' && $_POST) {
         return $this->_current_access = 'no';
     }
     return $this->_current_access = $access[Route::controller()];
 }