public function display($content) { $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' => LangLoader::get_message('xml_lang', 'main'), 'BODY' => new StringTemplate($content))); $template->display(); }
public function __construct() { parent::__construct(); $this->set_disable_fields_configuration(array('regex', 'possible_values', 'default_value')); $this->set_name(LangLoader::get_message('extended_fields.newsletter.name', 'common', 'newsletter')); $this->field_used_once = true; }
public function execute(HTTPRequestCustom $request) { $id = $request->get_int('id', 0); $id_stream = $request->get_int('id_stream', 0); $db_querier = PersistenceContext::get_querier(); if ($this->subscriber_exist($id) || $id_stream !== 0 && $id !== 0) { if (!NewsletterAuthorizationsService::id_stream($id_stream)->moderation_subscribers()) { NewsletterAuthorizationsService::get_errors()->moderation_subscribers(); } $condition = "WHERE subscriber_id = :id AND stream_id = :id_stream"; $parameters = array('id' => $id, 'id_stream' => $id_stream); $db_querier->delete(NewsletterSetup::$newsletter_table_subscriptions, $condition, $parameters); $condition = "WHERE subscriber_id = :id"; $parameters = array('id' => $id); $is_last = PersistenceContext::get_querier()->count(NewsletterSetup::$newsletter_table_subscriptions, $condition, $parameters) == 0; if ($is_last) { $condition = "WHERE id = :id"; $parameters = array('id' => $id); $db_querier->delete(NewsletterSetup::$newsletter_table_subscribers, $condition, $parameters); } NewsletterStreamsCache::invalidate(); $controller = new UserErrorController(LangLoader::get_message('success', 'status-messages-common'), LangLoader::get_message('process.success', 'status-messages-common'), UserErrorController::SUCCESS); DispatchManager::redirect($controller); } else { $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('error-subscriber-not-existed', 'common', 'newsletter')); DispatchManager::redirect($controller); } }
public function __construct($value = '') { if (empty($value)) { $value = LangLoader::get_message('submit', 'main'); } parent::__construct($value, 'submit'); }
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>' : ' '), 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_form() { $form = new HTMLForm(__CLASS__); //Configuration $fieldset = new FormFieldsetHTML('configuration_fieldset', LangLoader::get_message('configuration', 'admin-common')); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldNumberEditor('items_number_per_page', $this->lang['calendar.config.items_number_per_page'], $this->config->get_items_number_per_page(), array('min' => 1, 'max' => 50, 'required' => true), array(new FormFieldConstraintIntegerRange(1, 50)))); $fieldset->add_field(new FormFieldCheckbox('comments_enabled', LangLoader::get_message('config.comments_enabled', 'admin-common'), $this->config->are_comments_enabled())); $fieldset->add_field(new FormFieldColorPicker('event_color', $this->lang['calendar.config.event_color'], $this->config->get_event_color(), array(), array(new FormFieldConstraintRegex('`^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$`i')))); $fieldset->add_field(new FormFieldCheckbox('members_birthday_enabled', $this->lang['calendar.config.members_birthday_enabled'], $this->config->is_members_birthday_enabled(), array('events' => array('click' => ' if (HTMLForms.getField("members_birthday_enabled").getValue()) { HTMLForms.getField("birthday_color").enable(); } else { HTMLForms.getField("birthday_color").disable(); }')))); $user_born_field = ExtendedFieldsCache::load()->get_extended_field_by_field_name('user_born'); if (!empty($user_born_field) && !$user_born_field['display']) { $fieldset->add_field(new FormFieldHTML('user_born_disabled_msg', MessageHelper::display($this->lang['calendar.error.e_user_born_field_disabled'], MessageHelper::WARNING)->render())); } $fieldset->add_field(new FormFieldColorPicker('birthday_color', $this->lang['calendar.config.birthday_color'], $this->config->get_birthday_color(), array('hidden' => !$this->config->is_members_birthday_enabled()), array(new FormFieldConstraintRegex('`^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$`i')))); $common_lang = LangLoader::get('common'); $fieldset = new FormFieldsetHTML('authorizations_fieldset', $common_lang['authorizations'], array('description' => LangLoader::get_message('config.authorizations.explain', 'admin-common'))); $form->add_fieldset($fieldset); $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($common_lang['authorizations.read'], Category::READ_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.write'], Category::WRITE_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.contribution'], Category::CONTRIBUTION_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.moderation'], Category::MODERATION_AUTHORIZATIONS))); $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings); $auth_settings->build_from_auth_array($this->config->get_authorizations()); $fieldset->add_field($auth_setter); //Submit and reset buttons $this->submit_button = new FormButtonDefaultSubmit(); $form->add_button($this->submit_button); $form->add_button(new FormButtonReset()); $this->form = $form; }
private function update_fields(HTTPRequestCustom $request) { if ($request->get_value('submit', false)) { $this->update_position($request); $this->view->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.position.update', 'status-messages-common'), MessageHelper::SUCCESS, 5)); } }
public function execute(HTTPRequestCustom $request) { $this->load_lang(); $this->load_config(); $theme = $request->get_value('theme', 'all'); if ($theme !== 'all' && !ThemesManager::get_theme_existed($theme)) { AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface()); } $this->build_form($theme); $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #'); $tpl->add_lang($this->lang); if ($this->submit_button->has_been_submited() && $this->form->validate()) { $header_logo = $this->form->get_value('header_logo', null); if ($header_logo !== null) { $file_type = new FileType(new File($header_logo->get_name())); if ($file_type->is_picture()) { $this->save($header_logo, $theme); AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface()); } else { $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4)); } } elseif ($this->form->get_value('use_default_logo')) { $this->delete_pictures_saved($theme); AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface()); } else { $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4)); } } $tpl->put('FORM', $this->form->display()); return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.interface']); }
private function build_table() { $table_model = new SQLHTMLTableModel(DownloadSetup::$download_table, 'table', array(new HTMLTableColumn(LangLoader::get_message('form.name', 'common'), 'name'), new HTMLTableColumn(LangLoader::get_message('category', 'categories-common'), 'id_category'), new HTMLTableColumn(LangLoader::get_message('author', 'common'), 'display_name'), new HTMLTableColumn(LangLoader::get_message('form.date.creation', 'common'), 'creation_date'), new HTMLTableColumn(LangLoader::get_message('status', 'common'), 'approbation_type'), new HTMLTableColumn('')), new HTMLTableSortingRule('creation_date', HTMLTableSortingRule::DESC)); $table = new HTMLTable($table_model); $table_model->set_caption($this->lang['download.management']); $results = array(); $result = $table_model->get_sql_results('download LEFT JOIN ' . DB_TABLE_COMMENTS_TOPIC . ' com ON com.id_in_module = download.id AND com.module_id = \'download\' LEFT JOIN ' . DB_TABLE_AVERAGE_NOTES . ' notes ON notes.id_in_module = download.id AND notes.module_name = \'download\' LEFT JOIN ' . DB_TABLE_NOTE . ' note ON note.id_in_module = download.id AND note.module_name = \'download\' AND note.user_id = ' . AppContext::get_current_user()->get_id() . ' LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = download.author_user_id', array('*', 'download.id')); foreach ($result as $row) { $downloadfile = new DownloadFile(); $downloadfile->set_properties($row); $category = $downloadfile->get_category(); $user = $downloadfile->get_author_user(); $edit_link = new LinkHTMLElement(DownloadUrlBuilder::edit($downloadfile->get_id()), '', array('title' => LangLoader::get_message('edit', 'common')), 'fa fa-edit'); $delete_link = new LinkHTMLElement(DownloadUrlBuilder::delete($downloadfile->get_id()), '', array('title' => LangLoader::get_message('delete', 'common'), 'data-confirmation' => 'delete-element'), 'fa fa-delete'); $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true); $author = $user->get_id() !== User::VISITOR_LEVEL ? new LinkHTMLElement(UserUrlBuilder::profile($user->get_id()), $user->get_display_name(), !empty($user_group_color) ? array('style' => 'color: ' . $user_group_color) : array(), UserService::get_level_class($user->get_level())) : $user->get_display_name(); $results[] = new HTMLTableRow(array(new HTMLTableRowCell(new LinkHTMLElement(DownloadUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $downloadfile->get_id(), $downloadfile->get_rewrited_name()), $downloadfile->get_name()), 'left'), new HTMLTableRowCell(new LinkHTMLElement(DownloadUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name()), $category->get_name())), new HTMLTableRowCell($author), new HTMLTableRowCell($downloadfile->get_creation_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)), new HTMLTableRowCell($downloadfile->get_status()), new HTMLTableRowCell($edit_link->display() . $delete_link->display()))); } $table->set_rows($table_model->get_number_of_matching_rows(), $results); $this->view->put('table', $table->display()); }
private function build_form(HTTPRequestCustom $request) { $security_config = SecurityConfig::load(); $form = new HTMLForm(__CLASS__); $fieldset = new FormFieldsetHTML('add_member', LangLoader::get_message('members.add-member', 'admin-user-common')); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldTextEditor('display_name', $this->lang['display_name'], '', array('maxlength' => 100, 'required' => true, '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('custom_login', $this->lang['login.custom'], false, array('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('required' => true, 'hidden' => true, 'maxlength' => 25), array(new FormFieldConstraintLengthRange(3, 25), new FormFieldConstraintPHPBoostAuthLoginExists()))); $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['password'], '', array('required' => true), 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), 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)); } $fieldset->add_field(new FormFieldRanksSelect('rank', $this->lang['rank'], FormFieldRanksSelect::MEMBER)); $fieldset->add_field(new FormFieldHidden('referrer', $request->get_url_referrer())); $this->submit_button = new FormButtonDefaultSubmit(); $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis)); $form->add_button($this->submit_button); $form->add_button(new FormButtonReset()); $this->form = $form; }
public function __construct() { parent::__construct(); $this->lang = LangLoader::get('admin-user-common'); $this->set_disable_fields_configuration(array('possible_values')); $this->set_name(LangLoader::get_message('type.short-text', 'admin-user-common')); }
private function build_form() { $security_config = SecurityConfig::load(); $this->form = new HTMLForm('adminForm', '', false); $fieldset = new FormFieldsetHTML('adminAccount', $this->lang['admin.account']); $this->form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldTextEditor('display_name', LangLoader::get_message('display_name', 'user-common'), '', array('maxlength' => 100, 'required' => true, '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, $this->lang['admin.login.length'])))); $fieldset->add_field(new FormFieldMailEditor('email', $this->lang['admin.email'], '', array('required' => true))); $fieldset->add_field(new FormFieldCheckbox('custom_login', LangLoader::get_message('login.custom', 'user-common'), false, array('description' => LangLoader::get_message('login.custom.explain', 'user-common'), 'events' => array('click' => ' if (HTMLForms.getField("custom_login").getValue()) { HTMLForms.getField("login").enable(); } else { HTMLForms.getField("login").disable(); }')))); $fieldset->add_field(new FormFieldTextEditor('login', LangLoader::get_message('login', 'user-common'), '', array('required' => true, 'hidden' => true, 'maxlength' => 25), array(new FormFieldConstraintLengthRange(3, 25), new FormFieldConstraintPHPBoostAuthLoginExists()))); $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['admin.password'], '', array('description' => StringVars::replace_vars($this->lang['admin.password.explanation'], array('number' => $security_config->get_internal_password_min_length())), 'required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length(), StringVars::replace_vars($this->lang['admin.password.length'], array('number' => $security_config->get_internal_password_min_length()))), new FormFieldConstraintPasswordStrength()))); $fieldset->add_field($repeatPassword = new FormFieldPasswordEditor('repeatPassword', $this->lang['admin.password.repeat'], '', array('required' => true), array(new FormFieldConstraintLengthMin($security_config->get_internal_password_min_length()), new FormFieldConstraintPasswordStrength()))); $this->form->add_constraint(new FormConstraintFieldsEquality($password, $repeatPassword)); $fieldset->add_field(new FormFieldCheckbox('createSession', $this->lang['admin.connectAfterInstall'], true)); $fieldset->add_field(new FormFieldCheckbox('autoconnect', $this->lang['admin.autoconnect'], true)); $action_fieldset = new FormFieldsetSubmit('actions'); $back = new FormButtonLinkCssImg($this->lang['step.previous'], InstallUrlBuilder::website(), 'fa fa-arrow-left'); $action_fieldset->add_element($back); $this->submit_button = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'admin'); $action_fieldset->add_element($this->submit_button); $this->form->add_fieldset($action_fieldset); }
/** * @desc This function displayed fields profile * @param object $member_extended_field MemberExtendedField containing user_id, Template and field_type. */ public static function display_profile_fields(HTMLForm $form, $user_id) { $extended_fields_displayed = PersistenceContext::get_querier()->row_exists(DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST, 'WHERE display=1'); if ($extended_fields_displayed) { $fieldset = new FormFieldsetHTML('other', LangLoader::get_message('other', 'main')); $nbr_field = 0; $result = PersistenceContext::get_querier()->select("SELECT exc.name, exc.description, exc.field_type, exc.required, exc.field_name, exc.possible_values, exc.default_value, exc.auth, exc.regex, ex.*\r\n\t\t\tFROM " . DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST . " exc\r\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER_EXTENDED_FIELDS . " ex ON ex.user_id = :user_id\r\n\t\t\tWHERE exc.display = 1\r\n\t\t\tORDER BY exc.position", array('user_id' => $user_id)); while ($extended_field = $result->fetch()) { if (AppContext::get_current_user()->check_auth(unserialize($extended_field['auth']), ExtendedField::READ_PROFILE_AUTHORIZATION)) { $value = !empty($extended_field[$extended_field['field_name']]) ? $extended_field[$extended_field['field_name']] : $extended_field['default_value']; $extended_field['value'] = $value; $member_extended_field = new MemberExtendedField(); $member_extended_field->set_user_id($user_id); $member_extended_field->set_fieldset($fieldset); $member_extended_field->set_properties($extended_field); $member_extended_field->get_instance()->display_field_profile($member_extended_field); $nbr_field++; } } if ($nbr_field > 0) { $form->add_fieldset($fieldset); } $result->dispose(); } }
private function build_table() { $table_model = new SQLHTMLTableModel(CalendarSetup::$calendar_events_table, 'table', array(new HTMLTableColumn(LangLoader::get_message('form.title', 'common'), 'title'), new HTMLTableColumn(LangLoader::get_message('category', 'categories-common'), 'id_category'), new HTMLTableColumn(LangLoader::get_message('author', 'common'), 'display_name'), new HTMLTableColumn(LangLoader::get_message('date', 'date-common'), 'start_date'), new HTMLTableColumn($this->lang['calendar.titles.repetition']), new HTMLTableColumn(LangLoader::get_message('status.approved', 'common'), 'approved'), new HTMLTableColumn('')), new HTMLTableSortingRule('start_date', HTMLTableSortingRule::DESC)); $table = new HTMLTable($table_model); $table_model->set_caption($this->lang['calendar.config.events.management']); $table_model->add_permanent_filter('parent_id = 0'); $results = array(); $result = $table_model->get_sql_results('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'); foreach ($result as $row) { $event = new CalendarEvent(); $event->set_properties($row); $category = $event->get_content()->get_category(); $user = $event->get_content()->get_author_user(); $edit_link = new LinkHTMLElement(CalendarUrlBuilder::edit_event(!$event->get_parent_id() ? $event->get_id() : $event->get_parent_id()), '', array('title' => LangLoader::get_message('edit', 'common')), 'fa fa-edit'); $delete_link = new LinkHTMLElement(CalendarUrlBuilder::delete_event($event->get_id()), '', array('title' => LangLoader::get_message('delete', 'common'), 'data-confirmation' => !$event->belongs_to_a_serie() ? 'delete-element' : ''), 'fa fa-delete'); $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true); $author = $user->get_id() !== User::VISITOR_LEVEL ? new LinkHTMLElement(UserUrlBuilder::profile($user->get_id()), $user->get_display_name(), !empty($user_group_color) ? array('style' => 'color: ' . $user_group_color) : array(), UserService::get_level_class($user->get_level())) : $user->get_display_name(); $br = new BrHTMLElement(); $results[] = new HTMLTableRow(array(new HTMLTableRowCell(new LinkHTMLElement(CalendarUrlBuilder::display_event($category->get_id(), $category->get_rewrited_name(), $event->get_id(), $event->get_content()->get_rewrited_title()), $event->get_content()->get_title()), 'left'), new HTMLTableRowCell(new SpanHTMLElement($category->get_name(), array('style' => $category->get_id() != Category::ROOT_CATEGORY && $category->get_color() ? 'color:' . $category->get_color() : ''))), new HTMLTableRowCell($author), new HTMLTableRowCell(LangLoader::get_message('from_date', 'main') . ' ' . $event->get_start_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . $br->display() . LangLoader::get_message('to_date', 'main') . ' ' . $event->get_end_date()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)), new HTMLTableRowCell($event->belongs_to_a_serie() ? $this->lang['calendar.labels.repeat.' . $event->get_content()->get_repeat_type()] . ' - ' . $event->get_content()->get_repeat_number() . ' ' . $this->lang['calendar.labels.repeat_times'] : LangLoader::get_message('no', 'common')), new HTMLTableRowCell($event->get_content()->is_approved() ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common')), new HTMLTableRowCell($edit_link->display() . $delete_link->display()))); } $table->set_rows($table_model->get_number_of_matching_rows(), $results); $this->view->put('table', $table->display()); }
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; }
public function __construct($error_message = '') { if (empty($error_message)) { $error_message = LangLoader::get_message('constraint.wp-path', 'common', 'wpimport'); } $this->set_validation_error_message($error_message); }
public function __construct($error_message = '') { if (empty($error_message)) { $error_message = LangLoader::get_message('form.has_to_be_filled', 'status-messages-common'); } $this->error_message = $error_message; }
public function __construct($title, $message, $error_type = self::QUESTION) { $this->title = $title; $this->message = $message; $this->error_type = $error_type; $this->link_name = LangLoader::get_message('back', 'main'); }
private function build_form() { $form = new HTMLForm(__CLASS__); $fieldset = new FormFieldsetHTML('language-config', $this->lang['content.config.language']); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldEditors('formatting_language', $this->lang['content.config.default-formatting-language'], $this->content_formatting_config->get_default_editor(), array('description' => $this->lang['content.config.default-formatting-language-explain']))); $fieldset->add_field(new FormFieldMultipleSelectChoice('forbidden_tags', $this->lang['comments.config.forbidden-tags'], $this->content_formatting_config->get_forbidden_tags(), $this->generate_forbidden_tags_option(), array('size' => 10))); $fieldset = new FormFieldsetHTML('html-language-config', $this->lang['content.config.html-language']); $form->add_fieldset($fieldset); $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($this->lang['content.config.html-language-use-authorization'], self::HTML_USAGE_AUTHORIZATIONS, $this->lang['content.config.html-language-use-authorization-explain']))); $auth_settings->build_from_auth_array($this->content_formatting_config->get_html_tag_auth()); $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings); $fieldset->add_field($auth_setter); $fieldset = new FormFieldsetHTML('post-management', $this->lang['content.config.post-management']); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldNumberEditor('max_pm_number', $this->lang['content.config.max-pm-number'], $this->user_accounts_config->get_max_private_messages_number(), array('required' => true, 'description' => $this->lang['content.config.max-pm-number-explain']), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common'))))); $fieldset->add_field(new FormFieldCheckbox('anti_flood_enabled', $this->lang['content.config.anti-flood-enabled'], $this->content_management_config->is_anti_flood_enabled(), array('description' => $this->lang['content.config.anti-flood-enabled-explain']))); $fieldset->add_field(new FormFieldNumberEditor('delay_flood', $this->lang['content.config.delay-flood'], $this->content_management_config->get_anti_flood_duration(), array('required' => true, 'description' => $this->lang['content.config.delay-flood-explain']), array(new FormFieldConstraintRegex('`^([0-9]+)$`i', '', LangLoader::get_message('form.doesnt_match_number_regex', 'status-messages-common'))))); $fieldset = new FormFieldsetHTML('captcha', $this->lang['content.config.captcha']); $form->add_fieldset($fieldset); $fieldset->add_field(new FormFieldSimpleSelectChoice('captcha_used', $this->lang['content.config.captcha-used'], $this->content_management_config->get_used_captcha_module(), $this->generate_captcha_available_option(), array('description' => $this->lang['content.config.captcha-used-explain']))); $this->submit_button = new FormButtonDefaultSubmit(); $form->add_button($this->submit_button); $form->add_button(new FormButtonReset()); $this->form = $form; }
public function __construct($value = '') { $this->value = $value; if (empty($value)) { $this->value = LangLoader::get_message('reset', 'main'); } }
public function __construct() { $error = LangLoader::get_message('error', 'status-messages-common'); $unexist_page = LangLoader::get_message('error.page.forbidden', 'status-messages-common'); $message = '<strong>403.</strong> ' . $unexist_page; parent::__construct($error . ' 403', $message, self::WARNING); }
public function execute(HTTPRequestCustom $request) { AppContext::get_session()->csrf_get_protect(); $config = BugtrackerConfig::load(); $parameter = $request->get_string('parameter', ''); if (in_array($parameter, array('type', 'category', 'severity', 'priority', 'version'))) { switch ($parameter) { case 'type': $config->set_default_type(0); break; case 'category': $config->set_default_category(0); break; case 'severity': $config->set_default_severity(0); break; case 'priority': $config->set_default_priority(0); break; case 'version': $config->set_default_version(0); break; } BugtrackerConfig::save(); AppContext::get_response()->redirect(BugtrackerUrlBuilder::configuration()); } else { $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('error.e_unexist_parameter', 'common', 'bugtracker')); $controller->set_response_classname(UserErrorController::ADMIN_RESPONSE); DispatchManager::redirect($controller); } }
private function build_form($user_id) { $form = new HTMLForm('member-view-profile', '', false); $fieldset = new FormFieldsetHTML('profile', $this->lang['profile']); $form->add_fieldset($fieldset); if (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) { $link_edit = '<a href="' . UserUrlBuilder::edit_profile($user_id)->rel() . '" title="' . $this->lang['profile.edit'] . '" class="fa fa-edit"></a>'; $fieldset->add_field(new FormFieldFree('profile_edit', $this->lang['profile.edit'], $link_edit)); } $fieldset->add_field(new FormFieldFree('display_name', $this->lang['display_name'], $this->user_infos['display_name'])); $fieldset->add_field(new FormFieldFree('level', $this->lang['level'], '<a class="' . UserService::get_level_class($this->user_infos['level']) . '">' . $this->get_level_lang() . '</a>')); $fieldset->add_field(new FormFieldFree('groups', $this->lang['groups'], $this->build_groups($this->user_infos['groups']))); $registration_date = new Date($this->user_infos['registration_date']); $fieldset->add_field(new FormFieldFree('registered_on', $this->lang['registration_date'], $registration_date ? $registration_date->format(Date::FORMAT_DAY_MONTH_YEAR) : '')); $fieldset->add_field(new FormFieldFree('nbr_msg', $this->lang['number-messages'], $this->user_infos['posted_msg'] . '<br>' . '<a href="' . UserUrlBuilder::messages($user_id)->rel() . '">' . $this->lang['messages'] . '</a>')); $last_connection_date = !empty($this->user_infos['last_connection_date']) ? Date::to_format($this->user_infos['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main'); $fieldset->add_field(new FormFieldFree('last_connect', $this->lang['last_connection'], $last_connection_date)); if (AppContext::get_current_user()->check_auth(UserAccountsConfig::load()->get_auth_read_members(), UserAccountsConfig::AUTH_READ_MEMBERS_BIT) && $this->user_infos['show_email']) { $link_email = '<a href="mailto:' . $this->user_infos['email'] . '" class="basic-button smaller">Mail</a>'; $fieldset->add_field(new FormFieldFree('email', $this->lang['email'], $link_email)); } if (!$this->same_user_view_profile($user_id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) { $link_mp = '<a href="' . UserUrlBuilder::personnal_message($user_id)->rel() . '" class="basic-button smaller">MP</a>'; $fieldset->add_field(new FormFieldFree('private_message', $this->lang['private_message'], $link_mp)); } MemberExtendedFieldsService::display_profile_fields($form, $user_id); $this->form = $form; }
public function execute(HTTPRequestCustom $request) { $id = $request->get_getint('id', 0); if (!empty($id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) { try { $this->downloadfile = DownloadService::get_downloadfile('WHERE download.id = :id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } if ($this->downloadfile !== null && $this->downloadfile->is_visible()) { if (!PersistenceContext::get_querier()->row_exists(PREFIX . 'events', 'WHERE id_in_module=:id_in_module AND module=\'download\' AND current_status = 0', array('id_in_module' => $this->downloadfile->get_id()))) { $contribution = new Contribution(); $contribution->set_id_in_module($this->downloadfile->get_id()); $contribution->set_entitled(StringVars::replace_vars(LangLoader::get_message('contribution.deadlink', 'common'), array('link_name' => $this->downloadfile->get_name()))); $contribution->set_fixing_url(DownloadUrlBuilder::edit($this->downloadfile->get_id())->relative()); $contribution->set_description(LangLoader::get_message('contribution.deadlink_explain', 'common')); $contribution->set_poster_id(AppContext::get_current_user()->get_id()); $contribution->set_module('download'); $contribution->set_type('alert'); $contribution->set_auth(Authorizations::capture_and_shift_bit_auth(DownloadService::get_categories_manager()->get_heritated_authorizations($this->downloadfile->get_id_category(), Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT)); ContributionService::save_contribution($contribution); } DispatchManager::redirect(new UserContributionSuccessController()); } else { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } }
public function execute(HTTPRequestCustom $request) { AppContext::get_session()->csrf_get_protect(); $question = $this->get_faq_question($request); $this->check_authorizations($question); $this->delete_question($question); AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : FaqUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('faq.message.success.delete', 'common', 'faq'), array('question' => $question->get_question()))); }
public function execute(HTTPRequestCustom $request) { AppContext::get_session()->csrf_get_protect(); $message = $this->get_message($request); $this->check_authorizations($message); ShoutboxService::delete('WHERE id=:id', array('id' => $message->get_id())); AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : ShoutboxUrlBuilder::home(), LangLoader::get_message('shoutbox.message.success.delete', 'common', 'shoutbox')); }
public function __construct($error_message = '') { if (empty($error_message)) { $error_message = LangLoader::get_message('user.not_exists', 'status-messages-common'); } $this->set_validation_error_message($error_message); $this->error_message = TextHelper::to_js_string($error_message); }
public function __construct($error_message = '') { if (empty($error_message)) { $error_message = LangLoader::get_message('form.doesnt_match_picture_file_regex', 'status-messages-common'); } $this->set_validation_error_message($error_message); parent::__construct(self::$regex, self::$regex, $error_message); }
public function __construct() { parent::__construct(); $this->set_disable_fields_configuration(array('field_required', 'regex', 'possible_values', 'default_value')); $this->set_name(LangLoader::get_message('type.user_pmtomail', 'admin-user-common')); $this->field_used_once = true; $this->field_used_phpboost_config = true; }
public function __construct() { $this->set_id(self::ROOT_CATEGORY); $this->set_id_parent(self::ROOT_CATEGORY); $this->set_name(LangLoader::get_message('root', 'main')); $this->set_rewrited_name('root'); $this->set_order(0); }