function getSponsoredChannel() { $sponsored_channel = R::getAll(' SELECT * FROM sponsoredchannel WHERE status = 1 AND start_date <= NOW() AND end_date >= NOW() ORDER BY start_date DESC LIMIT 1 '); jsonForAjax($sponsored_channel); }
function updateSettings() { $db_name = 'settings'; $item = R::load($db_name, 1); foreach ($_POST as $key => $val) { if (substr($key, 0, 3) != 'db_') { continue; } $item->{substr($key, 3)} = $val; } $id = R::store($item); $res = new stdClass(); $res->success = $id ? true : false; jsonForAjax($res); }
function jsonError($error) { jsonForAjax(array('error' => $error)); }