/** * find results, either normal or crosstable * * for example * * $object = new mytable(); * $object->ID = 1; * $object->find(); * * * will set $object->N to number of rows, and expects next command to fetch rows * will return $object->N * * @param boolean $n Fetch first result * * @access public * @return mixed (number of rows returned, or true if numRows fetching is not supported) */ function find($n = false) { global $_DB_DATAOBJECT; if (!isset($this->_query)) { $this->raiseError("You cannot do two queries on the same object (copy it before finding)", DB_DATAOBJECT_ERROR_INVALIDARGS); return false; } if (empty($_DB_DATAOBJECT['CONFIG'])) { DB_DataObject::_loadConfig(); } if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug($n, "__find", 1); } if (!$this->__table) { // xdebug can backtrace this! php_error("NO \$__table SPECIFIED in class definition", E_USER_ERROR); } $this->N = 0; $query_before = $this->_query; $this->_build_condition($this->table()); $quoteIdentifiers = !empty($_DB_DATAOBJECT['CONFIG']['quote_identifiers']); $this->_connect(); $DB =& $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5]; /* We are checking for method modifyLimitQuery as it is PEAR DB specific */ $sql = 'SELECT ' . $this->_query['data_select'] . ' FROM ' . ($quoteIdentifiers ? $DB->quoteIdentifier($this->__table) : $this->__table) . " " . $this->_join . $this->_query['condition'] . ' ' . $this->_query['group_by'] . ' ' . $this->_query['having'] . ' ' . $this->_query['order_by'] . ' '; if (!isset($_DB_DATAOBJECT['CONFIG']['db_driver']) || $_DB_DATAOBJECT['CONFIG']['db_driver'] == 'DB') { /* PEAR DB specific */ if (isset($this->_query['limit_start']) && strlen($this->_query['limit_start'] . $this->_query['limit_count'])) { $sql = $DB->modifyLimitQuery($sql, $this->_query['limit_start'], $this->_query['limit_count']); } } else { /* theoretically MDB! */ if (isset($this->_query['limit_start']) && strlen($this->_query['limit_start'] . $this->_query['limit_count'])) { $DB->setLimit($this->_query['limit_count'], $this->_query['limit_start']); } } $this->_query($sql); if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug("CHECK autofetchd {$n}", "__find", 1); } // unset the if ($n && $this->N > 0) { if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug("ABOUT TO AUTOFETCH", "__find", 1); } $this->fetch(); } if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug("DONE", "__find", 1); } $this->_query = $query_before; return $this->N; }
CheckOutOfOffice($argv[2], $argv[3]); die; } if ($GLOBALS["VERBOSE"]) { events("receive: " . implode(" ", $argv), "main", __LINE__); } $options = parse_args(array('s', 'r', 'c', 'h', 'u', 'i', 'z'), $_SERVER['argv']); //getopt("s:r:c:h:u:"); if (!array_key_exists('r', $options) || !array_key_exists('s', $options)) { fwrite(STDOUT, "Usage is {$argv['0']} -s sender@domain -r recip@domain\n"); exit(EX_TEMPFAIL); } $tmpfname = tempnam("/var/lib/artica/mail/filter", 'IN.'); $tmpf = @fopen($tmpfname, "w"); if (!$tmpf) { writelogs("Error: Could not open {$tempfname} for writing: " . php_error(), "main", __FILE__, __LINE__); exit(EX_TEMPFAIL); } $GLOBALS["sender"] = strtolower($options['s']); $GLOBALS["recipients"] = $options['r']; $GLOBALS["original_recipient"] = $options['r']; $GLOBALS["POSTFIX_INSTANCE"] = $options['i']; $client_address = $options['c']; $smtp_final_sender = strtolower($options['h']); $sasl_username = strtolower($options['u']); $useAiguilleuse = strtolower($options['z']); if ($useAiguilleuse == "yes") { $GLOBALS["ROUTER-MODE"] = true; } // make sure recipients is an array if (!is_array($GLOBALS["recipients"])) {