コード例 #1
0
ファイル: ApiController.php プロジェクト: CloudOJ/ums
 public function getAuthAction($token = null, $key = null)
 {
     if ($key) {
         if ($this->checkAuthKey($key)) {
             if ($token) {
                 $usertoken = Usertoken::findTokenByID($token);
                 if ($usertoken) {
                     $this->rest_success(array("authdata" => unserialize($usertoken->authdata)));
                     $usertoken->delete();
                 } else {
                     $this->rest_error(array("name" => "Invaild Parameter", "message" => "Token not found"));
                 }
             } else {
                 $this->rest_error(array("name" => "Invaild Parameter", "message" => "Token is null"));
             }
         } else {
             $this->rest_error(array("name" => "Invaild Parameter", "message" => "Invaild Api Key"));
         }
     } else {
         $this->rest_error(array("name" => "Invaild Parameter", "message" => "Key is null"));
     }
 }
コード例 #2
0
ファイル: Usertoken.php プロジェクト: CloudOJ/ums
 public static function findTokenByID($tokenID)
 {
     $token = Usertoken::findFirst(array("tokenid = :tokenid:", 'bind' => array('tokenid' => $tokenID)));
     return $token;
 }