Source for file comment.php

Documentation is available at comment.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @copyright (C) 2000 - 2007 Mambo Foundation Inc.
  5. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  6. @author Mambo Foundation Inc see README.php
  7. */
  8.  
  9. /** ensure this file is being included by a parent file */
  10. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  11.  
  12. global $mosConfig_absolute_path$mosConfig_usecaptcha$task;
  13. require_once($mosConfig_absolute_path."/administrator/components/com_comment/config.comment.php");
  14.  
  15. # valid user check
  16. $is_user   (strtolower($my->usertype<> '');
  17. $captcha_success 0// captcha not required
  18.  
  19. if ($task == "captcha-audio"){
  20.    @ob_end_clean();
  21.    ob_start();
  22.    include ($mosConfig_absolute_path."/includes/captcha-audio.php");
  23.    ob_end_flush();
  24.    exit(0);
  25.    
  26. }
  27.  
  28. if ($mosConfig_usecaptcha == '1'{
  29.     # spam protection
  30.     session_name('mos_captcha');
  31.     session_start();
  32.  
  33.     if(isset($_SESSION['code']&& ($_SESSION['code'!= ""&& ($_SESSION['code'== $spamstop)) {
  34.         $captcha_success 1// success
  35.     else {
  36.         $captcha_success 2// fail
  37.     }
  38. }
  39.  
  40. if ($captcha_success != '2'{
  41.  
  42.     # if registered users only
  43.     if (!$allow_anonymous_entries AND !$is_user{
  44.  
  45.         $link sefRelToAbs("index.php?option=content&task=view&id=$articleid");
  46.         echo "<SCRIPT>alert('لطفا برای ارسال نظر عضو شوید.'); document.location.href='".$link."';</SCRIPT>";
  47.  
  48.     else {
  49.  
  50.         $comments  strip_tags($comments);
  51.         $comments  mysql_escape_string(strip_tags($comments));
  52.         $startdate date"Y-m-d H:i:s" );
  53.         $ip        getenv('REMOTE_ADDR');
  54.  
  55.         $query "INSERT INTO #__comment SET articleid='$articleid', ip='$ip', name='$mcname', comments='$comments', startdate='$startdate', published='$auto_publish_comments';";
  56.         $database->setQuery($query);
  57.         $database->query();
  58.  
  59.  
  60.         if ($notify_new_entries == "1"{
  61.             // messaging for new items
  62.             require_once($mosConfig_absolute_path."/includes/mambofunc.php");
  63.             $message "یک نظر اضافه شده است\n\n".$comments;
  64.  
  65.             if ($auto_publish_comments == "0"{
  66.                 $message $message "\n\nشما انتخاب کرده اید که نظرات به صورت خودکار منتشر نشوند ، به همین دلیل شما برای منتشر کردن نظر باید وارد مدیریت شوید و نظر های جدید را منتشر کنید.";
  67.             }
  68.  
  69.             mosMail $mosConfig_mailfrom$mosConfig_mailfrom$mosConfig_mailfrom"یک نظر ارسال شده است"$message);
  70.         }
  71.  
  72.         $msg 'تشکر ، نظر شما به صورت کامل ذخیره شد.';
  73.         if ($auto_publish_comments == "0"{
  74.             $msg $msg'مدیر بعد از باز بینی نظر شما آن را منتشر خواهد کرد.';
  75.             
  76.         }        
  77.         
  78.         mosRedirect"index.php?option=com_content&task=view&id=".$articleid."&Itemid=".$mcitemid."&limit=".$limit."&limitstart=".$limitstart$msg );
  79.     }
  80.  
  81. else {
  82.     echo "<SCRIPT> alert('کد امنیتی درست وارد نشده است');            document.location='index.php?option=com_content&task=view&id=$articleid&Itemid=$mcitemid&limit=$limit&limitstart=$limitstart&comments=$comments';</SCRIPT>";
  83. }
  84.  
  85.  
  86.  
  87.  
  88. ?>

Documentation generated on Mon, 05 May 2008 16:18:00 +0400 by phpDocumentor 1.4.0