TVProjects top



TVProjects bottom
You are not registered.
Registration allows you to subscribe to projects, open projects, and more. Click here to register.

Website Source Code
<< Back

comments.php

<?php
    
function comments_process($comments_string)
    {
        if (
$comments_string == '')
        {
            
$ret '<div style="font-style: italic">No comments had been posted.</div>';
        }
        else
        {
            
$exp explode(';'$comments_string);
            
            
$ret '';
            foreach (
$exp as $comment_un)
            {
                
$comment explode('-'$comment_un);
                
                
$author get_user($comment[0]);
                
$com_vars['AUTHOR'] = escape_html(filter_bad_words($author[1]));
                
$com_vars['LINK'] = 'users/' $comment[0] . '-' format_title_address(filter_bad_words($author[1])) . '/';
                
$com_vars['DATE'] = date('d/m/y H:i:s'$comment[1]);
                
                
$text $comment[2];
                
$text str_replace(chr(1), ';'$text);
                
$text str_replace(chr(2), '-'$text);
                
//$com_vars['TEXT'] = xss_safe($text);
                
$com_vars['TEXT'] = nl2br(filter_bad_words(plain_to_link(escape_html($text))));
                
                
$ret .= get_template('comment'$com_vars);
            }
        }
        
        return 
$ret;
    }
    
    function 
comments_update($comments_string)
    {
        global 
$logged_user;
        
        if ((
$logged_user != -1) and (isset($_POST['comment_text'])))
        {
            if (
$comments_string != '')
                
$comments_string .= ';';
            
            
$message $_POST['comment_text'];
            
$message str_replace(';'chr(1), $message);
            
$message str_replace('-'chr(2), $message);
            
            
$comments_string .= $logged_user '-' time() . '-' $message;
            
            return 
$comments_string;
        }
        else
        {
            return 
null;
        }
    }
?>