- Timestamp:
- Aug 3, 2012, 7:02:24 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/comments.php
r15924 r17351 383 383 com.author_id, 384 384 com.date, 385 com.website_url, 385 386 com.content, 386 387 com.validated … … 478 479 'ALT' => $name, 479 480 'AUTHOR' => trigger_event('render_comment_author', $comment['author']), 481 'WEBSITE_URL' => $comment['website_url'], 480 482 'DATE'=>format_date($comment['date'], true), 481 483 'CONTENT'=>trigger_event('render_comment_content',$comment['content']), -
trunk/include/functions.inc.php
r15598 r17351 1693 1693 return $is_mobile_theme; 1694 1694 } 1695 1696 /** 1697 * check url format 1698 */ 1699 function url_check_format($url) 1700 { 1701 if (version_compare(PHP_VERSION, '5.2.0') >= 0) 1702 { 1703 return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false; 1704 } 1705 else 1706 { 1707 // http://mathiasbynens.be/demo/url-regex @imme_emosol 1708 return (bool)preg_match('@^https?://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', $url); 1709 } 1710 } 1695 1711 ?> -
trunk/include/functions_comment.inc.php
r15983 r17351 128 128 } 129 129 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 130 141 // anonymous id = ip address 131 142 $ip_components = explode('.', $comm['ip']); … … 169 180 $query = ' 170 181 INSERT 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) 172 183 VALUES ( 173 184 \''.$comm['author'].'\', … … 178 189 \''.($comment_action=='validate' ? 'true':'false').'\', 179 190 '.($comment_action=='validate' ? 'NOW()':'NULL').', 180 '.$comm['image_id'].' 191 '.$comm['image_id'].', 192 '.(!empty($comm['website_url']) ? '\''.$comm['website_url'].'\'' : 'NULL').' 181 193 ) 182 194 '; -
trunk/include/picture_comment.inc.php
r15924 r17351 49 49 'author' => trim( @$_POST['author'] ), 50 50 'content' => trim( $_POST['content'] ), 51 'website_url' => trim( $_POST['website_url'] ), 51 52 'image_id' => $page['image_id'], 52 53 ); … … 146 147 date, 147 148 image_id, 149 website_url, 148 150 content, 149 151 validated … … 179 181 'DATE' => format_date($row['date'], true), 180 182 'CONTENT' => trigger_event('render_comment_content',$row['content']), 183 'WEBSITE_URL' => $row['website_url'], 181 184 ); 182 185 … … 242 245 { 243 246 $key = get_ephemeral_key(3, $page['image_id']); 244 $content = $author = '';247 $content = $author = $website_url = ''; 245 248 if ('reject'===@$comment_action) 246 249 { 247 250 $content = htmlspecialchars( stripslashes($comm['content']) ); 248 251 $author = htmlspecialchars( stripslashes($comm['author']) ); 252 $website_url = htmlspecialchars( stripslashes($comm['website_url']) ); 249 253 } 250 254 $template->assign('comment_add', … … 255 259 'SHOW_AUTHOR' => !is_classic_user(), 256 260 'AUTHOR' => $author , 261 'WEBSITE_URL' => $website_url, 257 262 )); 258 263 } -
trunk/install/piwigo_structure-mysql.sql
r15983 r17351 54 54 `author_id` smallint(5) DEFAULT NULL, 55 55 `anonymous_id` varchar(45) NOT NULL, 56 `website_url` varchar(255) DEFAULT NULL, 56 57 `content` longtext, 57 58 `validated` enum('true','false') NOT NULL default 'false', -
trunk/themes/default/template/comment_list.tpl
r16522 r17351 55 55 {/if} 56 56 57 <span class="commentAuthor">{$comment.AUTHOR}</span> - <span class="commentDate">{$comment.DATE}</span> 57 <span class="commentAuthor">{if $comment.WEBSITE_URL}<a href="{$comment.WEBSITE_URL}" class="external" target="_blank">{$comment.AUTHOR}</a>{else}{$comment.AUTHOR}{/if}</span> 58 - <span class="commentDate">{$comment.DATE}</span> 58 59 {if isset($comment.IN_EDIT)} 59 60 <a name="edit_comment"></a> -
trunk/themes/default/template/picture.tpl
r17302 r17351 350 350 <p><label for="author">{'Author'|@translate} :</label></p> 351 351 <p><input type="text" name="author" id="author" value="{$comment_add.AUTHOR}"></p> 352 <p><label for="contentid">{'Comment'|@translate} :</label></p>353 352 {/if} 353 <p><label for="website_url">{'Website'|@translate} :</label></p> 354 <p><input type="text" name="website_url" id="website_url" value="{$comment_add.WEBSITE_URL}"></p> 355 <p><label for="contentid">{'Comment'|@translate} :</label></p> 354 356 <p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p> 355 357 <p><input type="hidden" name="key" value="{$comment_add.KEY}">
Note: See TracChangeset
for help on using the changeset viewer.