File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change 2424// Security check
2525OA_Permission::enforceAccount (OA_ACCOUNT_MANAGER , OA_ACCOUNT_ADVERTISER );
2626
27-
2827$ aEntityMap = [];
28+ $ idx = 0 ;
2929
3030if (!empty ($ clientid )) {
3131 if (!OA_Permission::hasAccessToObject ('clients ' , $ clientid )) {
3939
4040 foreach ($ aCampaigns as $ campaignId => $ aCampaign ) {
4141 $ campaignName = $ aCampaign ['name ' ];
42- $ aEntityMap [$ campaignId ] = $ campaignName ;
42+ $ aEntityMap [$ campaignId ] = [
43+ 'name ' => $ campaignName ,
44+ 'idx ' => $ idx ++,
45+ ];
4346 }
4447}
4548
49+ MAX_header ('Content-Type: application/json ' );
4650
47-
48- if (count ($ aEntityMap )) {
49- $ idx = 0 ;
50- foreach ($ aEntityMap as $ k => $ v ) {
51- $ aEntityMap [$ k ] = $ k . ': { "name": " ' . addslashes ($ v ) . '","idx":" ' . ($ idx ++) . '" } ' ;
52- }
53-
54- echo "{ " . implode (', ' , $ aEntityMap ) . "} " ;
55- exit ;
56- }
57-
58- echo "{ } " ;
51+ echo json_encode ($ aEntityMap , JSON_FORCE_OBJECT );
You can’t perform that action at this time.
0 commit comments