Beispiel #1
0
 /**
  * Repack revision submission action.
  *
  * @param string $contrib_type		Contrib type URL identifier.
  * @param string $contrib			Contrib name clean.
  * @param id $id						Id for revision being repacked.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function repack($contrib_type, $contrib, $id)
 {
     $this->setup($contrib_type, $contrib);
     if (!$this->check_auth()) {
         return $this->helper->needs_auth();
     }
     $old_revision = new \titania_revision($this->contrib, $id);
     if (!$old_revision->load() || $old_revision->contrib_id != $this->contrib->contrib_id) {
         return $this->helper->error('NO_REVISION', 404);
     }
     if (!($old_queue = $old_revision->get_queue())) {
         $this->user->add_lang_ext('phpbb/titania', 'manage');
         return $this->helper->error('NO_QUEUE_ITEM', 404);
     }
     // Only allow revisions that are still in the queue to be repacked.
     if ($old_queue->queue_status < TITANIA_QUEUE_NEW || !$old_queue->allow_author_repack && !$this->is_moderator) {
         return $this->helper->needs_auth();
     }
     $old_revision->load_phpbb_versions();
     $this->revisions_in_queue = $this->contrib->in_queue();
     foreach ($old_revision->phpbb_versions as $version) {
         $this->repackable_branches[] = (int) $version['phpbb_version_branch'];
     }
     $this->repackable_branches = array_unique($this->repackable_branches);
     $error = array();
     if ($this->request->is_set_post('new_revision')) {
         $result = $this->process_steps();
         if ($result['complete']) {
             $this->revision->repack($old_revision, $old_queue);
             $this->submit();
             if ($this->use_queue && !$this->is_author && $this->is_moderator) {
                 redirect($this->helper->route('phpbb.titania.queue.item', array('id' => $this->revision->revision_queue_id)));
             }
             $old_queue->allow_author_repack = false;
             $old_queue->submit();
             redirect($this->contrib->get_url());
         } else {
             if (isset($result['response'])) {
                 return $result['response'];
             }
         }
         $error = $result['error'];
     } else {
         if ($this->request->is_set_post('cancel')) {
             $this->cancel();
         }
     }
     $settings = array('name' => $old_revision->revision_name, 'version' => $old_revision->revision_version, 'vendor_versions' => $old_revision->get_selected_branches(), 'custom' => $old_revision->get_custom_fields(), 'allow_repack' => $old_queue->queue_allow_repack, 'test_account' => '');
     if ($this->is_custom_license($old_revision->revision_license)) {
         $settings['custom_license'] = $old_revision->revision_license;
         $settings['license'] = $this->user->lang['CUSTOM_LICENSE'];
     } else {
         $settings['license'] = $old_revision->revision_license;
     }
     $this->assign_common_vars($error, !empty($this->id), $settings);
     $this->template->assign_vars(array('S_REPACK' => true, 'S_POST_ACTION' => $this->contrib->get_url('revision', array('page' => 'repack', 'id' => $old_revision->revision_id))));
     add_form_key('postform');
     return $this->helper->render('contributions/contribution_revision.html', $this->contrib->contrib_name . ' - ' . $this->user->lang['NEW_REVISION']);
 }
Beispiel #2
0
     }
     $errors = $validation_tools->check_package($reference_filepath);
     if (!empty($errors)) {
         trigger_error(implode('<br /><br />', $errors));
     }
     $validation_tools->remove_temp_files();
     phpbb::$template->assign_var('S_PASSED_TRANSLATION_VALIDATION', true);
     break;
 case 5:
     $revision = new titania_revision(titania::$contrib, $revision_id);
     if (!$revision->load()) {
         trigger_error('NO_REVISION');
     }
     // Repack if that's what we want
     if ($repack) {
         $revision->repack($old_revision);
     }
     // Update the revision to be submitted, which unhides the queue topic and updates the contrib_last_update time
     $revision->revision_submitted = true;
     $revision->submit();
     // Update the queue (make visible)
     $revision->update_queue();
     if ($repack && titania::$config->use_queue && titania_types::$types[titania::$contrib->contrib_type]->use_queue) {
         redirect(titania_url::build_url('manage/queue', array('q' => $revision->revision_queue_id)));
     }
     // Subscriptions
     $queue = $revision->get_queue();
     if ($queue) {
         $email_vars = array('NAME' => phpbb::$user->lang['VALIDATION'] . ' - ' . titania::$contrib->contrib_name . ' - ' . $revision->revision_version, 'U_VIEW' => titania_url::build_url('manage/queue', array('q' => $queue->queue_id)));
         titania_subscriptions::send_notifications(TITANIA_QUEUE, titania::$contrib->contrib_type, 'subscribe_notify_forum.txt', $email_vars, phpbb::$user->data['user_id']);
     }