示例#1
0
    $_mentions = $_GET['mentions'];
    return $mentioner->getValid($_mentions);
});
Request::get('Ajax/mentions/mentionable/:cid', function ($cid) {
    $mentioner = new CODOF\Forum\Notification\Mention();
    return $mentioner->getNotMentionable($cid);
});
Request::get('Ajax/mentions/:q/:cid/:tid', function ($q, $cid = 0, $tid = 0) {
    $mentioner = new CODOF\Forum\Notification\Mention();
    return $mentioner->find($q, $cid, $tid);
});
dispatch_get('Ajax/cron/run/:name', function ($name) {
    $user = CODOF\User\User::get();
    if (Request::valid($_GET['token']) && $user->hasRoleId(ROLE_ADMIN)) {
        $cron = new \CODOF\Cron\Cron();
        if (!$cron->run($name)) {
            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'];