/**
  * 客户端接口
  *
  * @see \Zend\Mvc\Controller\AbstractActionController::indexAction()
  */
 public function indexAction()
 {
     $response = $this->getResponse();
     $options = $this->getServiceLocator()->get('ucenter_client_module_options');
     $_DCACHE = $get = $post = array();
     $query = $this->getRequest()->getQuery();
     $code = $query->get('code');
     parse_str(Services\Plugin\Utils::ucAuthcode($code, 'DECODE', $options->getUcKey()), $get);
     defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
     if (MAGIC_QUOTES_GPC) {
         $get = $this->_stripslashes($get);
     }
     if (empty($get)) {
         return $response->setContent('Invalid Request');
     }
     $timestamp = time();
     if (isset($get['time']) && $timestamp - $get['time'] > 3600) {
         return $response->setContent('Authracation has expiried');
     }
     $post = SerializerXml::unserialize(file_get_contents('php://input'));
     if (isset($get['action']) && in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) {
         return $response->setContent($this->ucNote()->{$get}['action']($get, $post));
     } else {
         return $response->setContent(UcenterInterface::API_RETURN_FAILED);
     }
 }
Example #2
0
 public function userLogin($username, $password, $isuid = 0, $checkques = 0, $questionid = '', $answer = '')
 {
     $options = $this->getOptions();
     $apiFunc = $options->getUcConnect() == 'mysql' ? 'ucApimysql' : 'ucApipost';
     $return = call_user_func(array($this, $apiFunc), 'user', 'login', array('username' => $username, 'password' => $password, 'isuid' => $isuid, 'checkques' => $checkques, 'questionid' => $questionid, 'answer' => $answer));
     return $options->getUcConnect() == 'mysql' ? $return : Plugin\SerializerXml::unserialize($return);
 }