/** * Load revision * * @param int $id Revision id. * @throws \Exception Throws exception if revision or its attachment * cannot be loaded. * @return null */ protected function load_revision($id) { $this->id = (int) $id; if (!$this->id || !$this->revision->load($this->id) || $this->revision->contrib_id != $this->contrib->contrib_id || $this->revision->attachment_id && !$this->load_attachment($this->revision->attachment_id)) { throw new \Exception($this->user->lang['NO_REVISION']); } }
/** * Load revision. * * @throws \Exception Throws exception if no revision found. * @return null */ protected function load_revision($id) { $this->id = (int) $id; $this->revision = new \titania_revision(false, $this->id); if (!$this->id || !$this->revision->load()) { throw new \Exception($this->user->lang['NO_REVISION']); } }
/** * Send the approve/deny notification */ private function send_approve_deny_notification($approve = true) { $this->user->add_lang_ext('phpbb/titania', 'manage'); phpbb::_include('functions_privmsgs', 'submit_pm'); // Need some stuff $contrib = new titania_contribution(); $contrib->load((int) $this->contrib_id); $revision = new titania_revision($contrib, $this->revision_id); $revision->load(); // Generate the authors list to send it to $authors = array($contrib->contrib_user_id => 'to'); $sql = 'SELECT user_id FROM ' . TITANIA_CONTRIB_COAUTHORS_TABLE . ' WHERE contrib_id = ' . (int) $this->contrib_id . ' AND active = 1'; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $authors[$row['user_id']] = 'to'; } phpbb::$db->sql_freeresult($result); // Subject $subject = sprintf(phpbb::$user->lang[$contrib->type->validation_subject], $contrib->contrib_name, $revision->revision_version); // Message $notes = $this->validation_notes; message::decode($notes, $this->validation_notes_uid); if ($approve) { $message = $contrib->type->validation_message_approve; } else { $message = $contrib->type->validation_message_deny; } $message = sprintf(phpbb::$user->lang[$message], $notes); // Replace empty quotes if there are no notes if (!$notes) { $message = str_replace('[quote][/quote]', phpbb::$user->lang['NO_NOTES'], $message); } // Parse the message $message_uid = $message_bitfield = $message_options = false; generate_text_for_storage($message, $message_uid, $message_bitfield, $message_options, true, true, true); $data = array('address_list' => array('u' => $authors), 'from_user_id' => phpbb::$user->data['user_id'], 'from_username' => phpbb::$user->data['username'], 'icon_id' => 0, 'from_user_ip' => phpbb::$user->ip, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $message, 'bbcode_bitfield' => $message_bitfield, 'bbcode_uid' => $message_uid); // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $data, $this); // Submit Plz submit_pm('post', $subject, $data, true); }
*/ if (!defined('IN_TITANIA')) { exit; } load_contrib(); // Editing a revision can only be done by moderators if (!titania::$contrib->is_author && !titania::$contrib->is_active_coauthor && !titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate')) { titania::needs_auth(); } // Setup some variables $revision_id = request_var('revision', 0); $error = $revision_phpbb_versions = array(); $phpbb_versions = titania::$cache->get_phpbb_versions(); // Load the revision $revision = new titania_revision(titania::$contrib, $revision_id); if (!$revision->load()) { trigger_error('NO_REVISION'); } // Translations $translation = new titania_attachment(TITANIA_TRANSLATION, $revision_id); $translation->load_attachments(); $translation->upload(); $error = array_merge($error, $translation->error); // Revision phpBB versions $revision->load_phpbb_versions(); foreach ($revision->phpbb_versions as $row) { $revision_phpbb_versions[] = $phpbb_versions[$row['phpbb_version_branch'] . $row['phpbb_version_revision']]; } // Revision Status $revision_status = request_var('revision_status', (int) $revision->revision_status); $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');