本文整理汇总了PHP中phorum_get_url函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_get_url函数的具体用法?PHP phorum_get_url怎么用?PHP phorum_get_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phorum_get_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: spamhurdle_captcha_build_form
function spamhurdle_captcha_build_form($data)
{
if (!isset($data['captcha']['html_form'])) {
return $data;
}
global $PHORUM;
$config = $PHORUM['mod_spamhurdles']['captcha'];
$captcha = $data['captcha'];
$form = $captcha['html_form'];
// The actual value in the captcha is named {FIELDVALUE} in the
// generated captcha HTML code. Replace it with the actual value.
$fn = $captcha["input_fieldname"];
$fieldvalue = isset($_POST[$fn]) ? $_POST[$fn] : "";
$form = str_replace("{FIELDVALUE}", htmlspecialchars($fieldvalue), $form);
// Replace SPOKENURL with the URL for the spoken captcha code.
if ($config["spoken_captcha"] && file_exists($config["flite_location"])) {
$url = phorum_get_url(PHORUM_ADDON_URL, 'module=spamhurdles', 'hurdle=captcha', 'spokencaptcha=' . rawurlencode(spamhurdles_encrypt($captcha['spoken_text'])));
$form = str_replace('{SPOKENURL}', htmlspecialchars($url), $form);
}
// Replace IMAGE with the URL for the captcha image.
$url = phorum_get_url(PHORUM_ADDON_URL, 'module=spamhurdles', 'hurdle=captcha', 'imagecaptcha=' . rawurlencode(spamhurdles_encrypt(array('question' => $captcha['question'], 'type' => $captcha['type']))));
$form = str_replace('{IMAGEURL}', htmlspecialchars($url), $form);
if (!empty($data['use_editor_block'])) {
$PHORUM['DATA']['CONTENT'] = $form;
$PHORUM['DATA']['EDITOR'] = $data['use_editor_block'];
include phorum_get_template('spamhurdles::editor_block');
} else {
print $form;
}
return $data;
}
示例2: phorum_return_to_list
/**
* just returns to the list and exits the program
*/
function phorum_return_to_list()
{
$PHORUM=$GLOBALS["PHORUM"];
if(!empty($PHORUM["forum_id"])){
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
}else{
phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
}
exit();
}
示例3: phorum_user_subscribe
phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, PHORUM_SUBSCRIPTION_BOOKMARK );
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["NoMoreEmails"];
$PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
$template="message";
} elseif(!empty($_POST)) {
// the user has submitted the form
$type = (isset($_POST["send_email"])) ? PHORUM_SUBSCRIPTION_MESSAGE : PHORUM_SUBSCRIPTION_BOOKMARK;
phorum_user_subscribe( $PHORUM['user']['user_id'], $message["forum_id"], $thread, $type );
$PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $thread);
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
$PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["BookmarkedThread"];
$template="message";
} else {
// we are following a new thread
$PHORUM["DATA"]["URL"]["ACTION"]=phorum_get_url(PHORUM_FOLLOW_ACTION_URL);
$PHORUM["DATA"]["SUBJECT"]=htmlspecialchars($message["subject"]);
$PHORUM["DATA"]["THREAD"]=$thread;
$PHORUM["DATA"]["FORUM_ID"]=$PHORUM["forum_id"];
$template="follow";
}
// set all our common URL's
phorum_build_common_urls();
include phorum_get_template("header");
phorum_hook("after_header");
include phorum_get_template($template);
phorum_hook("before_footer");
include phorum_get_template("footer");
示例4: phorum_api_user_list_subscriptions
$forum_ids[] = $forum["forum_id"];
}
$subscr_array = phorum_api_user_list_subscriptions($PHORUM['user']['user_id'], $subdays, $forum_ids);
// storage for newflags
$PHORUM['user']['newinfo'] = array();
// go through all subscriptions
$subscr_array_final = array();
unset($subscr_array["forum_ids"]);
foreach ($subscr_array as $id => $data) {
$data['forum'] = $forums[$data['forum_id']]['name'];
$data['raw_datestamp'] = $data["modifystamp"];
$data['datestamp'] = phorum_date($PHORUM["short_date_time"], $data["modifystamp"]);
$data['raw_lastpost'] = $data['modifystamp'];
$data['lastpost'] = phorum_date($PHORUM["short_date_time"], $data["modifystamp"]);
$data["URL"]["READ"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $data["forum_id"], $data["thread"]);
$data["URL"]["NEWPOST"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $data["forum_id"], $data["thread"], "gotonewpost");
// Check if there are new messages for the current thread.
if (!isset($PHORUM['user']['newinfo'][$data["forum_id"]])) {
$PHORUM['user']['newinfo'][$data["forum_id"]] = null;
if ($PHORUM['cache_newflags']) {
$newflagkey = $data["forum_id"] . "-" . $PHORUM['user']['user_id'];
$PHORUM['user']['newinfo'][$data["forum_id"]] = phorum_cache_get('newflags', $newflagkey, $forums[$data["forum_id"]]['cache_version']);
}
if ($PHORUM['user']['newinfo'][$data["forum_id"]] == null) {
$PHORUM['user']['newinfo'][$data["forum_id"]] = phorum_db_newflag_get_flags($data["forum_id"]);
if ($PHORUM['cache_newflags']) {
phorum_cache_put('newflags', $newflagkey, $PHORUM['user']['newinfo'][$data["forum_id"]], 86400, $forums[$data["forum_id"]]['cache_version']);
}
}
}
$new = array();
示例5: phorum_mod_bbcode_editor_tool_plugin
function phorum_mod_bbcode_editor_tool_plugin()
{
global $PHORUM;
$lang = $PHORUM['DATA']['LANG']['mod_bbcode'];
$nr_of_enabled_tags = 0;
$enabled = isset($PHORUM['mod_bbcode']['enabled']) ? $PHORUM['mod_bbcode']['enabled'] : array();
$builtin = $PHORUM['MOD_BBCODE']['BUILTIN'];
// Register the tool buttons.
foreach ($PHORUM['mod_bbcode_parser']['taginfo'] as $id => $taginfo) {
// Skip tool if no editor tools button is implemented.
if (!$taginfo[BBCODE_INFO_HASEDITORTOOL]) {
continue;
}
// Check if the editor tool should be shown. If not, then skip
// to the next tag. If there are no settings saved yet for the
// module, then use the settings from the builtin tag list.
if (isset($enabled[$id]) && $enabled[$id] != 2 || !isset($PHORUM['mod_bbcode']['enabled'][$id]) && isset($builtin[$id]) && $builtin[$id][BBCODE_INFO_DEFAULTSTATE] != 2) {
continue;
}
// Keep track of the number of enabled tags.
$nr_of_enabled_tags++;
// Determine the description to use for the tool. If we can find
// a description in the language strings, then we use that one.
// Otherwise, we simply fall back to the less descriptive feature id.
$description = isset($lang[$id]) ? $lang[$id] : $id;
// Register the tool button with the Editor Tools module.
editor_tools_register_tool($id, $description, "./mods/bbcode/icons/{$id}.gif", "editor_tools_handle_{$id}()");
}
// Register the bbcode help page, unless no tags were enabled at all.
if ($nr_of_enabled_tags > 0) {
$description = isset($lang['bbcode help']) ? $lang['bbcode help'] : 'BBcode help';
editor_tools_register_help($description, phorum_get_url(PHORUM_ADDON_URL, 'module=bbcode', 'action=help'));
}
// Make language strings available for the editor tools javascript code.
editor_tools_register_translations($lang);
}
示例6: array
$rows = array();
// get the thread set started
$rows = phorum_db_get_unapproved_list($forum, $showwaiting, $moddays);
// loop through and read all the data in.
foreach ($rows as $key => $row) {
$numunapproved++;
$rows[$key]['forumname'] = $foruminfo[$forum]['name'];
$rows[$key]['checkvar'] = $checkvar;
if ($checkvar) {
$checkvar = 0;
}
$rows[$key]['forum_id'] = $forum;
$rows[$key]["URL"]["READ"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $forum, $row["thread"], $row['message_id']);
// we need to fake the forum_id here
$PHORUM["forum_id"] = $forum;
$rows[$key]["URL"]["APPROVE_MESSAGE"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_APPROVE_MESSAGE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum, "onlyunapproved=" . $showwaiting, "moddays=" . $moddays);
$rows[$key]["URL"]["APPROVE_TREE"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_APPROVE_MESSAGE_TREE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum, "onlyunapproved=" . $showwaiting, "moddays=" . $moddays);
$rows[$key]["URL"]["DELETE"] = phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_TREE, $row["message_id"], "prepost=1", "old_forum=" . $oldforum, "onlyunapproved=" . $showwaiting, "moddays=" . $moddays);
$PHORUM["forum_id"] = $oldforum;
$rows[$key]["raw_short_datestamp"] = $row["datestamp"];
$rows[$key]["short_datestamp"] = phorum_date($PHORUM["short_date_time"], $row["datestamp"]);
}
require_once "./include/format_functions.php";
$rows = phorum_format_messages($rows);
$PHORUM['DATA']['PREPOST'] = array_merge($PHORUM['DATA']['PREPOST'], $rows);
}
if (!$numunapproved) {
$PHORUM["DATA"]["UNAPPROVEDMESSAGE"] = $PHORUM["DATA"]["LANG"]["NoUnapprovedMessages"];
}
$PHORUM["DATA"]["HEADING"] = $PHORUM["DATA"]["LANG"]["UnapprovedMessages"];
$template = "cc_prepost";
示例7: htmlspecialchars
$redir = htmlspecialchars($_REQUEST["redir"]);
} elseif (!empty( $_SERVER["HTTP_REFERER"])) {
$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" );
示例8: phorum_get_forum_info
$forum_info = phorum_get_forum_info(2);
$forum_matches = array();
foreach ($forum_info as $id => $name) {
$forum_matches[htmlspecialchars($name)] = "message.forum_id = {$id}";
}
$ruledefs = array("body" => array("label" => "Message body", "matches" => array("contains" => "message.body = *QUERY*", "does not contain" => "message.body != *QUERY*"), "queryfield" => "string"), "subject" => array("label" => "Message subject", "matches" => array("is" => "message.subject = QUERY", "is not" => "message.subject != QUERY", "contains" => "message.subject = *QUERY*", "does not contain" => "message.subject != *QUERY*"), "queryfield" => "string"), "date" => array("label" => "Message date", "matches" => array("posted on" => "function:prepare_filter_date", "posted on or before" => "function:prepare_filter_date", "posted before" => "function:prepare_filter_date", "posted after" => "function:prepare_filter_date", "posted on or after" => "function:prepare_filter_date"), "prepare_filter_date" => "message.datestamp", "queryfield" => "date"), "status" => array("label" => "Message status", "matches" => array("approved" => "message.status = " . PHORUM_STATUS_APPROVED, "waiting for approval (on hold)" => "message.status = " . PHORUM_STATUS_HOLD, "disapproved by moderator" => "message.status = " . PHORUM_STATUS_HIDDEN, "hidden (on hold or disapproved)" => "message.status != " . PHORUM_STATUS_APPROVED)), "messagetype" => array("label" => "Message type", "matches" => array("thread starting messages" => "message.parent_id = 0", "reply messages" => "message.parent_id != 0")), "forum" => array("label" => "Forum", "matches" => $forum_matches), "author" => array("label" => "Author name", "matches" => array("is" => "message.author = QUERY", "is not" => "message.author != QUERY", "contains" => "message.author = *QUERY*", "does not contain" => "message.author != *QUERY*", "starts with" => "message.author = QUERY*", "does not start with" => "message.author != QUERY*", "ends with" => "message.author = *QUERY", "does not end with" => "message.author != QUERY*"), "queryfield" => "string"), "username" => array("label" => "Author username", "matches" => array("is" => "user.username = QUERY", "is not" => "user.username != QUERY", "contains" => "user.username = *QUERY*", "does not contain" => "user.username != *QUERY*", "starts with" => "user.username = QUERY*", "does not start with" => "user.username != QUERY*", "ends with" => "user.username = *QUERY", "does not end with" => "user.username != *QUERY"), "queryfield" => "string"), "user_id" => array("label" => "Author user id", "matches" => array("is" => "message.user_id = QUERY", "is not" => "message.user_id != QUERY"), "queryfield" => "string"), "authortype" => array("label" => "Author type", "matches" => array("registered user" => "message.user_id != 0", "anonymous user" => "message.user_id = 0", "moderator" => "message.moderator_post = 1", "administrator" => "user.admin = 1", "active user" => "user.active = " . PHORUM_USER_ACTIVE, "deactivated user" => "user.active = " . PHORUM_USER_INACTIVE)), "ipaddress" => array("label" => "Author IP/hostname", "matches" => array("is" => "message.ip = QUERY", "is not" => "message.ip != QUERY", "starts with" => "message.ip = QUERY*", "does not start with" => "message.ip != QUERY*", "ends with" => "message.ip = *QUERY", "does not end with" => "message.ip != *QUERY"), "queryfield" => "string"), "threadstate" => array("label" => "Thread status", "matches" => array("open for posting" => "thread.closed = 0", "closed for posting" => "thread.closed = 1")), "threadlastpost" => array("label" => "Thread last post", "matches" => array("posted on or before" => "function:prepare_filter_date", "posted before" => "function:prepare_filter_date", "posted after" => "function:prepare_filter_date", "posted on or after" => "function:prepare_filter_date"), "prepare_filter_date" => "thread.modifystamp", "queryfield" => "date"));
// ----------------------------------------------------------------------
// Handle a posted form
// ----------------------------------------------------------------------
$messages = null;
// selected messages (based on a filter)
$filters = array();
// active filters
$filtermode = "and";
// active filter mode (and / or)
$read_url_template = phorum_get_url(PHORUM_FOREIGN_READ_URL, '%forum_id%', '%thread_id%', '%message_id%');
// If there are messages to delete in the post data, then delete them
// from the database.
$delete_count = 0;
if (isset($_POST["deletemessage"]) && is_array($_POST["deletemessage"])) {
$msgids = array_keys($_POST["deletemessage"]);
$msgs = phorum_db_get_message($msgids, "message_id", true);
$deleted_messages = array();
foreach ($msgs as $msg) {
// if the message was already deleted, skip it
if (isset($delete_messages[$msg["message_id"]])) {
continue;
}
$PHORUM["forum_id"] = $msg["forum_id"];
$delmode = $msg["parent_id"] == 0 ? PHORUM_DELETE_TREE : PHORUM_DELETE_MESSAGE;
// A hook to allow modules to implement extra or different
示例9: phorum_feed_make_js
function phorum_feed_make_js($messages, $forums, $feed_url, $feed_title, $feed_description)
{
$PHORUM = $GLOBALS["PHORUM"];
// build PHP array to later be turned into a JS object
$feed["title"] = $feed_title;
$feed["description"] = $feed_description;
$feed["modified"] = phorum_date($PHORUM['short_date'], time());
// Lookup the plain text usernames for the authenticated authors.
$users = $messages['users'];
unset($messages['users']);
unset($users[0]);
$users = phorum_api_user_get_display_name($users, '', PHORUM_FLAG_PLAINTEXT);
foreach ($messages as $message) {
$author = isset($users[$message['user_id']]) && $users[$message['user_id']] != '' ? $users[$message['user_id']] : $message['author'];
$item = array("title" => strip_tags($message["subject"]), "author" => $author, "category" => $forums[$message["forum_id"]]["name"], "created" => phorum_date($PHORUM['short_date'], $message["datestamp"]), "modified" => phorum_date($PHORUM['short_date'], $message["modifystamp"]), "url" => phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"], $message["message_id"]), "description" => $message["body"]);
if ($message["thread_count"]) {
$replies = $message["thread_count"] - 1;
$item["replies"] = $replies;
}
$feed["items"][] = $item;
}
// this is where we convert the array into js
$buffer = phorum_array_to_javascript("phorum_feed", $feed);
return $buffer;
}
示例10: phorum_redirect_by_url
if ($parent_id == 0 && count($forums) < 2) {
phorum_redirect_by_url($forum['url']);
exit;
}
if ($forum["message_count"] > 0) {
$forum["raw_last_post"] = $forum["last_post_time"];
$forum["last_post"] = phorum_date($PHORUM["long_date_time"], $forum["last_post_time"]);
} else {
$forum["last_post"] = " ";
}
$forum["URL"]["LIST"] = phorum_get_url(PHORUM_LIST_URL, $forum["forum_id"]);
if ($PHORUM["DATA"]["LOGGEDIN"]) {
$forum["URL"]["MARK_READ"] = phorum_get_url(PHORUM_INDEX_URL, $forum["forum_id"], "markread", $PHORUM['forum_id']);
}
if (isset($PHORUM['use_rss']) && $PHORUM['use_rss']) {
$forum["URL"]["FEED"] = phorum_get_url(PHORUM_FEED_URL, $forum["forum_id"], "type=" . $PHORUM["default_feed"]);
}
$forum["raw_message_count"] = $forum["message_count"];
$forum["message_count"] = number_format($forum["message_count"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
$forum["raw_thread_count"] = $forum["thread_count"];
$forum["thread_count"] = number_format($forum["thread_count"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
if ($PHORUM["DATA"]["LOGGEDIN"]) {
if ($PHORUM["show_new_on_index"] == 1) {
$forum["new_messages"] = number_format($new_counts[$forum["forum_id"]]["messages"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
$forum["new_threads"] = number_format($new_counts[$forum["forum_id"]]["threads"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
} elseif ($PHORUM["show_new_on_index"] == 2) {
$forum["new_message_check"] = $new_checks[$forum["forum_id"]];
}
}
}
$forums_shown = true;
示例11: phorum_email_user
}
phorum_email_user($mail_users, $mail_data);
$PHORUM["DATA"]["URL"]["REDIRECT"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"]);
$PHORUM["DATA"]["BACKMSG"] = $PHORUM["DATA"]["LANG"]["BackToThread"];
$PHORUM["DATA"]["OKMSG"] = $PHORUM["DATA"]["LANG"]["ReportPostSuccess"];
$template = "message";
$report = true;
}
} else {
$PHORUM["DATA"]["ReportPostMessage"] = $PHORUM["DATA"]["LANG"]['ReportPostNotAllowed'];
}
}
// format message
list($message) = phorum_format_messages(array($message));
$PHORUM["DATA"]["PostSubject"] = $message["subject"];
$PHORUM["DATA"]["PostAuthor"] = $message["author"];
$PHORUM["DATA"]["PostBody"] = $message["body"];
$PHORUM["DATA"]["raw_PostDate"] = $message["datestamp"];
$PHORUM["DATA"]["PostDate"] = phorum_date($PHORUM["short_date_time"], $message["datestamp"]);
$PHORUM["DATA"]["ReportURL"] = phorum_get_url(PHORUM_REPORT_URL, $message_id);
// if the report was not successfully sent, keep whatever explanation they gave already
if (isset($_POST["explanation"]) && !$report) {
$PHORUM["DATA"]["explanation"] = $_POST["explanation"];
} else {
$PHORUM["DATA"]["explanation"] = "";
}
} else {
$PHORUM["DATA"]["ERROR"] = $PHORUM['DATA']['LANG']['MessageNotFound'];
$template = 'message';
}
phorum_output($template);
示例12: phorum_setup_announcements
function phorum_setup_announcements()
{
global $PHORUM;
// This variable will be used to store the formatted announcements.
$PHORUM['DATA']['MOD_ANNOUNCEMENTS'] = '';
// Check if we are on a page on which the announcements have to be shown.
if (phorum_page == 'index') {
// Hide the announcements, unless enabled for "index".
$hide = empty($PHORUM["mod_announcements"]["pages"]["index"]);
// Show announcements for the root page if "home" is enabled.
if ($PHORUM['vroot'] == $PHORUM['forum_id'] && !empty($PHORUM["mod_announcements"]["pages"]["home"])) {
$hide = FALSE;
}
if ($hide) {
return;
}
} else {
if (empty($PHORUM["mod_announcements"]["pages"][phorum_page])) {
return;
}
}
// Check if we need to show announcements.
$ann_forum_id = NULL;
// Inside a vroot, where we have a vroot configuration for the forum
// to use for announcements and the current forum is not that
// announcement forum.
if ($PHORUM['vroot'] > 0 && !empty($PHORUM["mod_announcements"]["vroot"][$PHORUM['vroot']]) && $PHORUM["forum_id"] != $PHORUM["mod_announcements"]["vroot"][$PHORUM['vroot']]) {
$ann_forum_id = $PHORUM["mod_announcements"]["vroot"][$PHORUM['vroot']];
// Inside the top level folder, where we have a forum that is configured
// to be used for announcements and the current forum is not that
// announcement forum.
} elseif ($PHORUM['vroot'] == 0 && !empty($PHORUM["mod_announcements"]["forum_id"]) && $PHORUM["forum_id"] != $PHORUM["mod_announcements"]["forum_id"]) {
$ann_forum_id = $PHORUM["mod_announcements"]["forum_id"];
}
// If no announcement forum_id is found, no announcements
// have to be shown.
if ($ann_forum_id === NULL) {
return;
}
// Retrieve the last number of posts from the announcement forum.
$messages = phorum_db_get_recent_messages($PHORUM["mod_announcements"]["number_to_show"], 0, $ann_forum_id, 0, true);
unset($messages["users"]);
// No announcements to show? Then we are done.
if (count($messages) == 0) {
return;
}
// Read the newflags information for authenticated users.
$newinfo = NULL;
if ($PHORUM["DATA"]["LOGGEDIN"]) {
$newflagkey = $ann_forum_id . "-" . $PHORUM['user']['user_id'];
if ($PHORUM['cache_newflags']) {
$newinfo = phorum_cache_get('newflags', $newflagkey, $PHORUM['cache_version']);
}
if ($newinfo == NULL) {
$newinfo = phorum_db_newflag_get_flags($ann_forum_id);
if ($PHORUM['cache_newflags']) {
phorum_cache_put('newflags', $newflagkey, $newinfo, 86400, $PHORUM['cache_version']);
}
}
}
require_once "./include/format_functions.php";
// Process the announcements.
foreach ($messages as $message) {
// Skip this message if it's older than the number of days that was
// configured in the settings screen.
if (!empty($PHORUM["mod_announcements"]["days_to_show"]) && $message["datestamp"] < time() - $PHORUM["mod_announcements"]["days_to_show"] * 86400) {
continue;
}
// Check if there are new messages in the thread.
if (isset($newinfo)) {
$new = 0;
foreach ($message["meta"]["message_ids"] as $id) {
if (!isset($newinfo[$id]) && $id > $newinfo['min_id']) {
$new = 1;
break;
}
}
// There are new messages. Setup the template data for showing
// a new flag.
if ($new) {
$message["new"] = $new ? $PHORUM["DATA"]["LANG"]["newflag"] : NULL;
$message["URL"]["NEWPOST"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"], "gotonewpost");
} elseif ($PHORUM["mod_announcements"]["only_show_unread"]) {
continue;
}
}
// Setup template data for the message.
unset($message['body']);
$message["lastpost"] = phorum_date($PHORUM["short_date_time"], $message["modifystamp"]);
$message["raw_datestamp"] = $message["datestamp"];
$message["datestamp"] = phorum_date($PHORUM["short_date_time"], $message["datestamp"]);
$message["URL"]["READ"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["message_id"]);
$PHORUM["DATA"]["ANNOUNCEMENTS"][] = $message;
}
// If all announcements were skipped, then we are done.
if (!isset($PHORUM["DATA"]["ANNOUNCEMENTS"])) {
return;
}
// format / clean etc. the messages found
$PHORUM["DATA"]["ANNOUNCEMENTS"] = phorum_format_messages($PHORUM["DATA"]["ANNOUNCEMENTS"]);
//.........这里部分代码省略.........
示例13: isset
}
// Setup template data.
$PHORUM["DATA"]["PROFILE"] = $user;
$PHORUM["DATA"]["PROFILE"]["forum_id"] = isset($PHORUM["forum_id"]) ? $PHORUM['forum_id'] : 0;
$PHORUM["DATA"]["PROFILE"]["PANEL"] = $panel;
// Set the back-URL and -message.
if ($PHORUM['forum_id'] > 0 && $PHORUM['folder_flag'] == 0) {
$PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_LIST_URL);
$PHORUM['DATA']['URL']['BACKTITLE'] = $PHORUM['DATA']['LANG']['BacktoForum'];
} else {
if(isset($PHORUM['forum_id'])) {
$PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_INDEX_URL,$PHORUM['forum_id']);
} else {
$PHORUM['DATA']['URL']['BACK'] = phorum_get_url(PHORUM_INDEX_URL);
}
$PHORUM['DATA']['URL']['BACKTITLE'] = $PHORUM['DATA']['LANG']['BackToForumList'];
}
// Load the include file for the current panel.
$panel = basename($panel);
if (file_exists("./include/controlcenter/$panel.php")) {
include "./include/controlcenter/$panel.php";
} else {
include "./include/controlcenter/summary.php";
}
// The include file can set the template we have to use for
// displaying the main part of the control panel screen
// in the $template variable.
示例14: unset
// Retrieve the recent messages.
$recent = $PHORUM['DB']->get_recent_messages($count, 0, $forum_id, $thread_id, $threads_only);
unset($recent["users"]);
// Add newflag info to the messages.
if ($PHORUM["DATA"]["LOGGEDIN"]) {
$type = $threads_only ? PHORUM_NEWFLAGS_BY_THREAD : PHORUM_NEWFLAGS_BY_MESSAGE;
$recent = phorum_api_newflags_apply_to_messages($recent, $type);
}
// Format the messages.
$recent = phorum_api_format_messages($recent);
// Apply the list hook to the messages.
if (isset($PHORUM["hooks"]["list"])) {
$recent = phorum_api_hook("list", $recent);
}
// Retrieve information about the forums for the active user.
$allowed_forums = phorum_api_user_check_access(PHORUM_USER_ALLOW_READ, PHORUM_ACCESS_LIST);
$forums = $PHORUM['DB']->get_forums($allowed_forums);
foreach ($forums as $id => $forum) {
$forums[$id]['url'] = phorum_get_url(PHORUM_LIST_URL, $forum['forum_id']);
}
// Add forum info to the messages and clean up data.
foreach ($recent as $id => $message) {
$recent[$id]['foruminfo'] = array('id' => $message['forum_id'], 'name' => $forums[$message['forum_id']]['name'], 'url' => $forums[$message['forum_id']]['url']);
// Strip fields that the caller should not see in the return data.
unset($recent[$id]['email']);
unset($recent[$id]['ip']);
unset($recent[$id]['meta']);
unset($recent[$id]['msgid']);
}
// Return the results.
phorum_ajax_return(array_values($recent));
示例15: phorum_email_moderators
function phorum_email_moderators($message)
{
$PHORUM = $GLOBALS["PHORUM"];
$mail_users = phorum_api_user_list_moderators($PHORUM['forum_id'], $PHORUM['email_ignore_admin'], TRUE);
if (count($mail_users)) {
include_once "./include/format_functions.php";
if ($message["status"] > 0) {
// just notification of a new message
$mailsubjecttpl = 'NewUnModeratedSubject';
$mailmessagetpl = 'NewUnModeratedMessage';
$mailsubject = $PHORUM["DATA"]["LANG"]['NewUnModeratedSubject'];
$mailmessage = $PHORUM["DATA"]["LANG"]['NewUnModeratedMessage'];
} else {
// posts needing approval
$mailsubjecttpl = 'NewModeratedSubject';
$mailmessagetpl = 'NewModeratedMessage';
$mailsubject = $PHORUM["DATA"]["LANG"]['NewModeratedSubject'];
$mailmessage = $PHORUM["DATA"]["LANG"]['NewModeratedMessage'];
}
$mail_data = array("forumname" => strip_tags($PHORUM["DATA"]["NAME"]), "forum_id" => $PHORUM['forum_id'], "message_id" => $message['message_id'], "author" => phorum_api_user_get_display_name($message["user_id"], $message["author"], PHORUM_FLAG_PLAINTEXT), "subject" => $message['subject'], "full_body" => $message['body'], "plain_body" => phorum_strip_body($message['body']), "approve_url" => phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=messages"), "read_url" => phorum_get_url(PHORUM_READ_URL, $message['thread'], $message['message_id']), "mailmessage" => $mailmessage, "mailsubject" => $mailsubject, "mailmessagetpl" => $mailmessagetpl, "mailsubjecttpl" => $mailsubjecttpl, "language" => $PHORUM['language']);
if (isset($_POST[PHORUM_SESSION_LONG_TERM])) {
// strip any auth info from the read url
$mail_data["read_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["read_url"]);
$mail_data["approve_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["approve_url"]);
}
phorum_email_user($mail_users, $mail_data);
}
}