Beispiel #1
0
 /**
  * Construct method
  */
 public function __construct(user $user, config $config, ContainerInterface $phpbb_container, language $language)
 {
     $this->config = $config;
     $this->phpbb_container = $phpbb_container;
     $this->language = $language;
     $this->language->add_lang(array('acp/common', 'acp/extensions'));
     parent::__construct($user);
 }
Beispiel #2
0
 /**
  * Construct method
  *
  * @param user             $user
  * @param driver_interface $db
  * @param language         $language
  * @param log_interface    $log
  * @param user_loader      $user_loader
  * @param string           $phpbb_root_path
  * @param string           $php_ext
  */
 public function __construct(user $user, driver_interface $db, language $language, log_interface $log, user_loader $user_loader, $phpbb_root_path, $php_ext)
 {
     $this->db = $db;
     $this->language = $language;
     $this->log = $log;
     $this->user_loader = $user_loader;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $php_ext;
     $this->language->add_lang('acp/users');
     parent::__construct($user);
 }
Beispiel #3
0
 /**
  * Construct method
  *
  * @param user             $user
  * @param driver_interface $db
  * @param config           $config
  * @param language         $language
  * @param manager          $password_manager
  * @param string           $phpbb_root_path
  * @param string           $php_ext
  */
 public function __construct(user $user, driver_interface $db, config $config, language $language, manager $password_manager, $phpbb_root_path, $php_ext)
 {
     $this->db = $db;
     $this->config = $config;
     $this->language = $language;
     $this->password_manager = $password_manager;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $php_ext;
     $this->language->add_lang('ucp');
     parent::__construct($user);
 }
Beispiel #4
0
 /**
  * @param \phpbb\auth\auth                $auth
  * @param \phpbb\config\config            $config
  * @param \phpbb\controller\helper        $helper
  * @param \phpbb\ideas\factory\ideas      $ideas
  * @param \phpbb\language\language        $language
  * @param \phpbb\ideas\factory\linkhelper $link_helper
  * @param \phpbb\template\template        $template
  * @param \phpbb\user                     $user
  * @param string                          $php_ext
  */
 public function __construct(auth $auth, config $config, helper $helper, ideas $ideas, language $language, linkhelper $link_helper, template $template, user $user, $php_ext)
 {
     $this->auth = $auth;
     $this->config = $config;
     $this->helper = $helper;
     $this->ideas = $ideas;
     $this->language = $language;
     $this->link_helper = $link_helper;
     $this->template = $template;
     $this->user = $user;
     $this->php_ext = $php_ext;
     $this->language->add_lang('common', 'phpbb/ideas');
 }
 /**
  * @return Response
  */
 public function main()
 {
     $this->lang->add_lang('common', 'paul999/downloadpage');
     $sql = 'SELECT * FROM ' . $this->versions_table . ' WHERE active = 1 ORDER BY sort DESC';
     $result = $this->db->sql_query($sql);
     while ($row = $this->db->sql_fetchrow($result)) {
         $this->template->assign_block_vars('releases', array('NAME' => $row['name'], 'EOL' => $row['eol'], 'L_EOL' => $this->lang->lang('PHPBB_EOL', $row['name']), 'L_ALWAYS_CURRENT_DOWNLOAD' => $this->lang->lang('ALWAYS_CURRENT', ''), 'L_ALWAYS_CURRENT_UPDATE' => $this->lang->lang('ALWAYS_CURRENT', '')));
         // Yes, we do a queries in a loop here.
         // However, as the versions table should have <= 3 versions this should be fine.
         $sql_row = 'SELECT * FROM ' . $this->releases_table . ' WHERE version_id = ' . $row['version_id'] . ' AND active = 1 ORDER BY release_time DESC';
         $result_row = $this->db->sql_query($sql_row);
         while ($row_row = $this->db->sql_fetchrow($result_row)) {
             $this->template->assign_block_vars('releases.versions', array('RELEASED_AT' => $this->lang->lang('RELEASED_AT', $this->user->format_date($row_row['release_time']))));
             $sql = 'SELECT * FROM ' . $this->downloads_table . ' WHERE active = 1 AND release_id = ' . (int) $row_row['release_id'];
             $int_result = $this->db->sql_query($sql);
             while ($int_row = $this->db->sql_fetchrow($int_result)) {
                 $this->template->assign_block_vars('releases.versions.downloads', array('U_DOWNLOAD' => $this->controller_helper->route('paul999_downloadpage_download', array('id' => $int_row['download_id'])), 'NAME' => $int_row['name'], 'S_FULL_PACKAGE' => $int_row['type'] == constants::FULL_PACKAGE, 'S_LANG_PACKAGE' => $int_row['type'] == constants::TRANSLATION, 'S_UPDATE_PACKAGE' => $int_row['type'] == constants::UPDATE_PACKAGE));
             }
             $this->db->sql_freeresult($int_result);
         }
         $this->db->sql_freeresult($result_row);
     }
     $this->db->sql_freeresult($result);
     return $this->controller_helper->render('@paul999_downloadpage/download_main.html');
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->language->add_lang('migrator');
     if (!isset($this->config['version_update_from'])) {
         $this->config->set('version_update_from', $this->config['version']);
     }
     $original_version = $this->config['version_update_from'];
     $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new installer_migrator_output_handler($this->iohandler), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem));
     $this->migrator->create_migrations_table();
     $migrations = $this->extension_manager->get_finder()->core_path('phpbb/db/migration/data/')->extension_directory('/migrations')->get_classes();
     $this->migrator->set_migrations($migrations);
     $migration_step_count = $this->installer_config->get('database_update_migration_steps', -1);
     if ($migration_step_count < 0) {
         $migration_step_count = count($this->migrator->get_installable_migrations()) * 2;
         $this->installer_config->set('database_update_migration_steps', $migration_step_count);
     }
     $progress_count = $this->installer_config->get('database_update_count', 0);
     $restart_progress_bar = $progress_count === 0;
     // Only "restart" when the update runs for the first time
     $this->iohandler->set_task_count($migration_step_count, $restart_progress_bar);
     $this->installer_config->set_task_progress_count($migration_step_count);
     while (!$this->migrator->finished()) {
         try {
             $this->migrator->update();
             $progress_count++;
             $last_run_migration = $this->migrator->get_last_run_migration();
             if (isset($last_run_migration['effectively_installed']) && $last_run_migration['effectively_installed']) {
                 // We skipped two step, so increment $progress_count by another one
                 $progress_count++;
             } else {
                 if ($last_run_migration['task'] === 'process_schema_step' && !$last_run_migration['state']['migration_schema_done'] || $last_run_migration['task'] === 'process_data_step' && !$last_run_migration['state']['migration_data_done']) {
                     // We just run a step that wasn't counted yet so make it count
                     $migration_step_count++;
                 }
             }
             $this->iohandler->set_task_count($migration_step_count);
             $this->installer_config->set_task_progress_count($migration_step_count);
             $this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count);
         } catch (exception $e) {
             $msg = $e->getParameters();
             array_unshift($msg, $e->getMessage());
             $this->iohandler->add_error_message($msg);
             throw new user_interaction_required_exception();
         }
         if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) {
             $this->installer_config->set('database_update_count', $progress_count);
             $this->installer_config->set('database_update_migration_steps', $migration_step_count);
             throw new resource_limit_reached_exception();
         }
     }
     if ($original_version !== $this->config['version']) {
         $this->log->add('admin', isset($this->user->data['user_id']) ? $this->user->data['user_id'] : ANONYMOUS, $this->user->ip, 'LOG_UPDATE_DATABASE', false, array($original_version, $this->config['version']));
     }
     $this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL');
     $this->config->delete('version_update_from');
     $this->cache->purge();
     $this->config->increment('assets_version', 1);
 }
Beispiel #7
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $config, $db, $phpbb_container, $phpbb_log, $request, $template, $user, $phpbb_root_path, $phpEx;
     $this->config = $config;
     $this->db = $db;
     $this->language = $phpbb_container->get('language');
     $this->log = $phpbb_log;
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $phpEx;
     // Add the phpBB Ideas ACP lang file
     $this->language->add_lang('phpbb_ideas_acp', 'phpbb/ideas');
     // Load a template from adm/style for our ACP page
     $this->tpl_name = 'acp_phpbb_ideas';
     // Set the page title for our ACP page
     $this->page_title = 'ACP_PHPBB_IDEAS_SETTINGS';
 }
Beispiel #8
0
 /**
  * Load language file of module
  *
  * @param object $module Module of which language file should be loaded
  */
 public function load_module_language($module)
 {
     if ($language_file = $module->get_language()) {
         // Load language file from vendor if specified
         if (is_array($language_file)) {
             $this->language->add_lang($language_file['file'], $language_file['vendor']);
         } else {
             $this->language->add_lang('modules/' . $language_file, 'board3/portal');
         }
     }
 }
Beispiel #9
0
 /**
  * BC function for loading language files
  *
  * @deprecated 3.2.0-dev (To be removed: 3.3.0)
  */
 private function set_lang($lang_set, $use_help, $ext_name)
 {
     if (empty($ext_name)) {
         $ext_name = null;
     }
     if ($use_help && strpos($lang_set, '/') !== false) {
         $component = dirname($lang_set) . '/help_' . basename($lang_set);
         if ($component[0] === '/') {
             $component = substr($component, 1);
         }
     } else {
         $component = ($use_help ? 'help_' : '') . $lang_set;
     }
     $this->language->add_lang($component, $ext_name);
 }
Beispiel #10
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->language->add_lang('migrator');
     if (!isset($this->config['version_update_from'])) {
         $this->config->set('version_update_from', $this->config['version']);
     }
     $original_version = $this->config['version_update_from'];
     $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new installer_migrator_output_handler($this->iohandler), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem));
     $this->migrator->create_migrations_table();
     $migrations = $this->extension_manager->get_finder()->core_path('phpbb/db/migration/data/')->extension_directory('/migrations')->get_classes();
     $this->migrator->set_migrations($migrations);
     $migration_count = count($this->migrator->get_migrations());
     $this->iohandler->set_task_count($migration_count, true);
     $progress_count = $this->installer_config->get('database_update_count', 0);
     while (!$this->migrator->finished()) {
         try {
             $this->migrator->update();
             $progress_count++;
             $this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count);
         } catch (exception $e) {
             $msg = $e->getParameters();
             array_unshift($msg, $e->getMessage());
             $this->iohandler->add_error_message($msg);
             $this->iohandler->send_response();
             throw new user_interaction_required_exception();
         }
         if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) {
             $this->installer_config->set('database_update_count', $progress_count);
             throw new resource_limit_reached_exception();
         }
     }
     if ($original_version !== $this->config['version']) {
         $this->log->add('admin', isset($this->user->data['user_id']) ? $this->user->data['user_id'] : ANONYMOUS, $this->user->ip, 'LOG_UPDATE_DATABASE', false, array($original_version, $this->config['version']));
     }
     $this->iohandler->finish_progress('INLINE_UPDATE_SUCCESSFUL');
     $this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL');
     $this->config->delete('version_update_from');
     $this->cache->purge();
     $this->config->increment('assets_version', 1);
 }