private function build_form()
 {
     $picture_yes = '<i class="fa fa-success fa-2x" title="' . LangLoader::get_message('yes', 'common') . '"></i>';
     $picture_no = '<i class="fa fa-error fa-2x" title="' . LangLoader::get_message('no', 'common') . '"></i>';
     $picture_unknown = '<i class="fa fa-question fa-2x" title="' . LangLoader::get_message('unknown', 'main') . '"></i>';
     $default_lang_config = LangsManager::get_lang(LangsManager::get_default_lang())->get_configuration();
     $default_theme_config = ThemesManager::get_theme(ThemesManager::get_default_theme())->get_configuration();
     $editors = AppContext::get_content_formatting_service()->get_available_editors();
     $default_editor = $editors[ContentFormattingConfig::load()->get_default_editor()];
     $server_configuration = new ServerConfiguration();
     $general_config = GeneralConfig::load();
     $server_environment_config = ServerEnvironmentConfig::load();
     $sessions_config = SessionsConfig::load();
     $maintenance_config = MaintenanceConfig::load();
     $url_rewriting_available = false;
     $url_rewriting_known = true;
     try {
         $url_rewriting_available = $server_configuration->has_url_rewriting();
     } catch (UnsupportedOperationException $ex) {
         $url_rewriting_known = false;
     }
     $summerization = "---------------------------------System report---------------------------------\n-----------------------------generated by PHPBoost-----------------------------\nSERVER CONFIGURATION-----------------------------------------------------------\nphp version\t\t\t: " . ServerConfiguration::get_phpversion() . "\ndbms version\t\t\t: " . PersistenceContext::get_dbms_utils()->get_dbms_version() . "\ngd library\t\t\t: " . (int) $server_configuration->has_gd_library() . "\nurl rewriting\t\t\t: " . ($url_rewriting_known ? (int) $url_rewriting_available : 'N/A') . "\napcu cache\t\t\t: " . (int) DataStoreFactory::is_apc_available() . "\nPHPBOOST CONFIGURATION---------------------------------------------------------\nphpboost version\t\t: " . Environment::get_phpboost_version() . "\nserver url\t\t\t: " . $general_config->get_site_url() . "\nsite path\t\t\t: " . $general_config->get_site_path() . "\ndefault theme\t\t\t: " . $default_theme_config->get_name() . " (" . LangLoader::get_message('version', 'admin') . " " . $default_theme_config->get_version() . ")\ndefault language\t\t: " . $default_lang_config->get_name() . "\ndefault editor\t\t\t: " . $default_editor . "\nhome page\t\t\t: " . Environment::get_home_page() . "\nurl rewriting\t\t\t: " . (int) $server_environment_config->is_url_rewriting_enabled() . "\napcu cache\t\t\t: " . (int) DataStoreFactory::is_apc_enabled() . "\noutput gzip\t\t\t: " . (int) $server_environment_config->is_output_gziping_enabled() . "\nsession cookie name\t\t: " . $sessions_config->get_cookie_name() . "\nsession duration\t\t: " . $sessions_config->get_session_duration() . "\nactive session duration\t\t: " . $sessions_config->get_active_session_duration() . "\nDIRECTORIES AUTHORIZATIONS-----------------------------------------------------\n";
     $form = new HTMLForm('system-report', '', false);
     $this->get_advises($form);
     $fieldset = new FormFieldsetHTML('report', $this->admin_lang['server']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldFree('php_version', $this->admin_lang['php_version'], ServerConfiguration::get_phpversion()));
     $fieldset->add_field(new FormFieldFree('dbms_version', $this->admin_lang['dbms_version'], PersistenceContext::get_dbms_utils()->get_dbms_version()));
     $fieldset->add_field(new FormFieldFree('gd_library', $this->admin_lang['gd_library'], $server_configuration->has_gd_library() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('url_rewriting', $this->admin_lang['url_rewriting'], $url_rewriting_known ? $url_rewriting_available ? $picture_yes : $picture_no : $picture_unknown));
     $fieldset->add_field(new FormFieldFree('apcu_cache', LangLoader::get_message('apcu_cache', 'admin-cache-common'), DataStoreFactory::is_apc_available() ? $picture_yes : $picture_no));
     $fieldset = new FormFieldsetHTML('report', $this->admin_lang['phpboost_config']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldFree('kernel_version', $this->admin_lang['kernel_version'], Environment::get_phpboost_version()));
     $fieldset->add_field(new FormFieldFree('site_url', LangLoader::get_message('advanced-config.site_url', 'admin-config-common'), $general_config->get_site_url()));
     $fieldset->add_field(new FormFieldFree('site_path', LangLoader::get_message('advanced-config.site_path', 'admin-config-common'), $general_config->get_site_path()));
     $fieldset->add_field(new FormFieldFree('default_theme', LangLoader::get_message('general-config.default_theme', 'admin-config-common'), $default_theme_config->get_name() . " (" . LangLoader::get_message('version', 'admin') . " " . $default_theme_config->get_version() . ")"));
     $fieldset->add_field(new FormFieldFree('default_language', LangLoader::get_message('general-config.default_language', 'admin-config-common'), $default_lang_config->get_name()));
     $fieldset->add_field(new FormFieldFree('default_editor', LangLoader::get_message('content.config.default-formatting-language', 'admin-contents-common'), $default_editor));
     $fieldset->add_field(new FormFieldFree('start_page', LangLoader::get_message('general-config.start_page', 'admin-config-common'), Environment::get_home_page()));
     $fieldset->add_field(new FormFieldFree('phpboost_url_rewriting', $this->admin_lang['url_rewriting'], $server_environment_config->is_url_rewriting_enabled() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('phpboost_apcu_cache', LangLoader::get_message('apcu_cache', 'admin-cache-common'), DataStoreFactory::is_apc_enabled() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('output_gz', $this->admin_lang['output_gz'], $server_environment_config->is_output_gziping_enabled() ? $picture_yes : $picture_no));
     $fieldset->add_field(new FormFieldFree('cookie_name', LangLoader::get_message('advanced-config.cookie-name', 'admin-config-common'), $sessions_config->get_cookie_name()));
     $fieldset->add_field(new FormFieldFree('session_length', LangLoader::get_message('advanced-config.cookie-duration', 'admin-config-common'), $sessions_config->get_session_duration()));
     $fieldset->add_field(new FormFieldFree('session_guest_length', LangLoader::get_message('advanced-config.active-session-duration', 'admin-config-common'), $sessions_config->get_active_session_duration()));
     $fieldset = new FormFieldsetHTML('directories_auth', $this->admin_lang['directories_auth']);
     $form->add_fieldset($fieldset);
     $directories_summerization = '';
     foreach (PHPBoostFoldersPermissions::get_permissions() as $key => $folder) {
         $fieldset->add_field(new FormFieldFree(str_replace('/', '_', $key), $key, $folder->is_writable() ? $picture_yes : $picture_no));
         $directories_summerization .= $key . str_repeat('	', 5 - strlen($key) / 8) . ": " . (int) $folder->is_writable() . "\n";
     }
     $fieldset = new FormFieldsetHTML('summerization', $this->admin_lang['system_report_summerization']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field(new FormFieldLabel($this->admin_lang['system_report_summerization_explain']));
     $fieldset->add_field(new FormFieldMultiLineTextEditor('summerization', '', $summerization . $directories_summerization, array('rows' => 20, 'cols' => 15, 'class' => 'system-report')));
     $this->form = $form;
 }
 private function check_folders_permissions()
 {
     $folders = array();
     foreach (PHPBoostFoldersPermissions::get_permissions() as $folder_name => $folder) {
         $folders[] = array('NAME' => $folder_name, 'EXISTS' => $folder->exists(), 'IS_WRITABLE' => $folder->is_writable());
     }
     $this->view->put('folder', $folders);
 }
 public static function __static()
 {
     self::$folders_path = array('/', '/cache', '/cache/backup', '/cache/syndication', '/cache/tpl', '/cache/css', '/images/avatars', '/images/customization', '/images/group', '/images/maths', '/images/smileys', '/kernel/db', '/lang', '/templates', '/upload');
 }
Пример #4
0
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 ###################################################*/
if (version_compare(phpversion(), '5.3', '<') == -1) {
    // Version is not retrieved from the ServerConfiguration::MIN_PHP_VERSION constant because
    // it would imply that bootstraping will work and that PHP version is at least 5.0 (static keyword)
    die('<h1>Impossible to install PHPBoost</h1><p>At least PHP 5.3 is needed but your current PHP version is ' . phpversion() . '</p>');
}
define('PATH_TO_ROOT', '..');
require_once PATH_TO_ROOT . '/install/environment/InstallEnvironment.class.php';
InstallEnvironment::load_imports();
InstallEnvironment::init();
$permissions = PHPBoostFoldersPermissions::get_permissions();
if (!$permissions['/cache']->is_writable() || !$permissions['/cache/tpl']->is_writable()) {
    die(LangLoader::get_message('chmod.cache.notWritable', 'install', 'install'));
}
$url_controller_mappers = array(new UrlControllerMapper('InstallWelcomeController', '`^(?:/welcome)?/?$`'), new UrlControllerMapper('InstallLicenseController', '`^/license/?$`'), new UrlControllerMapper('InstallServerConfigController', '`^/server/?$`'), new UrlControllerMapper('InstallDBConfigController', '`^/database/?$`'), new UrlControllerMapper('InstallWebsiteConfigController', '`^/website/?$`'), new UrlControllerMapper('InstallCreateAdminController', '`^/admin/?$`'), new UrlControllerMapper('InstallFinishController', '`^/finish/?$`'));
DispatchManager::dispatch($url_controller_mappers);
 private function check_folders_permissions()
 {
     CLIOutput::writeln("\t" . 'folder permissions...');
     if (!PHPBoostFoldersPermissions::validate()) {
         foreach (PHPBoostFoldersPermissions::get_permissions() as $folder_name => $folder) {
             if (!$folder->is_writable()) {
                 CLIOutput::writeln('Folder ' . $folder_name . ' is not writable. Please change its rights');
             }
         }
         return false;
     }
     return true;
 }