Exemplo n.º 1
0
 public function save()
 {
     if (!isset($this->tripId) || $this->tripId === "") {
         // Need a trip ID before we can save.
         return false;
     }
     if (!isset($this->commentId) || $this->commentId === "") {
         // Need a comment ID before we can save. Any comment ID is fine.
         return false;
     }
     $query = "INSERT INTO blogComment SET " . "tripId=" . db_sql_encode($this->tripId) . ", commentId=" . db_sql_encode($this->commentId) . db_created($this->created) . db_updated($this->updated) . ", userId=" . db_sql_encode($this->userId) . ", referenceId=" . db_sql_encode($this->referenceId) . ", commentText=" . db_sql_encode($this->commentText) . ", deleted=" . db_sql_encode($this->deleted) . ", hash=" . db_sql_encode($this->hash);
     // print "Saving to database: $query<br/>\n";
     if (mysql_query($query)) {
         // Saved successfully, now load fresh, including created and
         // updated values, and update the hash value
         $mustUpdateHash = true;
         if ($this->hash !== $this->latestHash) {
             // Hash value was manually set, so don't re-calculate it
             $mustUpdateHash = false;
         }
         if ($this->load($this->tripId, $this->commentId)) {
             if ($mustUpdateHash) {
                 $value = "|" . $this->created . "|" . $this->latestUpdated . "|" . $this->userId . "|" . $this->referenceId . "|" . $this->commentText . "|" . $this->deleted . "|";
                 $this->hash = md5($value);
                 $this->latestHash = $this->hash;
                 $query = "UPDATE blogComment SET " . "hash=" . db_sql_encode($this->hash) . " WHERE tripId=" . db_sql_encode($this->tripId) . " AND commentId=" . db_sql_encode($this->commentId) . " AND updated=" . db_sql_encode($this->latestUpdated);
                 if (mysql_query($query)) {
                     return true;
                 } else {
                     print $query . "<br/>";
                     print " --> error: " . mysql_error() . "<br/>\n";
                     return false;
                 }
             }
             return true;
         } else {
             return false;
         }
     } else {
         print $query . "<br/>";
         print " --> error: " . mysql_error() . "<br/>\n";
         return false;
     }
 }
Exemplo n.º 2
0
 public function save()
 {
     if (!isset($this->tripId) || $this->tripId === "") {
         // Need a trip ID before we can save.
         return false;
     }
     if (!isset($this->mediaId) || $this->mediaId === "") {
         // Need a journal ID before we can save. Any journal ID is fine.
         return false;
     }
     $query = "INSERT INTO blogMedia SET " . "tripId=" . db_sql_encode($this->tripId) . ", mediaId=" . db_sql_encode($this->mediaId) . db_created($this->created) . db_updated($this->updated) . ", type=" . db_sql_encode($this->type) . ", caption=" . db_sql_encode($this->caption) . ", timestamp=" . db_sql_encode($this->timestamp) . ", location=" . db_sql_encode($this->location) . ", width=" . db_sql_encode($this->width) . ", height=" . db_sql_encode($this->height) . ", deleted=" . db_sql_encode($this->deleted) . ", hash=" . db_sql_encode($this->hash);
     // print "Saving to database: $query<br/>\n";
     if (mysql_query($query)) {
         // Saved successfully, now load fresh, including created and
         // updated values, and update the hash value
         $mustUpdateHash = true;
         if ($this->hash !== $this->latestHash) {
             // Hash value was manually set, so don't re-calculate it
             $mustUpdateHash = false;
         }
         if ($this->load($this->tripId, $this->mediaId)) {
             if ($mustUpdateHash) {
                 $value = "|" . $this->created . "|" . $this->latestUpdated . "|" . $this->type . "|" . $this->caption . "|" . $this->timestamp . "|" . $this->location . "|" . $this->width . "|" . $this->height . "|" . $this->deleted . "|";
                 $this->hash = md5($value);
                 $this->latestHash = $this->hash;
                 $query = "UPDATE blogMedia SET " . "hash=" . db_sql_encode($this->hash) . " WHERE tripId=" . db_sql_encode($this->tripId) . " AND mediaId=" . db_sql_encode($this->mediaId) . " AND updated=" . db_sql_encode($this->latestUpdated);
                 if (mysql_query($query)) {
                     return true;
                 } else {
                     print $query . "<br/>";
                     print " --> error: " . mysql_error() . "<br/>\n";
                     return false;
                 }
             }
             return true;
         } else {
             return false;
         }
     } else {
         print $query . "<br/>";
         print " --> error: " . mysql_error() . "<br/>\n";
         return false;
     }
 }
Exemplo n.º 3
0
 public function save()
 {
     if ($this->authId === "") {
         // Need an auth ID before we can save.
         return false;
     }
     $query = "INSERT INTO blogAuth SET " . "authId=" . db_sql_encode($this->authId) . db_created($this->created) . db_updated($this->updated) . ", userId=" . db_sql_encode($this->userId) . ", expiration=" . db_sql_encode($this->expiration);
     // print "Saving to database: $query<br/>\n";
     if (!mysql_query($query)) {
         print $query . "<br/>";
         print " --> error: " . mysql_error() . "<br/>\n";
         return false;
     }
     // load object to get the new values for created and updated
     Auth::load($this->authId);
     return true;
 }
Exemplo n.º 4
0
 public function save()
 {
     if (!isset($this->tripId) || $this->tripId === '') {
         // Need a trip ID before we can save. Any trip ID is fine.
         return false;
     }
     if (!isset($this->name) || $this->name === '') {
         // Need a name before we can save. Any name is fine.
         return false;
     }
     $query = "INSERT INTO blogTripAttribute SET " . "tripId=" . db_sql_encode($this->tripId) . ", name=" . db_sql_encode($this->name) . db_created($this->created) . db_updated($this->updated) . ", value=" . db_sql_encode($this->value) . ", deleted=" . db_sql_encode($this->deleted) . ", hash=" . db_sql_encode($this->hash);
     if (mysql_query($query)) {
         // Saved successfully, now load fresh, including created and
         // updated values, and update the hash value
         $mustUpdateHash = true;
         if ($this->hash !== $this->latestHash) {
             // Hash value was manually set, so don't re-calculate it
             $mustUpdateHash = false;
         }
         if ($this->load($this->tripId, $this->name)) {
             if ($mustUpdateHash) {
                 $value = "|" . $this->created . "|" . $this->latestUpdated . "|" . $this->value . "|" . $this->deleted . "|";
                 $this->hash = md5($value);
                 $this->latestHash = $this->hash;
                 $query = "UPDATE blogTripAttribute SET " . "hash=" . db_sql_encode($this->hash) . " WHERE tripId=" . db_sql_encode($this->tripId) . " AND name=" . db_sql_encode($this->name) . " AND updated=" . db_sql_encode($this->latestUpdated);
                 if (mysql_query($query)) {
                     return true;
                 } else {
                     print $query . "<br/>";
                     print " --> error: " . mysql_error() . "<br/>\n";
                     return false;
                 }
             }
             return true;
         } else {
             return false;
         }
     } else {
         print $query . "<br/>";
         print " --> error: " . mysql_error() . "<br/>\n";
         return false;
     }
 }
Exemplo n.º 5
0
 public function save()
 {
     if (!isset($this->userId) || $this->userId === "") {
         // Need a user ID before we can save. Any user ID is fine.
         return false;
     }
     $query = "INSERT INTO blogUser SET " . "userId=" . db_sql_encode($this->userId) . ", password="******", name=" . db_sql_encode($this->name) . ", externalType=" . db_sql_encode($this->externalType) . ", externalId=" . db_sql_encode($this->externalId) . ", access=" . db_sql_encode($this->access) . ", email=" . db_sql_encode($this->email) . ", notification=" . db_sql_encode($this->notification) . ", tempCode=" . db_sql_encode($this->tempCode) . ", deleted=" . db_sql_encode($this->deleted) . ", hash=" . db_sql_encode($this->hash);
     // print "Saving to database: $query<br/>\n";
     if (mysql_query($query)) {
         // Saved successfully, now load fresh, including created and
         // updated values, and update the hash value
         $mustUpdateHash = true;
         if ($this->hash !== $this->latestHash) {
             // Hash value was manually set, so don't re-calculate it
             $mustUpdateHash = false;
         }
         if ($this->load($this->userId)) {
             if ($mustUpdateHash) {
                 $value = "|" . $this->password . "|" . $this->created . "|" . $this->latestUpdated . "|" . $this->name . "|" . $this->externalType . "|" . $this->externalId . "|" . $this->access . "|" . $this->email . "|" . $this->notification . "|" . $this->tempCode . "|" . $this->deleted . "|";
                 $this->hash = md5($value);
                 $this->latestHash = $this->hash;
                 $query = "UPDATE blogUser SET " . "hash=" . db_sql_encode($this->hash) . " WHERE userId=" . db_sql_encode($this->userId) . " AND updated=" . db_sql_encode($this->latestUpdated);
                 if (mysql_query($query)) {
                     return true;
                 } else {
                     print $query . "<br/>";
                     print " --> error: " . mysql_error() . "<br/>\n";
                     return false;
                 }
             }
             return true;
         } else {
             return false;
         }
     } else {
         print $query . "<br/>";
         print " --> error: " . mysql_error() . "<br/>\n";
         return false;
     }
 }