Example #1
0
<?php

/**
 * @package		OAuth2
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\OAuth2;

use h, cs\Config, cs\Index, cs\Language\Prefix, cs\Page;
$Index = Index::instance();
$L = new Prefix('oauth2_');
$client = OAuth2::instance()->get_client(Config::instance()->route[2]);
Page::instance()->title($L->editing_of_client($client['name']));
$Index->apply_button = false;
$Index->cancel_button_back = true;
$Index->action = 'admin/OAuth2/clients/list';
$Index->content(h::{'p.lead.cs-center'}($L->editing_of_client($client['name'])) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr'}(h::th($L->client_name) . h::{'td input[name=name]'}(['value' => $client['name']]), h::th('client_secret') . h::{'td input[name=secret]'}(['value' => $client['secret']]), h::th($L->client_domain) . h::{'td input[name=domain]'}(['value' => $client['domain']]), h::th($L->active) . h::{'td input[type=radio][name=active]'}(['checked' => $client['active'], 'value' => [0, 1], 'in' => [$L->no, $L->yes]])) . h::{'input[type=hidden][name=id]'}(['value' => $client['id']]) . h::{'input[type=hidden][name=mode][value=edit]'}());
Example #2
0
/**
 * @package		OAuth2
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
/**
 * Provides next triggers:<br>
 *  OAuth2/custom_sign_in_page
 */
namespace cs\modules\OAuth2;

use h, cs\Config, cs\Index, cs\Language\Prefix, cs\Page, cs\Trigger, cs\User;
$OAuth2 = OAuth2::instance();
$Config = Config::instance();
$Index = Index::instance();
$L = new Prefix('oauth2_');
$Page = Page::instance();
/**
 * Errors processing
 */
if (!isset($_GET['client_id'])) {
    code_header(400);
    $Page->Content = '';
    $Page->warning($L->client_id_parameter_required);
    $Index->stop = true;
    return;
}
if (!($client = $OAuth2->get_client($_GET['client_id']))) {
Example #3
0
<?php

/**
 * @package		OAuth2
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\OAuth2;

use h, cs\Config, cs\Index, cs\Language\Prefix, cs\Page;
$Index = Index::instance();
$L = new Prefix('oauth2_');
Page::instance()->title($L->list_of_client);
$Index->apply_button = false;
$module_data = Config::instance()->module('OAuth2');
$Index->content(h::{'p.lead.cs-center'}($L->list_of_clients) . h::{'table.cs-table.cs-center-all'}(h::{'thead tr th'}([$L->client_name, 'client_id', 'client_secret', $L->action]) . h::{'tbody tr'}(array_map(function ($client) use($L) {
    return h::td([$client['name'], h::{'input{disabled]'}($client['id']), h::{'input{disabled]'}($client['secret']), h::{'a.cs-button-compact'}([h::icon('pencil'), ['href' => "admin/OAuth2/clients/edit/{$client['id']}", 'data-title' => $L->edit]]) . h::{'a.cs-button-compact'}([h::icon('trash-o'), ['href' => "admin/OAuth2/clients/delete/{$client['id']}", 'data-title' => $L->delete]])], ['class' => $client['active'] ? false : 'text-muted']);
}, OAuth2::instance()->clients_list()))) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd.uk-margin-top tr| td'}([h::info('oauth2_allow_guest_tokens'), h::{'input[type=radio]'}(['name' => 'general[guest_tokens]', 'checked' => $module_data->guest_tokens, 'value' => [0, 1], 'in' => [$L->no, $L->yes]])], [h::info('oauth2_automatic_prolongation'), h::{'input[type=radio]'}(['name' => 'general[automatic_prolongation]', 'checked' => $module_data->automatic_prolongation, 'value' => [0, 1], 'in' => [$L->no, $L->yes]])], [h::info('oauth2_expiration'), h::{'input[type=number]'}(['name' => 'general[expiration]', 'value' => $module_data->expiration, 'min' => 1]) . $L->seconds]) . h::{'p.cs-left a.cs-button'}([$L->add_client, ['href' => 'admin/OAuth2/clients/add']]));