コード例 #1
0
 function main($id, $mode)
 {
     global $phpbb_root_path;
     define('PHPBB_INCLUDED', true);
     define('USE_PHPBB_TEMPLATE', true);
     define('IN_TITANIA', true);
     if (!defined('PHP_EXT')) {
         define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
     }
     require TITANIA_ROOT . 'common.' . PHP_EXT;
     // Need a few hacks to be used from within phpBB
     titania_url::decode_url(titania::$config->phpbb_script_path);
     titania::$hook->register(array('titania_url', 'build_url'), 'titania_outside_build_url', 'standalone');
     titania::$hook->register(array('titania_url', 'append_url'), 'titania_outside_build_url', 'standalone');
     titania::$hook->register(array('titania', 'page_header'), 'titania_outside_page_header', 'standalone');
     titania::$hook->register(array('titania', 'page_footer'), 'titania_outside_page_footer', 'standalone');
     titania::$hook->register('titania_generate_text_for_display', 'titania_outside_generate_text_for_display', 'standalone');
     titania::add_lang('manage');
     $this->p_master->assign_tpl_vars(phpbb::append_sid('mcp'));
     phpbb::$template->assign_vars(array('L_TITLE' => phpbb::$user->lang['ATTENTION'], 'L_EXPLAIN' => ''));
     include TITANIA_ROOT . 'manage/attention.' . PHP_EXT;
 }
コード例 #2
0
    function main($id, $mode)
    {
        global $phpbb_root_path;
        define('PHPBB_INCLUDED', true);
        define('USE_PHPBB_TEMPLATE', true);
        define('IN_TITANIA', true);
        if (!defined('PHP_EXT')) {
            define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
        }
        require TITANIA_ROOT . 'common.' . PHP_EXT;
        // Need a few hacks to be used from within phpBB
        titania_url::decode_url(titania::$config->phpbb_script_path);
        titania::$hook->register(array('titania_url', 'build_url'), 'titania_outside_build_url', 'standalone');
        titania::$hook->register(array('titania_url', 'append_url'), 'titania_outside_build_url', 'standalone');
        titania::$hook->register(array('titania', 'page_header'), 'titania_outside_page_header', 'standalone');
        titania::$hook->register(array('titania', 'page_footer'), 'titania_outside_page_footer', 'standalone');
        $this->p_master->assign_tpl_vars(phpbb::append_sid('ucp'));
        // Include some files
        titania::_include('functions_display', 'titania_topic_folder_img');
        // Setup the sort tool
        $sort = new titania_sort();
        $sort->default_limit = phpbb::$config['topics_per_page'];
        $sort->request();
        // Start initial var setup
        $url = $this->u_action;
        add_form_key('ucp_front_subscription');
        // User wants to unsubscribe?
        if (isset($_POST['unsubscribe'])) {
            if (check_form_key('ucp_front_subscription')) {
                $sections = request_var('sections', array(0 => array(0 => 0)));
                $items = request_var('items', array(0 => array(0 => 0)));
                $subscriptions = $sections + $items;
                if (sizeof($subscriptions)) {
                    foreach ($subscriptions as $type => $type_id) {
                        $object_ids = array_keys($type_id);
                        foreach ($object_ids as $object_id) {
                            $sql = 'DELETE FROM ' . TITANIA_WATCH_TABLE . '
								WHERE watch_user_id = ' . phpbb::$user->data['user_id'] . '
								AND watch_object_type = ' . $type . '
								AND watch_object_id = ' . $object_id;
                            phpbb::$db->sql_query($sql);
                        }
                    }
                } else {
                    $msg = phpbb::$user->lang['NO_SUBSCRIPTIONS_SELECTED'];
                }
            } else {
                $msg = phpbb::$user->lang['FORM_INVALID'];
            }
            if (isset($msg)) {
                meta_refresh(3, $url);
                $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>');
                trigger_error($message);
            }
        }
        switch ($mode) {
            case 'subscription_items':
                $array_items = array(TITANIA_CONTRIB, TITANIA_TOPIC);
                // We prepare pagination stuff
                $sql = 'SELECT COUNT(*) AS subscription_count
					FROM ' . TITANIA_WATCH_TABLE . '
					WHERE ' . phpbb::$db->sql_in_set('watch_object_type', $array_items) . '
						AND watch_user_id = ' . phpbb::$user->data['user_id'];
                phpbb::$db->sql_query($sql);
                $subscription_count = phpbb::$db->sql_fetchfield('subscription_count');
                phpbb::$db->sql_freeresult();
                $sort->total = $subscription_count;
                $sort->build_pagination($url);
                $sql_ary = array('SELECT' => '*,
						CASE w.watch_object_type
							WHEN ' . TITANIA_CONTRIB . ' THEN c.contrib_last_update
							WHEN ' . TITANIA_TOPIC . ' THEN t.topic_last_post_time
						END AS time', 'FROM' => array(TITANIA_WATCH_TABLE => 'w'), 'LEFT_JOIN' => array(array('FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'), 'ON' => '(w.watch_object_type = ' . TITANIA_CONTRIB . ')
								AND c.contrib_id = w.watch_object_id'), array('FROM' => array(TITANIA_TOPICS_TABLE => 't'), 'ON' => 'w.watch_object_type = ' . TITANIA_TOPIC . '
								AND t.topic_id = w.watch_object_id')), 'WHERE' => 'w.watch_user_id = ' . phpbb::$user->data['user_id'] . '
						AND ' . phpbb::$db->sql_in_set('watch_object_type', $array_items), 'ORDER_BY' => 'time DESC');
                // Additional tracking for support topics
                titania_tracking::get_track_sql($sql_ary, TITANIA_TOPIC, 't.topic_id');
                titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 0, 'tsa');
                titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 't.parent_id', 'tsc');
                titania_tracking::get_track_sql($sql_ary, TITANIA_QUEUE_DISCUSSION, 0, 'tqt');
                // Tracking for contributions
                titania_tracking::get_track_sql($sql_ary, TITANIA_CONTRIB, 'c.contrib_id', 'tc');
                $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
                // Get the data
                $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start);
                $user_ids = $rows = array();
                while ($row = phpbb::$db->sql_fetchrow($result)) {
                    $rows[] = $row;
                    titania_tracking::store_from_db($row);
                    if ($row['watch_object_type'] == TITANIA_TOPIC) {
                        $user_ids[] = $row['topic_first_post_user_id'];
                        $user_ids[] = $row['topic_last_post_user_id'];
                    } else {
                        if ($row['watch_object_type'] == TITANIA_CONTRIB) {
                            $user_ids[] = $row['contrib_user_id'];
                        }
                    }
                }
                phpbb::$db->sql_freeresult($result);
                // Get user data
                users_overlord::load_users($user_ids);
                foreach ($rows as $row) {
                    $folder_img = $folder_alt = '';
                    if ($row['watch_object_type'] == TITANIA_TOPIC) {
                        if (!$row['topic_id']) {
                            // Topic was deleted
                            $sql = 'DELETE FROM ' . TITANIA_WATCH_TABLE . '
								WHERE watch_object_type = ' . (int) $row['watch_object_type'] . '
									AND watch_object_id = ' . (int) $row['watch_object_id'];
                            phpbb::$db->sql_query($sql);
                            continue;
                        }
                        $topic = new titania_topic();
                        $topic->__set_array($row);
                        $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'id' => 0);
                        $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'parent_match' => true);
                        $topic->additional_unread_fields[] = array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true);
                        $tpl_block = 'items';
                        $subscription_target = '';
                        if ($row['topic_type'] == TITANIA_QUEUE_DISCUSSION) {
                            $subscription_target = phpbb::$user->lang['SUBSCRIPTION_QUEUE_VALIDATION'];
                        }
                        if ($row['topic_type'] == TITANIA_QUEUE) {
                            $subscription_target = phpbb::$user->lang['SUBSCRIPTION_QUEUE'];
                        }
                        if ($row['topic_type'] == TITANIA_SUPPORT) {
                            $subscription_target = phpbb::$user->lang['SUBSCRIPTION_SUPPORT_TOPIC'];
                        }
                        // Tracking check
                        $last_read_mark = titania_tracking::get_track(TITANIA_TOPIC, $topic->topic_id, true);
                        $last_read_mark = max($last_read_mark, titania_tracking::find_last_read_mark($topic->additional_unread_fields, $topic->topic_type, $topic->parent_id));
                        $topic->unread = $topic->topic_last_post_time > $last_read_mark ? true : false;
                        // Get the folder image
                        $topic->topic_folder_img($folder_img, $folder_alt);
                        $vars = array('LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'SUBSCRIPTION_AUTHOR_FULL' => users_overlord::get_user($row['topic_first_post_user_id'], '_full'), 'SUBSCRIPTION_ID' => $row['topic_id'], 'SUBSCRIPTION_LAST_AUTHOR_FULL' => users_overlord::get_user($row['topic_last_post_user_id'], '_full'), 'SUBSCRIPTION_LAST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']), 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['topic_time']), 'SUBSCRIPTION_TARGET' => $subscription_target, 'SUBSCRIPTION_TITLE' => censor_text($row['topic_subject']), 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'U_VIEW_SUBSCRIPTION' => $topic->get_url(), 'U_VIEW_LAST_POST' => titania_url::append_url($topic->get_url(), array('p' => $topic->topic_last_post_id, '#p' => $topic->topic_last_post_id)), 'S_ACCESS_TEAMS' => $row['topic_access'] == TITANIA_ACCESS_TEAMS || $row['topic_type'] == TITANIA_QUEUE ? true : false, 'S_ACCESS_AUTHORS' => $row['topic_access'] == TITANIA_ACCESS_AUTHORS ? true : false, 'S_TOPIC' => true);
                    } else {
                        if ($row['watch_object_type'] == TITANIA_CONTRIB) {
                            $tpl_block = 'items';
                            $contrib = new titania_contribution();
                            $contrib->__set_array($row);
                            titania_topic_folder_img($folder_img, $folder_alt, 0, titania_tracking::is_unread(TITANIA_CONTRIB, $contrib->contrib_id, $contrib->contrib_last_update));
                            $vars = array('SUBSCRIPTION_AUTHOR_FULL' => users_overlord::get_user($row['contrib_user_id'], '_full'), 'SUBSCRIPTION_CONTRIB_TYPE' => titania_types::$types[$contrib->contrib_type]->lang, 'SUBSCRIPTION_DOWNLOADS' => $row['contrib_downloads'], 'SUBSCRIPTION_ID' => $row['contrib_id'], 'SUBSCRIPTION_TARGET' => phpbb::$user->lang['SUBSCRIPTION_CONTRIB'], 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['contrib_last_update']), 'SUBSCRIPTION_TITLE' => $row['contrib_name'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'SUBSCRIPTION_VIEWS' => $row['contrib_views'], 'U_VIEW_SUBSCRIPTION' => $contrib->get_url(), 'S_CONTRIB' => true);
                        }
                    }
                    phpbb::$template->assign_block_vars($tpl_block, array_merge($vars, array('FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => phpbb::$user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => phpbb::$user->img($folder_img, '', false, '', 'height'))));
                }
                break;
            case 'subscription_sections':
                $array_items = array(TITANIA_SUPPORT, TITANIA_QUEUE, TITANIA_ATTENTION);
                // We prepare pagination stuff
                $sql = 'SELECT COUNT(*) AS subscription_count
					FROM ' . TITANIA_WATCH_TABLE . '
					WHERE ' . phpbb::$db->sql_in_set('watch_object_type', $array_items) . '
					AND watch_user_id = ' . phpbb::$user->data['user_id'];
                phpbb::$db->sql_query($sql);
                $subscription_count = phpbb::$db->sql_fetchfield('subscription_count');
                phpbb::$db->sql_freeresult();
                $sort->total = $subscription_count;
                $sort->build_pagination($url);
                $sql_ary = array('SELECT' => '*,
						CASE w.watch_object_type
							WHEN ' . TITANIA_SUPPORT . ' THEN c.contrib_last_update
						END AS time', 'FROM' => array(TITANIA_WATCH_TABLE => 'w'), 'LEFT_JOIN' => array(array('FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'), 'ON' => '(w.watch_object_type = ' . TITANIA_SUPPORT . ')
								AND c.contrib_id = w.watch_object_id')), 'WHERE' => 'w.watch_user_id = ' . phpbb::$user->data['user_id'] . '
						AND ' . phpbb::$db->sql_in_set('watch_object_type', $array_items), 'ORDER_BY' => 'time DESC');
                $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
                // Get the data
                $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start);
                $user_ids = array();
                while ($row = phpbb::$db->sql_fetchrow($result)) {
                    $rows[] = $row;
                    $user_ids[] = $row['contrib_user_id'];
                }
                phpbb::$db->sql_freeresult($result);
                // Get user data
                users_overlord::load_users($user_ids);
                if (isset($rows)) {
                    foreach ($rows as $row) {
                        if ($row['watch_object_type'] == TITANIA_SUPPORT) {
                            $tpl_block = 'sections';
                            $contrib = new titania_contribution();
                            $contrib->__set_array($row);
                            $vars = array('SUBSCRIPTION_AUTHOR_FULL' => users_overlord::get_user($row['contrib_user_id'], '_full'), 'SUBSCRIPTION_ID' => $row['watch_object_id'], 'SUBSCRIPTION_TARGET' => phpbb::$user->lang['SUBSCRIPTION_SUPPORT'], 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['contrib_last_update']), 'SUBSCRIPTION_TITLE' => $row['contrib_name'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'U_VIEW_SUBSCRIPTION' => $contrib->get_url('support'));
                        } else {
                            if ($row['watch_object_type'] == TITANIA_ATTENTION) {
                                $tpl_block = 'sections';
                                $vars = array('SUBSCRIPTION_ID' => $row['watch_object_id'], 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['watch_mark_time']), 'SUBSCRIPTION_TITLE' => phpbb::$user->lang['SUBSCRIPTION_ATTENTION'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'S_ATTENTION' => true, 'S_ACCESS_TEAMS' => true, 'U_VIEW_SUBSCRIPTION' => titania_url::build_url('manage/attention'));
                            } else {
                                if ($row['watch_object_type'] == TITANIA_QUEUE) {
                                    $tpl_block = 'sections';
                                    $queue_id = $row['watch_object_id'];
                                    // Setup the base url we will use
                                    $base_url = titania_url::build_url('manage/queue');
                                    $vars = array('SUBSCRIPTION_ID' => $queue_id, 'SUBSCRIPTION_TARGET' => titania_types::$types[$queue_id]->lang, 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['watch_mark_time']), 'SUBSCRIPTION_TITLE' => phpbb::$user->lang['SUBSCRIPTION_QUEUE'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'S_QUEUE' => true, 'S_ACCESS_TEAMS' => true, 'U_VIEW_SUBSCRIPTION' => titania_url::append_url($base_url, array('queue' => titania_types::$types[$queue_id]->url)));
                                }
                            }
                        }
                        phpbb::$template->assign_block_vars($tpl_block, $vars);
                    }
                }
                break;
        }
        phpbb::$template->assign_vars(array('S_ACTION' => $url, 'TITANIA_THEME_PATH' => titania::$absolute_path . 'styles/' . titania::$config->style . '/theme/'));
        titania::page_header(phpbb::$user->lang['SUBSCRIPTION_TITANIA']);
        titania::page_footer(true, 'manage/' . $mode . '.html');
    }
コード例 #3
0
ファイル: message.php プロジェクト: kairion/customisation-db
 /**
  * Set the options in the template
  */
 public function set_in_template()
 {
     // Assign some variables to the template parser
     phpbb::$template->assign_vars(array('S_BBCODE_CHECKED' => $this->enable_bbcode ? '' : ' checked="checked"', 'S_SMILIES_CHECKED' => $this->enable_smilies ? '' : ' checked="checked"', 'S_MAGIC_URL_CHECKED' => $this->enable_magic_url ? '' : ' checked="checked"', 'BBCODE_STATUS' => sprintf(phpbb::$user->lang[$this->bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'], '<a href="' . phpbb::append_sid('faq', 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->img_status ? phpbb::$user->lang['IMAGES_ARE_ON'] : phpbb::$user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $this->flash_status ? phpbb::$user->lang['FLASH_IS_ON'] : phpbb::$user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $this->smilies_status ? phpbb::$user->lang['SMILIES_ARE_ON'] : phpbb::$user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->url_status ? phpbb::$user->lang['URL_IS_ON'] : phpbb::$user->lang['URL_IS_OFF'], 'S_BBCODE_ALLOWED' => $this->bbcode_status, 'S_SMILIES_ALLOWED' => $this->smilies_status, 'S_LINKS_ALLOWED' => $this->url_status, 'S_BBCODE_IMG' => $this->img_status, 'S_BBCODE_URL' => $this->url_status, 'S_BBCODE_FLASH' => $this->flash_status, 'S_BBCODE_QUOTE' => true));
 }
コード例 #4
0
ファイル: manage.php プロジェクト: Gfksx/customisation-db
                    titania::$contrib->change_permalink($permalink);
                }
            }
            // Submit the changes
            titania::$contrib->submit();
            // Set the coauthors
            titania::$contrib->set_coauthors($active_coauthors_list, $nonactive_coauthors_list, true);
            // Create relations
            titania::$contrib->put_contrib_in_categories($contrib_categories);
            // Update the release topic
            titania::$contrib->update_release_topic();
            if ($change_owner == '') {
                redirect(titania::$contrib->get_url());
            } else {
                $s_hidden_fields = array('submit' => true, 'change_owner' => $change_owner, 'change_owner_id' => $change_owner_id);
                titania::confirm_box(false, sprintf(phpbb::$user->lang['CONTRIB_CONFIRM_OWNER_CHANGE'], '<a href="' . phpbb::append_sid('memberlist', 'mode=viewprofile&amp;u=' . $change_owner_id) . '">' . $change_owner . '</a>'), titania_url::append_url(titania_url::$current_page), $s_hidden_fields);
            }
        }
    } else {
        $sql = 'SELECT category_id
		FROM ' . TITANIA_CONTRIB_IN_CATEGORIES_TABLE . '
		WHERE contrib_id = ' . titania::$contrib->contrib_id;
        $result = phpbb::$db->sql_query($sql);
        while ($row = phpbb::$db->sql_fetchrow($result)) {
            $contrib_categories[] = $row['category_id'];
        }
        phpbb::$db->sql_freeresult($result);
        $active_coauthors = $nonactive_coauthors = array();
        foreach (titania::$contrib->coauthors as $row) {
            // User does not exist anymore...
            if (users_overlord::get_user($row['user_id'], 'user_id') != $row['user_id']) {
コード例 #5
0
ファイル: author.php プロジェクト: Noxwizard/customisation-db
 /**
  * Get phpBB profile url
  *
  * @return string
  */
 public function get_phpbb_profile_url()
 {
     if ($this->user_id) {
         return phpbb::append_sid('memberlist', 'mode=viewprofile&amp;u=' . $this->user_id);
     }
     return '';
 }
コード例 #6
0
ファイル: manage.php プロジェクト: Elsensee/customisation-db
 /**
  * Trigger author change confirmation.
  *
  * @param string $username		New author's username.
  * @param int $user_id			New author's user id.
  *
  * @return null
  */
 protected function confirm_author_change($username, $user_id)
 {
     $s_hidden_fields = array('submit' => true, 'change_owner_id' => $user_id);
     $author_profile = '<a href="' . \phpbb::append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_id) . '">' . $username . '</a>';
     confirm_box(false, $this->user->lang('CONTRIB_CONFIRM_OWNER_CHANGE', $author_profile), build_hidden_fields($s_hidden_fields));
 }
コード例 #7
0
ファイル: email.php プロジェクト: Gfksx/customisation-db
    /**
     * Ignore this for now!
     * Moving it to the side for later...
     */
    public function email_friend()
    {
        phpbb::$user->add_lang('memberlist');
        if (!phpbb::$config['email_enable']) {
            titania::error_box('ERROR', 'EMAIL_DISABLED', TITANIA_ERROR, HEADER_SERVICE_UNAVAILABLE);
            return false;
        }
        if (!phpbb::$user->data['is_registered'] || phpbb::$user->data['is_bot'] || !phpbb::$auth->acl_get('u_sendemail')) {
            if (phpbb::$user->data['user_id'] == ANONYMOUS) {
                login_box(titania::$page, phpbb::$user->lang['ERROR_CONTRIB_EMAIL_FRIEND']);
            }
            titania::error_box('ERROR', 'ERROR_CONTRIB_EMAIL_FRIEND', TITANIA_ERROR, HEADER_FORBIDDEN);
            return false;
        }
        // Are we trying to abuse the facility?
        if (titania::$time - phpbb::$user->data['user_emailtime'] < phpbb::$config['flood_interval']) {
            trigger_error('FLOOD_EMAIL_LIMIT', E_USER_NOTICE);
        }
        $name = utf8_normalize_nfc(request_var('name', '', true));
        $email = request_var('email', '');
        $email_lang = request_var('lang', phpbb::$config['default_lang']);
        $message = utf8_normalize_nfc(request_var('message', '', true));
        $cc = isset($_POST['cc_email']) ? true : false;
        $submit = isset($_POST['submit']) ? true : false;
        add_form_key('contrib_email');
        phpbb::$template->assign_vars(array('S_LANG_OPTIONS' => language_select($email_lang), 'S_POST_ACTION' => phpbb::append_sid(titania::$page, array('id' => 'email', 'contrib_id' => $this->contrib_id))));
        $error = array();
        if ($submit) {
            if (!check_form_key('contrib_email')) {
                $error[] = 'FORM_INVALID';
            }
            if (!$email || !preg_match('/^' . get_preg_expression('email') . '$/i', $email)) {
                $error[] = 'EMPTY_ADDRESS_EMAIL';
            }
            if (!$name) {
                $error[] = 'EMPTY_NAME_EMAIL';
            }
            if (!empty($error)) {
                titania::error_box('ERROR', $error, TITANIA_ERROR);
                return false;
            }
            phpbb::_include('functions_messenger', false, 'messenger');
            $sql = 'UPDATE ' . USERS_TABLE . '
				SET user_emailtime = ' . titania::$time . '
				WHERE user_id = ' . (int) phpbb::$user->data['user_id'];
            $result = phpbb::$db->sql_query($sql);
            $mail_to_users = array();
            $mail_to_users[] = array('email_lang' => $email_lang, 'email' => $email, 'name' => $name);
            // Ok, now the same email if CC specified, but without exposing the users email address
            if ($cc) {
                $mail_to_users[] = array('email_lang' => phpbb::$user->data['user_lang'], 'email' => phpbb::$user->data['user_email'], 'name' => phpbb::$user->data['username']);
            }
            $lang_path = phpbb::$user->lang_path;
            phpbb::$user->set_custom_lang_path(titania::$config->language_path);
            $messenger = new messenger(false);
            foreach ($mail_to_users as $row) {
                $messenger->template('contrib_recommend', $row['email_lang']);
                $messenger->replyto(phpbb::$user->data['user_email']);
                $messenger->to($row['email'], $row['name']);
                $messenger->headers('X-AntiAbuse: Board servername - ' . phpbb::$config['server_name']);
                $messenger->headers('X-AntiAbuse: User_id - ' . (int) phpbb::$user->data['user_id']);
                $messenger->headers('X-AntiAbuse: Username - ' . phpbb::$user->data['username']);
                $messenger->headers('X-AntiAbuse: User IP - ' . phpbb::$user->ip);
                $messenger->assign_vars(array('BOARD_CONTACT' => phpbb::$config['board_contact'], 'TO_USERNAME' => htmlspecialchars_decode($name), 'FROM_USERNAME' => htmlspecialchars_decode(phpbb::$user->data['username']), 'MESSAGE' => htmlspecialchars_decode($message), 'CONTRIB_NAME' => htmlspecialchars_decode($this->contrib_name), 'U_CONTRIB' => phpbb::append_sid(titania::$page, array('contrib_id' => $this->contrib_id, 'id' => 'details'), true, '')));
                $messenger->send(NOTIFY_EMAIL);
            }
            phpbb::$user->set_custom_lang_path($lang_path);
            titania::error_box('SUCCESS', 'EMAIL_SENT', TITANIA_SUCCESS);
            return true;
        }
        return false;
    }
コード例 #8
0
ファイル: posts.php プロジェクト: Noxwizard/customisation-db
    /**
     * Display topic section for support/tracker/etc
     *
     * @param object $topic The topic object
     * @param titania_sort $sort The sort object (includes/tools/sort.php)
     */
    public static function display_topic($topic, $sort = false)
    {
        if ($sort === false) {
            // Setup the sort tool
            $sort = self::build_sort();
        }
        $sort->request();
        $sql_ary = array('SELECT' => 'p.*', 'FROM' => array(TITANIA_POSTS_TABLE => 'p'), 'WHERE' => 'p.topic_id = ' . (int) $topic->topic_id . self::sql_permissions('p.'), 'ORDER_BY' => $sort->get_order_by());
        // Main SQL Query
        $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
        // Handle pagination
        if (!$sort->sql_count($sql_ary, 'p.post_id')) {
            // No results...no need to query more...
            return;
        }
        $sort->build_pagination($topic->get_url());
        // Get the data
        $post_ids = $user_ids = array();
        $last_post_time = 0;
        // tracking
        $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start);
        while ($row = phpbb::$db->sql_fetchrow($result)) {
            self::$posts[$row['post_id']] = $row;
            self::$posts[$row['post_id']]['attachments'] = array();
            $post_ids[] = $row['post_id'];
            $user_ids[] = $row['post_user_id'];
            $user_ids[] = $row['post_edit_user'];
            $user_ids[] = $row['post_delete_user'];
            $last_post_time = $row['post_time'];
            // to set tracking
        }
        phpbb::$db->sql_freeresult($result);
        // Grab the tracking data
        $last_mark_time = titania_tracking::get_track(TITANIA_TOPIC, $topic->topic_id);
        // Store tracking data
        titania_tracking::track(TITANIA_TOPIC, $topic->topic_id, $last_post_time);
        // load the user data
        users_overlord::load($user_ids);
        phpbb::_include('functions_profile_fields', false, 'custom_profile');
        $cp = new custom_profile();
        $post = new titania_post($topic->topic_type, $topic);
        $attachments = new titania_attachment($topic->topic_type, false);
        // Grab all attachments
        $attachments_set = $attachments->load_attachments_set($post_ids);
        // Loop de loop
        $prev_post_time = 0;
        foreach ($post_ids as $post_id) {
            $post->__set_array(self::$posts[$post_id]);
            $attachments->clear_attachments();
            if (isset($attachments_set[$post_id])) {
                $attachments->store_attachments($attachments_set[$post_id]);
            }
            // Parse attachments before outputting the message
            $message = $post->generate_text_for_display();
            $parsed_attachments = $attachments->parse_attachments($message);
            // Prepare message text for use in javascript
            $message_decoded = censor_text($post->post_text);
            titania_decode_message($message_decoded, $post->post_text_uid);
            $message_decoded = bbcode_nl2br($message_decoded);
            // Build CP Fields
            $cp_row = array();
            if (isset(users_overlord::$cp_fields[$post->post_user_id])) {
                $cp_row = $cp->generate_profile_fields_template('show', false, users_overlord::$cp_fields[$post->post_user_id]);
            }
            $cp_row['row'] = isset($cp_row['row']) && sizeof($cp_row['row']) ? $cp_row['row'] : array();
            // Display edit info
            $display_username = get_username_string('full', $post->post_user_id, users_overlord::get_user($post->post_user_id, 'username'), users_overlord::get_user($post->post_user_id, 'user_colour'), false, phpbb::append_sid('memberlist', 'mode=viewprofile'));
            $l_edited_by = $post->post_edit_time ? sprintf(phpbb::$user->lang['EDITED_MESSAGE'], $display_username, phpbb::$user->format_date($post->post_edit_time)) : '';
            phpbb::$template->assign_block_vars('posts', array_merge($post->assign_details(false), users_overlord::assign_details($post->post_user_id), $cp_row['row'], array('POST_TEXT' => $message, 'POST_TEXT_DECODED' => $message_decoded, 'EDITED_MESSAGE' => $l_edited_by, 'U_MINI_POST' => titania_url::append_url($topic->get_url(), array('p' => $post_id, '#p' => $post_id)), 'MINI_POST_IMG' => $post->post_time > $last_mark_time ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), 'S_FIRST_UNREAD' => $post->post_time > $last_mark_time && $prev_post_time <= $last_mark_time ? true : false)));
            // Output CP Fields
            if (!empty($cp_row['blockrow'])) {
                foreach ($cp_row['blockrow'] as $field_data) {
                    phpbb::$template->assign_block_vars('posts.custom_fields', $field_data);
                }
            }
            //S_IGNORE_POST
            //POST_ICON_IMG
            //MINI_POST_IMG
            foreach ($parsed_attachments as $attachment) {
                phpbb::$template->assign_block_vars('posts.attachment', array('DISPLAY_ATTACHMENT' => $attachment));
            }
            $prev_post_time = $post->post_time;
        }
        unset($post, $attachments);
        // Increment the topic view count
        $sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
			SET topic_views = topic_views + 1
			WHERE topic_id = ' . (int) $topic->topic_id;
        phpbb::$db->sql_query($sql);
    }
コード例 #9
0
ファイル: topic.php プロジェクト: Sajaki/customisation-db
 /**
  * Assign details
  *
  * A little different from those in other classes, this one only returns the info ready for output
  */
 public function assign_details()
 {
     // Tracking check
     $last_read_mark = $this->tracking->get_track(TITANIA_TOPIC, $this->topic_id, true);
     $last_read_mark = max($last_read_mark, $this->tracking->find_last_read_mark($this->additional_unread_fields, $this->topic_type, $this->parent_id));
     $this->unread = $this->topic_last_post_time > $last_read_mark ? true : false;
     $folder_img = $folder_alt = '';
     $this->topic_folder_img($folder_img, $folder_alt);
     // To find out if we have any posts that need approval
     $approved = count::from_db($this->topic_posts, count::get_flags(access::PUBLIC_LEVEL, false, false));
     $total = count::from_db($this->topic_posts, count::get_flags(access::PUBLIC_LEVEL, false, true));
     $u_new_post = '';
     if ($this->unread) {
         $u_new_post = $this->get_url(false, array('view' => 'unread', '#' => 'unread'));
     }
     $details = array('TOPIC_ID' => $this->topic_id, 'TOPIC_TYPE' => $this->topic_type, 'TOPIC_ACCESS' => $this->topic_access, 'TOPIC_STATUS' => $this->topic_status, 'TOPIC_STICKY' => $this->topic_sticky, 'TOPIC_LOCKED' => $this->topic_locked, 'POSTS_APPROVED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') && $total > $approved ? false : true, 'TOPIC_APPROVED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->topic_approved : true, 'TOPIC_REPORTED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->topic_reported : false, 'TOPIC_ASSIGNED' => $this->topic_assigned, 'TOPIC_REPLIES' => $this->get_postcount() - 1, 'TOPIC_VIEWS' => $this->topic_views, 'TOPIC_SUBJECT' => censor_text($this->topic_subject), 'TOPIC_FIRST_POST_ID' => $this->topic_first_post_id, 'TOPIC_FIRST_POST_USER_ID' => $this->topic_first_post_user_id, 'TOPIC_FIRST_POST_USER_COLOUR' => $this->topic_first_post_user_colour, 'TOPIC_FIRST_POST_USER_FULL' => get_username_string('full', $this->topic_first_post_user_id, $this->topic_first_post_username, $this->topic_first_post_user_colour, false, phpbb::append_sid('memberlist', 'mode=viewprofile')), 'TOPIC_FIRST_POST_TIME' => phpbb::$user->format_date($this->topic_first_post_time), 'TOPIC_LAST_POST_ID' => $this->topic_last_post_id, 'TOPIC_LAST_POST_USER_ID' => $this->topic_last_post_user_id, 'TOPIC_LAST_POST_USER_COLOUR' => $this->topic_last_post_user_colour, 'TOPIC_LAST_POST_USER_FULL' => get_username_string('full', $this->topic_last_post_user_id, $this->topic_last_post_username, $this->topic_last_post_user_colour, false, phpbb::append_sid('memberlist', 'mode=viewprofile')), 'TOPIC_LAST_POST_TIME' => phpbb::$user->format_date($this->topic_last_post_time), 'TOPIC_LAST_POST_SUBJECT' => censor_text($this->topic_last_post_subject), 'U_NEWEST_POST' => $u_new_post, 'U_VIEW_TOPIC' => $this->get_url(), 'U_VIEW_LAST_POST' => $this->get_url(false, array('p' => $this->topic_last_post_id, '#' => 'p' . $this->topic_last_post_id)), 'S_UNREAD_TOPIC' => $this->unread ? true : false, 'S_ACCESS_TEAMS' => $this->topic_access == access::TEAM_LEVEL ? true : false, 'S_ACCESS_AUTHORS' => $this->topic_access == access::AUTHOR_LEVEL ? true : false, 'FOLDER_STYLE' => $folder_img, 'FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => phpbb::$user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => phpbb::$user->img($folder_img, '', false, '', 'height'));
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $details, $this);
     return $details;
 }
コード例 #10
0
                 continue;
             }
             $type = explode(':', $vars['type']);
             $l_explain = '';
             if ($vars['explain'] && isset($vars['lang_explain'])) {
                 $l_explain = isset(phpbb::$user->lang[$vars['lang_explain']]) ? phpbb::$user->lang[$vars['lang_explain']] : $vars['lang_explain'];
             } else {
                 if ($vars['explain']) {
                     $l_explain = isset(phpbb::$user->lang[$vars['lang'] . '_EXPLAIN']) ? phpbb::$user->lang[$vars['lang'] . '_EXPLAIN'] : '';
                 }
             }
             $content = build_cfg_template($type, $name, $vars);
             if (empty($content)) {
                 continue;
             }
             phpbb::$template->assign_block_vars('options', array('KEY' => $name, 'TITLE' => isset(phpbb::$user->lang[$vars['lang']]) ? phpbb::$user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content['tpl'], 'S_FIND_USER' => isset($content['find_user']) ? true : false, 'U_FIND_USER' => isset($content['find_user']) ? phpbb::append_sid('memberlist', array('mode' => 'searchuser', 'form' => 'select_user', 'field' => 'username', 'select_single' => 'true', 'form' => 'stk', 'field' => $content['find_user_field'])) : ''));
         }
         titania::page_footer(true, 'manage/tool_options.html');
     } else {
         if (is_string($options)) {
             if (titania::confirm_box(true) || isset($_GET['submit']) && check_link_hash(request_var('hash', ''), 'manage')) {
                 $tool->run_tool();
             } else {
                 titania::confirm_box(false, $options, titania_url::build_url('manage/administration', array('t' => $plugin->tool_id)));
             }
         } else {
             // The page should have been setup by the tool.  We will exit to prevent the redirect from below.
             exit;
         }
     }
 }
コード例 #11
0
ファイル: common.php プロジェクト: Noxwizard/customisation-db
if (!file_exists(PHPBB_ROOT_PATH . 'common.' . PHP_EXT)) {
    die('<p>No phpBB installation found. Check the Titania configuration file.</p>');
}
if (!defined('PHPBB_INCLUDED')) {
    require PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
}
// Initialise phpBB
phpbb::initialise();
// If the database is not installed or outdated redirect to the installer
if (!defined('IN_TITANIA_INSTALL') && (!isset(phpbb::$config['titania_version']) || version_compare(phpbb::$config['titania_version'], TITANIA_VERSION, '<'))) {
    if (phpbb::$user->data['user_type'] != USER_FOUNDER) {
        phpbb::$user->set_custom_lang_path(TITANIA_ROOT . 'language/');
        phpbb::$user->add_lang('common');
        msg_handler(E_USER_ERROR, phpbb::$user->lang['TITANIA_DISABLED'], '', '');
    }
    redirect(phpbb::append_sid(TITANIA_ROOT . 'install.' . PHP_EXT));
}
// Initialise Titania
titania::initialise();
// Allow login attempts from any page (mini login box)
if (isset($_POST['login'])) {
    phpbb::login_box();
}
// admin requested the cache to be purged, ensure they have permission and purge the cache.
if (isset($_GET['cache']) && $_GET['cache'] == 'purge' && phpbb::$auth->acl_get('a_')) {
    titania::$cache->purge();
    titania::error_box('SUCCESS', phpbb::$user->lang['CACHE_PURGED']);
}
// admin requested a sync
if (isset($_GET['sync']) && phpbb::$auth->acl_get('a_')) {
    $sync = new titania_sync();
コード例 #12
0
 /**
  * Passes details to the template
  *
  * @param bool $simple True to output a simpler version (on the non-main pages)
  */
 public function assign_details($simple = false, $return = false)
 {
     $vars = array('CONTRIB_NAME' => $this->contrib_name, 'CONTRIB_DESC' => $this->generate_text_for_display(), 'CONTRIB_VIEWS' => $this->contrib_views, 'CONTRIB_UPDATE_DATE' => $this->contrib_last_update ? phpbb::$user->format_date($this->contrib_last_update) : '', 'CONTRIB_STATUS' => $this->contrib_status, 'CONTRIB_LIMITED_SUPPORT' => $this->contrib_limited_support, 'CONTRIB_LOCAL_NAME' => $this->contrib_local_name, 'CONTRIB_ISO_CODE' => $this->contrib_iso_code, 'CONTRIB_RATING' => $this->contrib_rating, 'CONTRIB_RATING_COUNT' => $this->contrib_rating_count, 'CONTRIB_RATING_STRING' => $this->rating ? $this->rating->get_rating_string($this->get_url('rate')) : '', 'L_ANNOUNCEMENT_TOPIC' => titania::$config->support_in_titania ? phpbb::$user->lang['ANNOUNCEMENT_TOPIC'] : phpbb::$user->lang['ANNOUNCEMENT_TOPIC_SUPPORT'], 'U_VIEW_DEMO' => $this->contrib_demo, 'S_INTEGRATE_DEMO' => $this->options['demo']);
     // Ignore some stuff before it is submitted else we can cause an error
     if ($this->contrib_id) {
         foreach ($this->type->get_allowed_branches(true, false) as $branch => $name) {
             $release_topic_id = $this->get_release_topic_id($branch);
             if ($release_topic_id) {
                 phpbb::$template->assign_block_vars('announce_topic', array('URL' => phpbb::append_sid('viewtopic', 't=' . $release_topic_id), 'BRANCH' => $name));
             }
         }
         if (!empty($this->download)) {
             $this->assign_download_details();
             $vars = array_merge($vars, array('CONTRIB_DOWNLOADS' => $this->contrib_downloads));
         }
         if ($this->contrib_type == TITANIA_TYPE_BBCODE && !empty($this->download)) {
             $download = reset($this->download);
             $demo_output = $download['revision_bbc_demo'];
             $demo_rendered = false;
             if ($download['revision_status'] == TITANIA_REVISION_APPROVED && !empty($demo_output)) {
                 $demo = $this->type->get_demo()->configure($this->contrib_id, $download['revision_bbc_bbcode_usage'], $download['revision_bbc_html_replace']);
                 $demo_output = $demo->get_demo($demo_output);
                 unset($demo);
                 $demo_rendered = true;
             }
             $vars = array_merge($vars, array('CONTRIB_BBC_HTML_REPLACEMENT' => isset($download['revision_bbc_html_replace']) ? $download['revision_bbc_html_replace'] : '', 'CONTRIB_BBC_BBCODE_USAGE' => isset($download['revision_bbc_bbcode_usage']) ? $download['revision_bbc_bbcode_usage'] : '', 'CONTRIB_BBC_HELPLINE' => isset($download['revision_bbc_help_line']) ? $download['revision_bbc_help_line'] : '', 'CONTRIB_BBC_DEMO' => $demo_output, 'S_CONTRIB_BBC_DEMO_RENDERED' => $demo_rendered));
         }
         $use_queue = titania::$config->use_queue && $this->type->use_queue;
         $u_view_reports = $u_manage = $u_new_revision = $u_queue_discussion = false;
         if ($this->type->acl_get('moderate')) {
             $u_view_reports = $this->controller_helper->route('phpbb.titania.manage.attention.redirect', array('type' => TITANIA_CONTRIB, 'id' => $this->contrib_id));
         }
         if ($this->is_manageable()) {
             $u_manage = $this->get_url('manage');
             if (phpbb::$auth->acl_get('u_titania_contrib_submit')) {
                 $u_new_revision = $this->get_url('revision');
             }
         }
         if ($use_queue && $this->is_manageable('queue_discussion')) {
             $u_queue_discussion = $this->get_url('queue_discussion');
         }
         $vars = array_merge($vars, array('CONTRIB_TYPE' => $this->type->lang, 'CONTRIB_TYPE_ID' => $this->contrib_type, 'CONTRIB_TYPE_CLEAN' => $this->type->url, 'U_CONTRIB_MANAGE' => $u_manage, 'U_NEW_REVISION' => $u_new_revision, 'U_QUEUE_DISCUSSION' => $u_queue_discussion, 'U_VIEW_CONTRIB' => $this->get_url(), 'U_REPORT' => phpbb::$user->data['is_registered'] ? $this->get_url('report') : '', 'U_VIEW_REPORTS' => $u_view_reports, 'S_CONTRIB_NEW' => $this->contrib_status == TITANIA_CONTRIB_NEW ? true : false, 'S_CONTRIB_VALIDATED' => $this->contrib_status == TITANIA_CONTRIB_APPROVED ? true : false, 'S_CONTRIB_CLEANED' => $this->contrib_status == TITANIA_CONTRIB_CLEANED ? true : false, 'S_CONTRIB_DOWNLOAD_DISABLED' => $this->contrib_status == TITANIA_CONTRIB_DOWNLOAD_DISABLED ? true : false, 'S_CONTRIB_HIDDEN' => $this->contrib_status == TITANIA_CONTRIB_HIDDEN ? true : false, 'S_CONTRIB_DISABLED' => $this->contrib_status == TITANIA_CONTRIB_DISABLED ? true : false, 'JS_CONTRIB_TRANSLATION' => !empty($this->contrib_iso_code) ? 'true' : 'false'));
     }
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $vars, $this);
     // Display real author
     if ($return) {
         $vars['AUTHOR_NAME_FULL'] = $this->author->get_username_string();
     } else {
         $this->author->assign_details();
     }
     if (!$simple && !$return) {
         $active_coauthors = $past_coauthors = array();
         $author_sort = function ($a, $b) {
             return strcmp($a['AUTHOR_NAME'], $b['AUTHOR_NAME']);
         };
         // Display Co-authors
         foreach ($this->coauthors as $user_id => $row) {
             if ($row['active']) {
                 $active_coauthors[] = $this->author->assign_details(true, $row);
             } else {
                 $past_coauthors[] = $this->author->assign_details(true, $row);
             }
         }
         usort($active_coauthors, $author_sort);
         usort($past_coauthors, $author_sort);
         phpbb::$template->assign_block_vars_array('coauthors', $active_coauthors);
         phpbb::$template->assign_block_vars_array('past_coauthors', $past_coauthors);
         // Display Revisions and phpBB versions
         if (sizeof($this->revisions)) {
             $revision = new titania_revision($this);
             $revision->contrib = $this;
             $phpbb_versions = array();
             foreach ($this->revisions as $revision_id => $row) {
                 $revision->__set_array($row);
                 $revision->phpbb_versions = isset($row['phpbb_versions']) ? $row['phpbb_versions'] : array();
                 $revision->translations = isset($row['translations']) ? $revision->set_translations($row['translations']) : array();
                 $revision->display('revisions', $this->type->acl_get('view'), $this->options['all_versions']);
                 $phpbb_versions = array_merge($phpbb_versions, $revision->phpbb_versions);
             }
             unset($revision);
             $ordered_phpbb_versions = versions::order_phpbb_version_list_from_db($this->cache, $phpbb_versions, $this->options['all_versions']);
             if (sizeof($ordered_phpbb_versions) == 1) {
                 phpbb::$template->assign_vars(array('PHPBB_VERSION' => $ordered_phpbb_versions[0]));
             } else {
                 foreach ($ordered_phpbb_versions as $version_row) {
                     phpbb::$template->assign_block_vars('phpbb_versions', array('NAME' => $version_row));
                 }
             }
         }
         // Display Screenshots
         if ($this->screenshots->get_count()) {
             $message = false;
             $this->screenshots->parse_attachments($message, false, false, 'screenshots', true);
         }
         // Display categories
         $category = new titania_category();
         foreach ($this->category_data as $category_row) {
             $category->__set_array($category_row);
             phpbb::$template->assign_block_vars('categories', $category->assign_display(true));
         }
     }
     if ($return) {
         return $vars;
     }
     phpbb::$template->assign_vars($vars);
 }
コード例 #13
0
ファイル: users.php プロジェクト: Sajaki/customisation-db
 /**
  * Assign user details
  *
  * @param int $user_id
  * @param string $prefix Prefix to assign to the user details
  * @param bool $output_to_template True to output the data to the template
  */
 public static function assign_details($user_id, $prefix = '', $output_to_template = false)
 {
     $row = self::get_user($user_id);
     $user_id = $row['user_id'];
     // Re-assign properly...in case it gives us the anonymous user
     phpbb::_include('functions_display', 'phpbb_get_user_rank');
     phpbb::$user->add_lang('memberlist');
     // Get user rank
     $rank = phpbb_get_user_rank($row, $row['user_posts']);
     $output = array($prefix . 'USER_FULL' => self::get_user($user_id, '_full'), $prefix . 'USER_COLOUR' => self::get_user($user_id, '_colour'), $prefix . 'USERNAME' => self::get_user($user_id, '_username'), $prefix . 'RANK_TITLE' => $rank['title'], $prefix . 'RANK_IMG' => $rank['img'], $prefix . 'RANK_IMG_SRC' => $rank['img_src'], $prefix . 'USER_JOINED' => phpbb::$user->format_date($row['user_regdate']), $prefix . 'USER_POSTS' => $row['user_posts'], $prefix . 'USER_AVATAR' => self::get_user($user_id, '_avatar'), $prefix . 'USER_WARNINGS' => $row['user_warnings'], $prefix . 'USER_SIG' => self::get_user($user_id, '_signature'), $prefix . 'ONLINE_IMG' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] ? phpbb::$user->img('icon_user_online', 'ONLINE') : phpbb::$user->img('icon_user_offline', 'OFFLINE') : '', $prefix . 'S_ONLINE' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] : false, $prefix . 'S_FRIEND' => isset($row['friend']) ? true : false, $prefix . 'S_FOE' => isset($row['foe']) ? true : false, $prefix . 'U_USER_BOARD_PROFILE' => self::get_user($user_id, '_profile'), $prefix . 'U_SEARCH' => phpbb::$auth->acl_get('u_search') ? phpbb::append_sid('search', "author_id={$user_id}&amp;sr=posts") : '', $prefix . 'U_PM' => self::get_user($user_id, '_u_pm'), $prefix . 'U_EMAIL' => self::get_user($user_id, '_u_email'), $prefix . 'U_JABBER' => self::get_user($user_id, '_jabber'), $prefix . 'S_JABBER_ENABLED' => phpbb::$config['jab_enable'] ? true : false, $prefix . 'SEND_EMAIL_USER' => phpbb::$user->lang('SEND_EMAIL_USER', self::get_user($user_id, '_username')));
     if ($output_to_template) {
         phpbb::$template->assign_vars($output);
     }
     return $output;
 }
コード例 #14
0
 /**
  * Passes details to the template
  *
  * @param bool $simple True to output a simpler version (on the non-main pages)
  */
 public function assign_details($simple = false, $return = false)
 {
     $vars = array('CONTRIB_NAME' => $this->contrib_name, 'CONTRIB_DESC' => $this->generate_text_for_display(), 'CONTRIB_VIEWS' => $this->contrib_views, 'CONTRIB_UPDATE_DATE' => $this->contrib_last_update ? phpbb::$user->format_date($this->contrib_last_update) : '', 'CONTRIB_STATUS' => $this->contrib_status, 'CONTRIB_LOCAL_NAME' => $this->contrib_local_name, 'CONTRIB_ISO_CODE' => $this->contrib_iso_code, 'CONTRIB_RATING' => $this->contrib_rating, 'CONTRIB_RATING_COUNT' => $this->contrib_rating_count, 'CONTRIB_RATING_STRING' => $this->rating ? $this->rating->get_rating_string() : '', 'CONTRIB_ANNOUNCEMENT_TOPIC' => $this->contrib_release_topic_id ? sprintf(phpbb::$user->lang['ANNOUNCEMENT_TOPIC_VIEW'], '<a href="' . phpbb::append_sid('viewtopic', 't=' . $this->contrib_release_topic_id) . '">', '</a>') : false, 'L_ANNOUNCEMENT_TOPIC' => titania::$config->support_in_titania ? phpbb::$user->lang['ANNOUNCEMENT_TOPIC'] : phpbb::$user->lang['ANNOUNCEMENT_TOPIC_SUPPORT'], 'CONTRIB_DOWNLOADS' => $this->contrib_downloads, 'DOWNLOAD_SIZE' => isset($this->download['filesize']) ? get_formatted_filesize($this->download['filesize']) : '', 'DOWNLOAD_CHECKSUM' => isset($this->download['hash']) ? $this->download['hash'] : '', 'DOWNLOAD_NAME' => isset($this->download['revision_name']) ? censor_text($this->download['revision_name']) : '', 'DOWNLOAD_VERSION' => isset($this->download['revision_version']) ? censor_text($this->download['revision_version']) : '', 'DOWNLOAD_LICENSE' => isset($this->download['revision_license']) ? censor_text($this->download['revision_license']) : '', 'U_VIEW_DEMO' => $this->contrib_demo);
     // Ignore some stuff before it is submitted else we can cause an error
     if ($this->contrib_id) {
         $vars = array_merge($vars, array('CONTRIB_TYPE' => titania_types::$types[$this->contrib_type]->lang, 'CONTRIB_TYPE_ID' => $this->contrib_type, 'U_CONTRIB_MANAGE' => ($this->is_author || $this->is_active_coauthor) && !in_array($this->contrib_status, array(TITANIA_CONTRIB_CLEANED, TITANIA_CONTRIB_DISABLED)) || titania_types::$types[$this->contrib_type]->acl_get('moderate') ? $this->get_url('manage') : '', 'U_DOWNLOAD' => isset($this->download['attachment_id']) ? titania_url::build_url('download', array('id' => $this->download['attachment_id'])) : '', 'U_NEW_REVISION' => ($this->is_author || $this->is_active_coauthor) && !in_array($this->contrib_status, array(TITANIA_CONTRIB_CLEANED, TITANIA_CONTRIB_DISABLED)) || titania_types::$types[$this->contrib_type]->acl_get('moderate') ? $this->get_url('revision') : '', 'U_QUEUE_DISCUSSION' => titania::$config->use_queue && titania_types::$types[$this->contrib_type]->use_queue && (($this->is_author || $this->is_active_coauthor) && !in_array($this->contrib_status, array(TITANIA_CONTRIB_CLEANED, TITANIA_CONTRIB_DISABLED)) || titania_types::$types[$this->contrib_type]->acl_get('queue_discussion')) ? $this->get_url('queue_discussion') : '', 'U_VIEW_CONTRIB' => $this->get_url(), 'U_REPORT' => phpbb::$user->data['is_registered'] ? $this->get_url('report') : '', 'U_INFO' => titania_types::$types[$this->contrib_type]->acl_get('moderate') ? titania_url::build_url('manage/attention', array('type' => TITANIA_CONTRIB, 'id' => $this->contrib_id)) : '', 'S_CONTRIB_NEW' => titania_types::$types[$this->contrib_type]->use_queue && titania::$config->use_queue && $this->contrib_status == TITANIA_CONTRIB_NEW ? true : false, 'S_CONTRIB_VALIDATED' => !titania_types::$types[$this->contrib_type]->use_queue || !titania::$config->use_queue || $this->contrib_status == TITANIA_CONTRIB_APPROVED ? true : false, 'S_CONTRIB_CLEANED' => $this->contrib_status == TITANIA_CONTRIB_CLEANED ? true : false, 'S_CONTRIB_DOWNLOAD_DISABLED' => $this->contrib_status == TITANIA_CONTRIB_DOWNLOAD_DISABLED ? true : false, 'S_CONTRIB_HIDDEN' => $this->contrib_status == TITANIA_CONTRIB_HIDDEN ? true : false, 'S_CONTRIB_DISABLED' => $this->contrib_status == TITANIA_CONTRIB_DISABLED ? true : false, 'JS_CONTRIB_TRANSLATION' => !empty($this->contrib_iso_code) ? 'true' : 'false'));
     }
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $vars, $this);
     // Display real author
     if ($return) {
         $vars = array_merge($vars, $this->author->assign_details(true));
     } else {
         $this->author->assign_details();
     }
     if (!$simple) {
         if (!$return) {
             // Display Co-authors
             foreach ($this->coauthors as $user_id => $row) {
                 if ($row['author_visible']) {
                     phpbb::$template->assign_block_vars('coauthors', $this->author->assign_details(true, $row));
                 }
             }
             // Display Revisions and phpBB versions
             if (sizeof($this->revisions)) {
                 $revision = new titania_revision($this);
                 $revision->contrib = $this;
                 foreach ($this->revisions as $revision_id => $row) {
                     $revision->__set_array($row);
                     $revision->phpbb_versions = isset($row['phpbb_versions']) ? $row['phpbb_versions'] : array();
                     $revision->translations = isset($row['translations']) ? $row['translations'] : array();
                     $revision->display('revisions', titania_types::$types[$this->contrib_type]->acl_get('view'));
                     $phpbb_versions[] = $revision->phpbb_versions[0];
                 }
                 unset($revision);
                 $ordered_phpbb_versions = order_phpbb_version_list_from_db($phpbb_versions);
                 if (sizeof($ordered_phpbb_versions) == 1) {
                     phpbb::$template->assign_vars(array('PHPBB_VERSION' => $ordered_phpbb_versions[0]));
                 } else {
                     foreach ($ordered_phpbb_versions as $version_row) {
                         phpbb::$template->assign_block_vars('phpbb_versions', array('NAME' => $version_row));
                     }
                 }
             }
             // Display Screenshots
             if ($this->screenshots) {
                 $this->screenshots->parse_attachments($message = false, false, false, 'screenshots');
             }
         }
     }
     if ($return) {
         return $vars;
     }
     phpbb::$template->assign_vars($vars);
 }
コード例 #15
0
ファイル: users.php プロジェクト: Gfksx/customisation-db
 /**
  * Assign user details
  *
  * @param int $user_id
  * @param string $prefix Prefix to assign to the user details
  * @param bool $output_to_template True to output the data to the template
  */
 public static function assign_details($user_id, $prefix = '', $output_to_template = false)
 {
     $row = self::get_user($user_id);
     $user_id = $row['user_id'];
     // Re-assign properly...in case it gives us the anonymous user
     phpbb::_include('functions_display', 'get_user_rank');
     // IT'S A HACK!
     global $phpbb_root_path;
     $phpbb_root_path = titania::$absolute_board;
     // Get user rank and avatar (need hacks for this)
     get_user_rank($row['user_rank'], $row['user_posts'], $row['rank_title'], $row['rank_image'], $row['rank_image_src']);
     // Undo
     $phpbb_root_path = PHPBB_ROOT_PATH;
     $output = array($prefix . 'USER_FULL' => self::get_user($user_id, '_full'), $prefix . 'USER_COLOUR' => self::get_user($user_id, '_colour'), $prefix . 'USERNAME' => self::get_user($user_id, '_username'), $prefix . 'RANK_TITLE' => $row['rank_title'], $prefix . 'RANK_IMG' => $row['rank_image'], $prefix . 'RANK_IMG_SRC' => $row['rank_image_src'], $prefix . 'USER_JOINED' => phpbb::$user->format_date($row['user_regdate']), $prefix . 'USER_POSTS' => $row['user_posts'], $prefix . 'USER_FROM' => $row['user_from'], $prefix . 'USER_AVATAR' => self::get_user($user_id, '_avatar'), $prefix . 'USER_WARNINGS' => $row['user_warnings'], $prefix . 'USER_SIG' => self::get_user($user_id, '_signature'), $prefix . 'ICQ_STATUS_IMG' => self::get_user($user_id, '_icq_status'), $prefix . 'ONLINE_IMG' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] ? phpbb::$user->img('icon_user_online', 'ONLINE') : phpbb::$user->img('icon_user_offline', 'OFFLINE') : '', $prefix . 'S_ONLINE' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] : false, $prefix . 'S_FRIEND' => isset($row['friend']) ? true : false, $prefix . 'S_FOE' => isset($row['foe']) ? true : false, $prefix . 'U_USER_PROFILE' => self::get_user($user_id, '_profile'), $prefix . 'U_SEARCH' => phpbb::$auth->acl_get('u_search') ? phpbb::append_sid('search', "author_id={$user_id}&amp;sr=posts") : '', $prefix . 'U_PM' => self::get_user($user_id, '_u_pm'), $prefix . 'U_EMAIL' => self::get_user($user_id, '_u_email'), $prefix . 'U_WWW' => $row['user_website'], $prefix . 'U_ICQ' => self::get_user($user_id, '_icq'), $prefix . 'U_AIM' => self::get_user($user_id, '_aim'), $prefix . 'U_MSN' => self::get_user($user_id, '_msnm'), $prefix . 'U_YIM' => self::get_user($user_id, '_yim'), $prefix . 'U_JABBER' => self::get_user($user_id, '_jabber'));
     if ($output_to_template) {
         phpbb::$template->assign_vars($output);
     }
     return $output;
 }