本文整理汇总了PHP中phorum_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_hook函数的具体用法?PHP phorum_hook怎么用?PHP phorum_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phorum_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phorum_mod_editor_tools_common
/**
* Adds the javascript and CSS for the editor tools to the page header.
* Sets up internal datastructures for the editor tools module.
* Allows other modules to register their editor tool buttons.
*/
function phorum_mod_editor_tools_common()
{
$lang = $GLOBALS["PHORUM"]["DATA"]["LANG"]["mod_editor_tools"];
// Initialize the tool data array.
$GLOBALS["PHORUM"]["MOD_EDITOR_TOOLS"] = array("DO_TOOLS" => false, "STARTED" => false, "TOOLS" => array(), "JSLIBS" => array(), "HELP_CHAPTERS" => array(), "TRANSLATIONS" => $lang);
// Add a help tool. We add it as the first tool, so we can
// shift it nicely to the right side of the page using CSS float.
if (!empty($GLOBALS["PHORUM"]["mod_editor_tools"]["enable_help"])) {
editor_tools_register_tool('help', $lang['help']);
}
// Give other modules a chance to setup their plugged in
// editor tools. This is done through a standard hook call.
if (isset($GLOBALS["PHORUM"]["hooks"]["editor_tool_plugin"])) {
phorum_hook('editor_tool_plugin');
}
// Keep track that the editor tools have been setup. From here
// on, the API calls for registering tools, javascript libraries
// help chapters and language strings are no longer allowed.
$PHORUM["MOD_EDITOR_TOOLS"]["STARTED"] = true;
}
示例2: phorum_date
}
if ($PHORUM["track_user_activity"] && (!empty($PHORUM["user"]["admin"]) || phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_MESSAGES) || phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_USERS) || !$user["hide_activity"])) {
$PHORUM["DATA"]["PROFILE"]["raw_date_last_active"] = $PHORUM["DATA"]["PROFILE"]["date_last_active"];
$PHORUM["DATA"]["PROFILE"]["date_last_active"] = phorum_date($PHORUM['short_date_time'], $PHORUM["DATA"]["PROFILE"]["date_last_active"]);
} else {
unset($PHORUM["DATA"]["PROFILE"]["date_last_active"]);
}
$PHORUM["DATA"]["PROFILE"]["posts"] = number_format($PHORUM["DATA"]["PROFILE"]["posts"], 0, "", $PHORUM["thous_sep"]);
$PHORUM["DATA"]["PROFILE"]["URL"]["PM"] = phorum_get_url(PHORUM_PM_URL, "page=send", "to_id=" . urlencode($user["user_id"]));
$PHORUM["DATA"]["PROFILE"]["URL"]["ADD_BUDDY"] = phorum_get_url(PHORUM_PM_URL, "page=buddies", "action=addbuddy", "addbuddy_id=" . urlencode($user["user_id"]));
$PHORUM["DATA"]["PROFILE"]["is_buddy"] = phorum_db_pm_is_buddy($user["user_id"]);
// unset($PHORUM["DATA"]["PROFILE"]["signature"]);
$PHORUM["DATA"]["PROFILE"]["URL"]["SEARCH"] = phorum_get_url(PHORUM_SEARCH_URL, "author=" . urlencode($PHORUM["DATA"]["PROFILE"]["user_id"]), "match_type=USER_ID", "match_dates=0", "match_threads=0");
$PHORUM["DATA"]["PROFILE"]["username"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["username"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
if (isset($PHORUM["DATA"]["PROFILE"]["real_name"])) {
$PHORUM["DATA"]["PROFILE"]["real_name"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["real_name"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
}
if (empty($PHORUM["custom_display_name"])) {
$PHORUM["DATA"]["PROFILE"]["display_name"] = htmlspecialchars($PHORUM["DATA"]["PROFILE"]["display_name"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
}
if (isset($PHORUM["hooks"]["profile"])) {
$PHORUM["DATA"]["PROFILE"] = phorum_hook("profile", $PHORUM["DATA"]["PROFILE"]);
}
$PHORUM["DATA"]["HEADING"] = $PHORUM["DATA"]["LANG"]["UserProfile"];
$PHORUM["DATA"]["DESCRIPTION"] = "";
$PHORUM['DATA']['HTML_DESCRIPTION'] = '';
// fill the breadcrumbs-info.
$PHORUM['DATA']['BREADCRUMBS'][] = array('URL' => '', 'TEXT' => strip_tags($PHORUM["DATA"]["HEADING"]), 'TYPE' => 'profile');
// set all our URL's
phorum_build_common_urls();
phorum_output($template);
示例3: strtolower
$base = strtolower(phorum_get_url(PHORUM_BASE_URL));
$len = strlen($base);
if (strtolower(substr($_SERVER["HTTP_REFERER"],0,$len)) == $base) {
$redir = htmlspecialchars($_SERVER["HTTP_REFERER"]);
}
}
if (! isset($redir)) {
$redir = phorum_get_url(PHORUM_LIST_URL);
}
// Setup template data.
$PHORUM["DATA"]["LOGIN"]["redir"] = $redir;
$PHORUM["DATA"]["URL"]["REGISTER"] = phorum_get_url( PHORUM_REGISTER_URL );
$PHORUM["DATA"]["URL"]["ACTION"] = phorum_get_url( PHORUM_LOGIN_ACTION_URL );
$PHORUM["DATA"]["LOGIN"]["forum_id"] = ( int )$PHORUM["forum_id"];
$PHORUM["DATA"]["LOGIN"]["username"] = htmlspecialchars( $username );
$PHORUM["DATA"]["ERROR"] = htmlspecialchars( $error );
$PHORUM["DATA"]["OKMSG"] = htmlspecialchars( $okmsg );
// Set the field to set the focus to after loading.
$PHORUM["DATA"]["FOCUS_TO_ID"] = empty($username) ? "username" : "password";
// Display the page.
include phorum_get_template( "header" );
phorum_hook( "after_header" );
include phorum_get_template( $template );
phorum_hook( "before_footer" );
include phorum_get_template( "footer" );
?>
示例4: trim
if ($key === 'num_rows' || !empty($item['deleted'])) {
continue;
}
if (!empty($item['show_in_admin'])) {
if (!$cf_header_shown) {
$frm->addbreak('Custom Profile Fields');
$cf_header_shown = 1;
}
$itemval = "[EMPTY]";
if (isset($user[$item['name']]) && trim($user[$item['name']]) != '') {
$itemval = trim($user[$item['name']]);
}
$frm->addrow($item['name'], $itemval);
}
}
phorum_hook("admin_users_form", $frm, $user);
$frm->show();
echo "<br /><hr class=\"PhorumAdminHR\" /><br /><a name=\"forums\"></a>";
$frm = new PhorumInputForm("", "post", "Update");
$frm->hidden("user_id", $_REQUEST["user_id"]);
$frm->hidden("module", "users");
$frm->hidden("section", "forums");
$frm->hidden("referrer", $referrer);
$row = $frm->addbreak("Edit Forum Permissions");
$frm->addhelp($row, "Forum Permissions", "These are permissions set exclusively for this user. You need to grant all permisssions you want the user to have for a forum here. No permissions from groups or a forum's properties will be used once the user has specific permissions for a forum.");
$forums = phorum_db_get_forums();
$forumpaths = phorum_get_forum_info(1);
$perm_frm = $frm->checkbox("new_forum_permissions[" . PHORUM_USER_ALLOW_READ . "]", 1, "Read") . " " . $frm->checkbox("new_forum_permissions[" . PHORUM_USER_ALLOW_REPLY . "]", 1, "Reply") . " " . $frm->checkbox("new_forum_permissions[" . PHORUM_USER_ALLOW_NEW_TOPIC . "]", 1, "Create New Topics") . " " . $frm->checkbox("new_forum_permissions[" . PHORUM_USER_ALLOW_EDIT . "]", 1, "Edit Their Posts") . "<br />" . $frm->checkbox("new_forum_permissions[" . PHORUM_USER_ALLOW_ATTACH . "]", 1, "Attach Files") . "<br />" . $frm->checkbox("new_forum_permissions[" . PHORUM_USER_ALLOW_MODERATE_MESSAGES . "]", 1, "Moderate Messages") . " " . $frm->checkbox("new_forum_permissions[" . PHORUM_USER_ALLOW_MODERATE_USERS . "]", 1, "Moderate Users") . " ";
$arr[] = "Add A Forum...";
foreach ($forumpaths as $forum_id => $forumname) {
if (!isset($user["forum_permissions"][$forum_id]) && $forums[$forum_id]['folder_flag'] == 0) {
示例5: phorum_db_delete_message
}
// Handle the delete action, unless a module already handled it.
if (!$delete_handled) {
// Delete the message from the database.
phorum_db_delete_message($msgthd_id, PHORUM_DELETE_MESSAGE);
// Delete the message attachments from the database.
$files = phorum_db_get_message_file_list($msgthd_id);
foreach ($files as $file_id => $data) {
if (phorum_api_file_check_delete_access($file_id)) {
phorum_api_file_delete($file_id);
}
}
}
// Run a hook for performing custom actions after cleanup.
if (isset($PHORUM["hooks"]["delete"])) {
phorum_hook("delete", array($msgthd_id));
}
}
}
}
$PHORUM['DATA']['PREPOST'] = array();
if ($gotforums) {
$foruminfo = phorum_db_get_forums($mod_forums, NULL, $PHORUM['vroot']);
} else {
$foruminfo = array();
}
foreach ($mod_forums as $forum => $rest) {
$checkvar = 1;
// Get the threads
$rows = array();
// get the thread set started
示例6: elseif
($mode == 'post' || $mode == 'reply'))
{
if (empty($message["author"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrAuthor"];
} elseif ((!defined('PHORUM_ENFORCE_UNREGISTERED_NAMES') || (defined('PHORUM_ENFORCE_UNREGISTERED_NAMES') && PHORUM_ENFORCE_UNREGISTERED_NAMES == true)) && phorum_user_check_username($message["author"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrRegisterdName"];
} elseif (!empty($message["email"]) &&
phorum_user_check_email($message["email"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrRegisterdEmail"];
}
}
// A hook entry for checking the data from a module.
if (! $error) {
list($message, $error) =
phorum_hook("check_post", array($message, $error));
}
// Data integrity checks for all messages.
if (! $error)
{
if (empty($message["subject"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrSubject"];
} elseif (empty($message["body"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrBody"];
} elseif (!empty($message["email"]) &&
!phorum_valid_email($message["email"])) {
$error = $PHORUM["DATA"]["LANG"]["ErrEmail"];
} elseif (strlen($message["body"]) > 64000) {
$error = $PHORUM["DATA"]["LANG"]["ErrBodyTooLarge"];
}
示例7: array_shift
* Miscellaneous
*
* [when]
* In the <filename>script.php</filename> when called from the command
* prompt or a script file.
*
* [input]
* Any array of arguments. (Optional)
*
* [output]
* Same as input.
*
*/
if ($callhook == 'external') {
$module = array_shift($modules);
// The first argument in $callargs is set to the name of the
// called module. This module name is not really needed, but it
// in there for backward compatibility (in older code, all "external"
// hooks were called and the external hook implementation had to check
// the module name to see if it had to be run or not).
array_unshift($callargs, $module);
$callargs = array_values($callargs);
// reindex (0, 1, 2, ...) array keys.
// Call the external hook.
phorum_hook("external", $callargs);
} elseif ($callhook == 'scheduled') {
phorum_hook('scheduled');
} else {
echo $GLOBALS["PHORUM"]["DATA"]["LANG"]["ScriptUsage"];
exit(1);
}
示例8: phorum_hook
* {
* // An optional name=.... argument can be used in the request.
* $name = phorum_ajax_getarg('name', 'string', 'Anonymous Person');
*
* // This will return a JSON encoded string to the client.
* phorum_ajax_return("Hello, $name");
* }
* </hookcode>
*
* For this hook implementation, a GET based URL to fire this
* Ajax call could look like
* <literal>http://example.com/ajax.php?call=sayhello,name=JohnDoe</literal>.
*/
$call_hook = 'ajax_' . $ajax_call;
if (isset($PHORUM['hooks'][$call_hook])) {
phorum_hook($call_hook, $PHORUM['ajax_args']);
}
// Check if the Ajax call has a core handler script.
if (file_exists("./include/ajax/call.{$ajax_call}.php")) {
include "./include/ajax/call.{$ajax_call}.php";
exit;
}
// No handler script available. Bail out.
phorum_ajax_error('Unknown call "' . $ajax_call . '" in Ajax POST request');
// ----------------------------------------------------------------------
// Utility functions that can be used by Ajax call implementations
// ----------------------------------------------------------------------
/**
* Return an Ajax error to the caller.
*
* This will send an error (500 HTTP status code) message to the client,
示例9: phorum_email_user
/**
* function for sending email to users, gets addresses-array and data-array
*/
function phorum_email_user($addresses, $data)
{
$PHORUM = $GLOBALS['PHORUM'];
require_once './include/api/mail.php';
// If we have no from_address in the message data, then generate
// from_address ourselves, based on the system_email_* settings.
if (!isset($data['from_address']) || trim($data['from_address']) == '') {
$from_name = trim($PHORUM['system_email_from_name']);
if ($from_name != '') {
// Handle (Quoted-Printable) encoding of the from name.
// Mail headers cannot contain 8-bit data as per RFC821.
$from_name = phorum_api_mail_encode_header($from_name);
$prefix = $from_name . ' <';
$postfix = '>';
} else {
$prefix = $postfix = '';
}
$data['from_address'] = $prefix . $PHORUM['system_email_from_address'] . $postfix;
}
/*
* [hook]
* email_user_start
*
* [description]
* This hook is put at the very beginning of
* <literal>phorum_email_user()</literal> and is therefore called for
* <emphasis>every</emphasis> email that is sent from Phorum. It is put
* before every replacement done in that function so that all data which
* is sent to that function can be replaced/changed at will.
*
* [category]
* Moderation
*
* [when]
* In the file <filename>email_functions.php</filename> at the start of
* <literal>phorum_email_user()</literal>, before any modification of
* data.
*
* [input]
* An array containing:
* <ul>
* <li>An array of addresses.</li>
* <li>An array containing the message data.</li>
* </ul>
*
* [output]
* Same as input.
*
* [example]
* <hookcode>
* function phorum_mod_foo_email_user_start (list($addresses, $data))
* {
* global $PHORUM;
*
* // Add our disclaimer to the end of every email message.
* $data["mailmessage"] = $PHORUM["mod_foo"]["email_disclaimer"];
*
* return array($addresses, $data);
* }
* </hookcode>
*/
if (isset($PHORUM["hooks"]["email_user_start"])) {
list($addresses, $data) = phorum_hook("email_user_start", array($addresses, $data));
}
// Clear some variables that are meant for use by the email_user_start hook.
unset($data['mailmessagetpl']);
unset($data['mailsubjecttpl']);
unset($data['language']);
// Extract message body and subject.
$mailmessage = $data['mailmessage'];
unset($data['mailmessage']);
$mailsubject = $data['mailsubject'];
unset($data['mailsubject']);
// Replace template variables.
if (is_array($data) && count($data)) {
foreach (array_keys($data) as $key) {
if ($data[$key] === NULL || is_array($data[$key])) {
continue;
}
$mailmessage = str_replace("%{$key}%", $data[$key], $mailmessage);
$mailsubject = str_replace("%{$key}%", $data[$key], $mailsubject);
}
}
$num_addresses = count($addresses);
$from_address = $data['from_address'];
# Try to find a useful hostname to use in the Message-ID.
$host = "";
if (isset($_SERVER["HTTP_HOST"])) {
$host = $_SERVER["HTTP_HOST"];
} else {
if (function_exists("posix_uname")) {
$sysinfo = @posix_uname();
if (!empty($sysinfo["nodename"])) {
$host .= $sysinfo["nodename"];
}
if (!empty($sysinfo["domainname"])) {
$host .= $sysinfo["domainname"];
//.........这里部分代码省略.........
示例10: phorum_api_file_purge_stale
/**
* This function is used for purging stale files from the Phorum system.
*
* @param boolean $do_purge
* If this parameter is set to a false value (the default), then no
* actual purging will take place. The function will only return an
* array of stale files. If the parameter is set to a true value,
* then the stale files will be purged for real.
*
* @return array
* An array of stale Phorum files, indexed by file_id. Every item in
* this array is an array on its own, containing the fields:
* - file_id: the file id of the stale file
* - filename: the name of the stale file
* - filesize: the size of the file in bytes
* - add_datetime: the time (epoch) at which the file was added
* - reason: the reason why it's a stale file
* This array will be returned, regardless of the $do_purge parameter.
*/
function phorum_api_file_purge_stale($do_purge)
{
$stale_files = phorum_db_list_stale_files();
/**
* [hook]
* file_purge_stale
*
* [description]
* This hook can be used to feed the file storage API function
* phorum_api_file_purge_stale() extra stale files. This can be
* useful for modules that handle their own files, using a
* custom link type.
*
* [category]
* File storage
*
* [when]
* Right after Phorum created its own list of stale files.
*
* [input]
* An array containing stale files, indexed by file_id. Each item
* in this array is an array on its own, containing the following
* fields:
* <ul>
* <li>file_id:
* the file id of the stale file</li>
* <li>filename:
* the name of the stale file</li>
* <li>filesize:
* the size of the file in bytes</li>
* <li>add_datetime:
* the time (epoch) at which the file was added</li>
* <li>reason:
* the reason why it's a stale file</li>
* </ul>
*
* [output]
* The same array as the one that was used for the hook call
* argument, possibly extended with extra files that are
* considered to be stale.
*/
if (isset($GLOBALS['PHORUM']['hooks']['file_purge_stale'])) {
$stale_files = phorum_hook('file_purge_stale', $stale_files);
}
// Delete the files if requested.
if ($do_purge) {
foreach ($stale_files as $file) {
phorum_api_file_delete($file);
}
}
return $stale_files;
}
示例11: phorum_db_get_messages
// will return messages with the same thread id in
// other forums as well (those are the move notifications).
if ($delmode == PHORUM_DELETE_TREE) {
$forum_id = $PHORUM["forum_id"];
$PHORUM["forum_id"] = 0;
$moved = phorum_db_get_messages($msg["message_id"]);
$PHORUM["forum_id"] = $forum_id;
foreach ($moved as $id => $data) {
if (!empty($data["moved"])) {
phorum_db_delete_message($id, PHORUM_DELETE_MESSAGE);
}
}
}
}
// Run a hook for performing custom actions after cleanup.
phorum_hook("delete", $delids);
// Keep track of deleted messages ids for counting the deleted
// messages at the end. We can't simply add the number of messages
// in the message array, because there might be overlap between
// messages and threads here.
foreach ($delids as $id) {
$delete_messages[$id] = 1;
}
}
$delete_count = count($delete_messages);
phorum_admin_okmsg("Deleted {$delete_count} message(s) from the database.");
}
// If a filterdesc field is in the post data, then query the database
// based on this filterdesc. The results will be shown later on,
// below the filter form.
if (isset($_POST["filterdesc"])) {
示例12: phorum_hook
* [when]
* Right before the <literal>PhorumInputForm</literal> object is shown.
*
* [input]
* The <literal>PhorumInputForm</literal> object.
*
* [output]
* Same as input.
*
* [example]
* <hookcode>
* function phorum_mod_foo_admin_general ($frm)
* {
* // Add a section for the foo settings
* $frm->addbreak( "Foo Module Settings" );
*
* // Add the option to cache the bar
* $row=$frm->addrow( "Enable Bar Caching:", $frm->select_tag( "mod_foo[enable_bar_caching]", array( "No", "Yes" ), $PHORUM["mod_foo"]["enable_bar_caching"] ) );
* $frm->addhelp($row, "Enable Bar Caching", "If you select yes for this option, then the bar will be cached." );
*
* // Return the modified PhorumInputForm
* return $frm;
*
* }
* </hookcode>
*/
$frm = phorum_hook("admin_general", $frm);
$frm->show();
?>
示例13: phorum_hook
* $pm_message = preg_replace(
* "/%message_subject%/",
* $dbmessage["subject"],
* $PHORUM["DATA"]["LANG"]["mod_foo"]["MessageEditedBody"]
* );
* phorum_db_pm_send(
* $PHORUM["DATA"]["LANG"]["mod_foo"]["MessageEditedSubject"],
* $pm_message,
* $dbmessage["user_id"]
* );
* }
* }
* </hookcode>
*/
if (isset($PHORUM["hooks"]["after_edit"])) {
phorum_hook("after_edit", $dbmessage);
}
// remove the message from the cache if caching is enabled
// no need to clear the thread-index as the message has only been changed
if ($PHORUM['cache_messages']) {
phorum_cache_remove('message', $message["message_id"]);
phorum_db_update_forum(array('forum_id' => $PHORUM['forum_id'], 'cache_version' => $PHORUM['cache_version'] + 1));
}
// Update children to the same sort setting.
if (!$message["parent_id"] && $origmessage["sort"] != $dbmessage["sort"]) {
$messages = phorum_db_get_messages($message["thread"], 0);
unset($messages["users"]);
foreach ($messages as $message_id => $msg) {
if ($msg["sort"] != $dbmessage["sort"] || $msg["forum_id"] != $dbmessage["forum_id"]) {
$msg["sort"] = $dbmessage["sort"];
phorum_db_update_message($message_id, $msg);
示例14: phorum_format_messages
//.........这里部分代码省略.........
// Normally, the message_id must be set, since we should be handling
// message data. It might not be set however, because sometimes
// the message formatting is called using some fake message data
// for formatting something else than a message.
if (!isset($message['message_id'])) {
$data[$key]['message_id'] = $message['message_id'] = $key;
}
// Work on the message body ========================
if (isset($message["body"])) {
$body = $message["body"];
// Convert legacy <> urls into bare urls.
$body = preg_replace("/<((http|https|ftp):\\/\\/[a-z0-9;\\/\\?:@=\\&\$\\-_\\.\\+!*'\\(\\),~%]+?)>/i", "\$1", $body);
// Escape special HTML characters.
$escaped_body = htmlspecialchars($body, ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
if ($escaped_body == "") {
if (function_exists("iconv")) {
// we are gonna guess and see if we get lucky
$escaped_body = iconv("ISO-8859-1", $PHORUM["DATA"]["HCHARSET"], $body);
} else {
// we let htmlspecialchars use its defaults
$escaped_body = htmlspecialchars($body);
}
}
$body = $escaped_body;
// Replace newlines with $phorum_br temporarily.
// This way the mods know what Phorum did vs the user.
$body = str_replace("\n", "{$phorum_br}\n", $body);
// Run bad word replacement code.
if ($bad_word_check) {
$body = preg_replace($replace_words, $replace_vals, $body);
}
$data[$key]["body"] = $body;
}
// Work on the other fields ========================
// Run bad word replacement code on subject and author.
if ($bad_word_check) {
if (isset($message["subject"])) {
$data[$key]["subject"] = preg_replace($replace_words, $replace_vals, $data[$key]["subject"]);
}
if (isset($message["author"])) {
$data[$key]["author"] = preg_replace($replace_words, $replace_vals, $data[$key]["author"]);
}
}
// Escape special HTML characters in fields.
if (isset($message["email"])) {
$data[$key]["email"] = htmlspecialchars($data[$key]["email"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
}
if (isset($message["subject"])) {
$data[$key]["subject"] = htmlspecialchars($data[$key]["subject"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
}
// Do author formatting for all provided author fields.
foreach ($author_specs as $spec) {
// Use "Anonymous user" as the author name if there's no author
// name available for some reason.
if (!isset($message[$spec[1]]) || $message[$spec[1]] == '') {
$data[$key][$spec[3]] = $PHORUM["DATA"]["LANG"]["AnonymousUser"];
} elseif (!empty($message[$spec[0]])) {
$url = str_replace('%spec_data%', $message[$spec[0]], $profile_url_template);
$data[$key]["URL"][$spec[4]] = $url;
$data[$key][$spec[3]] = empty($PHORUM["custom_display_name"]) ? htmlspecialchars($message[$spec[1]], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]) : $message[$spec[1]];
} elseif ($spec[2] !== NULL && !empty($message[$spec[2]]) && (empty($PHORUM['hide_email_addr']) || !empty($PHORUM["user"]["admin"]) || phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_MESSAGES) && PHORUM_MOD_EMAIL_VIEW || phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_USERS) && PHORUM_MOD_EMAIL_VIEW)) {
$data[$key][$spec[3]] = htmlspecialchars($message[$spec[1]], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
$email_url = phorum_html_encode("mailto:" . $message[$spec[2]]);
$data[$key]["URL"]["PROFILE"] = $email_url;
} else {
$data[$key][$spec[3]] = htmlspecialchars($message[$spec[1]], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
}
}
}
// A hook for module writers to apply custom message formatting.
if (isset($PHORUM["hooks"]["format"])) {
$data = phorum_hook("format", $data);
}
// A hook for module writers for doing post formatting fixups.
if (isset($PHORUM["hooks"]["format_fixup"])) {
$data = phorum_hook("format_fixup", $data);
}
// Clean up after the mods are done.
foreach ($data as $key => $message) {
// Clean up line breaks inside pre and xmp tags. These tags
// take care of showing newlines as breaks themselves.
if (isset($message["body"])) {
foreach (array("pre", "goep", "xmp") as $tagname) {
if (preg_match_all("/(<{$tagname}.*?>).+?(<\\/{$tagname}>)/si", $message["body"], $matches)) {
foreach ($matches[0] as $match) {
$stripped = str_replace($phorum_br, "", $match);
$message["body"] = str_replace($match, $stripped, $message["body"]);
}
}
}
// Remove line break after div, quote and code tags. These
// tags have their own line break. Without this, there would
// be to many white lines.
$message["body"] = preg_replace("/\\s*(<\\/?(?:div|xmp|blockquote|pre)[^>]*>)\\s*\\Q{$phorum_br}\\E/", "\$1", $message["body"]);
// Normalize the Phorum line breaks that are left.
$data[$key]["body"] = str_replace($phorum_br, "<br />", $message["body"]);
}
}
return $data;
}
示例15: phorum_hook
*
* [category]
* Moderation
*
* [when]
* In <filename>moderation.php</filename>, right after a thread has
* been split by a moderator.
*
* [input]
* The id of the newly created thread
*
* [output]
* None
*
*/
phorum_hook('after_split', $_POST['message']);
break;
default:
if (!isset($PHORUM['DATA']['OKMSG'])) {
$PHORUM['DATA']['OKMSG'] = "";
}
$PHORUM['DATA']["URL"]["REDIRECT"] = $PHORUM["DATA"]["URL"]["LIST"];
}
// remove the affected messages from the cache if caching is enabled.
if ($PHORUM['cache_messages']) {
foreach ($invalidate_message_cache as $message) {
phorum_cache_remove('message', $message["message_id"]);
phorum_db_update_forum(array('forum_id' => $PHORUM['forum_id'], 'cache_version' => $PHORUM['cache_version'] + 1));
}
}
if (!isset($PHORUM['DATA']['BACKMSG'])) {