- Timestamp:
- Nov 4, 2012, 3:59:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_on_Albums/include/functions_comment.inc.php
r15999 r18927 39 39 if ( empty($comm['author']) ) 40 40 { 41 if ($conf['comments_author_mandatory']) 42 { 43 array_push($infos, l10n('Username is mandatory') ); 44 $comment_action='reject'; 45 } 41 46 $comm['author'] = 'guest'; 42 47 } … … 75 80 } 76 81 82 // website 83 if (!empty($comm['website_url'])) 84 { 85 if (!preg_match('/^https?/i', $comm['website_url'])) 86 { 87 $comm['website_url'] = 'http://'.$comm['website_url']; 88 } 89 if (!url_check_format($comm['website_url'])) 90 { 91 array_push($infos, l10n('Your website URL is invalid')); 92 $comment_action='reject'; 93 } 94 } 95 96 // email 97 if (empty($comm['email'])) 98 { 99 if (!empty($user['email'])) 100 { 101 $comm['email'] = $user['email']; 102 } 103 else if ($conf['comments_email_mandatory']) 104 { 105 array_push($infos, l10n('Email address is missing. Please specify an email address.') ); 106 $comment_action='reject'; 107 } 108 } 109 else if (!email_check_format($comm['email'])) 110 { 111 array_push($infos, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)')); 112 $comment_action='reject'; 113 } 114 77 115 // anonymous id = ip address 78 116 $ip_components = explode('.', $comm['ip']); … … 116 154 $query = ' 117 155 INSERT INTO '.COA_TABLE.' 118 (author, author_id, content, date, validated, validation_date, category_id)156 (author, author_id, anonymous_id, content, date, validated, validation_date, category_id, website_url, email) 119 157 VALUES ( 120 158 \''.$comm['author'].'\', 121 159 '.$comm['author_id'].', 160 \''.$comm['anonymous_id'].'\', 122 161 \''.$comm['content'].'\', 123 162 NOW(), 124 163 \''.($comment_action=='validate' ? 'true':'false').'\', 125 164 '.($comment_action=='validate' ? 'NOW()':'NULL').', 126 '.$comm['category_id'].' 165 '.$comm['category_id'].', 166 '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').', 167 '.(!empty($comm['email']) ? '\''.$comm['email'].'\'' : 'NULL').' 127 168 ) 128 169 '; … … 142 183 ( 143 184 get_l10n_args('Author: %s', stripslashes($comm['author']) ), 185 get_l10n_args('Email: %s', stripslashes($comm['email']) ), 144 186 get_l10n_args('Comment: %s', stripslashes($comm['content']) ), 145 187 get_l10n_args('', ''),
Note: See TracChangeset
for help on using the changeset viewer.