Changeset 11325 for extensions/reply_to/reply_to.inc.php
- Timestamp:
- Jun 11, 2011, 11:06:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/reply_to/reply_to.inc.php
r11299 r11325 27 27 { 28 28 add_event_handler('render_comment_content', 'replyto_parse_picture', 60); 29 add_event_handler('user_comment_insertion', 'replyto_parse_picture_mail'); 29 30 if ( !is_a_guest() OR $conf['comments_forall'] ) 30 31 { … … 40 41 { 41 42 add_event_handler('render_comment_content', 'replyto_parse_album', 60); 43 add_event_handler('user_comment_insertion', 'replyto_parse_album_mail'); 42 44 if ( !is_a_guest() OR $conf['comments_forall'] ) 43 45 { … … 80 82 {if not isset($comment.IN_EDIT)} 81 83 <div class="actions" style="float:right;"> 82 <a title="{\'reply to this comment\'|@translate}" class="replyTo" onclick="replyto(\'{$comment.ID}\', \'{$comment.AUTHOR}\');"> </a>84 <a href="#commentform" title="{\'reply to this comment\'|@translate}" class="replyTo" onclick="replyto(\'{$comment.ID}\', \'{$comment.AUTHOR}\');"> </a> 83 85 </div> 84 86 {/if}' … … 91 93 .$search[2]; 92 94 95 $search[3] = '<legend>{\'Add a comment\'|@translate}</legend>'; 96 $replace[3] = $search[3].' 97 <a name="commentform"></a>'; 98 93 99 return str_replace($search, $replace, $content); 94 100 } … … 100 106 function replyto_parse_picture($comment) 101 107 { 102 if (preg_match('#\[reply=([ 1-9]+)\](.*)\[/reply\]#si', $comment, $matches))108 if (preg_match('#\[reply=([0-9]+)\]([^\[\]]*)\[/reply\]#i', $comment, $matches)) 103 109 { 104 110 // picture informations … … 141 147 )); 142 148 143 $search = "#\[reply=([ 1-9]+)\](.*)\[/reply\]#si";144 $replace = '@ <a href="'. $image['url'].'#comment-$1">$2</a> :';149 $search = "#\[reply=([0-9]+)\]([^\[\]]*)\[/reply\]#i"; 150 $replace = '@ <a href="'.get_absolute_root_url().$image['url'].'#comment-$1">$2</a> :'; 145 151 } 146 152 else 147 153 { 148 $search = "#\[reply=([ 1-9]+)\](.*)\[/reply\]#si";154 $search = "#\[reply=([0-9]+)\]([^\[\]]*)\[/reply\]#i"; 149 155 $replace = ''; 150 156 } … … 160 166 function replyto_parse_album($comment) 161 167 { 162 if (preg_match('#\[reply=([ 1-9]+)\](.*)\[/reply\]#si', $comment, $matches))168 if (preg_match('#\[reply=([0-9]+)\]([^\[\]]*)\[/reply\]#i', $comment, $matches)) 163 169 { 164 170 // check if the comment is really an album comment 165 171 // (both comments_on_albums script and default comments script are executed... 166 172 // with the same 'render_comment_content' event) 173 ## THIS CAN INDUCE ERRORS, MUST FIND A BETTER WAY 167 174 $query = ' 168 175 SELECT id … … 199 206 )); 200 207 201 $search = "#\[reply=([ 1-9]+)\](.*)\[/reply\]#si";202 $replace = '@ <a href="'. $category['url'].'#comment-$1">$2</a> :';208 $search = "#\[reply=([0-9]+)\]([^\[\]]*)\[/reply\]#i"; 209 $replace = '@ <a href="'.get_absolute_root_url().$category['url'].'#comment-$1">$2</a> :'; 203 210 } 204 211 else 205 212 { 206 $search = "#\[reply=([ 1-9]+)\](.*)\[/reply\]#si";213 $search = "#\[reply=([0-9]+)\]([^\[\]]*)\[/reply\]#i"; 207 214 $replace = ''; 208 215 } … … 216 223 } 217 224 225 /** 226 * Replace BBcode tag by a link in notification mails 227 */ 228 function replyto_parse_picture_mail($comment) 229 { 230 $comment['content'] = replyto_parse_picture($comment['content']); 231 var_dump($comment); 232 return $comment; 233 } 234 235 function replyto_parse_album_mail($comment) 236 { 237 $comment['content'] = replyto_parse_album($comment['content']); 238 return $comment; 239 } 240 218 241 ?>
Note: See TracChangeset
for help on using the changeset viewer.