Changeset 18995 for trunk/include


Ignore:
Timestamp:
Nov 11, 2012, 4:01:09 PM (11 years ago)
Author:
mistic100
Message:

feature:2786 Allow to edit website url in user comments + improve "user experience" on comment edition

File:
1 edited

Legend:

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

    r18164 r18995  
    310310function update_user_comment($comment, $post_key)
    311311{
    312   global $conf;
     312  global $conf, $page;
    313313
    314314  $comment_action = 'validate';
     
    336336                  );
    337337
     338  // website
     339  if (!empty($comment['website_url']))
     340  {
     341    if (!preg_match('/^https?/i', $comment['website_url']))
     342    {
     343      $comment['website_url'] = 'http://'.$comment['website_url'];
     344    }
     345    if (!url_check_format($comment['website_url']))
     346    {
     347      array_push($page['errors'], l10n('Your website URL is invalid'));
     348      $comment_action='reject';
     349    }
     350  }
     351
    338352  if ( $comment_action!='reject' )
    339353  {
     
    348362UPDATE '.COMMENTS_TABLE.'
    349363  SET content = \''.$comment['content'].'\',
     364      website_url = '.(!empty($comment['website_url']) ? '\''.$comment['website_url'].'\'' : 'NULL').',
    350365      validated = \''.($comment_action=='validate' ? 'true':'false').'\',
    351366      validation_date = '.($comment_action=='validate' ? 'NOW()':'NULL').'
Note: See TracChangeset for help on using the changeset viewer.