芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/modules/MailChangePasswordPoppassdPlugin/Poppassd.php
CheckResponse($this->GetNextLine(), 0); } return $bResult; } /** * @param string $sLogin * @param string $sPassword * @return bool */ public function Login($sLogin, $sPassword) { return $this->SendCommand('user ' . $sLogin, array(), 1) && $this->SendCommand('pass ' . $sPassword, array($sPassword), 1); } /** * @param string $sLogin * @param string $sPassword * @return bool */ public function ConnectAndLogin($sLogin, $sPassword) { return $this->Connect() && $this->Login($sLogin, $sPassword); } /** * @return bool */ public function Disconnect() { return parent::Disconnect(); } /** * @return bool */ public function Logout() { return $this->SendCommand('quit', array(), 0); } /** * @return bool */ public function LogoutAndDisconnect() { return $this->Logout() && $this->Disconnect(); } /** * @param string $sNewPassword * @return bool */ public function NewPass($sNewPassword) { $bResult = false; $sMessage = ''; $aLines = []; if ($this->WriteLine('newpass ' . $sNewPassword, array($sNewPassword))) { while ($sLine = $this->GetNextLine()) { $aLine = \explode(' ', $sLine); if ($aLine[0] == 200) { $bResult = true; break; } if ($aLine[0] == 500) { $bResult = false; $aLines[] = substr($sLine, 4) ; } } } if (!$bResult) { $sMessage = implode("\n", $aLines); } return [$bResult, $sMessage]; // return $this->SendCommand('newpass '.$sNewPassword, array($sNewPassword), 0); } /** * @param string $sCmd * @return bool */ public function SendLine($sCmd) { return $this->WriteLine($sCmd); } /** * @param string $sCmd * @param array $aHideValues = array() * @param int $iCheckType = 0 * @return bool */ public function SendCommand($sCmd, $aHideValues = array(), $iCheckType = 0) { if ($this->WriteLine($sCmd, $aHideValues)) { return $this->CheckResponse($this->GetNextLine(), $iCheckType); } return false; } /** * @return string */ public function GetNextLine() { return $this->ReadLine(); } /** * @param string $sResponse * @param int $iCheckType = 0 * @return bool */ public function CheckResponse($sResponse, $iCheckType = 0) { switch ($iCheckType) { case 0: return (bool) preg_match('/^2\d\d/', $sResponse); break; case 1: return (bool) preg_match('/^[23]\d\d/', $sResponse); break; } return false; } }