diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-25 19:49:17 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-25 19:49:17 -0800 |
commit | 1606961153fca681895a4f0145f7794000337539 (patch) | |
tree | 30a8fc8ed2dfcafe1c1aea13432ccd4b5a26be40 /modules/rest | |
parent | cc912935731c216a57e4c291548ec503a0c1607e (diff) | |
parent | 6023f2bb46598f9da096d63f7ab1dfb914eab6f7 (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev
Conflicts:
modules/gallery/libraries/MY_ORM.php
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> |