diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2003-04-10 21:35:31 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2003-04-10 21:35:31 +0000 |
| commit | 3616d540947c67ea020c66d36518c792429bc163 (patch) | |
| tree | 93dd295a1f5f88984a3b4b6a80c7097d0059628f /phpBB/includes | |
| parent | f2d09291474030c949a19e823d83fb62c09a0b54 (diff) | |
| download | forums-3616d540947c67ea020c66d36518c792429bc163.tar forums-3616d540947c67ea020c66d36518c792429bc163.tar.gz forums-3616d540947c67ea020c66d36518c792429bc163.tar.bz2 forums-3616d540947c67ea020c66d36518c792429bc163.tar.xz forums-3616d540947c67ea020c66d36518c792429bc163.zip | |
initial 'view attachments' implementation. added new template var (merged include, to preserve previous block vars), could be changed later to consider caching. some config variables and upload icons are not present as of yet...
git-svn-id: file:///svn/phpbb/trunk@3807 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/functions.php | 1 | ||||
| -rw-r--r-- | phpBB/includes/functions_posting.php | 6 | ||||
| -rw-r--r-- | phpBB/includes/message_parser.php | 8 | ||||
| -rw-r--r-- | phpBB/includes/template.php | 25 |
4 files changed, 32 insertions, 8 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index fd9ae37841..cbce502231 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -796,6 +796,7 @@ function obtain_attach_extensions(&$extensions) { $extension = strtolower(trim($row['extension'])); + $extensions['_allowed_'][] = $extension; $extensions[$extension]['display_cat'] = intval($row['cat_id']); $extensions[$extension]['download_mode'] = intval($row['download_mode']); $extensions[$extension]['upload_icon'] = trim($row['upload_icon']); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index eea3c611ca..3eaefe1b1b 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -574,7 +574,7 @@ function format_display($message, $html, $bbcode, $uid, $url, $smilies, $sig) // Signature $user_sig = ($sig && $config['allow_sig']) ? trim($user->data['user_sig']) : ''; - if ($user_sig != '' && $auth->acl_gets('f_sigs', 'm_', 'a_', $forum_id)) + if ($user_sig != '' && $auth->acl_get('f_sigs', $forum_id)) { if (!$auth->acl_get('f_html', $forum_id) && $user->data['user_allowhtml']) { @@ -733,7 +733,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_ 'topic_title' => stripslashes($subject), 'topic_time' => $current_time, 'topic_type' => $topic_type, - 'topic_approved' => (($post_data['enable_moderate']) && !$auth->acl_gets('f_ignorequeue', 'm_', 'a_', $post_data['forum_id'])) ? 0 : 1, + 'topic_approved' => (($post_data['enable_moderate']) && !$auth->acl_get('f_ignorequeue', $post_data['forum_id'])) ? 0 : 1, 'icon_id' => $post_data['icon_id'], 'topic_attachment' => (sizeof($attachment_data['physical_filename'])) ? 1 : 0, 'topic_poster' => intval($user->data['user_id']), @@ -765,7 +765,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_ 'icon_id' => $post_data['icon_id'], 'poster_ip' => $user->ip, 'post_time' => $current_time, - 'post_approved' => ($post_data['enable_moderate'] && !$auth->acl_gets('f_ignorequeue', 'm_', 'a_', $post_data['forum_id'])) ? 0 : 1, + 'post_approved' => ($post_data['enable_moderate'] && !$auth->acl_get('f_ignorequeue', $post_data['forum_id'])) ? 0 : 1, 'post_edit_time' => ($mode == 'edit' && $post_data['poster_id'] == $user->data['user_id']) ? $current_time : 0, 'enable_sig' => $post_data['enable_sig'], 'enable_bbcode' => $post_data['enable_bbcode'], diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index e18abd6ce1..fcbc470b93 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -179,8 +179,6 @@ class parse_message { global $config, $_FILE, $_POST, $auth, $user; - $config['max_attachments'] = 1; - $error = false; $error_msg = ''; @@ -194,7 +192,7 @@ class parse_message if ( $submit && ($mode == 'post' || $mode == 'reply' || $mode == 'edit') && $attachment_data['filename'] != '') { - if ( $num_attachments < $config['max_attachments'] || $auth->acl_get('m_', 'a_') ) + if ( $num_attachments < $config['max_attachments'] ) //|| $auth->acl_gets('m_', 'a_', $forum_id) ) { $filedata = upload_attachment($attachment_data['filename']); @@ -326,7 +324,7 @@ class parse_message if ((($add_file) || ($preview) ) && ($attachment_data['filename'] != '') ) { - if ( $num_attachments < $config['max_attachments'] || $auth->acl_get('m_', 'a_') ) + if ( $num_attachments < $config['max_attachments'] ) //|| $auth->acl_gets('m_', 'a_', $forum_id) ) { $filedata = upload_attachment($attachment_data['filename']); @@ -372,7 +370,7 @@ class parse_message $err_msg = ''; // Process poll options - if (!empty($poll_data['poll_option_text']) && (($auth->acl_get('f_poll', $forum_id) && !$poll_data['poll_last_vote']) || $auth->acl_gets('m_edit', 'a_', $forum_id))) + if (!empty($poll_data['poll_option_text']) && (($auth->acl_get('f_poll', $forum_id) && !$poll_data['poll_last_vote']) || $auth->acl_get('m_edit', $forum_id))) { if (($result = $this->parse($poll_data['poll_option_text'], $poll_data['enable_html'], $poll_data['enable_bbcode'], $poll_data['bbcode_uid'], $poll_data['enable_urls'], $poll_data['enable_smilies'], false)) != '') { diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index ceee724c81..079a40c0fe 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -247,6 +247,23 @@ class Template { } } + function merge_from_include($filename) + { + $handle = 'include_' . $this->include_counter++; + + $this->filename[$handle] = $filename; + $this->files[$handle] = $this->make_filename($filename); + + if (!file_exists($this->files[$handle])) + { + trigger_error("Template->pparse(): Couldn't load template file for handle $handle", E_USER_ERROR); + } + + $content = implode('', @file($this->files[$handle])); + + return ($content); + } + /** * Root-level variable assignment. Adds to current assignments, overriding * any existing variable assignment with the same name. @@ -323,6 +340,14 @@ class Template { */ function compile($code, $do_not_echo = false, $retvar = '') { + // Pull out all merging includes, to let them parse with the code + preg_match_all('#<!-- MERGE_INCLUDE(.*?)-->#s', $code, $matches); + $merge_blocks = $matches[1]; + foreach($merge_blocks as $filename) + { + $code = preg_replace('#<!-- MERGE_INCLUDE ' . preg_quote(trim($filename)) . ' -->#s', $this->merge_from_include(trim($filename)), $code); + } + // Pull out all block/statement level elements and seperate // plain text preg_match_all('#<!-- PHP -->(.*?)<!-- ENDPHP -->#s', $code, $matches); |
