コード例 #1
0
ファイル: Servers.php プロジェクト: Zipcore/GMDonate
 public static function AddServer($DisplayName, $IP, $Port)
 {
     // Make it in the database
     Database::Insert(self::$TableName, array("Name" => $DisplayName, "IP" => $IP, "Port" => $Port));
     // Flush the cache
     DB_Accessor::FlushMemCache("Servers");
 }
コード例 #2
0
ファイル: ItemAction.php プロジェクト: Zipcore/GMDonate
 public static function AddItemAction($ItemID, $ActionType, $ActionData, $Servers)
 {
     // Make it in the database
     Database::Insert(self::$TableName, array("ItemID" => $ItemID, "ActionType" => $ActionType, "ActionData" => $ActionData, "Servers" => $Servers));
     // Flush the cache
     DB_Accessor::FlushMemCache("ItemAction");
 }
コード例 #3
0
ファイル: ItemCategory.php プロジェクト: Zipcore/GMDonate
 public static function MakeCategory($CatName)
 {
     if (empty($CatName)) {
         return;
     }
     // Make it in the database
     Database::Insert(self::$TableName, array("Name" => $CatName));
     // Flush the cache
     DB_Accessor::FlushMemCache("ItemCategory");
 }
コード例 #4
0
ファイル: Item.php プロジェクト: Zipcore/GMDonate
 public function Delete()
 {
     $ItemActions = ItemAction::GetAllByField("ItemAction", "ItemID", $this->GetValue("ID"));
     // Delete all actions related to this item
     foreach ($ItemActions as $ItemAction) {
         // Delete all of the user actions using this Item Action
         $UserActions = UserAction::GetAllByField("UserAction", "ItemAction", $ItemAction->GetValue("ID"));
         foreach ($UserActions as $UserAction) {
             $UserAction->Delete();
         }
         // Delete the actual item action
         $ItemAction->Delete();
     }
     // Delete the saved image (we warned them)
     $this->DeleteImage();
     // Literally delete the item itself
     Database::Query("DELETE FROM `%s` WHERE `ID` = %s;", static::$TableName, $this->Data["ID"]);
     DB_Accessor::FlushMemCache(get_class($this));
 }
コード例 #5
0
ファイル: DB_Accessor.php プロジェクト: Zipcore/GMDonate
 public static function GetByField($ClassName, $FieldName, $Value)
 {
     $ClassValues = get_class_vars($ClassName);
     if (isset(DB_Accessor::$DataCache[$ClassName])) {
         foreach (DB_Accessor::$DataCache[$ClassName] as $Obj) {
             if ($Obj->Data[$FieldName] == $Value) {
                 return $Obj;
             }
         }
     }
     $Array = DB_Accessor::GetAllByField($ClassName, $FieldName, $Value);
     if (1 > count($Array)) {
         return new $ClassName();
     }
     return array_pop($Array);
 }