function query($sql) { $ts = microtime(); $this->rows = array(); $result = mysql_query($sql, $this->link); if (mysql_error() != "") { ooerror(E_CODEERROR, "MySQL: " . mysql_error() . "<br /> Query:" . $sql); } $n = 0; if (strstr($sql, "UPDATE") == FALSE && strstr($sql, "DELETE") == FALSE && strstr($sql, "INSERT") == FALSE && strstr($sql, "CREATE") == FALSE && strstr($sql, "DROP") == FALSE && strstr($sql, "ALTER") == FALSE) { if ($result) { while ($temprow = mysql_fetch_assoc($result)) { foreach ($temprow as $k => $v) { $this->rows[$n][$k] = $v; } $n++; } } } debug($this, "query:<b>" . substr($sql, 0, 128) . "...</b>, " . (microtime() - $ts) . " seconds"); }
function drop($object) { if (!is_object($object)) { ooerror(403, "Hey! That is not an object!<br />This is an application <b>Coding Error</b>, you cannot drop anything that is not an object to an object.<br />See the backtrace in order to find the offending line. If you cannot fix it, tell your vendor or programmer to fix this, attaching this message. He/She will understand it."); } $class = get_class($object); debug($this, "<font color=\"blue\">Received object " . $object->toString() . "</font>"); $object->ondrop(); for ($i = 0; $i < count($this->__accepts); $i++) { if ($class == $this->accepts[$i] || get_parent_class($object) == $this->accepts[$i]) { $ok = true; } } for ($i = 0; $i < count($this->__mailbox); $i++) { if ($this->__mailbox[$i] == "") { $this->__mailbox[$i] = $object; $this->onReceive(); return; } } $this->__mailbox[] = $object; $this->onReceive(); return; }
function xmlparser($xml) { if (file_exists($xml)) { $xml = implode("\n", file($xml)); } global $obj; $obj->tree = '$obj->xml'; $obj->xml = ''; $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0); xml_set_character_data_handler($xml_parser, "characterData"); if (!xml_parse($xml_parser, $xml, 1)) { ooerror("XML", "<b>XML error:" . xml_error_string(xml_get_error_code($xml_parser)) . " at line " . xml_get_current_line_number($xml_parser)); } xml_parser_free($xml_parser); $this->tree = $obj->xml; $obj = ""; }
function onDrop() { ooerror(CODE_ERROR, "Session objects cannot be dropped"); }