Utente:Genuzzo/ATTENZIONERADIATTIVO: differenze tra le versioni

nessun oggetto della modifica
(Creata pagina con 'function QuoteFast() { global $modSettings, $user_info, $txt, $settings, $context; global $sourcedir, $smcFunc; loadLanguage('Post'); if (!isset($_REQUEST['xml'])) loadTem...')
 
Nessun oggetto della modifica
 
Riga 1:
function QuoteFast()
{
global $modSettings, $user_info, $txt, $settings, $context;
global $sourcedir, $smcFunc;
{
 
loadLanguage('Post');
if (!isset($_REQUEST['xml']))
loadTemplate('Post');
}
 
include_once($sourcedir . '/Subs-Post.php');
{
 
$moderate_boards = boardsAllowedTo('moderate_board');
}
 
// Where we going if we need to?
$context['post_box_name'] = isset($_GET['pb']) ? $_GET['pb'] : '';
 
$request = $smcFunc['db_query']('', '
SELECT IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time, m.body, m.id_topic, m.subject,
m.id_board, m.id_member, m.approved
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board AND {query_see_board})
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_msg = {int:id_msg}' . (isset($_REQUEST['modify']) || (!empty($moderate_boards) && $moderate_boards[0] == 0) ? '' : '
AND (t.locked = {int:not_locked}' . (empty($moderate_boards) ? '' : ' OR b.id_board IN ({array_int:moderation_board_list})') . ')') . '
LIMIT 1',
array(
'current_member' => $user_info['id'],
'moderation_board_list' => $moderate_boards,
'id_msg' => (int) $_REQUEST['quote'],
'not_locked' => 0,
)
)
);
);
$context['close_window'] = $smcFunc['db_num_rows']($request) == 0;
$row = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);
 
$context['sub_template'] = 'quotefast';
if (!empty($row))
$can_view_post = $row['approved'] || ($row['id_member'] != 0 && $row['id_member'] == $user_info['id']) || allowedTo('approve_posts', $row['id_board']);
 
if (!empty($can_view_post))
{
{
// Remove special formatting we don't want anymore.
$row['body'] = un_preparsecode($row['body']);
 
// Censor the message!
censorText($row['body']);
 
$row['body'] = preg_replace('~<br ?/?' . '>~i', "\n", $row['body']);
 
// Want to modify a single message by double clicking it?
if (isset($_REQUEST['modify']))
{
{
censorText($row['subject']);
 
$context['sub_template'] = 'modifyfast';
$context['message'] = array(
'id' => $_REQUEST['quote'],
'body' => $row['body'],
'subject' => addcslashes($row['subject'], '"'),
);
);
 
return;
}
}
 
// Remove any nested quotes.
if (!empty($modSettings['removeNestedQuotes']))
$row['body'] = preg_replace(array('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '~^\n~', '~\[/quote\]~'), '', $row['body']);
 
// Make the body HTML if need be.
if (!empty($_REQUEST['mode']))
{
{
require_once($sourcedir . '/Subs-Editor.php');
$row['body'] = strtr($row['body'], array('&lt;' => '#smlt#', '&gt;' => '#smgt#', '&amp;' => '#smamp#'));
$row['body'] = bbc_to_html($row['body']);
$lb = '<br />';
}
}
else
else
$lb = "\n";
 
// Add a quote string on the front and end.
$context['quote']['xml'] = '[quote author=' . $row['poster_name'] . ' link=topic=' . $row['id_topic'] . '.msg' . (int) $_REQUEST['quote'] . '#msg' . (int) $_REQUEST['quote'] . ' date=' . $row['poster_time'] . ']' . $lb . $row['body'] . $lb . '[/quote]';
$context['quote']['text'] = strtr(un_htmlspecialchars($context['quote']['xml']), array('\'' => '\\\'', '\\' => '\\\\', "\n" => '\\n', '</script>' => '</\' + \'script>'));
$context['quote']['xml'] = strtr($context['quote']['xml'], array('&nbsp;' => '&#160;', '<' => '&lt;', '>' => '&gt;'));
 
$context['quote']['mozilla'] = strtr($smcFunc['htmlspecialchars']($context['quote']['text']), array('&quot;' => '"'));
}
}
// !!! Needs a nicer interface.
// In case our message has been removed in the meantime.
elseif (isset($_REQUEST['modify']))
{
{
$context['sub_template'] = 'modifyfast';
$context['message'] = array(
'id' => 0,
'body' => '',
'subject' => '',
);
);
}
}
else
$context['quote'] = array(
'xml' => '',
'mozilla' => '',
'text' => '',
);
);
}
0

contributi