Exemple #1
0
/**
 *  Whatever Data is returned by Hanlder, should be an array will be rendered as array on response
 * 
 * @param AbstractUser $user
 * @param array $controllerInfo
 * @param String $handlerName
 */
function rx_interceptor_json($user, $controllerInfo, $handlerName)
{
    $user->validate();
    include_once RUDRA . "/core/handler/AbstractHandler.php";
    $handlerInfo = ClassUtil::getHandler($handlerName);
    if ($handlerInfo != NULL) {
        global $temp;
        include_once $handlerInfo["filePath"];
        $className = $handlerInfo["className"];
        $tempClass = new ReflectionClass($className);
        if ($tempClass->isInstantiable()) {
            $temp = $tempClass->newInstance();
        }
        if ($temp != NULL) {
            try {
                if ($tempClass->hasMethod("invokeHandler")) {
                    $resp = call_method_by_class($tempClass, $temp, 'invokeHandler', array('user' => $user, 'data' => new RequestData(get_request_param("data"))), $handlerInfo["requestParams"]);
                    if (isset($resp)) {
                        echo json_encode($resp);
                    }
                }
            } catch (Exception $e) {
                echo json_encode(array("error" => $e));
            }
        }
    }
}
Exemple #2
0
 public function __construct()
 {
     if (self::$usercache == NULL) {
         self::$usercache = new RxCache('user');
     }
     $this->info = array();
 }
Exemple #3
0
 /**
  * Create a new user using an MD5 hash
  *
  * @param string $username username of the user
  * @param string $md5 MD5 hash of the user password
  */
 public function __construct($username, $md5)
 {
     parent::__construct($username);
     $this->md5 = $md5;
 }
Exemple #4
0
 /**
  * Construct a new User object
  *
  * @param array $user
  * @param \PDO  $db
  */
 public function __construct(array $user, \PDO $db)
 {
     $this->db = $db;
     parent::__construct($user, \ArrayObject::ARRAY_AS_PROPS);
 }
Exemple #5
0
 /**
  * Save settings
  */
 public function save()
 {
     $config = $this->getArrayCopy();
     $this->userInstance->offsetSet('config', serialize($config), true);
     $this->userInstance->save();
 }
Exemple #6
0
 /**
  * Create a new user using a plain text password
  *
  * @param string $username username of the user
  * @param string $plain plain text user password
  */
 public function __construct($username, $plain)
 {
     parent::__construct($username);
     $this->plain = $plain;
 }
Exemple #7
0
 /**
  * {@inheritdoc}
  */
 protected function afterDelete()
 {
     parent::afterDelete();
 }