本文整理汇总了PHP中UUID类的典型用法代码示例。如果您正苦于以下问题:PHP UUID类的具体用法?PHP UUID怎么用?PHP UUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UUID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute($db, $params)
{
if (isset($params["SceneID"]) && UUID::TryParse($params["SceneID"], $this->SceneID)) {
$sql = "DELETE FROM Scenes WHERE ID='" . $this->SceneID . "'";
} else {
if (isset($params["Name"])) {
$sql = "DELETE FROM Scenes WHERE Name='" . $params["Name"] . "'";
} else {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
}
$sth = $db->prepare($sql);
if ($sth->execute()) {
header("Content-Type: application/json", true);
echo '{ "Success": true }';
exit;
} else {
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:26,代码来源:Class.RemoveScene.php
示例2: Execute
public function Execute($db, $params)
{
// TODO: Sanity check the expiration date
// TODO: Also run a regex on Resource to make sure it's a valid (relative or absolute) URL
if (!isset($params["OwnerID"], $params["Resource"], $params["Expiration"]) || !UUID::TryParse($params["OwnerID"], $this->OwnerID)) {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
if (!isset($params["CapabilityID"]) || !UUID::TryParse($params["CapabilityID"], $this->CapabilityID)) {
$this->CapabilityID = UUID::Random();
}
$resource = $params["Resource"];
$expiration = $params["Expiration"];
$sql = "INSERT INTO Capabilities (ID, OwnerID, Resource, ExpirationDate) VALUES (:ID, :OwnerID, :Resource, :ExpirationDate)\n ON DUPLICATE KEY UPDATE OwnerID=VALUES(OwnerID), Resource=VALUES(Resource), ExpirationDate=VALUES(ExpirationDate)";
$sth = $db->prepare($sql);
if ($sth->execute(array(':ID' => $this->CapabilityID, ':OwnerID' => $this->OwnerID, ':Resource' => $resource, ':ExpirationDate' => $expiration))) {
header("Content-Type: application/json", true);
echo sprintf('{"Success": true, "CapabilityID": "%s"}', $this->CapabilityID);
exit;
} else {
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
}
开发者ID:ronfesta,项目名称:simiangrid,代码行数:28,代码来源:Class.AddCapability.php
示例3: save_products
function save_products($link, $prenote_uuid, $product, $id_employee, $lastUpdate)
{
include 'config.php';
include_once '../class.uuid.php';
$handle = $link->prepare('INSERT INTO ' . $table_prenoteDetails . ' (ID, UUID, LastUpdate, CreationUserID, LastUpdateUserID, OperationOnHoldUUID, ItemUUID, ItemCombinationID, ItemCombinationUUID, ItemSerialID, ItemBarcode, UnitID, Quantity, UnitPrice, SalesPersonUserID, ParentID) VALUES (0, :UUID, :last_update, :create_id, :update_id, :prenote_uuid, :ItemUUID, :combinationID, :combinationUUID, :serialID, :barcode, :unitID, :Quantity, :Price, :id_employee, 0)');
$handle->bindParam(':UUID', $prenoteDetails_uuid);
$handle->bindParam(':last_update', $lastUpdate);
$handle->bindParam(':id_employee', $id_employee, PDO::PARAM_INT);
$handle->bindParam(':create_id', $id_employee, PDO::PARAM_INT);
$handle->bindParam(':update_id', $id_employee, PDO::PARAM_INT);
$handle->bindParam(':prenote_uuid', $prenote_uuid);
$handle->bindParam(':ItemUUID', $UUID);
$handle->bindParam(':unitID', $UnitID, PDO::PARAM_INT);
$handle->bindParam(':Quantity', $Quantity);
$handle->bindParam(':Price', $Price);
$handle->bindParam(':serialID', $serialID);
$handle->bindParam(':barcode', $barcode);
$handle->bindParam(':combinationID', $combinationID);
$handle->bindParam(':combinationUUID', $combinationUUID);
$lenght = count($product);
for ($i = 0; $i < $lenght; $i++) {
$prenoteDetails_uuid = UUID::generate(UUID::UUID_RANDOM, UUID::FMT_STRING);
$UUID = $product[$i]->UUID;
$Quantity = $product[$i]->Quantity;
$Price = $product[$i]->Price;
$UnitID = $product[$i]->UnitID;
$serialID = $product[$i]->SerialID;
$barcode = $product[$i]->barcode;
$combinationID = $product[$i]->optionID;
$combinationUUID = $product[$i]->optionUUID;
$handle->execute();
}
}
开发者ID:anuarml,项目名称:Prenotas-Assis,代码行数:33,代码来源:save_products.php
示例4: Execute
public function Execute($db, $params)
{
if (!isset($params["OwnerID"], $params["Resource"], $params["Expiration"]) || !UUID::TryParse($params["OwnerID"], $this->OwnerID)) {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
if (!isset($params["CapabilityID"]) || !UUID::TryParse($params["CapabilityID"], $this->CapabilityID)) {
$this->CapabilityID = UUID::Random();
}
$resource = $params["Resource"];
$expiration = intval($params["Expiration"]);
// Sanity check the expiration date
if ($expiration <= time()) {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid expiration date ' . $expiration . '" }';
exit;
}
log_message('debug', "Creating capability " . $this->CapabilityID . " owned by " . $this->OwnerID . " mapping to {$resource} until {$expiration}");
$sql = "INSERT INTO Capabilities (ID, OwnerID, Resource, ExpirationDate) VALUES (:ID, :OwnerID, :Resource, FROM_UNIXTIME(:ExpirationDate))\n ON DUPLICATE KEY UPDATE ID=VALUES(ID), Resource=VALUES(Resource), ExpirationDate=VALUES(ExpirationDate)";
$sth = $db->prepare($sql);
if ($sth->execute(array(':ID' => $this->CapabilityID, ':OwnerID' => $this->OwnerID, ':Resource' => $resource, ':ExpirationDate' => $expiration))) {
header("Content-Type: application/json", true);
echo sprintf('{"Success": true, "CapabilityID": "%s"}', $this->CapabilityID);
exit;
} else {
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:33,代码来源:Class.AddCapability.php
示例5: Execute
public function Execute($db, $params)
{
if (!isset($params["CapabilityID"]) || !UUID::TryParse($params["CapabilityID"], $this->CapabilityID)) {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
$sql = "SELECT OwnerID,Resource,UNIX_TIMESTAMP(ExpirationDate) AS ExpirationDate FROM Capabilities WHERE ID=:ID AND UNIX_TIMESTAMP(ExpirationDate) > UNIX_TIMESTAMP() LIMIT 1";
$sth = $db->prepare($sql);
if ($sth->execute(array(':ID' => $this->CapabilityID))) {
if ($sth->rowCount() > 0) {
$obj = $sth->fetchObject();
header("Content-Type: application/json", true);
echo sprintf('{"Success": true, "CapabilityID": "%s", "OwnerID": "%s", "Resource": "%s", "Expiration": %u}', $this->CapabilityID, $obj->OwnerID, $obj->Resource, $obj->ExpirationDate);
exit;
} else {
header("Content-Type: application/json", true);
echo '{ "Message": "Capability not found" }';
exit;
}
}
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:27,代码来源:Class.GetCapability.php
示例6: locateObject
public function locateObject($slug, $parent = null, $kind = null, $universe = null)
{
$query = array();
$query['limit'] = 1;
if ($parent !== false) {
$query['parent'] = $parent;
}
if ($kind !== null) {
$query['kind'] = $kind;
}
if ($universe !== null) {
$query['universe'] = $universe;
}
if (null !== ($uuid = UUID::isUUID($slug))) {
$query['uuid'] = $uuid;
} else {
if (strpos($slug, ':') !== false) {
$query['iri'] = $slug;
} else {
$query['tag'] = $slug;
}
}
$rs = $this->query($query);
foreach ($rs as $obj) {
return $obj;
}
return null;
}
开发者ID:nexgenta,项目名称:weaver,代码行数:28,代码来源:model.php
示例7: post_createPet
public function post_createPet()
{
$this->data = Input::all();
if ($this->data["clase_mascota"] == "Mini pig") {
$this->data["raza"] = "Mini pig";
}
$certificados = "";
$vacunas = "";
if (is_array($this->data["certificado"])) {
foreach ($this->data["certificado"] as $key => $certificado) {
$certificados .= $certificado . ", ";
}
$this->data["certificado"] = $certificados;
} else {
$this->data["certificado"] = "No tiene";
}
if (is_array($this->data["vacunas_cuales"])) {
foreach ($this->data["vacunas_cuales"] as $key => $vacuna) {
$vacunas .= $vacuna . ", ";
}
$this->data["vacunas_cuales"] = $vacunas;
} else {
$this->data["vacunas_cuales"] = "No tiene";
}
//print_r($this->data);die;
//$this->data["raza"] = empty($this->data["perro"]) ? $this->data["gato"] : $this->data["perro"];
//list($mes, $dia, $anio) = preg_split('/\//', $this->data["fecha_nacimiento"]);
//$this->data["fecha_nacimiento"] = strtotime($dia."-".$mes."-".$anio);
$this->data["uuid"] = UUID::getUUID();
if ($this->connection->mSave($this->data)) {
return json_encode(array("message" => "Mascota creada", "type" => 201, "error" => 0, "uuid" => $this->data["uuid"]));
} else {
return json_encode(array("message" => "Error al crear mascota", "type" => 500, "error" => 1));
}
}
开发者ID:xeneize-js,项目名称:laravel-petmatch,代码行数:35,代码来源:MascotaController.php
示例8: Execute
public function Execute($db, $params)
{
if (isset($params["Identifier"], $params["Credential"], $params["Type"], $params["UserID"]) && UUID::TryParse($params["UserID"], $this->UserID)) {
if (isset($params["Enabled"]) && $params["Enabled"] == False) {
$parameters = array(':Identifier' => $params["Identifier"], ':Credential' => $params["Credential"], ':Type' => $params["Type"], ':UserID' => $this->UserID);
$sql = "INSERT INTO Identities (Identifier, Credential, Type, UserID, Enabled)\n VALUES (:Identifier, :Credential, :Type, :UserID, False)\n ON DUPLICATE KEY UPDATE Credential=VALUES(Credential), Type=VALUES(Type), UserID=VALUES(UserID), Enabled=VALUES(Enabled)";
} else {
$parameters = array(':Identifier' => $params["Identifier"], ':Credential' => $params["Credential"], ':Type' => $params["Type"], ':UserID' => $this->UserID);
$sql = "INSERT INTO Identities (Identifier, Credential, Type, UserID)\n VALUES (:Identifier, :Credential, :Type, :UserID)\n ON DUPLICATE KEY UPDATE Credential=VALUES(Credential), Type=VALUES(Type), UserID=VALUES(UserID), Enabled=1";
}
$sth = $db->prepare($sql);
if ($sth->execute($parameters)) {
header("Content-Type: application/json", true);
echo '{ "Success": true }';
exit;
} else {
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
} else {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:28,代码来源:Class.AddIdentity.php
示例9: tweet_post
function tweet_post()
{
$args = func_get_args();
$cate = $args[2];
$content = format_str($_POST['text'], false);
if (!$cate or !$content) {
die("Invalid argument!");
}
include_once 'sinaoauth.inc.php';
$c = new WeiboClient(SINA_AKEY, SINA_SKEY, $GLOBALS['user']['sinakey']['oauth_token'], $GLOBALS['user']['sinakey']['oauth_token_secret']);
if ($_FILES['upload']['tmp_name']) {
$msg = $c->upload($content, $_FILES['upload']['tmp_name']);
} else {
$msg = $c->update($content);
}
if ($msg === false || $msg === null) {
echo "Error occured";
return false;
}
if (isset($msg['error_code']) && isset($msg['error'])) {
echo 'Error_code: ' . $msg['error_code'] . '; Error: ' . $msg['error'];
return false;
}
include_once "uuid.inc.php";
$v4uuid = str_replace("-", "", UUID::v4());
connect_db();
$add = "INSERT INTO pending_tweets (\r\n site_id, tweet_id, user_site_id, content, post_datetime,\r\n type, tweet_site_id,\r\n post_screenname, profile_image_url, source)\r\n VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "')";
if ($msg['thumbnail_pic']) {
$add = "INSERT INTO pending_tweets (\r\n site_id, tweet_id, user_site_id, content, post_datetime,\r\n type, tweet_site_id,\r\n post_screenname, profile_image_url, source, thumbnail)\r\n VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "', '" . $msg['thumbnail_pic'] . "')";
}
$added = mysql_query($add) or die("Could not add entry!");
echo "0";
}
开发者ID:soross,项目名称:0f523140-f3b3-4653-89b0-eb08c39940ad,代码行数:33,代码来源:tweet.inc.php
示例10: fromStorageRow
public static function fromStorageRow(array $row, $obj = null)
{
/** @var $obj AbstractSummary */
$obj = parent::fromStorageRow($row, $obj);
$obj->summaryTargetId = UUID::create($row['rev_type_id']);
return $obj;
}
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:7,代码来源:AbstractSummary.php
示例11: assignCredentials
/**
* Update the sign-in credentials for the specific user.
*
* @param UserRecord $user The user to update the credentials for
* @return Boolean True on success
*/
public function assignCredentials(UserRecord $user)
{
$db = new DatabaseConnection();
// Generate a new salt and hash the password
$salt = $this->generateSalt();
// What hashing algorithm to use
$ha = config::get('lepton.user.hashalgorithm', 'md5');
$ps = $user->password . $salt;
$hp = hash($ha, $ps);
if ($user->userid == null) {
$uuid = UUID::v4();
try {
$id = $db->insertRow("REPLACE INTO " . LEPTON_DB_PREFIX . "users (username,salt,password,email,flags,registered,uuid) VALUES (%s,%s,%s,%s,%s,NOW(),%s)", $user->username, $salt, $hp, $user->email, $user->flags, $uuid);
$user->userid = $id;
} catch (Exception $e) {
throw $e;
// TODO: Handle exception
}
} else {
try {
$db->updateRow("UPDATE " . LEPTON_DB_PREFIX . "users SET username=%s,salt=%s,password=%s,email=%s,flags=%s WHERE id=%d", $user->username, $salt, $hp, $user->email, $user->flags, $user->userid);
} catch (Exception $e) {
throw $e;
// TODO: Handle exception
}
}
return true;
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:34,代码来源:defaultauthbackend.php
示例12: EditEntity
public function EditEntity($bo)
{
$db = new Database();
$newID = UUID::newID();
$ID = str_replace("sys", "", $bo["EntityName"]) . "id";
if ($bo[$ID] != null) {
$values = SqlHelper::GetUpdates(explode(",", $bo["EntityFields"]), $bo);
$sql = 'UPDATE ' . $bo["EntityName"] . ' SET ' . $values . ' WHERE ' . $ID . ' = "' . $bo[$ID] . '"';
} else {
//
$fields = str_replace($ID . ",", "", $bo["EntityFields"]);
$values = SqlHelper::GetValues(explode(",", $fields), $bo);
$sql = 'INSERT INTO ' . $bo["EntityName"] . '(' . $ID . ',' . $fields . ')' . ' VALUES("' . $newID . '",' . $values . ')';
//table
if ($bo["EntityName"] == 'sysentity') {
$table = ';CREATE TABLE IF NOT EXISTS ' . $bo["Name"] . '(' . $bo["Name"] . 'ID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (' . $bo["Name"] . 'ID))ENGINE = InnoDB';
$sql .= $table;
}
if ($bo["EntityName"] == 'sysproperty') {
$result = $db->RunSQL('SELECT Name FROM SysEntity WHERE EntityID = ' . $bo["EntityID"]);
$table = ';ALTER TABLE ' . $result[0]['Name'] . ' ADD COLUMN ' . $bo["Name"] . ' VARCHAR(45) NULL ';
$sql .= $table;
}
}
$result = $db->ExecuteSQL($sql);
return $this->GetEntityView($bo["RefreshEntityViewID"], array("id" => $newID));
}
开发者ID:sasadjolic,项目名称:SailOn,代码行数:27,代码来源:BusinessEntity.php
示例13: Execute
public function Execute($db, $params)
{
$sql = "SELECT Identifier, Type, Credential, UserID, Enabled FROM Identities WHERE";
$id = null;
if (isset($params["UserID"]) && UUID::TryParse($params["UserID"], $id)) {
$sql .= " UserID=:ID";
} else {
if (isset($params["Identifier"])) {
$id = $params["Identifier"];
$sql .= " Identifier=:ID";
} else {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
}
$sth = $db->prepare($sql);
if ($sth->execute(array(':ID' => $id))) {
$found = array();
while ($obj = $sth->fetchObject()) {
$found[] = sprintf('{"Identifier":"%s","Credential":"%s","Type":"%s","UserID":"%s","Enabled":%s}', $obj->Identifier, $obj->Credential, $obj->Type, $obj->UserID, $obj->Enabled ? 'true' : 'false');
}
header("Content-Type: application/json", true);
echo '{"Success":true,"Identities":[' . implode(',', $found) . ']}';
exit;
} else {
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:33,代码来源:Class.GetIdentities.php
示例14: Execute
public function Execute($db, $params)
{
$asset = null;
$assetID = null;
if (isset($params["ID"]) && UUID::TryParse($params["ID"], $assetID)) {
log_message('debug', "xGetAsset asset: {$assetID}");
$assets = new SQLAssets($db);
$asset = $assets->GetAsset($assetID);
}
$response = array();
if (!empty($asset)) {
$response['Success'] = TRUE;
$response['SHA256'] = $asset->SHA256;
$response['Last-Modified'] = gmdate(DATE_RFC850, $asset->CreationDate);
$response['CreatorID'] = $asset->CreatorID;
$response['ContentType'] = $asset->ContentType;
$response['ContentLength'] = $asset->ContentLength;
$response['EncodedData'] = base64_encode($asset->Data);
$response['Temporary'] = $asset->Temporary;
} else {
log_message('info', "Asset {$assetID} not found");
$response['Success'] = FALSE;
$response['Message'] = "Asset {$assetID} not found";
}
header("Content-Type: application/json", true);
echo json_encode($response);
exit;
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:28,代码来源:Class.xGetAsset.php
示例15: Execute
public function Execute($db, $params)
{
if (isset($params["SceneID"], $params["Enabled"]) && UUID::TryParse($params["SceneID"], $this->SceneID)) {
$sql = "UPDATE Scenes SET Enabled=:Enabled WHERE ID='" . $this->SceneID . "'";
} else {
if (isset($params["Name"], $params["Enabled"])) {
$sql = "UPDATE Scenes SET Enabled=:Enabled WHERE Name='" . $params["Name"] . "'";
} else {
log_message('error', sprintf("AddScene: Unable to parse passed parameters or parameter missing: '%s'", print_r($params, true)));
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
}
$sth = $db->prepare($sql);
if ($sth->execute(array(':Enabled' => $params["Enabled"]))) {
if ($sth->rowCount() > 0) {
header("Content-Type: application/json", true);
echo '{ "Success": true }';
exit;
} else {
log_message('error', "Failed updating the database");
header("Content-Type: application/json", true);
echo '{ "Message": "Database update failed" }';
exit;
}
} else {
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:34,代码来源:Class.EnableScene.php
示例16: getObject
protected function getObject()
{
$this->title = $this->object->title;
$this->crumbName = $this->object->title;
$this->addCrumb();
if (null !== ($tag = $this->request->consume())) {
$obj = null;
if (null !== ($uuid = UUID::isUUID($tag))) {
$rs = $this->model->query(array('uuid' => $uuid, 'parent' => $this->object->uuid));
$obj = $rs->next();
} else {
$rs = $this->model->query(array('tag' => $tag, 'parent' => $this->object->uuid));
$obj = $rs->next();
}
if (!$obj) {
return $this->error(Error::OBJECT_NOT_FOUND);
}
switch ($obj->kind) {
case 'episode':
require_once dirname(__FILE__) . '/browse-episode.php';
$inst = new MediaBrowseEpisode();
$inst->object = $obj;
$inst->process($this->request);
return false;
}
print_r($obj);
die('-- unhandled object --');
}
$this->object->merge();
$this->episodes = $this->model->query(array('kind' => 'episode', 'parent' => $this->object->uuid));
if ($this->episodes->EOF) {
$this->episodes = null;
}
return true;
}
开发者ID:nexgenta,项目名称:programmes,代码行数:35,代码来源:browse-series.php
示例17: Execute
public function Execute($db, $params)
{
$this->inventory = new ALT($db);
$folderid = '';
if (!isset($params["FolderID"]) || !UUID::TryParse($params["FolderID"], $folderid)) {
$folderid = UUID::Random();
}
$this->Folder = new InventoryFolder($folderid);
if (!isset($params, $params["Name"], $params["ParentID"], $params["OwnerID"]) || !UUID::TryParse($params["ParentID"], $this->Folder->ParentID) || !UUID::TryParse($params["OwnerID"], $this->Folder->OwnerID)) {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
$this->Folder->Name = trim($params["Name"]);
$this->Folder->ContentType = isset($params["ContentType"]) && trim($params["ContentType"]) != '' ? trim($params["ContentType"]) : 'application/octet-stream';
$this->Folder->ExtraData = isset($params["ExtraData"]) ? trim($params["ExtraData"]) : '';
try {
$result = $this->inventory->InsertNode($this->Folder);
if ($result != FALSE) {
header("Content-Type: application/json", true);
echo sprintf('{ "Success": true, "FolderID": "%s" }', $result);
exit;
} else {
header("Content-Type: application/json", true);
echo '{ "Message": "Folder creation failed" }';
exit;
}
} catch (Exception $ex) {
log_message('error', sprintf("Error occurred during query: %s", $ex));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:34,代码来源:Class.AddInventoryFolder.php
示例18: Execute
public function Execute($db, $params)
{
$sql = "DELETE FROM Sessions";
if (isset($params['SessionID']) && UUID::TryParse($params['SessionID'], $this->ID)) {
$sql .= " WHERE SessionID=:ID";
} else {
if (isset($params['UserID']) && UUID::TryParse($params['UserID'], $this->ID)) {
$sql .= " WHERE UserID=:ID";
} else {
header("Content-Type: application/json", true);
echo '{ "Message": "Invalid parameters" }';
exit;
}
}
$sth = $db->prepare($sql);
if ($sth->execute(array(':ID' => $this->ID))) {
header("Content-Type: application/json", true);
echo '{ "Success": true }';
exit;
} else {
log_message('error', sprintf("Error occurred during query: %d %s", $sth->errorCode(), print_r($sth->errorInfo(), true)));
log_message('debug', sprintf("Query: %s", $sql));
header("Content-Type: application/json", true);
echo '{ "Message": "Database query error" }';
exit;
}
}
开发者ID:QuillLittlefeather,项目名称:mgm-simiangrid,代码行数:27,代码来源:Class.RemoveSession.php
示例19: getInstance
/**
* Returns an instance of type UUID
*
* @return UUID
*/
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new UUID();
}
return self::$instance;
}
开发者ID:Evil-Co-Legacy,项目名称:Evil-Co.de-Services,代码行数:12,代码来源:UUID.class.php
示例20: indexAction
public function indexAction()
{
if ($this->request->isPost()) {
$register = new Users();
$register->id = UUID::v4();
$register->password = $this->security->hash($this->request->getPost('password'));
$register->phonenumber = $this->request->getPost('phonenumber');
$register->email = $this->request->getPost('email');
$register->name = $this->request->getPost('name');
$register->created_date = Carbon::now()->now()->toDateTimeString();
$register->updated_date = Carbon::now()->now()->toDateTimeString();
$user = Users::findFirstByEmail($register->email);
if ($user) {
$this->flash->error("can not register, User " . $register->email . " Alredy Registerd! ");
return true;
}
if ($register->save() === true) {
$this->session->set('user_name', $register->name);
$this->session->set('user_email', $register->email);
$this->session->set('user_id', $register->id);
$this->flash->success("Your " . $register->email . " has been registered Please Login for booking court");
$this->response->redirect('dashboard');
}
}
}
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:25,代码来源:RegisterController.php
注:本文中的UUID类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论