Exemplo n.º 1
0
        // Reload the contrib (to make sure the authors list is updated)
        $submit = false;
        // Set submit as false to keep the main stuff from being resubmitted again
        redirect(titania::$contrib->get_url());
    }
}
/**
* ---------------------------- Main Page ----------------------------
*/
// Load the message object
$message = new titania_message(titania::$contrib);
$message->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies'), 'edit_subject' => titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate')));
$message->set_settings(array('display_error' => false, 'display_subject' => false, 'subject_name' => 'name'));
// Screenshots
$screenshot = new titania_attachment(TITANIA_SCREENSHOT, titania::$contrib->contrib_id);
$screenshot->load_attachments();
$screenshot->upload(175);
$error = array_merge($error, $screenshot->error);
if ($screenshot->uploaded || isset($_POST['preview']) || $submit) {
    titania::$contrib->post_data($message);
    titania::$contrib->__set_array(array('contrib_demo' => titania::$config->can_modify_style_demo_url || titania_types::$types[TITANIA_TYPE_STYLE]->acl_get('moderate') || titania::$contrib->contrib_type != TITANIA_TYPE_STYLE ? $contrib_demo : titania::$contrib->contrib_demo, 'contrib_local_name' => utf8_normalize_nfc(request_var('contrib_local_name', '', true)), 'contrib_iso_code' => request_var('contrib_iso_code', '')));
}
if (isset($_POST['preview'])) {
    $message->preview();
} else {
    if ($submit) {
        // Handle the deletion routine
        if (isset($_POST['delete']) && phpbb::$auth->acl_get('u_titania_admin')) {
            titania::$contrib->delete();
            redirect(titania_url::build_url(''));
        }
Exemplo n.º 2
0
// 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');
if ($translation->uploaded || isset($_POST['submit'])) {
    $revision_license = utf8_normalize_nfc(request_var('revision_license', '', true));
    $revision->__set_array(array('revision_name' => utf8_normalize_nfc(request_var('revision_name', $revision->revision_name, true)), 'revision_license' => $revision_license != phpbb::$user->lang['CUSTOM_LICENSE'] ? $revision_license : utf8_normalize_nfc(request_var('revision_custom_license', '', true))));
    // Stuff that can be done by moderators only
    if (titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate')) {
Exemplo n.º 3
0
$message = new titania_message(titania::$contrib);
$message->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies'), 'edit_subject' => titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate')));
$message->set_settings(array('display_error' => false, 'display_subject' => false, 'subject_name' => 'name'));
// Screenshots
$screenshot = new titania_attachment(TITANIA_SCREENSHOT, titania::$contrib->contrib_id);
$screenshot->load_attachments();
$screenshot->upload(175);
$error = array_merge($error, $screenshot->error);
if ($screenshot->uploaded || isset($_POST['preview']) || $submit) {
    titania::$contrib->post_data($message);
    titania::$contrib->__set_array(array('contrib_demo' => titania::$config->can_modify_style_demo_url || titania_types::$types[TITANIA_TYPE_STYLE]->acl_get('moderate') || titania::$contrib->contrib_type != TITANIA_TYPE_STYLE ? $contrib_demo : titania::$contrib->contrib_demo, 'contrib_local_name' => utf8_normalize_nfc(request_var('contrib_local_name', '', true)), 'contrib_iso_code' => request_var('contrib_iso_code', '')));
}
// ColorizeIt sample
if (strlen(titania::$config->colorizeit) && titania_types::$types[titania::$contrib->contrib_type]->acl_get('colorizeit')) {
    $clr_sample = new titania_attachment(TITANIA_CLR_SCREENSHOT, titania::$contrib->contrib_id);
    $clr_sample->load_attachments();
    $clr_sample->upload();
    $error = array_merge($error, $clr_sample->error);
    if ($clr_sample->uploaded || isset($_POST['preview']) || $submit) {
        titania::$contrib->post_data($message);
    }
}
if (isset($_POST['preview'])) {
    $message->preview();
} else {
    if ($submit) {
        // Handle the deletion routine
        if (isset($_POST['delete']) && phpbb::$auth->acl_get('u_titania_admin')) {
            titania::$contrib->delete();
            redirect(titania_url::build_url(''));
        }
Exemplo n.º 4
0
 /**
  * Quick Edit a post
  *
  * @param mixed $post_id
  */
 public function quick_edit($post_id)
 {
     $submit = isset($_POST['submit']) ? true : false;
     $full_editor = isset($_POST['full_editor']) ? true : false;
     // AJAX output
     if (!$submit && !$full_editor) {
         phpbb::$user->add_lang('viewtopic');
         // Load the stuff we need
         $post_object = $this->load_post($post_id);
         // Check permissions
         if (!$post_object->acl_get('edit')) {
             echo phpbb::$user->lang['NO_AUTH'];
             garbage_collection();
             exit_handler();
         }
         $post_message = $post_object->post_text;
         titania_decode_message($post_message, $post_object->post_text_uid);
         add_form_key('postform');
         phpbb::$template->assign_vars(array('MESSAGE' => $post_message, 'U_QR_ACTION' => $post_object->get_url('quick_edit')));
         phpbb::$template->set_filenames(array('quick_edit' => 'posting/quickedit_editor.html'));
         // application/xhtml+xml not used because of IE
         header('Content-type: text/html; charset=UTF-8');
         header('Cache-Control: private, no-cache="set-cookie"');
         header('Expires: 0');
         header('Pragma: no-cache');
         phpbb::$template->display('quick_edit');
         garbage_collection();
         exit_handler();
     }
     if ($full_editor || !check_form_key('postform')) {
         $this->edit($post_id);
         return;
     }
     // Load the stuff we need
     $post_object = $this->load_post($post_id);
     // Check permissions
     if (!$post_object->acl_get('edit')) {
         titania::needs_auth();
     }
     // Grab some data
     $for_edit = $post_object->generate_text_for_edit();
     // Set the post text
     $post_object->post_text = utf8_normalize_nfc(request_var('message', '', true));
     // Generate for storage based on previous options
     $post_object->generate_text_for_storage($for_edit['allow_bbcode'], $for_edit['allow_urls'], $for_edit['allow_smilies']);
     // Submit
     $post_object->submit();
     // Load attachments
     $attachments = new titania_attachment($post_object->post_type, $post_object->post_id);
     $attachments->load_attachments();
     // Parse the mesage
     $message = $post_object->generate_text_for_display();
     $parsed_attachments = $attachments->parse_attachments($message);
     // echo the message (returned to the JS to display in the place of the old message)
     echo $message;
     garbage_collection();
     exit_handler();
 }
Exemplo n.º 5
0
     redirect(titania::$contrib->get_url('faq'));
     break;
 default:
     if ($faq_id) {
         titania::page_header($faq->faq_subject . ' - ' . titania::$contrib->contrib_name);
         if ($faq->faq_access < titania::$access_level) {
             trigger_error('NOT_AUTHORISED');
         }
         // increase a FAQ views counter
         $faq->increase_views_counter();
         // tracking
         titania_tracking::track(TITANIA_FAQ, $faq_id);
         $message = $faq->generate_text_for_display();
         // Grab attachments
         $attachments = new titania_attachment(TITANIA_FAQ, $faq->faq_id);
         $attachments->load_attachments();
         $parsed_attachments = $attachments->parse_attachments($message);
         phpbb::$template->assign_vars(array('FAQ_SUBJECT' => $faq->faq_subject, 'FAQ_TEXT' => $message, 'FAQ_VIEWS' => $faq->faq_views, 'S_DETAILS' => true, 'S_ACCESS_TEAMS' => $faq->faq_access == TITANIA_ACCESS_TEAMS ? true : false, 'S_ACCESS_AUTHORS' => $faq->faq_access == TITANIA_ACCESS_AUTHORS ? true : false, 'U_EDIT_FAQ' => titania::$contrib->is_author || phpbb::$auth->acl_get('u_titania_faq_edit') ? $faq->get_url('edit') : false, 'U_CANONICAL' => $faq->get_url()));
         foreach ($parsed_attachments as $attachment) {
             phpbb::$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
         }
     } else {
         titania::page_header(titania::$contrib->contrib_name . ' - ' . phpbb::$user->lang['FAQ_LIST']);
         titania::_include('functions_display', 'titania_topic_folder_img');
         // Setup the sort tool
         $sort = new titania_sort();
         $sort->set_url(titania::$contrib->get_url('faq'));
         $sort->set_defaults(phpbb::$config['topics_per_page']);
         $sort->request();
         $faqs = array();
         $sql_ary = array('SELECT' => 'f.*', 'FROM' => array(TITANIA_CONTRIB_FAQ_TABLE => 'f'), 'WHERE' => 'f.contrib_id = ' . titania::$contrib->contrib_id . '