private function getStatus() { $sqlCount = 0; $bwStats = $this->ircClass->getStats(); if (is_object($this->db)) { $sqlCount = $this->db->numQueries(); } $bwUp = irc::intToSizeString($bwStats['BYTESUP']); $bwDown = irc::intToSizeString($bwStats['BYTESDOWN']); $fileBwUp = irc::intToSizeString($this->dccClass->getBytesUp()); $fileBwDown = irc::intToSizeString($this->dccClass->getBytesDown()); $txtQueue = $this->ircClass->getTextQueueLength() + 1; $ircStat = $this->ircClass->getStatusString($this->ircClass->getStatusRaw()); $permin = round($sqlCount / $this->ircClass->getRunTime(), 1); $kbs = ($bwStats['BYTESUP'] + $bwStats['BYTESDOWN']) / 1024; $kbs = round($kbs / $this->ircClass->getRunTime(), 2); $status = "Status: " . number_format($sqlCount) . " SQL / {$permin} Q/sec (irc BW: " . $bwUp . " up, " . $bwDown . " down avg ~{$kbs} kbps)"; return $status; }
private function getStatus() { $sqlCount = 0; $bwStats = $this->ircClass->getStats(); if (is_object($this->db)) { $sqlCount = $this->db->numQueries(); } $bwUp = irc::intToSizeString($bwStats['BYTESUP']); $bwDown = irc::intToSizeString($bwStats['BYTESDOWN']); $fileBwUp = irc::intToSizeString($this->dccClass->getBytesUp()); $fileBwDown = irc::intToSizeString($this->dccClass->getBytesDown()); $txtQueue = $this->ircClass->getTextQueueLength() + 1; $ircStat = $this->ircClass->getStatusString($this->ircClass->getStatusRaw()); $status = "Status: [" . $ircStat . "] " . $sqlCount . " SQL, " . $txtQueue . " SrQ, (irc BW: " . $bwUp . " up, " . $bwDown . " down, file BW: " . $fileBwUp . " up, " . $fileBwDown . " down)"; return $status; }
public function initialize($filename, $size = 0) { $this->reportedRecieved = 0; $this->completed = 0; $this->filesize = $size; $this->timeConnected = time(); $this->timeOutLevel = 0; $this->readQueue = ""; $this->type = FILE; if ($this->transferType == UPLOAD) { $this->filename = $filename; if (strpos($filename, "/") !== false) { $filenameArray = explode("/", $filename); $this->filenameNoDir = $filenameArray[count($filenameArray) - 1]; } else { if (strpos($filename, "\\") !== false) { $filenameArray = explode("\\", $filename); $this->filenameNoDir = $filenameArray[count($filenameArray) - 1]; } else { $this->filenameNoDir = $filename; } } $this->filenameNoDir = $this->cleanFilename($this->filenameNoDir); $this->dccClass->dccInform($this->dccString . "Initiating file transfer of (" . $this->filenameNoDir . ") to " . $this->nick); if (!$this->file_exists($this->filename)) { $this->disconnect("File does not exist"); return; } $fileSize = $this->filesize($this->filename); if ($fileSize === false) { $this->disconnect("File does not exist"); return; } $this->filesize = $fileSize; $kbSize = irc::intToSizeString($fileSize); if ($this->reverse == false) { $this->ircClass->privMsg($this->nick, "DCC SEND " . $this->filenameNoDir . " " . $this->ircClass->getClientIP(1) . " " . $this->port . " " . $fileSize . "", 0); } $this->ircClass->notice($this->nick, "DCC: Sending you (\"" . $this->filenameNoDir . "\") which is " . $kbSize . " (resume supported)", 0); } else { $uldir = $this->ircClass->getClientConf('uploaddir'); $lastChar = substr($uldir, strlen($uldir) - 1, 1); if ($lastChar != "\\" || $lastChar != "/") { $uldir .= "/"; } $filename = $this->cleanFilename($filename); $this->filename = $uldir . $filename; $this->dccClass->dccInform($this->dccString . "Initiating file transfer of (" . $filename . ") from " . $this->nick); if ($this->file_exists($this->filename)) { $bytesFinished = $this->filesize($this->filename); if ($bytesFinished >= $this->filesize) { $this->disconnect("Connection aborted. I already have that file."); return; } else { $this->status = DCC_WAITING; $this->bytesTransfered = $bytesFinished; $this->resumedSize = $bytesFinished; $this->ircClass->privMsg($this->nick, "DCC RESUME file.ext " . $this->port . " " . $bytesFinished . "", 0); } return; } $this->ircClass->notice($this->nick, "DCC: Upload accepted, connecting to you (" . $this->connectHost . ") on port " . $this->port . ".", 0); $this->status = DCC_CONNECTING; $this->connection->connect(); } }