示例#1
0
 /**
  * Resolve the call - identify the handler class and method and store
  * locally
  * @return boolean FALSE if failed (invalid request - see errors)
  * @access private
  */
 function resolveCall()
 {
     $uriPath = explode('/', JPSpan_Server::getUriPath());
     if (count($uriPath) != 2) {
         trigger_error('Invalid call syntax', E_USER_ERROR);
         return FALSE;
     }
     if (preg_match('/^[a-z]+[0-9a-z_]*$/', $uriPath[0]) != 1) {
         trigger_error('Invalid handler name: ' . $uriPath[0], E_USER_ERROR);
         return FALSE;
     }
     if (preg_match('/^[a-z]+[0-9a-z_]*$/', $uriPath[1]) != 1) {
         trigger_error('Invalid handler method: ' . $uriPath[1], E_USER_ERROR);
         return FALSE;
     }
     if (!array_key_exists($uriPath[0], $this->descriptions)) {
         trigger_error('Unknown handler: ' . $uriPath[0], E_USER_ERROR);
         return FALSE;
     }
     if (!in_array($uriPath[1], $this->descriptions[$uriPath[0]]->methods)) {
         trigger_error('Unknown handler method: ' . $uriPath[1], E_USER_ERROR);
         return FALSE;
     }
     $this->calledClass = $uriPath[0];
     $this->calledMethod = $uriPath[1];
     return TRUE;
 }
 /**
  * Resolve the call - identify the handler class and method and store
  * locally
  * @return boolean FALSE if failed (invalid request - see errors)
  * @access private
  */
 function resolveCall()
 {
     // Hack between server.php?class/method and server.php/class/method
     $uriPath = $_SERVER['QUERY_STRING'];
     if ($uriPath) {
         if (preg_match('/\\/$/', $uriPath)) {
             $uriPath = substr($uriPath, 0, strlen($uriPath) - 1);
         }
     } else {
         $uriPath = JPSpan_Server::getUriPath();
     }
     $uriPath = explode('/', $uriPath);
     if (count($uriPath) != 2) {
         trigger_error('Invalid call syntax', E_USER_ERROR);
         return FALSE;
     }
     if (preg_match('/^[a-z]+[0-9a-z_]*$/', $uriPath[0]) != 1) {
         trigger_error('Invalid handler name: ' . $uriPath[0], E_USER_ERROR);
         return FALSE;
     }
     if (preg_match('/^[a-z]+[0-9a-z_]*$/', $uriPath[1]) != 1) {
         trigger_error('Invalid handler method: ' . $uriPath[1], E_USER_ERROR);
         return FALSE;
     }
     if (!array_key_exists($uriPath[0], $this->descriptions)) {
         trigger_error('Unknown handler: ' . $uriPath[0], E_USER_ERROR);
         return FALSE;
     }
     if (!in_array($uriPath[1], $this->descriptions[$uriPath[0]]->methods)) {
         trigger_error('Unknown handler method: ' . $uriPath[1], E_USER_ERROR);
         return FALSE;
     }
     $this->calledClass = $uriPath[0];
     $this->calledMethod = $uriPath[1];
     return TRUE;
 }