示例#1
0
 public static function replace_vars($string, array $parameters, $strict = false)
 {
     if (empty($parameters)) {
         return $string;
     }
     $string_var = new StringVars($strict);
     return $string_var->replace($string, $parameters);
 }
 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);
     }
 }
    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);
    }
示例#4
0
 public function i18nraw($key, $parameters)
 {
     if (!empty($parameters)) {
         StringVars::replace_vars($this->messages[$key], $parameters);
     }
     return $this->messages[$key];
 }
 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 execute(HTTPRequestCustom $request)
    {
        $id = $request->get_getint('id');
        $this->init();
        $extended_field = new ExtendedField();
        $extended_field->set_id($id);
        $exist_field = ExtendedFieldsDatabaseService::check_field_exist_by_id($extended_field);
        if ($exist_field) {
            $this->extended_field = ExtendedFieldsCache::load()->get_extended_field($id);
            $this->build_form($request);
        } else {
            $error_controller = PHPBoostErrors::unexisting_page();
            DispatchManager::redirect($error_controller);
        }
        $this->tpl = new StringTemplate('# INCLUDE MSG #
				# INCLUDE FORM #
				<script>
				jQuery(document).ready(function() {
				' . $this->get_events_select_type() . '});
				</script>');
        $this->tpl->add_lang($this->lang);
        $this->tpl->put_all(array('FIELD_TYPE' => $this->extended_field['field_type']));
        if ($this->submit_button->has_been_submited() && $this->form->validate()) {
            $extended_field = $this->save($id);
            $error = ExtendedFieldsService::get_error();
            if (!empty($error)) {
                $this->tpl->put('MSG', MessageHelper::display($error, MessageHelper::ERROR, 5));
            } else {
                AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : AdminExtendedFieldsUrlBuilder::fields_list(), StringVars::replace_vars($this->lang['message.success.edit'], array('name' => $extended_field->get_name())));
            }
        }
        $this->tpl->put('FORM', $this->form->display());
        return new AdminExtendedFieldsDisplayResponse($this->tpl, $this->lang['extended-field-edit']);
    }
    public function execute(HTTPRequestCustom $request)
    {
        $this->init();
        $this->build_form();
        $this->tpl = new StringTemplate('
				# INCLUDE MSG #
				# INCLUDE FORM #
				<script>
				<!--
					jQuery(document).ready(function() {
						' . $this->get_events_select_type() . '
					});
				-->
				</script>');
        $this->tpl->add_lang($this->lang);
        if ($this->submit_button->has_been_submited() && $this->form->validate()) {
            $extended_field = $this->save();
            $error = ExtendedFieldsService::get_error();
            if (!empty($error)) {
                $this->tpl->put('MSG', MessageHelper::display($error, MessageHelper::ERROR, 5));
            } else {
                AppContext::get_response()->redirect(AdminExtendedFieldsUrlBuilder::fields_list(), StringVars::replace_vars($this->lang['message.success.add'], array('name' => $extended_field->get_name())));
            }
        }
        $this->tpl->put('FORM', $this->form->display());
        return new AdminExtendedFieldsDisplayResponse($this->tpl, $this->lang['extended-field-add']);
    }
 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;
     }
 }
 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 __construct($upper_bound, $js_message = '')
 {
     if (empty($js_message)) {
         $js_message = LangLoader::get_message('form.doesnt_match_integer_max', 'status-messages-common');
     }
     $this->error_message = StringVars::replace_vars($js_message, array('upper_bound' => $upper_bound));
     $this->set_validation_error_message($this->error_message);
     $this->upper_bound = $upper_bound;
 }
    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;
    }
 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));
 }
 private function build_form()
 {
     $security_config = SecurityConfig::load();
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('fieldset', $this->lang['change-password']);
     $form->add_fieldset($fieldset);
     $fieldset->add_field($password = new FormFieldPasswordEditor('password', $this->lang['password.new'], '', 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())));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_constraint(new FormConstraintFieldsEquality($password, $password_bis));
     $this->form = $form;
 }
 public function execute(HTTPRequestCustom $request)
 {
     AppContext::get_session()->csrf_get_protect();
     $this->init($request);
     $this->check_authorizations();
     $this->build_form($request);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : BugtrackerUrlBuilder::unsolved(), StringVars::replace_vars(LangLoader::get_message('success.delete', 'common', 'bugtracker'), array('id' => $this->bug->get_id())));
     }
     $this->view->put('FORM', $this->form->display());
     return $this->build_response($this->view);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form($request);
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $display_name = $this->save();
         AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : AdminMembersUrlBuilder::management(), StringVars::replace_vars($this->lang['user.message.success.add'], array('name' => $display_name)));
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminMembersDisplayResponse($tpl, LangLoader::get_message('members.add-member', 'admin-user-common'));
 }
 /**
  * @desc Send a PM to a member.
  * @param string $pm_type Type of PM ('assigned', 'comment', 'pending', 'in_progress', 'delete', 'edit', 'fixed', 'rejected', 'reopen')
  * @param int $recipient_id ID of the PM's recipient
  * @param int $bug_id ID of the bug which is concerned
  * @param string $message (optional) Message to include in the PM
  */
 public static function send_PM($pm_type, $recipient_id, $bug_id, $message = '')
 {
     //Load module lang
     $lang = LangLoader::get('common', 'bugtracker');
     //Send the PM if the recipient is not a guest
     if ($recipient_id > 0) {
         //Get current user
         $current_user = AppContext::get_current_user();
         $author = $current_user->get_id() != User::VISITOR_LEVEL ? $current_user->get_display_name() : LangLoader::get_message('visitor', 'user-common');
         $pm_content = StringVars::replace_vars($lang['pm.' . $pm_type . '.contents'], array('author' => $author, 'id' => $bug_id)) . (!empty($message) ? $pm_type != 'edit' ? StringVars::replace_vars($lang['pm.with_comment'], array('comment' => $message)) : StringVars::replace_vars($lang['pm.edit_fields'], array('fields' => $message)) : '') . ($pm_type != 'delete' ? StringVars::replace_vars($lang['pm.bug_link'], array('link' => BugtrackerUrlBuilder::detail($bug_id)->relative())) : '');
         //Send the PM
         PrivateMsg::start_conversation($recipient_id, StringVars::replace_vars($lang['pm.' . $pm_type . '.title'], array('id' => $bug_id)), $pm_content, -1, PrivateMsg::SYSTEM_PM);
     }
 }
 public function execute(HTTPRequestCustom $request)
 {
     AppContext::get_session()->csrf_get_protect();
     $this->get_downloadfile($request);
     $this->check_authorizations();
     DownloadService::delete('WHERE id=:id', array('id' => $this->downloadfile->get_id()));
     DownloadService::get_keywords_manager()->delete_relations($this->downloadfile->get_id());
     PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'download', 'id' => $this->downloadfile->get_id()));
     CommentsService::delete_comments_topic_module('download', $this->downloadfile->get_id());
     NotationService::delete_notes_id_in_module('download', $this->downloadfile->get_id());
     Feed::clear_cache('download');
     DownloadCache::invalidate();
     AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : DownloadUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('download.message.success.delete', 'common', 'download'), array('name' => $this->downloadfile->get_name())));
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->test = str_repeat($this->test, 1);
     $bench_non_cached = new Bench();
     $bench_non_cached->start();
     $this->run_non_cached_parsing();
     $bench_non_cached->stop();
     $bench_cached = new Bench();
     $bench_cached->start();
     $this->run_cached_parsing();
     $bench_cached->stop();
     $this->view->put_all(array('RESULT' => StringVars::replace_vars($this->lang['string_template.result'], array('non_cached_time' => $bench_non_cached->to_string(5), 'cached_time' => $bench_cached->to_string(5), 'string_length' => strlen($this->test)))));
     return $this->generate_response();
 }
    private function build_view(HTTPRequestCustom $request)
    {
        $db_querier = PersistenceContext::get_querier();
        $date_lang = LangLoader::get('date-common');
        $events_list = $participants = array();
        $config = CalendarConfig::load();
        $year = $this->year ? $this->year : $request->get_int('calendar_ajax_year', date('Y'));
        $month = $this->month ? $this->month : $request->get_int('calendar_ajax_month', date('n'));
        $day = $this->day ? $this->day : $request->get_int('calendar_ajax_day', 1);
        $array_l_month = array($date_lang['january'], $date_lang['february'], $date_lang['march'], $date_lang['april'], $date_lang['may'], $date_lang['june'], $date_lang['july'], $date_lang['august'], $date_lang['september'], $date_lang['october'], $date_lang['november'], $date_lang['december']);
        $result = $db_querier->select("SELECT *\n\t\tFROM " . CalendarSetup::$calendar_events_table . " event\n\t\tLEFT JOIN " . CalendarSetup::$calendar_events_content_table . " event_content ON event_content.id = event.content_id\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " member ON member.user_id = event_content.author_id\n\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON com.id_in_module = event.id_event AND com.module_id = 'calendar'\n\t\tWHERE approved = 1\n\t\tAND ((start_date BETWEEN :first_day_hour AND :last_day_hour) OR (end_date BETWEEN :first_day_hour AND :last_day_hour) OR (:first_day_hour BETWEEN start_date AND end_date))\n\t\tORDER BY start_date ASC", array('first_day_hour' => mktime(0, 0, 0, $month, $day, $year), 'last_day_hour' => mktime(23, 59, 59, $month, $day, $year)));
        while ($row = $result->fetch()) {
            $event = new CalendarEvent();
            $event->set_properties($row);
            $events_list[$event->get_id()] = $event;
        }
        $result->dispose();
        $events_number = $result->get_rows_count();
        $this->view->put_all(array('C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_EVENTS' => $events_number > 0, 'DATE' => $day . ' ' . $array_l_month[$month - 1] . ' ' . $year, 'L_EVENTS_NUMBER' => $events_number > 1 ? StringVars::replace_vars($this->lang['calendar.labels.events_number'], array('events_number' => $events_number)) : $this->lang['calendar.labels.one_event']));
        if (!empty($events_list)) {
            $result = $db_querier->select('SELECT event_id, member.user_id, display_name, level, groups
			FROM ' . CalendarSetup::$calendar_users_relation_table . ' participants
			LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = participants.user_id
			WHERE event_id IN :events_list', array('events_list' => array_keys($events_list)));
            while ($row = $result->fetch()) {
                if (!empty($row['display_name'])) {
                    $participant = new CalendarEventParticipant();
                    $participant->set_properties($row);
                    $participants[$row['event_id']][$participant->get_user_id()] = $participant;
                }
            }
            $result->dispose();
            foreach ($events_list as $event) {
                if (isset($participants[$event->get_id()])) {
                    $event->set_participants($participants[$event->get_id()]);
                }
                $this->view->assign_block_vars('event', $event->get_array_tpl_vars());
                $participants_number = count($event->get_participants());
                $i = 0;
                foreach ($event->get_participants() as $participant) {
                    $i++;
                    $this->view->assign_block_vars('event.participant', array_merge($participant->get_array_tpl_vars(), array('C_LAST_PARTICIPANT' => $i == $participants_number)));
                }
            }
        }
    }
 public function execute(HTTPRequestCustom $request)
 {
     $user_id = $request->get_int('id', null);
     $user = UserService::get_user($user_id);
     if (!$user->is_admin() || $user->is_admin() && UserService::count_admin_members() > 1) {
         try {
             UserService::delete_by_id($user_id);
         } catch (RowNotFoundException $ex) {
             $error_controller = PHPBoostErrors::unexisting_element();
             DispatchManager::redirect($error_controller);
         }
         AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : AdminMembersUrlBuilder::management(), StringVars::replace_vars(LangLoader::get_message('user.message.success.delete', 'user-common'), array('name' => $user->get_display_name())));
     } else {
         $error_controller = PHPBoostErrors::unauthorized_action();
         DispatchManager::redirect($error_controller);
     }
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     $this->build_form($request);
     $tpl = new StringTemplate('# INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->set_properties();
         $this->save();
         if ($this->is_new_category) {
             AppContext::get_response()->redirect($this->get_categories_management_url(), StringVars::replace_vars($this->get_success_message(), array('name' => $this->get_category()->get_name())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : $this->get_categories_management_url(), StringVars::replace_vars($this->get_success_message(), array('name' => $this->get_category()->get_name())));
         }
     }
     $tpl->put('FORM', $this->form->display());
     return $this->generate_response($tpl);
 }
 public function execute(HTTPRequestCustom $request)
 {
     AppContext::get_session()->csrf_get_protect();
     $news = $this->get_news($request);
     if (!$news->is_authorized_to_delete()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($controller);
     }
     NewsService::delete('WHERE id=:id', array('id' => $news->get_id()));
     NewsService::get_keywords_manager()->delete_relations($news->get_id());
     PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'news', 'id' => $news->get_id()));
     CommentsService::delete_comments_topic_module('news', $news->get_id());
     Feed::clear_cache('news');
     AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : NewsUrlBuilder::home(), StringVars::replace_vars(LangLoader::get_message('news.message.success.delete', 'common', 'news'), array('name' => $news->get_name())));
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init($request);
     $this->build_form($request);
     $this->tpl = new FileTemplate('contact/AdminContactFieldFormController.tpl');
     $this->tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         if ($this->is_new_field) {
             AppContext::get_response()->redirect(ContactUrlBuilder::manage_fields(), StringVars::replace_vars($this->lang['message.success.add'], array('name' => $this->get_field()->get_name())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : ContactUrlBuilder::manage_fields(), StringVars::replace_vars($this->lang['message.success.edit'], array('name' => $this->get_field()->get_name())));
         }
     }
     $this->tpl->put('FORM', $this->form->display());
     if (!$this->get_field()->is_readonly()) {
         $this->tpl->put('JS_EVENT_SELECT_TYPE', $this->get_events_select_type());
     }
     return new AdminContactDisplayResponse($this->tpl, !empty($this->id) ? $this->lang['admin.fields.title.edit_field.page_title'] : $this->lang['admin.fields.title.add_field.page_title']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init();
     try {
         $category = $this->get_category();
     } catch (CategoryNotFoundException $e) {
         $controller = PHPBoostErrors::unexisting_page();
         DispatchManager::redirect($controller);
     }
     $childrens = $this->get_category_childrens($category);
     if (empty($childrens) && !$this->get_category_items_exists($category)) {
         $this->get_categories_manager()->delete($this->get_category()->get_id());
         AppContext::get_response()->redirect($this->get_categories_management_url(), StringVars::replace_vars($this->get_success_message(), array('name' => $this->get_category()->get_name())));
     }
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         if ($this->form->get_value('delete_category_and_content')) {
             $this->get_categories_manager()->delete($this->get_category()->get_id());
             foreach ($childrens as $id => $category) {
                 $this->get_categories_manager()->delete($id);
             }
         } else {
             $id_parent = $this->form->get_value('move_in_other_cat')->get_raw_value();
             $this->get_categories_manager()->move_items_into_another($category, $id_parent);
             $childrens = $this->get_category_childrens($category, false);
             foreach ($childrens as $id => $category) {
                 $this->get_categories_manager()->move_into_another($category, $id_parent);
             }
             $this->get_categories_manager()->delete($this->get_category()->get_id());
         }
         AppContext::get_response()->redirect($this->get_categories_management_url(), StringVars::replace_vars($this->get_success_message(), array('name' => $this->get_category()->get_name())));
     }
     $tpl->put('FORM', $this->form->display());
     return $this->generate_response($tpl);
 }
 private function redirect()
 {
     $downloadfile = $this->get_downloadfile();
     $category = $downloadfile->get_category();
     if ($this->is_new_downloadfile && $this->is_contributor_member() && !$downloadfile->is_visible()) {
         DispatchManager::redirect(new UserContributionSuccessController());
     } elseif ($downloadfile->is_visible()) {
         if ($this->is_new_downloadfile) {
             AppContext::get_response()->redirect(DownloadUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $downloadfile->get_id(), $downloadfile->get_rewrited_name()), StringVars::replace_vars($this->lang['download.message.success.add'], array('name' => $downloadfile->get_name())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : DownloadUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $downloadfile->get_id(), $downloadfile->get_rewrited_name()), StringVars::replace_vars($this->lang['download.message.success.edit'], array('name' => $downloadfile->get_name())));
         }
     } else {
         if ($this->is_new_downloadfile) {
             AppContext::get_response()->redirect(DownloadUrlBuilder::display_pending(), StringVars::replace_vars($this->lang['download.message.success.add'], array('name' => $downloadfile->get_name())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : DownloadUrlBuilder::display_pending(), StringVars::replace_vars($this->lang['download.message.success.edit'], array('name' => $downloadfile->get_name())));
         }
     }
 }
 private function redirect()
 {
     $article = $this->get_article();
     $category = $article->get_category();
     if ($this->is_new_article && $this->is_contributor_member() && !$article->is_published()) {
         DispatchManager::redirect(new UserContributionSuccessController());
     } elseif ($article->is_published()) {
         if ($this->is_new_article) {
             AppContext::get_response()->redirect(ArticlesUrlBuilder::display_article($category->get_id(), $category->get_rewrited_name(), $article->get_id(), $article->get_rewrited_title(), AppContext::get_request()->get_getint('page', 1)), StringVars::replace_vars($this->lang['articles.message.success.add'], array('title' => $article->get_title())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : ArticlesUrlBuilder::display_article($category->get_id(), $category->get_rewrited_name(), $article->get_id(), $article->get_rewrited_title(), AppContext::get_request()->get_getint('page', 1)), StringVars::replace_vars($this->lang['articles.message.success.edit'], array('title' => $article->get_title())));
         }
     } else {
         if ($this->is_new_article) {
             AppContext::get_response()->redirect(ArticlesUrlBuilder::display_pending_articles(), StringVars::replace_vars($this->lang['articles.message.success.add'], array('title' => $article->get_title())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : ArticlesUrlBuilder::display_pending_articles(), StringVars::replace_vars($this->lang['articles.message.success.edit'], array('title' => $article->get_title())));
         }
     }
 }
示例#27
0
 public function get_array_tpl_vars()
 {
     $lang = LangLoader::get('common', 'calendar');
     $category = $this->content->get_category();
     $author = $this->content->get_author_user();
     $author_group_color = User::get_group_color($author->get_groups(), $author->get_level(), true);
     $missing_participants_number = $this->content->get_max_registered_members() > 0 && $this->get_registered_members_number() < $this->content->get_max_registered_members() ? $this->content->get_max_registered_members() - $this->get_registered_members_number() : 0;
     $registration_days_left = $this->content->get_last_registration_date() && time() < $this->content->get_last_registration_date()->get_timestamp() ? (int) (($this->content->get_last_registration_date()->get_timestamp() - time()) / 3600 / 24) : 0;
     return array('C_APPROVED' => $this->content->is_approved(), 'C_EDIT' => $this->is_authorized_to_edit(), 'C_DELETE' => $this->is_authorized_to_delete(), 'C_LOCATION' => $this->content->get_location(), 'C_BELONGS_TO_A_SERIE' => $this->belongs_to_a_serie(), 'C_PARTICIPATION_ENABLED' => $this->content->is_registration_authorized(), 'C_DISPLAY_PARTICIPANTS' => $this->content->is_authorized_to_display_registered_users(), 'C_PARTICIPANTS' => !empty($this->participants), 'C_PARTICIPATE' => $this->content->is_registration_authorized() && $this->content->is_authorized_to_register() && time() < $this->start_date->get_timestamp() && (!$this->content->get_max_registered_members() || $this->content->get_max_registered_members() > 0 && $this->get_registered_members_number() < $this->content->get_max_registered_members()) && (!$this->content->get_last_registration_date() || $this->content->is_last_registration_date_enabled() && time() < $this->content->get_last_registration_date()->get_timestamp()) && !in_array(AppContext::get_current_user()->get_id(), array_keys($this->participants)), 'C_IS_PARTICIPANT' => in_array(AppContext::get_current_user()->get_id(), array_keys($this->participants)), 'C_REGISTRATION_CLOSED' => $this->content->is_last_registration_date_enabled() && $this->content->get_last_registration_date() && time() > $this->content->get_last_registration_date()->get_timestamp(), 'C_MAX_PARTICIPANTS_REACHED' => $this->content->get_max_registered_members() > 0 && $this->get_registered_members_number() == $this->content->get_max_registered_members(), 'C_MISSING_PARTICIPANTS' => !empty($missing_participants_number) && $missing_participants_number <= 5, 'C_REGISTRATION_DAYS_LEFT' => !empty($registration_days_left) && $registration_days_left <= 5, 'C_AUTHOR_GROUP_COLOR' => !empty($author_group_color), 'C_AUTHOR_EXIST' => $author->get_id() !== User::VISITOR_LEVEL, 'ID' => $this->id, 'CONTENT_ID' => $this->content->get_id(), 'TITLE' => $this->content->get_title(), 'CONTENTS' => FormatingHelper::second_parse($this->content->get_contents()), 'LOCATION' => $this->content->get_location(), 'START_DATE' => $this->start_date->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'START_DATE_DAY' => $this->start_date->get_day(), 'START_DATE_MONTH' => $this->start_date->get_month(), 'START_DATE_YEAR' => $this->start_date->get_year(), 'START_DATE_HOUR' => $this->start_date->get_hours(), 'START_DATE_MINUTE' => $this->start_date->get_minutes(), 'START_DATE_ISO8601' => $this->start_date->format(Date::FORMAT_ISO8601), 'END_DATE' => $this->end_date->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'END_DATE_DAY' => $this->end_date->get_day(), 'END_DATE_MONTH' => $this->end_date->get_month(), 'END_DATE_YEAR' => $this->end_date->get_year(), 'END_DATE_HOUR' => $this->end_date->get_hours(), 'END_DATE_MINUTE' => $this->end_date->get_minutes(), 'END_DATE_ISO8601' => $this->end_date->format(Date::FORMAT_ISO8601), 'NUMBER_COMMENTS' => CommentsService::get_number_comments('calendar', $this->id), 'L_COMMENTS' => CommentsService::get_number_and_lang_comments('calendar', $this->id), 'REPEAT_NUMBER' => $this->content->get_repeat_number(), 'AUTHOR' => $author->get_display_name(), 'AUTHOR_LEVEL_CLASS' => UserService::get_level_class($author->get_level()), 'AUTHOR_GROUP_COLOR' => $author_group_color, 'L_MISSING_PARTICIPANTS' => $missing_participants_number > 1 ? StringVars::replace_vars($lang['calendar.labels.remaining_places'], array('missing_number' => $missing_participants_number)) : $lang['calendar.labels.remaining_place'], 'L_REGISTRATION_DAYS_LEFT' => $registration_days_left > 1 ? StringVars::replace_vars($lang['calendar.labels.remaining_days'], array('days_left' => $registration_days_left)) : $lang['calendar.labels.remaining_day'], 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'CATEGORY_ID' => $category->get_id(), 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_COLOR' => $category->get_id() != Category::ROOT_CATEGORY ? $category->get_color() : '', 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? CalendarUrlBuilder::configuration()->rel() : CalendarUrlBuilder::edit_category($category->get_id())->rel(), 'U_SYNDICATION' => SyndicationUrlBuilder::rss('calendar', $category->get_id())->rel(), 'U_AUTHOR_PROFILE' => UserUrlBuilder::profile($author->get_id())->rel(), 'U_LINK' => CalendarUrlBuilder::display_event($category->get_id(), $category->get_rewrited_name(), $this->id, $this->content->get_rewrited_title())->rel(), 'U_EDIT' => CalendarUrlBuilder::edit_event(!$this->parent_id ? $this->id : $this->parent_id)->rel(), 'U_DELETE' => CalendarUrlBuilder::delete_event($this->id)->rel(), 'U_SUSCRIBE' => CalendarUrlBuilder::suscribe_event($this->id)->rel(), 'U_UNSUSCRIBE' => CalendarUrlBuilder::unsuscribe_event($this->id)->rel(), 'U_COMMENTS' => CalendarUrlBuilder::display_event_comments($category->get_id(), $category->get_rewrited_name(), $this->id, $this->content->get_rewrited_title())->rel());
 }
 for ($i = 1900; $i <= 2037; $i++) {
     $selected = $year == $i ? 'selected="selected"' : '';
     $tpl->assign_block_vars('year', array('YEAR' => '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>'));
 }
 //Premier jour du mois.
 $first_day = date('w', @mktime(1, 0, 0, $month, 1, $year));
 if ($first_day == 0) {
     $first_day = 7;
 }
 //Génération du calendrier.
 $month = $month < 10 && substr($month, 0, 1) != 0 ? '0' . $month : $month;
 $j = 1;
 $last_day = $month_day + $first_day;
 for ($i = 1; $i <= 42; $i++) {
     if ($i >= $first_day && $i < $last_day) {
         $date = StringVars::replace_vars(':year-:month-:day', array('year' => $year, 'month' => $month, 'day' => $j < 10 && substr($j, 0, 1) != 0 ? '0' . $j : $j));
         $class = '';
         if ($i % 7 == 6 || $i % 7 == 0) {
             $class = 'calendar-weekend';
         }
         if ($j == $selected_day && $month == $selected_month && $year == $selected_year) {
             $class = 'calendar-event';
         }
         $contents = $j;
         $j++;
     } else {
         $date = $contents = '';
         $class = 'calendar-none';
     }
     $tpl->assign_block_vars('day', array('DAY' => $contents, 'CLASS' => $class, 'CHANGE_LINE' => $i % 7 == 0 && $i != 42, 'INPUT_FIELD' => $input_field, 'DATE' => $date));
 }
示例#29
0
 public function get_array_tpl_vars()
 {
     $category = $this->get_category();
     $contents = FormatingHelper::second_parse($this->contents);
     $description = $this->get_real_short_contents();
     $user = $this->get_author_user();
     $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
     $number_comments = CommentsService::get_number_comments('download', $this->id);
     return array('C_VISIBLE' => $this->is_visible(), 'C_EDIT' => $this->is_authorized_to_edit(), 'C_DELETE' => $this->is_authorized_to_delete(), 'C_READ_MORE' => !$this->is_short_contents_enabled() && $description != $contents && strlen($description) >= DownloadConfig::NUMBER_CARACTERS_BEFORE_CUT, 'C_SIZE' => !empty($this->size), 'C_PICTURE' => $this->has_picture(), 'C_CUSTOM_AUTHOR_DISPLAY_NAME' => $this->is_author_display_name_enabled(), 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_UPDATED_DATE' => $this->has_updated_date(), 'ID' => $this->id, 'NAME' => $this->name, 'SIZE' => $this->formated_size, 'CONTENTS' => $contents, 'DESCRIPTION' => $description, 'DATE' => $this->creation_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'DATE_DAY' => $this->creation_date->get_day(), 'DATE_MONTH' => $this->creation_date->get_month(), 'DATE_YEAR' => $this->creation_date->get_year(), 'DATE_DAY_MONTH' => $this->creation_date->format(Date::FORMAT_DAY_MONTH), 'DATE_ISO8601' => $this->creation_date->format(Date::FORMAT_ISO8601), 'UPDATED_DATE' => $this->updated_date !== null ? $this->updated_date->format(Date::FORMAT_DAY_MONTH_YEAR) : '', 'UPDATED_DATE_ISO8601' => $this->updated_date !== null ? $this->updated_date->format(Date::FORMAT_ISO8601) : '', 'STATUS' => $this->get_status(), 'CUSTOM_AUTHOR_DISPLAY_NAME' => $this->author_display_name, 'C_AUTHOR_EXIST' => $user->get_id() !== User::VISITOR_LEVEL, 'PSEUDO' => $user->get_display_name(), 'USER_LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'USER_GROUP_COLOR' => $user_group_color, 'NUMBER_DOWNLOADS' => $this->number_downloads, 'L_DOWNLOADED_TIMES' => StringVars::replace_vars(LangLoader::get_message('downloaded_times', 'common', 'download'), array('number_downloads' => $this->number_downloads)), 'STATIC_NOTATION' => NotationService::display_static_image($this->get_notation()), 'NOTATION' => NotationService::display_active_image($this->get_notation()), 'C_COMMENTS' => !empty($number_comments), 'L_COMMENTS' => CommentsService::get_lang_comments('download', $this->id), 'NUMBER_COMMENTS' => CommentsService::get_number_comments('download', $this->id), 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'CATEGORY_ID' => $category->get_id(), 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_DESCRIPTION' => $category->get_description(), 'CATEGORY_IMAGE' => $category->get_image()->rel(), 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? DownloadUrlBuilder::configuration()->rel() : DownloadUrlBuilder::edit_category($category->get_id())->rel(), 'U_SYNDICATION' => SyndicationUrlBuilder::rss('download', $this->id_category)->rel(), 'U_AUTHOR_PROFILE' => UserUrlBuilder::profile($this->get_author_user()->get_id())->rel(), 'U_LINK' => DownloadUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel(), 'U_DOWNLOAD' => DownloadUrlBuilder::download($this->id)->rel(), 'U_DEADLINK' => DownloadUrlBuilder::dead_link($this->id)->rel(), 'U_CATEGORY' => DownloadUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name())->rel(), 'U_EDIT' => DownloadUrlBuilder::edit($this->id)->rel(), 'U_DELETE' => DownloadUrlBuilder::delete($this->id)->rel(), 'U_PICTURE' => $this->get_picture()->rel(), 'U_COMMENTS' => DownloadUrlBuilder::display_comments($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel());
 }
 public function get_validation_error_message()
 {
     return StringVars::replace_vars($this->js_message, array('field1' => $this->first_field->get_label(), 'field2' => $this->second_field->get_label()));
 }