/** * Physically saves the mapping to the database * @return */ function Save() { $connection = Database::Connect(); $this->pog_query = "select `objectid` from `objectsiblingmap` where `objectid`='" . $this->objectId . "' AND `siblingid`='" . $this->siblingId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows == 0) { $this->pog_query = "insert into `objectsiblingmap` (`objectid`, `siblingid`) values ('" . $this->objectId . "', '" . $this->siblingId . "')"; } return Database::InsertOrUpdate($this->pog_query, $connection); }
/** * Saves the object to the database * @return integer $parent_Id */ function Save($deep = true) { $connection = Database::Connect(); $this->pog_query = "select `parent_id` from `parent_` where `parent_id`='" . $this->parent_Id . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `parent_` set \n\t\t\t`attribute`='" . $this->Escape($this->attribute) . "' where `parent_id`='" . $this->parent_Id . "'"; } else { $this->pog_query = "insert into `parent_` (`attribute` ) values (\n\t\t\t'" . $this->Escape($this->attribute) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->parent_Id == "") { $this->parent_Id = $insertId; } if ($deep) { foreach ($this->_objectList as $object) { $object->parent_Id = $this->parent_Id; $object->Save($deep); } } return $this->parent_Id; }
/** * Saves the object to the database * @return integer $pluginId */ function Save() { $connection = Database::Connect(); $this->pog_query = "select `pluginid` from `plugin` where `pluginid`='" . $this->pluginId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `plugin` set\n\t\t\t`name`='" . $this->Escape($this->name) . "',\n\t\t\t`author`='" . $this->Escape($this->author) . "',\n\t\t\t`description`='" . $this->Escape($this->description) . "',\n\t\t\t`code`='" . $this->Escape($this->code) . "',\n\t\t\t`version`='" . $this->Escape($this->version) . "',\n\t\t\t`emailaddress`='" . $this->Escape($this->emailAddress) . "',\n\t\t\t`password`='" . $this->Escape($this->password) . "',\n\t\t\t`active`='" . $this->Escape($this->active) . "',\n\t\t\t`mysql`='" . $this->Escape($this->mysql) . "',\n\t\t\t`php`='" . $this->Escape($this->php) . "' where `pluginid`='" . $this->pluginId . "'"; } else { $this->pog_query = "insert into `plugin` (`name`, `author`, `description`, `code`, `version`, `emailaddress`, `password`, `active`, `mysql`, `php` ) values (\n\t\t\t'" . $this->Escape($this->name) . "',\n\t\t\t'" . $this->Escape($this->author) . "',\n\t\t\t'" . $this->Escape($this->description) . "',\n\t\t\t'" . $this->Escape($this->code) . "',\n\t\t\t'" . $this->Escape($this->version) . "',\n\t\t\t'" . $this->Escape($this->emailAddress) . "',\n\t\t\t'" . $this->Escape($this->password) . "',\n\t\t\t'" . $this->Escape($this->active) . "',\n\t\t\t'" . $this->Escape($this->mysql) . "',\n\t\t\t'" . $this->Escape($this->php) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->pluginId == "") { $this->pluginId = $insertId; } return $this->pluginId; }
/** * Saves the object to the database * @return integer $recordId */ function Save($deep = true) { $connection = Database::Connect(); $this->update_date = date('r'); $this->access_date = date('r'); $this->pog_query = "select `recordid` from `record` where `recordid`='" . $this->recordId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `record` set \n\t\t\t`userid`='" . $this->userId . "', \n\t\t\t`reference`='" . $this->Escape($this->reference) . "', \n\t\t\t`data`='" . $this->Escape($this->data) . "', \n\t\t\t`version`='" . $this->Escape($this->version) . "', \n\t\t\t`creation_date`='" . $this->creation_date . "', \n\t\t\t`update_date`='" . $this->update_date . "', \n\t\t\t`access_date`='" . $this->access_date . "' where `recordid`='" . $this->recordId . "'"; } else { $this->pog_query = "insert into `record` (`userid`, `reference`, `data`, `version`, `creation_date`, `update_date`, `access_date` ) values (\n\t\t\t'" . $this->userId . "', \n\t\t\t'" . $this->Escape($this->reference) . "', \n\t\t\t'" . $this->Escape($this->data) . "', \n\t\t\t'" . $this->Escape($this->version) . "', \n\t\t\t'" . $this->creation_date . "', \n\t\t\t'" . $this->update_date . "', \n\t\t\t'" . $this->access_date . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->recordId == "") { $this->recordId = $insertId; } if ($deep) { foreach ($this->_recordversionList as $recordversion) { $recordversion->recordId = $this->recordId; $recordversion->Save($deep); } } return $this->recordId; }
/** * Saves the object to the database * @return integer $onetimepasswordId */ function Save() { $connection = Database::Connect(); $this->pog_query = "select `onetimepasswordid` from `onetimepassword` where `onetimepasswordid`='" . $this->onetimepasswordId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `onetimepassword` set \n\t\t\t`userid`='" . $this->userId . "', \n\t\t\t`onetimepasswordstatusid`='" . $this->onetimepasswordstatusId . "', \n\t\t\t`reference`='" . $this->Escape($this->reference) . "', \n\t\t\t`key`='" . $this->Escape($this->key) . "', \n\t\t\t`key_checksum`='" . $this->Escape($this->key_checksum) . "', \n\t\t\t`data`='" . $this->Escape($this->data) . "', \n\t\t\t`version`='" . $this->Escape($this->version) . "', \n\t\t\t`creation_date`='" . $this->creation_date . "', \n\t\t\t`request_date`='" . $this->request_date . "', \n\t\t\t`usage_date`='" . $this->usage_date . "' where `onetimepasswordid`='" . $this->onetimepasswordId . "'"; } else { $this->pog_query = "insert into `onetimepassword` (`userid`, `onetimepasswordstatusid`, `reference`, `key`, `key_checksum`, `data`, `version`, `creation_date`, `request_date`, `usage_date` ) values (\n\t\t\t'" . $this->userId . "', \n\t\t\t'" . $this->onetimepasswordstatusId . "', \n\t\t\t'" . $this->Escape($this->reference) . "', \n\t\t\t'" . $this->Escape($this->key) . "', \n\t\t\t'" . $this->Escape($this->key_checksum) . "', \n\t\t\t'" . $this->Escape($this->data) . "', \n\t\t\t'" . $this->Escape($this->version) . "', \n\t\t\t'" . $this->creation_date . "', \n\t\t\t'" . $this->request_date . "', \n\t\t\t'" . $this->usage_date . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->onetimepasswordId == "") { $this->onetimepasswordId = $insertId; } return $this->onetimepasswordId; }
/** * Saves the object to the database * @return integer $siblingId */ function Save($deep = true) { $connection = Database::Connect(); $this->pog_query = "select `siblingid` from `sibling` where `siblingid`='" . $this->siblingId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `sibling` set \n\t\t\t`attribute`='" . $this->Escape($this->attribute) . "' where `siblingid`='" . $this->siblingId . "'"; } else { $this->pog_query = "insert into `sibling` (`attribute` ) values (\n\t\t\t'" . $this->Escape($this->attribute) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->siblingId == "") { $this->siblingId = $insertId; } if ($deep) { foreach (array_keys($this->_objectList) as $key) { $object =& $this->_objectList[$key]; $object->Save(); $map = new objectsiblingMap(); $map->AddMapping($this, $object); } } return $this->siblingId; }
/** * Saves the object to the database * @return integer $onetimepasswordstatusId */ function Save($deep = true) { $connection = Database::Connect(); $this->pog_query = "select `onetimepasswordstatusid` from `onetimepasswordstatus` where `onetimepasswordstatusid`='" . $this->onetimepasswordstatusId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `onetimepasswordstatus` set \n\t\t\t`code`='" . $this->Escape($this->code) . "', \n\t\t\t`name`='" . $this->Escape($this->name) . "', \n\t\t\t`description`='" . $this->Escape($this->description) . "' where `onetimepasswordstatusid`='" . $this->onetimepasswordstatusId . "'"; } else { $this->pog_query = "insert into `onetimepasswordstatus` (`code`, `name`, `description` ) values (\n\t\t\t'" . $this->Escape($this->code) . "', \n\t\t\t'" . $this->Escape($this->name) . "', \n\t\t\t'" . $this->Escape($this->description) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->onetimepasswordstatusId == "") { $this->onetimepasswordstatusId = $insertId; } if ($deep) { foreach ($this->_onetimepasswordList as $onetimepassword) { $onetimepassword->onetimepasswordstatusId = $this->onetimepasswordstatusId; $onetimepassword->Save($deep); } } return $this->onetimepasswordstatusId; }
/** * Saves the object to the database * @return integer $userId */ function Save($deep = true) { $connection = Database::Connect(); $this->pog_query = "select `userid` from `user` where `userid`='" . $this->userId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `user` set \n\t\t\t`username`='" . $this->Escape($this->username) . "', \n\t\t\t`srp_s`='" . $this->Escape($this->srp_s) . "', \n\t\t\t`srp_v`='" . $this->Escape($this->srp_v) . "', \n\t\t\t`header`='" . $this->Escape($this->header) . "', \n\t\t\t`statistics`='" . $this->Escape($this->statistics) . "', \n\t\t\t`auth_version`='" . $this->Escape($this->auth_version) . "', \n\t\t\t`version`='" . $this->Escape($this->version) . "', \n\t\t\t`lock`='" . $this->Escape($this->lock) . "'where `userid`='" . $this->userId . "'"; } else { $this->pog_query = "insert into `user` (`username`, `srp_s`, `srp_v`, `header`, `statistics`, `auth_version`, `version`, `lock`) values (\n\t\t\t'" . $this->Escape($this->username) . "', \n\t\t\t'" . $this->Escape($this->srp_s) . "', \n\t\t\t'" . $this->Escape($this->srp_v) . "', \n\t\t\t'" . $this->Escape($this->header) . "', \n\t\t\t'" . $this->Escape($this->statistics) . "', \n\t\t\t'" . $this->Escape($this->auth_version) . "', \n\t\t\t'" . $this->Escape($this->version) . "', \n\t\t\t'" . $this->Escape($this->lock) . "')"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->userId == "") { $this->userId = $insertId; } if ($deep) { foreach ($this->_recordList as $record) { $record->userId = $this->userId; $record->Save($deep); } foreach ($this->_onetimepasswordList as $onetimepassword) { $onetimepassword->userId = $this->userId; $onetimepassword->Save($deep); } } return $this->userId; }
/** * Saves the object to the database * @return integer $mp3Id */ function Save() { $connection = Database::Connect(); $this->pog_query = "select `mp3id` from `mp3` where `mp3id`='" . $this->mp3Id . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `mp3` set \n\t\t\t`path`='" . $this->Escape($this->path) . "', \n\t\t\t`filename`='" . $this->Escape($this->filename) . "', \n\t\t\t`artist`='" . $this->Escape($this->artist) . "', \n\t\t\t`title`='" . $this->Escape($this->title) . "', \n\t\t\t`album`='" . $this->Escape($this->album) . "' where `mp3id`='" . $this->mp3Id . "'"; } else { $this->pog_query = "insert into `mp3` (`path`, `filename`, `artist`, `title`, `album` ) values (\n\t\t\t'" . $this->Escape($this->path) . "', \n\t\t\t'" . $this->Escape($this->filename) . "', \n\t\t\t'" . $this->Escape($this->artist) . "', \n\t\t\t'" . $this->Escape($this->title) . "', \n\t\t\t'" . $this->Escape($this->album) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->mp3Id == "") { $this->mp3Id = $insertId; } return $this->mp3Id; }
/** * Saves the object to the database * @return integer $recordversionId */ function Save() { $connection = Database::Connect(); date_default_timezone_set('America/New_York'); $this->update_date = date('Y-m-d H:i:s'); $this->access_date = date('Y-m-d H:i:s'); $this->pog_query = "select `recordversionid` from `recordversion` where `recordversionid`='" . $this->recordversionId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `recordversion` set \n\t\t\t`recordid`='" . $this->recordId . "', \n\t\t\t`reference`='" . $this->Escape($this->reference) . "', \n\t\t\t`header`='" . $this->Escape($this->header) . "', \n\t\t\t`data`='" . $this->Escape($this->data) . "', \n\t\t\t`version`='" . $this->Escape($this->version) . "', \n\t\t\t`previous_version_key`='" . $this->Escape($this->previous_version_key) . "', \n\t\t\t`previous_version_id`='" . $this->Escape($this->previous_version_id) . "', \n\t\t\t`creation_date`='" . $this->creation_date . "', \n\t\t\t`update_date`='" . $this->update_date . "', \n\t\t\t`access_date`='" . $this->access_date . "' where `recordversionid`='" . $this->recordversionId . "'"; } else { $this->pog_query = "insert into `recordversion` (`recordid`, `reference`, `header`, `data`, `version`, `previous_version_key`, `previous_version_id`, `creation_date`, `update_date`, `access_date` ) values (\n\t\t\t'" . $this->recordId . "', \n\t\t\t'" . $this->Escape($this->reference) . "', \n\t\t\t'" . $this->Escape($this->header) . "', \n\t\t\t'" . $this->Escape($this->data) . "', \n\t\t\t'" . $this->Escape($this->version) . "', \n\t\t\t'" . $this->Escape($this->previous_version_key) . "', \n\t\t\t'" . $this->Escape($this->previous_version_id) . "', \n\t\t\t'" . $this->creation_date . "', \n\t\t\t'" . $this->update_date . "', \n\t\t\t'" . $this->access_date . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->recordversionId == "") { $this->recordversionId = $insertId; } return $this->recordversionId; }
/** * Saves the object to the database * @return integer $childId */ function Save() { $connection = Database::Connect(); $this->pog_query = "select `childid` from `child` where `childid`='" . $this->childId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `child` set \n\t\t\t`objectid`='" . $this->objectId . "', \n\t\t\t`attribute`='" . $this->Escape($this->attribute) . "' where `childid`='" . $this->childId . "'"; } else { $this->pog_query = "insert into `child` (`objectid`, `attribute` ) values (\n\t\t\t'" . $this->objectId . "', \n\t\t\t'" . $this->Escape($this->attribute) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->childId == "") { $this->childId = $insertId; } return $this->childId; }
/** * Saves the object to the database * @return integer $poiId */ function Save() { $connection = Database::Connect(); $this->pog_query = "select `poiid` from `poi` where `poiid`='" . $this->poiId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `poi` set \n\t\t\t`title`='" . $this->Escape($this->title) . "', \n\t\t\t`description`='" . $this->Escape($this->description) . "', \n\t\t\t`lat`='" . $this->Escape($this->lat) . "', \n\t\t\t`lon`='" . $this->Escape($this->lon) . "', \n\t\t\t`altitude`='" . $this->Escape($this->altitude) . "', \n\t\t\t`url`='" . $this->Escape($this->url) . "', \n\t\t\t`quadrant_x`='" . $this->Escape($this->quadrant_x) . "', \n\t\t\t`quadrant_y`='" . $this->Escape($this->quadrant_y) . "' where `poiid`='" . $this->poiId . "'"; } else { $this->pog_query = "insert into `poi` (`title`, `description`, `lat`, `lon`, `altitude`, `url`, `quadrant_x`, `quadrant_y` ) values (\n\t\t\t'" . $this->Escape($this->title) . "', \n\t\t\t'" . $this->Escape($this->description) . "', \n\t\t\t'" . $this->Escape($this->lat) . "', \n\t\t\t'" . $this->Escape($this->lon) . "', \n\t\t\t'" . $this->Escape($this->altitude) . "', \n\t\t\t'" . $this->Escape($this->url) . "', \n\t\t\t'" . $this->Escape($this->quadrant_x) . "', \n\t\t\t'" . $this->Escape($this->quadrant_y) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->poiId == "") { $this->poiId = $insertId; } return $this->poiId; }
/** * Saves the object to the database * @return integer $objectId */ function Save($deep = true) { $connection = Database::Connect(); $this->pog_query = "select `objectid` from `object` where `objectid`='" . $this->objectId . "' LIMIT 1"; $rows = Database::Query($this->pog_query, $connection); if ($rows > 0) { $this->pog_query = "update `object` set \n\t\t\t`attribute`='" . $this->Escape($this->attribute) . "', \n\t\t\t`parent_id`='" . $this->parent_Id . "', \n\t\t\t`attribute2`='" . $this->Escape($this->attribute2) . "' where `objectid`='" . $this->objectId . "'"; } else { $this->pog_query = "insert into `object` (`attribute`, `parent_id`, `attribute2` ) values (\n\t\t\t'" . $this->Escape($this->attribute) . "', \n\t\t\t'" . $this->parent_Id . "', \n\t\t\t'" . $this->Escape($this->attribute2) . "' )"; } $insertId = Database::InsertOrUpdate($this->pog_query, $connection); if ($this->objectId == "") { $this->objectId = $insertId; } if ($deep) { foreach ($this->_childList as $child) { $child->objectId = $this->objectId; $child->Save($deep); } foreach ($this->_siblingList as $sibling) { $sibling->Save(); $map = new objectsiblingMap(); $map->AddMapping($this, $sibling); } } return $this->objectId; }