コード例 #1
0
function popComments($id)
{
    global $sitename, $s, $thisarticle;
    $preview = gps('preview');
    $h3 = $preview ? hed(gTxt('message_preview'), 3) : '';
    $discuss = discuss($id);
    ob_start('parse');
    $out = fetch_form('popup_comments');
    $out = str_replace("<txp:popup_comments />", $discuss, $out);
    return $out;
}
コード例 #2
0
ファイル: taghandlers.php プロジェクト: bgarrels/textpattern
function comments_preview($atts, $thing = '', $me = '')
{
    global $thisarticle;
    if (!ps('preview')) {
        return;
    }
    extract(lAtts(array('id' => @$pretext['id'], 'form' => 'comments', 'bc' => false, 'wraptag' => '', 'class' => __FUNCTION__), $atts));
    //FIXME for crockery. This emulates the old hardcoded preview behaviour.
    if ($bc) {
        if (@$GLOBALS['pretext']['secondpass'] == false) {
            return $me;
        }
        if (@$GLOBALS['pretext']['comments_preview_shown']) {
            return '';
        } else {
            return '<a id="cpreview"></a>' . discuss($id);
        }
    }
    $GLOBALS['pretext']['comments_preview_shown'] = true;
    if (is_array($thisarticle)) {
        extract($thisarticle);
    }
    if (@$thisid) {
        $id = $thisid;
    }
    $Form = fetch_form($form);
    $preview = psas(array('name', 'email', 'web', 'message', 'parentid', 'remember'));
    $preview['time'] = time();
    $preview['discussid'] = 0;
    $preview['message'] = markup_comment($preview['message']);
    $GLOBALS['thiscomment'] = $preview;
    $comments = parse($Form) . n;
    unset($GLOBALS['thiscomment']);
    $out = doTag($comments, $wraptag, $class);
    return $out;
}
コード例 #3
0
ファイル: publish.php プロジェクト: bgarrels/textpattern
function doArticle($atts)
{
    global $pretext, $prefs;
    extract($prefs);
    extract($pretext);
    $preview = ps('preview');
    $parentid = ps('parentid');
    extract(lAtts(array('form' => 'default', 'status' => ''), $atts));
    if ($status and !is_numeric($status)) {
        $status = getStatusNum($status);
    }
    $q_status = $status ? "and Status='" . doSlash($status) . "'" : 'and Status in (4,5)';
    $rs = safe_row("*, unix_timestamp(Posted) as uPosted", "textpattern", "ID='{$id}' {$q_status} limit 1");
    if ($rs) {
        extract($rs);
        populateArticleData($rs);
        // define the article form
        $article = fetch_form($override_form ? $override_form : $form);
        if ($preview && $parentid) {
            $article = '<a id="cpreview"></a>' . discuss($parentid) . $article;
        }
        $article = parse($article);
        if ($use_comments and $comments_auto_append) {
            $f = fetch_form('comments_display');
            $article .= parse($f);
        }
        unset($GLOBALS['thisarticle']);
        return $article;
    }
}
コード例 #4
0
ファイル: publish.php プロジェクト: bgarrels/textpattern
function doArticle($atts)
{
    global $pretext, $prefs;
    extract($prefs);
    extract($pretext);
    if (is_array($atts)) {
        extract($atts);
    }
    $preview = ps('preview');
    $parentid = ps('parentid');
    if (empty($form)) {
        $form = 'default';
    }
    $Form = fetch('Form', 'txp_form', 'name', $form);
    $rs = safe_row("*, unix_timestamp(Posted) as uPosted", "textpattern", "ID='{$id}' and Status='4' limit 1");
    $GLOBALS['is_article_list'] = false;
    if ($rs) {
        extract($rs);
        $com_count = safe_count('txp_discuss', "parentid={$ID} and visible=1");
        $author = fetch('RealName', 'txp_users', 'name', $AuthorID);
        $author = !$author ? $AuthorID : $author;
        $out['thisid'] = $id;
        $out['posted'] = $uPosted;
        $out['comments_invite'] = '';
        $out['mentions_link'] = '';
        $out['if_comments'] = ($Annotate or $com_count) ? true : false;
        $out['comments_count'] = $com_count;
        $out['author'] = $author;
        $out['permlink'] = formatPermLink($ID, $Section);
        $out['body'] = parse($Body_html);
        $out['excerpt'] = $Excerpt;
        $out['title'] = $Title;
        $out['url_title'] = $url_title;
        $out['category1'] = $Category1;
        $out['category2'] = $Category2;
        $out['section'] = $Section;
        $out['keywords'] = $Keywords;
        $out['article_image'] = $Image;
        $GLOBALS['thisarticle'] = $out;
        // define the article form
        $article = $override_form ? fetch('Form', 'txp_form', 'name', $override_form) : $Form;
        // quick check for things not pulled from the db
        $article = doPermlink($article, $out['permlink'], $Title, $url_title);
        #			include txpath.'/publish/mention.php';
        #			$article .= show_mentions();
        if ($preview && $parentid) {
            $article = discuss($parentid) . $article;
        }
        if (($Annotate or $com_count) && !$preview) {
            if ($use_comments) {
                $article .= discuss($ID);
            }
        }
        return parse($article);
    }
    return '';
}