includes/comment.php
changeset 345 4ccdfeee9a11
parent 334 c72b545f1304
child 359 e0787bb6285b
equal deleted inserted replaced
344:be6c5fdd9203 345:4ccdfeee9a11
    59     else
    59     else
    60       $this->perms = $session->fetch_page_acl($page_id, $namespace);
    60       $this->perms = $session->fetch_page_acl($page_id, $namespace);
    61     
    61     
    62     $this->page_id = $db->escape($page_id);
    62     $this->page_id = $db->escape($page_id);
    63     $this->namespace = $db->escape($namespace);
    63     $this->namespace = $db->escape($namespace);
    64   }
       
    65   
       
    66   /**
       
    67    * PHP 4 constructor.
       
    68    * @see Comments::__construct
       
    69    */
       
    70   function Comments($page_id, $namespace)
       
    71   {
       
    72     $this->__construct($page_id, $namespace);
       
    73   }
    64   }
    74   
    65   
    75   /**
    66   /**
    76    * Processes a command in JSON format.
    67    * Processes a command in JSON format.
    77    * @param string The JSON-encoded input, probably something sent from the Javascript/AJAX frontend
    68    * @param string The JSON-encoded input, probably something sent from the Javascript/AJAX frontend
   149               ';
   140               ';
   150               $row['comment_data'] = $wrapper;
   141               $row['comment_data'] = $wrapper;
   151             }
   142             }
   152             
   143             
   153             // Format date
   144             // Format date
   154             $row['time'] = date('F d, Y h:i a', $row['time']);
   145             $row['time'] = enano_date('F d, Y h:i a', $row['time']);
   155             
   146             
   156             // Format signature
   147             // Format signature
   157             $row['signature'] = ( !empty($row['signature']) ) ? RenderMan::render($row['signature']) : '';
   148             $row['signature'] = ( !empty($row['signature']) ) ? RenderMan::render($row['signature']) : '';
   158             
   149             
   159             // Add the comment to the list
   150             // Add the comment to the list
   291           $src = $text;
   282           $src = $text;
   292           $sql_text = $db->escape($text);
   283           $sql_text = $db->escape($text);
   293           $text = RenderMan::render($text);
   284           $text = RenderMan::render($text);
   294           $appr = ( getConfig('approve_comments') == '1' ) ? '0' : '1';
   285           $appr = ( getConfig('approve_comments') == '1' ) ? '0' : '1';
   295           $time = time();
   286           $time = time();
   296           $date = date('F d, Y h:i a', $time);
   287           $date = enano_date('F d, Y h:i a', $time);
   297           
   288           
   298           // Send it to the database
   289           // Send it to the database
   299           $q = $db->sql_query('INSERT INTO '.table_prefix.'comments(page_id,namespace,name,subject,comment_data,approved, time, user_id) VALUES' .
   290           $q = $db->sql_query('INSERT INTO '.table_prefix.'comments(page_id,namespace,name,subject,comment_data,approved, time, user_id) VALUES' .
   300                               "('$this->page_id', '$this->namespace', '$name', '$subj', '$sql_text', $appr, $time, $session->user_id);");
   291                               "('$this->page_id', '$this->namespace', '$name', '$subj', '$sql_text', $appr, $time, $session->user_id);");
   301           if(!$q)
   292           if(!$q)