forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategories.json.php
executable file
·30 lines (30 loc) · 1.26 KB
/
categories.json.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
error_reporting(0);
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'].'objects/category.php';
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$categories = Category::getAllCategories(true);
$total = Category::getTotalCategories(true);
$breaks = array("<br />","<br>","<br/>");
foreach ($categories as $key => $value) {
$categories[$key]['iconHtml'] = "<span class='$value[iconClass]'></span>";
$categories[$key]['description'] = str_ireplace($breaks, "\r\n", $value['description']);
$sql = "SELECT * FROM `category_type_cache` WHERE categoryId = ?";
$res = sqlDAL::readSql($sql,"i",array($value['id']));
$catTypeCache = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if($catTypeCache!=false){
if($catTypeCache['manualSet']=="0"){
$categories[$key]['type'] = "3";
} else {
$categories[$key]['type'] = $catTypeCache['type'];
}
} else {
$categories[$key]['type'] = "3";
}
}
echo '{ "current": '.$_POST['current'].',"rowCount": '.$_POST['rowCount'].', "total": '.$total.', "rows":'. json_encode($categories).'}';