assign('REPLYTO_PATH', REPLYTO_PATH); // comment form has different id if ( (isset($_GET['action']) and $_GET['action'] == 'edit_comment') or (isset($page['body_id']) and $page['body_id'] == 'theCommentsPage') ) { $template->assign('replyto_form_name', 'editComment'); } else { $template->assign('replyto_form_name', 'addComment'); } /* COMMENTS page */ if (script_basename() == 'comments') { if (!is_a_guest() or $conf['comments_forall']) { $comments = $template->get_template_vars('comments'); if (!count($comments)) { return; } // generates urls to picture or albums with necessary url params foreach ($comments as $tpl_var) { $replyto_links[ $tpl_var['ID'] ] = add_url_params( $tpl_var['U_PICTURE'], array( 'rt' => $tpl_var['ID'], 'rta' =>$tpl_var['AUTHOR'], ) ).'#commentform'; } $template->assign('replyto_links', $replyto_links); $template->set_prefilter('comments', 'replyto_add_link_comments_prefilter'); } } /* PICTURE page */ else if (script_basename() == 'picture') { add_event_handler('user_comment_insertion', 'replyto_parse_picture_mail'); if (!is_a_guest() or $conf['comments_forall']) { $template->set_prefilter('picture', 'replyto_add_link_prefilter'); } } /* ALBUM page */ else if ( script_basename() == 'index' and isset($page['section']) and isset($pwg_loaded_plugins['Comments_on_Albums']) and $page['section'] == 'categories' and isset($page['category']) ) { add_event_handler('user_comment_insertion', 'replyto_parse_album_mail'); if (!is_a_guest() or $conf['comments_forall']) { $template->set_prefilter('comments_on_albums', 'replyto_add_link_prefilter'); } } /* we come from comments.php page */ if (!empty($_GET['rt']) and !empty($_GET['rta'])) { $template->func_combine_script(array('id'=>'insertAtCaret', 'path'=>REPLYTO_PATH.'insertAtCaret.js')); $template->block_footer_script(array('require'=>'insertAtCaret'), 'replyTo("'.$_GET['rt'].'", "'.$_GET['rta'].'");'); } } /** * reply buttons on comments.php page */ function replyto_add_link_comments_prefilter($content) { // style $content.= ' {html_style} .replyTo { display:none; background:url({$ROOT_URL}{$REPLYTO_PATH}reply.png) left top no-repeat; height:16px; margin-left:20px; padding-left:20px; } li.commentElement:hover .replyTo { display:inline; } .replyTo:hover { background-position:left -16px; } {/html_style}'; // button $search = '{$comment.DATE}'; $replace = $search.'{\'Reply\'|@translate}'; return str_replace($search, $replace, $content); } /** * reply buttons on picture.php and index.php pages */ function replyto_add_link_prefilter($content, &$smarty) { // script & style $content.= ' {combine_script id=\'insertAtCaret\' require=\'jquery\' path=$REPLYTO_PATH|cat:\'insertAtCaret.js\'} {footer_script require=\'insertAtCaret\'} function replyTo(commentID, author) { jQuery("#{$replyto_form_name} textarea").insertAtCaret("[reply=" + commentID + "]" + author + "[/reply] ").focus(); } {/footer_script} {html_style} .replyTo { display:none; background:url({$ROOT_URL}{$REPLYTO_PATH}reply.png) left top no-repeat; height:16px; margin-left:20px; padding-left:20px; } li.commentElement:hover .replyTo { display:inline; } .replyTo:hover { background-position:left -16px; } {/html_style}'; // button $search[1] = '{$comment.DATE}'; $replace[1] = $search[1].'{\'Reply\'|@translate}'; // anchors $search[2] = '