function PasswordRequestForm(&$Context, $FormName = '')
 {
     $this->Name = 'PasswordRequestForm';
     $this->ValidActions = array('PasswordRequestForm', 'RequestPasswordReset');
     $this->Constructor($Context);
     if ($this->IsPostBack) {
         $this->FormName = $FormName;
         $this->Username = ForceIncomingString('Username', '');
         // Set up the page
         global $Banner, $Foot;
         $Banner->Properties['CssClass'] = 'PasswordRequest';
         $Foot->CssClass = 'PasswordRequest';
         $this->Context->PageTitle = $this->Context->GetDefinition('PasswordResetRequest');
         $this->UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
         if ($this->PostBackAction == 'RequestPasswordReset') {
             $this->EmailSentTo = $this->UserManager->RequestPasswordReset($this->Username);
             $aEmailSentTo = explode('@', $this->EmailSentTo);
             if (count($aEmailSentTo) > 1) {
                 $this->EmailSentTo = $aEmailSentTo[1];
             }
             if ($this->EmailSentTo) {
                 $this->PostBackValidated = 1;
             }
         }
         $this->CallDelegate('LoadData');
     }
 }
 function GetPropertiesFromForm(&$Context)
 {
     $this->CategoryID = ForceIncomingInt('CategoryID', 0);
     $this->Name = ForceIncomingString('Name', '');
     $this->Description = ForceIncomingString('Description', '');
     $this->AllowedRoles = ForceIncomingArray('CategoryRoleBlock', array());
 }
 function PasswordRequestForm(&$Context, $FormName = "")
 {
     $this->ValidActions = array("RequestPasswordReset");
     $this->FormName = $FormName;
     $this->Username = ForceIncomingString("Username", "");
     $this->Constructor($Context);
 }
 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 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 ApplicantsForm(&$Context)
 {
     $this->Name = "ApplicantsForm";
     $this->ValidActions = array("Applicants", "ProcessApplicants");
     $this->Constructor($Context);
     if (!$this->Context->Session->User->Permission("PERMISSION_APPROVE_APPLICANTS")) {
         $this->IsPostBack = 0;
     } elseif ($this->IsPostBack) {
         $this->Context->PageTitle = $this->Context->GetDefinition('MembershipApplicants');
         // See if the form has been submitted
         if ($this->PostBackAction == 'ProcessApplicants' && $this->IsValidFormPostBack()) {
             $Action = ForceIncomingString('btnSubmit', '');
             // Compare to language dictionary to figure out exactly what should be done
             if ($Action != '') {
                 $Action = $Context->GetDefinition('ApproveForMembership') == $Action ? 'Approve' : 'Decline';
             }
             // Retrieve the id's to manipulate
             $ApplicantIDs = ForceIncomingArray('ApplicantID', array());
             // Approve or decline the applicants
             if ($Action != '' && is_array($ApplicantIDs) && count($ApplicantIDs) > 0) {
                 $um = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
                 if ($Action == 'Approve') {
                     $um->ApproveApplicant($ApplicantIDs);
                 } else {
                     $um->RemoveApplicant($ApplicantIDs);
                 }
             }
         }
         // There is no need to load all of the applicants since they were already loaded by the settings.php page
         // $um = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
         // $this->ApplicantData = $um->GetUsersByRoleId(0);
     }
     $this->CallDelegate("Constructor");
 }
 function LoadData()
 {
     $this->Reporter = ForceIncomingString("ReporterName", "");
     $this->ReporterEmail = ForceIncomingString("ReporterEmail", "");
     $this->BugUrl = ForceIncomingString("BugUrl", "");
     $this->BugHappenedWhen = ForceIncomingString("BugHappenedWhen", "");
     $this->BugDescription = ForceIncomingString("BugDescription", "");
     if ($this->IsPostBack) {
         if ($this->PostBackAction == "ReportBug") {
             // Validate the inputs
             Validate($this->Context->GetDefinition("YourNameLower"), 1, $this->Reporter, 100, "", $this->Context);
             Validate($this->Context->GetDefinition("YourEmailLower"), 1, $this->ReporterEmail, 200, "(.+)@(.+)\\.(.+)", $this->Context);
             Validate($this->Context->GetDefinition("BugUrlLower"), 1, $this->BugUrl, 255, "", $this->Context);
             Validate($this->Context->GetDefinition("BugHappenedWhenLower"), 1, $this->BugHappenedWhen, 5000, "", $this->Context);
             Validate($this->Context->GetDefinition("BugDescriptionLower"), 1, $this->BugDescription, 5000, "", $this->Context);
             $this->PostBackValidated = $this->Context->WarningCollector->Iif();
         }
         if ($this->PostBackValidated) {
             $e = $this->Context->ObjectFactory->NewContextObject($this->Context, "Email");
             $e->HtmlOn = 0;
             $e->WarningCollector =& $this->Context->WarningCollector;
             $e->ErrorManager =& $this->Context->ErrorManager;
             $e->AddFrom(agSUPPORT_EMAIL, agSUPPORT_NAME);
             $e->AddRecipient(agSUPPORT_EMAIL, agSUPPORT_NAME);
             $e->Subject = agAPPLICATION_TITLE . " " . $this->Context->GetDefinition("BugReport");
             $e->BodyText = $this->Context->GetDefinition("BugReportSubmitted") . "\r\n" . $this->Context->GetDefinition("UserAgent") . ": " . ForceString(@$_SERVER["HTTP_USER_AGENT"], "") . "\r\n" . $this->Context->GetDefinition("ReporterName") . ": " . $this->Reporter . "\r\n" . $this->Context->GetDefinition("ReporterEmail") . ": " . $this->ReporterEmail . "\r\n" . $this->Context->GetDefinition("BugUrl") . ": " . $this->BugUrl . "\r\n" . $this->Context->GetDefinition("BugHappenedWhen") . ": " . $this->BugHappenedWhen . "\r\n" . $this->Context->GetDefinition("BugDescription") . ": " . $this->BugDescription . "\r\n" . $this->Context->GetDefinition("NoteOnBugsForAdmins");
             $e->Send();
         }
     }
 }
示例#8
0
 function GetPropertiesFromForm()
 {
     $this->StyleID = ForceIncomingInt("StyleID", 0);
     $this->AuthUserID = ForceIncomingInt("AuthUserID", 0);
     $this->AuthUsername = ForceIncomingString("AuthUsername", "");
     $this->Name = ForceIncomingString("Name", "");
     $this->Url = ForceIncomingString("Url", "");
     $this->PreviewImage = ForceIncomingString("PreviewImage", "");
 }
示例#9
0
 function RoleHistory(&$Context, &$UserManager, $UserID)
 {
     $this->PostBackAction = ForceIncomingString("PostBackAction", "");
     $this->Name = "RoleHistory";
     $this->Control($Context);
     if ($this->PostBackAction == "") {
         $this->History = $UserManager->GetUserRoleHistoryByUserId($UserID);
     }
 }
 function SignInForm(&$Context, $FormName)
 {
     $this->Name = 'SignInForm';
     $this->ValidActions = array('SignIn');
     $this->Constructor($Context);
     if ($this->PostBackAction == '') {
         $this->IsPostBack = 1;
     }
     if ($this->IsPostBack) {
         $this->FormName = $FormName;
         $this->ReturnUrl = urldecode(ForceIncomingString('ReturnUrl', ''));
         $ValidateReturnUrl = strstr($this->ReturnUrl, $this->Context->Configuration['COOKIE_DOMAIN'] . $this->Context->Configuration['COOKIE_PATH']);
         if ($this->ReturnUrl != '') {
             $this->PostBackParams->Add('ReturnUrl', $this->ReturnUrl);
         }
         $this->Username = ForceIncomingString('Username', '');
         $this->Password = ForceIncomingString('Password', '', false);
         $this->RememberMe = ForceIncomingBool('RememberMe', 0);
         // Set up the page
         global $Banner, $Foot;
         $Banner->Properties['CssClass'] = 'SignIn';
         $Foot->CssClass = 'SignIn';
         $this->Context->PageTitle = $this->Context->GetDefinition('SignIn');
         if ($this->PostBackAction == 'SignIn') {
             $UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
             // Check for an already active session
             if ($this->Context->Session->UserID != 0) {
                 $this->PostBackValidated = 1;
             } else {
                 // Attempt to create a new session for the user
                 if ($UserManager->ValidateUserCredentials($this->Username, $this->Password, $this->RememberMe)) {
                     $this->PostBackValidated = 1;
                     //Automatically redirect if this user isn't a user administrator or there aren't any new applicants
                     $AutoRedirect = 1;
                     if ($this->Context->Session->User->Permission('PERMISSION_APPROVE_APPLICANTS')) {
                         $this->ApplicantCount = $UserManager->GetApplicantCount();
                         if ($this->ApplicantCount > 0) {
                             $AutoRedirect = 0;
                         }
                     }
                     if ($this->ReturnUrl == '' || empty($ValidateReturnUrl)) {
                         $this->ReturnUrl = $this->Context->Configuration['FORWARD_VALIDATED_USER_URL'];
                     } else {
                         $this->ReturnUrl = str_replace('&', '&', $this->ReturnUrl);
                     }
                     if ($AutoRedirect && $this->ReturnUrl != '') {
                         //@todo: Should the the process die here?
                         Redirect($this->ReturnUrl, '302', '', 0);
                     }
                 }
             }
         }
         $this->Context->BodyAttributes = " onload=\"Focus('txtUsername');\"";
     }
     $this->CallDelegate('Constructor');
 }
 function Account(&$Context, &$User)
 {
     $this->FatalError = 0;
     $this->Name = 'Account';
     $this->PostBackAction = ForceIncomingString('PostBackAction', '');
     $this->Control($Context);
     $this->User =& $User;
     if ($this->Context->WarningCollector->Count() > 0) {
         $this->FatalError = 1;
     }
     $this->CallDelegate('Constructor');
 }
示例#12
0
 function IpHistory(&$Context, &$UserManager, $UserID)
 {
     $this->Name = "IpHistory";
     $this->PostBackAction = ForceIncomingString("PostBackAction", "");
     $this->Control($Context);
     $this->History = false;
     if ($this->Context->Session->User) {
         if ($this->Context->Session->User->Permission("PERMISSION_IP_ADDRESSES_VISIBLE") && $this->PostBackAction == "") {
             $this->History = $UserManager->GetIpHistory($UserID);
         }
     }
 }
 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", "");
 }
 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');
 }
示例#15
0
 function reCAPTCHA_CheckCaptcha(&$ApplyForm)
 {
     // Check the submitted answer.
     $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
     $resp = recaptcha_check_answer($ApplyForm->Context->Configuration['reCAPTCHA.PrivateKey'], $ip, ForceIncomingString('recaptcha_challenge_field', ''), ForceIncomingString('recaptcha_response_field', ''));
     // Report errors if necessary.
     if (!$resp->is_valid) {
         if ('incorrect-captcha-sol' == $resp->error) {
             $ApplyForm->Context->WarningCollector->Add($ApplyForm->Context->GetDefinition('reCAPTCHA.Error.Incorrect'));
         } else {
             $ApplyForm->Context->WarningCollector->Add($ApplyForm->Context->GetDefinition('reCAPTCHA.Error.Config'));
         }
     }
 }
 function GetPropertiesFromForm(&$Context)
 {
     $this->CategoryID = ForceIncomingInt("CategoryID", 0);
     $this->Name = ForceIncomingString("Name", "");
     $this->Description = ForceIncomingString("Description", "");
     $p = $Context->ObjectFactory->NewObject($this->Context, "Parameters");
     $p->DefineCollection($_POST, "CategoryRoleBlock_", 1);
     while (list($key, $val) = each($p->aParameters)) {
         $RoleID = ForceInt(str_replace("CategoryRoleBlock_", "", $key), 0);
         if ($RoleID > 0) {
             $this->AllowedRoles[] = $RoleID;
         }
     }
 }
 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);
 }
 function CompleteUpload($Message = '', $ResultPage = '')
 {
     if (ForceIncomingString('PostBackAction', '') == $this->PostBackAction) {
         if ($this->Context->WarningCollector->Count() > 0) {
             // Change the contents of the container element to the specified message
             echo "<html>\n               <head>\n                  <script type=\"text/javascript\">\n                     var Parent = window.parent.document;\n                     if (Parent) {\n                        var Container = Parent.getElementById('" . $this->ContainerID . "_Errors');\n                        if (Container) {\n                           Container.innerHTML = '" . $this->EncodeErrorMessage($this->Context->WarningCollector->GetMessages()) . "';\n                        }\n                     }\n                  </script>\n               </head>\n            </html>";
         } elseif ($ResultPage == '') {
             // Change the contents of the container element to the specified message
             echo "<html>\n               <head>\n                  <script type=\"text/javascript\">\n                     var Parent = window.parent.document;\n                     if (Parent) {\n                        var Container = Parent.getElementById('" . $this->ContainerID . "');\n                        var ResultContainer = Parent.getElementById('" . $this->ContainerID . "_Result');\n                        if (Container && ResultContainer) {\n                           Container.style.display = 'none';\n                           ResultContainer.innerHTML = '" . $Message . "';\n                           ResultContainer.style.display = 'block';\n                        }\n                     }\n                  </script>\n               </head>\n            </html>";
         } else {
             // Refresh the parent document
             echo "<html>\n               <head>\n                  <script type=\"text/javascript\">\n                     var Parent = window.parent.document;\n                     if (Parent) {\n                        Parent.location = '" . $ResultPage . "';\n                     }\n                  </script>\n               </head>\n            </html>";
         }
         $this->Context->Unload();
         die;
     }
 }
 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');
 }
示例#20
0
 function CommentLinks_AddLink(&$CommentGrid)
 {
     $Context =& $CommentGrid->Context;
     $UnCounted =& $Context->PassThruVars['CommentLinks_UnCounted'];
     $Page = ForceIncomingInt('page', 1) - 1;
     $Comment =& $CommentGrid->DelegateParameters['Comment'];
     $RowNumber =& $CommentGrid->DelegateParameters['RowNumber'];
     // count the whispers & deleted comments on prior page(s), if any
     if (1 == $RowNumber && 1 <= $Page && !$Comment->DiscussionWhisperUserID) {
         $cm = $Context->ObjectFactory->NewContextObject($Context, 'CommentManager');
         $DiscussionID = ForceIncomingString('DiscussionID', 0);
         $PriorPages = $Page;
         while (1 <= $PriorPages) {
             $CommentData = $cm->GetCommentList($Context->Configuration['COMMENTS_PER_PAGE'], $PriorPages--, $DiscussionID);
             while ($Row = $Context->Database->GetRow($CommentData)) {
                 if (ForceInt($Row['WhisperUserID'], 0) || ForceBool($Row['Deleted'], 0)) {
                     $UnCounted++;
                 }
             }
         }
     }
     if (!CommentLinks_WHISPERS && ($Comment->WhisperUserID || $Comment->DiscussionWhisperUserID)) {
         $UnCounted++;
     } else {
         $Number = $RowNumber - $UnCounted + $Page * $Context->Configuration['COMMENTS_PER_PAGE'];
         // Uncounted comments should not be numbered, but may still be linkable
         if ($Comment->WhisperUserID || $Comment->DiscussionWhisperUserID || $Comment->Deleted) {
             $UnCounted++;
             $Number = $Comment->Deleted ? $Context->GetDefinition('CommentLinks_Deleted') : $Context->GetDefinition('CommentLinks_Whispered');
         }
         // This results in a shorter permalink URL that will persist if FriendlyURLs is later turned off.
         $Url = $Context->Configuration['BASE_URL'] . '?CommentID=' . $Comment->CommentID;
         $Link = '<a href="' . $Url . '" id="CommentID_' . $Comment->CommentID . '" rel="nofollow" Title="';
         if (CommentLinks_CLIPBOARD) {
             $Default = $Context->PassThruVars['CommentLinks_DefaultFormat'];
             $Link .= str_replace('//1', $Default, $Context->GetDefinition('CommentLinks_DblClk')) . '" onclick="ShowMenu(' . $Comment->CommentID . ',\'' . $Number . '\');return false;" ondblclick="CopyDefault(' . $Comment->CommentID . ',\'' . $Number . '\');return false;';
         } else {
             $Link .= $Context->GetDefinition('CommentLinks_Permalink');
         }
         $CommentList =& $CommentGrid->DelegateParameters['CommentList'];
         $CommentList .= $Link . '">#&nbsp;' . $Number . '</a>';
     }
 }
示例#21
0
 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 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);
     }
 }
示例#23
0
 function LoadData()
 {
     $this->Username = ForceIncomingString("Username", "");
     $this->Password = ForceIncomingString("Password", "");
     $this->RememberMe = ForceIncomingBool("RememberMe", 0);
     if ($this->IsPostBack) {
         if ($this->PostBackAction == "SignIn") {
             $UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, "UserManager");
             // Check for an already active session
             if ($this->Context->Session->UserID != 0) {
                 $this->PostBackValidated = 1;
             } else {
                 // Attempt to create a new session for the user
                 if ($UserManager->ValidateUserCredentials($this->Username, $this->Password, $this->RememberMe)) {
                     $this->PostBackValidated = 1;
                     // Automatically redirect if this user isn't a user administrator or master administrator or there aren't any new applicants
                     $AutoRedirect = 1;
                     if ($this->Context->Session->User->AdminUsers || $this->Context->Session->User->MasterAdmin) {
                         $this->ApplicantCount = $UserManager->GetApplicantCount();
                         if ($this->ApplicantCount > 0) {
                             $AutoRedirect = 0;
                         }
                     }
                     if ($AutoRedirect) {
                         if ($this->ReturnUrl == "") {
                             $this->ReturnUrl = dirname(ForceString(@$_SERVER["PHP_SELF"], ""));
                         } else {
                             $this->ReturnUrl = urldecode($this->ReturnUrl);
                         }
                         $this->ReturnUrl = ForceString(@$_SERVER['HTTP_HOST'], "") . $this->ReturnUrl;
                         header("location: http://" . $this->ReturnUrl);
                         die;
                     }
                 }
             }
         }
     }
 }
 function SaveUserCustomizationsFromForm(&$User)
 {
     $ValueSet = 0;
     while (list($CustomizationName) = each($this->Context->Configuration)) {
         if (strpos($CustomizationName, 'CUSTOMIZATION_') !== false) {
             $ValueSet = 1;
             $Value = ForceIncomingString($CustomizationName, '');
             $CustomizationName = substr($CustomizationName, 14);
             $User->Preferences[$CustomizationName] = $Value;
         }
     }
     if ($ValueSet) {
         $this->SaveUserPreferences($User);
     }
     return true;
 }
示例#25
0
文件: index.php 项目: jdegges/pipweb
 function Configuration()
 {
     // Configuration Settings
     $this->ConfigFile = "_config.xml";
     $this->FileTypesFile = "_filetypes.xml";
     $this->CurrentWorkingDirectory = getcwd();
     // Configuration Properties
     $this->Version = "1.3.3";
     $this->Developer = "Mark O'Sullivan";
     $this->Date = "2002-2005";
     $this->StyleUrl = "_default.css";
     $this->PageTitle = "Lussumo Filebrowser";
     $this->PageIntroduction = "";
     $this->UsePageIntroductionInSubFolders = false;
     $this->DisplayHiddenFiles = false;
     $this->BrowseSubFolders = true;
     $this->SortBy = "Name";
     $this->SortDirection = "asc";
     $this->DateFormat = "m-d-y";
     $this->PluginHeight = 400;
     $this->PluginWidth = 400;
     $this->DefaultFilesPerPage = 5;
     $this->MaxFilesPerPage = 50;
     $this->FitImagesToPage = 1;
     $this->UseThumbnails = 0;
     $this->HideFiles = array();
     $this->FullyQualifiedHideFiles = array();
     // Browsing Properties
     $this->FolderDelimiter = "-";
     $this->FileID = ForceIncomingInt("fid", 0);
     $this->FolderIDs = ForceIncomingString("did", "");
     if ($this->FolderIDs == "") {
         $this->aFolderID = array();
     } else {
         $this->aFolderID = explode($this->FolderDelimiter, $this->FolderIDs);
     }
     $this->CurrentBrowsingDirectory = $this->CurrentWorkingDirectory;
     $this->FolderNavigator = array();
     $this->FolderNavigatorLocation = "";
     $this->ShowMultipleFiles = ForceIncomingBool("smf", false);
     $this->GetFileID = ForceIncomingInt("gid", 0);
     $this->Name = "FileBrowser";
 }
示例#26
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);
//验证客服和访客的状态
if (!$uginfo['userid'] or !$uginfo['activated'] or !$uginfo['uisonline']) {
    $lines[] = 'offline';
} elseif (!$uginfo['guestid']) {
    $lines[] = 'kickout';
} elseif ($uginfo['isbanned']) {
    $lines[] = 'banned';
} elseif ($uginfo['guestid'] and $act == 'sending') {
    //发表信息
    $ajaxline = ForceIncomingString('ajaxline');
    $ajaxbiu = ForceIncomingString('ajaxbiu', '000');
    $ajaxcolor = ForceIncomingString('ajaxcolor', '0');
    $DB->exe("INSERT INTO " . TABLE_PREFIX . "msg (fromid, toid, msg, biu, color, created, minitime, type) VALUES ('{$gid}', '{$uid}', '{$ajaxline}', '{$ajaxbiu}', '{$ajaxcolor}', '{$realtime}', '{$minitime}', 0)");
    $lines[] = WeLive(2, html($ajaxline), 2, $ajaxbiu, $ajaxcolor);
}
if (!$uginfo['gisonline'] and $uginfo['guestid']) {
    //客人如果不在线, 更新为在线状态
    $DB->exe("UPDATE " . TABLE_PREFIX . "guest SET isonline = 1, created = '{$realtime}' WHERE guestid = '{$gid}'");
}
WeLiveSend($realtime + $minitime, $lines, $ajax_last, $DB->errno);
?>

示例#27
0
    }
}
//########### DELETE GROUPS ###########
if ($action == 'deletegroups') {
    $deleteusergroupids = $_POST['deleteusergroupids'];
    for ($i = 0; $i < count($deleteusergroupids); $i++) {
        $DB->exe("DELETE FROM " . TABLE_PREFIX . "usergroup WHERE usergroupid <>1 AND usergroupid = '" . ForceInt($deleteusergroupids[$i]) . "'");
    }
    GotoPage('admin.groups.php', 1);
}
//########### CREATE GROUP ###########
if ($action == 'creatgroup') {
    $groupname = ForceIncomingString('groupname');
    $groupename = ForceIncomingString('groupename');
    $description = ForceIncomingString('description');
    $descriptionen = ForceIncomingString('descriptionen');
    if ($groupname == '') {
        $errors[] = "群组名称不能为空!";
    }
    if ($groupename == '') {
        $errors[] = "群组英文名称不能为空!";
    }
    if (isset($errors)) {
        $errortitle = '添加群组错误';
        $action = 'default';
    } else {
        $DB->exe("INSERT INTO " . TABLE_PREFIX . "usergroup (displayorder, groupname, groupename, activated, description, descriptionen) VALUES (1, '{$groupname}', '{$groupename}', 1, '{$description}', '{$descriptionen}')");
        $usergroupid = $DB->insert_id();
        $DB->exe("UPDATE " . TABLE_PREFIX . "usergroup SET displayorder = '{$usergroupid}' WHERE usergroupid = '{$usergroupid}'");
        GotoPage('admin.groups.php', 1);
    }
示例#28
0
        }
    }
    if (!$error_c and !$error_u and !$error_v) {
        $sql = "SELECT u.userid FROM " . TABLE_PREFIX . "user u\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup ug ON ug.usergroupid = u.usergroupid\n\t\t\t\t\tWHERE u.userid  = '{$uid}'\n\t\t\t\t\tAND   u.activated = 1\n\t\t\t\t\tAND   u.usergroupid <> 1\n\t\t\t\t\tAND   ug.activated = 1";
        $user = $DB->getOne($sql);
        if (!$user['userid']) {
            $error = $lang['er_noaccess'];
        } else {
            $DB->exe("INSERT INTO " . TABLE_PREFIX . "comment VALUES(NULL,'{$uid}','{$gname}','{$content}','" . GetIP() . "','" . time() . "')");
            $er_info = '<BR><BR><BR><BR><BR><BR><BR><center><font color=green>' . $lang['thanksfor'] . '</font></center>';
            header_utf8();
            die($er_info);
        }
    }
} else {
    $vvckey = ForceIncomingString('vvckey');
    $code = authcode(base64_decode($_GET['code']), 'DECODE', $vvckey);
    if (!$uid or !$code or !$vvckey) {
        $error = $lang['er_verify'];
    } elseif ($code !== COOKIE_KEY . $uid) {
        $error = $lang['er_verify'];
    } elseif (IsBannedIP(GetIP())) {
        $error = $lang['er_bannedip'];
    } else {
        $sql = "SELECT u.userid, u.userfrontname, u.userfrontename FROM " . TABLE_PREFIX . "user u\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup ug ON ug.usergroupid = u.usergroupid\n\t\t\t\t\tWHERE u.userid  = '{$uid}'\n\t\t\t\t\tAND   u.activated = 1\n\t\t\t\t\tAND   u.usergroupid <> 1\n\t\t\t\t\tAND   ug.activated = 1";
        $user = $DB->getOne($sql);
        if (!$user['userid'] or $code !== COOKIE_KEY . $user['userid']) {
            $error = $lang['er_verify'];
        } elseif ($user['isonline']) {
            //跳转到服务窗口
        }
示例#29
0
    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) {
            $Error = $php_errormsg;
            if ($Error != '') {
                $Error = 'The system reported the following message:<code>' . $Error . '</code>';
            }
            $Context->WarningCollector->Add("Failed to create the '" . $File . "' configuration file. " . $Error);
        } else {
            if (fwrite($Handle, $Contents) === FALSE) {
                $Context->WarningCollector->Add("Failed to write to the '" . $File . "' file. Make sure that PHP has write access to the file.");
            }
            fclose($Handle);
示例#30
0
* Copyright 2003 Mark O'Sullivan
* This file is part of Vanilla.
* Vanilla is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
* 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 the Extension management form to handle turning extensions on and off
*/
include '../appg/settings.php';
include '../appg/init_ajax.php';
// Process the ajax request
$PostBackKey = ForceIncomingString('PostBackKey', '');
$ExtensionKey = ForceIncomingString('ExtensionKey', '');
$RequestName = ForceIncomingString('RequestName', '');
if ($PostBackKey != $Context->Session->GetVariable('SessionPostBackKey', 'string')) {
    echo $RequestName . '|[ERROR]' . $Context->GetDefinition('ErrPostBackKeyInvalid');
} else {
    if ($RequestName == 'Core') {
        // Ping the Lussumo server with core version information
        $VersionStatus = OpenUrl($Context->Configuration['UPDATE_URL'] . '?Application=VanillaCore' . '&Version=' . APPLICATION_VERSION . '&Language=' . $Context->Configuration['LANGUAGE'] . '&RequestUrl=' . $Context->Configuration['BASE_URL'], $Context);
        // Also record that the check occurred
        $SettingsFile = $Context->Configuration['APPLICATION_PATH'] . 'conf/settings.php';
        $ConfigurationManager = $Context->ObjectFactory->NewContextObject($Context, "ConfigurationManager");
        $ConfigurationManager->DefineSetting('LAST_UPDATE', mktime(), 1);
        $ConfigurationManager->SaveSettingsToFile($SettingsFile);
        // Spit out the core message
        if ($VersionStatus == "GOOD") {
            echo 'First|' . $Context->GetDefinition('ApplicationStatusGood');
        } else {