diff options
author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-01-26 16:33:02 +0000 |
---|---|---|
committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-01-26 16:33:02 +0000 |
commit | a6f794c20dc3592bcaef17c622413c1b670a20d8 (patch) | |
tree | 8819f4d9108b4b98fc1d59a3fb23d28cdfba9555 /modules/rest | |
parent | b21e7be11a0abe57790ec2a2fcca1874632fed8c (diff) | |
parent | accd00464e2d7e1d1fd0e24e1ee583a7baa73611 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/rest')
-rw-r--r-- | modules/rest/helpers/rest_event.php | 17 | ||||
-rw-r--r-- | modules/rest/views/user_profile_rest.html.php | 8 |
2 files changed, 25 insertions, 0 deletions
diff --git a/modules/rest/helpers/rest_event.php b/modules/rest/helpers/rest_event.php index 860c8e41..f9aa34e3 100644 --- a/modules/rest/helpers/rest_event.php +++ b/modules/rest/helpers/rest_event.php @@ -74,4 +74,21 @@ class rest_event { ->class("g-form-static") ->label(t("Remote access key")); } + + static function show_user_profile($data) { + if ($data->display_all) { + $view = new View("user_profile_rest.html"); + $key = ORM::factory("user_access_token") + ->where("user_id", "=", $data->user->id) + ->find(); + + if (!$key->loaded()) { + $key->user_id = $data->user->id; + $key->access_key = md5($data->user->name . rand()); + $key->save(); + } + $view->rest_key = $key->access_key; + $data->content[] = (object)array("title" => t("Rest api"), "view" => $view); + } + } } diff --git a/modules/rest/views/user_profile_rest.html.php b/modules/rest/views/user_profile_rest.html.php new file mode 100644 index 00000000..3807817e --- /dev/null +++ b/modules/rest/views/user_profile_rest.html.php @@ -0,0 +1,8 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-rest-detail"> +<ul> + <li id="g-rest-key"> + <p><b><?= t("Key") ?></b>:<?= $rest_key ?></p> + </li> +</ul> +</div> |