namespace fix
This commit is contained in:
parent
7b30e7ffc5
commit
da3d41a6f5
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
namespace ManiaControl\Files;
|
||||||
|
|
||||||
use ManiaControl\Callbacks\TimerListener;
|
use ManiaControl\Callbacks\TimerListener;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use Structures\SocketStructure;
|
|
||||||
|
|
||||||
class AsynchronousFileReader implements TimerListener {
|
class AsynchronousFileReader implements TimerListener {
|
||||||
/**
|
/**
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace ManiaControl;
|
namespace ManiaControl\Files;
|
||||||
|
|
||||||
|
use ManiaControl\ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File utility class
|
* File utility class
|
||||||
@ -21,11 +23,11 @@ abstract class FileUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$urlData = parse_url($url);
|
$urlData = parse_url($url);
|
||||||
$port = (isset($urlData['port']) ? $urlData['port'] : 80);
|
$port = (isset($urlData['port']) ? $urlData['port'] : 80);
|
||||||
|
|
||||||
$fsock = fsockopen($urlData['host'], $port);
|
$fsock = fsockopen($urlData['host'], $port);
|
||||||
stream_set_timeout($fsock, 3);
|
stream_set_timeout($fsock, 3);
|
||||||
|
|
||||||
$query = 'GET ' . $urlData['path'] . ' HTTP/1.0' . PHP_EOL;
|
$query = 'GET ' . $urlData['path'] . ' HTTP/1.0' . PHP_EOL;
|
||||||
$query .= 'Host: ' . $urlData['host'] . PHP_EOL;
|
$query .= 'Host: ' . $urlData['host'] . PHP_EOL;
|
||||||
$query .= 'Content-Type: ' . $contentType . PHP_EOL;
|
$query .= 'Content-Type: ' . $contentType . PHP_EOL;
|
||||||
@ -33,28 +35,28 @@ abstract class FileUtil {
|
|||||||
$query .= PHP_EOL;
|
$query .= PHP_EOL;
|
||||||
|
|
||||||
fwrite($fsock, $query);
|
fwrite($fsock, $query);
|
||||||
|
|
||||||
$buffer = '';
|
$buffer = '';
|
||||||
$info = array('timed_out' => false);
|
$info = array('timed_out' => false);
|
||||||
while (!feof($fsock) && !$info['timed_out']) {
|
while(!feof($fsock) && !$info['timed_out']) {
|
||||||
$buffer .= fread($fsock, 1024);
|
$buffer .= fread($fsock, 1024);
|
||||||
$info = stream_get_meta_data($fsock);
|
$info = stream_get_meta_data($fsock);
|
||||||
}
|
}
|
||||||
fclose($fsock);
|
fclose($fsock);
|
||||||
|
|
||||||
if ($info['timed_out'] || !$buffer) {
|
if ($info['timed_out'] || !$buffer) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (substr($buffer, 9, 3) != "200") {
|
if (substr($buffer, 9, 3) != "200") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = explode("\r\n\r\n", $buffer, 2);
|
$result = explode("\r\n\r\n", $buffer, 2);
|
||||||
|
|
||||||
if (count($result) < 2) {
|
if (count($result) < 2) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result[1];
|
return $result[1];
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
|||||||
* Time: 00:18
|
* Time: 00:18
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Structures;
|
namespace ManiaControl\Files;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Socket Structure
|
* Socket Structure
|
@ -5,7 +5,7 @@ namespace ManiaControl\Maps;
|
|||||||
use ManiaControl\Admin\AuthenticationManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\FileUtil;
|
use ManiaControl\Files\FileUtil;
|
||||||
use ManiaControl\Formatter;
|
use ManiaControl\Formatter;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\ManiaExchange\ManiaExchangeList;
|
use ManiaControl\ManiaExchange\ManiaExchangeList;
|
||||||
@ -115,8 +115,8 @@ class MapManager implements CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function saveMap(Map &$map) {
|
private function saveMap(Map &$map) {
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
$mapQuery = "INSERT INTO `" . self::TABLE_MAPS . "` (
|
$mapQuery = "INSERT INTO `" . self::TABLE_MAPS . "` (
|
||||||
`uid`,
|
`uid`,
|
||||||
`name`,
|
`name`,
|
||||||
`authorLogin`,
|
`authorLogin`,
|
||||||
|
Loading…
Reference in New Issue
Block a user