private function build_table()
 {
     $table = new SQLHTMLTableModel(DB_TABLE_MEMBER, __CLASS__, array(new HTMLTableColumn('pseudo', 'display_name'), new HTMLTableColumn('email'), new HTMLTableColumn('inscrit le', 'registration_date'), new HTMLTableColumn('messages'), new HTMLTableColumn('derniere connexion'), new HTMLTableColumn('messagerie')), new HTMLTableSortingRule('user_id', HTMLTableSortingRule::ASC));
     $table->set_caption('Liste des membres');
     $options = array('horn' => 'Horn', 'coucou' => 'Coucou', 'teston' => 'teston');
     $table->add_filter(new HTMLTableEqualsFromListSQLFilter('display_name', 'filter1', 'login Equals', $options));
     $table->add_filter(new HTMLTableBeginsWithTextSQLFilter('display_name', 'filter2', 'login Begins with (regex)', '`^(?!%).+$`'));
     $table->add_filter(new HTMLTableBeginsWithTextSQLFilter('display_name', 'filter3', 'login Begins with (no regex)'));
     $table->add_filter(new HTMLTableEndsWithTextSQLFilter('display_name', 'filter4', 'login Ends with (regex)', '`^(?!%).+$`'));
     $table->add_filter(new HTMLTableEndsWithTextSQLFilter('display_name', 'filter5', 'login Ends with (no regex)'));
     $table->add_filter(new HTMLTableLikeTextSQLFilter('display_name', 'filter6', 'login Like (regex)', '`^toto`'));
     $table->add_filter(new HTMLTableLikeTextSQLFilter('display_name', 'filter7', 'login Like (no regex)'));
     $table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter8', 'id >'));
     $table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter9', 'id > (lower=3)', 3));
     $table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter10', 'id > (upper=3)', HTMLTableNumberComparatorSQLFilter::NOT_BOUNDED, 3));
     $table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter11', 'id > (lower=1, upper=3)', 1, 3));
     $table->add_filter(new HTMLTableLessThanSQLFilter('user_id', 'filter12', 'id <'));
     $table->add_filter(new HTMLTableGreaterThanOrEqualsToSQLFilter('user_id', 'filter13', 'id >='));
     $table->add_filter(new HTMLTableLessThanOrEqualsToSQLFilter('user_id', 'filter14', 'id <='));
     $table->add_filter(new HTMLTableEqualsToSQLFilter('user_id', 'filter15', 'id ='));
     $html_table = new HTMLTable($table);
     $results = array();
     $result = $table->get_sql_results();
     foreach ($result as $row) {
         $results[] = new HTMLTableRow(array(new HTMLTableRowCell($row['display_name']), new HTMLTableRowCell($row['show_email'] == 1 ? '<a href="mailto:' . $row['email'] . '" class="basic-button smaller">Mail</a>' : '&nbsp;'), new HTMLTableRowCell(Date::to_format($row['registration_date'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)), new HTMLTableRowCell(!empty($row['posted_msg']) ? $row['posted_msg'] : '0'), new HTMLTableRowCell(!empty($row['last_connection_date']) ? Date::to_format($row['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main')), new HTMLTableRowCell('<a href="' . Url::to_rel('/user/pm.php?pm=' . $row['user_id']) . '" class="basic-button smaller">MP</a>')));
     }
     $html_table->set_rows($table->get_number_of_matching_rows(), $results);
     return $html_table;
 }
    private function build_view($group_id)
    {
        if (!empty($group_id)) {
            $group = $this->groups_cache->get_group($group_id);
            $this->view->put_all(array('C_ADMIN' => AppContext::get_current_user()->check_level(User::ADMIN_LEVEL), 'U_ADMIN_GROUPS' => TPL_PATH_TO_ROOT . '/admin/admin_groups.php?id=' . $group_id, 'GROUP_NAME' => $group['name']));
        } else {
            $this->view->put_all(array('GROUP_NAME' => $this->lang['groups']));
        }
        $user_accounts_config = UserAccountsConfig::load();
        $number_member = 0;
        foreach ($this->get_members_group($group_id) as $user_id) {
            if (!empty($user_id)) {
                $user = PersistenceContext::get_querier()->select('SELECT 
					member.display_name, member.level, member.groups, member.warning_percentage, member.delay_banned, ext_field.user_avatar
					FROM ' . DB_TABLE_MEMBER . ' member
					LEFT JOIN ' . DB_TABLE_MEMBER_EXTENDED_FIELDS . ' ext_field ON ext_field.user_id = member.user_id
					WHERE member.user_id = :user_id
				', array('user_id' => $user_id))->fetch();
                if (!empty($user)) {
                    //Avatar
                    $user_avatar = !empty($user['user_avatar']) ? Url::to_rel($user['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
                    $group_color = User::get_group_color($user['groups'], $user['level']);
                    $this->view->assign_block_vars('members_list', array('C_AVATAR' => $user['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'C_GROUP_COLOR' => !empty($group_color), 'PSEUDO' => $user['display_name'], 'LEVEL' => $user['warning_percentage'] < '100' || time() - $user['delay_banned'] < 0 ? UserService::get_level_lang($user['level']) : $this->lang['banned'], 'LEVEL_CLASS' => UserService::get_level_class($user['level']), 'GROUP_COLOR' => $group_color, 'U_PROFILE' => UserUrlBuilder::profile($user_id)->rel(), 'U_AVATAR' => $user_avatar));
                    $number_member++;
                }
            }
        }
        $this->view->put_all(array('C_NOT_MEMBERS' => $number_member == 0, 'SELECT_GROUP' => $this->build_form($group_id)->display()));
    }
 private function display_page(View $body_template)
 {
     $template = new FileTemplate('admin/frame.tpl');
     $customization_config = CustomizationConfig::load();
     $template->put_all(array('C_FAVICON' => $customization_config->favicon_exists(), 'C_CSS_CACHE_ENABLED' => CSSCacheConfig::load()->is_enabled(), 'FAVICON' => Url::to_rel($customization_config->get_favicon_path()), 'FAVICON_TYPE' => $customization_config->favicon_type(), 'TITLE' => $this->get_seo_meta_data()->get_full_title(), 'MODULES_CSS' => $this->get_modules_css_files_html_code(), 'JS_TOP' => new FileTemplate('js_top.tpl'), 'JS_BOTTOM' => new FileTemplate('js_bottom.tpl'), 'L_XML_LANGUAGE' => self::$lang['xml_lang'], 'BODY' => $body_template));
     $template->display();
 }
 /**
  * @return string The html code for the input.
  */
 public function display()
 {
     $template = $this->get_template_to_use();
     $this->assign_common_template_variables($template);
     $file_type = new FileType(new File($this->get_value()));
     $template->put_all(array('C_PREVIEW_HIDDEN' => !$file_type->is_picture(), 'C_AUTH_UPLOAD' => FileUploadConfig::load()->is_authorized_to_access_interface_files(), 'FILE_PATH' => Url::to_rel($this->get_value())));
     return $template;
 }
 private function delete_old_files()
 {
     $file = new File(Url::to_rel('/' . $this->module_id . '/formatting/smileys.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/smileys.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/wikipedia_icon.png'));
     $file->delete();
 }
 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($label, $link, $css_class_image = '')
 {
     $full_label = '';
     if (!empty($css_class_image)) {
         $full_label = '<i class="' . $css_class_image . '" title="' . $label . '"></i>';
     } else {
         $full_label = $label;
     }
     parent::__construct('button', $full_label, '', 'window.location=' . TextHelper::to_js_string(Url::to_rel($link)), 'image');
 }
Пример #8
0
 public function __construct($label, $link, $img = '')
 {
     $full_label = '';
     if (!empty($img)) {
         $full_label = '<img src="' . $img . '" alt="' . $label . '" title="' . $label . '" />';
     } else {
         $full_label = $label;
     }
     parent::__construct('button', $full_label, '', 'window.location=' . TextHelper::to_js_string(Url::to_rel($link)), !empty($img) ? 'image' : '');
 }
 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 '';
 }
 protected function get_modules_css_files_html_code()
 {
     $css_cache_config = CSSCacheConfig::load();
     $css_files = array_merge(ModulesCssFilesService::get_css_files_always_displayed(), ModulesCssFilesService::get_css_files_running_module_displayed());
     if ($css_cache_config->is_enabled()) {
         $html_code = '<link rel="stylesheet" href="' . CSSCacheManager::get_css_path($css_files) . '" type="text/css" media="screen, print" />';
     } else {
         $html_code = '';
         foreach ($css_files as $file) {
             $html_code .= '<link rel="stylesheet" href="' . Url::to_rel($file) . '" type="text/css" media="screen, print" />';
         }
     }
     return $html_code;
 }
 private function build_table()
 {
     $table_model = new HTMLTableModel('table', array(new HTMLTableColumn($this->lang['smiley']), new HTMLTableColumn(LangLoader::get_message('code', 'main')), new HTMLTableColumn('')), new HTMLTableSortingRule(''), HTMLTableModel::NO_PAGINATION);
     $table = new HTMLTable($table_model);
     $table_model->set_caption($this->lang['smiley_management']);
     $results = array();
     foreach (SmileysCache::load()->get_smileys() as $code => $row) {
         $edit_link = new LinkHTMLElement(AdminSmileysUrlBuilder::edit($row['idsmiley']), '', array('title' => LangLoader::get_message('edit', 'common')), 'fa fa-edit');
         $delete_link = new LinkHTMLElement(AdminSmileysUrlBuilder::delete($row['idsmiley']), '', array('title' => LangLoader::get_message('delete', 'common'), 'data-confirmation' => 'delete-element'), 'fa fa-delete');
         $results[] = new HTMLTableRow(array(new HTMLTableRowCell(new ImgHTMLElement(Url::to_rel('/images/smileys/') . $row['url_smiley'], array('id' => 'smiley-' . $row['idsmiley'] . '-img', 'alt' => ''))), new HTMLTableRowCell($code), new HTMLTableRowCell($edit_link->display() . $delete_link->display())));
     }
     $table->set_rows(count($results), $results);
     $this->view->put('table', $table->display());
 }
 public function display_field_profile(MemberExtendedField $member_extended_field)
 {
     $fieldset = $member_extended_field->get_fieldset();
     $user_accounts_config = UserAccountsConfig::load();
     $value = $member_extended_field->get_value();
     if (empty($value) && $user_accounts_config->is_default_avatar_enabled()) {
         $avatar = '<img src="' . Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) . '" alt="' . LangLoader::get_message('avatar', 'user-common') . '" title="' . LangLoader::get_message('avatar', 'user-common') . '" />';
     } elseif (!empty($value)) {
         $avatar = '<img src="' . Url::to_rel($value) . '" alt="' . LangLoader::get_message('avatar', 'user-common') . '" title="' . LangLoader::get_message('avatar', 'user-common') . '" />';
     } else {
         $avatar = $this->lang['extended-field.field.avatar.no_avatar'];
     }
     if (!empty($avatar)) {
         $fieldset->add_field(new FormFieldFree($member_extended_field->get_field_name(), $member_extended_field->get_name(), $avatar));
     }
 }
 private function build_view()
 {
     $installed_themes = ThemesManager::get_installed_themes_map();
     foreach ($installed_themes as $theme) {
         $configuration = $theme->get_configuration();
         $authorizations = $theme->get_authorizations();
         $default_theme = ThemesManager::get_default_theme();
         $pictures = $configuration->get_pictures();
         $this->view->assign_block_vars('themes_installed', array('C_IS_DEFAULT_THEME' => $theme->get_id() == $default_theme, 'C_IS_ACTIVATED' => $theme->is_activated(), 'C_WEBSITE' => $configuration->get_author_link() !== '', 'C_PICTURES' => count($pictures) > 0, 'ID' => $theme->get_id(), 'NAME' => $configuration->get_name(), 'VERSION' => $configuration->get_version(), 'MAIN_PICTURE' => count($pictures) > 0 ? Url::to_rel('/templates/' . $theme->get_id() . '/' . current($pictures)) : '', 'AUTHOR_NAME' => $configuration->get_author_name(), 'AUTHOR_WEBSITE' => $configuration->get_author_link(), 'AUTHOR_EMAIL' => $configuration->get_author_mail(), 'DESCRIPTION' => $configuration->get_description() !== '' ? $configuration->get_description() : $this->lang['themes.bot_informed'], 'COMPATIBILITY' => $configuration->get_compatibility(), 'AUTHORIZATIONS' => Authorizations::generate_select(Theme::ACCES_THEME, $authorizations, array(2 => true), $theme->get_id()), 'HTML_VERSION' => $configuration->get_html_version() !== '' ? $configuration->get_html_version() : $this->lang['themes.bot_informed'], 'CSS_VERSION' => $configuration->get_css_version() !== '' ? $configuration->get_css_version() : $this->lang['themes.bot_informed'], 'MAIN_COLOR' => $configuration->get_main_color() !== '' ? $configuration->get_main_color() : $this->lang['themes.bot_informed'], 'WIDTH' => $configuration->get_variable_width() ? $this->lang['themes.variable-width'] : $configuration->get_width()));
         if (count($pictures) > 0) {
             unset($pictures[0]);
             foreach ($pictures as $picture) {
                 $this->view->assign_block_vars('themes_installed.pictures', array('URL' => Url::to_rel('/templates/' . $theme->get_id() . '/' . $picture)));
             }
         }
     }
     $this->view->put_all(array('L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_RESET' => LangLoader::get_message('reset', 'main'), 'L_UPDATE' => LangLoader::get_message('update', 'main')));
 }
    private function build_form($request)
    {
        $pagination = $this->get_pagination();
        $result = PersistenceContext::get_querier()->select('SELECT @id_stream:= id, newsletter_streams.*,
			(SELECT COUNT(*)
			FROM ' . NewsletterSetup::$newsletter_table_subscriptions . ' subscriptions
			LEFT JOIN ' . NewsletterSetup::$newsletter_table_subscribers . ' subscribers ON subscriptions.subscriber_id = subscribers.id
			LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON subscribers.user_id = member.user_id
			WHERE (subscribers.mail <> \'\' OR member.email <> \'\') AND subscriptions.stream_id = @id_stream
			) AS subscribers_number
		FROM ' . NewsletterSetup::$newsletter_table_streams . ' newsletter_streams
		LIMIT :number_items_per_page OFFSET :display_from', array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
        while ($row = $result->fetch()) {
            if (NewsletterAuthorizationsService::id_stream($row['id'])->read()) {
                $this->view->assign_block_vars('streams_list', array('C_VIEW_ARCHIVES' => NewsletterAuthorizationsService::id_stream($row['id'])->read_archives(), 'C_VIEW_SUBSCRIBERS' => NewsletterAuthorizationsService::id_stream($row['id'])->read_subscribers(), 'IMAGE' => Url::to_rel($row['image']), 'NAME' => $row['name'], 'DESCRIPTION' => $row['description'], 'SUBSCRIBERS_NUMBER' => $row['subscribers_number'], 'U_VIEW_ARCHIVES' => NewsletterUrlBuilder::archives($row['id'], $row['rewrited_name'])->absolute(), 'U_VIEW_SUBSCRIBERS' => NewsletterUrlBuilder::subscribers($row['id'], $row['rewrited_name'])->absolute()));
            }
        }
        $this->view->put_all(array('C_SUSCRIBE' => NewsletterAuthorizationsService::check_authorizations()->subscribe(), 'C_STREAMS' => $result->get_rows_count() != 0, 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display()));
        $result->dispose();
    }
 private function build_view()
 {
     $not_installed_themes = $this->get_not_installed_themes();
     foreach ($not_installed_themes as $key => $name) {
         try {
             $configuration = ThemeConfigurationManager::get($name);
             $pictures = $configuration->get_pictures();
             $id_theme = $name;
             $this->view->assign_block_vars('themes_not_installed', array('C_WEBSITE' => $configuration->get_author_link() !== '', 'C_PICTURES' => count($pictures) > 0, 'ID' => $id_theme, 'NAME' => $configuration->get_name(), 'VERSION' => $configuration->get_version(), 'MAIN_PICTURE' => count($pictures) > 0 ? Url::to_rel('/templates/' . $id_theme . '/' . current($pictures)) : '', 'AUTHOR_NAME' => $configuration->get_author_name(), 'AUTHOR_WEBSITE' => $configuration->get_author_link(), 'AUTHOR_EMAIL' => $configuration->get_author_mail(), 'DESCRIPTION' => $configuration->get_description() !== '' ? $configuration->get_description() : $this->lang['themes.bot_informed'], 'COMPATIBILITY' => $configuration->get_compatibility(), 'AUTHORIZATIONS' => Authorizations::generate_select(Theme::ACCES_THEME, array('r-1' => 1, 'r0' => 1, 'r1' => 1), array(2 => true), $id_theme), 'HTML_VERSION' => $configuration->get_html_version() !== '' ? $configuration->get_html_version() : $this->lang['themes.bot_informed'], 'CSS_VERSION' => $configuration->get_css_version() !== '' ? $configuration->get_css_version() : $this->lang['themes.bot_informed'], 'MAIN_COLOR' => $configuration->get_main_color() !== '' ? $configuration->get_main_color() : $this->lang['themes.bot_informed'], 'WIDTH' => $configuration->get_variable_width() ? $this->lang['themes.variable-width'] : $configuration->get_width()));
             if (count($pictures) > 0) {
                 unset($pictures[0]);
                 foreach ($pictures as $picture) {
                     $this->view->assign_block_vars('themes_not_installed.pictures', array('URL' => Url::to_rel('/templates/' . $id_theme . '/' . $picture)));
                 }
             }
         } catch (IOException $e) {
             unset($not_installed_themes[$key]);
         }
     }
     $this->view->put_all(array('C_THEME_INSTALL' => count($not_installed_themes) > 0, 'L_ADD' => $this->lang['themes.add_theme']));
 }
 private function delete_old_files()
 {
     $file = new File(Url::to_rel('/' . $this->module_id . '/lang/english/' . $this->module_id . '_english.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/lang/french/' . $this->module_id . '_french.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/admin_shoutbox.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/shoutbox.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/shoutbox_begin.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/xmlhttprequest.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_shoutbox_config.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/shoutbox.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/shoutbox_mini.tpl'));
     $file->delete();
 }
    private function build_view()
    {
        $user_accounts_config = UserAccountsConfig::load();
        $messages_number = GuestbookService::count();
        $page = AppContext::get_request()->get_getint('page', 1);
        $pagination = $this->get_pagination($messages_number, $page);
        $is_guest = !AppContext::get_current_user()->check_level(User::MEMBER_LEVEL);
        $result = PersistenceContext::get_querier()->select('SELECT member.*, guestbook.*, guestbook.login as glogin, ext_field.user_avatar
		FROM ' . GuestbookSetup::$guestbook_table . ' guestbook
		LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = guestbook.user_id
		LEFT JOIN ' . DB_TABLE_MEMBER_EXTENDED_FIELDS . ' ext_field ON ext_field.user_id = member.user_id
		ORDER BY guestbook.timestamp DESC
		LIMIT :number_items_per_page OFFSET :display_from', array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
        while ($row = $result->fetch()) {
            $message = new GuestbookMessage();
            $message->set_properties($row);
            //Avatar
            $user_avatar = !empty($row['user_avatar']) ? Url::to_rel($row['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
            $this->view->assign_block_vars('messages', array_merge($message->get_array_tpl_vars($page), array('C_AVATAR' => $row['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'C_USER_GROUPS' => !empty($row['groups']), 'U_AVATAR' => $user_avatar)));
            //user's groups
            if ($message->get_author_user()->get_groups()) {
                $groups_cache = GroupsCache::load();
                $user_groups = $message->get_author_user()->get_groups();
                foreach ($user_groups as $user_group_id) {
                    if ($groups_cache->group_exists($user_group_id)) {
                        $group = $groups_cache->get_group($user_group_id);
                        $this->view->assign_block_vars('messages.user_groups', array('C_GROUP_PICTURE' => !empty($group['img']), 'GROUP_PICTURE' => $group['img'], 'GROUP_NAME' => $group['name']));
                    }
                }
            }
        }
        $result->dispose();
        $this->view->put_all(array('C_NO_MESSAGE' => $result->get_rows_count() == 0, 'C_PAGINATION' => $messages_number > GuestbookConfig::load()->get_items_per_page(), 'PAGINATION' => $pagination->display()));
        if (GuestbookAuthorizationsService::check_authorizations()->write() && !AppContext::get_current_user()->is_readonly()) {
            $this->view->put('FORM', GuestbookFormController::get_view());
        } else {
            $this->view->put('MSG', MessageHelper::display($this->lang['error.post.unauthorized'], MessageHelper::WARNING));
        }
        return $this->view;
    }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('customize-favicon', $this->lang['customization.favicon']);
     $form->add_fieldset($fieldset);
     if ($this->config->get_favicon_path() == null || $this->config->get_favicon_path() == '') {
         $fieldset->add_field(new FormFieldFree('current_favicon', $this->lang['customization.favicon.current'], $this->lang['customization.favicon.current.null']));
     } else {
         if ($this->config->favicon_exists()) {
             $favicon_file = new File(PATH_TO_ROOT . $this->config->get_favicon_path());
             $picture = '<img src="' . Url::to_rel($favicon_file->get_path()) . '" alt="' . $this->lang['customization.favicon.current'] . '" title="' . $this->lang['customization.favicon.current'] . '"/>';
             $fieldset->add_field(new FormFieldFree('current_favicon', $this->lang['customization.favicon.current'], $picture));
         } else {
             $fieldset->add_field(new FormFieldFree('current_favicon', $this->lang['customization.favicon.current'], '<span class="text-strong color-alert">' . $this->lang['customization.favicon.current.erased'] . '</span>'));
         }
     }
     $fieldset->add_field(new FormFieldFilePicker('favicon', $this->lang['customization.favicon.current.change']));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
    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;
        }
    }
 private function delete_old_files()
 {
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/browsers.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/countries.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/keyword.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/member.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/os.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/pages.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/referer.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/robots.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/site.png'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/images/visitors.png'));
     $file->delete();
 }
    private function build_smiley_form()
    {
        $form = new HTMLForm('smiley', '', false);
        $fieldset = new FormFieldsetHTML('smiley', !$this->smiley['idsmiley'] ? $this->lang['add_smiley'] : $this->lang['edit_smiley']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldTextEditor('code_smiley', $this->lang['smiley_code'], $this->smiley['code_smiley'], array('maxlength' => 50, 'required' => true)));
        $fieldset->add_field(new FormFieldSimpleSelectChoice('url_smiley', $this->lang['smiley_available'], $this->smiley['url_smiley'], $this->generate_available_smileys_pictures_list(), array('events' => array('change' => '
				if (HTMLForms.getField("url_smiley").getValue() != \'\') {
					jQuery(\'#smiley-img\').attr(\'src\', \'' . Url::to_rel('/images/smileys/') . '\' + HTMLForms.getField("url_smiley").getValue());
					HTMLForms.getField("img_smiley").enable();
				} else {
					HTMLForms.getField("img_smiley").disable();
				}'))));
        $img_smiley = new ImgHTMLElement($this->smiley['idsmiley'] ? Url::to_rel('/images/smileys/') . $this->smiley['url_smiley'] : '', array('id' => 'smiley-img', 'alt' => ''));
        $fieldset->add_field(new FormFieldFree('img_smiley', LangLoader::get_message('form.picture.preview', 'common'), $img_smiley->display(), array('hidden' => !$this->smiley['idsmiley'])));
        $this->smiley_submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->smiley_submit_button);
        $this->smiley_form = $form;
    }
Пример #22
0
     $user_groups = '';
     $array_user_groups = explode('|', $row['groups']);
     foreach (GroupsService::get_groups() as $idgroup => $array_group_info) {
         if (is_numeric(array_search($idgroup, $array_user_groups))) {
             $user_groups .= !empty($array_group_info['img']) ? '<img src="../images/group/' . $array_group_info['img'] . '" alt="' . $array_group_info['name'] . '" title="' . $array_group_info['name'] . '"/><br />' : $LANG['group'] . ': ' . $array_group_info['name'] . '<br />';
         }
     }
 } else {
     $user_groups = $LANG['group'] . ': ' . $user_group;
 }
 $user_accounts_config = UserAccountsConfig::load();
 //Avatar
 if (empty($row['user_avatar'])) {
     $user_avatar = $user_accounts_config->is_default_avatar_enabled() == '1' ? '<img src="../templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name() . '" alt="' . LangLoader::get_message('avatar', 'user-common') . '" />' : '';
 } else {
     $user_avatar = '<img src="' . Url::to_rel($row['user_avatar']) . '" alt="' . LangLoader::get_message('avatar', 'user-common') . '" />';
 }
 //Affichage du nombre de message.
 if ($row['posted_msg'] >= 1) {
     $posted_msg = '<a href="' . UserUrlBuilder::messages($row['user_id'])->rel() . '" class="small">' . $LANG['message_s'] . '</a>: ' . $row['posted_msg'];
 } else {
     $posted_msg = !$is_guest ? '<a href="' . PATH_TO_ROOT . '/forum/membermsg' . url('.php?id=' . $row['user_id'], '') . '" class="small">' . $LANG['message'] . '</a>: 0' : $LANG['message'] . ': 0';
 }
 $user_sign_field = $extended_fields_cache->get_extended_field_by_field_name('user_sign');
 $tpl->assign_block_vars('list', array('C_GROUP_COLOR' => !empty($group_color), 'C_GUEST' => empty($row['display_name']), 'CONTENTS' => FormatingHelper::second_parse($row['contents']), 'DATE' => $LANG['on'] . ' ' . Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'ID' => $row['id'], 'USER_RANK' => $row['warning_percentage'] < '100' || time() - $row['delay_banned'] < 0 ? $user_rank : LangLoader::get_message('banned', 'user-common'), 'USER_IMG_ASSOC' => $user_assoc_img, 'USER_AVATAR' => $user_avatar, 'USER_GROUP' => $user_groups, 'USER_DATE' => !$is_guest ? $LANG['registered_on'] . ': ' . Date::to_format($row['registered'], Date::FORMAT_DAY_MONTH_YEAR) : '', 'USER_MSG' => !$is_guest ? $posted_msg : '', 'USER_MAIL' => !empty($row['email']) && $row['show_email'] == '1' ? '<a href="mailto:' . $row['email'] . '" class="basic-button smaller">Mail</a>' : '', 'USER_SIGN' => !empty($row['user_sign']) && !empty($user_sign_field) && $user_sign_field['display'] ? '____________________<br />' . FormatingHelper::second_parse($row['user_sign']) : '', 'USER_WARNING' => $row['warning_percentage'], 'USER_PM' => !$is_guest && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL) ? '<a href="' . UserUrlBuilder::personnal_message($row['user_id'])->rel() . '" class="basic-button smaller">MP</a>' : '', 'USER_ONLINE' => '<i class="fa ' . (!empty($row['connect']) ? 'fa-online' : 'fa-offline') . '"></i>', 'USER_PSEUDO' => !empty($row['display_name']) ? wordwrap(TextHelper::html_entity_decode($row['display_name']), 13, '<br />', 1) : $LANG['guest'], 'LEVEL_CLASS' => UserService::get_level_class($row['level']), 'GROUP_COLOR' => $group_color, 'U_USER_PROFILE' => UserUrlBuilder::profile($row['user_id'])->rel(), 'U_VARS_ANCRE' => url('.php?id=' . $row['idtopic'], '-' . $row['idtopic'] . $rewrited_title . '.php'), 'U_FORUM_CAT' => '<a class="forum-mbrmsg-links" href="' . PATH_TO_ROOT . '/forum/forum' . url('.php?id=' . $row['idcat'], '-' . $row['idcat'] . $rewrited_cat_title . '.php') . '">' . $row['name'] . '</a>', 'U_TITLE_T' => '<a class="forum-mbrmsg-links" href="' . PATH_TO_ROOT . '/forum/topic' . url('.php?id=' . $row['idtopic'], '-' . $row['idtopic'] . $rewrited_title . '.php') . '">' . stripslashes($row['title']) . '</a>'));
 foreach ($displayed_extended_fields as $field_type) {
     $field = $extended_fields_cache->get_extended_field_by_field_name($field_type);
     if (!empty($row[$field_type]) && !empty($field) && $field['display']) {
         $button = '';
         if ($field['regex'] == 4) {
             foreach (MemberShortTextExtendedField::$brands_pictures_list as $id => $parameters) {
 private function delete_old_files()
 {
     $file = new File(Url::to_rel('/' . $this->module_id . '/admin_media_cats.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/admin_media_config.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/admin_media_menu.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/xmlhttprequest_cats.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/phpboost/MediaCats.class.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_media_cats.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_media_config.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_media_menu.tpl'));
     $file->delete();
 }
Пример #24
0
 /**
  * @desc Assign tpl vars
  * @access protected
  * @param Template $template the template on which we gonna assign vars
  * @param int $mode in LinksMenuElement::LINKS_MENU_ELEMENT__CLASSIC_DISPLAYING mode, the links menu is
  * displayed. With the LinksMenuElement::LINKS_MENU_ELEMENT__FULL_DISPLAYING mode, the authorization form is
  * also shown.
  */
 protected function _assign($template, $mode = self::LINKS_MENU_ELEMENT__CLASSIC_DISPLAYING)
 {
     $image = new Image(Url::to_absolute($this->image));
     parent::_assign($template);
     $template->put_all(array('C_MENU' => false, 'TITLE' => $this->title, 'DEPTH' => $this->depth, 'PARENT_DEPTH' => $this->depth - 1, 'C_URL' => !empty($this->url), 'C_IMG' => !empty($this->image), 'ABSOLUTE_URL' => Url::to_absolute($this->url), 'ABSOLUTE_IMG' => Url::to_absolute($this->image), 'RELATIVE_URL' => Url::to_relative($this->url), 'RELATIVE_IMG' => Url::to_relative($this->image), 'REL_URL' => Url::to_rel($this->url), 'REL_IMG' => Url::to_rel($this->image), 'ID' => $this->get_uid(), 'ID_VAR' => $this->get_uid(), 'IMG_HEIGHT' => $image->get_height(), 'IMG_WIDTH' => $image->get_width()));
     //Full displaying: we also show the authorization formulary
     if ($mode) {
         $template->put_all(array('AUTH_FORM' => Authorizations::generate_select(Menu::MENU_AUTH_BIT, $this->get_auth(), array(), 'menu_element_' . $this->uid . '_auth')));
     }
 }
Пример #25
0
 public function get_avatar()
 {
     return Url::to_rel($this->avatar);
 }
 private function delete_old_files()
 {
     $file = new File(Url::to_rel('/' . $this->module_id . '/GalleryUrlBuilder.class.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/admin_gallery_cat.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/admin_gallery_cat_add.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/admin_xmlhttprequest.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/pics/index.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/pics/thumbnails/index.php'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_gallery_cat.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_gallery_cat_add.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_gallery_cat_del.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_gallery_cat_edit.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/' . $this->module_id . '/templates/admin_gallery_cat_edit2.tpl'));
     $file->delete();
     $folder = new Folder(Url::to_rel('/' . $this->module_id . '/templates/js'));
     if ($folder->exists()) {
         $folder->delete();
     }
 }
Пример #27
0
 public function set_target($target)
 {
     $this->target = Url::to_rel($target);
 }
Пример #28
0
 private function delete_old_files_user()
 {
     $file = new File(Url::to_rel('/user/controllers/UserErrorCSRFController.class.php'));
     $file->delete();
     $file = new File(Url::to_rel('/user/controllers/UserMaintainController.class.php'));
     $file->delete();
     $file = new File(Url::to_rel('/user/phpboost/EventsCommentsTopic.class.php'));
     $file->delete();
     $file = new File(Url::to_rel('/user/phpboost/EventsExtensionPointProvider.class.php'));
     $file->delete();
     $file = new File(Url::to_rel('/user/services/UserLostPasswordService.class.php'));
     $file->delete();
     $file = new File(Url::to_rel('/user/templates/ErrorViewBuilder.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/user/templates/UserMaintainController.tpl'));
     $file->delete();
     $file = new File(Url::to_rel('/user/util/UserDisplayResponse.class.php'));
     $file->delete();
     $folder = new Folder(Url::to_rel('/user/controllers/error'));
     if ($folder->exists()) {
         $folder->delete();
     }
 }
 private function build_javascript_picture_themes()
 {
     $text = 'var theme = new Array;' . "\n";
     foreach (ThemesManager::get_activated_themes_map() as $theme) {
         $text .= 'theme["' . $theme->get_id() . '"] = "' . Url::to_rel($this->get_picture_theme($theme->get_id())) . '";' . "\n";
     }
     $text .= 'var theme_id = HTMLForms.getField("theme").getValue(); document.images[\'img_theme\'].src = theme[theme_id];';
     return $text;
 }
 public function add_link($name, $url)
 {
     $this->links[] = array('LINK' => $name, 'U_LINK' => Url::to_rel($url));
 }