function FTForm(&$Context) { $this->Name = 'FTForm'; $this->ValidActions = array('FeedThis', 'ProcessFeedThis'); $this->Constructor($Context); if ($this->IsPostBack) { $SettingsFile = $this->Context->Configuration['APPLICATION_PATH'] . 'conf/settings.php'; $this->ConfigurationManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'ConfigurationManager'); if ($this->PostBackAction == 'ProcessFeedThis') { $this->ConfigurationManager->GetSettingsFromForm($SettingsFile); $this->ConfigurationManager->DefineSetting('FT_BLOG_FEED', ForceIncomingBool('FT_BLOG_FEED', 0), 0); $this->ConfigurationManager->DefineSetting('FT_BLOG_FEED_EVERY', ForceIncomingBool('FT_BLOG_FEED_EVERY', 0), 0); $this->ConfigurationManager->DefineSetting('FT_ALLDISCUSSIONS_FEED', ForceIncomingBool('FT_ALLDISCUSSIONS_FEED', 0), 0); $this->ConfigurationManager->DefineSetting('FT_ALLDISCUSSIONS_FEED_EVERY', ForceIncomingBool('FT_ALLDISCUSSIONS_FEED_EVERY', 0), 0); $this->ConfigurationManager->DefineSetting('FT_DISCUSSION_FEED', ForceIncomingBool('FT_DISCUSSION_FEED', 0), 0); $this->ConfigurationManager->DefineSetting('FT_CATEGORY_FEED', ForceIncomingBool('FT_CATEGORY_FEED', 0), 0); $this->ConfigurationManager->DefineSetting('FT_SEARCHRESULTS_FEED', ForceIncomingBool('FT_SEARCHRESULTS_FEED', 0), 0); $this->ConfigurationManager->DefineSetting('FT_USERBLOG_FEED', ForceIncomingBool('FT_USERBLOG_FEED', 0), 0); $this->ConfigurationManager->DefineSetting('FT_USERCOMMENTS_FEED', ForceIncomingBool('FT_USERCOMMENTS_FEED', 0), 0); $this->ConfigurationManager->DefineSetting('FT_PANEL_POSITION', ForceIncomingInt('FT_PANEL_POSITION', 0), 0); $this->ConfigurationManager->DefineSetting('FT_FEED_ITEMS', ForceIncomingInt('FT_FEED_ITEMS', 0), 0); $this->ConfigurationManager->DefineSetting('FT_WORD_LIMIT', ForceIncomingInt('FT_WORD_LIMIT', 0), 0); $this->DelegateParameters['ConfigurationManager'] =& $this->ConfigurationManager; // And save everything if ($this->ConfigurationManager->SaveSettingsToFile($SettingsFile)) { header('location: ' . GetUrl($this->Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction=FeedThis&Success=1')); } else { $this->PostBackAction = 'FeedThis'; } } } }
function CommentGrid_AddAjaxQuoteButton(&$CommentGrid) { $Comment =& $CommentGrid->DelegateParameters['Comment']; $CommentList =& $CommentGrid->DelegateParameters["CommentList"]; $Url = GetUrl($CommentGrid->pl->Context->Configuration, $CommentGrid->pl->Context->SelfUrl, '', $CommentGrid->pl->UrlIdName, $CommentGrid->pl->UrlIdValue, $CommentGrid->pl->PageCount, 'aq_quote=' . $Comment->CommentID . '&aq_author=' . $Comment->AuthUsername, ''); $CommentList .= '<a id="AjaxQuote_' . $Comment->CommentID . '" href="' . $Url . '" onclick="return ajaxquote(\'' . $Comment->Context->Configuration['WEB_ROOT'] . '\',' . $Comment->CommentID . ',\'' . $Comment->AuthUsername . '\');">' . $CommentGrid->Context->GetDefinition("Quote") . '</a>'; }
function AccountRoleForm(&$Context, &$UserManager, $User) { $this->Name = 'AccountRoleForm'; $this->ValidActions = array('ApproveUser', 'DeclineUser', 'Role', 'ProcessRole'); $this->Constructor($Context); if ($this->IsPostBack) { $this->User =& $User; $Redirect = 0; if ($this->PostBackAction == 'ProcessRole' && $this->IsValidFormPostBack() && $this->Context->Session->UserID != $User->UserID && $this->Context->Session->User->Permission('PERMISSION_CHANGE_USER_ROLE')) { $urh = $this->Context->ObjectFactory->NewObject($this->Context, 'UserRoleHistory'); $urh->GetPropertiesFromForm(); if ($UserManager->AssignRole($urh)) { $Redirect = 1; } } if ($Redirect) { $Url = GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', 'u', $User->UserID); Redirect($Url); } else { $this->PostBackAction = str_replace('Process', '', $this->PostBackAction); } if ($this->PostBackAction == 'Role') { $RoleManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'RoleManager'); $RoleData = $RoleManager->GetRoles(); $this->RoleSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select'); $this->RoleSelect->Name = 'RoleID'; $this->RoleSelect->CssClass = 'PanelInput'; $this->RoleSelect->AddOptionsFromDataSet($this->Context->Database, $RoleData, 'RoleID', 'Name'); $this->RoleSelect->SelectedValue = $this->User->RoleID; $this->RoleSelect->Attributes = ' id="ddRoleID"'; } } $this->CallDelegate('Constructor'); }
function GlobalsForm(&$Context) { $this->Name = 'GlobalsForm'; $this->ValidActions = array('Globals', 'ProcessGlobals'); $this->Constructor($Context); if (!$this->Context->Session->User->Permission('PERMISSION_CHANGE_APPLICATION_SETTINGS')) { $this->IsPostBack = 0; } elseif ($this->IsPostBack) { $this->Context->PageTitle = $this->Context->GetDefinition('ApplicationSettings'); $SettingsFile = $this->Context->Configuration['APPLICATION_PATH'] . 'conf/settings.php'; $this->ConfigurationManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'ConfigurationManager'); if ($this->PostBackAction == 'ProcessGlobals' && $this->IsValidFormPostBack()) { $this->ConfigurationManager->GetSettingsFromForm($SettingsFile); // Checkboxes aren't posted back if unchecked, so make sure that they are saved properly $this->ConfigurationManager->DefineSetting('ENABLE_WHISPERS', ForceIncomingBool('ENABLE_WHISPERS', 0), 0); $this->ConfigurationManager->DefineSetting('ALLOW_NAME_CHANGE', ForceIncomingBool('ALLOW_NAME_CHANGE', 0), 0); $this->ConfigurationManager->DefineSetting('PUBLIC_BROWSING', ForceIncomingBool('PUBLIC_BROWSING', 0), 0); $this->ConfigurationManager->DefineSetting('USE_CATEGORIES', ForceIncomingBool('USE_CATEGORIES', 0), 0); $this->ConfigurationManager->DefineSetting('LOG_ALL_IPS', ForceIncomingBool('LOG_ALL_IPS', 0), 0); // And save everything if ($this->ConfigurationManager->SaveSettingsToFile($SettingsFile)) { header('location: ' . GetUrl($this->Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction=Globals&Success=1')); } else { $this->PostBackAction = 'Globals'; } } } $this->CallDelegate('Constructor'); }
function GlobalsForm(&$Context) { $this->Name = 'GlobalsForm'; $this->ValidActions = array('Globals', 'ProcessGlobals'); $this->Constructor($Context); if (!$this->Context->Session->User->Permission('PERMISSION_CHANGE_APPLICATION_SETTINGS')) { $this->IsPostBack = 0; } elseif ($this->IsPostBack) { $this->Context->PageTitle = $this->Context->GetDefinition('ApplicationSettings'); $SettingsFile = $this->Context->Configuration['APPLICATION_PATH'] . 'conf/settings.php'; $this->ConfigurationManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'ConfigurationManager'); if ($this->PostBackAction == 'ProcessGlobals' && $this->IsValidFormPostBack()) { $this->ConfigurationManager->GetSettingsFromForm($SettingsFile); // Checkboxes aren't posted back if unchecked, so make sure that they are saved properly $this->ConfigurationManager->DefineSetting('ENABLE_WHISPERS', ForceIncomingBool('ENABLE_WHISPERS', 0), 0); $this->ConfigurationManager->DefineSetting('ALLOW_NAME_CHANGE', ForceIncomingBool('ALLOW_NAME_CHANGE', 0), 0); $this->ConfigurationManager->DefineSetting('PUBLIC_BROWSING', ForceIncomingBool('PUBLIC_BROWSING', 0), 0); $this->ConfigurationManager->DefineSetting('USE_CATEGORIES', ForceIncomingBool('USE_CATEGORIES', 0), 0); $this->ConfigurationManager->DefineSetting('LOG_ALL_IPS', ForceIncomingBool('LOG_ALL_IPS', 0), 0); //Validate cookie domain. //The pattern is loose; eg, It won't stop "domain.tld" or ".co.uk" to be saved //(the "domain.tld" can be set by the browser, the 2nd won't). Validate($this->Context->GetDefinition('CookieDomain'), 0, ForceIncomingString('COOKIE_DOMAIN', ''), 255, '^[\\.-_~a-zA-Z0-9]*\\.?[-_~a-zA-Z0-9]+\\.[-_~a-zA-Z0-9]+$', $this->Context); // And save everything if ($this->ConfigurationManager->SaveSettingsToFile($SettingsFile)) { header('Location: ' . GetUrl($this->Context->Configuration, 'settings.php', '', '', '', '', 'PostBackAction=Globals&Success=1')); } else { $this->PostBackAction = 'Globals'; } } } $this->CallDelegate('Constructor'); }
function DiscussionGrid_DiscussionPages($DiscussionGrid) { $Discussion =& $DiscussionGrid->DelegateParameters['Discussion']; $DiscussionList =& $DiscussionGrid->DelegateParameters['DiscussionList']; $CommentsPerPage = $DiscussionGrid->Context->Configuration['COMMENTS_PER_PAGE']; if ($Discussion->CountComments > $CommentsPerPage) { $PageList = '<font class="DiscussionPageNumbersContainer">'; $PageList .= $Discussion->Context->GetDefinition('TextPrefix'); $PageCount = CalculateNumberOfPages($Discussion->CountComments, $CommentsPerPage); if ($PageCount > 6) { $PageCountMinus2 = $PageCount - 2; $PageCountMinus1 = $PageCount - 1; $PageList .= ' <a href="' . GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, 1) . '">1</a> '; $PageList .= ' <a href="' . GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, 2) . '">2</a> '; $PageList .= ' <a href="' . GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, 3) . '">3</a> ... '; $PageList .= ' <a href="' . GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $PageCountMinus2) . '">' . $PageCountMinus2 . '</a> '; $PageList .= ' <a href="' . GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $PageCountMinus1) . '">' . $PageCountMinus1 . '</a> '; $PageList .= ' <a href="' . GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $PageCount) . '">' . $PageCount . '</a> '; } else { for ($i = 1; $i <= $PageCount; $i++) { $PageList .= ' <a href="' . GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $i) . '">' . $i . '</a> '; } } $PageList .= $Discussion->Context->GetDefinition('TextSuffix'); $PageList .= "</font>"; $DiscussionList = str_replace('class="DiscussionTopicName">' . $Discussion->Name . '</a>', 'class="DiscussionTopicName">' . $Discussion->Name . '</a> ' . $PageList, $DiscussionList); } }
function GetAccountLink($Object) { if (isset($Object->AuthUserID) && $Object->AuthUserID != "" && isset($Object->AuthUsername) && $Object->AuthUsername != "") { return '<a href="' . GetUrl($Object->Context->Configuration, 'account.php', '', 'u', $Object->AuthUserID) . '">' . $Object->AuthUsername . '</a>'; } else { return '/me'; } }
public function index() { $Article = $this->GetArticle(); $Article = $this->FormatArticle($Article); $ArticleAbout = $this->GetAbout(); $url = GetUrl(); $this->assign("ArticleInfo", $Article); $this->assign("thisurl", $url); $this->assign("ArticleAbout", $ArticleAbout); $this->display("Article/index"); }
function Render() { if ($this->IsPostBack) { $this->CallDelegate('PreRender'); $this->PostBackParams->Clear(); if ($this->PostBackAction == 'Notifi') { $this->PostBackParams->Set('PostBackAction', 'ProcessNotifi'); echo '<div id="Form" class="Account NotifiSettings">'; if (ForceIncomingInt('Success', 0)) { echo '<div id="Success">' . $this->Context->GetDefinition('ChangesSaved') . '</div>'; } echo ' <fieldset> <legend>' . $this->Context->GetDefinition("NotifiSettings") . '</legend> ' . $this->Get_Warnings() . ' ' . $this->Get_PostBackForm('frmNotifi') . ' <p>' . $this->Context->GetDefinition("NotifiAdminNotes") . '</p> <ul> <li> <p><span>' . GetDynamicCheckBox('NOTIFI_ALLOW_ALL', 1, $this->ConfigurationManager->GetSetting('NOTIFI_ALLOW_ALL'), '', $this->Context->GetDefinition('AdminAllowAll')) . '</span></p> </li> <li> <p><span>' . GetDynamicCheckBox('NOTIFI_ALLOW_CATEGORY', 1, $this->ConfigurationManager->GetSetting('NOTIFI_ALLOW_CATEGORY'), '', $this->Context->GetDefinition('AdminAllowCategories')) . '</span></p> </li> <li> <p><span>' . GetDynamicCheckBox('NOTIFI_ALLOW_DISCUSSION', 1, $this->ConfigurationManager->GetSetting('NOTIFI_ALLOW_DISCUSSION'), '', $this->Context->GetDefinition('AdminAllowDiscussions')) . '</span></p> </li> <li> <p><span>' . GetDynamicCheckBox('NOTIFI_ALLOW_BBCODE', 1, $this->ConfigurationManager->GetSetting('NOTIFI_ALLOW_BBCODE'), '', $this->Context->GetDefinition('AdminAllowBbcode')) . '</span></p> </li> <li> <p><span>' . GetDynamicCheckBox('NOTIFI_FORMAT_PLAINTEXT', 1, $this->ConfigurationManager->GetSetting('NOTIFI_FORMAT_PLAINTEXT'), '', $this->Context->GetDefinition('AdminFormatPlaintext')) . '</span></p> </li> <li> <p><span>' . GetDynamicCheckBox('NOTIFI_AUTO_ALL', 1, $this->ConfigurationManager->GetSetting('NOTIFI_AUTO_ALL'), '', $this->Context->GetDefinition('AdminAutoAll')) . '</span></p> </li> </ul> <div class="Submit"> <input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Save') . '" class="Button SubmitButton" /> <a href="' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl) . '" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a> </div> </form> </fieldset> </div>'; } $this->CallDelegate('PostRender'); } }
function UpdateCheck(&$Context) { $this->Name = 'UpdateCheck'; $this->ValidActions = array('UpdateCheck', 'ProcessUpdateCheck', 'ProcessUpdateReminder'); $this->Constructor($Context); if (!$this->Context->Session->User->Permission('PERMISSION_CHECK_FOR_UPDATES')) { $this->IsPostBack = 0; } if ($this->IsPostBack) { $this->Context->PageTitle = $this->Context->GetDefinition('UpdatesAndReminders'); $this->ReminderSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select'); $this->ReminderSelect->Name = 'ReminderRange'; $this->ReminderSelect->AddOption('', $this->Context->GetDefinition('Never')); $this->ReminderSelect->AddOption('Weekly', $this->Context->GetDefinition('Weekly')); $this->ReminderSelect->AddOption('Monthly', $this->Context->GetDefinition('Monthly')); $this->ReminderSelect->AddOption('Quarterly', $this->Context->GetDefinition('Quarterly')); $this->ReminderSelect->SelectedValue = $this->Context->Configuration['UPDATE_REMINDER']; $SettingsFile = $this->Context->Configuration['APPLICATION_PATH'] . 'conf/settings.php'; } if ($this->IsPostBack && $this->PostBackAction == 'ProcessUpdateCheck') { // Load the extensions $this->Extensions = DefineExtensions($this->Context, true); // Add an onload event to the document body $this->Context->BodyAttributes .= " onload=\"UpdateCheck('" . $this->Context->Configuration['WEB_ROOT'] . "ajax/updatecheck.php', 'Core', '" . $this->Context->Session->GetCsrfValidationKey() . "');\""; // Report that the postback is validated $this->PostBackValidated = 1; } elseif ($this->IsPostBack && $this->PostBackAction == 'ProcessUpdateReminder' && $this->IsValidFormPostBack()) { $ReminderRange = ForceIncomingString('ReminderRange', ''); if (!in_array($ReminderRange, array('Weekly', 'Monthly', 'Quarterly'))) { $ReminderRange = ''; } // Set the Reminder configuration option $ConfigurationManager = $this->Context->ObjectFactory->NewContextObject($this->Context, "ConfigurationManager"); $ConfigurationManager->DefineSetting('UPDATE_REMINDER', $ReminderRange, 1); if ($ConfigurationManager->SaveSettingsToFile($SettingsFile)) { // If everything was successful, Redirect back with saved changes message if ($this->Context->WarningCollector->Iif()) { $Url = GetUrl($this->Context->Configuration, $this->Context->SelfUrl, "", "", "", "", "PostBackAction=UpdateCheck&Saved=1"); Redirect($Url); } } } $this->CallDelegate('Constructor'); }
function LanguageForm(&$Context) { $this->Name = "LanguageForm"; $this->ValidActions = array("LanguageChange", "ProcessLanguageChange"); $this->Constructor($Context); if (!$this->Context->Session->User->Permission("PERMISSION_MANAGE_LANGUAGE")) { $this->IsPostBack = 0; } elseif ($this->IsPostBack) { $this->Context->PageTitle = $this->Context->GetDefinition('LanguageManagement'); $this->DefineLanguages(); $this->LanguageSelect = $this->Context->ObjectFactory->NewObject($Context, "Select"); $this->LanguageSelect->Name = "LanguageKey"; $this->LanguageSelect->Attributes = ' id="ddLanguage"'; for ($i = 0; $i < count($this->Languages); $i++) { $this->LanguageSelect->AddOption($i, $this->Languages[$i]); if ($this->Languages[$i] == $this->Context->Configuration['LANGUAGE']) { $this->LanguageSelect->SelectedValue = $i; } } if ($this->PostBackAction == "ProcessLanguageChange" && $this->IsValidFormPostBack()) { $LanguageKey = ForceIncomingInt("LanguageKey", 0); // Grab that language from the languages array $Language = $this->Languages[$LanguageKey]; if ($Language) { // Set the language configuration option $ConfigurationManager = $this->Context->ObjectFactory->NewContextObject($this->Context, "ConfigurationManager"); $ConfigurationManager->DefineSetting('LANGUAGE', $Language, 1); $SettingsFile = $this->Context->Configuration['APPLICATION_PATH'] . 'conf/settings.php'; if ($ConfigurationManager->SaveSettingsToFile($SettingsFile)) { // If everything was successful, mark the postback as validated if ($this->Context->WarningCollector->Iif()) { $Url = GetUrl($this->Context->Configuration, $this->Context->SelfUrl, "", "", "", "", "PostBackAction=LanguageChange&Saved=1"); Redirect($Url); } } } } elseif ($this->PostBackAction == "LanguageChange" && ForceIncomingBool("Saved", 0) == 1) { $this->PostBackValidated = 1; } } $this->CallDelegate("Constructor"); }
function DiscussionGrid(&$Context) { $this->Name = "DiscussionGrid"; $this->Control($Context); $this->Category = false; $DiscussionManager = $this->Context->ObjectFactory->NewContextObject($this->Context, "DiscussionManager"); $this->CurrentPage = ForceIncomingInt("page", 1); $this->DiscussionData = false; $this->DiscussionDataCount = false; // Get the category if filtered $CategoryID = ForceIncomingInt("CategoryID", 0); if ($CategoryID > 0) { $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, "CategoryManager"); $this->Category = $cm->GetCategoryById($CategoryID); } $this->PageJump = '<a id="PageJump" href="' . GetUrl($this->Context->Configuration, 'index.php') . '">' . $this->Context->GetDefinition('ShowAll') . '</a>'; $this->DelegateParameters['DiscussionManager'] =& $DiscussionManager; $this->CallDelegate('PreDataLoad'); if (!$this->DiscussionData) { $this->DiscussionData = $DiscussionManager->GetDiscussionList($this->Context->Configuration['DISCUSSIONS_PER_PAGE'], $this->CurrentPage, $CategoryID); $this->DiscussionDataCount = $DiscussionManager->GetDiscussionCount($CategoryID); if ($this->Category) { if ($this->Context->PageTitle == '') { $this->Context->PageTitle = htmlspecialchars($this->Category->Name); } } else { if ($this->Context->PageTitle == '') { $this->PageJump = ''; } if ($this->Context->Session->User->BlocksCategories) { if ($this->Context->PageTitle == '') { $this->Context->PageTitle = $this->Context->GetDefinition('WatchedDiscussions'); } } else { if ($this->Context->PageTitle == '') { $this->Context->PageTitle = $this->Context->GetDefinition('AllDiscussions'); } } } } $this->CallDelegate('Constructor'); }
function PasswordForm(&$Context, &$UserManager, $UserID) { $this->Name = 'PasswordForm'; if ($Context->Configuration['ALLOW_PASSWORD_CHANGE']) { $this->ValidActions = array('ProcessPassword', 'Password'); } $this->Constructor($Context); if ($this->IsPostBack) { $this->UserManager =& $UserManager; $this->User = $this->Context->ObjectFactory->NewContextObject($Context, 'User'); $this->User->GetPropertiesFromForm(); $this->User->UserID = $UserID; if ($this->PostBackAction == 'ProcessPassword' && $this->IsValidFormPostBack()) { if ($this->UserManager->ChangePassword($this->User)) { header('location: ' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl)); } } } $this->CallDelegate('Constructor'); }
function IdentityForm(&$Context, &$UserManager, &$User) { $this->Name = 'IdentityForm'; $this->ValidActions = array('ProcessIdentity', 'Identity'); $this->Constructor($Context); if ($this->IsPostBack) { $this->UserManager =& $UserManager; $this->User = clone $User; if ($this->PostBackAction == 'ProcessIdentity' && $this->IsValidFormPostBack()) { $this->User->Clear(); $this->User->GetPropertiesFromForm(); $this->User->Preferences = $User->Preferences; $this->CallDelegate('PreSaveIdentity'); if ($this->UserManager->SaveIdentity($this->User) && $this->UserManager->SaveUserCustomizationsFromForm($this->User)) { header('location: ' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', 'u', $this->Context->Session->UserID == 0 ? '' : $this->User->UserID, '', 'Success=1')); } } } $this->CallDelegate('Constructor'); }
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); } }
function Scan($url) { global $scanned, $pf, $extension, $skip, $freq, $priority; echo "scan url {$url}\n"; array_push($scanned, $url); $html = GetUrl($url); $a1 = explode("<a", $html); foreach ($a1 as $key => $val) { $parts = explode(">", $val); $a = $parts[0]; $aparts = explode("href=", $a); $hrefparts = explode(" ", $aparts[1]); $hrefparts2 = explode("#", $hrefparts[0]); $href = str_replace("\"", "", $hrefparts2[0]); if (substr($href, 0, 7) != "http://" && substr($href, 0, 8) != "https://" && substr($href, 0, 6) != "ftp://") { if ($href[0] == '/') { $href = "{$scanned['0']}{$href}"; } else { $href = Path($url) . $href; } } if (substr($href, 0, strlen($scanned[0])) == $scanned[0]) { $ignore = false; if (isset($skip)) { foreach ($skip as $k => $v) { if (substr($href, 0, strlen($v)) == $v) { $ignore = true; } } } if (!$ignore && !in_array($href, $scanned) && strpos($href, $extension) > 0) { fwrite($pf, "<url>\n <loc>{$href}</loc>\n" . " <changefreq>{$freq}</changefreq>\n" . " <priority>{$priority}</priority>\n</url>\n"); echo $href . "\n"; Scan($href); } } } }
function CommentLinks_LocateComment(&$Head) { $Context =& $Head->Context; $cm = $Context->ObjectFactory->NewContextObject($Context, 'CommentManager'); $c = $Context->ObjectFactory->NewContextObject($Context, 'Comment'); $c = $cm->GetCommentByID(ForceIncomingInt('CommentID', 0), $Context->Session->UserID); // Insufficient permissions & not logged in, go to the sign-in form if (!$Context->Session->UserID && $c) { if ($c->WhisperUserID || $c->DiscussionWhisperUserID) { CommentLinks_GoSignIn($Context); } } if ($c && $Context->WarningCollector->Iif()) { // A lot of overhead--might be better to just build my own query, but this is easier $dm = $Context->ObjectFactory->NewContextObject($Context, 'DiscussionManager'); $d = $Context->ObjectFactory->NewContextObject($Context, 'Discussion'); $d = $dm->GetDiscussionByID($c->DiscussionID); if ($d && $d->Active || $Context->Session->User->Permission('PERMISSION_VIEW_HIDDEN_DISCUSSIONS') && $Context->Session->User->Preference('ShowDeletedDiscussions')) { // Figure out which page the comment is on. A binary search would be more efficient for huge threads $PageCount = CalculateNumberOfPages($cm->GetCommentCount($c->DiscussionID), $Context->Configuration['COMMENTS_PER_PAGE']); $CurrentPage = 0; $FoundComment = 0; while ($CurrentPage <= $PageCount && !$FoundComment) { $CommentData = $cm->GetCommentList($Context->Configuration['COMMENTS_PER_PAGE'], ++$CurrentPage, $c->DiscussionID); $RowPosition = 0; while ($Row = $Context->Database->GetRow($CommentData)) { $RowPosition++; if (ForceInt($Row['CommentID'], 0) == $c->CommentID) { $FoundComment = 1; break; } } } if (!$FoundComment) { $Context->WarningCollector->Add($Context->GetDefinition('ErrCommentNotFound')); } } else { // Discussion is either missing or deleted. If deleted, say it can't be found. if (!$d->Active) { $Context->WarningCollector->Add($Context->GetDefinition('ErrCommentNotFound')); } } // If all is well, 302 to the comment's location if ($Context->WarningCollector->Iif()) { $Suffix = $Context->Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite' ? cleanupstring($d->Name) . '/' : ''; $Anchor = CommentLinks_YELLOWFADE ? '#Comment_' . $c->CommentID : '#Item_' . $RowPosition; $Url = GetUrl($Context->Configuration, 'comments.php', '', 'DiscussionID', $d->DiscussionID, $CurrentPage, $Anchor, $Suffix); header('Location: ' . str_replace('&', '&', $Url)); $Context->unload(); exit(0); } } else { //Comment probably belongs to a private category if (!$Context->Session->UserID && $c) { CommentLinks_GoSignIn($Context); } } }
'; 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> '; } $this->CallDelegate('PostDiscussionOptionsRender'); $DiscussionList .= '</ul> </li>'; $this->CallDelegate('PostDiscussionRender');
$Message = str_replace('//1', $Days, $Context->GetDefinition('XDaysSinceUpdateCheck')); } $NoticeCollector->AddNotice($Message . ' <a href="' . GetUrl($Configuration, 'settings.php', '', '', '', '', 'PostBackAction=UpdateCheck') . '">' . $Context->GetDefinition('CheckForUpdatesNow') . '</a>'); } } } // Remind them to get addons if this is a new install if ($Configuration['ADDON_NOTICE']) { if ($Context->Session->User && $Context->Session->User->Permission('PERMISSION_MANAGE_EXTENSIONS')) { $HideNotice = ForceIncomingBool('TurnOffAddonNotice', 0); if ($HideNotice) { $SettingsFile = $Configuration['APPLICATION_PATH'] . 'conf/settings.php'; $SettingsManager = $Context->ObjectFactory->NewContextObject($Context, 'ConfigurationManager'); $SettingsManager->DefineSetting("ADDON_NOTICE", '0', 1); $SettingsManager->SaveSettingsToFile($SettingsFile); } else { $NoticeCollector->AddNotice('<span><a href="' . GetUrl($Configuration, 'index.php', '', '', '', '', 'TurnOffAddonNotice=1') . '">' . $Context->GetDefinition('RemoveThisNotice') . '</a></span> ' . $Context->GetDefinition('WelcomeToVanillaGetSomeAddons')); } } } // 3. ADD CONTROLS TO THE PAGE $Page->AddRenderControl($Head, $Configuration['CONTROL_POSITION_HEAD']); $Page->AddRenderControl($Menu, $Configuration['CONTROL_POSITION_MENU']); $Page->AddRenderControl($Panel, $Configuration['CONTROL_POSITION_PANEL']); $Page->AddRenderControl($NoticeCollector, $Configuration['CONTROL_POSITION_NOTICES']); $Page->AddRenderControl($DiscussionGrid, $Configuration['CONTROL_POSITION_BODY_ITEM']); $Page->AddRenderControl($Foot, $Configuration['CONTROL_POSITION_FOOT']); $Page->AddRenderControl($PageEnd, $Configuration['CONTROL_POSITION_PAGE_END']); // 4. FIRE PAGE EVENTS $Page->FireEvents();
// 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("&", "&", $UrlParts[1]); } $Url = $UrlParts[0]; if ($QS != "") { $Url .= "?" . str_replace("&", "&", $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'); }
<div id="Form" class="Account Preferences">'; if ($this->PostBackValidated) { echo ' <div id="Success">' . $this->Context->GetDefinition('ChangesSaved') . '</div>'; } echo ' <fieldset> <legend>' . $this->formName . '</legend> ' . $this->Get_Warnings() . ' ' . $this->Get_PostBackForm('frm' . $this->formKey) . ' <ul>'; $elementKeys = array_keys($this->formData['elements']); foreach ($elementKeys as $element) { if ($this->shouldRender($element)) { echo ' <li> ' . $this->renderLabel($element) . ' ' . $this->renderElementHtml($element) . ' ' . $this->renderDescription($element) . ' </li>'; } } echo ' </ul> <div class="Submit"> <input type="submit" name="btnSave"' . ' value="' . $this->Context->GetDefinition('Save') . '"' . ' class="Button SubmitButton" /> <a href="' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl) . '"' . ' class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a> </div> </form> </fieldset> </div>';
function Render() { global $NuggetObj; if ($this->IsPostBack) { $this->PostBackParams->Clear(); //editing or creating a nugget if ($this->PostBackAction == 'Nugget' || $this->PostBackAction == 'ProcessNugget') { // Allow Page Manager pages and any other tabs which are not added by Vanilla global $Menu; reset($Menu->Tabs); while (list(, $Value) = each($Menu->Tabs)) { if (!in_array($Value['Value'], array("settings", "search", "account", "discussions", "categories"))) { $NuggetObj->Pages = array_merge($NuggetObj->Pages, array(array('name' => $Value['Text'], 'page' => $Value['Value']))); } } // Create RoleCheckboxes and PageCheckboxes $IsValid = isset($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]) || $this->PostBackAction == 'ProcessNugget'; if ($IsValid && $this->PostBackAction == 'Nugget') { $this->NuggetRoles = $NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['roles']; $this->NuggetPages = $NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['pages']; } for ($i = 0; $i < count($NuggetObj->Roles); $i++) { $this->RoleCheckboxes .= "<li><p><span>" . GetDynamicCheckBox("AllowedRoles[]", $NuggetObj->Roles[$i]['ID'], $IsValid ? in_array($NuggetObj->Roles[$i]['ID'], $this->NuggetRoles) : 1, "", $NuggetObj->Roles[$i]['Name'], '', 'RoleID_' . $NuggetObj->Roles[$i]['ID']) . "</span></p></li>\r\n"; } for ($i = 0; $i < count($NuggetObj->Pages); $i++) { $this->PageCheckboxes .= "<li><p><span>" . GetDynamicCheckBox("AllowedPages[]", $NuggetObj->Pages[$i]['page'], $IsValid ? in_array($NuggetObj->Pages[$i]['page'], $this->NuggetPages) : 1, "", $NuggetObj->Pages[$i]['name'], '', 'PageID_' . str_replace(" ", "_", $NuggetObj->Pages[$i]['name'])) . "</span></p></li>\r\n"; } if (isset($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]) && $this->PostBackAction == 'Nugget') { $this->NuggetName = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['name']); $this->NuggetID = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['id']; $this->NuggetHTML = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['html']); $this->NuggetHideName = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['hideName']; $this->NuggetDescription = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['description']); $this->NuggetPosition = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['position']); $this->NuggetWeight = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['weight']; $this->PositionSelect->SelectedValue = $NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['position']; $this->WeightSelect->SelectedValue = (int) @$NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['weight']; } $this->PostBackParams->Set('PostBackAction', 'ProcessNugget'); echo '<div id="Form" class="Account NuggetList RoleEditForm"> <fieldset> <legend>' . $this->Context->GetDefinition("NuggetManagement") . '</legend>'; if (isset($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex])) { $this->NuggetSelect->Attributes .= ' onchange="document.location=\'?PostBackAction=Nugget&NuggetID=\'+this.options[this.selectedIndex].value;"'; $this->NuggetSelect->SelectedValue = $GLOBALS['NuggetObj']->SentNuggetID; echo ' ' . $this->Get_Warnings() . ' ' . $this->Get_PostBackForm('frmNugget') . ' <h2>1. ' . $this->Context->GetDefinition('SelectPage') . '</h2> <ul><li>' . $this->NuggetSelect->Get() . '</li></ul> <h2>2. ' . $this->Context->GetDefinition('NuggetEdit') . '</h2>'; } else { echo ' ' . $this->Get_Warnings() . ' ' . $this->Get_PostBackForm('frmNugget') . ' <h2>' . $this->Context->GetDefinition('DefineNewNugget') . '</h2>'; } echo ' <ul> <li> <label for="txtNuggetName">' . $this->Context->GetDefinition('NuggetName') . '</label> <input type="text" name="Name" value="' . $this->NuggetName . '" maxlength="80" class="SmallInput" id="txtNuggetName" /> </li> <li> <p class="Description"><span>' . GetDynamicCheckBox('HideName', 1, $this->NuggetHideName, '', $this->Context->GetDefinition('NuggetNameHide')) . '</span></p> </li> <li> <label for="txtNuggetDescription">' . $this->Context->GetDefinition('NuggetDescription') . ' <small>' . $this->Context->GetDefinition('(optional)') . '</small></label> <input type="text" name="Description" value="' . $this->NuggetDescription . '" maxlength="80" class="SmallInput" id="txtNuggetDescription" /> <p class="Description">' . $this->Context->GetDefinition('NuggetDescriptionNotes') . '</p> </li> <li> <label for="Position">' . $this->Context->GetDefinition('NuggetPan') . '</label> ' . $this->PositionSelect->Get() . ' </li> <li> <label for="Weight">' . $this->Context->GetDefinition('NuggetWeight') . '</label> ' . $this->WeightSelect->Get() . ' <p class="Description">' . $this->Context->GetDefinition('NuggetWeightNotes') . '</p> </li> <li> <input type="hidden" name="ID" value="' . $this->NuggetID . '" maxlength="80" class="SmallInput" id="txtNuggetID" /> <label for="txtNuggetHTML">' . $this->Context->GetDefinition('NuggetHTML') . '</label> <textarea name="HTML" id="txtNuggetHTML" rows=25>' . $this->NuggetHTML . '</textarea> <p class="Description">' . $this->Context->GetDefinition('NuggetHTMLNotes') . '</p> </li> <table cellspacing="5"> <tbody><tr><td> <p class="Description"><strong>' . $this->Context->GetDefinition('NuggetPages') . '</strong><br /> ' . $this->Context->GetDefinition('NuggetPagesNotes') . '</p> </td> <td> <p class="Description"><strong>' . $this->Context->GetDefinition('Roles') . '</strong><br /> ' . $this->Context->GetDefinition('NuggetRoleNotes') . '</p> </td></tr> <tr><td>Check: <a onclick="CheckAll(\'PageID_\'); return false;" href="./">All</a>, <a onclick="CheckNone(\'PageID_\'); return false;" href="./">None</a></td> <td>Check: <a onclick="CheckAll(\'RoleID_\'); return false;" href="./">All</a>, <a onclick="CheckNone(\'RoleID_\'); return false;" href="./">None</a></td> </tr> <tr><td valign="top" > ' . $this->PageCheckboxes . ' </td> <td valign="top"> ' . $this->RoleCheckboxes . ' </td></tr></tbody></table> </ul> <div class="Submit"> <input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Save') . '" class="Button SubmitButton" /> <a href="./settings.php?PostBackAction=NuggetList" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a> </div> </form> </fieldset> </div>'; } else { if ($this->PostBackAction == 'RemoveNugget') { $this->PostBackParams->Set('PostBackAction', 'ProcessRemoveNugget'); $this->NuggetSelect->Attributes .= ' onchange="document.location=\'?PostBackAction=RemoveNugget&NuggetID=\'+this.options[this.selectedIndex].value;"'; $this->NuggetSelect->SelectedValue = $GLOBALS['NuggetObj']->SentNuggetID; $this->NuggetName = htmlspecialchars($NuggetObj->Nugget[$GLOBALS['NuggetObj']->NuggetIndex]['name']); echo '<div id="Form" class="Account RoleRemoveForm"><fieldset> <legend>' . $this->Context->GetDefinition('NuggetManagement') . '</legend> ' . $this->Get_PostBackForm('frmRemoveNugget') . ' <p><strong>Are you sure you want to trash "' . $this->NuggetName . '" nugget and not freeze it for later use.</strong></p><p> If you want to freeze it, select [Frozen] from the Pan select box</p> <ul><li>' . $this->NuggetSelect->Get() . '</li></ul> <div class="Submit"> <input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Trash it') . '" class="Button SubmitButton RoleRemoveButton" /> <a href="./settings.php?PostBackAction=NuggetList" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a> </div> </form> </fieldset> </div>'; } else { if ($this->PostBackAction == 'NuggetList') { echo '<div id="Form" class="Account NuggetList"> <fieldset> <legend>' . $this->Context->GetDefinition('NuggetManagement') . '</legend> <form method="get" action="' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl) . '"> <input type="hidden" name="PostBackAction" value="Nugget" /> <p>' . $this->Context->GetDefinition('NuggetNotes') . '</p> <p id="ReadDocumentation"><a href="#" onclick="document.getElementById(\'NuggetDocumentation\').style.display = \'block\';document.getElementById(\'ReadDocumentation\').style.display = \'none\';">Read Cooking Documentation</a></p> <div id="NuggetDocumentation" style="display:none">' . $this->Context->GetDefinition('NuggetDocumentation') . '</div> <p><input type="submit" name="btnNewNugget" value="' . $this->Context->GetDefinition('CreateANewNugget') . '" class="Button SubmitButton NewRoleButton" /></p> </form> </fieldset> </div> '; if ($GLOBALS['NuggetObj']->Nugget) { $this->PostBackParams->Set('PostBackAction', 'ProcessNuggetList'); echo '<div id="Form" class="Account NuggetList"> <fieldset> ' . $this->Get_PostBackForm('frmNuggetList') . ' <table id="NuggetListTable"> <thead> <tr> <th>Nugget</th> <th>Pan</th> <th>Weight</th> <th>Serving</th> </tr> </thead> <tbody>'; $cooked = 0; $frozen = 0; for ($i = 0; $i < count($NuggetObj->Nugget); $i++) { $this->NuggetName = htmlspecialchars($GLOBALS['NuggetObj']->Nugget[$i]['name']); $this->NuggetDescription = htmlspecialchars($GLOBALS['NuggetObj']->Nugget[$i]['description']); $this->PositionSelect->Name = $i . '[Position]'; $this->PositionSelect->SelectedValue = $GLOBALS['NuggetObj']->Nugget[$i]['position']; $this->WeightSelect->Name = $i . '[Weight]'; $this->WeightSelect->SelectedValue = (int) @$GLOBALS['NuggetObj']->Nugget[$i]['weight']; $this->NuggetStatus = (int) @$GLOBALS['NuggetObj']->Nugget[$i]['status']; $this->Alternate = FlipBool($this->Alternate); $this->Alternate ? $class = 'even' : ($class = 'odd'); // Display the heading only once if ($this->NuggetStatus && !$cooked) { echo '<tr><td class="region" colspan="4">Cooked</td></tr>'; $cooked = 1; } else { if (!$this->NuggetStatus && !$frozen) { echo '<tr><td class="region" colspan="4">Frozen</td></tr>'; $frozen = 1; } } echo '<tr class=' . $class . '> <td class="name"><strong>' . $this->NuggetName . '</strong><br />' . $this->NuggetDescription . '</td> <td>' . $this->PositionSelect->Get() . '</td> <td>' . $this->WeightSelect->Get() . '</td> <td><a href="' . $this->Context->Configuration['WEB_ROOT'] . 'settings.php?PostBackAction=Nugget&NuggetID=' . $GLOBALS['NuggetObj']->Nugget[$i]['id'] . '">' . $this->Context->GetDefinition('Edit') . '</a> | <a href="' . $this->Context->Configuration['WEB_ROOT'] . 'settings.php?PostBackAction=RemoveNugget&NuggetID=' . $GLOBALS['NuggetObj']->Nugget[$i]['id'] . '">Trash it</a></td> </tr> '; } echo '</tbody></table> <div class="Submit"> <input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Save Nuggets') . '" class="Button SubmitButton" /> <a href="' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl) . '" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a> </div> </form> </fieldset> </div>'; } } } } } }
<?php /** * Used by RoleHistory in extensions/RoleHistory/default.php */ if (!defined('IN_VANILLA')) { exit; } echo '<h2>' . $this->Context->GetDefinition("RoleHistory") . '</h2> <ul>'; // Loop through the user's role history $UserHistory = $this->Context->ObjectFactory->NewObject($this->Context, "UserRoleHistory"); while ($Row = $this->Context->Database->GetRow($this->History)) { $UserHistory->Clear(); $UserHistory->GetPropertiesFromDataSet($Row); $UserHistory->FormatPropertiesForDisplay($this->Context); echo '<li> <h3> ' . $UserHistory->Role . ' <small>(' . TimeDiff($this->Context, $UserHistory->Date, mktime()) . ')</small></h3> <p class="Info"> ' . str_replace("//1", $UserHistory->AdminUserID == 0 ? $this->Context->GetDefinition("Applicant") : "<a href=\"" . GetUrl($this->Context->Configuration, "account.php", "", "u", $UserHistory->AdminUserID) . "\">" . $UserHistory->AdminUsername . "</a>", $this->Context->GetDefinition("RoleAssignedByX")) . ' </p> <p class="Note"> ' . $UserHistory->Notes . ' </p> </li>'; } echo "</ul>";
$Menu->AddTab($Context->GetDefinition('Categories'), 'categories', GetUrl($Configuration, 'categories.php'), '', $Configuration['TAB_POSITION_CATEGORIES']); } $Menu->AddTab($Context->GetDefinition('Search'), 'search', GetUrl($Configuration, 'search.php'), '', $Configuration['TAB_POSITION_SEARCH']); if ($Context->Session->UserID > 0) { // Make sure they should be seeing the settings tab $RequiredPermissions = array('PERMISSION_CHECK_FOR_UPDATES', 'PERMISSION_APPROVE_APPLICANTS', 'PERMISSION_MANAGE_REGISTRATION', 'PERMISSION_ADD_ROLES', 'PERMISSION_EDIT_ROLES', 'PERMISSION_REMOVE_ROLES', 'PERMISSION_ADD_CATEGORIES', 'PERMISSION_EDIT_CATEGORIES', 'PERMISSION_REMOVE_CATEGORIES', 'PERMISSION_SORT_CATEGORIES', 'PERMISSION_CHANGE_APPLICATION_SETTINGS', 'PERMISSION_MANAGE_EXTENSIONS', 'PERMISSION_MANAGE_LANGUAGE', 'PERMISSION_MANAGE_STYLES', 'PERMISSION_MANAGE_THEMES'); $RequiredPermissionsCount = count($RequiredPermissions); $i = 0; for ($i = 0; $i < $RequiredPermissionsCount; $i++) { if ($Context->Session->User->Permission($RequiredPermissions[$i])) { $Menu->AddTab($Context->GetDefinition('Settings'), 'settings', GetUrl($Configuration, 'settings.php'), '', $Configuration['TAB_POSITION_SETTINGS']); break; } } // Add the account tab $Menu->AddTab($Context->GetDefinition('Account'), 'account', GetUrl($Configuration, 'account.php'), '', $Configuration['TAB_POSITION_ACCOUNT']); } // Define the context object's passthru variables $Context->PassThruVars['SetBookmarkOnClick'] = ''; // INCLUDE EXTENSIONS include $Configuration['APPLICATION_PATH'] . 'conf/extensions.php'; $Panel->AddString($Context->GetDefinition('PanelFooter'), 500); // Make sure to get all delegates from the extensions into objects which were // constructed before the extensions were loaded. $Head->GetDelegatesFromContext(); $Menu->GetDelegatesFromContext(); $Panel->GetDelegatesFromContext(); $NoticeCollector->GetDelegatesFromContext(); $Foot->GetDelegatesFromContext(); $PageEnd->GetDelegatesFromContext(); // If the sign-in and sign-out urls have not been modified from their default
<fieldset> <legend>' . $this->Context->GetDefinition('ChangeYourPassword') . '</legend>'; $this->CallDelegate('PreWarningsRender'); echo $this->Get_Warnings() . $this->Get_PostBackForm('frmAccountPassword'); $this->CallDelegate('PreInputsRender'); echo '<ul> <li> <label for="txtOldPassword">' . $this->Context->GetDefinition('YourOldPassword') . ' <small>' . $Required . '</small></label> <input type="password" name="OldPassword" value="' . $this->User->OldPassword . '" maxlength="100" class="SmallInput" id="txtOldPassword" /> <p class="Description">' . $this->Context->GetDefinition('YourOldPasswordNotes') . '</p> </li> <li> <label for="txtNewPassword">' . $this->Context->GetDefinition('YourNewPassword') . ' <small>' . $Required . '</small></label> <input type="password" name="NewPassword" value="' . $this->User->NewPassword . '" maxlength="100" class="SmallInput" id="txtNewPassword" /> <p class="Description">' . $this->Context->GetDefinition('YourNewPasswordNotes') . '</p> </li> <li> <label for="txtConfirmPassword">' . $this->Context->GetDefinition('YourNewPasswordAgain') . ' <small>' . $Required . '</small></label> <input type="password" name="ConfirmPassword" value="' . $this->User->ConfirmPassword . '" maxlength="100" class="SmallInput" id="txtConfirmPassword" /> <p class="Description">' . $this->Context->GetDefinition('YourNewPasswordAgainNotes') . '</p> </li> </ul>'; $this->CallDelegate('PreButtonsRender'); echo '<div class="Submit"> <input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Save') . '" class="Button SubmitButton" /> <a href="' . GetUrl($this->Context->Configuration, "account.php", "", "u", $this->User->UserID) . '" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a> </div> </form> </fieldset> </div>'; }
function RequestPasswordReset($Username) { $Username = FormatStringForDatabaseInput($Username, ''); $Email = false; if ($Username == '') { $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrInvalidUsername')); } else { // Attempt to retrieve email address $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder'); $s->SetMainTable('User', 'u'); $s->AddSelect(array('Email', 'Name', 'UserID'), 'u'); $s->AddWhere('u', 'Name', '', $Username, '='); $UserResult = $this->Context->Database->Select($s, $this->Name, 'RequestPasswordReset', 'An error occurred while retrieving account information.'); if ($this->Context->Database->RowCount($UserResult) == 0) { $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrAccountNotFound')); } else { $Name = ''; $Email = ''; $UserID = 0; while ($rows = $this->Context->Database->GetRow($UserResult)) { $UserID = ForceInt($rows['UserID'], 0); $Email = ForceString($rows['Email'], ''); $Name = FormatStringForDisplay($rows['Name'], 1); } // Now that we have the email, generate an email verification key $EmailVerificationKey = DefineVerificationKey(); // Insert the email verification key into the user table $s->Clear(); $s->SetMainTable('User', 'u'); $s->AddFieldNameValue('EmailVerificationKey', $EmailVerificationKey, 1); $s->AddWhere('u', 'UserID', '', $UserID, '='); $this->Context->Database->Update($s, $this->Name, 'RequestPasswordReset', 'An error occurred while managing your account information.'); // If there are no errors, send the user an email if ($this->Context->WarningCollector->Count() == 0) { // Retrieve the email body $File = $this->Context->Configuration['LANGUAGES_PATH'] . $this->Context->Configuration['LANGUAGE'] . '/email_password_request.txt'; $EmailBody = @file_get_contents($File); if (!$EmailBody) { $this->Context->ErrorManager->AddError($this->Context, $this->Name, 'AssignRole', 'Failed to read email template (' . $File . ').'); } $e = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Email'); $e->HtmlOn = 0; $e->WarningCollector =& $this->Context->WarningCollector; $e->ErrorManager =& $this->Context->ErrorManager; $e->AddFrom($this->Context->Configuration['SUPPORT_EMAIL'], $this->Context->Configuration['SUPPORT_NAME']); $e->AddRecipient($Email, $Name); $e->Subject = $this->Context->Configuration['APPLICATION_TITLE'] . ' ' . $this->Context->GetDefinition('PasswordResetRequest'); $e->Body = str_replace(array('{user_name}', '{forum_name}', '{password_url}'), array($Name, $this->Context->Configuration['APPLICATION_TITLE'], ConcatenatePath($this->Context->Configuration['BASE_URL'], GetUrl($this->Context->Configuration, 'people.php', '', '', '', '', 'PostBackAction=PasswordResetForm&u=' . $UserID . '&k=' . $EmailVerificationKey))), $EmailBody); $e->Send(); } } } return $this->Context->WarningCollector->Iif($Email, false); }
} echo ' </fieldset></form></div>'; } } } if (in_array($Context->SelfUrl, array('account.php'))) { if (!@$UserManager) { unset($UserManager); } $UserManager = $Context->ObjectFactory->NewContextObject($Context, "UserManager"); $AccountUserID = ForceIncomingInt("u", $Context->Session->UserID); if (!@$AccountUser) { $AccountUser = $UserManager->GetUserById($AccountUserID); } if ($Context->Session->User) { if (($AccountUser->UserID == $Context->Session->UserID or $Context->Session->User->Permission("PERMISSION_EDIT_USERS")) and $Context->Configuration['NOTIFY_AUTO_ALL'] == 0) { $Panel->AddListItem($Context->GetDefinition('AccountOptions'), $Context->GetDefinition('Notification'), GetUrl($Configuration, $Context->SelfUrl, "", "", "", "", "u=" . ForceIncomingInt('u', $Context->Session->UserID) . "&PostBackAction=Notification"), "", "", 92); $Page->AddRenderControl($Context->ObjectFactory->NewContextObject($Context, "NotificationControl"), $Configuration["CONTROL_POSITION_BODY_ITEM"]); } } $Head->AddStyleSheet('extensions/Notify/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/Notify/functions.js'); } if ($Context->Session->UserID > 0) { mysql_query("UPDATE " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "User SET Notified = 0 WHERE UserID = '" . $Context->Session->UserID . "'"); }
function Render() { if ($this->IsPostBack) { $this->CallDelegate('PreRender'); $this->PostBackParams->Clear(); $CategoryID = ForceIncomingInt('CategoryID', 0); if ($this->PostBackAction == 'Category') { $this->PostBackParams->Set('PostBackAction', 'ProcessCategory'); $this->CallDelegate('PreEditRender'); include ThemeFilePath($this->Context->Configuration, 'settings_category_edit.php'); $this->CallDelegate('PostEditRender'); } elseif ($this->PostBackAction == 'CategoryRemove') { $this->PostBackParams->Set('PostBackAction', 'ProcessCategoryRemove'); $this->CategorySelect->Attributes = "onchange=\"document.location='" . GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=CategoryRemove') . "&CategoryID='+this.options[this.selectedIndex].value;\""; $this->CategorySelect->SelectedValue = $CategoryID; $this->CallDelegate('PreRemoveRender'); include ThemeFilePath($this->Context->Configuration, 'settings_category_remove.php'); $this->CallDelegate('PostRemoveRender'); } else { $this->PostBackParams->Set('PostBackAction', 'ProcessCategories'); $this->CallDelegate('PreListRender'); include ThemeFilePath($this->Context->Configuration, 'settings_category_list.php'); $this->CallDelegate('PostListRender'); } $this->CallDelegate('PostRender'); } }
echo '<div id="Form" class="Account RoleRemoveForm"> <fieldset> <legend>' . $this->Context->GetDefinition('RoleManagement') . '</legend>' . $this->Get_Warnings() . $this->Get_PostBackForm('frmRoleRemove') . '<h2>' . $this->Context->GetDefinition('SelectRoleToRemove') . '</h2> <ul> <li> <label for="sRoleToRemove">' . $this->Context->GetDefinition('Roles') . ' <small>' . $this->Context->GetDefinition('Required') . '</small></label>'; $this->RoleSelect->Attributes .= ' id="sRoleToRemove"'; echo $this->RoleSelect->Get() . ' </li> </ul>'; if ($RoleID > 0) { $this->RoleSelect->Attributes = ' id="sReplacementRole"'; $this->RoleSelect->RemoveOption($this->RoleSelect->SelectedValue); $this->RoleSelect->Name = 'ReplacementRoleID'; $this->RoleSelect->SelectedValue = ForceIncomingInt('ReplacementRoleID', 0); echo '<h2>' . $this->Context->GetDefinition('SelectReplacementRole') . '</h2> <ul> <li> <label for="sReplacementRole">' . $this->Context->GetDefinition('ReplacementRole') . ' <small>' . $this->Context->GetDefinition('Required') . '</small></label> ' . $this->RoleSelect->Get() . ' <p class="Description">' . $this->Context->GetDefinition('ReplacementRoleNotes') . '</p> </li> </ul> <div class="Submit"> <input type="submit" name="btnSave" value="' . $this->Context->GetDefinition('Remove') . '" class="Button SubmitButton RoleRemoveButton" /> <a href="' . GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=Roles') . '" class="CancelButton">' . $this->Context->GetDefinition('Cancel') . '</a> </div>'; } echo '</form> </fieldset> </div>';