From: Evan Prodromou Date: Sun, 17 Apr 2011 21:46:32 +0000 (-0400) Subject: utility functions for Confirm_address X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ceef84b6d1b26489e7ddc95d948fb210bf956476;p=quix0rs-gnu-social.git utility functions for Confirm_address --- diff --git a/classes/Confirm_address.php b/classes/Confirm_address.php index ed3875d223..4b9bec64c6 100644 --- a/classes/Confirm_address.php +++ b/classes/Confirm_address.php @@ -28,4 +28,36 @@ class Confirm_address extends Memcached_DataObject function sequenceKey() { return array(false, false); } + + static function getAddress($address, $addressType) + { + $ca = new Confirm_address(); + + $ca->address = $address; + $ca->address_type = $addressType; + + if ($ca->find(true)) { + return $ca; + } + + return null; + } + + static function saveNew($user, $address, $addressType, $extra=null) + { + $ca = new Confirm_address(); + + if (!empty($user)) { + $ca->user_id = $user->id; + } + + $ca->address = $address; + $ca->address_type = $addressType; + $ca->address_extra = $extra; + $ca->code = common_confirmation_code(64); + + $ca->insert(); + + return $ca; + } }