/* ======================================================================================== * WMNews Version 0.3 * Another PHP & MySQL driven News Publishing system * * Filename : wmnpgcomments.php * Description : Part of WMNews, Photo Gallery user comments script, adapted from wmncomments.php * Last Updated : Wednesday, June 24, 2009 12:19:45 PM * Latest Version : http://wartamikael.org/PHPScripts/ * * Copyright (c) 2001-2003 Rudy S. Ingga (toekangweb@wartamikael.org). All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ======================================================================================== */ /* ----------------------------------------- * * Tables, configuration and library we need * * ----------------------------------------- */ if(!isset($config)){ include("config/config.php"); } if(!isset($lib_lib)){ include("libs/lib-wmlib.php"); } if(!isset($lib_phogal)){ include("libs/lib-wmphogal.php"); } if($lang == "ina"){ $pgcat_file = "WMNPGCat"; $pglist_file = "WMNPGList"; $cmt_file = "WMNPGComments"; }else{ $pgcat_file = "en_WMNPGCat"; $pglist_file = "en_WMNPGList"; $cmt_file = "en_WMNPGComments"; } $members_file = "WMLMembers"; $fnlc = "WMN_Komentar_Terakhir_PG.wmn"; session_save_path($base_temp); session_start(); if(!$g_pgcmt_use){ header("Location: $base_url"); } // Do not use comment system, back to mainpage! /* ------------------------ */ function GetComments($CmID=0){ /* ------------------------ */ global $g_pgcmt_auth_use, $db, $PGListID, $cmt_file, $pos, $step; $return_msg = ""; if(!$CmID){ $CmID = 0; } if($g_pgcmt_auth_use){ $get_comments = mysql_query("SELECT * FROM $cmt_file WHERE CmPGListID = '$PGListID' AND CmPID = '$CmID' AND CmAllow='1' ORDER BY CmDate ASC LIMIT $pos, $step", $db); }else{ $get_comments = mysql_query("SELECT * FROM $cmt_file WHERE CmPGListID = '$PGListID' AND CmPID = '$CmID' ORDER BY CmDate ASC LIMIT $pos, $step", $db); } $comment_counter = mysql_num_rows($get_comments); if($comment_counter > 0){ $return_msg .= "
$CmC
"; return $return_msg; } /* ------------------------------------------------------- */ function ShowLink($CmID,$CmSubject,$CmName,$CmEmail,$CmDate){ /* ------------------------------------------------------- */ global $PHP_SELF, $PGListID, $lang_pre1, $lang_pre2, $lang_param; $pretty_time = pretty_time($CmDate,1); /* if($CmEmail != ""){ $email_name = "$CmName"; }else{ $email_name = $CmName; } */ $email_name = $CmName; $return_msg = "\n$T_CMT_ADM - " . pretty_time($CmDate2,1) . ""; $nw_comment2 .= ""; } $return_msg = <<
" . SmileysConverter($CmContent2) . "
$email_name - $pretty_time |
$CmSubject $CmContent $nw_comment2 |
$nav |
" . $nav_repl . " " . $nav_top . " " . $nav_prnt . " " .$nav_retr . "
"; } /* ----------------- */ function ShowAddLink(){ /* ----------------- */ global $PHP_SELF, $T_CMT_ADD, $PGListID, $act, $T_RETURN, $CmPID, $T_CMT_TOP; global $lang_pre1, $lang_pre2, $lang_param; //$return_msg = "\n$T_CMT_ADD";
if($act == "add" && $CmPID == "0"){
//$return_msg .= "
";
$return_msg .= " $T_CMT_TOP $T_RETURN";
}
return $return_msg;
}
/* ----------------------- */
function AddCommentCounter(){
/* ----------------------- */
global $db, $article_file, $PGListID;
/*
$get_news = mysql_query("SELECT * FROM $article_file WHERE PGListID = '$PGListID' LIMIT 0,1", $db);
while($get_row = mysql_fetch_array($get_news)){
$ArtDate = $get_row[ArtDate];
}
*/
$update = mysql_query("UPDATE $article_file SET ArtDate=ArtDate, ArtComment=ArtComment+1 WHERE PGListID='$PGListID'", $db);
}
/* ------------------------- */
function CheckAllow($PGListID=""){
/* ------------------------- */
global $db, $article_catfile, $article_file;
if($PGListID == ""){
return false;
}else{
$get_allow = mysql_query("SELECT * FROM $article_file LEFT JOIN $article_catfile ON ($article_catfile.ArtCat = $article_file.ArtCat) WHERE $article_file.PGListID='$PGListID' LIMIT 0,1", $db);
while($get_row = mysql_fetch_array($get_allow)){
if($get_row['ArtUseComment'] == "1"){
return true;
}else{
return false;
}
}
}
return false;
}
/* ---------------- *
* Begin the action *
* ---------------- */
$depth = 0;
$max_indent = 5;
$swear = array("isep","bau tai","kudis","kurap","nonok","entot","ngewe","kontol","titit","peler","jembut","memek","itil","taik","cibai","fuck","asshole","pekker","whore","bitch","shit","nigger","bigass","tits","cum ","cunt","clit");
$output = "";
$numpage = 0;
$home_dir = $base_pgpath;
$home_url = $base_url_pg;
$home_thumbdir = $home_dir . "/thumbnail";
$home_thumburl = $home_url . "/thumbnail";
if(!isset($act)){
if(!isset($PGListID)){
$PGListID = GetLast($pglist_file, "PGListID", "PGListID");
}
if($PGListID){
/*
$allow_cmt = CheckAllow($PGListID);
if(!$allow_cmt){
header("Location: $base_url");
}
*/
$headlines = GetPG($PGListID);
if($headlines){
if(!isset($pos)){$pos = 0;}
$temp_pos = $pos;
if($g_pgcmt_auth_use){
$get_count = mysql_query("SELECT COUNT(CmID) AS Total FROM $cmt_file WHERE CmPGListID = '$PGListID' AND CmPID = '0' AND CmAllow='1'",$db);
}else{
$get_count = mysql_query("SELECT COUNT(CmID) AS Total FROM $cmt_file WHERE CmPGListID = '$PGListID' AND CmPID = '0'",$db);
}
$count_row = mysql_fetch_array($get_count);
$numrec = $count_row['Total'];
$numpage = intval($numrec / $step);
if($numrec % $step){ $numpage++; }
$output .= ShowAddLink();
$comment_top = GetComments();
if($comment_top){
$output .= $comment_top;
}else{
$output .= "
" . $T_CMT_EPT; } }else{ $output .= "
$T_NEWS #$PGListID $T_NOEXISTS!";
}
/*
$output = <<$headlines
EOF;
*/
$output = <<$output
$T_ERR_INV:
$error
$T_RF_YNA : | $yname |
$T_RF_YML : | $ymail |
$T_CMT_SBJ : | $subject |
$T_CMT : | $comment_disp |
IP Address : | $_SERVER[REMOTE_ADDR] |
$T_ERR_INV:
$error
$T_CMT_THA
" . $output . " |
Managed by WMNews, PHP & MySQL"; */ echo "