public function sendToServer($type, $subject, $number, $message, $file, $line) { // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Executing...'); // $this->_logVerbose('Executing...'); if ($this->_isTraceDefined()) { $trace = anvilFuseTrace::render(); // $this->_firePHP->_log('Trace Defined'); if ($this->echoTrace && $type > self::TRACE_TYPE_DEBUG) { echo nl2br($message); echo anvilFuseTrace::renderHTML(); echo '<hr />'; } } if ($this->isFireBugEnabled()) { // $this->_firePHP->_log(array($type, $subject, $number, $message, $file, $line, $trace)); } if ($this->isServerEnabled()) { // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Opening Connection to anvilFuseTrap Server...'); $this->_logVerbose('Opening Connection to anvilFuseTrap Server...'); try { $anvilFuseWS = new SoapClient($this->serverURL); // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Adding new event...'); // $this->_logVerbose('Adding new event...'); $return = $anvilFuseWS->newEvent($type, $this->applicationID, $this->applicationVersion, $this->_remoteIP, $subject, $number, $message, $file, $line, $trace); return $return; } catch (SoapFault $fault) { $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Server communications failure! (' . $fault->faultcode . ' - ' . $fault->faultstring . ')'); } catch (Exception $exception) { $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Server communications failure! (' . $exception->getCode() . ' - ' . $exception->getMessage() . ')'); } #---------------------------------------- } elseif ($this->isDatabaseEnabled()) { // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Opening Connection to Database...'); $this->_logVerbose('Opening Connection to Database...'); try { // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'starting...'); // $this->_logVerbose('starting...'); if ($this->tableVersion === 1) { $objEvent = new anvilFuseEvent($this->dataConnection, $this->tableName); $objEvent->eventTypeID = $type; $objEvent->applicationID = $this->applicationID; } else { $objEvent = new anvilFuseEvent2($this->dataConnection, $this->tableName); $objEvent->fuseEventTypeID = $type; $objEvent->fuseApplicationID = $this->applicationID; } $objEvent->version = $this->applicationVersion; $objEvent->userIP = $this->_remoteIP; $objEvent->userID = $this->userID; $objEvent->name = substr($subject, 0, 255); $objEvent->number = $number; $objEvent->details = $message; $objEvent->file = $file; $objEvent->line = $line; $objEvent->trace = $trace; // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Save SQL = ' . $objEvent->buildSaveSQL()); $objEvent->save(); $return = array('result' => '1', 'junk' => 'junk'); // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, '$return=' . var_export($return, true)); return $return; } catch (Exception $exception) { // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Server communications failure! (' . $exception->getCode() . ' - ' . $exception->getMessage . ")\n[" . $exception->getTraceAsString() . ']'); $this->_logError('Server communications failure! (' . $exception->getCode() . ' - ' . $exception->getMessage() . ')'); } } elseif (!empty($this->_logPath)) { $types = array(0 => 'Other', 10 => 'Test', 20 => 'Info', 30 => 'Debug', 40 => 'Warning', 50 => 'Error', 60 => 'Critical'); try { $log = fopen($this->_logPath, 'ab'); $logAppend = "-------------------------------------------------------\r\n"; $logAppend .= 'DTS: ' . date('Y-m-d H:i:s') . "\r\n"; $logAppend .= 'Type: ' . $types[$type] . "\r\n"; $logAppend .= 'Application ID: ' . $this->applicationID . "\r\n"; $logAppend .= 'Application version: ' . $this->applicationVersion . "\r\n"; $logAppend .= 'User IP: ' . $this->_remoteIP . "\r\n"; $logAppend .= 'Number: ' . $number . "\r\n"; $logAppend .= 'Name: ' . $subject . "\r\n"; $logAppend .= 'Details: ' . $message . "\r\n"; $logAppend .= 'File: ' . $file . "\r\n"; $logAppend .= 'Line: ' . $line . "\r\n"; $logAppend .= "\r\n"; $logAppend .= $trace; $logAppend .= "-------------------------------------------------------\r\n\r\n\r\n\r\n"; fwrite($log, $logAppend); fclose($log); $return = array('result' => '1', 'junk' => 'junk'); return $return; } catch (Exception $exception) { // $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Server communications failure! (' . $exception->code . ' - ' . $exception->message . ')'); $this->_logError('Server communications failure! (' . $exception->getCode() . ' - ' . $exception->getMessage() . ')'); } } else { return false; } }