function GetPropertiesFromDataSet($DataSet)
 {
     $this->ClippingID = ForceInt(@$DataSet["ClippingID"], 0);
     $this->UserID = ForceInt(@$DataSet["UserID"], 0);
     $this->Label = ForceString(@$DataSet["Label"], "");
     $this->Contents = ForceString(@$DataSet["Contents"], "");
 }
 function DefineCollection($Collection, $ParameterPrefix = "", $IncludeByPrefix = "0", $ExcludeByPrefix = "0")
 {
     $ParameterPrefix = ForceString($ParameterPrefix, "");
     $IncludeByPrefix = ForceBool($IncludeByPrefix, 0);
     $ExcludeByPrefix = ForceBool($ExcludeByPrefix, 0);
     $Add = 1;
     while (list($key, $value) = each($Collection)) {
         $Add = 1;
         if ($ParameterPrefix != "") {
             $PrefixMatchLocation = strstr($key, $ParameterPrefix);
             // If the prefix isn't found or the location is anywhere other than 0 (the start of the variable name)
             if ($PrefixMatchLocation === false || $PrefixMatchLocation != 0) {
                 if ($IncludeByPrefix) {
                     $Add = 0;
                 }
             } else {
                 if ($ExcludeByPrefix) {
                     $Add = 0;
                 }
             }
         }
         if ($Add) {
             $this->Add($key, $value);
         }
     }
 }
 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();
         }
     }
 }
 function Context(&$Configuration)
 {
     $this->Configuration =& $Configuration;
     $this->BodyAttributes = '';
     $this->StyleUrl = '';
     $this->PageTitle = '';
     $this->Dictionary = array();
     $this->DelegateCollection = array();
     $this->PassThruVars = array();
     $this->CommentFormats = array();
     $this->CommentFormats[] = 'Text';
     // Create an object factory
     $this->ObjectFactory = new ObjectFactory();
     // Current Mode
     $this->Mode = ForceIncomingCookieString('Mode', '');
     // Url of the current page (this should be hard-coded by each page since php server vars are unreliable)
     $this->SelfUrl = ForceString($Configuration['SELF_URL'], 'index.php');
     // Instantiate a SqlCollector (for debugging)
     $this->SqlCollector = new MessageCollector();
     $this->SqlCollector->CssClass = 'Sql';
     // Instantiate a Warning collector (for user errors)
     $this->WarningCollector = new MessageCollector();
     // Instantiate an Error manager (for fatal errors)
     $this->ErrorManager = new ErrorManager();
     // Instantiate a Database object (for performing database actions)
     $this->Database = new $Configuration['DATABASE_SERVER']($this);
     // Instantiate the string manipulation object
     $this->StringManipulator = new StringManipulator($this->Configuration);
     // Add the plain text manipulator
     $TextFormatter = new TextFormatter();
     $this->StringManipulator->AddManipulator($Configuration['DEFAULT_FORMAT_TYPE'], $TextFormatter);
 }
 function GetPropertiesFromDataSet($DataSet)
 {
     $this->CategoryID = ForceInt(@$DataSet["CategoryID"], 0);
     $this->Name = ForceString(@$DataSet["Name"], "");
     $this->Description = ForceString(@$DataSet["Description"], "");
     $this->DiscussionCount = ForceInt(@$DataSet["DiscussionCount"], 0);
     $this->Blocked = ForceBool(@$DataSet["Blocked"], 0);
 }
Example #6
0
/**
 * Function to add to Comment::GetPropertiesFromDataSet() PreAssignAuthRoleIcon delegation.
 *
 * @param Comment $Comment
 */
function Gravatar_SetAuthIconToGravatarUrl(&$Comment)
{
    $DataSet = $Comment->DelegateParameters['DataSet'];
    $Email = ForceString(@$DataSet['AuthEmail'], '');
    if ($Email) {
        $Comment->AuthIcon = Gravatar_GetGravatarUrl($Email, $Comment->AuthIcon, $Comment->Context->Configuration);
    }
}
 function GetSimple()
 {
     $sReturn = "";
     $ErrorCount = count($this->Errors);
     for ($i = 0; $i < $ErrorCount; $i++) {
         $sReturn .= ForceString($this->Errors[$i]->Message, "No error message supplied\r\n");
     }
     return $sReturn;
 }
 function GetPropertiesFromDataSet($DataSet)
 {
     $this->CategoryID = ForceInt(@$DataSet['CategoryID'], 0);
     $this->Name = ForceString(@$DataSet['Name'], '');
     $this->Description = ForceString(@$DataSet['Description'], '');
     $this->DiscussionCount = ForceInt(@$DataSet['DiscussionCount'], 0);
     $this->Blocked = ForceBool(@$DataSet['Blocked'], 0);
     $this->RoleBlocked = ForceBool(@$DataSet['RoleBlocked'], 0);
 }
 function GetVariable($Name, $DataType = 'bool')
 {
     if ($DataType == 'int') {
         return ForceInt(@$_SESSION[$Name], 0);
     } elseif ($DataType == 'bool') {
         return ForceBool(@$_SESSION[$Name], 0);
     } else {
         return ForceString(@$_SESSION[$Name], '');
     }
 }
Example #10
0
function ForceStringFrom($VariableName, $DefaultValue = '')
{
    if (isset($_GET[$VariableName])) {
        return ForceString($_GET[$VariableName], $DefaultValue);
    } elseif (isset($_POST[$VariableName])) {
        return ForceString($_POST[$VariableName], $DefaultValue);
    } else {
        return $DefaultValue;
    }
}
 function GetPropertiesFromDataSet($DataSet, $ParseKeywords = "0")
 {
     $ParseKeywords = ForceBool($ParseKeywords, 0);
     $this->SearchID = ForceInt(@$DataSet["SearchID"], 0);
     $this->Label = ForceString(@$DataSet["Label"], "");
     $this->Type = $this->DefineType(ForceString(@$DataSet["Type"], ""));
     $this->Keywords = urldecode(ForceString(@$DataSet["Keywords"], ""));
     if ($ParseKeywords) {
         $this->ParseKeywords($this->Type, $this->Keywords);
     }
 }
 function GetPropertiesFromDataSet($DataSet, $ParseKeywords = '0')
 {
     $ParseKeywords = ForceBool($ParseKeywords, 0);
     $this->SearchID = ForceInt(@$DataSet['SearchID'], 0);
     $this->Label = ForceString(@$DataSet['Label'], '');
     $this->Type = $this->DefineType(ForceString(@$DataSet['Type'], ''));
     $this->Keywords = urldecode(ForceString(@$DataSet['Keywords'], ''));
     if ($ParseKeywords) {
         $this->ParseKeywords($this->Type, $this->Keywords);
     }
 }
 function GetVariable($Name, $DataType = "bool")
 {
     if ($DataType == "int") {
         return ForceInt(@$_SESSION[$Name], 0);
     } elseif ($DataType == "bool") {
         return ForceBool(@$_SESSION[$Name], 0);
     } elseif ($DataType == "Array") {
         return ForceArray(@$_SESSION[$Name], array());
     } else {
         return ForceString(@$_SESSION[$Name], "");
     }
 }
Example #14
0
 function GetPropertiesFromDataSet($DataSet)
 {
     $this->StyleID = ForceInt(@$DataSet["StyleID"], 0);
     $this->AuthUserID = ForceInt(@$DataSet["AuthUserID"], 0);
     if ($this->AuthUserID == 0) {
         $this->AuthUsername = $this->Context->GetDefinition("System");
         $this->AuthFullName = $this->Context->GetDefinition("System");
     } else {
         $this->AuthUsername = ForceString(@$DataSet["AuthUsername"], "");
         $this->AuthFullName = ForceString(@$DataSet["AuthFullName"], "");
     }
     $this->Name = ForceString(@$DataSet["Name"], "");
     $this->Url = ForceString(@$DataSet["Url"], "");
     $this->PreviewImage = ForceString(@$DataSet["PreviewImage"], "");
 }
 function GetPropertiesFromDataSet($DataSet)
 {
     $this->UserID = ForceInt(@$DataSet['UserID'], 0);
     $this->Username = ForceString(@$DataSet['Username'], '');
     $this->FullName = ForceString(@$DataSet['FullName'], '');
     $this->RoleID = ForceInt(@$DataSet['RoleID'], 0);
     $this->Role = ForceString(@$DataSet['Role'], '');
     $this->RoleDescription = ForceString(@$DataSet['RoleDescription'], '');
     $this->RoleIcon = ForceString(@$DataSet['RoleIcon'], '');
     $this->AdminUserID = ForceInt(@$DataSet['AdminUserID'], 0);
     $this->AdminUsername = ForceString(@$DataSet['AdminUsername'], '');
     $this->AdminFullName = ForceString(@$DataSet['AdminFullName'], '');
     $this->Notes = ForceString(@$DataSet['Notes'], '');
     $this->Date = UnixTimestamp(@$DataSet['Date']);
 }
 function GetPropertiesFromDataSet($DataSet)
 {
     $this->RoleID = ForceInt(@$DataSet["RoleID"], 0);
     $this->Name = ForceString(@$DataSet["Name"], "");
     $this->Icon = ForceString(@$DataSet["Icon"], "");
     $this->Description = ForceString(@$DataSet["Description"], "");
     $this->CanLogin = ForceBool(@$DataSet["CanLogin"], 0);
     $this->CanPostDiscussion = ForceBool(@$DataSet["CanPostDiscussion"], 0);
     $this->CanPostComment = ForceBool(@$DataSet["CanPostComment"], 0);
     $this->CanPostHTML = ForceBool(@$DataSet["CanPostHTML"], 0);
     $this->CanViewIps = ForceBool(@$DataSet["CanViewIps"], 0);
     $this->AdminUsers = ForceBool(@$DataSet["AdminUsers"], 0);
     $this->AdminCategories = ForceBool(@$DataSet["AdminCategories"], 0);
     $this->MasterAdmin = ForceBool(@$DataSet["MasterAdmin"], 0);
     $this->ShowAllWhispers = ForceBool(@$DataSet["ShowAllWhispers"], 0);
 }
 function Authenticate($Username, $Password, $PersistentSession)
 {
     // Validate the username and password that have been set
     $Username = FormatStringForDatabaseInput($Username);
     $Password = FormatStringForDatabaseInput($Password);
     $UserID = 0;
     // Retrieve matching username/password values
     $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder');
     $s->SetMainTable('User', 'u');
     $s->AddJoin('Role', 'r', 'RoleID', 'u', 'RoleID', 'left join');
     $s->AddSelect(array('UserID', 'VerificationKey'), 'u');
     $s->AddSelect('PERMISSION_SIGN_IN', 'r');
     $s->AddWhere('u', 'Name', '', $Username, '=');
     $s->AddWhere('u', 'Password', '', $Password, '=', 'and', 'md5', 1, 1);
     $s->AddWhere('u', 'Password', '', $Password, '=', 'or');
     $s->EndWhereGroup();
     $UserResult = $this->Context->Database->Select($s, 'Authenticator', 'Authenticate', 'An error occurred while attempting to validate your credentials');
     if (!$UserResult) {
         $UserID = -2;
     } elseif ($this->Context->Database->RowCount($UserResult) > 0) {
         $CanSignIn = 0;
         $VerificationKey = '';
         while ($rows = $this->Context->Database->GetRow($UserResult)) {
             $VerificationKey = ForceString($rows['VerificationKey'], '');
             if ($VerificationKey == '') {
                 $VerificationKey = DefineVerificationKey();
             }
             $UserID = ForceInt($rows['UserID'], 0);
             $CanSignIn = ForceBool($rows['PERMISSION_SIGN_IN'], 0);
         }
         if (!$CanSignIn) {
             $UserID = -1;
         } else {
             // Update the user's information
             $this->UpdateLastVisit($UserID, $VerificationKey);
             // Assign the session value
             $this->AssignSessionUserID($UserID);
             // Set the 'remember me' cookies
             if ($PersistentSession) {
                 $this->SetCookieCredentials($UserID, $VerificationKey);
             }
         }
     }
     return $UserID;
 }
 function Context()
 {
     // Create an object factory
     $this->ObjectFactory = new ObjectFactory();
     // Current Mode
     $this->Mode = ForceIncomingCookieString("Mode", "");
     // Url of the current page
     $this->SelfUrl = basename(ForceString(@$_SERVER['PHP_SELF'], "index.php"));
     // Instantiate a SqlCollector (for debugging)
     $this->SqlCollector = new MessageCollector();
     $this->SqlCollector->CssClass = "Sql";
     // Instantiate a Warning collector (for user errors)
     $this->WarningCollector = new MessageCollector();
     // Instantiate an Error manager (for fatal errors)
     $this->ErrorManager = new ErrorManager();
     // Instantiate a Database object (for performing database actions)
     $this->Database = new MySQL(dbHOST, dbNAME, dbUSER, dbPASSWORD, $this);
 }
Example #19
0
 function GetPropertiesFromDataSet($DataSet, &$Context)
 {
     $this->Title = FormatHtmlStringInline(ForceString($DataSet["Name"], ""));
     $this->Link = PrependString("http://", AppendFolder(agDOMAIN, "comments.php?DiscussionID=" . ForceInt($DataSet["DiscussionID"], 0)));
     $this->Id = $this->Link;
     $this->Published = FixDate(@$DataSet["DateCreated"]);
     $this->Updated = FixDate(@$DataSet["DateLastActive"]);
     $this->AuthorName = FormatHtmlStringInline(ForceString($DataSet["AuthUsername"], ""));
     $this->AuthorUrl = PrependString("http://", AppendFolder(agDOMAIN, "account.php?u=" . ForceInt($DataSet["AuthUserID"], 0)));
     $this->Content = $this->RemoveHtml(ForceString(@$DataSet["Body"], ""));
     $this->Summary = SliceString($this->Content, 200);
     $this->Summary = str_replace("\r\n", " ", $this->Content);
     $this->Content = str_replace("\r\n", "<br />", $this->Content);
     if (agUSE_CATEGORIES) {
         $this->Category = FormatStringForDisplay(ForceString($DataSet["Category"], ""), true);
         $this->CategoryLink = "http://" . AppendFolder(agDOMAIN, "?CategoryID=" . ForceInt($DataSet["CategoryID"], 0));
     }
 }
 function BreakKeywords()
 {
     $this->UserQuery = strtolower(trim($this->UserQuery));
     $Keywords = explode(" ", $this->UserQuery);
     $CurrentKeywords = "";
     for ($i = 0; $i < count($Keywords); $i++) {
         $CurrentKeyword = ForceString($Keywords[$i], "");
         if ($CurrentKeyword != "") {
             if (in_array($CurrentKeyword, $this->Operators)) {
                 if ($i + 1 < count($Keywords)) {
                     $i++;
                     $NextKeyword = ForceString($Keywords[$i], "");
                     $this->Keywords[] = array("Operator" => $CurrentKeyword, "Keyword" => $NextKeyword);
                 }
             } else {
                 $this->Keywords[] = array("Operator" => "and", "Keyword" => $CurrentKeyword);
             }
         }
     }
 }
Example #21
0
 function GetPropertiesFromDataSet($DataSet)
 {
     $this->RoleID = ForceInt(@$DataSet['RoleID'], 0);
     $this->RoleName = ForceString(@$DataSet['Name'], '');
     $this->Icon = ForceString(@$DataSet['Icon'], '');
     $this->Description = ForceString(@$DataSet['Description'], '');
     $this->PERMISSION_SIGN_IN = ForceBool(@$DataSet['PERMISSION_SIGN_IN'], 0);
     $this->PERMISSION_HTML_ALLOWED = ForceBool(@$DataSet['PERMISSION_HTML_ALLOWED'], 0);
     $this->PERMISSION_RECEIVE_APPLICATION_NOTIFICATION = ForceBool(@$DataSet['PERMISSION_RECEIVE_APPLICATION_NOTIFICATION'], 0);
     $this->Unauthenticated = ForceBool(@$DataSet['Unauthenticated'], 0);
     $TempPermissions = '';
     $TempPermissions = ForceString(@$DataSet['Permissions'], '');
     $TempPermissions = UnserializeAssociativeArray($TempPermissions);
     $this->Permissions['PERMISSION_SIGN_IN'] = $this->PERMISSION_SIGN_IN;
     $this->Permissions['PERMISSION_HTML_ALLOWED'] = $this->PERMISSION_HTML_ALLOWED;
     $this->Permissions['PERMISSION_RECEIVE_APPLICATION_NOTIFICATION'] = $this->PERMISSION_RECEIVE_APPLICATION_NOTIFICATION;
     while (list($TempKey, $TempValue) = each($TempPermissions)) {
         $this->Permissions[$TempKey] = $TempValue;
     }
     unset($TempPermissions);
 }
 function BreakKeywords()
 {
     $Keywords = explode(' ', $this->UserQuery);
     $CurrentKeywords = '';
     $KeywordCount = count($Keywords);
     $i = 0;
     for ($i = 0; $i < $KeywordCount; $i++) {
         $CurrentKeyword = ForceString($Keywords[$i], '');
         if ($CurrentKeyword != '') {
             if (in_array($CurrentKeyword, $this->Operators)) {
                 if ($i + 1 < count($Keywords)) {
                     $i++;
                     $NextKeyword = ForceString($Keywords[$i], '');
                     $this->Keywords[] = array('Operator' => $CurrentKeyword, 'Keyword' => $NextKeyword);
                 }
             } else {
                 $this->Keywords[] = array('Operator' => 'and', 'Keyword' => $CurrentKeyword);
             }
         }
     }
 }
 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;
                     }
                 }
             }
         }
     }
 }
Example #24
0
 public function updatephrases()
 {
     $page = ForceIntFrom('p', 1);
     //页码
     if (IsPost('updatephrases')) {
         $pids = $_POST['pids'];
         $sorts = $_POST['sorts'];
         $activateds = $_POST['activateds'];
         $msgs = $_POST['msgs'];
         $msg_ens = $_POST['msg_ens'];
         for ($i = 0; $i < count($pids); $i++) {
             $pid = ForceInt($pids[$i]);
             APP::$DB->exe("UPDATE " . TABLE_PREFIX . "phrase SET sort = '" . ForceInt($sorts[$i]) . "',\n\t\t\t\t\tactivated = '" . ForceInt($activateds[$i]) . "',\n\t\t\t\t\tmsg = '" . ForceString($msgs[$i]) . "',\n\t\t\t\t\tmsg_en = '" . ForceString($msg_ens[$i]) . "'\t\t\t\t\t\n\t\t\t\t\tWHERE pid = '{$pid}'");
         }
     } else {
         $deletepids = $_POST['deletepids'];
         for ($i = 0; $i < count($deletepids); $i++) {
             $pid = ForceInt($deletepids[$i]);
             APP::$DB->exe("DELETE FROM " . TABLE_PREFIX . "phrase WHERE pid = '{$pid}'");
         }
     }
     Success('phrases?p=' . $page);
 }
 function VerifyPasswordResetRequest($VerificationUserID, $EmailVerificationKey)
 {
     $VerificationUserID = ForceInt($VerificationUserID, 0);
     $EmailVerificationKey = ForceString($EmailVerificationKey, '');
     $EmailVerificationKey = FormatStringForDatabaseInput($EmailVerificationKey);
     // Attempt to retrieve email address
     $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder');
     $s->SetMainTable('User', 'u');
     $s->AddSelect('UserID', 'u');
     $s->AddWhere('u', 'UserID', '', $VerificationUserID, '=');
     $s->AddWhere('u', 'EmailVerificationKey', '', $EmailVerificationKey, '=');
     $UserResult = $this->Context->Database->Select($s, $this->Name, 'VerifyPasswordResetRequest', 'An error occurred while retrieving account information.');
     if ($this->Context->Database->RowCount($UserResult) == 0) {
         $this->Context->WarningCollector->Add($this->Context->GetDefinition('ErrPasswordResetRequest'));
     }
     return $this->Context->WarningCollector->Iif();
 }
Example #26
0
 function ParseNode($XmlString)
 {
     // Retrieve the first xml tag in the file
     $XmlString = trim($XmlString);
     $RootNodeStartTag = strpos($XmlString, "<");
     $RootNodeEndTag = strpos($XmlString, ">");
     $RootNodeName = "";
     $RootNodeAttributes = array();
     $FauxContext = "0";
     // If the opening tag exists, parse it out
     if ($RootNodeStartTag === false || $RootNodeEndTag === false) {
         $this->ErrorManager->AddError($FauxContext, $this->Name, "ParseNode", "A fatal error occurred while attempting to parse xml nodes. Syntax Error: xml not properly defined.");
     } else {
         $RootNodeName = trim(substr($XmlString, $RootNodeStartTag + 1, $RootNodeEndTag - 1));
         // Evaluate the tag for attributes
         $SpacePosition = strpos($RootNodeName, " ");
         if ($SpacePosition !== false) {
             $sAttributes = trim(substr($RootNodeName, $SpacePosition, strlen($RootNodeName) - $SpacePosition));
             $RootNodeName = trim(substr($RootNodeName, 0, $SpacePosition));
             $tmpArray = explode("=", $sAttributes);
             $i = 0;
             $ArrayKeys = count($tmpArray) - 1;
             $Name = "";
             while ($i < $ArrayKeys) {
                 if ($i + 1 <= $ArrayKeys) {
                     if ($Name == "") {
                         $Name = ForceString($tmpArray[$i], "");
                     }
                     $Value = ForceString($tmpArray[$i + 1], "");
                     if (strpos($Value, "\"") === 0) {
                         $Value = substr($Value, 1);
                     }
                     $NextQuotePosition = strpos($Value, "\"");
                     $NextName = "";
                     if ($NextQuotePosition !== false) {
                         $NextName = trim(substr($Value, $NextQuotePosition));
                         $Value = substr($Value, 0, $NextQuotePosition);
                     }
                     $RootNodeAttributes[$Name] = $Value;
                     $Name = $NextName;
                 }
                 $i += 2;
             }
         }
     }
     // Double check to see that the root tag name has been properly defined
     if ($RootNodeName == "") {
         $this->ErrorManager->AddError($FauxContext, $this->Name, "ParseNode", "Node name not defined.");
     }
     $Node = new XmlNode();
     $Node->Name = $RootNodeName;
     $Node->Attributes = $RootNodeAttributes;
     // Get content from within the root tag
     $RootNodeStartCloseTag = strpos($XmlString, "</" . $RootNodeName . ">");
     $XmlString = substr($XmlString, $RootNodeEndTag + 1, $RootNodeStartCloseTag - $RootNodeEndTag - 1);
     // Check the inner content to define the current node type
     if (strpos($XmlString, "<") !== false && strpos($XmlString, ">") !== false) {
         $Node->Type = XmlNodeTypeContainer;
     } else {
         $Node->Type = XmlNodeTypeContent;
     }
     if ($Node->Type == XmlNodeTypeContent) {
         // If the current node holds content, return it
         $Node->Value = $XmlString;
     } else {
         // If the current node contains more nodes, parse it
         // Define nodes until entire xmlstring has been handled at this level
         $HandlerComplete = false;
         while (!$HandlerComplete) {
             // Defind the node name
             $NodeStartOpenTag = strpos($XmlString, "<");
             $NodeEndOpenTag = strpos($XmlString, ">");
             $NodeName = trim(substr($XmlString, $NodeStartOpenTag + 1, $NodeEndOpenTag - 1 - $NodeStartOpenTag));
             // Check the Node Name for any spaces and remove anything if it exists
             $SpacePosition = strpos($NodeName, " ");
             if ($SpacePosition !== false) {
                 $NodeName = substr($NodeName, 0, $SpacePosition);
             }
             // Find the position of the closing tag for this node
             $NodeStartCloseTag = strpos($XmlString, "</" . $NodeName . ">");
             $NodeEndCloseTag = $NodeStartCloseTag + strlen($NodeName) + 3;
             // If it wasn't found, throw an error and break the loop
             if ($NodeStartCloseTag === false) {
                 $this->ErrorManager->AddError($FauxContext, $this->Name, "ParseNode", "Closing tag for \"{$NodeName}\" node not defined.");
                 break;
                 // If the tag was found, return everything from the beginning to the end and parse it into a child
             } else {
                 $NewXmlNodeString = substr($XmlString, $NodeStartOpenTag, $NodeEndCloseTag);
                 $Node->Child[] = $this->ParseNode($NewXmlNodeString);
             }
             if (strlen($XmlString) > $NodeEndCloseTag) {
                 $XmlString = trim(substr($XmlString, $NodeEndCloseTag, strlen($XmlString)));
             } else {
                 $XmlString = "";
             }
             if ($XmlString == "") {
                 $HandlerComplete = true;
             }
         }
     }
     return $Node;
 }
 function GetSelect($SelectPrefix = "")
 {
     $sReturn = $SelectPrefix . "select ";
     $sReturn .= $this->Fields . " ";
     // Build the from statement
     $sReturn .= "from " . $this->MainTable["TableName"] . " ";
     $TableAlias = ForceString($this->MainTable["TableAlias"], "");
     if ($TableAlias != "") {
         $sReturn .= $TableAlias . " ";
     }
     $sReturn .= $this->Joins . " ";
     if ($this->Wheres != "") {
         $sReturn .= " where " . $this->Wheres . " ";
     }
     if ($this->GroupBys != "") {
         $sReturn .= " group by " . $this->GroupBys;
     }
     if ($this->OrderBys != "") {
         $sReturn .= " order by " . $this->OrderBys;
     }
     $sReturn .= $this->Limit;
     $this->WriteDebug($sReturn, "purple");
     return $sReturn;
     // 		echo "<!--[".$sReturn."-->";
 }
Example #28
0
    $action = 'deletegroups';
}
PrintHeader($userinfo['username'], 'groups');
//########### UPDATE GROUPS ###########
if ($action == 'updategroups') {
    $usergroupids = $_POST['usergroupids'];
    $displayorders = $_POST['displayorders'];
    $groupnames = $_POST['groupnames'];
    $groupenames = $_POST['groupenames'];
    $descriptions = $_POST['descriptions'];
    $descriptionens = $_POST['descriptionens'];
    $activateds = $_POST['activateds'];
    for ($i = 0; $i < count($usergroupids); $i++) {
        $groupname = ForceString($groupnames[$i]);
        $groupename = ForceString($groupenames[$i]);
        $DB->exe("UPDATE " . TABLE_PREFIX . "usergroup SET displayorder = '" . ForceInt($displayorders[$i]) . "',\r\n\t\tgroupname = '" . Iif($groupname, $groupname, '未命名') . "',\r\n\t\tgroupename = '" . Iif($groupename, $groupename, 'No name') . "',\r\n\t\tactivated = '" . ForceInt($activateds[$i]) . "',\r\n\t\tdescription = '" . ForceString($descriptions[$i]) . "',\r\n\t\tdescriptionen = '" . ForceString($descriptionens[$i]) . "'\r\n\t\tWHERE usergroupid = '" . ForceInt($usergroupids[$i]) . "'");
    }
    if (!storeCache()) {
        //更新小面板在线客服缓存文件
        $errortitle = '更新客服缓存错误';
        $errors = '客服群组信息已保存到数据库, 但更新在线客服缓存文件失败, 前台客服小面板状态无法更新! 请检查cache/目录是否存在或可写?';
        $action = 'default';
    } else {
        GotoPage('admin.groups.php', 1);
    }
}
//########### 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]) . "'");
Example #29
0
    echo '<h2>Vanilla Upgrade Wizard (Step 1 of 3)</h2>
				
				<p><strong>Only use this upgrader if you are upgrading from Vanilla 0.9.2.x</strong></p>';
    if ($Context->WarningCollector->Count() > 0) {
        echo "<div class=\"Warnings\">\r\n\t\t\t\t\t\t<strong>We came across some problems while checking your permissions...</strong>\r\n\t\t\t\t\t\t" . $Context->WarningCollector->GetMessages() . "\r\n\t\t\t\t\t</div>";
    }
    echo "<p>Navigate the filesystem of your server to the Vanilla folder. If you have your old appg/settings.php file from your previous installation of Vanilla, rename it <strong>old_settings.php</strong> and upload it to the /conf folder of your new Vanilla installation.</p>\r\n\t\t\t\t\r\n\t\t\t\t<p>Vanilla will need read AND write access to the <strong>conf</strong> folder.</p>\r\n\t\t\t\t\r\n\t\t\t\t<p>There are many ways to set these permissions. One way is to execute the following from the root Vanilla folder:</p>\r\n\t\t\t\t\r\n\t\t\t\t<code>chmod 777 ./conf</code>\r\n\t\t\t\t\r\n\t\t\t\t<p>You will also need to grant read access to the extensions, languages, setup, and themes folders. Typically these permissions are granted by default, but if not you can achieve them with the following commands:</p>\r\n                                \r\n                                <code>chmod --recursive 755 ./extensions\r\n                                <br />chmod --recursive 755 ./languages\r\n                                <br />chmod --recursive 755 ./setup\r\n                                <br />chmod --recursive 755 ./themes</code>\r\n\t\t\t\t\r\n\t\t\t\t<form id=\"frmPermissions\" method=\"post\" action=\"upgrader.php\">\r\n\t\t\t\t<input type=\"hidden\" name=\"PostBackAction\" value=\"Permissions\" />\r\n\t\t\t\t<div class=\"Button\"><input type=\"submit\" value=\"Click here to check your permissions and proceed to the next step\" /></div>\r\n\t\t\t\t</form>";
} elseif ($CurrentStep == 2) {
    echo "<h2>Vanilla Upgrade Wizard (Step 2 of 3)</h2>";
    if ($Context->WarningCollector->Count() > 0) {
        echo "<div class=\"Warnings\">\r\n\t\t\t\t\t\t\t<strong>We came across some problems while upgrading Vanilla...</strong>\r\n\t\t\t\t\t\t\t" . $Context->WarningCollector->GetMessages() . "\r\n\t\t\t\t\t\t</div>";
    }
    echo "<p>Below you can provide the connection parameters for the mysql server where your existing Vanilla database is set up so it can be upgraded. If you haven't done it yet, <strong>back up your existing Vanilla database before continuing</strong>.</p>\r\n\t\t\t\t\t<fieldset>\r\n\t\t\t\t\t\t<form id=\"frmDatabase\" method=\"post\" action=\"upgrader.php\">\r\n\t\t\t\t\t\t<input type=\"hidden\" name=\"PostBackAction\" value=\"Database\" />\r\n\t\t\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t<label for=\"tDBHost\">MySQL Server</label>\r\n\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"tDBHost\" name=\"DBHost\" value=\"" . FormatStringForDisplay($DBHost, 1) . "\" />\r\n\t\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t<label for=\"tDBName\">MySQL Database Name</label>\r\n\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"tDBName\" name=\"DBName\" value=\"" . FormatStringForDisplay($DBName, 1) . "\" />\r\n\t\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t<label for=\"tDBUser\">MySQL User</label>\r\n\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"tDBUser\" name=\"DBUser\" value=\"" . FormatStringForDisplay($DBUser, 1) . "\" />\r\n\t\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t<label for=\"tDBPass\">MySQL Password</label>\r\n\t\t\t\t\t\t\t\t\t<input type=\"password\" id=\"tDBPass\" name=\"DBPass\" value=\"" . FormatStringForDisplay($DBPass, 1) . "\" />\r\n\t\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t\t\t<div class=\"Button\"><input type=\"submit\" value=\"Click here to create Vanilla's database and proceed to the next step\" /></div>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</fieldset>";
} elseif ($CurrentStep == 3) {
    if ($PostBackAction != "User") {
        $CookieDomain = ForceString(@$_SERVER['HTTP_HOST'], "");
        $CookiePath = $WebRoot;
    }
    echo "<h2>Vanilla Upgrade Wizard (Step 3 of 3)</h2>";
    if ($Context->WarningCollector->Count() > 0) {
        echo "<div class=\"Warnings\">\r\n\t\t\t\t\t\t\t<strong>We came across some problems while setting up Vanilla...</strong>\r\n\t\t\t\t\t\t\t" . $Context->WarningCollector->GetMessages() . "\r\n\t\t\t\t\t\t</div>";
    }
    echo "<p>Now we've got to set up the support contact information for your forum. This is what people will see when emails go out from the system for things like password retrieval and role changes.</p>\r\n\t\t\t\t\t\t<fieldset>" . '<form name="frmUser" method="post" action="upgrader.php">
						<input type="hidden" name="PostBackAction" value="User" />					
						<ul>
							<li>
								<label for="tSupportName">Support Contact Name</label>
								<input id="tSupportName" type="text" name="SupportName" value="' . FormatStringForDisplay($SupportName, 1) . '" />
							</li>
							<li>
								<label for="tSupportEmail">Support Email Address</label>
 function GetPropertiesFromDataSet($DataSet, $UserID)
 {
     $this->CommentID = ForceInt(@$DataSet["CommentID"], 0);
     $this->DiscussionID = ForceInt(@$DataSet["DiscussionID"], 0);
     $this->DiscussionWhisperUserID = ForceInt(@$DataSet["DiscussionWhisperUserID"], 0);
     $this->Discussion = ForceString(@$DataSet["Discussion"], "");
     $this->CategoryID = ForceInt(@$DataSet["CategoryID"], 0);
     $this->Category = ForceString(@$DataSet["Category"], "");
     $this->AuthUserID = ForceInt(@$DataSet["AuthUserID"], 0);
     $this->AuthFullName = ForceString(@$DataSet["AuthFullName"], "");
     $this->AuthUsername = ForceString(@$DataSet["AuthUsername"], "");
     $this->AuthIcon = ForceString(@$DataSet["AuthIcon"], "");
     $this->AuthRoleID = ForceInt(@$DataSet["AuthRoleID"], 0);
     $this->AuthRole = ForceString(@$DataSet["AuthRole"], "");
     $this->AuthRoleIcon = ForceString(@$DataSet["AuthRoleIcon"], "");
     $this->AuthRoleDesc = ForceString(@$DataSet["AuthRoleDesc"], "");
     $this->AuthCanPostHtml = ForceBool(@$DataSet["AuthCanPostHtml"], 0);
     $this->AuthBlocked = ForceBool(@$DataSet["AuthBlocked"], 0);
     $this->CommentBlocked = ForceBool(@$DataSet["CommentBlocked"], 0);
     $this->EditUserID = ForceInt(@$DataSet["EditUserID"], 0);
     $this->EditFullName = ForceString(@$DataSet["EditFullName"], "");
     $this->EditUsername = ForceString(@$DataSet["EditUsername"], "");
     $this->DateCreated = UnixTimestamp(@$DataSet["DateCreated"]);
     $this->DateEdited = UnixTimestamp(@$DataSet["DateEdited"]);
     $this->WhisperUserID = ForceInt(@$DataSet["WhisperUserID"], 0);
     $this->WhisperUsername = ForceString(@$DataSet["WhisperUsername"], "");
     $this->Body = ForceString(@$DataSet["Body"], "");
     $this->FormatType = ForceString(@$DataSet["FormatType"], "Text");
     $this->Deleted = ForceBool(@$DataSet["Deleted"], 0);
     $this->DateDeleted = UnixTimestamp(@$DataSet["DateDeleted"]);
     $this->DeleteUserID = ForceInt(@$DataSet["DeleteUserID"], 0);
     $this->DeleteFullName = ForceString(@$DataSet["DeleteFullName"], "");
     $this->DeleteUsername = ForceString(@$DataSet["DeleteUsername"], "");
     $this->RemoteIp = ForceString(@$DataSet["RemoteIp"], "");
     $this->Status = $this->GetStatus($UserID);
     if ($this->AuthRoleIcon != "") {
         $this->AuthIcon = $this->AuthRoleIcon;
     }
 }