Follow us on Facebook and Twitter!

PhpMyFAQ + Commentics
#1
PhpMyFAQ is Faq System.
http://www.phpmyfaq.de/

Intergration Sample.
But, Don't work "Vote" , and maybe "Flag".
I'm waiting for someone's proposals.

Code:
###########################################
#
# PhpMyFAQ Ver2.7.0 Beta3 + Commentics Ver1.6
#
###########################################
#
# Ver1.0
#
###### PhpMyFAQ ##########################
###------- OPEN -------------
#

index.php

#
###---- Find ----------
# About Line270
#

//
// Create a new Tags object
//
$oTag = new PMF_Tags($db, $Language);

#
##------ After ADD -----------
#

$commentics_css = '';


#
###---- Find ----------
#
    $keywords        = ',' . $faq->getRecordKeywords($id);
    $metaDescription = $faq->getRecordPreview($id);

#
##------ After ADD -----------
#

//Commnetics
    $commentics_css = '<link rel="stylesheet" type="text/css" href="/comments/css/stylesheet.css"/>';


#
###---- Find ----------
# About Line450

$main_template_vars = array(
    'msgRegisterUser'     => '<a href="?' . $sids . 'action=register">' . $PMF_LANG['msgRegisterUser'] . '</a>',
    'msgLoginUser'        => $PMF_LANG['msgLoginUser'],
    'title'               => $faqconfig->get('main.titleFAQ').$title,

#
##------ After ADD -----------
#

    'commentics_css'    => $commentics_css ,


#################################
###------- OPEN -------------
#

template/default/index.tpl

#
###---- Find ----------------------------
# About Line46
#

</head>
<body dir="{dir}">

#
###---- Before ADD ----------------------
#

{commentics_css}


############################################
###------- OPEN -------------
#

artikel.php

#
###---- Find ----------
# About Line250
#

if (!empty($switchLanguage)) {
    $tpl->processBlock('writeContent', 'switchLanguage', array());
}

#
##------ After ADD -----------
# $path_to_comments_folder is absolute(full) path

//commentics
if($faq->faqRecord['id']){
    //session_name("commentics");
    //session_start(); //already been started  
    ob_start();

    ob_start();
        $page_id = $faq->faqRecord['id']; //Uniqe No
        $reference = "cmtx_id";
    // ex./var/www/vhosts/*** commentics/httpdocs/
        $cmtx_absolute path = "/your absolute path /";
        $path_to_comments_folder = "comments/";
        define ('IN_COMMENTICS', 'true');
        require $cmtx_absolute path . $path_to_comments_folder . "includes/commentics.php";
        $commentics_main = ob_get_clean();
    ob_end_clean();
}

#
###---- Find ----------
# soon later

// Set the template variables
$tpl->processTemplate ('writeContent', array(

#
##------ After ADD -----------
#

    'commentics_main'               => $commentics_main, //commentics

####################################
###------- OPEN -------------
#

template/default/artikel.tpl

#
###---- Find ----------
#  About Line80...Line120

            <p>{writeCommentMsg}</p>

            <!-- Comment Form -->
            <a name="comment"></a>
            <div id="commentForm" style="display: none;">
                <form id="formValues" action="#" method="post">
                    <input type="hidden" name="id" id="id" value="{id}" />
                    <input type="hidden" name="lang" id="lang" value="{lang}" />
                    <input type="hidden" name="type" id="type" value="faq" />

                    <p>
                        <label for="user">{msgNewContentName}</label>
                        <input type="text" id="user" name="user" value="{defaultContentName}" size="50" required="required" />
                    </p>

                    <p>
                        <label for="mail">{msgNewContentMail}</label>
                        <input type="email" id="mail" name="mail" value="{defaultContentMail}" size="50" required="required" />
                    </p>

                    <p>
                        <label for="comment_text">{msgYourComment}</label>
                        <textarea cols="37" rows="10" id="comment_text" name="comment_text" required="required" /></textarea>
                    </p>

                    <p>
                        {captchaFieldset}
                    </p>

                    <p>
                        <input class="submit" id="submitcomment" type="submit" value="{msgNewContentSubmit}" />
                    </p>
                </form>
            </div>
            <!-- /Comment Form -->

            <div id="loader"></div>
            <div id="comments">
                {writeComments}
            </div>

#
### ----- Replace With--------
#

<p>{commentics_main}</p>

#
##########################################
####### Commentics #######################
##########################################
###------- OPEN -------------
#   comment --> cmtx__comment
#
comments/includes/template/form.php

#
###---- Find ----------
#
# About Line28...

function addTags(Tag,fTag,Comment) {

  var frm=document.forms['commentics'];
  
  //remember cursor position
  var scrollTop = frm.comment.scrollTop;
  var scrollLeft = frm.comment.scrollLeft;
  
  var obj = document.commentics.comment;

  obj.focus();

  if (document.selection && document.selection.createRange)  // Internet Explorer
  {
sel = document.selection.createRange();
if (sel.parentElement() == obj)  sel.text = Tag + sel.text + fTag;
  }

  else if (typeof(obj) != "undefined")  // Firefox
  {
var longueur = parseInt(obj.value.length);
var selStart = obj.selectionStart;
var selEnd = obj.selectionEnd;

obj.value = obj.value.substring(0,selStart) + Tag + obj.value.substring(selStart,selEnd) + fTag + obj.value.substring(selEnd,longueur);
  }

  else obj.value += Tag + fTag;
  
  textCounter(frm.comment,frm.count,<?php echo $settings->comment_maximum_characters;?>);

  
  //set cursor position
  frm.comment.scrollTop = scrollTop;
  frm.comment.scrollLeft = scrollLeft;

  frm.comment.focus();
  
}

#
### ----- Replace With--------
#

function addTags(Tag,fTag,Comment) {

  var frm=document.forms['commentics'];
  
  //remember cursor position
  var scrollTop = frm.cmtx_comment.scrollTop;
  var scrollLeft = frm.cmtx_comment.scrollLeft;
  
  var obj = document.commentics.cmtx_comment;

  obj.focus();

  if (document.selection && document.selection.createRange)  // Internet Explorer
  {
sel = document.selection.createRange();
if (sel.parentElement() == obj)  sel.text = Tag + sel.text + fTag;
  }

  else if (typeof(obj) != "undefined")  // Firefox
  {
var longueur = parseInt(obj.value.length);
var selStart = obj.selectionStart;
var selEnd = obj.selectionEnd;

obj.value = obj.value.substring(0,selStart) + Tag + obj.value.substring(selStart,selEnd) + fTag + obj.value.substring(selEnd,longueur);
  }

  else obj.value += Tag + fTag;
  
  textCounter(frm.cmtx_comment,frm.count,<?php echo $settings->comment_maximum_characters;?>);
  
  //set cursor position
  frm.cmtx_comment.scrollTop = scrollTop;
  frm.cmtx_comment.scrollLeft = scrollLeft;

  frm.cmtx_comment.focus();
  
}

#
## ------- Find ------------
# comment --> cmtx__comment
# About Line630

<textarea name="comment" title="<?php echo CMTX_TITLE_COMMENT; ?>" cols="<?php echo $settings->field_size_comment_columns; ?>" rows="<?php echo $settings->field_size_comment_rows; ?>" onkeydown="textCounter(document.commentics.comment,document.commentics.count,<?php echo $settings->comment_maximum_characters;?>)"

#
### ----- Replace With--------
#

<textarea name="cmtx_comment" title="<?php echo CMTX_TITLE_COMMENT; ?>" cols="<?php echo $settings->field_size_comment_columns; ?>" rows="<?php echo $settings->field_size_comment_rows; ?>" onkeydown="textCounter(document.commentics.cmtx_comment,document.commentics.count,<?php echo $settings->comment_maximum_characters;?>)"

#
## ------- Find ------------
# About Line748

<script type="text/javascript">textCounter(document.commentics.comment,document.commentics.count,<?php echo $settings->comment_maximum_characters;?>)</script>

#
### ----- Replace With--------
#

<script type="text/javascript">textCounter(document.commentics.cmtx_comment,document.commentics.count,<?php echo $settings->comment_maximum_characters;?>)</script>

#########################################
### --------- OPEN --------------
#

comments/includes/app/processor.php

#
### -------- FIND ---------------
#

if (!defined("IN_COMMENTICS")) { die("Access Denied."); }

#
##------ After ADD -----------
#

$box = cmtx_app_processor();

function cmtx_app_processor(){
        global $settings,$mysql_table_prefix,$path_to_comments_folder,$approve_reason,$is_admin,$page_id,$error_total,$error,$error_message,$ip_address;
        $box = '';

#
### -------- FIND ---------------
#

} //end of if-data-submitted
?>

#
### ----- Replace With--------
#

} //end of if-data-submitted

return $box;  
}
?>

#
### -------- FIND ---------------
#
    if (!isset($_POST['comment'])) { //if comment not submitted

#
### ----- Replace With--------
#

    if (!isset($_POST['cmtx_comment'])) { //if comment not submitted
#
### -------- FIND ---------------
#
    $comment = @trim($_POST['comment']); //remove any space at beginning and end


#
### ----- Replace With--------
#
    $comment = @trim($_POST['cmtx_comment']); //remove any space at beginning and end

#
#########################################
##--- OPEN ---------------
# This case is ,using <base.. in <HEAD>...</HEAD>
# Fix anchor trouble (ex.#form)

comments/includes/functions/comments.php

#
### -------- FIND ---------------
#

$box .= "<a class='reply_enabled' href='" . CMTX_ANCHOR_FORM . "' title='" . CMTX_TITLE_REPLY . "' onclick='";

#
### ----- Replace With--------
#

$box .= "<a class='reply_enabled' href='" .
$_SERVER["REQUEST_URI"]
. CMTX_ANCHOR_FORM . "' title='" . CMTX_TITLE_REPLY . "' onclick='";



#
#########################################
##--- OPEN ---------------
#

comments/includes/template/comments.php

#
### -------- FIND ---------------
# About Line 547

<a href="<?php echo $path_to_comments_folder . "rss.php?id=" . $page_id;?>" title="<?php echo CMTX_TITLE_RSS_THIS; ?>"><?php echo CMTX_RSS_THIS_PAGE ?></a>

#
####------- Replace With
#

<a href="<?php echo $settings->url_to_comments_folder . "rss.php?id=" . $page_id;?>" title="<?php echo CMTX_TITLE_RSS_THIS; ?>"><?php echo CMTX_RSS_THIS_PAGE ?></a>

#
### -------- FIND -------------------------
# About Line 552

<a href="<?php echo $path_to_comments_folder . "rss.php";?>" title="<?php echo CMTX_TITLE_RSS_ALL; ?>"><?php echo CMTX_RSS_ALL_PAGES ?></a>

#
####------- Replace With -----------------
#

<a href="<?php echo $settings->url_to_comments_folder . "rss.php";?>" title="<?php echo CMTX_TITLE_RSS_ALL; ?>"><?php echo CMTX_RSS_ALL_PAGES ?></a>
HeartHeart
---------------------------------------------------
Commentics's Japanese Commentary Site
http://commentics.bbfriend.net/
*Sorry...I am not good at English.
---------------------------------------------------
Reply
#2
A simple Filed name starts a conflict.
I encountered.$_POST['name'] and $name.

Ex. $_POST['name'],$_POST['email'],$_POST['website'])
,$_POST['cmtx_comment'],vote,id...

Please change..
$_POST['name'] ---> $_POST['cmtx_name']
$_POST['email'] ---> $_POST['cmtx_email']
...

Global Variable is also dangerous.
$settings,$mysql_table_prefix ,$page_id, $error,$ip_address..
$name ---> $cmtx_email
$id ---> $cmtx_id
..and so on.

Same Suggestions..
http://www.commentics.org/forum/showthread.php?tid=130
---------------------------------------------------
Commentics's Japanese Commentary Site
http://commentics.bbfriend.net/
*Sorry...I am not good at English.
---------------------------------------------------
Reply
#3
Sorry..

artikel.php Mistake Code..

Code:
//commentics
if($faq->faqRecord['id']){
    //session_name("commentics");
    //session_start(); //already been started  
    ob_start();

    ob_start();
        $page_id = $faq->faqRecord['id']; //Uniqe No
        $reference = "cmtx_id";
    // ex./var/www/vhosts/*** commentics/httpdocs/
        $cmtx_absolute path = "/your absolute path /";
        $path_to_comments_folder = "comments/";
        define ('IN_COMMENTICS', 'true');
        require $cmtx_absolute path . $path_to_comments_folder . "includes/commentics.php";
        $commentics_main = ob_get_clean();
    ob_end_clean();
}


to

Code:
//commentics
if($faq->faqRecord['id']){
    //session_name("commentics");
    //session_start(); //already been started  
    ob_start();

    ob_start();
        $page_id = $faq->faqRecord['id']; #Uniqe No
        $reference = "cmtx_id"; #
        $path_to_comments_folder = "/**your absolute path**/comments/";
        //ex."/var/www/vhosts/commentics.net/httpdocs/comments/";
        define ('IN_COMMENTICS', 'true');
        require $path_to_comments_folder . "includes/commentics.php";
        $commentics_main = ob_get_clean();
    ob_end_clean();
}
---------------------------------------------------
Commentics's Japanese Commentary Site
http://commentics.bbfriend.net/
*Sorry...I am not good at English.
---------------------------------------------------
Reply
#4
phpMyFAQ 2.7.0-RC is Also OK by the Same Method.
---------------------------------------------------
Commentics's Japanese Commentary Site
http://commentics.bbfriend.net/
*Sorry...I am not good at English.
---------------------------------------------------
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  commentics and https - warning, mixed content sfzeller 9 686 16-Jul-2018, 05:59 PM
Last Post: sfzeller
Rainbow combine commentics with existing login system on own website Joerg 5 1,576 08-Oct-2017, 08:36 PM
Last Post: luigi
  Implementing commentics to main-domain and all sub-domain sanzuu 3 962 09-Apr-2017, 08:37 AM
Last Post: sanzuu
  Commentics 2.5 and TNG10 HiTowerUK 7 3,679 10-Oct-2015, 11:11 PM
Last Post: bobby
  commentics and subdomain problem ludo 8 3,736 30-Apr-2015, 10:12 AM
Last Post: finzer
  use commentics with ebay like commenting? daxu 0 871 29-Mar-2015, 12:43 PM
Last Post: daxu
  AJAX Commentics ApexGene 4 2,123 27-Feb-2015, 11:22 PM
Last Post: ApexGene
  setting the page for commentics piero 2 1,541 26-Feb-2015, 08:48 AM
Last Post: piero
  Top Bar Stops Functions With commentics On Page starams5 3 1,676 15-Feb-2015, 02:41 PM
Last Post: Steven
  Commentics in the (php) loop? Tomek 0 1,186 24-Oct-2014, 08:05 PM
Last Post: Tomek

Forum Jump:


Users browsing this thread: 1 Guest(s)