Commit a394ee090eb529ac10cbf588fd0fd8f980397820
1 parent
8f6112a7
Exists in
master
and in
110 other branches
bugFix token
Showing
5 changed files
with
153 additions
and
157 deletions
Show diff stats
php/config.php
1 | 1 | <?php |
2 | - /** | |
2 | +/** | |
3 | 3 | * @file config.php |
4 | 4 | * @version $Id: config.php 2368 2014-05-21 08:46:23Z elena $ |
5 | 5 | * |
... | ... | @@ -21,21 +21,23 @@ |
21 | 21 | */ |
22 | 22 | require_once 'my_config.php'; |
23 | 23 | |
24 | -if (is_file('amda_version.php')) | |
25 | - require_once 'amda_version.php'; | |
24 | +if (is_file('amda_version.php')) { | |
25 | + require_once 'amda_version.php'; | |
26 | +} | |
26 | 27 | |
27 | -if (is_file('errors.php')) | |
28 | - require_once 'errors.php'; | |
28 | +if (is_file('errors.php')) { | |
29 | + require_once 'errors.php'; | |
30 | +} | |
29 | 31 | |
30 | 32 | /*----------------------- SYSTEM config section --------*/ |
31 | -if (!defined('PHP_VERSION_ID')) | |
32 | -{ | |
33 | - $version = explode('.', PHP_VERSION); | |
34 | - define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); | |
33 | +if (!defined('PHP_VERSION_ID')) { | |
34 | + $version = explode('.', PHP_VERSION); | |
35 | + define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); | |
35 | 36 | } |
36 | 37 | |
37 | -if (!defined('MAGIC_FILE')) | |
38 | - define('MAGIC_FILE','/usr/share/misc/magic'); | |
38 | +if (!defined('MAGIC_FILE')) { | |
39 | + define('MAGIC_FILE', '/usr/share/misc/magic'); | |
40 | +} | |
39 | 41 | |
40 | 42 | date_default_timezone_set('UTC'); |
41 | 43 | /*-----------------------END SYSTEM config section --------*/ |
... | ... | @@ -47,11 +49,11 @@ define("MaxGuestTimeInterval", 10); // days |
47 | 49 | /*-----------------------END GUESTS LOGIN section --------*/ |
48 | 50 | |
49 | 51 | // user WS size limit |
50 | -define('DISK_QUOTA', 1024*1024*200); // 200MB | |
52 | +define('DISK_QUOTA', 1024 * 1024 * 200); // 200MB | |
51 | 53 | // max lines of uploaded ascii file to show |
52 | 54 | define('MAX_FILE_INDEX_TO_SHOW', 100); |
53 | 55 | // private key used to be considerate as a trust client for some functions of DD web service |
54 | -define('DDSERVICE_PRIVATEKEY','!%p856Dc'); | |
56 | +define('DDSERVICE_PRIVATEKEY', '!%p856Dc'); | |
55 | 57 | |
56 | 58 | define('IMPEX_INTERVAL_LIMIT', 86400); // one day for impex request |
57 | 59 | |
... | ... | @@ -64,12 +66,12 @@ define('JOB_CYCLES_NUMBER', 5); // cycles number for all the jobs |
64 | 66 | /*-----------------------END BATCH JOBS section --------*/ |
65 | 67 | |
66 | 68 | // EPN-TAP services |
67 | -define('EPNTAP_APIS','http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync'); | |
68 | -define('EPNTAP_AMDA','http://cdpp-epntap.irap.omp.eu/__system__/tap/run/tap/sync'); | |
69 | +define('EPNTAP_APIS', 'http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync'); | |
70 | +define('EPNTAP_AMDA', 'http://cdpp-epntap.irap.omp.eu/__system__/tap/run/tap/sync'); | |
69 | 71 | |
70 | 72 | /*----------------------- PHP run-time settings --------*/ |
71 | -ini_set('memory_limit',128000000); | |
72 | -ini_set('max_execution_time',600); // max PHP execution | |
73 | +ini_set('memory_limit', 128000000); | |
74 | +ini_set('max_execution_time', 600); // max PHP execution | |
73 | 75 | ini_set('default_socket_timeout', 600); //TODO if this is needed ? IMPEX LONG DURATION WEBSERVICES |
74 | 76 | // to avoid 403 error while copying from URL |
75 | 77 | ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201001012 Firefox/7.0'); |
... | ... | @@ -79,145 +81,142 @@ ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201 |
79 | 81 | /*-----------------------END PHP run-time settings --------*/ |
80 | 82 | |
81 | 83 | // General Info dirs |
82 | -define('DATAPATH', IHM_SRC_DIR.'generic_data/'); | |
84 | +define('DATAPATH', IHM_SRC_DIR . 'generic_data/'); | |
83 | 85 | //define('Param', DATAPATH.'Param/'); |
84 | -define('LocalData', DATAPATH.'LocalData/'); | |
85 | -define('RemoteData', DATAPATH.'RemoteData/'); | |
86 | -define('Functions', DATAPATH.'Functions/'); | |
86 | +define('LocalData', DATAPATH . 'LocalData/'); | |
87 | +define('RemoteData', DATAPATH . 'RemoteData/'); | |
88 | +define('Functions', DATAPATH . 'Functions/'); | |
87 | 89 | //define('Plot', DATAPATH.'Plot/'); |
88 | -define('Hst', DATAPATH.'Hst/'); | |
89 | -define('SpecialSettingsDir',DATAPATH.'SpecialSettings/'); | |
90 | +define('Hst', DATAPATH . 'Hst/'); | |
91 | +define('SpecialSettingsDir', DATAPATH . 'SpecialSettings/'); | |
90 | 92 | |
91 | 93 | // General Info files |
92 | -define('orbitsXml',LocalData.'Orbites.xml'); | |
93 | -define('orbitsAllXml',LocalData.'OrbitsAll.xml'); | |
94 | -define('FeedbackXml', DATAPATH.'Feedback/Feedback.xml'); | |
95 | -define('specialGrpsXml',SpecialSettingsDir.'Groups.xml'); | |
96 | -define('specialSettingsXml',SpecialSettingsDir.'Settings.xml'); | |
94 | +define('orbitsXml', LocalData . 'Orbites.xml'); | |
95 | +define('orbitsAllXml', LocalData . 'OrbitsAll.xml'); | |
96 | +define('FeedbackXml', DATAPATH . 'Feedback/Feedback.xml'); | |
97 | +define('specialGrpsXml', SpecialSettingsDir . 'Groups.xml'); | |
98 | +define('specialSettingsXml', SpecialSettingsDir . 'Settings.xml'); | |
97 | 99 | |
98 | 100 | //Help info dirs |
99 | -define('HELPPATH', IHM_SRC_DIR."help/"); | |
101 | +define('HELPPATH', IHM_SRC_DIR . "help/"); | |
100 | 102 | |
101 | 103 | // IMPEX special files |
102 | -define('SimuTargetsXml', DATAPATH.'SimuTemplate/TargetsSimu.xml'); | |
104 | +define('SimuTargetsXml', DATAPATH . 'SimuTemplate/TargetsSimu.xml'); | |
103 | 105 | |
104 | 106 | // Root User dir : All user dirs are defined in UserMgr.php |
105 | -define('USERPATH', IHM_SRC_DIR.'data/'); | |
107 | +define('USERPATH', IHM_SRC_DIR . 'data/'); | |
106 | 108 | |
107 | 109 | // Shared dir |
108 | -define('SHAREDPATH', IHM_SRC_DIR.'shared_data/'); | |
110 | +define('SHAREDPATH', IHM_SRC_DIR . 'shared_data/'); | |
109 | 111 | |
110 | 112 | /*------------------- WEB SERVICES section ---------*/ |
111 | -define('WSRESULT', USERPATH.'WSRESULT/'); // Web Services result directory | |
112 | -define('wsResultsXml',WSRESULT.'WSresults.xml'); // Web Service result file | |
113 | +define('WSRESULT', USERPATH . 'WSRESULT/'); // Web Services result directory | |
114 | +define('wsResultsXml', WSRESULT . 'WSresults.xml'); // Web Service result file | |
113 | 115 | |
114 | -define('plotsXml', IHM_SRC_DIR.'public/WebServices/XML/AmdaPlots.xml'); // Web Service getPlot : list of parameters to plot | |
116 | +define('plotsXml', IHM_SRC_DIR . 'public/WebServices/XML/AmdaPlots.xml'); // Web Service getPlot : list of parameters to plot | |
115 | 117 | |
116 | 118 | // Web Service servers WSDL : $_SERVER['SERVER_NAME'] (par apache) gethostname() (par command) |
117 | -$SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname(); | |
119 | +$SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname(); | |
118 | 120 | |
119 | -define('webAlias',"http://".$SERVER_NAME.APACHE_ALIAS); | |
120 | -define('wsdl_AMDA', webAlias."public/wsdl/Methods_AMDA.wsdl"); | |
121 | +define('webAlias', "http://" . $SERVER_NAME . APACHE_ALIAS); | |
122 | +define('wsdl_AMDA', webAlias . "public/wsdl/Methods_AMDA.wsdl"); | |
121 | 123 | |
122 | 124 | // Time interval between 2 queries before to ask for a new authentification, in seconds. |
123 | -define ('timeLimitQuery', 600); | |
125 | +define('timeLimitQuery', 600); // 10 minutes | |
126 | + | |
124 | 127 | /*-------------------END WEB SERVICES section ---------*/ |
125 | 128 | |
126 | 129 | // AKKA - KERNELBIN is now the new kernel bin dir |
127 | -define('KERNELBIN',NEWKERNEL_INSTALL_DIR.'bin/'); | |
130 | +define('KERNELBIN', NEWKERNEL_INSTALL_DIR . 'bin/'); | |
128 | 131 | |
129 | -putenv("LD_LIBRARY_PATH=".SYS_LIBS.":".DDLIB.":".CEFLIB.":".CDFLIB); | |
130 | -putenv("PATH=./:".DDBIN.":".SYS_BIN.":".IHM_SRC_DIR."php/bin"); | |
132 | +putenv("LD_LIBRARY_PATH=" . SYS_LIBS . ":" . DDLIB . ":" . CEFLIB . ":" . CDFLIB); | |
133 | +putenv("PATH=./:" . DDBIN . ":" . SYS_BIN . ":" . IHM_SRC_DIR . "php/bin"); | |
131 | 134 | |
132 | -putenv("DDPATH=".DDRES_DIR); | |
135 | +putenv("DDPATH=" . DDRES_DIR); | |
133 | 136 | |
134 | 137 | // PHP classes |
135 | -define('XMLPATH', IHM_SRC_DIR.'php/XML/'); | |
136 | -define('CLASSPATH', IHM_SRC_DIR.'php/classes/'); | |
137 | -define('REMOTE_CLASSPATH', IHM_SRC_DIR.'php/RemoteDataCenter/'); | |
138 | -define('OLD_CLASSPATH', IHM_SRC_DIR.'php/old_amda/'); | |
139 | - | |
140 | -set_include_path(".:".CLASSPATH.":".REMOTE_CLASSPATH.":".OLD_CLASSPATH); | |
141 | - | |
142 | -if (!function_exists('__autoload')) | |
143 | -{ | |
144 | - function __autoload($class_name) { | |
145 | - require_once $class_name . '.php'; | |
146 | - } | |
138 | +define('XMLPATH', IHM_SRC_DIR . 'php/XML/'); | |
139 | +define('CLASSPATH', IHM_SRC_DIR . 'php/classes/'); | |
140 | +define('REMOTE_CLASSPATH', IHM_SRC_DIR . 'php/RemoteDataCenter/'); | |
141 | +define('OLD_CLASSPATH', IHM_SRC_DIR . 'php/old_amda/'); | |
142 | + | |
143 | +set_include_path(".:" . CLASSPATH . ":" . REMOTE_CLASSPATH . ":" . OLD_CLASSPATH); | |
144 | + | |
145 | +if (!function_exists('__autoload')) { | |
146 | + function __autoload($class_name) | |
147 | + { | |
148 | + require_once $class_name . '.php'; | |
149 | + } | |
147 | 150 | } |
148 | 151 | |
149 | 152 | global $API; |
150 | -$API = array( | |
151 | - 'AmdaAction'=>array( | |
152 | - 'methods'=>array( | |
153 | - 'getTree'=>array('len'=>1), | |
154 | - 'saveTree'=>array('len'=>1), | |
155 | - 'getInfo'=>array('len'=>1), | |
156 | - 'doNothing'=>array('len'=>1), | |
157 | - 'deleteFromTree'=>array('len'=>1), | |
158 | - 'getObject'=>array('len'=>2), | |
159 | - 'getAsciiFile'=>array('len'=>1), | |
160 | - 'getTmpObject'=>array('len'=>3), | |
161 | - 'getUploadedObject'=>array('len'=>3), | |
162 | - 'getMyParamInfo'=>array('len'=>1), | |
163 | - 'deleteObject'=>array('len'=>1), | |
164 | - 'renameObject'=>array('len'=>1), | |
165 | - 'createObject'=>array('len'=>2), | |
166 | - 'modifyObject'=>array('len'=>1), | |
167 | - 'validNameObject'=>array('len'=>1), | |
168 | - 'getJobs'=>array('len'=>0), | |
169 | - 'execute'=>array('len'=>2), | |
170 | - //'formHandler'=>true | |
171 | - 'compilParam'=>array('len'=>1), | |
172 | - 'compilParamDelete'=>array('len'=>1), | |
173 | - 'killPlotRequest'=>array('len'=>0), | |
174 | - 'merge'=>array('len'=>1), | |
175 | - 'intersect'=>array('len'=>1), | |
176 | - 'loadTTIntervals'=>array('len'=>1), | |
177 | - 'saveTTCacheIntervalsInTT'=>array('len'=>1), | |
178 | - 'initTTCache'=>array ('len'=>2), | |
179 | - 'initTTCacheFromTT'=>array('len'=>2), | |
180 | - 'initForChart'=>array('len'=>4), | |
181 | - 'initTTCacheFromTmpObject'=>array('len'=>3), | |
182 | - 'initTTCacheFromUploadedFile'=>array('len'=>3), | |
183 | - 'readTTCacheIntervals'=>array('len'=>1), | |
184 | - 'readIntervalsForChart'=>array('len'=>1), | |
185 | - 'addTTCacheInterval'=>array('len'=>1), | |
186 | - 'removeTTCacheIntervalFromId'=>array('len'=>2), | |
187 | - 'modifyTTCacheInterval'=>array('len'=>1), | |
188 | - 'operationTTCacheIntervals'=>array('len'=>2), | |
189 | - 'mergeTTCacheIntervals'=>array('len'=>0), | |
190 | - 'getTTCacheStatistics'=>array('len'=>0), | |
191 | - 'sendFeedback'=>array('len'=>1), | |
192 | - 'saveState'=>array('len'=>1), | |
193 | - 'loadState'=>array('len'=>1), | |
194 | - 'sendToSAMP'=>array('len'=>1), | |
195 | - 'getHstImagesUrl'=>array('len'=>1), | |
196 | - 'getAPISImagesUrl'=>array('len'=>1), | |
197 | - 'loadFilterList'=>array('len'=>0), | |
198 | - 'loadFilters'=>array('len'=>1), | |
199 | - 'saveFilter'=>array('len'=>1), | |
200 | - 'createFilter'=>array('len'=>1), | |
201 | - 'destroyFilter'=>array('len'=>1), | |
202 | - 'getCrtFilterId'=>array('len'=>0), | |
203 | - 'getCrtFilterResult'=>array('len'=>0), | |
204 | - 'setCrtFilterId'=>array('len'=>1), | |
205 | - 'resetFilter'=>array('len'=>0), | |
206 | - 'logout'=>array('len'=>1), | |
207 | - 'getUserInfo'=>array('len'=>0), | |
208 | - 'convertWS'=>array('len'=>0), | |
209 | - 'getRun'=>array('len'=>1), | |
210 | - 'addRun'=>array('len'=>1), | |
211 | - //AKKA - New action to clean user WS | |
212 | - 'cleanUserWS'=>array('len'=>0), | |
213 | - 'deleteSpecialInfo'=>array('len'=>1), | |
214 | - 'interactivePlot'=>array('len'=>2), | |
215 | - 'getParamPlotInit'=>array('len'=>1), | |
216 | - 'getParamInfo'=>array('len'=>1), | |
217 | - 'getSharedObjectFolders' => array('len'=>1), | |
218 | - 'shareObjects' => array('len'=>1), | |
219 | - 'isSharedObjectNameAlreadyUsed' => array('len'=>1) | |
220 | - ) | |
221 | - ) | |
222 | -); | |
153 | +$API = array('AmdaAction' => array('methods' => array( | |
154 | + 'getTree' => array('len' => 1), | |
155 | + 'saveTree' => array('len' => 1), | |
156 | + 'getInfo' => array('len' => 1), | |
157 | + 'doNothing' => array('len' => 1), | |
158 | + 'deleteFromTree' => array('len' => 1), | |
159 | + 'getObject' => array('len' => 2), | |
160 | + 'getAsciiFile' => array('len' => 1), | |
161 | + 'getTmpObject' => array('len' => 3), | |
162 | + 'getUploadedObject' => array('len' => 3), | |
163 | + 'getMyParamInfo' => array('len' => 1), | |
164 | + 'deleteObject' => array('len' => 1), | |
165 | + 'renameObject' => array('len' => 1), | |
166 | + 'createObject' => array('len' => 2), | |
167 | + 'modifyObject' => array('len' => 1), | |
168 | + 'validNameObject' => array('len' => 1), | |
169 | + 'getJobs' => array('len' => 0), | |
170 | + 'execute' => array('len' => 2), | |
171 | + //'formHandler'=>true | |
172 | + 'compilParam' => array('len' => 1), | |
173 | + 'compilParamDelete' => array('len' => 1), | |
174 | + 'killPlotRequest' => array('len' => 0), | |
175 | + 'merge' => array('len' => 1), | |
176 | + 'intersect' => array('len' => 1), | |
177 | + 'loadTTIntervals' => array('len' => 1), | |
178 | + 'saveTTCacheIntervalsInTT' => array('len' => 1), | |
179 | + 'initTTCache' => array('len' => 2), | |
180 | + 'initTTCacheFromTT' => array('len' => 2), | |
181 | + 'initForChart' => array('len' => 4), | |
182 | + 'initTTCacheFromTmpObject' => array('len' => 3), | |
183 | + 'initTTCacheFromUploadedFile' => array('len' => 3), | |
184 | + 'readTTCacheIntervals' => array('len' => 1), | |
185 | + 'readIntervalsForChart' => array('len' => 1), | |
186 | + 'addTTCacheInterval' => array('len' => 1), | |
187 | + 'removeTTCacheIntervalFromId' => array('len' => 2), | |
188 | + 'modifyTTCacheInterval' => array('len' => 1), | |
189 | + 'operationTTCacheIntervals' => array('len' => 2), | |
190 | + 'mergeTTCacheIntervals' => array('len' => 0), | |
191 | + 'getTTCacheStatistics' => array('len' => 0), | |
192 | + 'sendFeedback' => array('len' => 1), | |
193 | + 'saveState' => array('len' => 1), | |
194 | + 'loadState' => array('len' => 1), | |
195 | + 'sendToSAMP' => array('len' => 1), | |
196 | + 'getHstImagesUrl' => array('len' => 1), | |
197 | + 'getAPISImagesUrl' => array('len' => 1), | |
198 | + 'loadFilterList' => array('len' => 0), | |
199 | + 'loadFilters' => array('len' => 1), | |
200 | + 'saveFilter' => array('len' => 1), | |
201 | + 'createFilter' => array('len' => 1), | |
202 | + 'destroyFilter' => array('len' => 1), | |
203 | + 'getCrtFilterId' => array('len' => 0), | |
204 | + 'getCrtFilterResult' => array('len' => 0), | |
205 | + 'setCrtFilterId' => array('len' => 1), | |
206 | + 'resetFilter' => array('len' => 0), | |
207 | + 'logout' => array('len' => 1), | |
208 | + 'getUserInfo' => array('len' => 0), | |
209 | + 'convertWS' => array('len' => 0), | |
210 | + 'getRun' => array('len' => 1), | |
211 | + 'addRun' => array('len' => 1), | |
212 | + //AKKA - New action to clean user WS | |
213 | + 'cleanUserWS' => array('len' => 0), | |
214 | + 'deleteSpecialInfo' => array('len' => 1), | |
215 | + 'interactivePlot' => array('len' => 2), | |
216 | + 'getParamPlotInit' => array('len' => 1), | |
217 | + 'getParamInfo' => array('len' => 1), | |
218 | + 'getSharedObjectFolders' => array('len' => 1), | |
219 | + 'shareObjects' => array('len' => 1), | |
220 | + 'isSharedObjectNameAlreadyUsed' => array('len' => 1) | |
221 | +))); | |
223 | 222 | ?> | ... | ... |
php/my_config.php
... | ... | @@ -7,11 +7,11 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | //AKKA - Path to AMDA_Integration base dir |
10 | -define('INTEGRATION_BASE_PATH', '/home/benjamin/AMDA-GIT/AMDA_Integration/'); | |
10 | +define('INTEGRATION_BASE_PATH', '/AMDA/AMDA_Integration/'); | |
11 | 11 | |
12 | 12 | require_once(INTEGRATION_BASE_PATH.'config/AMDAIntegrationConfig.php'); |
13 | 13 | |
14 | -define('CEFLIB', '/usr/local/cef/lib'); | |
14 | +define('CEFLIB', '/opt/local/cef/lib'); | |
15 | 15 | define('CDFLIB', '/opt/local/lib'); |
16 | 16 | define('SYS_LIBS', '/lib:/usr/lib:/usr/local/lib64'); |
17 | 17 | define('SYS_BIN','/bin:/usr/bin/:/usr/local/bin/'); |
... | ... | @@ -26,9 +26,9 @@ define('log', IHM_SRC_DIR.'LOG'); |
26 | 26 | // User apache |
27 | 27 | define('APACHE_USER', 'apache'); |
28 | 28 | // Alias for name of AMDA |
29 | -define('APACHE_ALIAS', '/NEWAMDA-BENJAMIN/'); | |
29 | +define('APACHE_ALIAS', '/NEWAMDA-NJOURDANE/'); | |
30 | 30 | //email to send errors from AmdaUpdate/AmdaInstall |
31 | -define('email','brenard@irap.omp.eu'); | |
31 | +define('email','nathanael.jourdane@irap.omp.eu'); | |
32 | 32 | |
33 | 33 | //DDPATH |
34 | 34 | define('DDBIN','/opt/local/bin/'); |
... | ... | @@ -36,7 +36,7 @@ define('DDLIB','/opt/local/lib/'); |
36 | 36 | |
37 | 37 | // for updateAmda |
38 | 38 | define('DD_WSDL','http://amda-dev.irap.omp.eu/BASE/DDService/dd.wsdl'); |
39 | -define('TITLE', 'AMDANEW-Test'); | |
39 | +define('TITLE', 'NEWAMDA-NJOURDANE'); | |
40 | 40 | |
41 | 41 | $is64 = true; |
42 | 42 | ... | ... |
php/rest/getDatasetData.php
... | ... | @@ -11,23 +11,22 @@ require_once '../config.php'; |
11 | 11 | |
12 | 12 | $amda_ws = new WebServer(); |
13 | 13 | |
14 | -if (!$_GET["token"]) { | |
15 | - return array('success' => false, 'message' => "E01\nAuthentication is required for this webservice."); | |
16 | -} | |
17 | -if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { | |
18 | - return array('success' => false, 'message' => "E02\nToken expired. Please authenticate again."); | |
14 | +if (!key_exists("token", $_GET)) { | |
15 | + $result = array('success' => false, 'message' => "E01: Authentication is required for this webservice."); | |
16 | +} else if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { | |
17 | + $result = array('success' => false, 'message' => "E02: Token expired. Please authenticate again."); | |
18 | +} else { | |
19 | + $result = $amda_ws->getDataset($_GET); | |
19 | 20 | } |
20 | 21 | |
21 | -$result = $amda_ws->getDataset($_GET); | |
22 | - | |
23 | 22 | if ($result['success']) { |
24 | 23 | $file = str_replace("http://oberoi.cesr.fr/AMDA-WS/", BASE_PATH, $result['dataFileURLs']); |
25 | 24 | |
26 | 25 | if ($file) { |
27 | 26 | // header('Content-type: text/xml'); |
28 | -// $contenu = file_get_contents($file); | |
29 | -// error_log($contenu,3,'/home/natacha/TMP/tmp.xml'); | |
30 | -// echo $contenu; | |
27 | +// $contenu = file_get_contents($file); | |
28 | +// error_log($contenu,3,'/home/natacha/TMP/tmp.xml'); | |
29 | +// echo $contenu; | |
31 | 30 | |
32 | 31 | header('Content-type: text/xml'); |
33 | 32 | $doc = new DOMDocument(); | ... | ... |
php/rest/getOrbites.php
... | ... | @@ -12,15 +12,14 @@ require_once '../config.php'; |
12 | 12 | |
13 | 13 | $amda_ws = new WebServer(); |
14 | 14 | |
15 | -if (!$_GET["token"]) { | |
16 | - return array('success' => false, 'message' => "E01\nAuthentication is required for this webservice."); | |
17 | -} | |
18 | -if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { | |
19 | - return array('success' => false, 'message' => "E02\nToken expired. Please authenticate again."); | |
15 | +if (!key_exists("token", $_GET)) { | |
16 | + $result = array('success' => false, 'message' => "E01: Authentication is required for this webservice."); | |
17 | +} else if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { | |
18 | + $result = array('success' => false, 'message' => "E02: Token expired. Please authenticate again."); | |
19 | +} else { | |
20 | + $result = $amda_ws->getOrbites($_GET); | |
20 | 21 | } |
21 | 22 | |
22 | -$result = $amda_ws->getOrbites($_GET); | |
23 | - | |
24 | 23 | if ($result['success']) { |
25 | 24 | echo $result['dataFileURLs']; |
26 | 25 | } else { | ... | ... |
php/rest/getParameter.php
... | ... | @@ -12,15 +12,14 @@ require_once '../config.php'; |
12 | 12 | |
13 | 13 | $amda_ws = new WebServer(); |
14 | 14 | |
15 | -if (!$_GET["token"]) { | |
16 | - return array('success' => false, 'message' => "E01\nAuthentication is required for this webservice."); | |
17 | -} | |
18 | -if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { | |
19 | - return array('success' => false, 'message' => "E02\nToken expired. Please authenticate again."); | |
15 | +if (!key_exists("token", $_GET)) { | |
16 | + $result = array('success' => false, 'message' => "E01: Authentication is required for this webservice."); | |
17 | +} else if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { | |
18 | + $result = array('success' => false, 'message' => "E02: Token expired. Please authenticate again."); | |
19 | +} else { | |
20 | + $result = $amda_ws->getParameter($_GET); | |
20 | 21 | } |
21 | 22 | |
22 | -$result = $amda_ws->getParameter($_GET); | |
23 | - | |
24 | 23 | if ($result['success']) { |
25 | 24 | echo $result['dataFileURLs']; |
26 | 25 | } else { | ... | ... |