use Friendica\Database\DBA;
use Friendica\Model\User;
-require_once 'include/dba.php';
-
class ExAuth
{
private $bDebug;
/**
* @brief Create the class
*
- * @param boolean $bDebug Debug mode
*/
public function __construct()
{
* parameters
*
* @return null
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public function readStdin()
{
* @brief Check if the given username exists
*
* @param array $aCommand The command array
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private function isUser(array $aCommand)
{
- $a = get_app();
+ $a = \get_app();
// Check if there is a username
if (!isset($aCommand[1])) {
/**
* @brief Check remote user existance via HTTP(S)
*
- * @param string $host The hostname
- * @param string $user Username
- * @param boolean $ssl Should the check be done via SSL?
+ * @param string $host The hostname
+ * @param string $user Username
+ * @param boolean $ssl Should the check be done via SSL?
*
* @return boolean Was the user found?
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private function checkUser($host, $user, $ssl)
{
$url = ($ssl ? 'https' : 'http') . '://' . $host . '/noscrape/' . $user;
- $data = Network::curl($url);
+ $curlResult = Network::curl($url);
- if (!is_array($data)) {
+ if (!$curlResult->isSuccess()) {
return false;
}
- if ($data['return_code'] != '200') {
+ if ($curlResult->getReturnCode() != 200) {
return false;
}
- $json = @json_decode($data['body']);
+ $json = @json_decode($curlResult->getBody());
if (!is_object($json)) {
return false;
}
* @brief Authenticate the given user and password
*
* @param array $aCommand The command array
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private function auth(array $aCommand)
{
- $a = get_app();
+ $a = \get_app();
// check user authentication
if (sizeof($aCommand) != 4) {
* @brief Set the hostname for this process
*
* @param string $host The hostname
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private function setHost($host)
{