/** * @brief Open a mailbox store. * * @param string $identity The identity to open as a URI */ function openMailbox($identity) { $box = parse_url($identity); if (isset(self::$_handlers[$box['scheme']])) { $handler = self::$_handlers[$box['scheme']]; $this->identity = $identity; // Activate the selected backend console::debugEx(LOG_DEBUG, __CLASS__, "Opening identity: %s", $identity); $this->mailbox = new $handler($identity); } else { throw new MailException("Bad backend: " . $box['scheme'] . " (from " . $identity . ")"); } }
function quote($args) { if (is_array($args)) { for ($n = 1; $n < count($args); $n++) { if (!is_numeric($args[$n]) || is_a($args[$n], 'sqlstr')) { console::debugEx(LOG_DEBUG2, __CLASS__, "Escaping value: %s", $args[$n]); $args[$n] = $this->conn->quote((string) $args[$n]); console::debugEx(LOG_DEBUG2, __CLASS__, " -> %s", $args[$n]); } } if (count($args) > 1) { $str = call_user_func_array("sprintf", $args); } else { $str = $args[0]; } } else { $str = $this->conn->quote($args); } return $str; }
public function __set($field, $value) { if (isset($this->_fields[$field])) { $this->_data[$field] = $value; console::debugEx(LOG_DEBUG, __CLASS__, "Setting %s.%s to %s", $this->model, $field, $value); } else { throw new Exception("No such field in model"); } }
static function setErrorHandler($handler, $override = false) { if ($override == true || self::$__errorhandler == null) { self::$__errorhandler = $handler; console::debugEx(LOG_BASIC, __CLASS__, "Assigned error handler: %s", $handler); } else { console::debugEx(LOG_BASIC, __CLASS__, "Ignoring error handler: %s", $handler); } }
/** * @brief Return the message with the matching id * * @param string $msgid The message id * @return MailMessage The message */ function getMessage($msgid) { console::debugEx(LOG_DEBUG, __CLASS__, "Fetching message %s...", $msgid); $messages = $this->xp->query("message[@msgid='" . $msgid . "']"); $mailmsg = new MailMessage(); $mailmsg->subject = $messages->item(0)->getAttribute('subject'); $mailmsg->body = $messages->item(0)->nodeValue; return $mailmsg; }