mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Comment 'share' preparation
This commit is contained in:
33
comment.php
33
comment.php
@@ -113,30 +113,35 @@ if(e_AJAX_REQUEST) // TODO improve security
|
||||
if(vartrue($_POST['comment'])) // ajax render comment
|
||||
{
|
||||
$pid = intval(varset($_POST['pid'], 0)); // ID of the specific comment being edited (nested comments - replies)
|
||||
|
||||
$row = array();
|
||||
$clean_authorname = $_POST['author_name'];
|
||||
$clean_comment = $_POST['comment'];
|
||||
$clean_subject = $_POST['subject'];
|
||||
|
||||
$_SESSION['comment_author_name'] = $clean_authorname;
|
||||
|
||||
$newid = e107::getComment()->enter_comment($clean_authorname, $clean_comment, $_POST['table'], intval($_POST['itemid']), $pid, $clean_subject);
|
||||
|
||||
$row['comment_item_id'] = intval($_POST['itemid']);
|
||||
$row['comment_type'] = e107::getComment()->getCommentType($tp->toDB($_POST['table'],true));
|
||||
$row['comment_subject'] = $tp->toDB($_POST['subject']);
|
||||
$row['comment_comment'] = $tp->toDB($_POST['comment']);
|
||||
$row['user_image'] = USERIMAGE;
|
||||
$row['user_id'] = (USERID) ? USERID : 0;
|
||||
$row['user_name'] = USERNAME;
|
||||
$row['comment_author_name'] = $tp->toDB($clean_authorname);
|
||||
$row['comment_datestamp'] = time();
|
||||
$row['comment_blocked'] = (check_class($pref['comments_moderate']) ? 2 : 0);
|
||||
$row['comment_share'] = ($_POST['comment_share']);
|
||||
|
||||
$newid = e107::getComment()->enter_comment($row);
|
||||
|
||||
|
||||
// $newid = e107::getComment()->enter_comment($clean_authorname, $clean_comment, $_POST['table'], intval($_POST['itemid']), $pid, $clean_subject);
|
||||
|
||||
if(is_numeric($newid) && ($_GET['mode'] == 'submit'))
|
||||
{
|
||||
$row = array();
|
||||
$row['comment_id'] = $newid;
|
||||
$row['comment_item_id'] = intval($_POST['itemid']);
|
||||
$row['comment_type'] = e107::getComment()->getCommentType($tp->toDB($_POST['table'],true));
|
||||
$row['comment_subject'] = $tp->toDB($_POST['subject']);
|
||||
$row['comment_comment'] = $tp->toDB($_POST['comment']);
|
||||
$row['user_image'] = USERIMAGE;
|
||||
$row['user_id'] = (USERID) ? USERID : 0;
|
||||
$row['user_name'] = USERNAME;
|
||||
$row['comment_author_name'] = $tp->toDB($clean_authorname);
|
||||
$row['comment_datestamp'] = time();
|
||||
$row['comment_blocked'] = (check_class($pref['comments_moderate']) ? 2 : 0);
|
||||
|
||||
$row['comment_id'] = $newid;
|
||||
$width = ($pid) ? 5 : 0;
|
||||
|
||||
$ret['html'] = "\n<!-- Appended -->\n";
|
||||
|
@@ -103,6 +103,7 @@ CREATE TABLE comments (
|
||||
comment_ip varchar(45) NOT NULL default '',
|
||||
comment_type varchar(20) NOT NULL default '0',
|
||||
comment_lock tinyint(1) unsigned NOT NULL default '0',
|
||||
comment_share tinyint(1) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (comment_id),
|
||||
KEY comment_blocked (comment_blocked),
|
||||
KEY comment_author_id (comment_author_id)
|
||||
|
@@ -372,6 +372,15 @@ class comment_shortcodes extends e_shortcode
|
||||
$SIGNATURE = (isset($this->var['user_signature']) && $this->var['user_signature'] ? $tp->toHTML($this->var['user_signature'], true) : '');
|
||||
return $SIGNATURE;
|
||||
}
|
||||
|
||||
function sc_comment_share($parm='')
|
||||
{
|
||||
return e107::getForm()->checkbox('comment_share',1,true). "Share on Facebook";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -563,7 +563,7 @@ class comment
|
||||
* Add a comment to an item
|
||||
* e-token POST value should be always valid when using this method.
|
||||
*
|
||||
* @param unknown_type $author_name
|
||||
* @param string or array $data - $author_name or array of all values.
|
||||
* @param unknown_type $comment
|
||||
* @param unknown_type $table
|
||||
* @param integer $id - reference of item in source table to which comment is linked
|
||||
@@ -573,9 +573,27 @@ class comment
|
||||
*/
|
||||
|
||||
|
||||
function enter_comment($author_name, $comment, $table, $id, $pid, $subject, $rateindex = FALSE)
|
||||
function enter_comment($data, $comment='', $table='', $id='', $pid='', $subject='', $rateindex = FALSE)
|
||||
{
|
||||
//rateindex : the posted value from the rateselect box (without the urljump) (see function rateselect())
|
||||
|
||||
if(is_array($data))
|
||||
{
|
||||
$table = $data['comment_type'];
|
||||
$id = intval($data['comment_item_id']);
|
||||
$pid = intval($data['comment_pid']);
|
||||
$subject = $data['comment_subject'];
|
||||
$comment = $data['comment_comment'];
|
||||
$author_name = $data['comment_author_name'];
|
||||
$comment_share = intval($data['comment_share']);
|
||||
$comment_datestamp = $data['comment_datestamp'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$author_name = $data; //BC Fix.
|
||||
}
|
||||
|
||||
|
||||
global $e_event,$e107,$rater;
|
||||
|
||||
$sql = e107::getDb();
|
||||
@@ -673,7 +691,8 @@ class comment
|
||||
'comment_blocked' => ($this->moderateComment($pref['comments_moderate']) ? 2 : 0),
|
||||
'comment_ip' => $ip,
|
||||
'comment_type' => $tp->toDB($type, true),
|
||||
'comment_lock' => 0 //Not locked by default
|
||||
'comment_lock' => 0,//Not locked by default
|
||||
'comment_share' => $comment_share
|
||||
);
|
||||
|
||||
//SecretR: new event 'prepostcomment' - allow plugin hooks - e.g. Spam Check
|
||||
|
@@ -77,8 +77,11 @@ $sc_style['AUTHOR_INPUT']['post'] = "";
|
||||
$sc_style['COMMENT_INPUT']['pre'] = "";// COMLAN_8
|
||||
$sc_style['COMMENT_INPUT']['post'] = "";
|
||||
|
||||
$sc_style['COMMENT_BUTTON']['pre'] = "<div id='commentformbutton'>";
|
||||
$sc_style['COMMENT_BUTTON']['post'] = "</div>";
|
||||
$sc_style['COMMENT_BUTTON']['pre'] = "";
|
||||
$sc_style['COMMENT_BUTTON']['post'] = "";
|
||||
|
||||
$sc_style['COMMENT_SHARE']['pre'] = "";
|
||||
$sc_style['COMMENT_SHARE']['post'] = "";
|
||||
|
||||
$sc_style['COMMENT_RATE']['pre'] = '<div class="comment-rate">';
|
||||
$sc_style['COMMENT_RATE']['post'] = '</div>';
|
||||
@@ -101,7 +104,10 @@ $COMMENT_TEMPLATE['FORM'] = "
|
||||
<div class='P10'>
|
||||
{AUTHOR_INPUT}
|
||||
{COMMENT_INPUT}
|
||||
<div id='commentformbutton'>
|
||||
{COMMENT_BUTTON}
|
||||
{COMMENT_SHARE}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user