Ejemplo n.º 1
0
 /**
  * Assign template variables.
  *
  * @param array $settings
  * @param array $error
  *
  * @return null
  */
 protected function assign_vars($settings, $error)
 {
     $this->display->assign_global_vars();
     $this->generate_navigation('manage');
     // Output the available license options
     foreach ($this->contrib->type->license_options as $option) {
         $this->template->assign_block_vars('license_options', array('NAME' => $option, 'VALUE' => $option));
     }
     // Display the list of phpBB versions available
     foreach ($this->vendor_versions as $version => $name) {
         $this->template->assign_block_vars('phpbb_versions', array('VERSION' => $name, 'S_SELECTED' => in_array($name, $settings['vendor_versions'])));
     }
     $status_list = array(TITANIA_REVISION_NEW => 'REVISION_NEW', TITANIA_REVISION_APPROVED => 'REVISION_APPROVED', TITANIA_REVISION_DENIED => 'REVISION_DENIED', TITANIA_REVISION_PULLED_SECURITY => 'REVISION_PULLED_FOR_SECURITY', TITANIA_REVISION_PULLED_OTHER => 'REVISION_PULLED_FOR_OTHER', TITANIA_REVISION_REPACKED => 'REVISION_REPACKED', TITANIA_REVISION_RESUBMITTED => 'REVISION_RESUBMITTED');
     // Display the status list
     foreach ($status_list as $status => $lang) {
         $this->template->assign_block_vars('status_select', array('S_SELECTED' => $status == $settings['status'], 'VALUE' => $status, 'NAME' => $this->user->lang[$lang]));
     }
     $has_custom_license = $this->has_custom_license($settings['license']);
     $translation_uploader = '';
     if ($this->contrib->type->extra_upload) {
         $translation_uploader = $this->translations->parse_uploader('posting/attachments/default.html');
     }
     // Display the rest of the page
     $this->template->assign_vars(array('ERROR_MSG' => !empty($error) ? implode('<br />', $error) : '', 'REVISION_NAME' => $settings['name'], 'REVISION_LICENSE' => $settings['license'], 'REVISION_CUSTOM_LICENSE' => $has_custom_license ? $settings['custom_license'] : '', 'TRANSLATION_UPLOADER' => $translation_uploader, 'S_IS_MODERATOR' => $this->is_moderator, 'S_POST_ACTION' => $this->contrib->get_url('revision', array('page' => 'edit', 'id' => $this->id)), 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', 'S_CUSTOM_LICENSE' => $has_custom_license, 'S_ALLOW_CUSTOM_LICENSE' => $this->contrib->type->license_allow_custom));
 }
Ejemplo n.º 2
0
 /**
  * Assign ColorizeIt template variables.
  *
  * @return null
  */
 protected function assign_colorizeit_vars()
 {
     $test_sample = '';
     if ($this->contrib->has_colorizeit(true) || $this->contrib->clr_sample) {
         $sample_url = $this->contrib->clr_sample->get_url();
         $test_sample = 'http://' . $this->ext_config->colorizeit_url . '/testsample.html?sub=' . $this->ext_config->colorizeit . '&amp;sample=' . urlencode($sample_url);
     }
     $this->template->assign_vars(array('MANAGE_COLORIZEIT' => $this->ext_config->colorizeit, 'CLR_SCREENSHOTS' => $this->colorizeit_sample->parse_uploader('posting/attachments/simple.html'), 'CLR_COLORS' => htmlspecialchars($this->contrib->contrib_clr_colors), 'U_TESTSAMPLE' => $test_sample));
 }
Ejemplo n.º 3
0
 /**
  * Display the message box
  *
  * @@param int $topic_access_level		Topic access level
  * @return $this
  */
 public function display($topic_access_level = access::PUBLIC_LEVEL)
 {
     $for_edit = $this->post_object->generate_text_for_edit();
     $this->options->set_auth($this->auth['bbcode'], $this->auth['smilies'], true, true, true)->set_status($for_edit['allow_bbcode'], $for_edit['allow_smilies'], $for_edit['allow_urls']);
     // Setup the attachments!
     $this->setup_attachments();
     if ($this->auth['polls']) {
         $this->posting_panels['poll-panel'] = 'POLL';
     }
     // Add the forum key
     add_form_key($this->settings['form_name']);
     // Generate smiley listing
     if ($this->options->get_status('smilies')) {
         if (!function_exists('generate_smilies')) {
             require $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
         }
         generate_smilies('inline', false);
     }
     // Build custom bbcodes array
     if ($this->options->get_status('bbcode')) {
         if (!function_exists('display_custom_bbcodes')) {
             require $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
         }
         display_custom_bbcodes();
     }
     // Display the Captcha if required
     if ($this->settings['display_captcha']) {
         $this->captcha->init(CONFIRM_POST);
         if ($this->captcha->validate($this->request_data()) !== false) {
             // Correct confirm image link
             $this->template->assign_var('CAPTCHA_TEMPLATE', $this->captcha->get_template());
         }
         $this->s_hidden_fields = array_merge($this->s_hidden_fields, $this->captcha->get_hidden_fields());
     }
     $this->options->set_in_template();
     // Save the opened panel to show again
     $default_panel = $this->request->variable('show_panel', 'options-panel');
     $default_panel = isset($this->posting_panels[$default_panel]) ? $default_panel : 'options-panel';
     $access_level = isset($for_edit['access']) ? $for_edit['access'] : access::PUBLIC_LEVEL;
     $text = $this->settings['text_default_override'] !== false ? $this->settings['text_default_override'] : $for_edit['text'];
     $subject = $this->settings['subject_default_override'] !== false ? $this->settings['subject_default_override'] : (isset($for_edit['subject']) ? $for_edit['subject'] : '');
     $this->template->assign_vars(array('ACCESS_OPTIONS' => $this->get_access_select($access_level, $topic_access_level), 'EDIT_REASON' => isset($for_edit['edit_reason']) ? $for_edit['edit_reason'] : '', 'POSTING_FORM_NAME' => $this->settings['form_name'], 'POSTING_TEXT_NAME' => $this->settings['text_name'], 'POSTING_SUBJECT_NAME' => $this->settings['subject_name'], 'POSTING_PANELS_DEFAULT' => $default_panel, 'POSTING_TEXT' => $text, 'SUBJECT' => $subject, 'S_DISPLAY_ERROR' => $this->settings['display_error'], 'S_DISPLAY_SUBJECT' => $this->settings['display_subject'], 'S_STICKY_TOPIC_ALLOWED' => $this->auth['sticky_topic'], 'S_STICKY_TOPIC_CHECKED' => isset($for_edit['topic_sticky']) ? $for_edit['topic_sticky'] : false, 'S_LOCK_TOPIC_ALLOWED' => $this->auth['lock_topic'], 'S_LOCK_TOPIC_CHECKED' => isset($for_edit['topic_locked']) ? $for_edit['topic_locked'] : false, 'S_LOCK_POST_ALLOWED' => $this->auth['lock'], 'S_LOCK_POST_CHECKED' => isset($for_edit['locked']) ? $for_edit['locked'] : false, 'S_EDIT_REASON' => $this->settings['display_edit_reason'], 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields)));
     if ($this->auth['attachments']) {
         $this->template->assign_vars(array('UPLOADER' => $this->uploader->parse_uploader($this->settings['attachment_tpl']), 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"'));
     }
     $this->display_panels();
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * Assign common template variables.
  *
  * @param array $error			Array containing any errors found in form.
  * @param bool $basic_form		Whether we're outputting a basic form.
  * @param array $settings		Form settings.
  *
  * @return null
  */
 protected function assign_common_vars($error, $basic_form, $settings = array())
 {
     $this->template->assign_vars(array('REVISION_ID' => $this->id));
     $this->display->assign_global_vars();
     $this->generate_navigation('manage');
     $this->generate_breadcrumbs();
     if ($basic_form && empty($error)) {
         return;
     }
     $_settings = array_fill_keys(array('name', 'version', 'custom_license', 'license', 'allow_repack', 'test_account'), '');
     $_settings['custom'] = $this->request->variable('custom_fields', array('' => ''));
     $_settings['vendor_versions'] = array();
     $settings = array_merge($_settings, $settings);
     $this->display->generate_custom_fields($this->contrib->type->revision_fields, $settings['custom'], $this->contrib->type->id);
     $this->template->assign_vars(array('REVISION_NAME' => $this->request->variable('revision_name', $settings['name'], true), 'REVISION_VERSION' => $this->request->variable('revision_version', $settings['version'], true), 'REVISION_LICENSE' => $this->request->variable('revision_license', $settings['license'], true), 'REVISION_CUSTOM_LICENSE' => $this->request->variable('revision_custom_license', $settings['custom_license'], true), 'REVISION_TEST_ACCOUNT' => $this->request->variable('revision_test_account', $settings['test_account'], true), 'REQUEST_TEST_ACCOUNT' => $this->use_queue && $this->contrib->type->id === TITANIA_TYPE_EXTENSION, 'S_CUSTOM_LICENSE' => $this->has_custom_license($this->request->variable('revision_license', $settings['license'], true)), 'S_ALLOW_CUSTOM_LICENSE' => $this->contrib->type->license_allow_custom, 'S_REQUIRE_UPLOAD' => $this->require_upload, 'S_REVISION_FORM' => true));
     // Assign separately so we can output some data first
     $this->template->assign_var('REVISION_UPLOADER', $this->uploader->parse_uploader('posting/attachments/revisions.html'));
     $this->display->generate_phpbb_version_select($settings['vendor_versions'], $this->contrib->type->get_allowed_branches());
     $this->template->assign_vars(array('ERROR_MSG' => !empty($error) ? is_array($error) ? implode('<br />', $error) : $error : '', 'AGREEMENT_NOTICE' => $this->contrib->type->upload_agreement ? nl2br($this->user->lang($this->contrib->type->upload_agreement)) : false, 'QUEUE_ALLOW_REPACK' => $settings['allow_repack']));
     // Output the available license options
     foreach ($this->contrib->type->license_options as $option) {
         $this->template->assign_block_vars('license_options', array('NAME' => $option, 'VALUE' => $option));
     }
 }