/** * @param Company_Type $company_type * will redirect the user to the company type place */ function encoder_redirect_success(Ownership $ownership) { $Name = $ownership->getName(); $Name_Amharic = $ownership->getNameAmharic(); $dir = "VIEW/html/Encoder/Add_Ownership/Add_Ownership.php?success=1&Name={$Name}&Name_Amharic={$Name_Amharic}"; $url = BASE_URL . $dir; header("Location:{$url}"); //redirect the encoder to the regions add place exit; }
public static function kill(\PDO $pdo_db, int $ship_id, array $langvars, Reg $tkireg, bool $remove_planets = false) { $sql = "UPDATE ::prefix::ships SET ship_destroyed='Y', on_planet='N', sector=0, cleared_defenses=' ' WHERE ship_id=:ship_id"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':ship_id', $ship_id); $stmt->execute(); $sql = "DELETE FROM ::prefix::bounty WHERE placed_by = :placed_by"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':placed_by', $ship_id); $stmt->execute(); if ($remove_planets === true && $ship_id > 0) { $sql = "DELETE FROM ::prefix::planets WHERE owner=:owner"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':owner', $ship_id); $stmt->execute(); } else { $sql = "UPDATE ::prefix::planets SET owner=0, team=0, fighters=0, base='N' WHERE owner=:owner"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':owner', $ship_id); $stmt->execute(); } $sql = "SELECT DISTINCT sector_id FROM ::prefix::planets WHERE owner=:owner AND base='Y'"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':owner', $ship_id); $stmt->execute(); $sectors_owned = $stmt->fetchAll(\PDO::FETCH_ASSOC); if ($sectors_owned !== null) { foreach ($sectors_owned as $tmp_sector) { Ownership::calc($pdo_db, $tmp_sector, $tkireg->min_bases_to_own, $langvars); } } $sql = "DELETE FROM ::prefix::sector_defense WHERE ship_id=:ship_id"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':owner', $ship_id); $stmt->execute(); $sql = "SELECT zone_id FROM ::prefix::zones WHERE team_zone='N' AND owner=:owner"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':owner', $ship_id); $stmt->execute(); $zone = $stmt->fetch(\PDO::FETCH_ASSOC); $sql = "UPDATE ::prefix::universe SET zone_id=1 WHERE zone_id=:zone_id"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':zone_id', $zone['zone_id']); $stmt->execute(); $sql = "SELECT character_name FROM ::prefix::ships WHERE ship_id=:ship_id"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':owner', $ship_id); $stmt->execute(); $name = $stmt->fetch(\PDO::FETCH_ASSOC); $headline = $name['character_name'] . ' ' . $langvars['l_killheadline']; $newstext = str_replace('[name]', $name['character_name'], $langvars['l_news_killed']); $sql = "INSERT INTO ::prefix::news (headline, newstext, user_id, date, news_type) VALUES (:headline,:newstext,:user_id,NOW(), 'killed')"; $stmt = $pdo_db->prepare($sql); $stmt->bindParam(':headline', $headline); $stmt->bindParam(':newstext', $newstext); $stmt->bindParam(':user_id', $ship_id); $stmt->execute(); }
<?php include_once '/var/www/html/Lux/Core/Helper.php'; $REQUEST = new Request(); $RULES = new Rules(0, "ownership"); $OUTPUT = new Output(); $OWNERSHIP = new Ownership($RULES); $document = $OWNERSHIP->mine($REQUEST); $OUTPUT->success(1, $document); ?>
<?php /* Reformatted 12.11.2015 */ // Helper function's and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("SocialNetwork"); $OUTPUT = new Output(); // Get Request Variables $REQUEST = new Request(); // No privleges needed, Ownership rules apply $RULES = new Rules(0, "assets"); $OWNERSHIP = new Ownership($RULES); // Allows user to switch away from a standard collection $collectionName = Helper::getCollectionName($REQUEST, "Groups"); $collection = $DB->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST); $query = $OWNERSHIP->adjust($collection, $query); // Values which are accepted by the Adjustment script $permitted = array("group_name", "group_picture", "bio", "images[]"); // Format Update and Options $update = Helper::updatePermitted($REQUEST, $permitted); $options = Helper::formatOptions($REQUEST); // Used for Analytics //$LOG = new Logging("Asset.adjust"); //$LOG->log($RULES->getId(), 31, $query, 100, "User Modified Asset"); // Find and Modify documents in collection $documents = $collection->findAndModify($query, $update, $options); // Output $OUTPUT->success(0, $documents, null);
<?php /* Reformatted 12.11.2015 */ // Helper function's and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $db = new Db("Scoreboard"); $OUTPUT = new Output(); // Get Request Variables $REQUEST = new Request(); // No Priveleges needed $RULES = new Rules(0, "scoreboard"); // Select collection $collectionName = Helper::getCollectionName($REQUEST, "Users"); $collection = $db->selectCollection($collectionName); // Find Ownership Rules $OWNERSHIP = new Ownership($RULES); // Format a query from the request $query = Helper::formatQuery($REQUEST, "user_id", "user_id"); // Used for analytics $LOG = new Logging("Asset.query"); $LOG->log($RULES->getId(), 32, $query, 100, "User Queried Asset"); // Find Documents in Collection $documents = $collection->find($query); // Filter out unOwned Documents $documents = $OWNERSHIP->query($documents); // Output $OUTPUT->success(1, $documents);
public function TransferOwnership(Player $player, Ownership $newowner, $price) { $oldid = $this->GetOwner(); $newid = $newowner->GetOwner(); $oldobj = null; $newobj = null; $oldstats = null; $newstats = null; switch ($this->GetType()) { case OWNERSHIP_ACCOUNT: $oldobj = Players::FindByDBID($oldid); if (!$oldobj) { $oldstats = Accounts::LoadStats($oldid); } if (!$oldobj && !$oldstats) { $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed'); echo "WARNING! Trying to transfer ownership from an old owner identified as OWNERSHIP_ACCOUNT({$oldid}), " . "but unable to load their stats (account deleted?)\n"; return false; } break; case OWNERSHIP_FACTION: $oldobj = Factions::FindByID($oldid); if (!$oldobj) { $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed'); echo "WARNING! Trying to transfer ownership from an old owner identified as OWNERSHIP_FACTION({$oldid}), " . "but unable to find the faction (corrupted database?)\n"; return false; } break; } switch ($newowner->GetType()) { case OWNERSHIP_ACCOUNT: $newobj = Players::FindByDBID($newid); if (!$newobj) { $newstats = Accounts::LoadStats($newid); } if (!$newobj && !$newstats) { $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed'); echo "WARNING! Trying to transfer ownership to a new owner identified as OWNERSHIP_ACCOUNT({$newid}), " . "but unable to load their stats (account deleted?)\n"; return false; } break; case OWNERSHIP_FACTION: $newobj = Factions::FindByID($newid); if (!$newobj) { $player->Send(COLOR_RED, '[ERROR] Internal error, a log of this error has been saved to be fixed'); echo "WARNING! Trying to transfer ownership to a new owner identified as OWNERSHIP_FACTION({$newid}), " . "but unable to find the faction (corrupted database?)\n"; return false; } break; } /* Check if the bank accounts are frozen */ if ($oldobj && $oldobj->BankFreezed()) { $player->Send(COLOR_BANK_FREEZED, '[ERROR] The current owner of this property has his bank account frozen, operation cancelled'); return false; } if ($newobj && $newobj->BankFreezed()) { $facstr = ' '; if ($newobj instanceof Faction) { $facstr = ' faction '; } $player->Send(COLOR_BANK_FREEZED, "[ERROR] Your{$facstr}bank account has been freezed, operation cancelled"); return false; } /* Check if the buyer has enough money */ $facstr = ' '; if ($newobj) { $bank_buyer = $newobj->GetBank(); if ($newobj instanceof Faction) { $facstr = ' faction '; } } else { $bank_buyer = $newstats['bank']; } if ($bank_buyer < $price) { $player->Send(COLOR_NOTENOUGH_MONEYBANK, "[ERROR] Your{$facstr}bank account hasn\\'t enough money to buy this property"); return false; } /* Perform the transaction */ $newname = 'Somebody'; if ($newobj) { $newobj->GiveBank(-$price); $fixed_price = Core::FixIntegerDots($price); if ($newobj instanceof Faction) { $newobj->Send(COLOR_OWNERSHIP_ADQUIRED, "[FACTION BANK] {$player->name} adquired a new property for the faction for {$fixed_price}\$", MEMBER_ALLOWBANK); $newname = $newobj->GetName() . ' faction'; } else { $newobj->Send(COLOR_OWNERSHIP_ADQUIRED, "[BANK] New property adquired for {$fixed_price}\$"); $newname = $newobj->name; } } else { if ($newstats != null) { $newstats['bank'] -= $price; Accounts::SetLoadedStats($newid, $newstats); } } if ($oldobj) { $oldobj->GiveBank($price); $fixed_price = Core::FixIntegerDots($price); if ($oldobj instanceof Faction) { $oldobj->Send(COLOR_OWNERSHIP_SOLD, "[FACTION BANK] {$newname} bought one of the faction properties for sale for {$fixed_price}\$", MEMBER_ALLOWBANK); } else { $oldobj->Send(COLOR_OWNERSHIP_SOLD, "[BANK] {$newname} bought one of your properties for sale for {$fixed_price}\$"); } } else { if ($oldstats != null) { $oldstats['bank'] += $price; Accounts::SetLoadedStats($oldid, $oldstats); } } return true; }
/** ** UpdateOwnership ** Updates the ownership of one of the rooms ** ** Parameters: ** - room: The room to update ** - owner: The new owner **/ public function UpdateOwnership(Room $room, Ownership $owner) { $oldowner = $room->GetOwnership(); switch ($oldowner->GetType()) { case OWNERSHIP_ACCOUNT: unset($this->prooms[$oldowner->GetOwner()]); break; case OWNERSHIP_FACTION: unset($this->frooms[$oldowner->GetOwner()]); break; } switch ($owner->GetType()) { case OWNERSHIP_ACCOUNT: $this->prooms[$owner->GetOwner()] = $room; break; case OWNERSHIP_FACTION: $this->frooms[$owner->GetOwner()] = $room; break; } $room->UpdateOwnership($owner); if ($owner->GetType() == OWNERSHIP_NULL) { $room->SetPrice($this->default_price); $room->SetAvailable(true); $this->UpdateCheapest(); } }
<?php include_once '/var/www/html/Lux/Core/Helper.php'; $REQUEST = new Request(); $RULES = new Rules(0, "ownership"); $OWNERSHIP = new Ownership($RULES); $OUTPUT = new Output(); $document = $OWNERSHIP->find($REQUEST); $OUTPUT->success(1, $document); ?>
<?php /* Reformatted 12.11.2015 */ // Helper function's and includes include_once '/var/www/html/Lux/Core/Helper.php'; // Create Database Connection $DB = new Db("Assets"); $OUTPUT = new Output(); // Get Request Variables $REQUEST = new Request(); // No privleges needed, Ownership rules apply $RULES = new Rules(0, "assets"); $OWNERSHIP = new Ownership($RULES); // Allows user to switch away from a standard collection $collectionName = Helper::getCollectionName($REQUEST, "Standard", true); $collection = $DB->selectCollection($collectionName); // Format Query $query = Helper::formatQuery($REQUEST); $query = $OWNERSHIP->adjust($collection, $query); // Values which are accepted by the Adjustment script $permitted = array(); // All values accepted // Format Update and Options $update = Helper::updatePermitted($REQUEST, $permitted); $options = Helper::formatOptions($REQUEST); // Used for Analytics $LOG = new Logging("Asset.adjust"); $LOG->log($RULES->getId(), 31, $query, 100, "User Modified Asset"); // Find and Modify documents in collection $documents = $collection->findAndModify($query, $update, $options); $documents = $OWNERSHIP->check($documents);
function insert_into_table() { $this->tbl->domain = $this->get_domain($this->tbl->url); $this->tbl->status = "live"; $this->tbl->type = $this->type; $this->tbl->save(); $this->tbl->code = base62::encode($this->tbl->id); $this->tbl->save(); $own = new Ownership(); $own->url_id = $this->tbl->id; $own->user_id = 1; //TODO: basepage user_id'den gelecek... $own->created_by = $this->get_ip(); $visitor->created_on = date('Y-m-d H:i:s'); $own->save(); }
} $ownership_code = ''; $ownership_type = ''; $exemption = ''; $bcode = ''; $Submit = ""; $com = ""; ?> <body onload='javascript:alert ("Record Successfully Updated");'></body> <?php } } } } elseif ($com == 'delete') { $where = "business_category_code='{$bcode}'"; $nDelOwnType = new Ownership(); $nDelOwnType->DeleteQuery('ebpls_business_category', $where); $r = mysql_query("delete from fee_exempt where business_category_code='{$bcode}'") or die("d"); $bcode = ''; $com = ""; } $bname1 = mysql_query("select * from ebpls_business_category where business_category_code='{$bcode}'") or die("**"); if ($com == 'edit') { $get_info = mysql_fetch_row($bname1); } $bc = mysql_fetch_row($bname1); $bn = $bc[1]; include 'html/ownership_type.html'; if ($bcode == '') { $ownership_code = 0; } else {
/** * * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Ownership::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php include_once '/var/www/html/Lux/Core/Helper.php'; $REQUEST = new Request(); $RULES = new Rules(0, "ownership"); $OWNERSHIP = new Ownership($RULES); $OWNERSHIP->grant($REQUEST);
function Ownership_Exist(Ownership $ownership) { $Name = $ownership->getName(); $query = "SELECT * FROM Ownership WHERE Name='{$Name}'"; $result = mysqli_query($this->getDbc(), $query); if (mysqli_num_rows($result) >= 1) { return TRUE; } else { if (mysqli_num_rows($result) == 0) { return FALSE; } } }
function Edit_Ownership(Ownership $Ownership, $Ownership_ID) { $Name = $Ownership->getName(); $Name_Amharic = $Ownership->getNameAmharic(); $query = "UPDATE Ownership set Name='{$Name}',Name_Amharic='{$Name_Amharic}' where ID='{$Ownership_ID}'"; $result = mysqli_query($this->getDbc(), $query); //if the company is deleted return true if ($result) { return TRUE; } else { return FALSE; } }