예제 #1
0
function comments_form($atts)
{
    global $thisarticle, $has_comments_preview;
    extract(lAtts(array('class' => __FUNCTION__, 'form' => 'comment_form', 'isize' => '25', 'msgcols' => '25', 'msgrows' => '5', 'msgstyle' => '', 'show_preview' => empty($has_comments_preview), 'wraptag' => '', 'previewlabel' => gTxt('preview'), 'submitlabel' => gTxt('submit'), 'rememberlabel' => gTxt('remember'), 'forgetlabel' => gTxt('forget')), $atts));
    assert_article();
    extract($thisarticle);
    $out = '';
    $ip = serverset('REMOTE_ADDR');
    $blacklisted = is_blacklisted($ip);
    if (!checkCommentsAllowed($thisid)) {
        $out = graf(gTxt("comments_closed"), ' id="comments_closed"');
    } elseif (!checkBan($ip)) {
        $out = graf(gTxt('you_have_been_banned'), ' id="comments_banned"');
    } elseif ($blacklisted) {
        $out = graf(gTxt('your_ip_is_blacklisted_by' . ' ' . $blacklisted), ' id="comments_blacklisted"');
    } elseif (gps('commented') !== '') {
        $out = gTxt("comment_posted");
        if (gps('commented') === '0') {
            $out .= " " . gTxt("comment_moderated");
        }
        $out = graf($out, ' id="txpCommentInputForm"');
    } else {
        # display a comment preview if required
        if (ps('preview') and $show_preview) {
            $out = comments_preview(array());
        }
        $out .= commentForm($thisid, $atts);
    }
    return !$wraptag ? $out : doTag($out, $wraptag, $class);
}
page_open(array('sess' => 'SourceAgency_Session'));
if (isset($auth) && !empty($auth->auth['perm'])) {
    page_close();
    page_open(array('sess' => 'SourceAgency_Session', 'auth' => 'SourceAgency_Auth', 'perm' => 'SourceAgency_Perm'));
}
require 'include/header.inc';
require 'include/commentslib.inc';
$bx = new box('80%', $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align);
start_content();
$page = 'comments_edit';
if (check_permission($proid, $page)) {
    top_bar($proid, $page);
    if (is_not_set_or_empty($type)) {
        $type = 'General';
    }
    if (is_not_set_or_empty($number)) {
        $number = 0;
    }
    print $t->translate('General comments can be posted') . ' ' . $t->translate('by registered users of the system') . ".\n<br><p>\n";
    if (is_not_set_or_empty($submit)) {
        if (is_set_and_not_empty($preview)) {
            comments_preview($proid);
        }
        comments_form($proid);
    } else {
        comments_insert($proid, $auth->auth['uname'], $type, $number, $ref, $subject, $text);
    }
}
end_content();
require 'include/footer.inc';
@page_close();
예제 #3
0
function comments_form($atts)
{
    global $thisarticle, $has_comments_preview, $pretext;
    extract(lAtts(array('class' => __FUNCTION__, 'form' => 'comment_form', 'id' => @$pretext['id'], 'isize' => '25', 'msgcols' => '25', 'msgrows' => '5', 'msgstyle' => '', 'show_preview' => empty($has_comments_preview), 'wraptag' => ''), $atts));
    assert_article();
    if (is_array($thisarticle)) {
        extract($thisarticle);
    }
    if (@$thisid) {
        $id = $thisid;
    }
    $out = '';
    if ($id) {
        if (!checkCommentsAllowed($id)) {
            $out = graf(gTxt("comments_closed"));
        } elseif (gps('commented') !== '') {
            $out = gTxt("comment_posted");
            if (gps('commented') === '0') {
                $out .= " " . gTxt("comment_moderated");
            }
            $out = graf($out, ' id="txpCommentInputForm"');
        } else {
            # display a comment preview if required
            if (ps('preview') and $show_preview) {
                $out = comments_preview(array());
            }
            $out .= commentForm($id, $atts);
        }
        return !$wraptag ? $out : doTag($out, $wraptag, $class);
    }
}
예제 #4
0
function comments_form($atts, $thing = null)
{
    global $thisarticle, $has_comments_preview;
    global $thiscommentsform;
    // TODO: Remove any uses of $thiscommentsform when removing deprecated attributes from below.
    // deprecated attributes since TXP 4.6. Most of these (except msgstyle)
    // were moved to the tags that occur within a comments_form, although
    // some of the names changed.
    $deprecated = array('isize', 'msgrows', 'msgcols', 'msgstyle', 'previewlabel', 'submitlabel', 'rememberlabel', 'forgetlabel');
    foreach ($deprecated as $att) {
        if (isset($atts[$att])) {
            trigger_error(gTxt('deprecated_attribute', array('{name}' => $att)), E_USER_NOTICE);
        }
    }
    $atts = lAtts(array('class' => __FUNCTION__, 'form' => 'comment_form', 'isize' => '25', 'msgcols' => '25', 'msgrows' => '5', 'msgstyle' => '', 'show_preview' => empty($has_comments_preview), 'wraptag' => '', 'previewlabel' => gTxt('preview'), 'submitlabel' => gTxt('submit'), 'rememberlabel' => gTxt('remember'), 'forgetlabel' => gTxt('forget')), $atts);
    extract($atts);
    $thiscommentsform = array_intersect_key($atts, array_flip($deprecated));
    assert_article();
    extract($thisarticle);
    $out = '';
    $ip = serverset('REMOTE_ADDR');
    $blacklisted = is_blacklisted($ip);
    if (!checkCommentsAllowed($thisid)) {
        $out = graf(gTxt("comments_closed"), ' id="comments_closed"');
    } elseif ($blacklisted) {
        $out = graf(gTxt('your_ip_is_blacklisted_by' . ' ' . $blacklisted), ' id="comments_blacklisted"');
    } elseif (gps('commented') !== '') {
        $out = gTxt("comment_posted");
        if (gps('commented') === '0') {
            $out .= " " . gTxt("comment_moderated");
        }
        $out = graf($out, ' id="txpCommentInputForm"');
    } else {
        // Display a comment preview if required.
        if (ps('preview') and $show_preview) {
            $out = comments_preview(array());
        }
        extract(doDeEnt(psa(array('parentid', 'backpage'))));
        // If the form fields are filled (anything other than blank), pages really
        // should not be saved by a public cache (rfc2616/14.9.1).
        if (pcs('name') || pcs('email') || pcs('web')) {
            header('Cache-Control: private');
        }
        $url = $GLOBALS['pretext']['request_uri'];
        // Experimental clean URLs with only 404-error-document on Apache possibly
        // requires messy URLs for POST requests.
        if (defined('PARTLY_MESSY') and PARTLY_MESSY) {
            $url = hu . '?id=' . intval($parentid);
        }
        $out .= '<form id="txpCommentInputForm" method="post" action="' . txpspecialchars($url) . '#cpreview">' . n . '<div class="comments-wrapper">' . n . ($thing === null ? parse_form($form) : parse($thing)) . n . hInput('parentid', $parentid ? $parentid : $thisid) . n . hInput('backpage', ps('preview') ? $backpage : $url) . n . '</div>' . n . '</form>';
    }
    return !$wraptag ? $out : doTag($out, $wraptag, $class);
}