Beispiel #1
0
 function ConvertImage($Source, $Options = Null)
 {
     if (is_string($Options)) {
         $Options = array('Options' => $Options);
     }
     $TargetFolder = GetValue('TargetFolder', $Options, 'uploads/cached', True);
     $Options = GetValue('Options', $Options);
     $Filename = CleanupString(pathinfo($Source, 8)) . '-' . Crc32Value($Source, $Options);
     $Extension = CleanupString(pathinfo($Source, 4));
     $ResultImage = $TargetFolder . DS . $Filename . '.' . $Extension;
     if (!file_exists($ResultImage)) {
         $Source = GetImageSource($Source);
         ImageMagick('convert', $Source, $Options, $ResultImage);
     }
     return $ResultImage;
 }
function GetUnreadQuerystring(&$Discussion, &$Configuration, $CurrentUserJumpToLastCommentPref = '0')
{
    $Suffix = '';
    if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') {
        $Suffix = CleanupString($Discussion->Name) . '/';
    }
    if ($CurrentUserJumpToLastCommentPref) {
        $UnreadCommentCount = $Discussion->CountComments - $Discussion->NewComments + 1;
        $ReadCommentCount = $Discussion->CountComments - $Discussion->NewComments;
        $PageNumber = CalculateNumberOfPages($ReadCommentCount, $Configuration['COMMENTS_PER_PAGE']);
        $JumpToItem = $ReadCommentCount - ($PageNumber - 1) * $Configuration['COMMENTS_PER_PAGE'];
        if ($JumpToItem < 0) {
            $JumpToItem = 0;
        }
        if ($PageNumber == 0) {
            $PageNumber = '';
        }
        return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $PageNumber, '#Item_' . $JumpToItem, $Suffix);
    } else {
        return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, '', '', $Suffix);
    }
}
		<li class="DiscussionType">
			<span>' . $this->Context->GetDefinition('DiscussionType') . '</span>' . DiscussionPrefix($this->Context, $Discussion) . '
		</li>
		<li class="DiscussionTopic">
			<span>' . $this->Context->GetDefinition('DiscussionTopic') . '</span><a href="' . $UnreadUrl . '">' . $Discussion->Name . '</a>
		</li>
		';
if ($this->Context->Configuration['USE_CATEGORIES']) {
    $DiscussionList .= '
			<li class="DiscussionCategory">
				<span>' . $this->Context->GetDefinition('Category') . ' </span><a href="' . GetUrl($this->Context->Configuration, 'index.php', '', 'CategoryID', $Discussion->CategoryID) . '">' . $Discussion->Category . '</a>
			</li>
			';
}
$DiscussionList .= '<li class="DiscussionStarted">
			<span><a href="' . GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, '', '#Item_1', CleanupString($Discussion->Name) . '/') . '">' . $this->Context->GetDefinition('StartedBy') . '</a> </span><a href="' . GetUrl($this->Context->Configuration, 'account.php', '', 'u', $Discussion->AuthUserID) . '">' . $Discussion->AuthUsername . '</a>
		</li>
		<li class="DiscussionComments">
			<span>' . $this->Context->GetDefinition('Comments') . ' </span>' . $Discussion->CountComments . '
		</li>
		<li class="DiscussionLastComment">
			<span><a href="' . $LastUrl . '">' . $this->Context->GetDefinition('LastCommentBy') . '</a> </span><a href="' . GetUrl($this->Context->Configuration, 'account.php', '', 'u', $Discussion->LastUserID) . '">' . $Discussion->LastUsername . '</a>
		</li>
		<li class="DiscussionActive">
			<span><a href="' . $LastUrl . '">' . $this->Context->GetDefinition('LastActive') . '</a> </span>' . TimeDiff($this->Context, $Discussion->DateLastActive, mktime()) . '
		</li>';
if ($this->Context->Session->UserID > 0) {
    $DiscussionList .= '
			<li class="DiscussionNew">
				<a href="' . $NewUrl . '"><span>' . $this->Context->GetDefinition('NewCaps') . ' </span>' . $Discussion->NewComments . '</a>
			</li>
<?php

// Note: This file is included from the library/Vanilla/Vanilla.Control.SearchForm.php class.
$CommentList .= '<li class="SearchComment' . ($Alternate ? ' Alternate' : '') . '">
	<ul>
		<li class="DiscussionTopic">
			<span>' . $this->Context->GetDefinition('DiscussionTopic') . '</span>
			<a href="' . GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $Comment->DiscussionID, '', '', CleanupString($Comment->Discussion) . '/') . '">' . $Comment->Discussion . '</a>
		</li>
		<li class="CommentText">
			<span>' . $this->Context->GetDefinition('Comment') . '</span>
			<a href="' . GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $Comment->DiscussionID, '', 'Focus=' . $Comment->CommentID . '#Comment_' . $Comment->CommentID, CleanupString($Comment->Discussion) . '/') . '">' . HighlightTrimmedString($Comment->Body, $HighlightWords, 300) . '</a>
		</li>
		<li class="DiscussionCategory">
			<span>' . $this->Context->GetDefinition('Category') . '</span>
			<a href="' . GetUrl($this->Context->Configuration, 'index.php', '', 'CategoryID', $Comment->CategoryID) . '">' . $Comment->Category . '</a>
		</li>
		<li class="CommentAuthor">
			<span>' . $this->Context->GetDefinition('WrittenBy') . '</span>
			<a href="' . GetUrl($this->Context->Configuration, 'account.php', '', 'u', $Comment->AuthUserID) . '">' . $Comment->AuthUsername . '</a>
		</li>
		<li class="CommentAdded">
			<span>' . $this->Context->GetDefinition('Added') . '</span>
			' . TimeDiff($this->Context, $Comment->DateCreated, mktime()) . '
		</li>';
$this->DelegateParameters['Comment'] =& $Comment;
$this->DelegateParameters['CommentList'] =& $CommentList;
$this->CallDelegate('PostCommentOptionsRender');
$CommentList .= '
	</ul>
</li>
 function DiscussionForm(&$Context)
 {
     $this->Name = 'DiscussionForm';
     $this->CommentFormAttributes = '';
     $this->DiscussionFormAttributes = '';
     $this->Constructor($Context);
     $this->FatalError = 0;
     $this->EditDiscussionID = 0;
     $this->CommentID = ForceIncomingInt('CommentID', 0);
     $this->DiscussionID = ForceIncomingInt('DiscussionID', 0);
     $this->DiscussionFormattedForDisplay = 0;
     $this->ValidActions = array('SaveDiscussion', 'SaveComment', 'Reply');
     $this->CallDelegate('PreLoadData');
     // Check permissions and make sure that the user can add comments/discussions
     // Make sure user can post
     if ($this->DiscussionID == 0 && $this->Context->Session->UserID == 0) {
         $this->Context->WarningCollector->Add($this->Context->GetDefinition('NoDiscussionsNotSignedIn'));
         $this->FatalError = 1;
     }
     $this->Comment = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Comment');
     $this->Discussion = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Discussion');
     $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'CommentManager');
     $dm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'DiscussionManager');
     $this->DelegateParameters['CommentManager'] =& $cm;
     $this->DelegateParameters['DiscussionManager'] =& $dm;
     // If editing a comment, define it and validate the user's permissions
     if ($this->CommentID > 0) {
         $this->Comment = $cm->GetCommentById($this->CommentID, $this->Context->Session->UserID);
         if (!$this->Comment) {
             $this->FatalError = 1;
         } else {
             $this->DiscussionID = $this->Comment->DiscussionID;
             $this->Discussion = $dm->GetDiscussionById($this->Comment->DiscussionID);
             if (!$this->Discussion) {
                 $this->FatalError = 1;
             } else {
                 // if editing a discussion
                 if (($this->Context->Session->UserID == $this->Discussion->AuthUserID || $this->Context->Session->User->Permission('PERMISSION_EDIT_DISCUSSIONS')) && $this->Discussion->FirstCommentID == $this->CommentID) {
                     $this->EditDiscussionID = $this->Discussion->DiscussionID;
                     $this->Discussion->Comment = $this->Comment;
                 }
                 // Set the page title
                 $this->DiscussionFormattedForDisplay = 1;
                 $this->Discussion->FormatPropertiesForDisplay();
                 $this->Context->PageTitle = $this->Discussion->Name;
             }
         }
         // Ensure that this user has sufficient priviledges to edit the comment
         if ($this->Comment && $this->Discussion && !$this->Context->Session->User->Permission('PERMISSION_EDIT_COMMENTS') && $this->Context->Session->UserID != $this->Comment->AuthUserID && !($this->Discussion->FirstCommentID == $this->CommentID && $this->Context->Session->User->Permission('PERMISSION_EDIT_DISCUSSIONS'))) {
             $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrPermissionCommentEdit'));
             $this->FatalError = 1;
         }
     }
     $this->CallDelegate('PostLoadData');
     // If saving a discussion
     if ($this->PostBackAction == 'SaveDiscussion') {
         $FirstCommentID = $this->Discussion->FirstCommentID;
         $AuthUserID = $this->Discussion->AuthUserID;
         $this->Discussion->Clear();
         $this->Discussion->GetPropertiesFromForm($this->Context);
         $this->Discussion->FirstCommentID = $FirstCommentID;
         $this->Discussion->AuthUserID = $AuthUserID;
         // If we are editing a discussion, the following line
         // will make sure we save the proper discussion topic & message
         $this->Discussion->DiscussionID = $this->EditDiscussionID;
         if ($this->IsValidFormPostBack()) {
             $this->DelegateParameters['SaveDiscussion'] =& $this->Discussion;
             $this->CallDelegate('PreSaveDiscussion');
             $ResultDiscussion = $dm->SaveDiscussion($this->Discussion);
             $this->DelegateParameters['ResultDiscussion'] =& $ResultDiscussion;
             $this->CallDelegate('PostSaveDiscussion');
             if ($ResultDiscussion) {
                 // Saved successfully, so send back to the discussion
                 $Suffix = CleanupString($this->Discussion->Name) . '/';
                 header('location:' . GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $ResultDiscussion->DiscussionID, '', '', $Suffix));
                 die;
             }
         }
         // If saving a comment
     } elseif ($this->PostBackAction == 'SaveComment') {
         $this->Comment->Clear();
         $this->Comment->GetPropertiesFromForm();
         $this->Comment->DiscussionID = $this->DiscussionID;
         $this->Discussion = $dm->GetDiscussionById($this->Comment->DiscussionID);
         if ($this->IsValidFormPostBack()) {
             // Make sure to prevent saving comments if the discussion is closed and
             // the user doesn't have permission to manage closed discussions
             if ($this->Discussion->Closed && !$this->Context->Session->User->Permission('PERMISSION_CLOSE_DISCUSSIONS')) {
                 $ResultComment = false;
                 $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrPermissionInsufficient'));
             } else {
                 $this->DelegateParameters['SaveComment'] =& $this->Comment;
                 $this->CallDelegate('PreSaveComment');
                 $ResultComment = $cm->SaveComment($this->Comment);
             }
             $this->DelegateParameters['ResultComment'] =& $ResultComment;
             $this->CallDelegate('PostSaveComment');
             if ($ResultComment) {
                 // Reload the discussion so the "lastpage" property is recalculated with the new comment in the math.
                 $this->Discussion = $dm->GetDiscussionById($this->Comment->DiscussionID);
                 // Saved successfully, so send back to the discussion
                 // print_r($this->Discussion);
                 $Suffix = CleanupString($this->Discussion->Name) . '/';
                 $Url = GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $ResultComment->DiscussionID, $this->Discussion->LastPage, $ResultComment->CommentID > 0 ? '#Comment_' . $ResultComment->CommentID : '#pgbottom', $Suffix);
                 $UrlParts = explode("?", $Url);
                 $QS = "";
                 if (array_key_exists(1, $UrlParts)) {
                     $QS = str_replace("&amp;", "&", $UrlParts[1]);
                 }
                 $Url = $UrlParts[0];
                 if ($QS != "") {
                     $Url .= "?" . str_replace("&amp;", "&", $UrlParts[1]);
                 }
                 header('location:' . $Url);
                 die;
             }
         }
     } elseif ($this->PostBackAction == 'Reply') {
         if ($this->Comment) {
             $this->Comment->GetPropertiesFromForm();
         }
     }
     if (!$this->IsPostBack && $this->Comment->DiscussionID == 0 && $this->Comment->CommentID == 0) {
         if (!$this->Discussion->Comment) {
             $this->Discussion->Comment = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Comment');
         }
         $this->Discussion->Comment->FormatType = $this->Context->Session->User->DefaultFormatType;
         if ($this->Comment) {
             $this->Comment->FormatType = $this->Context->Session->User->DefaultFormatType;
         }
     }
     if ($this->Comment) {
         $this->PostBackParams->Set('CommentID', $this->Comment->CommentID);
     }
     $this->PostBackParams->Set('DiscussionID', $this->DiscussionID);
     $this->Title = $this->Context->GetDefinition('StartANewDiscussion');
     if ($this->EditDiscussionID > 0 || $this->CommentID == 0 && $this->DiscussionID == 0) {
         $this->Form = 'DiscussionForm';
     } else {
         $this->Form = 'CommentForm';
         if ($this->Comment && $this->Comment->CommentID > 0) {
             $this->Title = $this->Context->GetDefinition('EditYourComments');
         } else {
             $this->Title = $this->Context->GetDefinition('AddYourComments');
         }
     }
     $this->Context->PageTitle = $this->Title;
     $this->CallDelegate('PostSaveData');
 }
Beispiel #6
0
 function ThumbnailImage($Data, $Attributes = False)
 {
     if (function_exists('Debug') && Debug()) {
         Deprecated(__FUNCTION__, 'Thumbnail');
     }
     $Width = ArrayValue('width', $Attributes, '');
     $Height = ArrayValue('height', $Attributes, '');
     if (Is_Array($Data)) {
         // group, todo
         // <ul><li><a></a></li>
     }
     $Prefix = substr($Data, 0, 7);
     //if(In_Array($Prefix, array('http://', 'https:/'))) {}
     //$bLocalImage = False;
     if ($Prefix != 'http://') {
         //$bLocalImage = True;
         $IncomingImage = $Data;
         $ImageFindPaths[] = 'uploads' . DS . $Data;
         $ImageFindPaths[] = $Data;
         foreach ($ImageFindPaths as $File) {
             if (file_exists($File) && is_file($File)) {
                 $IncomingImage = $File;
                 break;
             }
         }
     } else {
         $IncomingImage = $Data;
     }
     $CacheDirectory = 'uploads/cached';
     if (!is_writable($CacheDirectory)) {
         mkdir($CacheDirectory, 0777, True);
         if (!is_writable($CacheDirectory)) {
             $ErrorMessage = ErrorMessage(sprintf(T('Directory (%s) is not writable.'), $CacheDirectory), 'PHP', __FUNCTION__);
             trigger_error($ErrorMessage, E_USER_ERROR);
             return '';
         }
     }
     $Name = CleanupString(pathinfo($IncomingImage, PATHINFO_FILENAME) . ' ' . $Width . ' ' . $Height);
     $Extension = FileExtension($IncomingImage);
     $Target = $CacheDirectory . DS . $Name . '.' . $Extension;
     if (!file_exists($Target)) {
         Gdn_UploadImage::SaveImageAs($IncomingImage, $Target, $Height, $Width);
     }
     $Target = str_replace(DS, '/', $Target);
     if (!array_key_exists('alt', $Attributes)) {
         $Attributes['alt'] = pathinfo($Name, PATHINFO_FILENAME);
     }
     list($Width, $Height, $Type) = GetImageSize($IncomingImage);
     $Attributes['alt'] .= sprintf(' (%d×%d)', $Width, $Height);
     $Image = Img($Target, $Attributes);
     return Anchor($Image, Url($IncomingImage), '', '', True);
 }
 function CommentGrid(&$Context, $DiscussionManager, $DiscussionID)
 {
     $this->Name = 'CommentGrid';
     $this->Control($Context);
     $this->CurrentPage = ForceIncomingInt('page', 1);
     // Load information about this discussion
     $RecordDiscussionView = 1;
     if ($this->Context->Session->UserID == 0) {
         $RecordDiscussionView = 0;
     }
     $this->Discussion = $DiscussionManager->GetDiscussionById($DiscussionID, $RecordDiscussionView);
     if ($this->Discussion) {
         $this->Discussion->FormatPropertiesForDisplay();
         if (!$this->Discussion->Active && !$this->Context->Session->User->Permission('PERMISSION_VIEW_HIDDEN_DISCUSSIONS')) {
             $this->Discussion = false;
             $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrDiscussionNotFound'));
         }
         if ($this->Context->WarningCollector->Count() > 0) {
             $this->CommentData = false;
             $this->CommentDataCount = 0;
         } else {
             // Load the data
             $CommentManager = $Context->ObjectFactory->NewContextObject($Context, 'CommentManager');
             $this->CommentDataCount = $CommentManager->GetCommentCount($DiscussionID);
             // If trying to focus on a particular comment, make sure to look at the correct page
             $Focus = ForceIncomingInt('Focus', 0);
             $PageCount = CalculateNumberOfPages($this->CommentDataCount, $this->Context->Configuration['COMMENTS_PER_PAGE']);
             if ($Focus > 0 && $PageCount > 1) {
                 $this->CurrentPage = 0;
                 $FoundComment = 0;
                 while ($this->CurrentPage <= $PageCount && !$FoundComment) {
                     $this->CurrentPage++;
                     $this->CommentData = $CommentManager->GetCommentList($this->Context->Configuration['COMMENTS_PER_PAGE'], $this->CurrentPage, $DiscussionID);
                     while ($Row = $this->Context->Database->GetRow($this->CommentData)) {
                         if (ForceInt($Row['CommentID'], 0) == $Focus) {
                             $FoundComment = 1;
                             break;
                         }
                     }
                 }
                 $this->Context->Database->RewindDataSet($this->CommentData);
             } else {
                 $this->CommentData = $CommentManager->GetCommentList($this->Context->Configuration['COMMENTS_PER_PAGE'], $this->CurrentPage, $DiscussionID);
             }
         }
         // Set up the pagelist
         $this->pl = $this->Context->ObjectFactory->NewContextObject($this->Context, 'PageList', 'DiscussionID', $this->Discussion->DiscussionID, CleanupString($this->Discussion->Name) . '/');
         $this->pl->NextText = $this->Context->GetDefinition('Next');
         $this->pl->PreviousText = $this->Context->GetDefinition('Previous');
         $this->pl->CssClass = 'PageList';
         $this->pl->TotalRecords = $this->CommentDataCount;
         $this->pl->CurrentPage = $this->CurrentPage;
         $this->pl->RecordsPerPage = $this->Context->Configuration['COMMENTS_PER_PAGE'];
         $this->pl->PagesToDisplay = 10;
         $this->pl->PageParameterName = 'page';
         $this->pl->DefineProperties();
         $this->pl->QueryStringParams->Remove('Focus');
         $CategoryManager = $Context->ObjectFactory->NewContextObject($this->Context, 'CategoryManager');
         $this->ShowForm = 0;
         if ($this->Context->Session->UserID > 0 && ($this->pl->PageCount == 1 || $this->pl->PageCount == $this->CurrentPage) && (!$this->Discussion->Closed && $this->Discussion->Active || $this->Context->Session->User->Permission('PERMISSION_ADD_COMMENTS_TO_CLOSED_DISCUSSION')) && $this->CommentData && $this->Context->Session->User->Permission('PERMISSION_ADD_COMMENTS') && !$CategoryManager->GetCategoryById($this->Discussion->CategoryID)->Blocked) {
             $this->ShowForm = 1;
         }
     }
     $this->CallDelegate('Constructor');
 }
Beispiel #8
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
$Page = (object) GetValue('Content', $Data);
$Title = GetValue('Title', $Data, $Page->Title);
$TargetUrl = $this->_Sender->SelfUrl;
// Wrapper box <div class="Box"> in Module::String()
$PermissionEdit = IsContentOwner($Page, 'Candy.Pages.Edit');
?>

<h4><?php 
echo Anchor($Title, 'content/page/' . $Page->PageID . '/' . CleanupString($Page->Title));
?>
</h4>

<ul class="PanelInfo">
	<?php 
if ($PermissionEdit) {
    ?>
	<li><?php 
    echo Anchor(T('Published'), 'candy/page/visible/' . $Page->PageID . '?Target=' . $TargetUrl, 'BoolButton');
    ?>
		<span class="Aside"><?php 
    echo T($Page->Visible == 1 ? 'Yes' : 'No');
    ?>
</span>
	</li>
	<li><?php 
    echo Anchor(T('Edit'), 'candy/page/edit/' . $Page->PageID, '');
 function GenerateCleanTargetName($TargetFolder, $Name, $Extension = '', $TempFile = False, $bForceOverwriteExisting = False)
 {
     if ($Extension == '') {
         $Extension = pathinfo($Name, 4);
         $Name = pathinfo($Name, 8);
     }
     $Extension = CleanupString($Extension);
     $BaseName = CleanupString($Name);
     // check for file with same name
     $TestName = $BaseName;
     $TargetFile = $TargetFolder . '/' . $TestName . '.' . $Extension;
     if (!file_exists($TargetFile)) {
         return $TargetFile;
     }
     $IsSameFile = $TempFile != False && file_exists($TempFile) && Crc32File($TempFile) == Crc32File($TargetFile);
     if ($IsSameFile || $bForceOverwriteExisting) {
         return $TargetFile;
     }
     $Count = 0;
     $NameSuffix = '';
     do {
         //if (++$Count > 100) $NameSuffix = mt_rand(100, 9999);
         if (++$Count > 250) {
             throw new Exception('Cannot generate unique name for file.');
         }
         // make sure that iteration will end
         $TargetFile = $TargetFolder . '/' . $TestName . $NameSuffix . '.' . $Extension;
         $FileExists = file_exists($TargetFile);
         if ($FileExists && file_exists($TempFile) && md5_file($TargetFile) == md5_file($TempFile)) {
             break;
         }
         $NameSuffix = '-' . $Count;
     } while ($FileExists);
     return $TargetFile;
 }
Beispiel #10
0
            #$s->AddJoin('DiscussionUserWhisperFrom', 'uwf', 'DiscussionID', 't', 'DiscussionID', 'left join');
            $s->AddJoin('UserDiscussionWatch', 'tw', 'DiscussionID', 't', 'DiscussionID', 'left join', 'and tw.' . $DatabaseColumns['UserDiscussionWatch']['UserID'] . ' = ' . $Context->Session->User->UserID);
            $s->AddWhere('co', 'DateCreated', 'tw', 'LastViewed', '>', 'and', '', 0);
            #$s->AddWhere('t', 'WhisperUserID', '', 'NULL', '=', 'and', '',  0);
            #$s->AddJoin('UserDiscussionWatch', 'udw', 'UserID', 'u', 'UserID', 'left join');
            #$s->StartWhereGroup();
            #$s->AddWhere('udw', 'DiscussionID', 't', 'DiscussionID', '=', 'and', '', 1, 1);
            #$s->AddWhere('utw', 'DiscussionID', '', 'NULL', 'is', 'and', '', 0, 1);
            #$s->AddWhere('utw', 'CountComments', '', '(twt.CountWhispers + tuwf.CountWhispers + t.CountComments)', '<', 'or', '', 0);
            #$s->EndWhereGroup();
            #$d = $Context->ObjectFactory->NewContextObject($Context, 'DiscussionManager');
            #$d->
            $result = $Context->Database->Select($s, '', '', 'An error occurred while querying the database.');
            if ($Context->Database->RowCount($result) != 0) {
                $msg = "";
                while ($row = $Context->Database->GetRow($result)) {
                    #echo GetUnreadQuerystring($discussion, $Context->Configuration, $Context->Session->User->Preference('JumpToLastReadComment'));
                    $xnew = str_replace('//1', $row['WhisperCount'], $Context->GetDefinition('XNew'));
                    $msg .= '<br />' . '<a href="' . GetUrl($Context->Configuration, 'comments.php', '', 'DiscussionID', $row['DiscussionID'], CleanupString($row['Name'])) . '#Comment_' . $row['CommentID'] . '">' . $row['Name'] . '</a> (' . $xnew . ')';
                }
                $NoticeCollector->AddNotice($Context->GetDefinition('YouHaveBeenWhisperedIn') . $msg);
            }
        }
    } elseif ($Context->SelfUrl == 'account.php') {
        function PreferencesForm_AddWhisperNotification(&$PreferencesForm)
        {
            $PreferencesForm->AddPreference('Notification', 'TellWhenWhisper', 'NotifyOnNewWhisper');
        }
        $Context->AddToDelegate('PreferencesForm', 'PreRender', 'PreferencesForm_AddWhisperNotification');
    }
}