当前位置: 首页>>代码示例>>PHP>>正文


PHP phorum_api_url函数代码示例

本文整理汇总了PHP中phorum_api_url函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_api_url函数的具体用法?PHP phorum_api_url怎么用?PHP phorum_api_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了phorum_api_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: phorum_api_redirect

/**
 * Redirect the browser to a different page.
 *
 * @param string|integer $url
 *
 *     The URL to redirect to, in case $url is a string.
 *
 *     In case an integer is used, then this is treated as one of
 *     the PHORUM_*_URL constants for building a Phorum URL. The API
 *     call phorum_api_url() will be called to build the URL using
 *     the $url value and any other arguments that are provided to
 *     the function call. After building the URL, the browser is
 *     redirected to that URL.
 */
function phorum_api_redirect($url)
{
    // Handle building of a Phorum URL in case an integer value was
    // provided as the URL.
    if (is_integer($url)) {
        $argv = func_get_args();
        $url = call_user_func_array('phorum_api_url', $argv);
    }
    // Some browsers strip the anchor from the URL in case we redirect
    // from a POSTed page :-/. So here we wrap the redirect,
    // to work around that problem. Instead of redirecting directly,
    // we do a GET request to Phorum's redirect.php script, which we
    // send the URL to redirect to in a request parameter. Then, the
    // redirect.php script will handle the actual redirect.
    if (count($_POST) && strstr($url, "#")) {
        $url = phorum_api_url(PHORUM_REDIRECT_URL, 'phorum_redirect_to=' . urlencode($url));
    }
    // Check for response splitting and valid http(s) URLs.
    if (preg_match("/\\s/", $url) || !preg_match("!^https?://!i", $url)) {
        $url = phorum_api_url(PHORUM_INDEX_URL);
    }
    // An ugly IIS-hack to avoid crashing IIS servers.
    if (isset($_SERVER['SERVER_SOFTWARE']) && stristr($_SERVER['SERVER_SOFTWARE'], "Microsoft-IIS")) {
        $qurl = htmlspecialchars($url);
        $jurl = addslashes($url);
        print "<html><head><title>Redirecting ...</title>\n               <script type=\"text/javascript\">\n               //<![CDATA[\n               document.location.href='{$jurl}'\n               //]]>\n               </script>\n               <meta http-equiv=\"refresh\"\n                     content=\"0; URL={$qurl}\">\n               </head>\n               <body><a href=\"{$qurl}\">Redirecting ...</a></body>\n               </html>";
    } else {
        header("Location: {$url}");
    }
    exit(0);
}
开发者ID:samuell,项目名称:Core,代码行数:45,代码来源:redirect.php

示例2: phorum_mod_smileys_editor_tool_plugin

function phorum_mod_smileys_editor_tool_plugin()
{
    $PHORUM = $GLOBALS['PHORUM'];
    $lang = $PHORUM["DATA"]["LANG"]["mod_smileys"];
    // Register the smiley tool button for the message body.
    if (!empty($PHORUM['mod_smileys']['smileys_tool_enabled'])) {
        editor_tools_register_tool('smiley', $lang['smiley'], "./mods/smileys/icon.gif", "editor_tools_handle_smiley()", NULL, NULL, 'body');
    }
    // Register the smiley tool button for the message subject.
    if (!empty($PHORUM['mod_smileys']['subjectsmileys_tool_enabled'])) {
        editor_tools_register_tool('subjectsmiley', $lang['subjectsmiley'], "./mods/smileys/icon.gif", "editor_tools_handle_subjectsmiley()", NULL, NULL, 'subject');
    }
    $description = isset($lang['smileys help']) ? $lang['smileys help'] : 'smileys help';
    // Register the smileys help page.
    editor_tools_register_help($description, phorum_api_url(PHORUM_ADDON_URL, 'module=smileys', 'action=help'));
}
开发者ID:netovs,项目名称:Core,代码行数:16,代码来源:smileys.php

示例3: phorum_api_feed_js

/**
 * This function implements the JavaScript output adapter for the Feed API.
 *
 * @param array $messages
 *     An array of messages to include in the feed.
 *
 * @param array $forums
 *     An array of related forums.
 *
 * @param string $url
 *     The URL that points to the feed's target.
 *
 * @param string $title
 *     The title to use for the feed.
 *
 * @param string $description
 *     The description to use for the feed.
 *
 * @param bool $replies
 *     Whether or not this is a feed that includes reply messages.
 *     If not, then it will only contain thread starter messages.
 *
 * @return array
 *     An array containing two elements:
 *     - The generated feed data (JavaScript code)
 *     - The Content-Type header to use for the feed.
 */
function phorum_api_feed_js($messages, $forums, $url, $title, $description, $replies)
{
    global $PHORUM;
    $feed = array('title' => $title, 'description' => $description, 'modified' => phorum_api_format_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 = !empty($users[$message['user_id']]) ? $users[$message['user_id']] : $message['author'];
        // Created date.
        $fmt = $PHORUM['short_date'];
        $created = phorum_api_format_date($fmt, $message['datestamp']);
        // Updated date.
        if ($message['parent_id']) {
            if (!empty($message['meta']['edit_date'])) {
                $modified = $message['meta']['edit_date'];
            } else {
                $modified = $message['datestamp'];
            }
        } else {
            $modified = $message['modifystamp'];
        }
        $modified = phorum_api_format_date($fmt, $modified);
        $url = htmlspecialchars(phorum_api_url(PHORUM_FOREIGN_READ_URL, $message['forum_id'], $message['thread'], $message['message_id']));
        $item = array('title' => strip_tags($message['subject']), 'author' => $author, 'category' => $forums[$message['forum_id']]['name'], 'created' => $created, 'modified' => $modified, 'url' => $url, '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_feed = ' . phorum_api_json_encode($feed);
    return array($buffer, 'text/javascript');
}
开发者ID:samuell,项目名称:Core,代码行数:64,代码来源:js.php

示例4: phorum_pm_format

function phorum_pm_format($messages)
{
    global $PHORUM;
    // Reformat message so it looks like a forum message (so we can run it
    // through phorum_api_message_format()) and do some PM specific formatting.
    foreach ($messages as $id => $message) {
        // The formatting code expects a message id.
        $messages[$id]["message_id"] = $id;
        // Read URLs need a folder id, so we only create that URL if
        // one's available.
        if (isset($message['pm_folder_id'])) {
            $folder_id = $message['pm_folder_id'] ? $message['pm_folder_id'] : $message['special_folder'];
            $messages[$id]["URL"]["READ"] = phorum_api_url(PHORUM_PM_URL, "page=read", "folder_id={$folder_id}", "pm_id={$id}");
        }
        // The datestamp is only available for already posted messages.
        if (isset($message['datestamp'])) {
            $messages[$id]["raw_date"] = $message["datestamp"];
            $messages[$id]["date"] = phorum_api_format_date($PHORUM["short_date_time"], $message["datestamp"]);
        }
        if (isset($message['meta']) && !is_array($message['meta'])) {
            $messages[$id]['meta'] = unserialize($message['meta']);
        }
        $messages[$id]["body"] = isset($message["message"]) ? $message["message"] : "";
        $messages[$id]["email"] = "";
        $messages[$id]["URL"]["PROFILE"] = phorum_api_url(PHORUM_PROFILE_URL, $message["user_id"]);
        $messages[$id]["recipient_count"] = 0;
        $messages[$id]["receive_count"] = 0;
        if (isset($message["recipients"]) && is_array($message["recipients"])) {
            $receive_count = 0;
            foreach ($message["recipients"] as $rcpt_id => $rcpt) {
                if (!empty($rcpt["read_flag"])) {
                    $receive_count++;
                }
                if (!isset($rcpt["display_name"])) {
                    $messages[$id]["recipients"][$rcpt_id]["display_name"] = $PHORUM["DATA"]["LANG"]["AnonymousUser"];
                } else {
                    $messages[$id]["recipients"][$rcpt_id]["display_name"] = empty($PHORUM["custom_display_name"]) ? htmlspecialchars($rcpt["display_name"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]) : $rcpt["display_name"];
                    $messages[$id]["recipients"][$rcpt_id]["URL"]["PROFILE"] = phorum_api_url(PHORUM_PROFILE_URL, $rcpt_id);
                }
            }
            $messages[$id]["recipient_count"] = count($message["recipients"]);
            $messages[$id]["receive_count"] = $receive_count;
        }
    }
    // Run the messages through the standard formatting code.
    $messages = phorum_api_format_messages($messages);
    // Reformat message back to a private message.
    foreach ($messages as $id => $message) {
        $messages[$id]["message"] = $message["body"];
        unset($messages[$id]["body"]);
    }
    return $messages;
}
开发者ID:netovs,项目名称:Core,代码行数:53,代码来源:pm.php

示例5: array

<?php

if (!defined('PHORUM') || phorum_page !== 'moderation') {
    return;
}
$PHORUM['DATA']['HEADING'] = $PHORUM['DATA']['LANG']['Moderate'] . ': ' . $PHORUM['DATA']['LANG']['SplitThread'];
$PHORUM['DATA']['BREADCRUMBS'][] = array('URL' => NULL, 'TEXT' => $PHORUM['DATA']['HEADING'], 'TYPE' => 'split');
$PHORUM['DATA']['URL']["ACTION"] = phorum_api_url(PHORUM_MODERATION_ACTION_URL);
$message = $PHORUM['DB']->get_message($msgthd_id);
$new_subject = preg_replace('/^Re:\\s*/', '', $message['subject']);
$PHORUM['DATA']["FORM"]["forum_id"] = $PHORUM["forum_id"];
$PHORUM['DATA']["FORM"]["thread_id"] = $message["thread"];
$PHORUM['DATA']["FORM"]["message_id"] = $msgthd_id;
$PHORUM['DATA']["FORM"]["message_subject"] = htmlspecialchars($message["subject"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
$PHORUM['DATA']["FORM"]["new_message_subject"] = htmlspecialchars($new_subject, ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
$PHORUM['DATA']["FORM"]["mod_step"] = PHORUM_DO_THREAD_SPLIT;
$template = "split_form";
开发者ID:netovs,项目名称:Core,代码行数:17,代码来源:split_thread.php

示例6: phorum_build_common_urls

/**
 * Generate the URLs that are used on most pages.
 */
function phorum_build_common_urls()
{
    global $PHORUM;
    $GLOBALS["PHORUM"]["DATA"]["URL"]["BASE"] = phorum_api_url(PHORUM_BASE_URL);
    $GLOBALS["PHORUM"]["DATA"]["URL"]["HTTP_PATH"] = $PHORUM['http_path'];
    $GLOBALS["PHORUM"]["DATA"]["URL"]["LIST"] = phorum_api_url(PHORUM_LIST_URL);
    // These links are only needed in forums, not in folders.
    if (isset($PHORUM['folder_flag']) && !$PHORUM['folder_flag']) {
        $GLOBALS["PHORUM"]["DATA"]["URL"]["POST"] = phorum_api_url(PHORUM_POSTING_URL);
        $GLOBALS["PHORUM"]["DATA"]["URL"]["SUBSCRIBE"] = phorum_api_url(PHORUM_SUBSCRIBE_URL);
    }
    $GLOBALS["PHORUM"]["DATA"]["URL"]["SEARCH"] = phorum_api_url(PHORUM_SEARCH_URL);
    // Find the id for the index.
    $index_id = -1;
    // A folder where we usually don't show the index-link but on
    // additional pages like search and login it is shown.
    if ($PHORUM['folder_flag'] && phorum_page != 'index' && ($PHORUM['forum_id'] == 0 || $PHORUM['vroot'] == $PHORUM['forum_id'])) {
        $index_id = $PHORUM['forum_id'];
        // Either a folder where the link should be shown (not vroot or root)
        // or an active forum where the link should be shown.
    } elseif ($PHORUM['folder_flag'] && ($PHORUM['forum_id'] != 0 && $PHORUM['vroot'] != $PHORUM['forum_id']) || !$PHORUM['folder_flag'] && $PHORUM['active']) {
        // Go to root or vroot.
        if (isset($PHORUM["index_style"]) && $PHORUM["index_style"] == PHORUM_INDEX_FLAT) {
            // vroot is either 0 (root) or another id
            $index_id = $PHORUM["vroot"];
            // Go to the parent folder.
        } else {
            $index_id = $PHORUM["parent_id"];
        }
    }
    if ($index_id > -1) {
        // check if its the full root, avoid adding an id in this case (SE-optimized ;))
        if (!empty($index_id)) {
            $GLOBALS["PHORUM"]["DATA"]["URL"]["INDEX"] = phorum_api_url(PHORUM_INDEX_URL, $index_id);
        } else {
            $GLOBALS["PHORUM"]["DATA"]["URL"]["INDEX"] = phorum_api_url(PHORUM_INDEX_URL);
        }
    }
    // these urls depend on the login-status of a user
    if ($GLOBALS["PHORUM"]["DATA"]["LOGGEDIN"]) {
        $GLOBALS["PHORUM"]["DATA"]["URL"]["LOGINOUT"] = phorum_api_url(PHORUM_LOGIN_URL, "logout=1");
        $GLOBALS["PHORUM"]["DATA"]["URL"]["REGISTERPROFILE"] = phorum_api_url(PHORUM_CONTROLCENTER_URL);
        $GLOBALS["PHORUM"]["DATA"]["URL"]["VIEWPROFILE"] = phorum_api_url(PHORUM_PROFILE_URL, $PHORUM['user']['user_id']);
        $GLOBALS["PHORUM"]["DATA"]["URL"]["PM"] = phorum_api_url(PHORUM_PM_URL);
    } else {
        $GLOBALS["PHORUM"]["DATA"]["URL"]["LOGINOUT"] = phorum_api_url(PHORUM_LOGIN_URL);
        $GLOBALS["PHORUM"]["DATA"]["URL"]["REGISTERPROFILE"] = phorum_api_url(PHORUM_REGISTER_URL);
    }
}
开发者ID:netovs,项目名称:Core,代码行数:52,代码来源:common.php

示例7: elseif

    // the admin. If they aren't then either set a message with a login link
    // (when running as include) or redirect to the login page.
} elseif ($PHORUM["DATA"]["LOGGEDIN"] && !$PHORUM["DATA"]["FULLY_LOGGEDIN"]) {
    if (isset($PHORUM["postingargs"]["as_include"])) {
        // Generate the URL to return to after logging in.
        $args = array(PHORUM_REPLY_URL, $PHORUM["args"][1]);
        if (isset($PHORUM["args"][2])) {
            $args[] = $PHORUM["args"][2];
        }
        if (isset($PHORUM["args"]["quote"])) {
            $args[] = "quote=1";
        }
        phorum_api_url;
        // Make sure the URL API layer code is loaded.
        $redir = urlencode(call_user_func_array('phorum_api_url', $args));
        $url = phorum_api_url(PHORUM_LOGIN_URL, "redir={$redir}");
        $PHORUM["DATA"]["URL"]["CLICKHERE"] = $url;
        $PHORUM["DATA"]["CLICKHEREMSG"] = $PHORUM["DATA"]["LANG"]["ClickHereToLogin"];
        $PHORUM["DATA"]["OKMSG"] = '<a name="REPLY"></a>' . $PHORUM["DATA"]["LANG"]["NoPost"] . ' ' . $PHORUM["DATA"]["LANG"]["PeriodicLogin"];
        $PHORUM["posting_template"] = "message";
        return;
    } else {
        // Generate the URL to return to after logging in.
        $args = array(PHORUM_POSTING_URL);
        if (isset($PHORUM["args"][1])) {
            $args[] = $PHORUM["args"][1];
        }
        if (isset($PHORUM["args"][2])) {
            $args[] = $PHORUM["args"][2];
        }
        if (isset($PHORUM["args"]["quote"])) {
开发者ID:samuell,项目名称:Core,代码行数:31,代码来源:check_permissions.php

示例8: array

    $checkvar = 1;
    // Get the threads
    $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_api_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_api_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_api_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_api_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_api_format_date($PHORUM["short_date_time"], $row["datestamp"]);
    }
    $rows = phorum_api_format_messages($rows);
    $PHORUM['DATA']['PREPOST'] = array_merge($PHORUM['DATA']['PREPOST'], $rows);
}
if (!$numunapproved) {
    $PHORUM["DATA"]["UNAPPROVEDMESSAGE"] = $PHORUM["DATA"]["LANG"]["NoUnapprovedMessages"];
}
$template = "cc_prepost";
开发者ID:netovs,项目名称:Core,代码行数:31,代码来源:messages.php

示例9: 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_api_url(PHORUM_ADDON_URL, 'module=bbcode', 'action=help'));
    }
    // Make language strings available for the editor tools javascript code.
    editor_tools_register_translations($lang);
}
开发者ID:samuell,项目名称:Core,代码行数:36,代码来源:bbcode.php

示例10: phorum_api_user_list

    }
    // if the option to build a dropdown list is enabled, build the list of members that could be added
    if ($PHORUM["enable_dropdown_userlist"]) {
        $userlist = phorum_api_user_list(PHORUM_GET_ACTIVE);
        $PHORUM["DATA"]["NEWMEMBERS"] = array();
        foreach ($userlist as $userid => $userinfo) {
            if (!in_array($userid, $usersingroup)) {
                $userinfo["username"] = htmlspecialchars($userinfo["username"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
                $userinfo["display_name"] = htmlspecialchars($userinfo["display_name"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]);
                $PHORUM["DATA"]["NEWMEMBERS"][] = $userinfo;
            }
        }
    }
} else {
    $PHORUM["DATA"]["GROUPS"] = array();
    $groups = phorum_api_user_check_group_access(PHORUM_USER_GROUP_MODERATOR, PHORUM_ACCESS_LIST);
    // Turn the groups into a group id => group name mapping.
    foreach ($groups as $id => $group) {
        $groups[$id] = $group['name'];
    }
    // put these things in order so the user can read them
    asort($groups);
    foreach ($groups as $groupid => $groupname) {
        // get the group members who are unapproved, so we can count them
        $members = $PHORUM['DB']->get_group_members($groupid, PHORUM_USER_GROUP_UNAPPROVED);
        $full_members = $PHORUM['DB']->get_group_members($groupid);
        $PHORUM["DATA"]["GROUPS"][] = array("id" => $groupid, "name" => $groupname, "unapproved" => count($members), "members" => count($full_members), "URL" => array("VIEW" => phorum_api_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $groupid), "UNAPPROVED" => phorum_api_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_GROUP_MODERATION, "group=" . $groupid, "filter=" . PHORUM_USER_GROUP_UNAPPROVED)));
    }
}
$PHORUM["DATA"]['POST_VARS'] .= "<input type=\"hidden\" name=\"group\" value=\"{$group_id}\" />\n";
$template = "cc_groupmod";
开发者ID:netovs,项目名称:Core,代码行数:31,代码来源:groupmod.php

示例11: substr

    if (substr($var, 0, 7) == "detach:") {
        $do_detach = substr($var, 7);
    }
}
// Check if the user uploads an attachment. We remove file uploads
// with no name set, because that simply means the user did not select
// a file to upload. Not an error condition in this case.
foreach ($_FILES as $key => $val) {
    if (!isset($val["name"]) || $val["name"] == "") {
        unset($_FILES[$key]);
    }
}
$do_attach = count($_FILES) ? true : false;
// Set all our URL's
phorum_build_common_urls();
$PHORUM["DATA"]["URL"]["ACTION"] = phorum_api_url(PHORUM_POSTING_ACTION_URL);
// Keep track of errors.
$PHORUM["DATA"]["ERROR"] = null;
// Do things that are specific for first time or followup requests.
if ($initial) {
    include './include/posting/request_first.php';
} else {
    include './include/posting/request_followup.php';
}
// Store the posting mode in the form parameters, so we can remember
// the mode throughout the editing cycle (for example to be able to
// create page titles which match the editing mode).
$PHORUM["DATA"]["MODE"] = $mode;
// Set the page title, description and breadcrumbs accordingly
switch ($mode) {
    case "post":
开发者ID:samuell,项目名称:Core,代码行数:31,代码来源:posting.php

示例12: phorum_api_feed


//.........这里部分代码省略.........
    $content_type = NULL;
    // Try to retrieve the data from cache.
    if (!empty($PHORUM['cache_rss'])) {
        // Build the cache key that uniquely identifies the requested feed.
        $cache_key = $PHORUM['user']['user_id'] . '|' . $adapter . '|' . $source_type . '|' . $cache_part . '|' . $replies . '|' . $count;
        $cache = phorum_api_cache_get('feed', $cache_key);
        if (!empty($cache)) {
            list($data, $content_type) = $cache;
        }
    }
    // No data from cache. Load the recent threads / messages
    // directly from the database and generate the feed data.
    if (empty($data)) {
        // ----------------------------------------------------------------
        // Retrieve the messages to show
        // ----------------------------------------------------------------
        $messages = $PHORUM['DB']->get_recent_messages($count, 0, $forum_ids, $thread_id, $replies ? LIST_RECENT_MESSAGES : LIST_RECENT_THREADS);
        // Temporarily, remove the user list from the messages array.
        $users = $messages['users'];
        unset($messages['users']);
        // Apply the "read" hook(s) to the messages.
        if (isset($PHORUM['hooks']['read'])) {
            $messages = phorum_api_hook('read', $messages);
        }
        // Apply formatting to the messages.
        $messages = phorum_api_format_messages($messages);
        // Put the array of users back in the messages array.
        $messages['users'] = $users;
        // ----------------------------------------------------------------
        // Setup the feed URL, title and description based on
        // the type of feed that was requested.
        // ----------------------------------------------------------------
        if ($source_type === PHORUM_FEED_VROOT) {
            $feed_url = phorum_api_url(PHORUM_INDEX_URL);
            $feed_title = strip_tags($PHORUM['DATA']['TITLE']);
            $feed_description = !empty($PHORUM['description']) ? $PHORUM['description'] : '';
        }
        if ($source_type === PHORUM_FEED_FORUM) {
            $feed_url = phorum_api_url(PHORUM_LIST_URL);
            /**
             * @todo The formatting of the forum base feed data should
             *       be based on the data in $forum and not the common.php
             *       $PHORUM contents. This is left as is for now, because
             *       the wrong data will only be shown for threads that
             *       were moved to a different forum.
             */
            $feed_title = strip_tags($PHORUM['DATA']['TITLE'] . ' - ' . $PHORUM['DATA']['NAME']);
            $feed_description = strip_tags($PHORUM['DATA']['DESCRIPTION']);
        }
        if ($source_type === PHORUM_FEED_THREAD) {
            // Retrieve the information for the forum to which the thread
            // belongs. Normally, this should be in $PHORUM already, but
            // let's make sure that the caller is using the correct forum id
            // in the URL here (since the thread might have been moved to
            // a different forum).
            $forum_id = $thread['forum_id'];
            if ($PHORUM['forum_id'] == $forum_id) {
                $forum = $PHORUM;
                // contains all required data already
            } else {
                $forum = phorum_api_forums_by_forum_id($forum_id);
                if (empty($forum)) {
                    trigger_error("phorum_api_feed(): Forum for forum_id \"{$id}\" not found.", E_USER_ERROR);
                }
            }
            $forums = array($forum_id => $forum);
开发者ID:netovs,项目名称:Core,代码行数:67,代码来源:feed.php

示例13: 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_api_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
开发者ID:samuell,项目名称:Core,代码行数:31,代码来源:message_prune.php

示例14: phorum_api_feed_rss

/**
 * This function implements the RSS output adapter for the Feed API.
 *
 * @param array $messages
 *     An array of messages to include in the feed.
 *
 * @param array $forums
 *     An array of related forums.
 *
 * @param string $url
 *     The URL that points to the feed's target.
 *
 * @param string $title
 *     The title to use for the feed.
 *
 * @param string $description
 *     The description to use for the feed.
 *
 * @param bool $replies
 *     Whether or not this is a feed that includes reply messages.
 *     If not, then it will only contain thread starter messages.
 *
 * @return array
 *     An array containing two elements:
 *     - The generated feed data (RSS XML).
 *     - The Content-Type header to use for the feed.
 */
function phorum_api_feed_rss($messages, $forums, $url, $title, $description, $replies)
{
    global $PHORUM;
    $hcharset = $PHORUM['DATA']['HCHARSET'];
    $url = htmlspecialchars($url, ENT_COMPAT, $hcharset);
    $title = htmlspecialchars($title, ENT_COMPAT, $hcharset);
    $description = htmlspecialchars($description, ENT_COMPAT, $hcharset);
    $builddate = htmlspecialchars(date('r'), ENT_COMPAT, $hcharset);
    $generator = htmlspecialchars('Phorum ' . PHORUM, ENT_COMPAT, $hcharset);
    $buffer = "<?xml version=\"1.0\" encoding=\"{$PHORUM['DATA']['CHARSET']}\"?>\n";
    $buffer .= "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
    $buffer .= " <channel>\n";
    $buffer .= "  <title>{$title}</title>\n";
    $buffer .= "  <description>{$description}</description>\n";
    $buffer .= "  <link>{$url}</link>\n";
    $buffer .= "  <lastBuildDate>{$builddate}</lastBuildDate>\n";
    $buffer .= "  <generator>{$generator}</generator>\n";
    // 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) {
        // Include information about the number of replies to threads.
        $title = strip_tags($message['subject']);
        if (!$replies) {
            $lang = $PHORUM['DATA']['LANG'];
            switch ($message['thread_count']) {
                case 1:
                    $title .= " ({$lang['noreplies']})";
                    break;
                case 2:
                    $title .= " (1 {$lang['reply']})";
                    break;
                default:
                    $replies = $message['thread_count'] - 1;
                    $title .= " ({$replies} {$lang['replies']})";
            }
            $date = date('r', $message['modifystamp']);
        } else {
            $date = date('r', $message['datestamp']);
        }
        // Generate the URL for reading the message.
        $url = htmlspecialchars(phorum_api_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"], $message["message_id"]));
        // The forum in which the message is stored is used as the category.
        $category = htmlspecialchars($forums[$message['forum_id']]['name'], ENT_COMPAT, $hcharset);
        // Format the author.
        $author = !empty($users[$message['user_id']]) ? $users[$message['user_id']] : $message['author'];
        $author = htmlspecialchars($author, ENT_COMPAT, $hcharset);
        // Strip unprintable characters from the message body.
        $body = strtr($message['body'], "\v\f" . "", "????????????????????????????");
        $buffer .= "  <item>\n";
        $buffer .= "   <guid>{$url}</guid>\n";
        $buffer .= "   <title>{$title}</title>\n";
        $buffer .= "   <link>{$url}</link>\n";
        $buffer .= "   <description><![CDATA[{$body}]]></description>\n";
        $buffer .= "   <dc:creator>{$author}</dc:creator>\n";
        $buffer .= "   <category>{$category}</category>\n";
        $buffer .= "   <pubDate>{$date}</pubDate>\n";
        $buffer .= "  </item>\n";
    }
    $buffer .= " </channel>\n";
    $buffer .= "</rss>\n";
    return array($buffer, 'application/xml');
}
开发者ID:samuell,项目名称:Core,代码行数:92,代码来源:rss.php

示例15: phorum_api_redirect

    // the mark all read URL.
    phorum_api_redirect(PHORUM_INDEX_URL, (int) $PHORUM['forum_id']);
}
// Somehow we arrived at a forum instead of a folder.
// Redirect the user to the message list for that forum.
if (!empty($PHORUM["forum_id"]) && $PHORUM["folder_flag"] == 0) {
    phorum_api_redirect(PHORUM_LIST_URL);
}
// Setup the "mark all read" URL.
if ($PHORUM["DATA"]["LOGGEDIN"]) {
    $PHORUM["DATA"]["URL"]["MARKVROOTREAD"] = phorum_api_url(PHORUM_INDEX_URL, $PHORUM["forum_id"], "markallread");
}
// Setup the syndication feed URLs for this folder.
$PHORUM['DATA']['FEEDS'] = array();
if (!empty($PHORUM['use_rss'])) {
    // Add the feed for new threads.
    $PHORUM['DATA']['FEEDS'][] = array('URL' => phorum_api_url(PHORUM_FEED_URL, $PHORUM['vroot'], 'type=' . $PHORUM['default_feed']), 'TITLE' => $PHORUM['DATA']['FEED'] . ' (' . strtolower($PHORUM['DATA']['LANG']['Threads']) . ')');
    // Add the feed for new threads and their replies.
    $PHORUM['DATA']['FEEDS'][] = array('URL' => phorum_api_url(PHORUM_FEED_URL, $PHORUM['vroot'], 'replies=1', 'type=' . $PHORUM['default_feed']), 'TITLE' => $PHORUM['DATA']['FEED'] . ' (' . strtolower($PHORUM['DATA']['LANG']['Threads'] . ' + ' . $PHORUM['DATA']['LANG']['replies']) . ')');
}
// From here on we differentiate the code per index style that we use.
switch ($PHORUM['index_style']) {
    case PHORUM_INDEX_FLAT:
        require_once './include/index/flat.php';
        break;
    case PHORUM_INDEX_DIRECTORY:
    default:
        // Should not happen
        require_once './include/index/directory.php';
        break;
}
开发者ID:samuell,项目名称:Core,代码行数:31,代码来源:index.php


注:本文中的phorum_api_url函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。