示例#1
0
$Context->SetDefinition("BrowsingHistory", "Browsing History");
$Context->SetDefinition("WhisperedDiscussions", "Whispered Discussions");
$Context->SetDefinition("DisplayBookmarks", "Display your bookmarks in the side panel");
$Context->SetDefinition("DisplayPrivateDiscussions", "Display your private discussions in the side panel");
$Context->SetDefinition("DisplayYourDiscussions", "Display your discussions in the side panel");
$Context->SetDefinition("DisplayBrowsingHistory", "Display your browsing history in the side panel");
$Context->SetDefinition('XNew', '//1 new');
$Context->SetDefinition('MaxBookmarksInPanel', 'Max bookmarks in panel');
$Context->SetDefinition('MaxPrivateInPanel', 'Max private in panel');
$Context->SetDefinition('MaxBrowsingHistoryInPanel', 'Max history in panel');
$Context->SetDefinition('MaxDiscussionsInPanel', 'Max own discussions in panel');
// Set up some default configuration options
CreateArrayEntry($Configuration, 'PANEL_BOOKMARK_COUNT', 10);
CreateArrayEntry($Configuration, 'PANEL_PRIVATE_COUNT', 5);
CreateArrayEntry($Configuration, 'PANEL_HISTORY_COUNT', 5);
CreateArrayEntry($Configuration, 'PANEL_USER_DISCUSSIONS_COUNT', 5);
if ($Context->SelfUrl == "account.php") {
    $Context->AddToDelegate("PreferencesForm", "PreRender", "PreferencesForm_AddPanelLists");
    function PreferencesForm_AddPanelLists(&$PreferencesForm)
    {
        $PreferencesForm->AddPreference("ControlPanel", "DisplayBookmarks", "ShowBookmarks");
        $PreferencesForm->AddPreference("ControlPanel", "DisplayYourDiscussions", "ShowRecentDiscussions");
        $PreferencesForm->AddPreference("ControlPanel", "DisplayBrowsingHistory", "ShowBrowsingHistory");
        if ($PreferencesForm->Context->Configuration["ENABLE_WHISPERS"]) {
            $PreferencesForm->AddPreference("ControlPanel", "DisplayPrivateDiscussions", "ShowPrivateDiscussions");
        }
    }
}
if (in_array($Context->SelfUrl, array("index.php", "comments.php"))) {
    function AddBookmarksToPanel(&$Context, &$Panel, &$DiscussionManager, $OptionalDiscussionID = "0")
    {
示例#2
0
<?php

/*
Extension Name: Whisperfi
Extension Url: http://vanillaforums.org/addon/435/whisperfi
Description: An extension that displays a notification at the top of the Discussions page when a user has received a whisper.
Version: 1.1.1
Author: Klaus Burton
Author Url: http://www.redskiesdesign.com/
*/
// Include the file that handles installations and upgrades. Separated just for the sake of organisation.
if ($Context->Session->User->UserID > 0) {
    include '_includes/install.php';
}
CreateArrayEntry($Context->Dictionary, 'YouHaveBeenWhisperedIn', 'You have been whispered in the following discussions:');
// If user is currently viewing a whisper, mark it read
if ($Context->Configuration['ENABLE_WHISPERS']) {
    if (in_array($Context->SelfUrl, array('comments.php'))) {
        if ($Context->Session->User->UserID > 0 && (whisperfiCheck($Context, 'WhisperNotification') == 1 || $Context->Configuration['WHISPERFI_AUTO_ALL'])) {
            // Mark whispers in this discussion as read
            $DiscussionID = ForceIncomingInt("DiscussionID", "0");
            mysql_query("\n\t\t\t\t\tUPDATE " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Comment AS Comment\n\t\t\t\t\tLEFT JOIN " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Discussion as Discussion\n\t\t\t\t\tON Comment.DiscussionID = Discussion.DiscussionID\n\t\t\t\t\tSET Comment.WhisperRead = 1\n\t\t\t\t\tWHERE Comment.WhisperRead = '0' AND Discussion.DiscussionID = '" . $DiscussionID . "' AND (Discussion.WhisperUserID = '" . $Context->Session->UserID . "') OR (Comment.WhisperUserID = '" . $Context->Session->UserID . "')\n\t\t\t\t", $Context->Database->Connection);
        }
    }
}
if ($Context->Configuration['ENABLE_WHISPERS']) {
    if (in_array($Context->SelfUrl, array('comments.php', 'index.php', 'categories.php'))) {
        if ($Context->Session->User->UserID > 0 && (whisperfiCheck($Context, 'WhisperNotification') == 1 || $Context->Configuration['WHISPERFI_AUTO_ALL'])) {
            $showNotice = "no";
            global $showNotice;
            $msg = "";