Example #1
0
    if ($Errors == 0) {
        // Mark this extension as enabled using a convenience method.
        AddConfigurationSetting($Context, 'NOTIFY_SETUP');
    }
}
if (!array_key_exists('NOTIFY_VERSION', $Configuration)) {
    AddConfigurationSetting($Context, 'NOTIFY_ALLOW_ALL', '1');
    AddConfigurationSetting($Context, 'NOTIFY_ALLOW_DISCUSSION', '1');
    AddConfigurationSetting($Context, 'NOTIFY_ALLOW_CATEGORY', '1');
    AddConfigurationSetting($Context, 'NOTIFY_VERSION', '1.0.0');
    if (!mysql_query("ALTER TABLE `" . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Category` ADD `Subscribeable` INT( 1 ) NOT NULL ;", $Context->Database->Connection)) {
        $Errors = 1;
    }
}
if ($Context->Configuration['NOTIFY_VERSION'] < '1.2.0') {
    AddConfigurationSetting($Context, 'NOTIFY_AUTO_ALL', '0');
    $cm = new ConfigurationManager($Context);
    $cm->GetSettingsFromFile($Configuration['APPLICATION_PATH'] . 'conf/settings.php');
    $cm->DefineSetting('NOTIFY_VERSION', '1.2.0');
    $cm->SaveSettingsToFile($Configuration['APPLICATION_PATH'] . 'conf/settings.php');
}
function CheckNotifySyntax($Context, $Method, $SelectID)
{
    switch ($Method) {
        case 'ALL':
            if ($SelectID == 0) {
                return true;
            } else {
                return false;
            }
        case 'CATEGORY':
Example #2
0
* Copyright (c) 2008 Steve Clay <*****@*****.**>
*
* Vanilla Bridge:
* Copyright (c) 2009 Klaus Burton <http://www.redskiesdesign.com/>
* Copyright (c) 2009 Damien Lebrun <*****@*****.**>
*/
// Make sure the fille is included in vanilla
if (!defined('IN_VANILLA')) {
    exit;
}
// Disable extension if php < 5.2.1 (Minify requirement
if (version_compare(PHP_VERSION, '5.2.1') < 0) {
    return;
}
if (!array_key_exists('MINIFY_PACKING_LEVEL', $Configuration)) {
    AddConfigurationSetting($Context, 'MINIFY_PACKING_LEVEL', 3);
}
$Context->AddToDelegate('Head', 'PackAssets', 'Minify_Head_PackAssets_Delegation');
/**
 * Handler for PackAssets Delegation
 *
 * @param Head $Head
 */
function Minify_Head_PackAssets_Delegation(&$Head)
{
    Minify_Script($Head);
    Minify_StyleSheets($Head);
}
/**
 * Replace multiple JS file from $Head->_Scripts by one or more request
 * to Minify which will pack them.
Example #3
0
}
// Define a constant to prevent a register_globals attack on the configuration paths
define('IN_VANILLA', '1');
//upgrade database
if ($Configuration['DATABASE_VERSION'] < 2) {
    include_once $Configuration['APPLICATION_PATH'] . 'appg/database.php';
    include_once $Configuration['DATABASE_PATH'];
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Functions.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.Database.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.' . $Configuration['DATABASE_SERVER'] . '.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.SqlBuilder.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.MessageCollector.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.ErrorManager.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.ObjectFactory.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.StringManipulator.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.Context.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Framework/Framework.Class.Delegation.php';
    include_once $Configuration['LIBRARY_PATH'] . 'Vanilla/Vanilla.Functions.php';
    include_once $Configuration['LIBRARY_PATH'] . $Configuration['AUTHENTICATION_MODULE'];
    include_once $Configuration['LIBRARY_PATH'] . 'People/People.Class.Session.php';
    include_once $Configuration['LIBRARY_PATH'] . 'People/People.Class.PasswordHash.php';
    include_once $Configuration['LIBRARY_PATH'] . 'People/People.Class.User.php';
    $Context = new Context($Configuration);
    $Context->DatabaseTables =& $DatabaseTables;
    $Context->DatabaseColumns =& $DatabaseColumns;
    $Query = 'ALTER TABLE ' . GetTableName('User', $DatabaseTables, $Configuration["DATABASE_TABLE_PREFIX"]) . ' CHANGE ' . $DatabaseColumns['User']['Password'] . ' ' . $DatabaseColumns['User']['Password'] . ' VARBINARY( 34 ) NULL DEFAULT NULL';
    if ($Context->Database->Execute($Query, '', '', '', 0)) {
        AddConfigurationSetting($Context, 'DATABASE_VERSION', '2');
    }
    unset($Context, $Query);
}
Example #4
0
     if (!mysql_query("SELECT MarkAllRead\r\n\t\t\tFROM " . $DatabasePrefix . "User\r\n\t\t\tLIMIT 1,1", $Context->Database->Connection)) {
         // Attempt to add the column
         if (!mysql_query("ALTER TABLE " . $DatabasePrefix . "User \r\n\t\t\tADD MarkAllRead timestamp null DEFAULT null", $Context->Database->Connection)) {
             $Errors = 1;
         }
     }
     // Add the db structure to the database configuration file
     if ($Errors == 0) {
         $Structure = "\$DatabaseColumns['User']['MarkAllRead'] = 'MarkAllRead';\r\n";
         if (!AppendToConfigurationFile($Configuration['APPLICATION_PATH'] . 'conf/database.php', $Structure)) {
             $Errors = 1;
         }
     }
     // Mark this extension as enabled using a convenience method
     if ($Errors == 0) {
         AddConfigurationSetting($Context, 'MARKALLREADREDUX_SETUP');
     }
 }
 /**
  * 3. Get the User's MarkAllRead data
  */
 $result = mysql_query("\tSELECT MarkAllRead\r\n\t\t\tFROM " . $DatabasePrefix . "User\r\n\t\t\tWHERE UserID=" . $Context->Session->UserID . "", $Context->Database->Connection);
 $MarkAllReadRedux_UserData = strtotime(mysql_result($result, 0));
 /**
  * 4. Change Discussion Properties 
  */
 if (in_array($Context->SelfUrl, array('index.php', 'search.php'))) {
     if ($MarkAllReadRedux_UserData) {
         // This function changes Discussion properties relevant to "read" status
         function MarkAllReadRedux_ChangeDiscussionProperties(&$Discussion)
         {
Example #5
0
Version 1.4 - 27.04.2011, SubJunk
- Added support for the HtmlFormatter 2.5+ dynamic image resizing feature
- Increased default maximum width
*/
$Context->Dictionary['ExtensionOptions'] = 'Extension Options';
$Context->Dictionary['InlineImages'] = 'Inline Images';
$Context->Dictionary['InlineImagesNotes'] = 'With Inline Images you can display image attachments directly into your comments by using [Image_%AttachmentID%].<br>If an image width exceeds the maximum width it will be automatically resized.';
$Context->Dictionary['InlineImagesMaxWidth'] = 'Maximum Width';
$Context->Dictionary['UseThickBox'] = 'Use ThickBox (Requires JQuery and JQThickBox extensions!)';
// Maximum width of inline images
if (!array_key_exists('INLINEIMAGES_MAX_WIDTH', $Configuration)) {
    AddConfigurationSetting($Context, 'INLINEIMAGES_MAX_WIDTH', '5120');
}
// ThickBox Support
if (!array_key_exists('INLINEIMAGES_USE_THICKBOX', $Configuration)) {
    AddConfigurationSetting($Context, 'INLINEIMAGES_USE_THICKBOX', '0');
}
if (in_array($Context->SelfUrl, array('comments.php', 'post.php'))) {
    function InlineImages_RenderAttachment(&$AttachmentManager)
    {
        $Attachment =& $AttachmentManager->DelegateParameters['Attachment'];
        $AttachmentBody =& $AttachmentManager->DelegateParameters['AttachmentBody'];
        $Comment =& $AttachmentManager->DelegateParameters['Comment'];
        // Locate the image and check if it's an image file
        if (file_exists($Attachment->Path) && in_array($Attachment->Extension, array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) {
            // Init variables
            $WebRoot = $AttachmentManager->Context->Configuration['WEB_ROOT'];
            $ImageTag = '[Image_' . $Attachment->AttachmentID . ']';
            global $ImageBody;
            $ImageBody = '<a href="' . $WebRoot . 'extensions/InlineImages/image.jpg.php?AttachmentID=' . $Attachment->AttachmentID . '">';
            $ImageBody .= '<img src="' . $WebRoot . 'extensions/InlineImages/image.php?AttachmentID=' . $Attachment->AttachmentID . '" alt="' . $Attachment->Name . '" class="InlineImage" />';
Example #6
0
                include '_includes/usersettings.php';
                $Panel->AddListItem($Context->GetDefinition('AccountOptions'), $Context->GetDefinition('Notification'), GetUrl($Configuration, $Context->SelfUrl, "", "", "", "", "u=" . ForceIncomingInt('u', $Context->Session->UserID) . "&amp;PostBackAction=Notification"), "", "", 92);
                $Page->AddRenderControl($Context->ObjectFactory->NewContextObject($Context, "NotificationControl"), $Configuration["CONTROL_POSITION_BODY_ITEM"]);
            }
        }
    }
    $Head->AddStyleSheet('extensions/Notifi/style.css');
}
if (in_array($Context->SelfUrl, array('comments.php', 'index.php', 'account.php', 'categories.php'))) {
    $Head->AddScript('js/prototype.js');
    $Head->AddScript('js/scriptaculous.js');
    $Head->AddScript('extensions/Notifi/functions.js');
}
if ($Context->Session->UserID > 0) {
    mysql_query("UPDATE " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "User SET Notified = 0 WHERE UserID = '" . $Context->Session->UserID . "'");
}
if ($Context->SelfUrl == "settings.php" && $Context->Session->User->Permission('PERMISSION_MANAGE_EXTENSIONS')) {
    include '_includes/adminsettings.php';
}
// Remind admin/s to customize settings
if ($Context->SelfUrl == 'index.php' && !array_key_exists('NOTIFI_SETTINGS_NOTICE', $Configuration)) {
    if ($Context->Session->User && $Context->Session->User->Permission('PERMISSION_MANAGE_EXTENSIONS')) {
        $HideNotice = ForceIncomingBool('TurnOffNotifiSettingsNotice', 0);
        if ($HideNotice) {
            AddConfigurationSetting($Context, 'NOTIFI_SETTINGS_NOTICE', '1');
        } else {
            $NoticeCollector->AddNotice('<span><a href="' . GetUrl($Configuration, 'index.php', '', '', '', '', 'TurnOffNotifiSettingsNotice=1') . '">' . $Context->GetDefinition('RemoveThisNotice') . '</a></span>
	    ' . $Context->GetDefinition('RememberToSetNotifiSettingsPermissions'));
        }
    }
}
Example #7
0
        $NotifiCreate = "ALTER TABLE `" . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Category`\n    \t                  ADD `Subscribeable` INT( 1 ) DEFAULT 0;";
        if (!mysql_query($NotifiCreate, $Context->Database->Connection)) {
            $Errors = 1;
        }
    }
    // Create admin configuration settings which can then be controlled in the Extension Options -> Notification page under the Settings tab
    if (empty($Context->Configuration['NOTIFI_ALLOW_ALL'])) {
        AddConfigurationSetting($Context, 'NOTIFI_ALLOW_ALL', '1');
        AddConfigurationSetting($Context, 'NOTIFI_ALLOW_DISCUSSION', '1');
        AddConfigurationSetting($Context, 'NOTIFI_ALLOW_CATEGORY', '1');
    }
    if (empty($Context->Configuration['NOTIFI_AUTO_ALL'])) {
        AddConfigurationSetting($Context, 'NOTIFI_AUTO_ALL', '0');
    }
    if (empty($Context->Configuration['NOTIFI_ALLOW_BBCODE'])) {
        AddConfigurationSetting($Context, 'NOTIFI_ALLOW_BBCODE', '0');
        AddConfigurationSetting($Context, 'NOTIFI_FORMAT_PLAINTEXT', '0');
    }
    if (!$Errors) {
        AddConfigurationSetting($Context, 'NOTIFI_INSTALL_V3_COMPLETE', '1');
    }
}
// Check the Low-Cal Vanilla is installed
if (!empty($Configuration['LOWCALVANILLA_TOOLS_PATH'])) {
    // Include Low-Cal Vanilla.
    require_once $Configuration['LOWCALVANILLA_TOOLS_PATH'];
    // Add Notifi to be gzipped
    LowCalVanilla_AddScript($Context, $Head, 'extensions/Notifi/functions.js');
} else {
    $Head->AddScript('extensions/Notifi/functions.js');
}
Example #8
0
    // Create the User column WhisperNotification
    $result = mysql_query("SHOW columns FROM " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "User like 'WhisperNotification'");
    if (mysql_num_rows($result) == 0) {
        $WhisperfiCreate = "ALTER TABLE `" . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "User`\n\t\t\t\t\t ADD `WhisperNotification` TINYINT( 1 ) DEFAULT 1;";
        if (!mysql_query($WhisperfiCreate, $Context->Database->Connection)) {
            $Errors = 1;
        }
    }
    // Create the Comment column WhisperRead
    $result = mysql_query("SHOW columns FROM " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Comment like 'WhisperRead'");
    if (mysql_num_rows($result) == 0) {
        $WhisperReadCreate = "ALTER TABLE `" . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Comment`\n\t\t\t\t\t ADD `WhisperRead` TINYINT( 1 ) DEFAULT 0;";
        if (!mysql_query($WhisperReadCreate, $Context->Database->Connection)) {
            $Errors = 1;
        }
        // If it worked up to this point, set all current whispers as read
        if ($Errors == 0) {
            $WhisperReadPopulate = "UPDATE " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Comment SET WhisperRead = 1 WHERE WhisperUserID != 0";
            if (!mysql_query($WhisperReadPopulate, $Context->Database->Connection)) {
                $Errors = 1;
            }
        }
    }
    // Create admin configuration settings which can then be controlled in the Extension Options -> Notification page under the Settings tab
    if (empty($Context->Configuration['WHISPERFI_AUTO_ALL'])) {
        AddConfigurationSetting($Context, 'WHISPERFI_AUTO_ALL', '0');
    }
    if (!$Errors) {
        AddConfigurationSetting($Context, 'WHISPERFI_INSTALL_COMPLETE', '1');
    }
}
Example #9
0
<?php

/*
Extension Name: David
Extension Url: http://lussumo.com/addons/
Description: Removes Sticky Discussions from index page but shows them when you are viewing the Category. This is dedicated to my nephew who was recently killed in an auto accident.
Version: 1.0.1
Author: Jim Wurster
Author Url: http://www.jwurster.us/
*/
if (!defined('IN_VANILLA')) {
    exit;
}
include $Configuration['APPLICATION_PATH'] . 'conf/settings.php';
AddConfigurationSetting($Context, 'DAVID_VERSION', '1.0.1');
// Set the version number.
$Context->SetDefinition('David', 'View Sticky only on Category');
mysql_connect($Context->Configuration['DATABASE_HOST'], $Context->Configuration['DATABASE_USER'], $Context->Configuration['DATABASE_PASSWORD']);
mysql_select_db($Context->Configuration['DATABASE_NAME']);
// if you want to add a Category Sticky to show on the index page, uncomment the $SB->AddWhere line below with the CategoryID
// then change the value in the $CategoryToShow variable below for your Category
// if you want to add more Category Stickies to show, add new variables like the following and the add another $SB->AddWhere
// statement below like the current CategoryID statement
global $CategoryToShow;
$CategoryToShow = '5';
// change this to also show this Category Sticky
if ($Context->SelfUrl == "index.php" && isset($Head)) {
    // this allows you to see the Sticky on the Category page but not on the index page
    if (ForceIncomingString('CategoryID', '') < '1') {
        function Sticky_HideFromDiscussions(&$DiscussionManager)
        {
Example #10
0
            // Add control to comment form
            $Context->AddToDelegate("DiscussionForm", "CommentForm_PreButtonsRender", "CommentForm_AddAttachmentForm");
            // Upload files on PreSaveComment
            $Context->AddToDelegate("DiscussionForm", "PreSaveComment", "DiscussionForm_UploadAttachments");
            // Upload files on PreSaveDiscussion
            $Context->AddToDelegate("DiscussionForm", "PreSaveDiscussion", "DiscussionForm_UploadAttachments");
            // Save files on PostSaveComment
            $Context->AddToDelegate("DiscussionForm", "PostSaveComment", "DiscussionForm_SaveCommentAttachments");
            // Save files on PostSaveDiscussion
            $Context->AddToDelegate("DiscussionForm", "PostSaveDiscussion", "DiscussionForm_SaveDiscussionAttachments");
        }
    }
    // Handle downloads
    if (ForceIncomingString('PostBackAction', '') == 'Download') {
        $AttachmentID = ForceIncomingInt('AttachmentID', 0);
        $AttachmentManager = $Context->ObjectFactory->NewContextObject($Context, 'AttachmentManager');
        $AttachmentManager->DownloadAttachment($AttachmentID);
    }
    // Remind user to set permissions
    if ($Context->SelfUrl == 'index.php' && !array_key_exists('ATTACHMENTS_NOTICE', $Configuration)) {
        if ($Context->Session->User && $Context->Session->User->Permission('PERMISSION_MANAGE_EXTENSIONS')) {
            $HideNotice = ForceIncomingBool('TurnOffAttachmentsNotice', 0);
            if ($HideNotice) {
                AddConfigurationSetting($Context, 'ATTACHMENTS_NOTICE', '1');
            } else {
                $NoticeCollector->AddNotice('<span><a href="' . GetUrl($Configuration, 'index.php', '', '', '', '', 'TurnOffAttachmentsNotice=1') . '">' . $Context->GetDefinition('RemoveThisNotice') . '</a></span>
					' . $Context->GetDefinition('RememberToSetAttachmentsPermissions'));
            }
        }
    }
}