function lookup_nonce($consumer, $token, $nonce, $timestamp) { $n = new Nonce(); $n->consumer_key = $consumer->key; $n->ts = common_sql_date($timestamp); $n->nonce = $nonce; if ($n->find(true)) { return true; } else { $n->created = DB_DataObject_Cast::dateTime(); $n->insert(); return false; } }