/** * 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)); }
/** * 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 . '&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)); }
/** * 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)); } }
/** * Get response data to return to Plupload. * * @return array */ public function get_plupload_response_data() { return $this->uploader->get_plupload_response_data(); }