Fix API request
This commit is contained in:
parent
e3c173bea4
commit
d7bbb4d18f
@ -48,7 +48,28 @@ $ui = new class($key)
|
|||||||
}
|
}
|
||||||
function getAll()
|
function getAll()
|
||||||
{
|
{
|
||||||
return $this->assign;
|
|
||||||
|
$result = [];
|
||||||
|
foreach ($this->assign as $key => $value) {
|
||||||
|
if($value instanceof ORM){
|
||||||
|
$result[$key] = $value->as_array();
|
||||||
|
}else if($value instanceof IdiormResultSet){
|
||||||
|
$count = count($value);
|
||||||
|
for($n=0;$n<$count;$n++){
|
||||||
|
foreach ($value[$n] as $k=>$v) {
|
||||||
|
$result[$key][$n][$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$result[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetch()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ class Csrf
|
|||||||
|
|
||||||
public static function check($token)
|
public static function check($token)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config, $isApi;
|
||||||
if($config['csrf_enabled'] == 'yes') {
|
if($config['csrf_enabled'] == 'yes' && !$isApi) {
|
||||||
if (isset($_SESSION['csrf_token'], $_SESSION['csrf_token_time'], $token)) {
|
if (isset($_SESSION['csrf_token'], $_SESSION['csrf_token_time'], $token)) {
|
||||||
$storedToken = $_SESSION['csrf_token'];
|
$storedToken = $_SESSION['csrf_token'];
|
||||||
$tokenTime = $_SESSION['csrf_token_time'];
|
$tokenTime = $_SESSION['csrf_token_time'];
|
||||||
|
@ -10,7 +10,7 @@ class Paginator
|
|||||||
{
|
{
|
||||||
public static function findMany($query, $search = [], $per_page = '10', $append_url = "", $toArray = false)
|
public static function findMany($query, $search = [], $per_page = '10', $append_url = "", $toArray = false)
|
||||||
{
|
{
|
||||||
global $routes, $ui;
|
global $routes, $ui, $isApi;
|
||||||
$adjacents = "2";
|
$adjacents = "2";
|
||||||
$page = _get('p', 1);
|
$page = _get('p', 1);
|
||||||
$page = (empty($page) ? 1 : $page);
|
$page = (empty($page) ? 1 : $page);
|
||||||
@ -72,7 +72,7 @@ class Paginator
|
|||||||
if ($ui) {
|
if ($ui) {
|
||||||
$ui->assign('paginator', $result);
|
$ui->assign('paginator', $result);
|
||||||
}
|
}
|
||||||
if($toArray){
|
if($toArray || $isApi){
|
||||||
return $query->offset($startpoint)->limit($per_page)->find_array();
|
return $query->offset($startpoint)->limit($per_page)->find_array();
|
||||||
}else{
|
}else{
|
||||||
return $query->offset($startpoint)->limit($per_page)->find_many();
|
return $query->offset($startpoint)->limit($per_page)->find_many();
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input name="coordinates" id="coordinates" class="form-control" value=""
|
<input name="coordinates" id="coordinates" class="form-control" value=""
|
||||||
placeholder="6.465422, 3.406448">
|
placeholder="-6.465422, 3.406448">
|
||||||
<div id="map" style="width: '100%'; height: 200px; min-height: 150px;"></div>
|
<div id="map" style="width: '100%'; height: 200px; min-height: 150px;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -98,9 +98,11 @@
|
|||||||
<div class="panel-heading">PPPoE</div>
|
<div class="panel-heading">PPPoE</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">{Lang::T('Usernames')} <span class="label label-danger" id="warning_username"></span></label>
|
<label class="col-md-3 control-label">{Lang::T('Usernames')} <span class="label label-danger"
|
||||||
|
id="warning_username"></span></label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input type="username" class="form-control" id="pppoe_username" name="pppoe_username" onkeyup="checkUsername(this, '0')">
|
<input type="username" class="form-control" id="pppoe_username" name="pppoe_username"
|
||||||
|
onkeyup="checkUsername(this, '0')">
|
||||||
<span class="help-block">{Lang::T('Not Working for freeradius')}</span>
|
<span class="help-block">{Lang::T('Not Working for freeradius')}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -112,9 +114,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">Remote IP <span class="label label-danger" id="warning_ip"></span></label>
|
<label class="col-md-3 control-label">Remote IP <span class="label label-danger"
|
||||||
|
id="warning_ip"></span></label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input type="text" class="form-control" id="pppoe_ip" name="pppoe_ip" onkeyup="checkIP(this, '0')">
|
<input type="text" class="form-control" id="pppoe_ip" name="pppoe_ip"
|
||||||
|
onkeyup="checkIP(this, '0')">
|
||||||
<span class="help-block">{Lang::T('Also Working for freeradius')}</span>
|
<span class="help-block">{Lang::T('Also Working for freeradius')}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -204,7 +208,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<center>
|
<center>
|
||||||
<button class="btn btn-primary" onclick="return ask(this, '{Lang::T("Continue the process of adding Customer Data?")}')" type="submit">
|
<button class="btn btn-primary"
|
||||||
|
onclick="return ask(this, '{Lang::T("Continue the process of adding Customer Data?")}')" type="submit">
|
||||||
{Lang::T('Save Changes')}
|
{Lang::T('Save Changes')}
|
||||||
</button>
|
</button>
|
||||||
<br><a href="{Text::url('customers/list')}" class="btn btn-link">{Lang::T('Cancel')}</a>
|
<br><a href="{Text::url('customers/list')}" class="btn btn-link">{Lang::T('Cancel')}</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user