function PasswordResetForm(&$Context, $FormName = '')
 {
     $this->Name = 'PasswordResetForm';
     $this->ValidActions = array('PasswordResetForm', 'ResetPassword');
     $this->Constructor($Context);
     if ($this->IsPostBack) {
         $this->FormName = $FormName;
         $this->ValidatedCredentials = 0;
         // Set up the page
         global $Banner, $Foot;
         $Banner->Properties['CssClass'] = 'PasswordReset';
         $Foot->CssClass = 'PasswordReset';
         $this->Context->PageTitle = $this->Context->GetDefinition('ResetYourPassword');
         // Form properties
         $this->UserID = ForceIncomingInt('u', 0);
         $this->EmailVerificationKey = ForceIncomingString('k', '');
         $this->NewPassword = ForceIncomingString('NewPassword', '');
         $this->ConfirmPassword = ForceIncomingString('ConfirmPassword', '');
         $this->CallDelegate('Constructor');
         $um = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
         if ($this->IsPostBack && $this->PostBackAction == 'ResetPassword') {
             $this->ValidatedCredentials = 1;
         } else {
             $this->ValidatedCredentials = $um->VerifyPasswordResetRequest($this->UserID, $this->EmailVerificationKey);
         }
         if ($this->ValidatedCredentials && $this->PostBackAction == 'ResetPassword') {
             $this->PostBackValidated = $um->ResetPassword($this->UserID, $this->EmailVerificationKey, $this->NewPassword, $this->ConfirmPassword);
         }
         $this->CallDelegate('LoadData');
     }
 }
 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 GetPropertiesFromForm(&$Context)
 {
     $this->CategoryID = ForceIncomingInt('CategoryID', 0);
     $this->Name = ForceIncomingString('Name', '');
     $this->Description = ForceIncomingString('Description', '');
     $this->AllowedRoles = ForceIncomingArray('CategoryRoleBlock', array());
 }
Exemplo n.º 4
0
 function Check(&$Context)
 {
     //		if (($this->UserID == 0 && !$Context->Configuration['PUBLIC_BROWSING']) || ($this->UserID > 0 && !$this->User->PERMISSION_SIGN_IN)) {
     if ($this->UserID == 0 && $Context->SelfUrl == 'index.php' && ForceIncomingInt('CategoryID', 0) == 0 || $this->UserID > 0 && !$this->User->PERMISSION_SIGN_IN) {
         if ($this->UserID > 0 && !$this->User->PERMISSION_SIGN_IN) {
             $this->End($Context->Authenticator);
         }
         $Url = AppendUrlParameters($Context->Configuration['SAFE_REDIRECT'], 'ReturnUrl=' . urlencode(GetRequestUri()));
         Redirect($Url);
     }
 }
 function RegistrationForm(&$Context)
 {
     $this->Name = 'RegistrationForm';
     $this->ValidActions = array('ProcessRegistrationChange', 'RegistrationChange');
     $this->Constructor($Context);
     if (!$this->Context->Session->User->Permission('PERMISSION_MANAGE_REGISTRATION')) {
         $this->IsPostBack = 0;
     } elseif ($this->IsPostBack) {
         $this->Context->PageTitle = $this->Context->GetDefinition('RegistrationManagement');
         $RoleID = ForceIncomingString('RoleID', '');
         if ($RoleID == '') {
             $RoleID = $this->Context->Configuration['DEFAULT_ROLE'];
         }
         $this->RoleManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'RoleManager');
         $this->RoleSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
         $this->RoleSelect->Name = 'RoleID';
         // Add the applicant faux-role
         $this->RoleSelect->AddOption(0, $this->Context->GetDefinition('Applicant'));
         // Add all other roles
         $this->RoleSelect->AddOptionsFromDataSet($this->Context->Database, $this->RoleManager->GetRoles(), 'RoleID', 'Name');
         $this->RoleSelect->SelectedValue = $RoleID;
         $this->RoleSelect->Attributes = ' id="ddRoleID"';
         $ApprovedRoleID = ForceIncomingInt('ApprovedRoleID', $this->Context->Configuration['APPROVAL_ROLE']);
         $this->ApprovedRoleSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
         $this->ApprovedRoleSelect->Name = 'ApprovedRoleID';
         $this->ApprovedRoleSelect->AddOptionsFromDataSet($this->Context->Database, $this->RoleManager->GetRoles(), 'RoleID', 'Name');
         $this->ApprovedRoleSelect->SelectedValue = $ApprovedRoleID;
         $this->ApprovedRoleSelect->Attributes = ' id="ddApprovedRoleID"';
         if ($this->PostBackAction == 'ProcessRegistrationChange' && $this->IsValidFormPostBack()) {
             // Make the immediate access option default to '0' if the 'default' role
             // for new members is '0' (applicant)
             $AllowImmediateAccess = 0;
             if ($RoleID > 0) {
                 $Role = $this->RoleManager->GetRoleById($RoleID);
                 $AllowImmediateAccess = $Role->PERMISSION_SIGN_IN ? '1' : '0';
             }
             $ConstantsFile = $this->Context->Configuration['APPLICATION_PATH'] . 'conf/settings.php';
             $ConstantManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'ConfigurationManager');
             // Set the constants to their new values
             $ConstantManager->DefineSetting('DEFAULT_ROLE', $RoleID);
             $ConstantManager->DefineSetting('ALLOW_IMMEDIATE_ACCESS', $AllowImmediateAccess);
             $ConstantManager->DefineSetting('APPROVAL_ROLE', $ApprovedRoleID);
             $this->DelegateParameters['ConstantManager'] =& $ConstantManager;
             $this->CallDelegate('PreSaveSettings');
             // Save the settings file
             $ConstantManager->SaveSettingsToFile($ConstantsFile);
             if ($this->Context->WarningCollector->Iif()) {
                 $this->PostBackValidated = 1;
             }
         }
     }
     $this->CallDelegate('Constructor');
 }
 function PasswordResetForm(&$Context, $FormName = "")
 {
     $this->ValidActions = array("ResetPassword");
     $this->FormName = $FormName;
     $this->ValidatedCredentials = 0;
     $this->Constructor($Context);
     // Form properties
     $this->UserID = ForceIncomingInt("u", 0);
     $this->EmailVerificationKey = ForceIncomingString("k", "");
     $this->NewPassword = ForceIncomingString("NewPassword", "");
     $this->ConfirmPassword = ForceIncomingString("ConfirmPassword", "");
 }
Exemplo n.º 7
0
    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 GetPropertiesFromForm()
 {
     $this->RoleID = ForceIncomingInt("RoleID", 0);
     $this->Name = ForceIncomingString("Name", "");
     $this->Icon = ForceIncomingString("Icon", "");
     $this->Description = ForceIncomingString("Description", "");
     $this->CanLogin = ForceIncomingBool("CanLogin", 0);
     $this->CanPostDiscussion = ForceIncomingBool("CanPostDiscussion", 0);
     $this->CanPostComment = ForceIncomingBool("CanPostComment", 0);
     $this->CanPostHTML = ForceIncomingBool("CanPostHTML", 0);
     $this->CanViewIps = ForceIncomingBool("CanViewIps", 0);
     $this->AdminUsers = ForceIncomingBool("AdminUsers", 0);
     $this->AdminCategories = ForceIncomingBool("AdminCategories", 0);
     $this->MasterAdmin = ForceIncomingBool("MasterAdmin", 0);
     $this->ShowAllWhispers = ForceIncomingBool("ShowAllWhispers", 0);
 }
Exemplo n.º 9
0
 function DiscussionGrid(&$Context, $DiscussionManager, $CategoryID, $View)
 {
     $DiscussionStarterUserID = 0;
     $BookmarkedDiscussionsOnly = 0;
     $PrivateDiscussionsOnly = 0;
     $this->Context =& $Context;
     $this->CurrentPage = ForceIncomingInt("page", 1);
     $this->View = $View;
     // Get the category if filtered
     $Category = false;
     if ($CategoryID > 0) {
         include_once sgLIBRARY . "Vanilla.Category.class.php";
         $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, "CategoryManager");
         $Category = $cm->GetCategoryById($CategoryID);
     }
     $this->PageJump = "<a class=\"PageJump AllDiscussions\" href=\"./\">Show all discussions</a>";
     switch ($View) {
         case "Bookmarks":
             $this->Context->PageTitle = $this->Context->GetDefinition("BookmarkedDiscussions");
             $BookmarkedDiscussionsOnly = 1;
             break;
         case "YourDiscussions":
             $this->Context->PageTitle = $this->Context->GetDefinition("YourDiscussions");
             $DiscussionStarterUserID = $this->Context->Session->UserID;
             break;
         case "Private":
             $this->Context->PageTitle = $this->Context->GetDefinition("PrivateDiscussions");
             $PrivateDiscussionsOnly = 1;
             break;
         default:
             if ($Category) {
                 $this->Context->PageTitle = $Category->Name . " " . $this->Context->GetDefinition("Discussions");
             } else {
                 if ($this->Context->Session->User->BlocksCategories) {
                     $this->Context->PageTitle = $this->Context->GetDefinition("WatchedDiscussions");
                 } else {
                     $this->Context->PageTitle = $this->Context->GetDefinition("AllDiscussions");
                 }
                 $this->PageJump = "";
             }
             break;
     }
     $this->DiscussionData = $DiscussionManager->GetDiscussionList(agDISCUSSIONS_PER_PAGE, $this->CurrentPage, $CategoryID, $BookmarkedDiscussionsOnly, $PrivateDiscussionsOnly, $DiscussionStarterUserID);
     $this->DiscussionDataCount = $DiscussionManager->GetDiscussionCount($CategoryID, $BookmarkedDiscussionsOnly, $PrivateDiscussionsOnly, $DiscussionStarterUserID);
 }
 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");
 }
Exemplo n.º 11
0
 function CommentGrid(&$Context, $DiscussionManager, $DiscussionID)
 {
     $this->Context =& $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->AdminCategories) {
             $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->CommentData = $CommentManager->GetCommentList(agCOMMENTS_PER_PAGE, $this->CurrentPage, $DiscussionID);
         $this->CommentDataCount = $CommentManager->GetCommentCount($DiscussionID);
     }
     // Set up the pagelist
     $this->pl = $this->Context->ObjectFactory->NewContextObject($this->Context, "PageList");
     $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 = agCOMMENTS_PER_PAGE;
     $this->pl->PagesToDisplay = 10;
     $this->pl->PageParameterName = "page";
     $this->pl->DefineProperties();
     $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->AdminCategories)) {
         $this->ShowForm = 1;
     }
 }
 function GetPropertiesFromForm()
 {
     $this->SearchID = ForceIncomingInt('SearchID', 0);
     $this->Label = ForceIncomingString('Label', '');
     $this->Type = $this->DefineType(ForceIncomingString('Type', ''));
     $this->Keywords = urldecode(ForceIncomingString('Keywords', ''));
     // Parse out the keywords differently based on the type of search
     $Advanced = ForceIncomingBool('Advanced', 0);
     if ($Advanced) {
         // Load all of the search variables from the form
         $this->Categories = ForceIncomingString('Categories', '');
         $this->AuthUsername = ForceIncomingString('AuthUsername', '');
         $this->Roles = ForceIncomingString('Roles', '');
         $this->UserOrder = ForceIncomingString('UserOrder', '');
         $this->Query = $this->Keywords;
         // Build the keyword definition
         $KeyDef = '';
         if ($this->Type == 'Users') {
             if ($this->Roles != '') {
                 $KeyDef = 'roles:' . $this->Roles . ';';
             }
             if ($this->UserOrder != '') {
                 $KeyDef .= 'sort:' . $this->UserOrder . ';';
             }
             $this->Keywords = $KeyDef . $this->Keywords;
         } else {
             if ($this->Categories != '') {
                 $KeyDef = 'cats:' . $this->Categories . ';';
             }
             if ($this->AuthUsername != '') {
                 $KeyDef .= $this->AuthUsername . ':';
             }
             $this->Keywords = $KeyDef . $this->Keywords;
         }
     } else {
         // Load all of the search variables from the keyword definition
         $this->ParseKeywords($this->Type, $this->Keywords);
     }
 }
 function DefineProperties()
 {
     if (!$this->isPropertiesDefined) {
         if ($this->CurrentPage == 0) {
             $this->CurrentPage = ForceIncomingInt($this->PageParameterName, 1);
         }
         if ($this->Totalled) {
             $this->PageCount = CalculateNumberOfPages($this->TotalRecords, $this->RecordsPerPage);
             if ($this->CurrentPage > $this->PageCount) {
                 $this->CurrentPage = $this->PageCount;
             }
             if ($this->CurrentPage < 1) {
                 $this->CurrentPage = 1;
             }
             $this->FirstRecord = ($this->CurrentPage - 1) * $this->RecordsPerPage + 1;
             $this->LastRecord = $this->FirstRecord + $this->RecordsPerPage - 1;
             if ($this->LastRecord > $this->TotalRecords) {
                 $this->LastRecord = $this->TotalRecords;
             }
         } else {
             if ($this->CurrentPage < 1) {
                 $this->CurrentPage = 1;
             }
             $this->PageCount = $this->CurrentPage;
             if ($this->TotalRecords > $this->RecordsPerPage) {
                 $this->PageCount++;
             }
             $this->FirstRecord = ($this->CurrentPage - 1) * $this->RecordsPerPage + 1;
             $this->LastRecord = $this->FirstRecord + $this->TotalRecords - 1;
             if ($this->LastRecord < $this->FirstRecord) {
                 $this->LastRecord = $this->FirstRecord;
             }
             if ($this->PageCount > $this->CurrentPage) {
                 $this->LastRecord = $this->LastRecord - 1;
             }
         }
         $this->isPropertiesDefined = 1;
     }
 }
 function GetPropertiesFromForm()
 {
     $this->SearchID = ForceIncomingInt("SearchID", 0);
     $this->Label = ForceIncomingString("Label", "");
     $this->Type = $this->DefineType(ForceIncomingString("Type", ""));
     $this->Keywords = urldecode(ForceIncomingString("Keywords", ""));
     // Parse out the keywords differently based on the type of search
     $Advanced = ForceIncomingBool("Advanced", 0);
     if ($Advanced) {
         // Load all of the search variables from the form
         $this->Categories = ForceIncomingString("Categories", "");
         $this->AuthUsername = ForceIncomingString("AuthUsername", "");
         $this->Roles = ForceIncomingString("Roles", "");
         $this->UserOrder = ForceIncomingString("UserOrder", "");
         $this->Query = $this->Keywords;
         // Build the keyword definition
         $KeyDef = "";
         if ($this->Type == "Users") {
             if ($this->Roles != "") {
                 $KeyDef = "roles:" . $this->Roles . ";";
             }
             if ($this->UserOrder != "") {
                 $KeyDef .= "sort:" . $this->UserOrder . ";";
             }
             $this->Keywords = $KeyDef . $this->Keywords;
         } else {
             if ($this->Categories != "") {
                 $KeyDef = "cats:" . $this->Categories . ";";
             }
             if ($this->AuthUsername != "") {
                 $KeyDef .= $this->AuthUsername . ":";
             }
             $this->Keywords = $KeyDef . $this->Keywords;
         }
     } else {
         // Load all of the search variables from the keyword definition
         $this->ParseKeywords($this->Type, $this->Keywords);
     }
 }
 function Render()
 {
     $this->CallDelegate('PreRender');
     // Set up the pagelist
     $CategoryID = ForceIncomingInt('CategoryID', 0);
     if ($CategoryID == 0) {
         $CategoryID = '';
     }
     $pl = $this->Context->ObjectFactory->NewContextObject($this->Context, 'PageList', 'CategoryID', $CategoryID);
     $pl->NextText = $this->Context->GetDefinition('Next');
     $pl->PreviousText = $this->Context->GetDefinition('Previous');
     $pl->CssClass = 'PageList';
     $pl->TotalRecords = $this->DiscussionDataCount;
     $pl->CurrentPage = $this->CurrentPage;
     $pl->RecordsPerPage = $this->Context->Configuration['DISCUSSIONS_PER_PAGE'];
     $pl->PagesToDisplay = 10;
     $pl->PageParameterName = 'page';
     $pl->DefineProperties();
     $PageDetails = $pl->GetPageDetails($this->Context);
     $PageList = $pl->GetNumericList();
     include ThemeFilePath($this->Context->Configuration, 'discussions.php');
     $this->CallDelegate('PostRender');
 }
 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') . "&amp;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');
     }
 }
Exemplo n.º 17
0
 function RetrieveConfigurationPropertiesFromXml($Path)
 {
     $FauxContext = "0";
     if ($this->ConfigFile == "") {
         $this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "You must supply a path to the configuration file");
     }
     // Retrieve config file contents
     $File = new File();
     $File->Name = $this->ConfigFile;
     $File->Path = $Path;
     $FileManager = new FileManager();
     $FileManager->ErrorManager =& $this->ErrorManager;
     $File = $FileManager->Get($File);
     // If there were errors retrieving the config file and we're in the CWD, report an error
     if ($this->ErrorManager->ErrorCount > 0 && $Path == $this->CurrentWorkingDirectory) {
         $this->ErrorManager->Clear();
         $this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "The root configuration file could not be found/read (_config.xml).");
         // If failed to retrieve the file from a non-root directory,
         // just accept the root file
     } elseif ($this->ErrorManager->ErrorCount > 0) {
         $this->ErrorManager->Clear();
         // If no errors occurred, continue to retrieve new configuration settings
     } else {
         // Create an XML Parser to retrieve configuration settings
         $XMan = new XmlManager();
         $XMan->ErrorManager =& $this->ErrorManager;
         $MyConfig = $XMan->ParseNode($File->Body);
         if ($MyConfig && $this->ErrorManager->ErrorCount == 0) {
             $this->StyleUrl = $XMan->GetNodeValueByName($MyConfig, "StyleUrl");
             $this->PageTitle = $XMan->GetNodeValueByName($MyConfig, "PageTitle");
             $this->PageIntroduction = $XMan->GetNodeValueByName($MyConfig, "PageIntroduction");
             $this->PageIntroduction = str_replace("[", "<", $this->PageIntroduction);
             $this->PageIntroduction = str_replace("]", ">", $this->PageIntroduction);
             $this->PageIntroduction = str_replace("\n", "<br />", $this->PageIntroduction);
             $this->DisplayHiddenFiles = $XMan->GetNodeValueByName($MyConfig, "DisplayHiddenFiles");
             $this->BrowseSubFolders = $XMan->GetNodeValueByName($MyConfig, "BrowseSubFolders");
             $this->SortBy = $XMan->GetNodeValueByName($MyConfig, "SortBy");
             $this->SortDirection = $XMan->GetNodeValueByName($MyConfig, "SortDirection");
             $this->DateFormat = $XMan->GetNodeValueByName($MyConfig, "DateFormat");
             $this->UsePageIntroductionInSubFolders = ForceBool($XMan->GetNodeValueByName($MyConfig, "UsePageIntroductionInSubFolders"), false);
             $this->PluginHeight = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginHeight"), $this->PluginHeight);
             $this->PluginWidth = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginWidth"), $this->PluginWidth);
             $this->FilesPerPage = ForceIncomingInt("fpp", ForceInt($XMan->GetNodeValueByName($MyConfig, "FilesPerPage"), $this->FilesPerPage));
             $this->MaxFilesPerPage = ForceInt($XMan->GetNodeValueByName($MyConfig, "MaxFilesPerPage"), $this->MaxFilesPerPage);
             $this->FitImagesToPage = ForceBool($XMan->GetNodeValueByName($MyConfig, "FitImagesToPage"), $this->FitImagesToPage);
             $this->UseThumbnails = ForceBool($XMan->GetNodeValueByName($MyConfig, "UseThumbnails"), $this->UseThumbnails);
             $this->HideFiles = explode(",", $XMan->GetNodeValueByName($MyConfig, "HideFiles"));
             for ($i = 0; $i < count($this->HideFiles); $i++) {
                 $this->FullyQualifiedHideFiles[] = $this->CurrentBrowsingDirectory . "/" . $this->HideFiles[$i];
             }
         }
     }
     return $this->ErrorManager->Iif();
 }
Exemplo n.º 18
0
<?php

// +---------------------------------------------+
// |     Copyright  2010 - 2028 WeLive           |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+
define('AJAX', true);
include 'includes/welive.Core.php';
$uid = ForceIncomingInt('uid');
$gid = ForceIncomingInt('gid');
$act = ForceIncomingString('act');
$ajax_last = ForceIncomingFloat('ajax_last');
if (!$uid or !$gid) {
    die('Hacking!');
} elseif (ForceIncomingCookie('weliveG' . COOKIE_KEY) != md5($gid . WEBSITE_KEY . $uid . $_CFG['cKillRobotCode'])) {
    setcookie('weliveG' . COOKIE_KEY, '', 0, '/');
    die('Hacking!');
}
$mktime = explode(' ', microtime());
$realtime = $mktime[1];
$minitime = $mktime[0];
$lines = array();
//获取最新信息
$getmsgs = $DB->query("SELECT msg, biu, color FROM " . TABLE_PREFIX . "msg WHERE toid = '{$gid}' AND type = 1 AND fromid ='{$uid}' AND (created + minitime) > {$ajax_last} ORDER BY msgid ASC");
while ($msg = $DB->fetch($getmsgs)) {
    $lines[] = WeLive(1, html($msg['msg']), 2, $msg['biu'], $msg['color']);
}
$sql = "SELECT u.userid, u.activated, u.isonline AS uisonline, g.guestid, g.isonline AS gisonline, g.isbanned FROM " . TABLE_PREFIX . "user u\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "guest g ON g.serverid = u.userid AND g.guestid = '{$gid}'\r\n\t\t\tWHERE u.userid  = '{$uid}'\r\n\t\t\tAND   u.usergroupid <> 1";
$uginfo = $DB->getOne($sql);
//验证客服和访客的状态
 function GetDiscussionForm($Discussion)
 {
     $this->DelegateParameters['Discussion'] =& $Discussion;
     $this->CallDelegate('DiscussionForm_PreRender');
     if (!$this->DiscussionFormattedForDisplay) {
         $Discussion->FormatPropertiesForDisplay();
     }
     $Discussion->Comment->FormatPropertiesForDisplay(1);
     // Load the category selector
     $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'CategoryManager');
     $CategoryData = $cm->GetCategories(0, 1);
     $cs = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
     $cs->Name = 'CategoryID';
     $cs->CssClass = 'CategorySelect';
     $cs->SelectedValue = ForceIncomingInt('CategoryID', $Discussion->CategoryID);
     $cat = $this->Context->ObjectFactory->NewObject($this->Context, 'Category');
     $LastBlocked = -1;
     while ($Row = $this->Context->Database->GetRow($CategoryData)) {
         $cat->Clear();
         $cat->GetPropertiesFromDataSet($Row);
         if ($cat->Blocked != $LastBlocked && $LastBlocked != -1) {
             $cs->AddOption("-1", "---", " disabled=\"true\"");
         }
         $cs->AddOption($cat->CategoryID, $cat->Name);
         $LastBlocked = $cat->Blocked;
     }
     $this->PostBackParams->Set('CommentID', $Discussion->FirstCommentID);
     $this->PostBackParams->Set('AuthUserID', $Discussion->AuthUserID);
     $this->PostBackParams->Set('UserDiscussionCount', $this->Context->Session->User->CountDiscussions);
     $this->PostBackParams->Set('PostBackAction', 'SaveDiscussion');
     include ThemeFilePath($this->Context->Configuration, 'discussion_form.php');
     $this->CallDelegate('DiscussionForm_PostRender');
 }
Exemplo n.º 20
0
<?php

// +---------------------------------------------+
// |     Copyright  2010 - 2028 WeLive           |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+
define('AUTH', true);
include 'includes/welive.Core.php';
include BASEPATH . 'includes/welive.Admin.php';
if ($userinfo['usergroupid'] != 1) {
    exit;
}
$updates = Iif(ForceIncomingInt('check'), 1, 0);
PrintHeader($userinfo['username']);
echo '<div><ul>
<li>欢迎 <u>' . $userinfo['username'] . '</u> 进入管理面板! 为了确保系统安全, 请在关闭前点击 <a href="index.php?logout=1" onclick="return confirm(\'确定退出管理面板吗?\');">安全退出</a>!</li>
<li>隐私保护: <span class="note2">' . APP_NAME . '郑重承诺, 您在使用本系统时, ' . APP_NAME . '开发商不会收集您的任何信息</span>.</li>
<li>您在使用' . APP_NAME . '在线客服系统时有任何问题, 请访问: <a href="http://www.weentech.com/bbs/" target="_blank">闻泰网络</a>!</li>
</ul></div>
<BR>
<table border="0" cellpadding="0" cellspacing="0" class="normal" width="600">
<tr>
<td><b>程序名称</b></td>
<td><b>您现在的版本</b></td>
<td><b>最新版本</b></td>
</tr>
<tr>
<td><b>' . APP_NAME . '</b></td>
<td>' . APP_VERSION . '(UTF-8)免费版</td>
<td><span id="welive_latest_versioninfo"></span></td>
 function SearchForm(&$Context, $FormName = '')
 {
     $this->Name = 'SearchForm';
     $this->ValidActions = array('Search', 'SaveSearch');
     $this->FormName = $FormName;
     $this->SearchID = ForceIncomingInt('SearchID', 0);
     $this->DataCount = 0;
     $this->Constructor($Context);
     if ($this->PostBackAction == '') {
         $this->IsPostBack = 1;
     }
     $this->Context->BodyAttributes .= " onload=\"Focus('txtKeywords');\"";
     $CurrentPage = ForceIncomingInt('page', 1);
     // Load a search object
     $this->Search = $this->Context->ObjectFactory->NewObject($this->Context, 'Search');
     $this->Search->GetPropertiesFromForm();
     $this->CallDelegate('PostDefineSearchFromForm');
     // Load selectors
     // Category Filter
     $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'CategoryManager');
     $CategorySet = $cm->GetCategories();
     $this->CategorySelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
     $this->CategorySelect->Name = 'Categories';
     $this->CategorySelect->CssClass = 'SearchSelect';
     $this->CategorySelect->AddOption('', $this->Context->GetDefinition('AllCategories'));
     $this->CategorySelect->AddOptionsFromDataSet($this->Context->Database, $CategorySet, 'Name', 'Name');
     $this->CategorySelect->SelectedValue = $this->Search->Categories;
     // UserOrder
     $this->OrderSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
     $this->OrderSelect->Name = 'UserOrder';
     $this->OrderSelect->CssClass = 'SearchSelect';
     $this->OrderSelect->Attributes = " id=\"UserOrder\"";
     $this->OrderSelect->AddOption('', $this->Context->GetDefinition('Username'));
     $this->OrderSelect->AddOption('Date', $this->Context->GetDefinition('DateLastActive'));
     $this->OrderSelect->SelectedValue = $this->Search->UserOrder;
     // Type
     $this->TypeRadio = $this->Context->ObjectFactory->NewObject($this->Context, 'Radio');
     $this->TypeRadio->Name = 'Type';
     $this->TypeRadio->CssClass = 'SearchType';
     $this->TypeRadio->AddOption('Topics', $this->Context->GetDefinition('Topics'));
     $this->TypeRadio->AddOption('Comments', $this->Context->GetDefinition('Comments'));
     $this->TypeRadio->AddOption('Users', $this->Context->GetDefinition('Users'));
     $this->TypeRadio->SelectedID = $this->Search->Type;
     $rm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'RoleManager');
     $RoleSet = $rm->GetRoles();
     $this->RoleSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
     $this->RoleSelect->Name = 'Roles';
     $this->RoleSelect->CssClass = 'SearchSelect';
     $this->RoleSelect->Attributes = " id=\"RoleFilter\"";
     $this->RoleSelect->AddOption('', $this->Context->GetDefinition('AllRoles'));
     if ($this->Context->Session->User->Permission('PERMISSION_APPROVE_APPLICANTS')) {
         $this->RoleSelect->AddOption($this->Context->GetDefinition('Applicant'), $this->Context->GetDefinition('Applicant'));
     }
     $this->RoleSelect->AddOptionsFromDataSet($this->Context->Database, $RoleSet, 'Name', 'Name');
     $this->RoleSelect->SelectedValue = $this->Search->Roles;
     $this->CallDelegate('PreSearchQuery');
     // Handle Searching
     if ($this->PostBackAction == 'Search') {
         $this->Data = false;
         // Because of PHP's new handling of objects in PHP 5, when I passed
         // in $this->Search directly, it passed by reference instead of
         // byval. I DO NOT want this because the keywords get formatted for
         // db input in the search query and it makes them display
         // incorrectly on the screen later down the page. Hence this kludge:
         $OriginalKeywords = $this->Search->Keywords;
         $OriginalQuery = $this->Search->Query;
         // Handle searches
         if ($this->Search->Type == 'Users') {
             $um = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
             $this->Data = $um->GetUserSearch($this->Search, $this->Context->Configuration['SEARCH_RESULTS_PER_PAGE'], $CurrentPage);
             $this->Search->Keywords = $OriginalKeywords;
             $this->Search->Query = $OriginalQuery;
             $this->Search->FormatPropertiesForDisplay();
         } else {
             if ($this->Search->Type == 'Topics') {
                 $dm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'DiscussionManager');
                 $this->Data = $dm->GetDiscussionSearch($this->Context->Configuration['SEARCH_RESULTS_PER_PAGE'], $CurrentPage, $this->Search);
                 $this->Search->Keywords = $OriginalKeywords;
                 $this->Search->Query = $OriginalQuery;
                 $this->Search->FormatPropertiesForDisplay();
             } else {
                 if ($this->Search->Type == 'Comments') {
                     $cm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'CommentManager');
                     $this->Data = $cm->GetCommentSearch($this->Context->Configuration['SEARCH_RESULTS_PER_PAGE'], $CurrentPage, $this->Search);
                     $this->Search->Keywords = $OriginalKeywords;
                     $this->Search->Query = $OriginalQuery;
                     $this->Search->FormatPropertiesForDisplay();
                 }
             }
         }
         if ($this->Data) {
             $this->DataCount = $this->Context->Database->RowCount($this->Data);
         }
         $pl = $this->Context->ObjectFactory->NewContextObject($this->Context, 'PageList');
         $pl->NextText = $this->Context->GetDefinition('Next');
         $pl->PreviousText = $this->Context->GetDefinition('Previous');
         $pl->Totalled = 0;
         $pl->CssClass = 'PageList';
         $pl->TotalRecords = $this->DataCount;
         $pl->PageParameterName = 'page';
         $pl->CurrentPage = $CurrentPage;
         $pl->RecordsPerPage = $this->Context->Configuration['SEARCH_RESULTS_PER_PAGE'];
         $pl->PagesToDisplay = 10;
         $this->PageList = $pl->GetLiteralList();
         if ($this->Search->Query != '') {
             $Query = $this->Search->Query;
         } else {
             $Query = $this->Context->GetDefinition('nothing');
         }
         if ($this->DataCount == 0) {
             $this->PageDetails = $this->Context->GetDefinition('NoSearchResultsMessage');
         } else {
             $this->PageDetails = str_replace(array('//1', '//2', '//3'), array($pl->FirstRecord, $pl->LastRecord, '<strong>' . $Query . '</strong>'), $this->Context->GetDefinition('SearchResultsMessage'));
         }
     }
     $this->CallDelegate('PostLoadData');
     // Make sure to remove the FormPostBackKey from the form so that it isn't
     // present in the querystring
     $this->PostBackParams->Remove('FormPostBackKey');
 }
Exemplo n.º 22
0
<?php

// +---------------------------------------------+
// |     Copyright  2010 - 2028 WeLive           |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+
include 'includes/welive.Core.php';
header_nocache();
$uid = ForceIncomingInt('uid');
//保存数据
if (isset($_POST['submitcomment'])) {
    $vvckey = ForceIncomingInt('vvckey');
    if (ForceIncomingCookie('safecookieC' . $vvckey . COOKIE_KEY) != md5($_CFG['cKillRobotCode'] . $vvckey)) {
        exit;
    }
    setcookie('safecookieC' . $vvckey . COOKIE_KEY, '', 0, '/');
    $gname = ForceIncomingString('gname');
    $username = ForceIncomingString('username');
    $content = ForceIncomingString('content');
    $vvc = ForceIncomingString('vvc');
    if (strlen($gname) < 1) {
        $error_u = 1;
    }
    if (strlen($content) < 1) {
        $error_c = 1;
    }
    if (strlen($vvc) < 1) {
        $error_v = 1;
    } else {
        if (!CheckVVC($vvckey, $vvc)) {
Exemplo n.º 23
0
 function CleanupForm(&$Context)
 {
     $this->ValidActions = array("Cleanup", "CleanupUsers", "CleanupComments", "CleanupDiscussions", "PurgeDiscussions", "BackupDatabase");
     $this->Constructor($Context);
     $this->Name = "CleanupForm";
     if ($this->IsPostBack) {
         if ($this->PostBackAction == "CleanupUsers") {
             $Days = ForceIncomingInt("Days", 30);
             $InactiveUsers = $this->GetInactiveUsers($Days);
             if (count($InactiveUsers) > 0) {
                 // Wipe out category blocks
                 $s = $this->Context->ObjectFactory->NewContextObject($this->Context, "SqlBuilder");
                 $s->SetMainTable("CategoryBlock", "cb");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user category blocks.");
                 // Wipe out clippings
                 $s->Clear();
                 $s->SetMainTable("Clipping", "c");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user clippings.");
                 // Wipe out comment blocks
                 $s->Clear();
                 $s->SetMainTable("CommentBlock", "c");
                 $s->AddWhere("BlockingUserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user comment blocks.");
                 // Wipe out the ip history
                 $s->Clear();
                 $s->SetMainTable("IpHistory", "I");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user IP history.");
                 // Update any styles associated with this user to be system styles
                 $s->Clear();
                 $s->SetMainTable("Style", "s");
                 $s->AddFieldNameValue("AuthUserID", "0");
                 $s->AddWhere("AuthUserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Update($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user style relations.");
                 // Wipe out any user blocks
                 $s->Clear();
                 $s->SetMainTable("UserBlock", "ub");
                 $s->AddWhere("BlockingUserID", "(" . implode(",", $InactiveUsers) . ")", "in", "or", "", 0);
                 $s->AddWhere("BlockedUserID", "(" . implode(",", $InactiveUsers) . ")", "in", "or", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user blocks.");
                 // Wipe out bookmarks
                 $s->Clear();
                 $s->SetMainTable("UserBookmark", "ub");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user bookmarks.");
                 // Wipe out user discussion watch
                 $s->Clear();
                 $s->SetMainTable("UserDiscussionWatch", "udw");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user discussion tracking data.");
                 // Wipe out role history
                 $s->Clear();
                 $s->SetMainTable("UserRoleHistory", "urh");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user role history.");
                 // Wipe out saved searches
                 $s->Clear();
                 $s->SetMainTable("UserSearch", "us");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove user searches.");
                 // Delete the users
                 $s->Clear();
                 $s->SetMainTable("User", "u");
                 $s->AddWhere("UserID", "(" . implode(",", $InactiveUsers) . ")", "in", "and", "", 0);
                 $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove the users.");
             }
             $this->NumberOfUsersRemoved = count($InactiveUsers);
             $this->PostBackValidated = 1;
         } elseif ($this->PostBackAction == "CleanupComments") {
             // First get all of the hidden comment ids
             $s = $this->Context->ObjectFactory->NewContextObject($this->Context, "SqlBuilder");
             $s->SetMainTable("Comment", "c");
             $s->AddWhere("Deleted", "1", "=", "and", "", 0);
             $s->AddWhere("Deleted", "1", "=", "or");
             $s->AddSelect("CommentID", "c");
             $Result = $this->Context->Database->Select($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to retrieve hidden comments.");
             $HiddenCommentIDs = array();
             while ($Row = $this->Context->Database->GetRow($Result)) {
                 $HiddenCommentIDs[] = ForceInt($Row["CommentID"], 0);
             }
             $HiddenCommentIDs[] = 0;
             // Now remove comment blocks
             $s->Clear();
             $s->SetMainTable("CommentBlock", "cb");
             $s->AddWhere("BlockedCommentID", "(" . implode(",", $HiddenCommentIDs) . ")", "in", "and", "", 0);
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden comment blocks.");
             // Now remove the comments
             $s->Clear();
             $s->SetMainTable("Comment", "c");
             $s->AddWhere("Deleted", "1", "=", "and", "", 0);
             $s->AddWhere("Deleted", "1", "=", "or");
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden comments.");
             $this->PostBackValidated = 1;
         } elseif ($this->PostBackAction == "CleanupDiscussions") {
             // First get all of the hidden discussion ids
             $s = $this->Context->ObjectFactory->NewContextObject($this->Context, "SqlBuilder");
             $s->SetMainTable("Discussion", "d");
             $s->AddSelect("DiscussionID", "d");
             $s->AddWhere("Active", "0", "=", "and", "", 0);
             $s->AddWhere("Active", "0", "=", "or");
             $Result = $this->Context->Database->Select($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to retrieve hidden discussions.");
             $HiddenDiscussionIDs = array();
             while ($Row = $this->Context->Database->GetRow($Result)) {
                 $HiddenDiscussionIDs[] = ForceInt($Row["DiscussionID"], 0);
             }
             $HiddenDiscussionIDs[] = 0;
             // Now remove comments associated with those discussions
             $s->Clear();
             $s->SetMainTable("Comment", "c");
             $s->AddWhere("DiscussionID", "(" . implode(",", $HiddenDiscussionIDs) . ")", "in", "and", "", 0);
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden discussion comments.");
             // Clean up the whisper tables
             $s->Clear();
             $s->SetMainTable("DiscussionUserWhisperFrom", "wf");
             $s->AddWhere("DiscussionID", "(" . implode(",", $HiddenDiscussionIDs) . ")", "in", "and", "", 0);
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden discussion whisper data.");
             $s->Clear();
             $s->SetMainTable("DiscussionUserWhisperTo", "wt");
             $s->AddWhere("DiscussionID", "(" . implode(",", $HiddenDiscussionIDs) . ")", "in", "and", "", 0);
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden discussion whisper data.");
             // Remove bookmarks
             $s->Clear();
             $s->SetMainTable("UserBookmark", "ub");
             $s->AddWhere("DiscussionID", "(" . implode(",", $HiddenDiscussionIDs) . ")", "in", "and", "", 0);
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden discussion bookmark data.");
             // Discussion Watch data
             $s->Clear();
             $s->SetMainTable("UserDiscussionWatch", "uw");
             $s->AddWhere("DiscussionID", "(" . implode(",", $HiddenDiscussionIDs) . ")", "in", "and", "", 0);
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden discussion watch data.");
             // Now remove the discussions themselves
             $s->Clear();
             $s->SetMainTable("Discussion", "d");
             $s->AddWhere("Active", "0", "=", "and", "", 0);
             $s->AddWhere("Active", "0", "=", "or");
             $this->Context->Database->Delete($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to remove hidden discussions.");
             $this->PostBackValidated = 1;
         } elseif ($this->PostBackAction == "PurgeDiscussions") {
             // Purge Whisper tables
             $Sql = "truncate table LUM_DiscussionUserWhisperFrom";
             $this->Context->Database->Execute($this->Context, $Sql, $this->Name, "Constructor", "An error occurred while attempting to truncate whisper relationships.");
             $Sql = "truncate table LUM_DiscussionUserWhisperTo";
             $this->Context->Database->Execute($this->Context, $Sql, $this->Name, "Constructor", "An error occurred while attempting to truncate whisper relationships.");
             // Comment Blocks
             $Sql = "truncate table LUM_CommentBlock";
             $this->Context->Database->Execute($this->Context, $Sql, $this->Name, "Constructor", "An error occurred while attempting to truncate comment blocks.");
             // Comments
             $Sql = "truncate table LUM_Comment";
             $this->Context->Database->Execute($this->Context, $Sql, $this->Name, "Constructor", "An error occurred while attempting to truncate comments.");
             // Discussions
             $Sql = "truncate table LUM_Discussion";
             $this->Context->Database->Execute($this->Context, $Sql, $this->Name, "Constructor", "An error occurred while attempting to truncate discussions.");
             // Bookmarks
             $Sql = "truncate table LUM_UserBookmark";
             $this->Context->Database->Execute($this->Context, $Sql, $this->Name, "Constructor", "An error occurred while attempting to truncate bookmarks.");
             // User discussion watch
             $Sql = "truncate table LUM_UserDiscussionWatch";
             $this->Context->Database->Execute($this->Context, $Sql, $this->Name, "Constructor", "An error occurred while attempting to truncate user discussion tracking data.");
             $this->PostBackValidated = 1;
         } elseif ($this->PostBackAction == "BackupDatabase") {
             $FileName = date("Y-m-d-H-i", mktime()) . "-" . dbNAME . ".sql";
             $Return = 1;
             $StringArray = array();
             // In order to enable the "system" function in windows, you've got to give
             // "read & execute" and "read" access to the internet guest account:
             // (machinename\iuser_machinename).
             @system(agMYSQL_DUMP_PATH . "mysqldump --opt -u " . dbUSER . " --password="******" " . dbNAME . " > " . agAPPLICATION_PATH . "images/" . $FileName);
             SaveAsDialogue(agAPPLICATION_PATH . "images/", $FileName, 1);
         } elseif ($this->PostBackAction == "Cleanup") {
             // Load some stats
             // 1. The number of hidden discussions
             $s = $this->Context->ObjectFactory->NewContextObject($this->Context, "SqlBuilder");
             $s->SetMainTable("Discussion", "d");
             $s->AddSelect("DiscussionID", "d", "HiddenDiscussionCount", "count");
             $s->AddWhere("Active", "0", "=", "and", "", 0);
             $s->AddWhere("Active", "0", "=", "or");
             $Result = $this->Context->Database->Select($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to retrieve hidden discussion statistics.");
             $this->HiddenDiscussions = 0;
             while ($Row = $this->Context->Database->GetRow($Result)) {
                 $this->HiddenDiscussions = ForceInt($Row["HiddenDiscussionCount"], 0);
             }
             // 2. The number of hidden comments
             $s->Clear();
             $s->SetMainTable("Comment", "d");
             $s->AddSelect("CommentID", "d", "HiddenCommentCount", "count");
             $s->AddWhere("Deleted", "1", "=", "and", "", 0);
             $s->AddWhere("Deleted", "1", "=", "or");
             $Result = $this->Context->Database->Select($this->Context, $s, $this->Name, "Constructor", "An error occurred while attempting to retrieve hidden comment statistics.");
             $this->HiddenComments = 0;
             while ($Row = $this->Context->Database->GetRow($Result)) {
                 $this->HiddenComments = ForceInt($Row["HiddenCommentCount"], 0);
             }
             // 3. The number of non-posting users
             $this->InactiveUsers = count($this->GetInactiveUsers());
         }
     }
 }
Exemplo n.º 24
0
if ($action == 'fastdelete') {
    $days = ForceIncomingInt('days');
    $uid = ForceIncomingInt('u');
    $realtime = time();
    $searchsql = Iif($uid, " WHERE fromid ='{$uid}' ", "");
    $searchsql .= Iif($searchsql, Iif($days, " AND created < " . $realtime - 3600 * 24 * $days), Iif($days, " WHERE created < " . $realtime - 3600 * 24 * $days));
    $DB->query("DELETE FROM " . TABLE_PREFIX . "msg " . $searchsql);
    GotoPage('admin.messages.php' . Iif($uid, '?u=' . $uid), 1);
}
//########### PRINT DEFAULT ###########
if ($action == 'default') {
    $NumPerPage = 20;
    $page = ForceIncomingInt('p', 1);
    $start = $NumPerPage * ($page - 1);
    $fromid = ForceIncomingInt('u');
    $toid = ForceIncomingInt('toid');
    /*$searchsql = Iif($uid, "WHERE touserid ='$uid' ", "");
    */
    //die ("SELECT userid, userfrontname FROM " . TABLE_PREFIX . "user WHERE usergroupid <>1 ORDER BY userid");
    $getusers = $DB->query("SELECT userid, userfrontname FROM " . TABLE_PREFIX . "user WHERE usergroupid <>1 ORDER BY userid");
    while ($user = $DB->fetch($getusers)) {
        $users[$user['userid']] = $user['userfrontname'];
        $useroptions .= '<option value="' . $user['userid'] . '" ' . Iif($uid == $user['userid'], 'SELECTED', '') . '>' . $user['userfrontname'] . '</option>';
    }
    $getguest = $DB->query("SELECT guestid,guestip FROM " . TABLE_PREFIX . "guest");
    while ($guest = $DB->fetch($getguest)) {
        $guests[$guest['guestid']] = $guest['guestip'];
    }
    if ($fromid) {
        $searchsql = "where `fromid`='{$fromid}'";
    }
Exemplo n.º 25
0
    }
    if (defined('agCOMMENT_THRESHOLD_PUNISHMENT')) {
        $NewConfiguration['COMMENT_THRESHOLD_PUNISHMENT'] = agCOMMENT_THRESHOLD_PUNISHMENT;
    }
    if (defined('agDEFAULT_ROLE')) {
        $NewConfiguration['DEFAULT_ROLE'] = agDEFAULT_ROLE;
    }
    if (defined('agALLOW_IMMEDIATE_ACCESS')) {
        $NewConfiguration['ALLOW_IMMEDIATE_ACCESS'] = agALLOW_IMMEDIATE_ACCESS;
    }
    if (defined('agAPPROVAL_ROLE')) {
        $NewConfiguration['APPROVAL_ROLE'] = agAPPROVAL_ROLE;
    }
}
// Retrieve all postback parameters
$CurrentStep = ForceIncomingInt("Step", 0);
$PostBackAction = ForceIncomingString('PostBackAction', '');
$DBHost = ForceIncomingString('DBHost', $DBHost);
$DBName = ForceIncomingString('DBName', $DBName);
$DBUser = ForceIncomingString('DBUser', $DBUser);
$DBPass = ForceIncomingString('DBPass', $DBPass);
$SupportEmail = ForceIncomingString('SupportEmail', $SupportEmail);
$SupportName = ForceIncomingString('SupportName', $SupportName);
$ApplicationTitle = ForceIncomingString('ApplicationTitle', $ApplicationTitle);
$CookieDomain = ForceIncomingString('CookieDomain', '');
$CookiePath = ForceIncomingString('CookiePath', '');
function CreateFile($File, $Contents, &$Context)
{
    if (!file_exists($File)) {
        $Handle = @fopen($File, 'wb');
        if (!$Handle) {
Exemplo n.º 26
0
// Note: This file is included from the library/People/People.Control.RoleForm.php control.
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>
Exemplo n.º 27
0
            }
            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) . "&amp;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 . "'");
}
Exemplo n.º 28
0
 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('&amp;', '&', $Url));
             $Context->unload();
             exit(0);
         }
     } else {
         //Comment probably belongs to a private category
         if (!$Context->Session->UserID && $c) {
             CommentLinks_GoSignIn($Context);
         }
     }
 }
Exemplo n.º 29
0
 function GetPropertiesFromForm(&$Context)
 {
     $this->CommentID = ForceIncomingInt("CommentID", 0);
     $this->DiscussionID = ForceIncomingInt("DiscussionID", 0);
     $this->FormatType = ForceIncomingString("FormatType", "Text");
     $this->WhisperUsername = ForceIncomingString("WhisperUsername", "");
     $this->Body = ForceIncomingString("Body", "");
     $this->UserCommentCount = ForceIncomingInt("UserCommentCount", 0);
     // Pass the body into a formatter for db input
     $this->Body = $Context->FormatString($this->Body, $this, $this->FormatType, agFORMATSTRINGFORDATABASE);
 }
Exemplo n.º 30
0
* Vanilla is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
* The latest source code for Vanilla is available at www.lussumo.com
* Contact Mark O'Sullivan at mark [at] lussumo [dot] com
*
* Description: File used by Dynamic Data Management object to handle any type of boolean switch
*/
include '../appg/settings.php';
include '../appg/init_ajax.php';
$PostBackKey = ForceIncomingString('PostBackKey', '');
$ExtensionKey = ForceIncomingString('ExtensionKey', '');
if ($PostBackKey != '' && $PostBackKey == $Context->Session->GetVariable('SessionPostBackKey', 'string')) {
    $Type = ForceIncomingString('Type', '');
    $Switch = ForceIncomingBool('Switch', 0);
    $DiscussionID = ForceIncomingInt('DiscussionID', 0);
    $CommentID = ForceIncomingInt('CommentID', 0);
    // Don't create unnecessary objects
    if (in_array($Type, array('Active', 'Closed', 'Sticky', 'Sink'))) {
        $dm = $Context->ObjectFactory->NewContextObject($Context, 'DiscussionManager');
    } elseif ($Type == 'Comment') {
        $cm = $Context->ObjectFactory->NewContextObject($Context, 'CommentManager');
    } else {
        // This will allow the switch class to be used to add new custom user settings
        $um = $Context->ObjectFactory->NewContextObject($Context, 'UserManager');
    }
    // Handle the switches
    if ($Type == 'Bookmark' && $DiscussionID > 0) {
        if ($Context->Session->UserID == 0) {
            die;
        }
        if ($Switch) {