Changeset 887 for trunk/Modules/API/API.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/API/API.php
r874 r887 17 17 class ModuleAPI extends AppModule 18 18 { 19 function __construct( $System)19 function __construct(System $System) 20 20 { 21 21 parent::__construct($System); … … 28 28 } 29 29 30 function DoStart() 30 function DoStart(): void 31 31 { 32 $this->System->RegisterPage( array('api'), 'PageAPI');32 $this->System->RegisterPage(['api'], 'PageAPI'); 33 33 } 34 34 } … … 36 36 class PageAPI extends Page 37 37 { 38 var$DataFormat;39 40 function __construct( $System)38 public string $DataFormat; 39 40 function __construct(System $System) 41 41 { 42 42 parent::__construct($System); 43 43 $this->ClearPage = true; 44 $this->DataFormat = ''; 44 45 } 45 46 46 function Show() 47 function Show(): string 47 48 { 48 49 // p - token … … 50 51 $Token = $_GET['p']; 51 52 $DbResult = $this->Database->query('SELECT `User` FROM `APIToken` WHERE `Token`="'.$Token.'"'); 52 if ($DbResult->num_rows > 0) 53 if ($DbResult->num_rows > 0) 53 54 { 54 55 $DbRow = $DbResult->fetch_assoc(); … … 75 76 } 76 77 77 function ShowList( $Table, $ItemId)78 function ShowList(string $Table, $ItemId): string 78 79 { 79 80 if (($Table != '') and (array_key_exists($Table, $this->System->FormManager->Classes))) … … 84 85 $SourceTable = '('.$FormClass['SQL'].') AS `TX`'; 85 86 else $SourceTable = '`'.$FormClass['Table'].'` AS `TX`'; 86 87 87 88 $Filter = ''; 88 89 if ($ItemId != 0) … … 112 113 $dom->appendChild($root); 113 114 114 $array2xml = function ($node, $array) use ($dom, &$array2xml) 115 $array2xml = function ($node, $array) use ($dom, &$array2xml) 115 116 { 116 117 foreach ($array as $key => $value) 117 118 { 118 if ( is_array($value) ) 119 if ( is_array($value) ) 119 120 { 120 121 if (is_numeric($key)) $key = 'N'.$key; //die('XML tag name "'.$key.'" can\'t be numeric');
Note:
See TracChangeset
for help on using the changeset viewer.