Esempio n. 1
0
    }
    $change_owner_id = request_var('change_owner_id', 0);
    if ($change_owner_id !== ANONYMOUS && $change_owner_id) {
        titania::$contrib->set_contrib_user_id($change_owner_id);
        titania::$contrib->load(utf8_normalize_nfc(request_var('c', '', true)));
        // 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) {
Esempio n. 2
0
     phpbb::$template->assign_vars(array('S_POST_ACTION' => titania_url::$current_page_url, 'L_POST_A' => phpbb::$user->lang['EDIT_VALIDATION_NOTES']));
     titania::page_header('EDIT_VALIDATION_NOTES');
     titania::page_footer(true, 'manage/queue_post.html');
     break;
 case 'rebuild':
     $queue = queue_overlord::get_queue_object($queue_id, true);
     $queue->update_first_queue_post();
     redirect(titania_url::append_url($base_url, array('q' => $queue->queue_id)));
     break;
 case 'allow_author_repack':
     $queue = queue_overlord::get_queue_object($queue_id, true);
     $topic = $queue->get_queue_discussion_topic();
     $post = new titania_post(TITANIA_QUEUE_DISCUSSION, $topic);
     $post->__set_array(array('post_subject' => 'Re: ' . $post->topic->topic_subject));
     // Load the message object
     $message_object = new titania_message($post);
     $message_object->set_auth(array('bbcode' => true, 'smilies' => true));
     $message_object->set_settings(array('display_subject' => false));
     // Submit check...handles running $post->post_data() if required
     $submit = $message_object->submit_check();
     if ($submit) {
         $queue->allow_author_repack = true;
         $contrib = contribs_overlord::get_contrib_object($queue->contrib_id, true);
         $for_edit = $post->generate_text_for_edit();
         $post->post_text = $for_edit['message'] . "\n\n[url=" . titania_url::append_url($contrib->get_url('revision'), array('repack' => $queue->revision_id)) . ']' . phpbb::$user->lang['AUTHOR_REPACK_LINK'] . '[/url]';
         $post->generate_text_for_storage($for_edit['allow_bbcode'], $for_edit['allow_smilies'], $for_edit['allow_urls']);
         $post->submit();
         $queue->submit();
         $queue->topic_reply('QUEUE_REPLY_ALLOW_REPACK');
         $queue->submit();
         redirect(titania_url::append_url($base_url, array('q' => $queue->queue_id)));
Esempio n. 3
0
 /**
  * Edit an existing post
  *
  * @param int $post_id
  */
 public function edit($post_id)
 {
     if (!phpbb::$auth->acl_get('u_titania_post')) {
         titania::needs_auth();
     }
     // Load the stuff we need
     $post_object = $this->load_post($post_id);
     // Check permissions
     if (!$post_object->acl_get('edit')) {
         titania::needs_auth();
     }
     // Some more complicated permissions for stickes in support
     $can_sticky = $can_lock = phpbb::$auth->acl_get('u_titania_mod_post_mod');
     if ($post_object->post_type == TITANIA_SUPPORT) {
         if (is_object(titania::$contrib) && titania::$contrib->contrib_id == $post_object->topic->parent_id && titania::$contrib->is_author || titania::$contrib->is_active_coauthor) {
             $can_sticky = $can_lock = true;
         } else {
             if (!is_object(titania::$contrib) || !titania::$contrib->contrib_id == $post_object->topic->parent_id) {
                 $contrib = new titania_contribution();
                 $contrib->load((int) $post_object->topic->parent_id);
                 if ($contrib->is_author || $contrib->is_active_coauthor) {
                     $can_sticky = $can_lock = true;
                 }
             }
         }
     }
     // Load the message object
     $message_object = new titania_message($post_object);
     $message_object->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies'), 'lock' => $post_object->post_user_id != phpbb::$user->data['user_id'] && phpbb::$auth->acl_get('u_titania_mod_post_mod') ? true : false, 'sticky_topic' => $post_object->post_id == $post_object->topic->topic_first_post_id && $can_sticky ? true : false, 'lock_topic' => $can_lock || phpbb::$auth->acl_get('u_titania_post_mod_own') && (phpbb::$auth->acl_get('u_titania_post_mod_own') && is_object(titania::$contrib) && titania::$contrib->contrib_id == $post_object->topic->parent_id && titania::$contrib->is_author || titania::$contrib->is_active_coauthor) ? true : false, 'attachments' => phpbb::$auth->acl_get('u_titania_post_attach')));
     // Call our common posting handler
     $this->common_post('edit', $post_object, $message_object);
     // Common stuff
     phpbb::$template->assign_vars(array('S_POST_ACTION' => $post_object->get_url('edit', false, titania_url::$current_page_url), 'L_POST_A' => phpbb::$user->lang['EDIT_POST']));
     titania::page_header('EDIT_POST');
 }
Esempio n. 4
0
titania::_include('functions_posting', 'generate_type_select');
$category_id = request_var('c', 0);
$submit = isset($_POST['submit']) ? true : false;
$action = request_var('action', '');
switch ($action) {
    case 'add':
    case 'edit':
        $category_object = new titania_category();
        if ($action == 'edit') {
            if (!$category_id) {
                trigger_error(phpbb::$user->lang['NO_CATEGORY']);
            }
            $category_object->load($category_id);
        }
        // Load the message object
        $message_object = new titania_message($category_object);
        $message_object->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies')));
        $message_object->set_settings(array('display_error' => false, 'display_subject' => false));
        $category_object->post_data($message_object);
        $message_object->display();
        // Define some variables for use later with keeping language-based category names the same in the DB during submit
        $old_category_name = $category_object->category_name;
        $old_category_name_clean = $category_object->category_name_clean;
        $old_category_name_lang = isset(phpbb::$user->lang[$old_category_name]) ? phpbb::$user->lang[$old_category_name] : $old_category_name;
        $error = array();
        if ($submit) {
            // Goodbye to some of the old category data...
            unset($category_object->category_name);
            $category_object->category_id = $action == 'edit' ? $category_id : '';
            $category_name = utf8_normalize_nfc(request_var('category_name', '', true));
            $category_object->category_name = $category_name == $old_category_name_lang ? $old_category_name : $category_name;
Esempio n. 5
0
        trigger_error('FAQ_NOT_FOUND');
    }
    load_contrib($faq->contrib_id);
} else {
    load_contrib();
}
// Output the simple info on the contrib
titania::$contrib->assign_details(true);
switch ($action) {
    case 'create':
    case 'edit':
        if (!phpbb::$auth->acl_get('u_titania_mod_faq_mod') && !phpbb::$auth->acl_get('u_titania_faq_' . $action) && !titania::$contrib->is_author && !titania::$contrib->is_active_coauthor) {
            titania::needs_auth();
        }
        // Load the message object
        $message = new titania_message($faq);
        $message->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies'), 'attachments' => true));
        // Submit check...handles running $faq->post_data() if required
        $submit = $message->submit_check();
        $error = array_merge($error, $message->error);
        if ($submit) {
            $error = array_merge($error, $faq->validate());
            if (($validate_form_key = $message->validate_form_key()) !== false) {
                $error[] = $validate_form_key;
            }
            if (!sizeof($error)) {
                $faq->submit();
                $message->submit($faq->faq_id);
                $sql = 'SELECT right_id FROM ' . TITANIA_CONTRIB_FAQ_TABLE . '
					WHERE contrib_id = ' . titania::$contrib->contrib_id . '
					ORDER BY right_id DESC LIMIT 1';
Esempio n. 6
0
    /**
     * Do everything we need to display the forum like page
     *
     * @param object $topic the topic object
     */
    public static function display_topic_complete($topic)
    {
        phpbb::$user->add_lang('viewtopic');
        // Setup the sort tool
        $sort = self::build_sort();
        $sort->request();
        // if a post_id was given we must start from the appropriate page
        $post_id = request_var('p', 0);
        if ($post_id) {
            $sql = 'SELECT COUNT(p.post_id) as start FROM ' . TITANIA_POSTS_TABLE . ' p
				WHERE p.post_id < ' . $post_id . '
					AND p.topic_id = ' . $topic->topic_id . self::sql_permissions('p.') . '
				ORDER BY ' . $sort->get_order_by();
            phpbb::$db->sql_query($sql);
            $start = phpbb::$db->sql_fetchfield('start');
            phpbb::$db->sql_freeresult();
            $sort->start = $start > 0 ? floor($start / $sort->limit) * $sort->limit : 0;
        }
        // check to see if they want to view the latest unread post
        if (request_var('view', '') == 'unread') {
            $mark_time = titania_tracking::get_track(TITANIA_TOPIC, $topic->topic_id);
            if ($mark_time > 0) {
                $sql = 'SELECT COUNT(p.post_id) as start FROM ' . TITANIA_POSTS_TABLE . ' p
					WHERE p.post_time <= ' . $mark_time . '
						AND p.topic_id = ' . $topic->topic_id . self::sql_permissions('p.') . '
					ORDER BY post_time ASC';
                phpbb::$db->sql_query($sql);
                $start = phpbb::$db->sql_fetchfield('start');
                phpbb::$db->sql_freeresult();
                $sort->start = $start > 0 ? floor($start / $sort->limit) * $sort->limit : 0;
            }
        }
        /*
        user_topic_show_days
        
        $limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
        */
        self::display_topic($topic, $sort);
        self::assign_common();
        // Build Quick Actions
        if ($topic->topic_type != TITANIA_QUEUE) {
            self::build_quick_actions($topic);
        }
        // Display the Quick Reply
        $post_object = new titania_post($topic->topic_type, $topic);
        if ($post_object->acl_get('reply')) {
            $message = new titania_message($topic);
            $message->display_quick_reply();
        }
        phpbb::$template->assign_vars(array('S_IS_LOCKED' => (bool) $topic->topic_locked));
    }