users = new AUsers(); $this->user = new AUser(); $this->userz = new Users(); $this->profile = new Profile(); $this->mailer = new Mailer(); $this->ph = new PasswordHash(8, FALSE); $this->data['rootUrl'] = Doo::conf()->APP_URL; } public function ZGServer() { ini_set("soap.wsdl_cache_enabled", "0"); $server = new SoapServer(Doo::conf()->APP_URL . 'service/getwsdl?wsdl', array('soap_version' => SOAP_1_2)); $server->setClass('ServiceController'); $server->addFunction('addUser'); $server->addFunction(SOAP_FUNCTIONS_ALL); $server->handle(); } public function getWSDL() { ini_set("soap.wsdl_cache_enabled", "0"); $soap = new soap_server; $soap->configureWSDL('UserService', 'urn:UserService', Doo::conf()->APP_URL . 'service/user'); $soap->soap_defencoding = 'UTF-8'; $soap->register( 'addUser', array('username' => 'xsd:string', 'realname' => 'xsd:string'), array('retval' => 'xsd:boolean'), 'urn:UserService', 'urn:UserService#addUser' ); // $soap->register( // 'updateUser', // array('username' => 'xsd:string') // ); // $soap->service(file_get_contents("php://input")); $soap->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''); } function addUser($username, $realname) { if (isset($username) && isset($realname)) { $uid = $this->users->createUser($username, $username); if ($uid) { $this->profile->ZGinsertProfile($uid, urldecode($realname)); return true; } else { return false; } } else { return false; } } public function randomPassword() { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; $pass = array(); //remember to declare $pass as an array $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache for ($i = 0; $i < 8; $i++) { $n = rand(0, $alphaLength); $pass[] = $alphabet[$n]; } return implode($pass); //turn the array into a string } }