コード例 #1
0
ファイル: Admin.php プロジェクト: KasaiDot/FoolFrame
 public function before()
 {
     $request = $this->getRequest();
     $this->uri = $this->getContext()->getService('uri');
     $this->mailer = $this->getContext()->getService('mailer');
     $this->notices = $this->getContext()->getService('notices');
     $this->preferences = $this->getContext()->getService('preferences');
     $this->config = $this->getContext()->getService('config');
     $this->security = $this->getContext()->getService('security');
     $theme_instance = \Foolz\Theme\Loader::forge('foolframe_admin');
     $theme_instance->addDir(VENDPATH . 'foolz/foolframe/assets/themes-admin/');
     $theme_instance->addDir(VAPPPATH . 'foolz/foolframe/themes-admin/');
     $theme_instance->setBaseUrl($this->uri->base() . 'foolframe/');
     $theme_instance->setPublicDir(DOCROOT . 'foolframe/');
     // make it possible to override the theme so other framework components can extend with their own
     $this->setupTheme($theme_instance);
     $this->builder = $this->theme->createBuilder();
     $this->param_manager = $this->builder->getParamManager();
     $this->builder->createLayout('base');
     $this->builder->getProps()->addTitle(_i('Control Panel') . ' - ' . $this->preferences->get('foolframe.gen.website_title'));
     $this->param_manager->setParams(['context' => $this->getContext(), 'notices' => $this->notices, 'uri' => $this->uri, 'request' => $request]);
     // returns the hardcoded sidebar array (can't use functions when declaring a class variable)
     $sidebar = $this->getSidebarValues();
     $sidebar_dynamic = Hook::forge('Foolz\\FoolFrame\\Controller\\Admin::before#var.sidebar')->setObject($this)->setParam('sidebar', [])->execute()->getParam('sidebar');
     // merge if there were sidebar elements added dynamically
     if (!empty($sidebar_dynamic)) {
         $sidebar = $this->mergeSidebars($sidebar, $sidebar_dynamic);
     }
     $this->builder->createPartial('navbar', 'navbar');
     $this->builder->createPartial('sidebar', 'sidebar')->getParamManager()->setParams(['sidebar' => $this->getSidebar($request, $sidebar)]);
 }
コード例 #2
0
ファイル: Install.php プロジェクト: KasaiDot/FoolFrame
 public function before()
 {
     $this->notices = $this->getContext()->getService('notices');
     $this->uri = $this->getContext()->getService('uri');
     $this->config = $this->getContext()->getService('config');
     $this->install = new \Foolz\FoolFrame\Model\Install($this->getContext());
     $theme_instance = \Foolz\Theme\Loader::forge('foolframe_admin');
     $theme_instance->addDir(VENDPATH . 'foolz/foolframe/assets/themes-admin/');
     $theme_instance->setBaseUrl($this->uri->base() . 'foolframe/');
     $theme_instance->setPublicDir(DOCROOT . 'foolframe/');
     $this->theme = $theme_instance->get('foolz/foolframe-theme-admin');
     $this->builder = $this->theme->createBuilder();
     $this->builder->createLayout('base');
     $this->builder->createPartial('navbar', 'install/navbar');
     $this->builder->getProps()->addTitle(_i('FoolFrame Installation'));
     $this->param_manager = $this->builder->getParamManager();
     $this->param_manager->setParams(['context' => $this->getContext(), 'request' => $this->getRequest(), 'notices' => $this->notices, 'controller_title' => _i('FoolFrame Installation')]);
 }
コード例 #3
0
ファイル: Chan.php プロジェクト: procod3R/FoolFuuka
 public function radix_gallery($page = 1)
 {
     $this->response = new StreamedResponse();
     try {
         $board = Board::forge($this->getContext())->getThreads()->setRadix($this->radix)->setPage($page)->setOptions('per_page', 100);
         $comments = $board->getComments();
         $this->builder->createPartial('body', 'gallery')->getParamManager()->setParams(['board' => $board->getComments()]);
         $this->param_manager->setParams(['pagination' => ['base_url' => $this->uri->create([$this->radix->shortname, 'gallery']), 'current_page' => $page, 'total' => $board->getPages()]]);
     } catch (\Foolz\Foolfuuka\Model\BoardException $e) {
         return $this->error($e->getMessage());
     }
     $this->response->setCallback(function () {
         $this->builder->stream();
     });
     return $this->response;
 }
コード例 #4
0
ファイル: Reader.php プロジェクト: KasaiDot/FoolSlide2
 public function before()
 {
     $this->config = $this->getContext()->getService('config');
     $this->preferences = $this->getContext()->getService('preferences');
     $this->uri = $this->getContext()->getService('uri');
     $this->profiler = $this->getContext()->getService('profiler');
     // this has already been forged in the foolslide bootstrap
     $theme_instance = \Foolz\Theme\Loader::forge('foolslide');
     try {
         $theme_name = $this->getQuery('theme', $this->getCookie('theme')) ?: $this->preferences->get('foolslide.theme.default');
         $theme_name_exploded = explode('/', $theme_name);
         if (count($theme_name_exploded) >= 2) {
             $theme_name = $theme_name_exploded[0] . '/' . $theme_name_exploded[1];
         }
         $theme = $theme_instance->get($theme_name);
         if (!isset($theme->enabled) || !$theme->enabled) {
             throw new \OutOfBoundsException();
         }
         $this->theme = $theme;
     } catch (\OutOfBoundsException $e) {
         $theme_name = 'foolz/foolslide-theme-foolslide';
         $this->theme = $theme_instance->get('foolz/foolslide-theme-foolslide');
     }
     // TODO this is currently bootstrapped in the foolslide bootstrap because we need it running before the router.
     //$this->theme->bootstrap();
     $this->builder = $this->theme->createBuilder();
     $this->param_manager = $this->builder->getParamManager();
     $this->builder->createLayout('chan');
     if (count($theme_name_exploded) == 3) {
         try {
             $this->builder->setStyle($theme_name_exploded[2]);
         } catch (\OutOfBoundsException $e) {
             // just let it go with default on getStyle()
         }
     }
     // KEEP THIS IN SYNC WITH THE ONE IN THE POSTS ADMIN PANEL
     $to_bind = ['context' => $this->getContext(), 'request' => $this->getRequest(), 'order' => false, 'modifiers' => [], 'backend_vars' => ['site_url' => $this->uri->base(), 'default_url' => $this->uri->base(), 'archive_url' => $this->uri->base(), 'system_url' => $this->uri->base(), 'api_url' => $this->uri->base(), 'cookie_domain' => $this->config->get('foolz/foolframe', 'config', 'config.cookie_domain'), 'cookie_prefix' => $this->config->get('foolz/foolframe', 'config', 'config.cookie_prefix'), 'selected_theme' => $theme_name, 'csrf_token_key' => 'csrf_token', 'images' => [], 'gettext' => ['submit_state' => _i('Submitting'), 'thread_is_real_time' => _i('This thread is being displayed in real time.'), 'update_now' => _i('Update now'), 'ghost_mode' => _i('This thread has entered ghost mode. Your reply will be marked as a ghost post and will only affect the ghost index.')]]];
     $this->param_manager->setParams($to_bind);
     // $this->builder->createPartial('tools_modal', 'tools_modal');
     // $this->builder->createPartial('tools_search', 'tools_search');
     // $this->builder->createPartial('tools_advanced_search', 'advanced_search');
 }
コード例 #5
0
ファイル: Chan.php プロジェクト: voh/FoolFuuka
 public function action_reports()
 {
     if (!$this->getAuth()->hasAccess('comment.reports')) {
         return $this->action_404();
     }
     $this->response = new StreamedResponse();
     $this->param_manager->setParam('section_title', _i('Reports'));
     /** @var Report[] $reports */
     $reports = $this->getContext()->getService('foolfuuka.report_collection')->getAll();
     $results = [];
     foreach ($reports as $report) {
         if (($result = $report->getComment()) !== null) {
             $results[0]['posts'][] = $result;
         }
     }
     $this->builder->createPartial('body', 'board')->getParamManager()->setParam('board', $results);
     $this->param_manager->setParams(['modifiers' => ['post_show_board_name' => true, 'post_show_view_button' => true]]);
     $this->response->setCallback(function () {
         $this->builder->stream();
     });
     return $this->response;
 }