public function get_root_category()
 {
     $root = new RichRootCategory();
     $root->set_authorizations(NewsConfig::load()->get_authorizations());
     $root->set_description(StringVars::replace_vars(LangLoader::get_message('news.seo.description.root', 'common', 'news'), array('site' => GeneralConfig::load()->get_site_name())));
     return $root;
 }
 /**
  * {@inheritdoc}
  */
 public function synchronize()
 {
     $this->htaccess_file_content = '';
     $this->general_config = GeneralConfig::load();
     $this->add_disable_signatures_protection();
     $this->add_hide_directory_listings();
     $this->add_server_protections();
     $this->add_http_headers();
     if (ServerEnvironmentConfig::load()->is_url_rewriting_enabled()) {
         $this->enable_rewrite_rules();
         $this->add_core_rules();
         $this->add_modules_rules();
         $this->add_php_and_http_protections();
         $this->add_file_and_sql_injections_protections();
         $this->force_https_if_available();
         $this->add_bandwidth_protection();
         $this->add_robots_protection();
     }
     $this->add_error_redirection();
     $this->add_gzip_compression();
     $this->add_expires_headers();
     $this->disable_file_etags();
     $this->add_manual_content();
     $this->clean_file_content();
 }
 public static function send_email_confirmation($user_id, $email, $pseudo, $login, $password, $registration_pass)
 {
     $lang = LangLoader::get('user-common');
     $user_accounts_config = UserAccountsConfig::load();
     $general_config = GeneralConfig::load();
     $site_name = $general_config->get_site_name();
     $subject = StringVars::replace_vars($lang['registration.subject-mail'], array('site_name' => $site_name));
     switch ($user_accounts_config->get_member_accounts_validation_method()) {
         case UserAccountsConfig::AUTOMATIC_USER_ACCOUNTS_VALIDATION:
             $parameters = array('pseudo' => $pseudo, 'site_name' => $site_name, 'host' => $general_config->get_site_url(), 'login' => $login, 'password' => $password, 'accounts_validation_explain' => $lang['registration.email.automatic-validation'], 'signature' => MailServiceConfig::load()->get_mail_signature());
             $content = StringVars::replace_vars($lang['registration.content-mail'], $parameters);
             AppContext::get_mail_service()->send_from_properties($email, $subject, $content);
             break;
         case UserAccountsConfig::MAIL_USER_ACCOUNTS_VALIDATION:
             $parameters = array('pseudo' => $pseudo, 'site_name' => $site_name, 'host' => $general_config->get_site_url(), 'login' => $login, 'password' => $password, 'accounts_validation_explain' => StringVars::replace_vars($lang['registration.email.mail-validation'], array('validation_link' => UserUrlBuilder::confirm_registration($registration_pass)->absolute())), 'signature' => MailServiceConfig::load()->get_mail_signature());
             $content = StringVars::replace_vars($lang['registration.content-mail'], $parameters);
             AppContext::get_mail_service()->send_from_properties($email, $subject, $content);
             break;
         case UserAccountsConfig::ADMINISTRATOR_USER_ACCOUNTS_VALIDATION:
             $alert = new AdministratorAlert();
             $alert->set_entitled($lang['registration.pending-approval']);
             $alert->set_fixing_url(UserUrlBuilder::edit_profile($user_id)->relative());
             $alert->set_priority(AdministratorAlert::ADMIN_ALERT_MEDIUM_PRIORITY);
             $alert->set_id_in_module($user_id);
             $alert->set_type('member_account_to_approbate');
             AdministratorAlertService::save_alert($alert);
             $parameters = array('pseudo' => $pseudo, 'site_name' => $site_name, 'host' => $general_config->get_site_url(), 'login' => $login, 'password' => $password, 'accounts_validation_explain' => $lang['registration.email.administrator-validation'], 'signature' => MailServiceConfig::load()->get_mail_signature());
             $content = StringVars::replace_vars($lang['registration.content-mail'], $parameters);
             AppContext::get_mail_service()->send_from_properties($email, $subject, $content);
             break;
     }
 }
 /**
  * Konstruktor statyczny -> Singleton
  * @return Config
  */
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #5
0
 public static function get_site_timezone()
 {
     if (self::$site_timezone == null) {
         self::$site_timezone = new DateTimeZone(GeneralConfig::load()->get_site_timezone());
     }
     return self::$site_timezone;
 }
 public final function get_right_controller_regarding_authorizations()
 {
     if (!AppContext::get_current_user()->is_admin()) {
         return new UserLoginController(UserLoginController::ADMIN_LOGIN, substr(REWRITED_SCRIPT, strlen(GeneralConfig::load()->get_site_path())));
     }
     return $this;
 }
Example #7
0
 public function get_full_description()
 {
     if (Environment::home_page_running()) {
         return GeneralConfig::load()->get_site_description();
     } else {
         return strip_tags($this->description);
     }
 }
 public function get_feed_data_struct($idcat = 0, $name = '')
 {
     $querier = PersistenceContext::get_querier();
     $lang = LangLoader::get('common', 'bugtracker');
     //Configuration load
     $config = BugtrackerConfig::load();
     $types = $config->get_types();
     $categories = $config->get_categories();
     $severities = $config->get_severities();
     $priorities = $config->get_priorities();
     $versions = $config->get_versions_detected();
     $site_name = GeneralConfig::load()->get_site_name();
     $feed_module_name = $idcat == 1 ? $lang['titles.solved'] : $lang['titles.unsolved'];
     $data = new FeedData();
     $data->set_title($feed_module_name . ' - ' . $site_name);
     $data->set_date(new Date());
     $data->set_link(SyndicationUrlBuilder::rss('bugtracker', $idcat));
     $data->set_host(HOST);
     $data->set_desc($feed_module_name . ' - ' . $site_name);
     $data->set_lang(LangLoader::get_message('xml_lang', 'main'));
     $data->set_auth_bit(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS);
     $results = $querier->select("SELECT bugtracker.*, author.*\r\n\t\tFROM " . BugtrackerSetup::$bugtracker_table . " bugtracker\r\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " author ON author.user_id = bugtracker.author_id\r\n\t\tWHERE " . ($idcat == 1 ? "(status = '" . Bug::FIXED . "' OR status = '" . Bug::REJECTED . "')" : "status <> '" . Bug::FIXED . "' AND status <> '" . Bug::REJECTED . "'") . "\r\n\t\tORDER BY " . ($idcat == 1 ? "fix_date" : "submit_date") . " DESC");
     foreach ($results as $row) {
         $bug = new Bug();
         $bug->set_properties($row);
         $link = BugtrackerUrlBuilder::detail($bug->get_id() . '-' . $bug->get_rewrited_title());
         $description = FormatingHelper::second_parse($bug->get_contents());
         $description .= '<br /><br />' . $lang['labels.fields.reproductible'] . ' : ' . ($bug->is_reproductible() ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common'));
         if ($bug->is_reproductible()) {
             $description .= '<br />' . FormatingHelper::second_parse($bug->get_reproduction_method()) . '<br />';
         }
         if ($types) {
             $description .= '<br />' . $lang['labels.fields.type'] . ' : ' . (isset($types[$bug->get_type()]) ? stripslashes($types[$bug->get_type()]) : $lang['notice.none']);
         }
         if ($categories) {
             $description .= '<br />' . $lang['labels.fields.category'] . ' : ' . (isset($categories[$bug->get_category()]) ? stripslashes($categories[$bug->get_category()]) : $lang['notice.none_e']);
         }
         if ($severities) {
             $description .= '<br />' . $lang['labels.fields.severity'] . ' : ' . (isset($severities[$bug->get_severity()]) ? stripslashes($severities[$bug->get_severity()]['name']) : $lang['notice.none']);
         }
         if ($priorities) {
             $description .= '<br />' . $lang['labels.fields.priority'] . ' : ' . (isset($priorities[$bug->get_priority()]) ? stripslashes($priorities[$bug->get_priority()]) : $lang['notice.none_e']);
         }
         if ($versions) {
             $description .= '<br />' . $lang['labels.fields.version'] . ' : ' . (isset($versions[$bug->get_detected_in()]) ? stripslashes($versions[$bug->get_detected_in()]['name']) : $lang['notice.not_defined']);
         }
         $item = new FeedItem();
         $item->set_title($bug->get_title());
         $item->set_link($link);
         $item->set_guid($link);
         $item->set_desc($description);
         $item->set_date($bug->get_submit_date());
         $item->set_auth(BugtrackerAuthorizationsService::READ_AUTHORIZATIONS);
         $data->add_item($item);
     }
     $results->dispose();
     return $data;
 }
 function display_page(View $body_template)
 {
     $template = new FileTemplate('frame.tpl');
     $customization_config = CustomizationConfig::load();
     $seo_meta_data = $this->get_seo_meta_data();
     $description = $seo_meta_data->get_full_description();
     $template->put_all(array('C_CSS_CACHE_ENABLED' => CSSCacheConfig::load()->is_enabled(), 'C_FAVICON' => $customization_config->favicon_exists(), 'C_CANONICAL_URL' => $seo_meta_data->canonical_link_exists(), 'C_DESCRIPTION' => !empty($description), 'FAVICON' => Url::to_rel($customization_config->get_favicon_path()), 'FAVICON_TYPE' => $customization_config->favicon_type(), 'TITLE' => $seo_meta_data->get_full_title(), 'SITE_DESCRIPTION' => $description, 'U_CANONICAL' => $seo_meta_data->get_canonical_link(), 'L_XML_LANGUAGE' => self::$main_lang['xml_lang'], 'PHPBOOST_VERSION' => GeneralConfig::load()->get_phpboost_major_version(), 'MODULES_CSS' => $this->get_modules_css_files_html_code(), 'JS_TOP' => new FileTemplate('js_top.tpl'), 'JS_BOTTOM' => new FileTemplate('js_bottom.tpl'), 'BODY' => $body_template));
     $template->display(true);
 }
 public function __construct($step_number, $step_title, Template $view)
 {
     $this->load_language_resources();
     $this->init_response($step_number, $view);
     $env = new InstallDisplayGraphicalEnvironment();
     $this->add_language_bar();
     $this->init_steps();
     $this->update_progress_bar();
     $this->full_view->put_all(array('RESTART' => InstallUrlBuilder::welcome()->rel(), 'STEP_TITLE' => $step_title, 'C_HAS_PREVIOUS_STEP' => false, 'C_HAS_NEXT_STEP' => false, 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'PROGRESSION' => floor(100 * $this->current_step / ($this->nb_steps - 1)), 'PHPBOOST_VERSION' => GeneralConfig::load()->get_phpboost_major_version()));
     parent::__construct($env, $this->full_view);
 }
Example #11
0
 function test_constructor()
 {
     $url = new Url('', '..', '/phpboost-svn/trunk/forum/topic.php');
     $rel = $url->relative();
     $abs = $url->absolute();
     self::assertEquals('', $rel, $rel . ' != /forum/');
     self::assertEquals('', $abs, $abs . ' != ' . Url::get_absolute_root() . '/forum/');
     $site_url = GeneralConfig::load()->get_site_url();
     $url = new Url('menus.php#m42', '../..', '/admin/menus/links.php');
     self::assertEquals('/admin/menus/menus.php#m42', $url->relative(), $url->relative() . ' != /admin/menus/menus.php#m42');
     self::assertEquals($site_url . '/admin/menus/menus.php#m42', $url->absolute(), $url->absolute() . ' != ' . $site_url . '/admin/menus/menus.php#m42');
 }
 private function send_email()
 {
     $change_password_pass = KeyGenerator::generate_key(15);
     $user = $this->get_user();
     PHPBoostAuthenticationMethod::update_auth_infos($user->get_id(), null, null, null, null, $change_password_pass);
     $general_config = GeneralConfig::load();
     $parameters = array('pseudo' => $user->get_display_name(), 'host' => $general_config->get_site_url(), 'change_password_link' => UserUrlBuilder::change_password($change_password_pass)->absolute(), 'signature' => MailServiceConfig::load()->get_mail_signature());
     $subject = $general_config->get_site_name() . ' : ' . $this->lang['forget-password'];
     $content = StringVars::replace_vars($this->lang['forget-password.mail.content'], $parameters);
     AppContext::get_mail_service()->send_from_properties($user->get_email(), $subject, $content);
     $this->tpl->put('MSG', MessageHelper::display($this->lang['forget-password.success'], MessageHelper::SUCCESS));
 }
 public function display($tpl = false)
 {
     global $LANG;
     if (!Url::is_current_url('/user/login')) {
         $tpl = new FileTemplate('connect/connect_mini.tpl');
         $user = AppContext::get_current_user();
         MenuService::assign_positions_conditions($tpl, $this->get_block());
         if ($user->check_level(User::MEMBER_LEVEL)) {
             $unread_contributions = UnreadContributionsCache::load();
             //Vaut 0 si l'utilisateur n'a aucune contribution. Est > 0 si on connait le nombre de contributions
             //Vaut -1 si l'utilisateur a au moins une contribution (mais on ne sait pas combien à cause des recoupements entre les groupes)
             $contribution_number = 0;
             if ($user->check_level(User::ADMIN_LEVEL)) {
                 $contribution_number = $unread_contributions->get_admin_unread_contributions_number();
             } elseif ($user->check_level(User::MODERATOR_LEVEL)) {
                 if ($unread_contributions->have_moderators_unread_contributions()) {
                     $contribution_number = -1;
                 }
             } else {
                 if ($unread_contributions->have_members_unread_contributions()) {
                     $contribution_number = -1;
                 } else {
                     if ($unread_contributions->has_user_unread_contributions($user->get_id())) {
                         $contribution_number = -1;
                     } else {
                         foreach ($user->get_groups() as $group_id) {
                             if ($unread_contributions->has_group_unread_contributions($group_id)) {
                                 $contribution_number = -1;
                                 break;
                             }
                         }
                     }
                 }
             }
             $user_accounts_config = UserAccountsConfig::load();
             $user_avatar = AppContext::get_session()->get_cached_data('user_avatar');
             if (empty($user_avatar)) {
                 $user_avatar = '/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name();
             }
             $total_alert = $user->get_unread_pm() + $contribution_number + ($user->check_level(User::ADMIN_LEVEL) ? AdministratorAlertService::get_number_unread_alerts() : 0);
             $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
             $tpl->put_all(array('C_ADMIN_AUTH' => $user->check_level(User::ADMIN_LEVEL), 'C_MODERATOR_AUTH' => $user->check_level(User::MODERATOR_LEVEL), 'C_UNREAD_CONTRIBUTION' => $contribution_number != 0, 'C_KNOWN_NUMBER_OF_UNREAD_CONTRIBUTION' => $contribution_number > 0, 'C_UNREAD_ALERT' => (bool) AdministratorAlertService::get_number_unread_alerts(), 'C_HAS_PM' => $user->get_unread_pm() > 0, 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'NUMBER_UNREAD_CONTRIBUTIONS' => $contribution_number, 'NUMBER_UNREAD_ALERTS' => AdministratorAlertService::get_number_unread_alerts(), 'NUMBER_PM' => $user->get_unread_pm(), 'NUMBER_TOTAL_ALERT' => $total_alert, 'PSEUDO' => $user->get_display_name(), 'USER_LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'USER_GROUP_COLOR' => $user_group_color, 'U_USER_PROFILE' => UserUrlBuilder::profile($user->get_id())->rel(), 'U_USER_PM' => UserUrlBuilder::personnal_message($user->get_id())->rel(), 'U_AVATAR_IMG' => Url::to_rel($user_avatar), 'L_NBR_PM' => $user->get_unread_pm() > 0 ? $user->get_unread_pm() . ' ' . ($user->get_unread_pm() > 1 ? $LANG['message_s'] : $LANG['message']) : $LANG['private_messaging'], 'L_PROFIL' => LangLoader::get_message('profile', 'user-common'), 'L_ADMIN_PANEL' => $LANG['admin_panel'], 'L_MODO_PANEL' => $LANG['modo_panel'], 'L_PRIVATE_PROFIL' => $LANG['my_private_profile'], 'L_DISCONNECT' => LangLoader::get_message('disconnect', 'user-common'), 'L_CONTRIBUTION_PANEL' => $LANG['contribution_panel']));
         } else {
             $authentication_config = AuthenticationConfig::load();
             $tpl->put_all(array('C_USER_NOTCONNECTED' => true, 'C_USER_REGISTER' => UserAccountsConfig::load()->is_registration_enabled(), 'C_FB_AUTH_ENABLED' => $authentication_config->is_fb_auth_available(), 'C_GOOGLE_AUTH_ENABLED' => $authentication_config->is_google_auth_available(), 'L_REQUIRE_PSEUDO' => $LANG['require_pseudo'], 'L_REQUIRE_PASSWORD' => $LANG['require_password'], 'L_CONNECT' => LangLoader::get_message('connection', 'user-common'), 'L_PSEUDO' => LangLoader::get_message('login', 'user-common'), 'L_PASSWORD' => LangLoader::get_message('password', 'user-common'), 'L_AUTOCONNECT' => LangLoader::get_message('autoconnect', 'user-common'), 'L_FORGOT_PASS' => LangLoader::get_message('forget-password', 'user-common'), 'L_REGISTER' => LangLoader::get_message('register', 'user-common'), 'U_CONNECT' => UserUrlBuilder::connect()->rel(), 'SITE_REWRITED_SCRIPT' => substr(REWRITED_SCRIPT, strlen(GeneralConfig::load()->get_site_path()))));
         }
         return $tpl->render();
     }
     return '';
 }
 public final function get_right_controller_regarding_authorizations()
 {
     if (!AppContext::get_current_user()->is_admin()) {
         return new UserLoginController(UserLoginController::ADMIN_LOGIN, substr(REWRITED_SCRIPT, strlen(GeneralConfig::load()->get_site_path())));
     } else {
         if (ModulesManager::is_module_installed(Environment::get_running_module_name())) {
             $module = ModulesManager::get_module(Environment::get_running_module_name());
             if (!$module->is_activated()) {
                 return PHPBoostErrors::module_not_activated();
             }
         } else {
             return PHPBoostErrors::module_not_installed();
         }
     }
     return $this;
 }
Example #15
0
 public static function install($id, $authorizations = array(), $enable = true)
 {
     if (!empty($id) && !self::get_lang_existed($id)) {
         $lang = new Lang($id, $authorizations, $enable);
         $configuration = $lang->get_configuration();
         $phpboost_version = GeneralConfig::load()->get_phpboost_major_version();
         if (version_compare($phpboost_version, $configuration->get_compatibility(), '>')) {
             self::$error = LangLoader::get_message('misfit.phpboost', 'status-messages-common');
         } else {
             LangsConfig::load()->add_lang($lang);
             LangsConfig::save();
         }
     } else {
         self::$error = LangLoader::get_message('element.already_exists', 'status-messages-common');
     }
 }
    function get_feed_data_struct($idcat = 0, $name = '')
    {
        if (MediaService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
            require_once PATH_TO_ROOT . '/media/media_constant.php';
            $category = MediaService::get_categories_manager()->get_categories_cache()->get_category($idcat);
            $site_name = GeneralConfig::load()->get_site_name();
            $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
            $feed_module_name = LangLoader::get_message('module_title', 'common', 'media');
            $data = new FeedData();
            $data->set_title($feed_module_name . ' - ' . $site_name);
            $data->set_date(new Date());
            $data->set_link(SyndicationUrlBuilder::rss('media', $idcat));
            $data->set_host(HOST);
            $data->set_desc($feed_module_name . ' - ' . $site_name);
            $data->set_lang(LangLoader::get_message('xml_lang', 'main'));
            $data->set_auth_bit(Category::READ_AUTHORIZATIONS);
            $categories = MediaService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
            $ids_categories = array_keys($categories);
            $results = PersistenceContext::get_querier()->select('SELECT media.*, cat.image
				FROM ' . MediaSetup::$media_table . ' media
				LEFT JOIN ' . MediaSetup::$media_cats_table . ' cat ON cat.id = media.idcat
				WHERE media.idcat IN :ids_categories
				AND infos = :status_approved
				ORDER BY timestamp DESC', array('ids_categories' => $ids_categories, 'status_approved' => MEDIA_STATUS_APROBED));
            foreach ($results as $row) {
                // Rewriting
                $link = new Url('/media/media' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['name']) . '.php'));
                $item = new FeedItem();
                $item->set_title($row['name']);
                $item->set_link($link);
                $item->set_guid($link);
                $item->set_desc(FormatingHelper::second_parse($row['contents']));
                $item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE));
                $item->set_image_url($row['image']);
                $item->set_auth(MediaService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
                $enclosure = new FeedItemEnclosure();
                $enclosure->set_lenght(@filesize($row['url']));
                $enclosure->set_type($row['mime_type']);
                $enclosure->set_url($row['url']);
                $item->set_enclosure($enclosure);
                $data->add_item($item);
            }
            $results->dispose();
            return $data;
        }
    }
    public function get_feed_data_struct($idcat = 0, $name = '')
    {
        if (CalendarService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
            $now = new Date();
            $lang = LangLoader::get('common', 'calendar');
            $querier = PersistenceContext::get_querier();
            $category = CalendarService::get_categories_manager()->get_categories_cache()->get_category($idcat);
            $site_name = GeneralConfig::load()->get_site_name();
            $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
            $feed_module_name = $lang['calendar.feed.name'];
            $data = new FeedData();
            $data->set_title($feed_module_name . ' - ' . $site_name);
            $data->set_date(new Date());
            $data->set_link(SyndicationUrlBuilder::rss('calendar', $idcat));
            $data->set_host(HOST);
            $data->set_desc($feed_module_name . ' - ' . $site_name);
            $data->set_lang(LangLoader::get_message('xml_lang', 'main'));
            $data->set_auth_bit(Category::READ_AUTHORIZATIONS);
            $categories = CalendarService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
            $ids_categories = array_keys($categories);
            $result = $querier->select('SELECT *
			FROM ' . CalendarSetup::$calendar_events_table . ' event
			LEFT JOIN ' . CalendarSetup::$calendar_events_content_table . ' event_content ON event_content.id = event.content_id
			LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = event_content.author_id
			LEFT JOIN ' . CalendarSetup::$calendar_cats_table . ' cat ON cat.id = event_content.id_category
			WHERE approved = 1
			AND id_category IN :cats_ids
			ORDER BY start_date DESC', array('cats_ids' => $ids_categories));
            while ($row = $result->fetch()) {
                $event = new CalendarEvent();
                $event->set_properties($row);
                $category = $categories[$event->get_content()->get_category_id()];
                $link = CalendarUrlBuilder::display_event($category->get_id(), $category->get_rewrited_name() ? $category->get_rewrited_name() : 'root', $event->get_id(), $event->get_content()->get_rewrited_title());
                $item = new FeedItem();
                $item->set_title($event->get_content()->get_title());
                $item->set_link($link);
                $item->set_guid($link);
                $item->set_desc(FormatingHelper::second_parse($event->get_content()->get_contents()) . ($event->get_content()->get_location() ? '<br />' . $lang['calendar.labels.location'] . ' : ' . $event->get_content()->get_location() . '<br />' : '') . '<br />' . $lang['calendar.labels.start_date'] . ' : ' . $event->get_start_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br />' . $lang['calendar.labels.end_date'] . ' : ' . $event->get_end_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE));
                $item->set_date($event->get_start_date());
                $item->set_auth(CalendarService::get_categories_manager()->get_heritated_authorizations($category->get_id(), Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
                $data->add_item($item);
            }
            $result->dispose();
            return $data;
        }
    }
 public function display($content)
 {
     $template = new FileTemplate('admin/body.tpl');
     $template->add_lang(self::$lang);
     $theme = ThemesManager::get_theme(AppContext::get_current_user()->get_theme());
     $customize_interface = $theme->get_customize_interface();
     $header_logo_path = $customize_interface->get_header_logo_path();
     $template->put_all(array('SITE_NAME' => GeneralConfig::load()->get_site_name(), 'SITE_SLOGAN' => GeneralConfig::load()->get_site_slogan(), 'C_HEADER_LOGO' => !empty($header_logo_path), 'HEADER_LOGO' => Url::to_rel($header_logo_path), 'PHPBOOST_VERSION' => GeneralConfig::load()->get_phpboost_major_version(), 'CONTENT' => $content, 'L_INDEX_SUPPORT' => self::$lang['index.support'], 'L_INDEX_FAQ' => self::$lang['index.faq'], 'L_INDEX_DOCUMENTATION' => self::$lang['index.documentation'], 'L_POWERED_BY' => self::$lang['powered_by'], 'L_PHPBOOST_RIGHT' => self::$lang['phpboost_right'], 'L_ADMINISTRATION' => self::$lang['index.administration'], 'L_INDEX_SITE' => self::$lang['index.site'], 'L_EXTEND_MENU' => self::$lang['index.extend_menu'], 'L_DISCONNECT' => self::$lang['index.disconnect'], 'L_ADMIN_MAIN_MENU' => self::$lang['admin.main_menu'], 'L_NEED_HELP' => self::$lang['admin.need_help']));
     if (GraphicalEnvironmentConfig::load()->is_page_bench_enabled()) {
         $template->put_all(array('C_DISPLAY_BENCH' => true, 'BENCH' => AppContext::get_bench()->to_string(), 'REQ' => PersistenceContext::get_querier()->get_executed_requests_count(), 'MEMORY_USED' => AppContext::get_bench()->get_memory_php_used(), 'L_REQ' => self::$lang['sql_req'], 'L_ACHIEVED' => self::$lang['achieved'], 'L_UNIT_SECOND' => LangLoader::get_message('unit.seconds', 'date-common')));
     }
     if (GraphicalEnvironmentConfig::load()->get_display_theme_author()) {
         $theme_configuration = ThemesManager::get_theme(AppContext::get_current_user()->get_theme())->get_configuration();
         $template->put_all(array('C_DISPLAY_AUTHOR_THEME' => true, 'L_THEME' => self::$lang['theme'], 'L_THEME_NAME' => $theme_configuration->get_name(), 'L_BY' => strtolower(self::$lang['by']), 'L_THEME_AUTHOR' => $theme_configuration->get_author_name(), 'U_THEME_AUTHOR_LINK' => $theme_configuration->get_author_link()));
     }
     $template->put('subheader_menu', self::get_subheader_tpl());
     $this->display_page($template);
 }
Example #19
0
 public function __construct($name, $value, $timestamp = null)
 {
     $this->name = $name;
     $this->value = stripslashes($value);
     if (AppContext::get_request()->get_is_https()) {
         $this->set_secure(true);
     }
     $site_path = GeneralConfig::load()->get_site_path();
     if (!empty($site_path)) {
         $this->path = $site_path;
     }
     if ($timestamp == null) {
         $this->expiration_date = time() + 3600 * 744;
         //1 month
     } else {
         $this->expiration_date = $timestamp;
     }
 }
    public function get_feed_data_struct($idcat = 0, $name = '')
    {
        if (ArticlesService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
            $querier = PersistenceContext::get_querier();
            $category = ArticlesService::get_categories_manager()->get_categories_cache()->get_category($idcat);
            $site_name = GeneralConfig::load()->get_site_name();
            $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
            $feed_module_name = LangLoader::get_message('articles.feed_name', 'common', 'articles');
            $data = new FeedData();
            $data->set_title($feed_module_name . ' - ' . $site_name);
            $data->set_date(new Date());
            $data->set_link(SyndicationUrlBuilder::rss('articles', $idcat));
            $data->set_host(HOST);
            $data->set_desc($feed_module_name . ' - ' . $site_name);
            $data->set_lang(LangLoader::get_message('xml_lang', 'main'));
            $data->set_auth_bit(Category::READ_AUTHORIZATIONS);
            $categories = ArticlesService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
            $ids_categories = array_keys($categories);
            $now = new Date();
            $results = $querier->select('SELECT articles.id, articles.id_category, articles.title, articles.rewrited_title, articles.picture_url, 
			articles.contents, articles.description, articles.date_created, cat.rewrited_name AS rewrited_name_cat
			FROM ' . ArticlesSetup::$articles_table . ' articles
			LEFT JOIN ' . ArticlesSetup::$articles_cats_table . ' cat ON cat.id = articles.id_category
			WHERE articles.id_category IN :cats_ids
			AND (published = 1 OR (published = 2 AND publishing_start_date < :timestamp_now AND (publishing_end_date > :timestamp_now OR publishing_end_date = 0)))
			ORDER BY articles.date_created DESC', array('cats_ids' => $ids_categories, 'timestamp_now' => $now->get_timestamp()));
            foreach ($results as $row) {
                $row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root';
                $link = ArticlesUrlBuilder::display_article($row['id_category'], $row['rewrited_name_cat'], $row['id'], $row['rewrited_title']);
                $item = new FeedItem();
                $item->set_title($row['title']);
                $item->set_link($link);
                $item->set_guid($link);
                $item->set_desc(FormatingHelper::second_parse($row['contents']));
                $item->set_date(new Date($row['date_created'], Timezone::SERVER_TIMEZONE));
                $item->set_image_url($row['picture_url']);
                $item->set_auth(ArticlesService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
                $data->add_item($item);
            }
            $results->dispose();
            return $data;
        }
    }
Example #21
0
 public function __construct(SessionData $session)
 {
     $this->id = $session->get_user_id();
     $this->level = $session->get_cached_data('level', -1);
     $this->is_admin = $this->level == 2;
     $this->display_name = $session->get_cached_data('display_name', SessionData::DEFAULT_VISITOR_DISPLAY_NAME);
     $this->email = $session->get_cached_data('email', null);
     $this->show_email = $session->get_cached_data('show_email', false);
     $this->unread_pm = $session->get_cached_data('unread_pm', 0);
     $this->timestamp = $session->get_cached_data('timestamp', time());
     $this->warning_percentage = $session->get_cached_data('warning_percentage', 0);
     $this->delay_banned = $session->get_cached_data('delay_banned', 0);
     $this->delay_readonly = $session->get_cached_data('delay_readonly', 0);
     $user_accounts_config = UserAccountsConfig::load();
     $this->locale = $session->get_cached_data('locale', $user_accounts_config->get_default_lang());
     $this->theme = $session->get_cached_data('theme', $user_accounts_config->get_default_theme());
     $this->timezone = $session->get_cached_data('timezone', GeneralConfig::load()->get_site_timezone());
     $this->editor = $session->get_cached_data('editor', ContentFormattingConfig::load()->get_default_editor());
     $this->build_groups($session);
 }
    public function get_feed_data_struct($idcat = 0, $name = '')
    {
        if (FaqService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
            $querier = PersistenceContext::get_querier();
            $category = FaqService::get_categories_manager()->get_categories_cache()->get_category($idcat);
            $site_name = GeneralConfig::load()->get_site_name();
            $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
            $feed_module_name = LangLoader::get_message('module_title', 'common', 'faq');
            $data = new FeedData();
            $data->set_title($feed_module_name . ' - ' . $site_name);
            $data->set_date(new Date());
            $data->set_link(SyndicationUrlBuilder::rss('faq', $idcat));
            $data->set_host(HOST);
            $data->set_desc($feed_module_name . ' - ' . $site_name);
            $data->set_lang(LangLoader::get_message('xml_lang', 'main'));
            $data->set_auth_bit(Category::READ_AUTHORIZATIONS);
            $categories = FaqService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
            $ids_categories = array_keys($categories);
            $results = $querier->select('SELECT faq.id, faq.id_category, faq.question, faq.answer, faq.creation_date, cat.rewrited_name AS rewrited_name_cat
				FROM ' . FaqSetup::$faq_table . ' faq
				LEFT JOIN ' . FaqSetup::$faq_cats_table . ' cat ON cat.id = faq.id_category
				WHERE approved = 1
				AND faq.id_category IN :ids_categories
				ORDER BY faq.creation_date DESC', array('ids_categories' => $ids_categories));
            foreach ($results as $row) {
                $row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root';
                $link = FaqUrlBuilder::display($row['id_category'], $row['rewrited_name_cat'], $row['id']);
                $item = new FeedItem();
                $item->set_title($row['question']);
                $item->set_link($link);
                $item->set_guid($link);
                $item->set_desc(FormatingHelper::second_parse($row['answer']));
                $item->set_date(new Date($row['creation_date'], Timezone::SERVER_TIMEZONE));
                $item->set_auth(FaqService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
                $data->add_item($item);
            }
            $results->dispose();
            return $data;
        }
    }
    function get_feed_data_struct($idcat = 0, $name = '')
    {
        if (GalleryService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
            $category = GalleryService::get_categories_manager()->get_categories_cache()->get_category($idcat);
            $config = GalleryConfig::load();
            $site_name = GeneralConfig::load()->get_site_name();
            $site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
            $feed_module_name = LangLoader::get_message('module_title', 'common', 'gallery');
            $data = new FeedData();
            $data->set_title($feed_module_name . ' - ' . $site_name);
            $data->set_date(new Date());
            $data->set_link(SyndicationUrlBuilder::rss('gallery', $idcat));
            $data->set_host(HOST);
            $data->set_desc($feed_module_name . ' - ' . $site_name);
            $data->set_lang(LangLoader::get_message('xml_lang', 'main'));
            $data->set_auth_bit(Category::READ_AUTHORIZATIONS);
            $categories = GalleryService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
            $ids_categories = array_keys($categories);
            $results = PersistenceContext::get_querier()->select('SELECT *
				FROM ' . GallerySetup::$gallery_table . '
				WHERE idcat IN :ids_categories
				ORDER BY timestamp DESC
				LIMIT :pics_number_per_page', array('ids_categories' => $ids_categories, 'pics_number_per_page' => $config->get_pics_number_per_page()));
            foreach ($results as $row) {
                $link = TextHelper::htmlentities(GalleryUrlBuilder::get_link_item($row['idcat'], $row['id']));
                $item = new FeedItem();
                $item->set_title($row['name']);
                $item->set_link($link);
                $item->set_guid($link);
                $item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE));
                $item->set_image_url(Url::to_rel('/gallery/pics/' . $row['path']));
                $item->set_auth(GalleryService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
                $data->add_item($item);
            }
            $results->dispose();
            return $data;
        }
    }
 public function execute(HTTPRequestCustom $request)
 {
     $general_config = GeneralConfig::load();
     $other_home_page = $general_config->get_other_home_page();
     if (strpos($other_home_page, '/index.php') !== false) {
         AppContext::get_response()->redirect(UserUrlBuilder::home());
     } else {
         if (!empty($other_home_page)) {
             AppContext::get_response()->redirect($other_home_page);
         } else {
             try {
                 $module = AppContext::get_extension_provider_service()->get_provider($general_config->get_module_home_page());
                 if ($module->has_extension_point(HomePageExtensionPoint::EXTENSION_POINT)) {
                     $home_page = $module->get_extension_point(HomePageExtensionPoint::EXTENSION_POINT)->get_home_page();
                     return $this->build_response($home_page->get_view(), $home_page->get_title());
                 } else {
                     AppContext::get_response()->redirect(UserUrlBuilder::home());
                 }
             } catch (UnexistingExtensionPointProviderException $e) {
                 AppContext::get_response()->redirect(UserUrlBuilder::home());
             }
         }
     }
 }
Example #25
0
 * 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.
 *
 ###################################################*/
require_once '../kernel/begin.php';
require_once '../forum/forum_begin.php';
require_once '../forum/forum_tools.php';
$Bread_crumb->add($config->get_forum_name(), 'index.php');
$Bread_crumb->add($LANG['stats'], '');
define('TITLE', $LANG['stats']);
require_once '../kernel/header.php';
$tpl = new FileTemplate('forum/forum_stats.tpl');
$total_day = NumberHelper::round((time() - GeneralConfig::load()->get_site_install_date()->get_timestamp()) / (3600 * 24), 0);
$timestamp_today = @mktime(0, 0, 1, Date::to_format(Date::DATE_NOW, 'm'), Date::to_format(Date::DATE_NOW, 'd'), Date::to_format(Date::DATE_NOW, 'y'));
$total_topics = PersistenceContext::get_querier()->count(ForumSetup::$forum_topics_table);
$total_messages = PersistenceContext::get_querier()->count(ForumSetup::$forum_message_table);
$total_day = max(1, $total_day);
$nbr_topics_day = NumberHelper::round($total_topics / $total_day, 1);
$nbr_msg_day = NumberHelper::round($total_messages / $total_day, 1);
$row = PersistenceContext::get_querier()->select_single_row_query("SELECT COUNT(*) as nbr_topics_today\nFROM " . ForumSetup::$forum_topics_table . " t\nJOIN " . ForumSetup::$forum_message_table . " m ON m.id = t.first_msg_id\nWHERE m.timestamp > :timestamp", array('timestamp' => $timestamp_today));
$nbr_topics_today = $row['nbr_topics_today'];
$nbr_msg_today = PersistenceContext::get_querier()->count(ForumSetup::$forum_message_table, 'WHERE timestamp > :timestamp', array('timestamp' => $timestamp_today));
$vars_tpl = array('FORUM_NAME' => $config->get_forum_name(), 'NBR_TOPICS' => $total_topics, 'NBR_MSG' => $total_messages, 'NBR_TOPICS_DAY' => $nbr_topics_day, 'NBR_MSG_DAY' => $nbr_msg_day, 'NBR_TOPICS_TODAY' => $nbr_topics_today, 'NBR_MSG_TODAY' => $nbr_msg_today, 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_FORUM' => $LANG['forum'], 'L_STATS' => $LANG['stats'], 'L_NBR_TOPICS' => $total_topics > 1 ? $LANG['topic_s'] : $LANG['topic'], 'L_NBR_MSG' => $total_messages > 1 ? $LANG['message_s'] : $LANG['message'], 'L_NBR_TOPICS_DAY' => $LANG['nbr_topics_day'], 'L_NBR_MSG_DAY' => $LANG['nbr_msg_day'], 'L_NBR_TOPICS_TODAY' => $LANG['nbr_topics_today'], 'L_NBR_MSG_TODAY' => $LANG['nbr_msg_today'], 'L_LAST_MSG' => $LANG['forum_last_msg'], 'L_POPULAR' => $LANG['forum_popular'], 'L_ANSWERS' => $LANG['forum_nbr_answers']);
//Vérification des autorisations.
$authorized_categories = ForumService::get_authorized_categories(Category::ROOT_CATEGORY);
//Dernières réponses
$result = PersistenceContext::get_querier()->select("SELECT t.id, t.title, c.id as cid, c.auth\nFROM " . PREFIX . "forum_topics t\nLEFT JOIN " . PREFIX . "forum_cats c ON c.id = t.idcat\nWHERE c.id_parent != 0 AND c.id IN :authorized_categories\nORDER BY t.last_timestamp DESC\nLIMIT 10", array('authorized_categories' => $authorized_categories));
while ($row = $result->fetch()) {
Example #26
0
        DispatchManager::redirect($error_controller);
    }
    $num_rows = !empty($page_infos['title']) ? 1 : 0;
    if ($page_infos['redirect'] > 0) {
        $redirect_title = stripslashes($page_infos['title']);
        $redirect_id = $page_infos['id'];
        try {
            $page_infos = PersistenceContext::get_querier()->select_single_row(PREFIX . 'pages', array('id', 'title', 'auth', 'is_cat', 'id_cat', 'hits', 'count_hits', 'activ_com', 'redirect', 'contents'), 'WHERE id = :id', array('id' => $page_infos['redirect']));
        } catch (RowNotFoundException $e) {
            $error_controller = PHPBoostErrors::unexisting_page();
            DispatchManager::redirect($error_controller);
        }
    } else {
        $redirect_title = '';
    }
    //Autorisation particulière ?
    $special_auth = !empty($page_infos['auth']);
    $array_auth = unserialize($page_infos['auth']);
    //Vérification de l'autorisation de voir la page
    if ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, READ_PAGE) || !$special_auth && !AppContext::get_current_user()->check_auth($pages_config->get_authorizations(), READ_PAGE)) {
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=e_auth'));
    }
}
if (empty($page_infos['id'])) {
    exit;
}
require_once PATH_TO_ROOT . '/kernel/header_no_display.php';
$template = new FileTemplate('framework/content/print.tpl');
$template->put_all(array('PAGE_TITLE' => stripslashes($page_infos['title']) . ' - ' . GeneralConfig::load()->get_site_name(), 'TITLE' => stripslashes($page_infos['title']), 'L_XML_LANGUAGE' => $LANG['xml_lang'], 'CONTENT' => FormatingHelper::second_parse($page_infos['contents'])));
$template->display();
require_once PATH_TO_ROOT . '/kernel/footer_no_display.php';
Example #27
0
                    } else {
                        $stats_array[$name] = $array_info[1];
                    }
                } else {
                    if (isset($array_info[0])) {
                        $name = ucwords($key);
                        if (array_key_exists($name, $stats_array)) {
                            $stats_array[$name] = $stats_array[$name] + $array_info[0];
                        } else {
                            $stats_array[$name] = $array_info[0];
                        }
                    }
                }
            }
        }
        if ($robots_visits_number) {
            $Stats = new ImagesStats();
            $Stats->load_data($stats_array, 'ellipse');
            foreach ($Stats->data_stats as $key => $angle_value) {
                $array_color = $Stats->array_allocated_color[$Stats->image_color_allocate_dark(false, NO_ALLOCATE_COLOR)];
                $name = ucfirst($key);
                $tpl->assign_block_vars('list', array('COLOR' => 'RGB(' . $array_color[0] . ', ' . $array_color[1] . ', ' . $array_color[2] . ')', 'VIEWS' => NumberHelper::round($angle_value * $Stats->nbr_entry / 360, 0), 'PERCENT' => NumberHelper::round($angle_value / 3.6, 1), 'L_NAME' => $name == 'Other' ? $LANG['other'] : $name));
            }
        }
        $tpl->put_all(array('C_STATS_ROBOTS' => true, 'C_ROBOTS_DATA' => $robots_visits_number, 'L_ERASE_RAPPORT' => $LANG['erase_rapport'], 'L_ERASE' => $LANG['erase'], 'L_COLORS' => $LANG['colors'], 'L_VIEW_NUMBER' => $LANG['number_r_visit'], 'L_LAST_UPDATE' => $LANG['last_update']));
    } else {
        $tpl->put_all(array('C_STATS_SITE' => true, 'START' => GeneralConfig::load()->get_site_install_date()->format(Date::FORMAT_DAY_MONTH_YEAR), 'VERSION' => Environment::get_phpboost_version(), 'BUILD' => GeneralConfig::load()->get_phpboost_major_version(), 'L_START' => $LANG['start'], 'L_KERNEL_VERSION' => $LANG['kernel_version']));
    }
    $tpl->display();
}
require_once '../admin/admin_footer.php';
Example #28
0
 * 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.
 *
 ###################################################*/
####################################################
#						French						#
####################################################
$lang['cat.name'] = 'Test';
$lang['cat.description'] = 'Catégorie de test';
$lang['news.title'] = 'Votre site sous PHPBoost ' . GeneralConfig::load()->get_phpboost_major_version();
$lang['news.content'] = 'Votre site boosté par PHPBoost ' . GeneralConfig::load()->get_phpboost_major_version() . ' est bien installé. Afin de vous aider à le prendre en main, 
l\'accueil de chaque module contient un message pour vous guider dans vos premiers pas. Voici également quelques recommandations supplémentaires que nous vous proposons de lire avec attention : <br />
<br />
<h2 class="formatter-title">N\'oubliez pas de supprimer le répertoire "install"</h2><br />
<br />
Supprimez le répertoire /install à la racine de votre site pour des raisons de sécurité afin que personne ne puisse recommencer l\'installation.<br />
<br />
<h2 class="formatter-title">Administrez votre site</h2><br />
<br />
Accédez au <a href="/admin/">panneau d\'administration de votre site</a> afin de le paramétrer comme vous le souhaitez!  Pour cela : <br />
<br />
<ul class="formatter-ul">
<li class="formatter-li"><a href="' . AdminMaintainUrlBuilder::maintain()->relative() . '">Mettez votre site en maintenance</a> en attendant que vous le configuriez à votre guise.
</li><li class="formatter-li">Rendez vous à la <a href="' . AdminConfigUrlBuilder::general_config()->relative() . '">Configuration générale du site</a>.
</li><li class="formatter-li"><a href="' . AdminModulesUrlBuilder::list_installed_modules()->relative() . '">Configurez les modules</a> disponibles et donnez leur les droits d\'accès (si vous n\'avez pas installé le pack complet, tous les modules sont disponibles sur le site de <a href="http://www.phpboost.com/download/">phpboost.com</a> dans la section téléchargement).
</li><li class="formatter-li"><a href="' . AdminContentUrlBuilder::content_configuration()->relative() . '">Choisissez le langage de formatage du contenu</a> par défaut du site.
    private function build_form()
    {
        $security_config = SecurityConfig::load();
        $form = new HTMLForm(__CLASS__);
        $this->member_extended_fields_service = new MemberExtendedFieldsService($form);
        $fieldset = new FormFieldsetHTML('registration', $this->lang['registration']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldHTML('validation_method', $this->get_accounts_validation_method_explain()));
        $fieldset->add_field(new FormFieldTextEditor('display_name', $this->lang['display_name'], '', array('maxlength' => 100, 'required' => true, 'description' => $this->lang['display_name.explain'], 'events' => array('blur' => '
				if (!HTMLForms.getField("login").getValue() && HTMLForms.getField("display_name").validate() == "") {
					HTMLForms.getField("login").setValue(HTMLForms.getField("display_name").getValue().replace(/\\s/g, \'\'));
					HTMLForms.getField("login").enableValidationMessage();
					HTMLForms.getField("login").liveValidate();
				}')), array(new FormFieldConstraintLengthRange(3, 100), new FormFieldConstraintDisplayNameExists())));
        $fieldset->add_field($email = new FormFieldMailEditor('email', $this->lang['email'], '', array('required' => true), array(new FormFieldConstraintMailExist())));
        $fieldset->add_field(new FormFieldCheckbox('user_hide_mail', $this->lang['email.hide'], FormFieldCheckbox::CHECKED));
        $fieldset->add_field(new FormFieldCheckbox('custom_login', $this->lang['login.custom'], false, array('description' => $this->lang['login.custom.explain'], 'events' => array('click' => '
				if (HTMLForms.getField("custom_login").getValue()) {
					HTMLForms.getField("login").enable();
				} else { 
					HTMLForms.getField("login").disable();
				}'))));
        $fieldset->add_field($login = new FormFieldTextEditor('login', $this->lang['login'], '', array('hidden' => true, 'maxlength' => 25), array(new FormFieldConstraintLengthRange(3, 25), new FormFieldConstraintPHPBoostAuthLoginExists())));
        $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['password'], '', array('description' => StringVars::replace_vars($this->lang['password.explain'], array('number' => $security_config->get_internal_password_min_length())), 'required' => true, 'maxlength' => 500), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength())));
        $fieldset->add_field($password_bis = new FormFieldPasswordEditor('password_bis', $this->lang['password.confirm'], '', array('required' => true, 'maxlength' => 500), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength())));
        $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis));
        if ($security_config->are_login_and_email_forbidden_in_password()) {
            $form->add_constraint(new FormConstraintFieldsInequality($email, $password));
            $form->add_constraint(new FormConstraintFieldsInequality($login, $password));
        }
        $options_fieldset = new FormFieldsetHTML('options', LangLoader::get_message('options', 'main'));
        $form->add_fieldset($options_fieldset);
        $options_fieldset->add_field(new FormFieldTimezone('timezone', $this->lang['timezone.choice'], GeneralConfig::load()->get_site_timezone(), array('description' => $this->lang['timezone.choice.explain'])));
        if (count(ThemesManager::get_activated_and_authorized_themes_map()) > 1) {
            $options_fieldset->add_field(new FormFieldThemesSelect('theme', $this->lang['theme'], $this->user_accounts_config->get_default_theme(), array('check_authorizations' => true, 'events' => array('change' => $this->build_javascript_picture_themes()))));
            $options_fieldset->add_field(new FormFieldFree('preview_theme', $this->lang['theme.preview'], '<img id="img_theme" src="' . $this->get_picture_theme() . '" title="' . $this->lang['theme.preview'] . '" alt="' . $this->lang['theme.preview'] . '" class="preview-img" />'));
        }
        $options_fieldset->add_field(new FormFieldEditors('text-editor', $this->lang['text-editor'], ContentFormattingConfig::load()->get_default_editor()));
        $options_fieldset->add_field(new FormFieldLangsSelect('lang', $this->lang['lang'], $this->user_accounts_config->get_default_lang(), array('check_authorizations' => true)));
        $this->member_extended_fields_service->display_form_fields();
        $agreement_text = FormatingHelper::second_parse($this->user_accounts_config->get_registration_agreement());
        if (!empty($agreement_text)) {
            $agreement_fieldset = new FormFieldsetHTML('agreement_fieldset', $this->lang['agreement']);
            $form->add_fieldset($agreement_fieldset);
            $agreement = new FormFieldHTML('agreement.required', $this->lang['agreement.agree.required'] . '<br /><br />');
            $agreement_fieldset->add_field($agreement);
            $agreement = new FormFieldHTML('agreement', '<div id="id-message-helper" class="notice user-agreement">' . $agreement_text . '</div>');
            $agreement_fieldset->add_field($agreement);
            $agreement_fieldset->add_field(new FormFieldCheckbox('agree', $this->lang['agreement.agree'], FormFieldCheckbox::UNCHECKED, array('required' => $this->lang['agreement.agree.required'])));
        }
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $form->add_button(new FormButtonReset());
        $this->form = $form;
    }
Example #30
0
/*##################################################
 *                             install.php
 *                            -------------------
 *   begin                : May 24, 2014
 *   copyright            : (C) 2014 Julien BRISWALTER
 *   email                : julienseth78@phpboost.com
 *
 *
 ###################################################
 *
 *   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.
 *
 ###################################################*/
####################################################
#						French						#
####################################################
$lang['stream.name'] = 'Actualités du site ' . GeneralConfig::load()->get_site_name();
$lang['stream.description'] = 'Newsletter mensuelle';