- tiny bugfixes. ;)

git-svn-id: file:///svn/phpbb/trunk@5296 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-11-08 19:29:20 +00:00
parent 8a965db7aa
commit a484161be2
6 changed files with 73 additions and 31 deletions

View file

@ -1744,8 +1744,8 @@ function page_header($page_title = '')
$l_privmsgs_text = $l_privmsgs_text_unread = '';
$s_privmsg_new = false;
// Obtain number of new private messages if user is logged in, not if in trigger_error
if (!defined('IN_ERROR_HANDLER') && $user->data['is_registered'])
// Obtain number of new private messages if user is logged in
if ($user->data['is_registered'])
{
if ($user->data['user_new_privmsg'])
{

View file

@ -923,9 +923,9 @@ class user extends session
// - add appropiate variables here, name them as they are used within the language file...
if (!$use_db)
{
if ( (@include $this->lang_path . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx") === FALSE )
if ((include($this->lang_path . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx")) === false)
{
trigger_error("Language file " . $this->lang_path . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx" . " couldn't be opened.");
trigger_error("Language file {$this->lang_path}" . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx couldn't be opened.");
}
}
else if ($use_db)

View file

@ -275,10 +275,10 @@ class template
$str = &$str[sizeof($str) - 1];
}
$vararray['S_ROW_COUNT'] = sizeof($str[$blocks[$blockcount]]);
$vararray['S_ROW_COUNT'] = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0;
// Assign S_FIRST_ROW
if (sizeof($str[$blocks[$blockcount]]) == 0)
if (!isset($str[$blocks[$blockcount]]) || sizeof($str[$blocks[$blockcount]]) == 0)
{
$vararray['S_FIRST_ROW'] = true;
}
@ -286,7 +286,7 @@ class template
// Now the tricky part, we always assign S_LAST_ROW and remove the entry before
// This is much more clever than going through the complete template data on display (phew)
$vararray['S_LAST_ROW'] = true;
if (sizeof($str[$blocks[$blockcount]]) > 0)
if (isset($str[$blocks[$blockcount]]) && sizeof($str[$blocks[$blockcount]]) > 0)
{
unset($str[$blocks[$blockcount]][sizeof($str[$blocks[$blockcount]]) - 1]['S_LAST_ROW']);
}
@ -299,17 +299,17 @@ class template
else
{
// Top-level block.
$vararray['S_ROW_COUNT'] = sizeof($this->_tpldata[$blockname]);
$vararray['S_ROW_COUNT'] = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
// Assign S_FIRST_ROW
if (sizeof($this->_tpldata[$blockname]) == 0)
if (!isset($this->_tpldata[$blockname]) || sizeof($this->_tpldata[$blockname]) == 0)
{
$vararray['S_FIRST_ROW'] = true;
}
// We always assign S_LAST_ROW and remove the entry before
$vararray['S_LAST_ROW'] = true;
if (sizeof($this->_tpldata[$blockname]) > 0)
if (isset($this->_tpldata[$blockname]) && sizeof($this->_tpldata[$blockname]) > 0)
{
unset($this->_tpldata[$blockname][sizeof($this->_tpldata[$blockname]) - 1]['S_LAST_ROW']);
}
@ -635,8 +635,8 @@ class template
$text_blocks = preg_replace('#\{L_([A-Z0-9\-_]*?)\}#e', "'<?php echo ((isset(\$this->_tpldata[\'.\'][0][\'L_\\1\'])) ? \$this->_tpldata[\'.\'][0][\'L_\\1\'] : \'' . ((isset(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '') . '\'); ?>'" , $text_blocks);
}
$text_blocks = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "<?php echo \$this->_tpldata['.'][0]['\\1']; ?>", $text_blocks);
$text_blocks = preg_replace('#\{\$([a-z0-9\-_]*?)\}#is', "<?php echo \$this->_tpldata['DEFINE']['.']['\\1']; ?>", $text_blocks);
$text_blocks = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "<?php echo (isset(\$this->_tpldata['.'][0]['\\1'])) ? \$this->_tpldata['.'][0]['\\1'] : ''; ?>", $text_blocks);
$text_blocks = preg_replace('#\{\$([a-z0-9\-_]*?)\}#is', "<?php echo (isset(\$this->_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks);
return;
}
@ -709,13 +709,13 @@ class template
return $tag_template_php;
}
//
// Compile IF tags - much of this is from Smarty with
// some adaptions for our block level methods
//
/**
* Compile IF tags - much of this is from Smarty with
* some adaptions for our block level methods
*/
function compile_tag_if($tag_args, $elseif)
{
/* Tokenize args for 'if' tag. */
// Tokenize args for 'if' tag.
preg_match_all('/(?:
"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" |
\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' |
@ -823,7 +823,8 @@ class template
}
else if (preg_match('#^\.((([a-z0-9\-_]+)?\.?)+?)$#s', $token, $varrefs))
{
$token = 'sizeof(' . $this->generate_block_data_ref($varrefs[1], false) . ')';
$_tok = $this->generate_block_data_ref($varrefs[1], false);
$token = "(isset($_tok) && sizeof($_tok))";
}
break;

View file

@ -100,6 +100,7 @@ class ucp_pm
'U_INBOX' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;folder=inbox")
);
$tpl_file = 'ucp_pm_popup';
break;
// Compose message
@ -251,7 +252,7 @@ class ucp_pm
}
$message_row = array();
if ($mode == 'view' && $action == 'view_message' && $msg_id)
if ($action == 'view_message' && $msg_id)
{
// Get Message user want to see
@ -384,4 +385,35 @@ class ucp_pm
}
}
/**
* @package module_install
*/
class ucp_pm_info
{
function module()
{
return array(
'filename' => 'ucp_pm',
'title' => 'UCP_PM',
'version' => '1.0.0',
'modes' => array(
'view' => array('title' => 'UCP_PM_VIEW', 'auth' => 'cfg_allow_privmsg'),
'compose' => array('title' => 'UCP_PM_COMPOSE', 'auth' => 'cfg_allow_privmsg'),
'unread' => array('title' => 'UCP_PM_UNREAD', 'auth' => 'cfg_allow_privmsg'),
'drafts' => array('title' => 'UCP_PM_DRAFTS', 'auth' => 'cfg_allow_privmsg'),
'options' => array('title' => 'UCP_PM_OPTIONS', 'auth' => 'cfg_allow_privmsg'),
'popup' => array('title' => 'UCP_PM_POPUP_TITLE', 'auth' => 'cfg_allow_privmsg', 'display' => 0),
),
);
}
function install()
{
}
function uninstall()
{
}
}
?>

View file

@ -99,7 +99,7 @@ function compose_pm($id, $mode, $action)
if ($action == 'quotepost')
{
$sql = 'SELECT p.post_text as message_text, p.poster_id as author_id, p.post_time as message_time, p.bbcode_bitfield, p.bbcode_uid, p.enable_sig, p.enable_html, p.enable_smilies, p.enable_magic_url, t.topic_title as message_subject, u.username as quote_username
$sql = 'SELECT p.post_id as msg_id, p.post_text as message_text, p.poster_id as author_id, p.post_time as message_time, p.bbcode_bitfield, p.bbcode_uid, p.enable_sig, p.enable_html, p.enable_smilies, p.enable_magic_url, t.topic_title as message_subject, u.username as quote_username
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u
WHERE p.post_id = $msg_id
AND t.topic_id = p.topic_id
@ -179,15 +179,17 @@ function compose_pm($id, $mode, $action)
$msg_id = (int) $post['msg_id'];
$enable_urls = $post['enable_magic_url'];
$enable_sig = (isset($post['enable_sig'])) ? $post['enable_sig'] : 0;
$message_attachment = $post['message_attachement'];
$message_attachment = (isset($post['message_attachement'])) ? $post['message_attachement'] : 0;
$message_text = $post['message_text'];
$message_subject = $post['message_subject'];
$quote_username = $post['quote_username'];
$message_time = $post['message_time'];
$icon_id = $post['icon_id'];
$folder_id = $post['folder_id'];
$icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0;
$folder_id = (isset($post['folder_id'])) ? $post['folder_id'] : 0;
$bbcode_uid = $post['bbcode_uid'];
if (!$post['author_id'] && $msg_id)
{
@ -204,8 +206,15 @@ function compose_pm($id, $mode, $action)
$address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address']));
}
if ($action == 'quotepost')
{
$check_value = 0;
}
else
{
$check_value = (($post['enable_html']+1) << 16) + (($post['enable_bbcode']+1) << 8) + (($post['enable_smilies']+1) << 4) + (($enable_urls+1) << 2) + (($post['enable_sig']+1) << 1);
}
}
else
{
$message_attachment = 0;
@ -308,7 +317,7 @@ function compose_pm($id, $mode, $action)
$db->sql_freeresult($result);
}
if (!in_array($action, array('quote', 'quotepost', 'edit', 'delete', 'forward')))
if (!in_array($action, array('quote', 'edit', 'delete', 'forward')))
{
$enable_sig = ($config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('attachsig'));
$enable_smilies = ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies'));
@ -578,7 +587,7 @@ function compose_pm($id, $mode, $action)
}
// Decode text for message display
$bbcode_uid = (($action == 'quote' || $action == 'forward' || $action == 'quotepost') && !$preview && !$refresh && !sizeof($error)) ? $bbcode_uid : $message_parser->bbcode_uid;
$bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && !sizeof($error)) ? $bbcode_uid : $message_parser->bbcode_uid;
$message_parser->decode_message($bbcode_uid);
@ -603,7 +612,7 @@ function compose_pm($id, $mode, $action)
if ($action == 'forward' && !$preview && !$refresh)
{
$fwd_to_field = write_pm_addresses(array('to' => $to_address), 0, true);
$fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true);
$forward_text = array();
$forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE'];
@ -612,7 +621,7 @@ function compose_pm($id, $mode, $action)
$forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username);
$forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to']));
$message_parser->message = implode("\n", $forward_text) . "\n\n[quote=\"[url=" . generate_board_url() . "/memberlist.$phpEx$SID&mode=viewprofile&u={$author_id}]{$quote_username}[/url]\"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";
$message_parser->message = implode("\n", $forward_text) . "\n\n[quote=\"[url=" . generate_board_url() . "/memberlist.$phpEx$SID&mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]\"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";
$message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject);
}

View file

@ -341,7 +341,7 @@ if ($stage == 0)
$php_version = phpversion();
if (version_compare($php_version, '4.1.0') < 0)
if (version_compare($php_version, '4.3.3') < 0)
{
$passed['db'] = false;
echo '<b style="color:red">' . $lang['NO'] . '</b>';