source: branches/2.4/rest/setup/default_records.inc.php @ 6754

Revision 6754, 1.7 KB checked in by niltonneto, 7 years ago (diff)

Ticket #0000 - Copiadas as alterações do Trunk. Versão final da 2.4.1.

Line 
1<?php
2
3  /**************************************************************************\
4  * eGroupWare - Setup                                                       *
5  * http://www.egroupware.org                                                *
6  * --------------------------------------------                             *
7  *  This program is free software; you can redistribute it and/or modify it *
8  *  under the terms of the GNU General Public License as published by the   *
9  *  Free Software Foundation; either version 2 of the License, or (at your  *
10  *  option) any later version.                                              *
11  \**************************************************************************/
12
13$secret = substr(md5(rand().rand()), 0, 16); //Gera senha aleatoria
14
15$oProc->query("INSERT INTO rest_client (client_id, client_secret) values (1, '$secret');");
16$dados = array();
17$oProc->query("select * from phpgw_config where config_app='phpgwapi'");
18while ($oProc->next_record())
19{
20    $test = @unserialize($oProc->f('config_value'));
21    if($test)
22        $dados[$oProc->f('config_name')] = $test;
23    else
24        $dados[$oProc->f('config_name')] = $oProc->f('config_value');
25}
26
27/*
28Cria e configura o arquivo REST.ini
29*/
30require_once dirname(__FILE__) . '/../../prototype/api/config.php';
31
32use prototype\api\Config as Config;
33
34$config = array();
35$config['baseUri'] = $dados['webserver_url'].'/rest';
36$config['oauth']['url_token'] = 'http://' . $_SERVER['HTTP_HOST'] . $dados['webserver_url'].'/rest/token';
37$config['oauth']['client_id'] = 1;
38$config['oauth']['client_secret'] = $secret;
39
40Config::writeIniFile($config , dirname(__FILE__) . '/../../prototype/config/REST.ini', true);
41   
42
43?>
Note: See TracBrowser for help on using the repository browser.