/** * Check user permission to access the bill * * @return boolean * @param bill_id * */ function api_bill_permitted($bill_id) { global $vars; $res = false; if ($vars['user']['level'] >= 10) { $res = true; } else { api_show_debug("Checking permission for bill", $bill_id); $row = dbFetchRow("SELECT * FROM `entity_permissions` WHERE `entity_type` = 'bill' AND `user_id` = ? AND `entity_id`= ? LIMIT 1", array($vars['user']['id'], $bill_id)); if (is_array($row)) { $res = true; } } api_show_debug("Returned bill permitted", $res); return $res; }
/** * Encrypt data into json format * * @return string * @param data * */ function api_json_data($data) { if (is_array($data)) { $res = json_encode($data); } else { $error = api_errorcodes("402"); $res = json_encode($error); } api_show_debug("Returned JSON data", $data); api_show_debug("Returned Encrypted JSON data", $res); return $res; }
/** * Encrypt data into json format * * @return string * @param data * */ function api_json_data($data) { if (is_array($data)) { $res = json_encode($data); } else { $error = api_errorcodes("402"); $res = json_encode($error); } api_show_debug("返回JSON数据", $data); api_show_debug("返回加密JSON数据", $res); return $res; }