public function pageCreate() { // just put some data in there without actually creating or returning any objects DbObject::_insert('PersonStuff', array('firstname' => 'Common', 'lastname' => 'Name')); // get it if it's there, create and return it if it's not there $promised = DbObject::_getOne('PersonStuff', array('firstname' => 'Definitely', 'lastname' => 'There')); $this->assign('promised', $promised); $new = DbObject::_create('PersonStuff', array('firstname' => 'Unique', 'lastname' => 'Person')); $this->assign('new', $new); $all = DbObject::_find('PersonStuff'); $this->assign('all', $all); }
var_dump($count = $mail->countMessages()); // for($i = 1; $i <= $count; $i++) foreach ($mail as $message) { // $message = $mail->getMessage($i); // print_r($message); // echo "$i {$message->from} {$message->to} {$message->subject}\n"; echo "{$message->from} {$message->to} {$message->subject}\n"; $res = preg_match('/([\\w ]+)<(\\w+)@([\\w.]+)>/', $message->from, $matches); $name = trim($matches[1]); $parts = explode(' ', $name); $firstname = array_shift($parts); $lastname = array_pop($parts); $user = trim($matches[2]); $domain = trim($matches[3]); $username = $email = "{$user}@{$domain}"; $sender = DbObject::_getOne('Person', array('username' => $username), array('firstname' => $firstname, 'lastname' => $lastname, 'email' => $email)); // print_r($sender); preg_match('/<([^>]+)>/', trim($message->messageId), $matches); $messageId = $matches[1]; if (SqlFetchCell("SELECT count(*) from request where message_id = :messageId", array('messageId' => $messageId))) { continue; } $request = new Request(); $request->owner_id = $sender->id; $request->name = trim($message->subject); $request->message_id = $messageId; // deal with the headers // foreach ($message->getHeaders() as $name => $value) // { // if(is_string($value)) // {