Beispiel #1
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $expert = ORM::factory('Expert', $id);
     if (!$expert->loaded()) {
         $this->redirect('manage/expert');
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $expert->delete();
         $opinions = ORM::factory('Expert_Opinion')->where('expert_id', '=', $id)->find_all();
         foreach ($opinions as $item) {
             ORM::factory('Expert_Opinion', $item->id)->delete();
         }
         $list = ORM::factory('Expert');
         $paginate = Paginate::factory($list);
         $list = $list->find_all();
         $last_page = $paginate->page_count();
         if ($this->page > $last_page) {
             $this->page = $this->page - 1;
         }
         if ($this->page <= 0) {
             $this->page = 1;
         }
         Message::success(i18n::get('Judge and all his positions removed'));
         $this->redirect('manage/expert/page-' . $this->page);
     } else {
         $this->set('expert', $expert)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/expert/page-' . $this->page));
     }
 }
Beispiel #2
0
 public function action_spam()
 {
     $id = (int) $this->request->param('id', 0);
     $question = ORM::factory('Feedback_Question', $id);
     $user_id = $this->user->id;
     if (!$question->loaded()) {
         $this->redirect('manage/feedback');
     }
     $token = Arr::get($_POST, 'token', false);
     $return = Security::xss_clean(Arr::get($_GET, 'r', 'manage/expert'));
     $this->set('return', Url::media($return));
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $question->is_spam = ($question->is_spam + 1) % 2;
         $question->spam_mod_id = $user_id;
         $question->save();
         if ($question->is_spam == 1) {
             Message::success(i18n::get('The question is marked as spam'));
         } else {
             Message::success(i18n::get('Marked "Spam" is removed from the question'));
         }
         $this->redirect($return);
     } else {
         if ($question->loaded()) {
             $this->set('question', $question)->set('token', Security::token(true));
         } else {
             $this->redirect('manage/expert');
         }
     }
 }
Beispiel #3
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $expert = ORM::factory('Expert_Opinion', $id);
     if (!$expert->loaded()) {
         $this->redirect('manage/expertopinions');
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $loger = new Loger('delete', $expert->title);
         $loger->logThis($expert);
         $expert->delete();
         $list = ORM::factory('Expert_Opinion');
         $paginate = Paginate::factory($list);
         $list = $list->find_all();
         $last_page = $paginate->page_count();
         if ($this->page > $last_page) {
             $this->page = $this->page - 1;
         }
         if ($this->page <= 0) {
             $this->page = 1;
         }
         Message::success(i18n::get('The position of the expert removed'));
         $this->redirect('manage/expertopinions/page-' . $this->page);
     } else {
         $this->set('item', $expert)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/expertopinions/page-' . $this->page));
     }
 }
Beispiel #4
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $type = Arr::get($_GET, 'type', 'slider');
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $slider = ORM::factory('Slider', $id);
         $loger = new Loger('delete', $slider->link_ru);
         $loger->log($slider);
         $slider->delete();
         $this->redirect('manage/sliders/?type=' . $type);
     } else {
         $this->set('token', Security::token(true))->set('r', Url::media('manage/sliders?type=' . $type));
     }
 }
Beispiel #5
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         ORM::factory('Leader', $id)->delete();
         $this->redirect('manage/leaders');
     } else {
         $leader = ORM::factory('Leader', $id);
         if ($leader->loaded()) {
             $this->set('record', $leader)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/leader'));
         } else {
             throw new HTTP_Exception_404();
         }
     }
 }
Beispiel #6
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $token = Arr::get($_POST, 'token', false);
     $acts = ORM::factory('Acts', $id);
     if (!$acts->loaded()) {
         throw new HTTP_Exception_404();
     }
     if ($this->request->post() && Security::token() === $token) {
         $acts->delete();
         Message::success('Акт удален');
         $this->redirect('manage/acts');
     } else {
         $this->set('record', $acts)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/acts'));
     }
 }
Beispiel #7
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         ORM::factory('Document', $id)->delete();
         $this->redirect('manage/documents');
     } else {
         $document = ORM::factory('Document', $id);
         if ($document->loaded()) {
             $this->set('record', $document)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/document'));
         } else {
             $this->redirect('manage/document');
         }
     }
 }
Beispiel #8
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $link = ORM::factory('Link', $id);
     if (!$link->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $link->delete();
         Message::success('Удалено');
         $this->redirect('manage/links');
     } else {
         $this->set('record', $link)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/links'));
     }
 }
Beispiel #9
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $point = ORM::factory('Point', $id);
     if (!$point->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $loger = new Loger($event, $point->name);
         $loger->logThis($point);
         $redirect = 'manage/maps/view/' . $point->district_id;
         $point->delete();
         $this->redirect($redirect);
     } else {
         $this->set('record', $point)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/maps/view/' . $point->district_id));
     }
 }
Beispiel #10
0
 public function action_delete()
 {
     $type = (int) Arr::get($_GET, 'type', 0);
     $id = (int) $this->request->param('id', 0);
     $item = ORM::factory('Comment', $id);
     if (!$item->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $item->delete();
         Message::success('Комментарий удален');
         $this->redirect('manage/comments?type=' . $type);
     } else {
         $this->set('type', $type);
         $this->set('record', $item)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/comments?type=' . $type));
     }
 }
Beispiel #11
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $infograph = ORM::factory('Infograph', $id);
     if (!$infograph->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $loger = new Loger('delete', $infograph->title);
         $loger->log($infograph);
         $infograph->delete();
         Message::success('Запись удалена');
         $this->redirect('manage/infographs');
     } else {
         $this->set('record', $infograph)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/infographs'));
     }
 }
Beispiel #12
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $item = ORM::factory('Chronology_Line', $id);
     if (!$item->loaded()) {
         throw new HTTP_Exception_404('Page not found');
     }
     $period = ORM::factory('Chronology', $item->period_id);
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->post() and Security::token() === $token) {
         $loger = new Loger('delete', $item->title);
         $loger->logThis($item);
         $item->delete();
         Message::success('Событие удалено');
         $this->redirect('manage/lines/list/' . $period->id);
     } else {
         $this->set('token', Security::token(true))->set('r', Url::media('manage/lines/list/' . $period->id))->set('period', $period);
     }
 }
Beispiel #13
0
 public function action_variantdelete()
 {
     $id = (int) $this->request->param('id', 0);
     $variant = ORM::factory('Test_Questvar', $id);
     if (!$variant->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $quest_id = $variant->quests_id;
         $variant->delete();
         Message::success(I18n::get('Record deleted'));
         $this->redirect('manage/tests/variants/' . $quest_id);
     } else {
         $this->set('record', $variant)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/tests/variants/' . $variant->quest_id));
     }
 }
Beispiel #14
0
 public function action_deletecategory()
 {
     $id = (int) $this->request->param('id', 0);
     $category = ORM::factory('Zhuze', $id);
     if (!$category->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $category->delete();
         Message::success(I18n::get("Category deleted"));
         $this->redirect('manage/specprojects/zhuzes');
     } else {
         $this->set('record', $category)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/specprojects/zhuzes'));
     }
 }
Beispiel #15
0
            ?>
"><span><?php 
            echo $max_page;
            ?>
</span></a>
                <?php 
        }
        ?>
            <?php 
    }
    ?>
            <?php 
    if ($page < $max_page) {
        ?>
                <a href="<?php 
        echo Url::media($link) . '/' . $key . '-' . ($page + 1);
        echo Url::query();
        ?>
"><span><?php 
        echo __('Next');
        ?>
</span></a>
            <?php 
    } else {
        ?>

            <?php 
    }
    ?>
        </div>
    </div>
Beispiel #16
0
                    } else {
                        $('#err-length').remove();
                        $('#error').append('<div id="err-length">Ошибка Добавления комментария! Приносим свои извенения.</div>');
                    }

                },
                error: function () {
                    alert('Ошибка добавления коментария.')
                }
            });
        });
        $("#deploy_button").click(function (e) {
            e.preventDefault();
            $.ajax({
                url: "<?php 
echo Url::media('ajax_comments/deploy_comment');
?>
",
                type: "POST",
                dataType: "json",
                data: { count_comment: view_count_comment, id: '<?php 
echo $id;
?>
' },
                success: function (data) {
                    if (data.length > 0) {
                        $.each(data, function (i, value) {
                            var photo = '';
                            var url = '<?php 
echo URL::site('profile/view/');
?>
Beispiel #17
0
            Введите логин:
            <input type="text" name="username" class="input-block-level" required>
            <img src="<?php 
    echo Url::media('/captcha/default');
    ?>
" width="150" height="50" alt="Captcha" class="captcha_old"/>
            <input type="text" name="captcha" required style="margin: 0; width: 147px; height: 42px; font-size:35px">
            <a onclick="reload()" style="cursor: pointer;"><img src="<?php 
    echo Url::media('media/theme/refresh.png');
    ?>
" width="16px" height="16px"></a>
            <script type="text/javascript">
                function reload(){
                    id=Math.floor(Math.random()*1000000);
                    $("img.captcha_old").attr("src","<?php 
    echo Url::media('/captcha/default?id=');
    ?>
"+id);
                }
            </script>
        </div>
        <div class="modal-footer">
            <button class="btn btn-large btn-primary" type="submit">Восстановить пароль</button>
        </div>
    </form>
    <?php 
} else {
    ?>
    <div class="modal-header">
        <a href="<?php 
    echo Url::site($return);
Beispiel #18
0
            ?>
"><span><?php 
            echo $max_page;
            ?>
</span></a>
        <?php 
        }
        ?>
        <?php 
    }
    ?>
    <?php 
    if ($page < $max_page) {
        ?>
        <a href="<?php 
        echo strip_tags(Security::xss_clean(Url::media($link) . '/' . $key . '-' . ($page + 1)));
        echo strip_tags(Security::xss_clean(Url::query()));
        ?>
"><span><?php 
        echo __('Next');
        ?>
</span></a>
    <?php 
    } else {
        ?>
        <span class="arrows"></span>
    <?php 
    }
    ?>
    </div>
</div>
Beispiel #19
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $content = ORM::factory('Pages_Content', $id);
     if (!$content->loaded()) {
         throw new HTTP_Exception_404('Page not found');
     }
     $page = ORM::factory('Page', $content->page_id);
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->post() and Security::token() === $token) {
         $loger = new Loger('delete', $content->title);
         $loger->logThis($content);
         $content->delete();
         Message::success('Контент удален');
         $this->redirect('manage/contents/list/' . $page->id);
     } else {
         $this->set('token', Security::token(true))->set('r', Url::media('manage/contents/list/' . $page->id))->set('page', $page);
     }
 }
Beispiel #20
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $graph = ORM::factory('Graph', $id);
     if (!$graph->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $items = $graph->items_graph->find_all();
         foreach ($items as $item) {
             $values = $item->values_graph->find_all();
             foreach ($values as $value) {
                 $value->delete();
             }
             $item->delete();
         }
         $graph->delete();
         Message::success('График удален');
         $this->redirect('manage/graphs');
     } else {
         $this->set('record', $graph)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/graphs'));
     }
 }
Beispiel #21
0
 public function action_delete()
 {
     $id = (int) $this->request->param('id', 0);
     $item = ORM::factory('Calendar', $id);
     if (!$item->loaded()) {
         throw new HTTP_Exception_404();
     }
     $month = $item->month;
     $day = $item->day;
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $loger = new Loger('delete', $item->title);
         $loger->logThis($item);
         $item->delete();
         Message::success('Удалено');
         $this->redirect('manage/calendar/list?m=' . $month . '&d=' . $day);
     } else {
         $this->set('record', $item)->set('month', $month)->set('day', $day)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/calendar/list?m=' . $month . '&d=' . $day));
     }
 }
Beispiel #22
0
 public function action_deletePost()
 {
     $id = (int) $this->request->param('id', 0);
     $attach = ORM::factory('Contacts_Attachment', $id);
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $contact_id = $attach->contact_id;
         $attach->delete();
         $this->redirect('manage/contacts/view/' . $contact_id);
     } else {
         if ($attach->loaded()) {
             $this->set('record', $attach)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/contacts'));
         } else {
             $this->redirect('manage/contacts');
         }
     }
 }
Beispiel #23
0
 public function action_deletecategory()
 {
     $id = (int) $this->request->param('id', 0);
     $item = ORM::factory('Category', $id);
     if (!$item->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $item->delete();
         Message::success('Категория удалена');
         $this->redirect('manage/video');
     } else {
         $this->set('record', $item)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/video'));
     }
     $this->template->set_filename('manage/video/delete');
 }
Beispiel #24
0
 public function action_deletechapter()
 {
     $id = (int) $this->request->param('id', 0);
     $chapter = ORM::factory('Book_Chapter', $id);
     if (!$chapter->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $book_id = $chapter->book_id;
         $chapter->delete();
         Message::success(I18n::get('Record deleted'));
         $this->redirect('manage/library/chapters/' . $book_id);
     } else {
         $this->set('record', $chapter)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/library/chapters/' . $chapter->book_id));
     }
 }
 public function action_delete()
 {
     $type = $this->request->param('type');
     $id = (int) $this->request->param('id', 0);
     $public = ORM::factory(ucfirst($type), $id);
     if (!$public->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $tags = $public->tags->where('type', '=', $type)->find_all();
         foreach ($tags as $tag) {
             ORM::factory('Tag', $tag->id)->delete();
         }
         $loger = new Loger('delete', $public->title);
         $loger->logThis($public);
         $public->delete();
         Message::success('Удалено');
         $this->redirect('manage/publicationprojects/' . $type);
     } else {
         $this->set('record', $public)->set('type', $type)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/publications/' . $type));
     }
 }
Beispiel #26
0
 public function action_delete()
 {
     $type = Arr::get($_GET, 'type');
     $id = (int) $this->request->param('id', 0);
     $forecast = ORM::factory('Forecasts_Item', $id);
     if (!$forecast->loaded()) {
         throw new HTTP_Exception_404();
     }
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $forecast->delete();
         Message::success('Прогноз удален');
         $this->redirect('manage/forecasts/list/' . $type);
     } else {
         $this->set('record', $forecast)->set('token', Security::token(true))->set('cancel_url', Url::media('manage/forecasts/list/' . $type));
     }
 }
Beispiel #27
0
                                  },
            upload_url           :"<?php 
echo Url::site('storage/upload');
?>
",
            flash_url            :"<?php 
echo Url::media('media/js/swfupload.swf');
?>
",
            file_post_name       :"Filedata",
            button_placeholder_id:"upload_button_<?php 
echo $rnd;
?>
",
            button_image_url     :"<?php 
echo Url::media('media/theme/upload_button.png');
?>
",
            button_width         :100,
            button_height        :30,
            button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT,
            file_size_limit    : '<?php 
echo Storage::to_byte(ini_get('upload_max_filesize'));
?>
',
            upload_complete_handler     :function () {
                this.startUpload();
                $("#progress_<?php 
echo $rnd;
?>
").hide();
Beispiel #28
0
 public function action_password()
 {
     $this->set('cancel_url', Url::media('manage/users/page-' . $this->page));
     $user_id = (int) $this->request->param('id', 0);
     $token = Arr::get($_POST, 'token', false);
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $password = Arr::get($_POST, 'password', NULL);
         $password_confirm = Arr::get($_POST, 'password_confirm', NULL);
         if (empty($password)) {
             //Notify::instance()->add('Пароль не должен быть пустым')->save();
             Message::success('Пароль не должен быть пустым');
             $this->redirect($this->request->uri());
         }
         if ($password !== $password_confirm) {
             Message::success('Пароли не совпадают');
             $this->redirect($this->request->uri());
         }
         $user = ORM::factory('User', $user_id);
         if ($user->loaded()) {
             $user->password = $password;
             $user->save();
             Message::success('Пароль пользователя успешно изменен');
             $this->redirect('manage/users/page-' . $this->page);
         } else {
             Message::success('Пользователь не найден');
             $this->redirect('manage/users/page-' . $this->page);
         }
     } else {
         $this->set('token', Security::token(true));
     }
 }
Beispiel #29
0
            },
            upload_url: "<?php 
echo Url::site('storage/upload');
?>
",
            flash_url: "<?php 
echo Url::media('media/js/swfupload.swf');
?>
",
            file_post_name: "Filedata",
            button_placeholder_id: "upload_button_<?php 
echo $rnd;
?>
",
            button_image_url     :"<?php 
echo Url::media('media/images/v1/pixel.png');
?>
",
            button_width: 458,
            button_height: 34,
            button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
            file_types: "*.mp3;*.jpg;*.jpeg;*.png;*.jpe;*.gif;*.xls;*.xlsx;*.doc;*.docx;*.ppt;*.pptx;*.rar;*.zip;*.7zip;*.7z;*.flv;*.mp4;*.3gp;*.wmv'*.avi;*.pdf;*.psd;*.odt;*.ods;*.odp;",
            file_size_limit: '<?php 
echo Storage::to_byte(ini_get('upload_max_filesize'));
?>
',
            upload_complete_handler: function () {

                this.startUpload();
                $("#progress_<?php 
echo $rnd;
Beispiel #30
0
 public function action_one()
 {
     $id = (int) $this->request->param('id', 0);
     $parent_page = ORM::factory('Chronology', $id);
     if ($post = $this->request->post()) {
         $page = ORM::factory('Chronology');
         $page->name = Security::xss_clean(Arr::get($post, 'name', ''));
         $page->start = Security::xss_clean(Arr::get($post, 'start', ''));
         $page->finish = Security::xss_clean(Arr::get($post, 'finish', ''));
         if ($parent_page->loaded()) {
             $page->insert_as_last_child($parent_page);
         } else {
             $page->make_root();
         }
         Message::success('Добавлено');
         $this->redirect('manage/chronology');
     }
     $this->set('cancel_url', Url::media('manage/chronology'))->set('period', $parent_page);
 }