Changeset 18164 for trunk/include/functions_comment.inc.php
- Timestamp:
- Sep 23, 2012, 11:34:30 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_comment.inc.php
r17351 r18164 92 92 if ( empty($comm['author']) ) 93 93 { 94 if ($conf['comments_author_mandatory']) 95 { 96 array_push($infos, l10n('Username is mandatory') ); 97 $comment_action='reject'; 98 } 94 99 $comm['author'] = 'guest'; 95 100 } … … 129 134 130 135 // 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')); 136 if (!empty($comm['website_url'])) 137 { 138 if (!preg_match('/^https?/i', $comm['website_url'])) 139 { 140 $comm['website_url'] = 'http://'.$comm['website_url']; 141 } 142 if (!url_check_format($comm['website_url'])) 143 { 144 array_push($infos, l10n('Your website URL is invalid')); 145 $comment_action='reject'; 146 } 147 } 148 149 // email 150 if (empty($comm['email'])) 151 { 152 if (!empty($user['email'])) 153 { 154 $comm['email'] = $user['email']; 155 } 156 else if ($conf['comments_email_mandatory']) 157 { 158 array_push($infos, l10n('Email address is missing. Please specify an email address.') ); 159 $comment_action='reject'; 160 } 161 } 162 else if (!email_check_format($comm['email'])) 163 { 164 array_push($infos, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)')); 138 165 $comment_action='reject'; 139 166 } … … 180 207 $query = ' 181 208 INSERT INTO '.COMMENTS_TABLE.' 182 (author, author_id, anonymous_id, content, date, validated, validation_date, image_id, website_url )209 (author, author_id, anonymous_id, content, date, validated, validation_date, image_id, website_url, email) 183 210 VALUES ( 184 211 \''.$comm['author'].'\', … … 190 217 '.($comment_action=='validate' ? 'NOW()':'NULL').', 191 218 '.$comm['image_id'].', 192 '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').' 219 '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').', 220 '.(!empty($comm['email']) ? '\''.$comm['email'].'\'' : 'NULL').' 193 221 ) 194 222 '; … … 208 236 ( 209 237 get_l10n_args('Author: %s', stripslashes($comm['author']) ), 238 get_l10n_args('Email: %s', stripslashes($comm['email']) ), 210 239 get_l10n_args('Comment: %s', stripslashes($comm['content']) ), 211 240 get_l10n_args('', ''),
Note: See TracChangeset
for help on using the changeset viewer.