Exemplo n.º 1
0
function getBody($link, $id)
{
    $body = false;
    if ($link == 'messages') {
        $msg = new suxThreadedMessages();
        $body = $msg->getByID($id);
        $body = "{$body['title']} \n\n {$body['body_plaintext']}";
    } elseif ($link == 'rss_items') {
        $rss = new suxRSS();
        $body = $rss->getItemByID($id);
        $body = "{$body['title']} \n\n {$body['body_plaintext']}";
    } elseif ($link == 'bookmarks') {
        $bm = new suxBookmarks();
        $body = $bm->getByID($id);
        $body = "{$body['title']} \n\n {$body['body_plaintext']}";
    }
    return $body;
}
Exemplo n.º 2
0
/**
* Render edit div
*
*/
function insert_edit($params)
{
    if (!isset($_SESSION['users_id'])) {
        return null;
    }
    if (!isset($params['id'])) {
        return null;
    }
    // Cache
    static $allowed = null;
    // Admin permissions
    $allowed2 = true;
    // Publisher permissions
    if ($allowed == null) {
        // Check if a user is an administrator
        $u = new suxUser();
        $allowed = true;
        if (!$u->isRoot()) {
            $access = $u->getAccess('blog');
            if ($access < $GLOBALS['CONFIG']['ACCESS']['blog']['admin']) {
                $allowed = false;
            }
        }
    }
    if (!$allowed) {
        // Check if a user is the publisher of the message
        $m = new suxThreadedMessages();
        $m->setPublished(null);
        if ($access < $GLOBALS['CONFIG']['ACCESS']['blog']['publisher']) {
            $allowed = false;
            $allowed2 = false;
        } else {
            $tmp = $m->getByID($params['id']);
            if ($tmp['users_id'] != $_SESSION['users_id']) {
                $allowed2 = false;
            }
        }
        if (!$allowed2) {
            return null;
        }
    }
    $url = suxFunct::makeUrl('/blog/edit/' . $params['id']);
    $text = suxFunct::gtext('blog');
    $html = "<div class='edit'>[ <a href='{$url}'>{$text['edit']}</a> ]</div>";
    return $html;
}