Ignore:
Timestamp:
Aug 3, 2012, 7:02:24 PM (12 years ago)
Author:
mistic100
Message:

feature 2380: add URL for user comment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_comment.inc.php

    r15983 r17351  
    128128  }
    129129 
     130  // website
     131  if ( !empty($comm['website_url']) and !preg_match('/^https?/i', $comm['website_url']) )
     132  {
     133    $comm['website_url'] = 'http://'.$comm['website_url'];
     134  }
     135  if ( !empty($comm['website_url']) and !url_check_format($comm['website_url']) )
     136  {
     137    array_push($infos, l10n('Your website URL is invalid'));
     138    $comment_action='reject';
     139  }
     140 
    130141  // anonymous id = ip address
    131142  $ip_components = explode('.', $comm['ip']);
     
    169180    $query = '
    170181INSERT INTO '.COMMENTS_TABLE.'
    171   (author, author_id, anonymous_id, content, date, validated, validation_date, image_id)
     182  (author, author_id, anonymous_id, content, date, validated, validation_date, image_id, website_url)
    172183  VALUES (
    173184    \''.$comm['author'].'\',
     
    178189    \''.($comment_action=='validate' ? 'true':'false').'\',
    179190    '.($comment_action=='validate' ? 'NOW()':'NULL').',
    180     '.$comm['image_id'].'
     191    '.$comm['image_id'].',
     192    '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').'
    181193  )
    182194';
Note: See TracChangeset for help on using the changeset viewer.