/** * * Get smarty object to assign variables */ function get_smarty() { return CODOF\Smarty\Single::get_instance(); }
echo 'Unable to run cron ' . $name . ' because another cron is already running'; } } //exit; }); //-------------PAGES-------------------------- dispatch_get('/page/:id/:url', function ($id, $url) { $pid = (int) $id; $user = \CODOF\User\User::get(); $qry = 'SELECT title, content FROM ' . PREFIX . 'codo_pages p ' . ' LEFT JOIN ' . PREFIX . 'codo_page_roles r ON r.pid=p.id ' . ' WHERE (r.rid IS NULL OR (r.rid IS NOT NULL AND r.rid IN (' . implode($user->rids) . ')))' . ' AND p.id=' . $pid; $res = \DB::getPDO()->query($qry); $row = $res->fetch(); if ($row) { $title = $row['title']; $content = $row['content']; $smarty = CODOF\Smarty\Single::get_instance(); $smarty->assign('contents', $content); \CODOF\Store::set('sub_title', $title); \CODOF\Smarty\Layout::load('page'); \CODOF\Hook::call('on_page_load', array($id)); } else { $page = \DB::table(PREFIX . 'codo_pages')->where('id', $id)->first(); if ($page == null) { \CODOF\Smarty\Layout::not_found(); } else { \CODOF\Smarty\Layout::access_denied(); } } }); //-------------USER------------------------------------------------------------- dispatch_get('/user/logout', function () {