当前位置: 首页>>代码示例>>PHP>>正文


PHP ForceBool函数代码示例

本文整理汇总了PHP中ForceBool函数的典型用法代码示例。如果您正苦于以下问题:PHP ForceBool函数的具体用法?PHP ForceBool怎么用?PHP ForceBool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ForceBool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetWhosOnline

 function GetWhosOnline()
 {
     $s = $this->Context->ObjectFactory->NewContextObject($this->Context, "SqlBuilder");
     $s->SetMainTable("User", "u");
     $s->AddSelect(array("Name", "UserID", "DateLastActive", "Preferences"), "u");
     $s->AddWhere("u", "DateLastActive", "", "DATE_SUB(NOW(), INTERVAL 5 MINUTE)", ">=", NULL, NULL, 0);
     $result = $this->Context->Database->Select($s, $this->Name, "GetRecentUsers", "An error occurred while attempting to retrieve the requested information.");
     if ($this->Context->Database->RowCount($result) == 0) {
         return NULL;
     } else {
         $my_array = array();
         while ($rows = $this->Context->Database->GetRow($result)) {
             if ($rows["Preferences"]) {
                 $settings = unserialize($rows["Preferences"]);
                 if (array_key_exists("Phantom", $settings)) {
                     $phantom = ForceBool($settings["Phantom"], 0);
                 } else {
                     $phantom = false;
                 }
             } else {
                 $phantom = false;
             }
             array_push($my_array, array("Name" => $rows["Name"], "UserID" => $rows["UserID"], "DateLastActive" => $rows["DateLastActive"], "Phantom" => $phantom));
         }
         return $my_array;
     }
 }
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:27,代码来源:default.php

示例2: AddOptionsFromDataSet

 function AddOptionsFromDataSet(&$Database, $DataSet, $IdField, $DisplayField, $CheckedField, $FlipCheckedValue, $Attributes = '')
 {
     $FlipCheckedValue = ForceBool($FlipCheckedValue, 0);
     while ($rows = $Database->GetRow($DataSet)) {
         $this->AddOption($rows[$IdField], $rows[$DisplayField], $rows[$CheckedField], $FlipCheckedValue, $Attributes);
     }
 }
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:7,代码来源:Framework.Class.Checkbox.php

示例3: DefineCollection

 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);
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:26,代码来源:Utility.Parameters.class.php

示例4: FormatPropertiesForDisplay

 function FormatPropertiesForDisplay($IncludeContents = "0")
 {
     $IncludeContents = ForceBool($IncludeContents, 0);
     $this->Label = FormatStringForDisplay($this->Label);
     if ($IncludeContents) {
         $this->Contents = htmlspecialchars($this->Contents);
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:8,代码来源:Clipboard.php

示例5: GetPropertiesFromDataSet

 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);
 }
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:9,代码来源:Vanilla.Class.Category.php

示例6: GetVariable

 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], '');
     }
 }
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:10,代码来源:People.Class.Session.php

示例7: GetPropertiesFromDataSet

 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);
     }
 }
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:11,代码来源:Vanilla.Class.Search.php

示例8: GetPropertiesFromDataSet

 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);
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:11,代码来源:Vanilla.Search.class.php

示例9: GetVariable

 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], "");
     }
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:12,代码来源:Vanilla.Session.class.php

示例10: GetPropertiesFromDataSet

 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);
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:16,代码来源:Vanilla.Role.class.php

示例11: InsertItemAt

 function InsertItemAt(&$Collection, $Item, $Position, $ForcePosition = '0')
 {
     $ForcePosition = ForceBool($ForcePosition, 0);
     if (array_key_exists($Position, $Collection)) {
         if ($ForcePosition) {
             // Move the item currently in that position ahead (forced ahead)
             $this->InsertItemAt($Collection, $Collection[$Position], $Position + 1, 1);
             // Place this item at the desired position
             $Collection[$Position] = $Item;
         } else {
             $this->InsertItemAt($Collection, $Item, $Position + 1);
         }
     } else {
         $Collection[$Position] = $Item;
     }
 }
开发者ID:laiello,项目名称:lussumo-vanilla,代码行数:16,代码来源:Framework.Class.Control.php

示例12: Authenticate

 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;
 }
开发者ID:jaran,项目名称:opencongress,代码行数:45,代码来源:People.Class.Authenticator.php

示例13: GetCategoryBuilder

 function GetCategoryBuilder($IncludeCount = '0', $ForceRoleBlock = '1')
 {
     $IncludeCount = ForceBool($IncludeCount, 0);
     $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder');
     $s->SetMainTable('Category', 'c');
     if ($IncludeCount) {
         if ($this->Context->Session->User->Permission('PERMISSION_REMOVE_CATEGORIES') && $this->Context->Session->User->Preference('ShowDeletedDiscussions')) {
             $s->AddJoin('Discussion', 'd', 'CategoryID', 'c', 'CategoryID', 'left join');
         } else {
             $s->AddJoin('Discussion', 'd', 'CategoryID', 'c', 'CategoryID', 'left join', " and d." . $this->Context->DatabaseColumns['Discussion']['Active'] . " = 1");
         }
         $s->AddSelect('DiscussionID', 'd', 'DiscussionCount', 'count');
     }
     $s->AddSelect(array('CategoryID', 'Name', 'Description'), 'c', '', '', '', 1);
     $BlockCategoriesByRole = 1;
     if ($this->Context->Session->User->Permission('PERMISSION_ADD_CATEGORIES') || $this->Context->Session->User->Permission('PERMISSION_EDIT_CATEGORIES') || $this->Context->Session->User->Permission('PERMISSION_REMOVE_CATEGORIES')) {
         $BlockCategoriesByRole = 0;
     }
     if ($ForceRoleBlock) {
         $BlockCategoriesByRole = 1;
     }
     if ($this->Context->Session->UserID > 0) {
         $s->AddJoin('CategoryRoleBlock', 'crb', 'CategoryID', 'c', 'CategoryID', 'left join', ' and crb.' . $this->Context->DatabaseColumns['CategoryRoleBlock']['RoleID'] . ' = ' . $this->Context->Session->User->RoleID);
         $s->AddJoin('CategoryBlock', 'b', 'CategoryID', 'c', 'CategoryID', 'left join', ' and b.' . $this->Context->DatabaseColumns['CategoryBlock']['UserID'] . ' = ' . $this->Context->Session->UserID);
         $s->AddSelect('Blocked', 'b', 'Blocked', 'coalesce', '0');
     } else {
         $s->AddJoin('CategoryRoleBlock', 'crb', 'CategoryID', 'c', 'CategoryID', 'left join', ' and crb.' . $this->Context->DatabaseColumns['CategoryRoleBlock']['RoleID'] . ' = 1');
     }
     // Limit to categories that this user is allowed to see.
     if ($BlockCategoriesByRole) {
         $s->AddWhere('crb', 'Blocked', '', 0, '=', 'and', '', 1, 1);
         $s->AddWhere('crb', 'Blocked', '', 0, '=', 'or', '', 0);
         $s->AddWhere('crb', 'Blocked', '', 'null', 'is', 'or', '', 0);
         $s->EndWhereGroup();
     } else {
         // Identify which of these categories is blocked by role
         // (so administrators can easily see what they do and don't have access to)
         $s->AddSelect('Blocked', 'crb', 'RoleBlocked', 'coalesce', '0');
     }
     $this->DelegateParameters['IncludeCount'] = $IncludeCount;
     $this->DelegateParameters['ForceRoleBlock'] = $ForceRoleBlock;
     $this->DelegateParameters['SqlBuilder'] =& $s;
     $this->CallDelegate('PostGetCategoryBuilder');
     return $s;
 }
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:45,代码来源:Vanilla.Class.CategoryManager.php

示例14: CommentLinks_AddLink

 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>';
     }
 }
开发者ID:avital,项目名称:vanilla-thewe,代码行数:43,代码来源:default.php

示例15: GetPropertiesFromDataSet

 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);
 }
开发者ID:jaran,项目名称:opencongress,代码行数:21,代码来源:People.Class.Role.php


注:本文中的ForceBool函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。