Example #1
0
 public function unformat($value)
 {
     if (!empty($value)) {
         return php_sql_datetime(datetime_php($value));
     }
     return "";
 }
Example #2
0
 public static function renewToken()
 {
     $info = static::token();
     if (!isset($info["error"])) {
         $orm = ORM::make("manager_tokens")->where("token", "=", $info["token"])->findFirst();
         if ($orm) {
             $orm->token = md5(base64_encode(pack('N6', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid())));
             $orm->expirationDate = php_sql_datetime(time() + 3600);
             //one hour
             $orm->update();
             Session::set("j_manager_token", $orm->token);
             return Response::json(array("access_token" => $orm->token, "expires_in" => 3600, "scope" => "all"));
         } else {
             return static::error(403, "invalid_token");
         }
     }
     return $info["error"];
 }