echo '<ul class="chapters_list posts_list">'; $ChapterCache->iterate_through_category_children($curr_Chapter, $callbacks, false, array('sorted' => true)); echo '</ul>'; // Button to create a new sub-chapter $create_new_chapter_url = $Blog->get_create_chapter_url($cat); // Button to create a new page $write_new_post_url = $Blog->get_write_item_url($cat); if (!empty($create_new_chapter_url) || !empty($write_new_post_url)) { echo '<div class="' . button_class('group') . '" style="margin:15px 0">'; if (!empty($create_new_chapter_url)) { // Display button to write a new post echo '<a href="' . $create_new_chapter_url . '" class="' . button_class('text') . '">' . get_icon('add') . ' ' . T_('Add a sub-chapter here') . '</a>'; } if (!empty($write_new_post_url)) { // Display button to write a new post echo '<a href="' . $write_new_post_url . '" class="' . button_class('text') . '">' . get_icon('add') . ' ' . T_('Add a page here') . '</a>'; } echo '</div>'; } if (!empty($intro_Item)) { global $c, $ReqURI; $c = 1; // Display comments echo '<div class="evo_content_block">'; // Beginning of posts display // ------------------ FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE ------------------ skin_include('_item_feedback.inc.php', array_merge(array('before_section_title' => '<h3 class="evo_comment__list_title">', 'after_section_title' => '</h3>', 'Item' => $intro_Item, 'form_title_text' => T_('Comment form'), 'comments_title_text' => T_('Comments on this chapter'), 'form_comment_redirect_to' => $ReqURI), $Skin->get_template('disp_params'))); // Note: You can customize the default item feedback by copying the generic // /skins/_item_feedback.inc.php file into the current skin folder. // ---------------------- END OF FEEDBACK (COMMENTS/TRACKBACKS) --------------------- echo '</div>';
" class="<?php $Item->div_classes(array('item_class' => 'jumbotron evo_content_block evo_post')); ?> " lang="<?php $Item->lang(); ?> "> <?php $Item->locale_temp_switch(); // Temporarily switch to post locale (useful for multilingual blogs) $action_links = $Item->get_edit_link(array('before' => '', 'after' => '', 'text' => $Item->is_intro() ? get_icon('edit') . ' ' . T_('Edit Intro') : '#', 'class' => button_class('text'))); if ($Item->status != 'published') { $Item->format_status(array('template' => '<div class="evo_status evo_status__$status$ badge pull-right">$status_title$</div>')); } $Item->title(array('link_type' => 'none', 'before' => '<div class="evo_post_title"><h1>', 'after' => '</h1><div class="' . button_class('group') . '">' . $action_links . '</div></div>', 'nav_target' => false)); // ---------------------- POST CONTENT INCLUDED HERE ---------------------- skin_include('_item_content.inc.php', $params); // Note: You can customize the default item content by copying the generic // /skins/_item_content.inc.php file into the current skin folder. // -------------------------- END OF POST CONTENT ------------------------- locale_restore_previous(); // Restore previous locale (Blog locale) ?> </div> <?php // ------------------------------- END OF INTRO-FRONT POST ------------------------------- } // --------------------------------- START OF POSTS ------------------------------------- // Display message if no post: $params_no_content = array('before' => '<div class="msg_nothing">', 'after' => '</div>', 'msg_empty_logged_in' => T_('Sorry, there is nothing to display...'), 'msg_empty_not_logged_in' => T_('This site has no public contents.'));
} else { echo $params['item_title_line_before']; } if ($disp == 'single' || $disp == 'page') { $title_before = $params['item_title_single_before']; $title_after = $params['item_title_single_after']; } else { $title_before = $params['item_title_before']; $title_after = $params['item_title_after']; } // POST TITLE: $Item->title(array('before' => $title_before, 'after' => $title_after, 'link_type' => '#')); // EDIT LINK: if ($Item->is_intro()) { // Display edit link only for intro posts, because for all other posts the link is displayed on the info line. $Item->edit_link(array('before' => '<div class="' . button_class('group') . '">', 'after' => '</div>', 'text' => $Item->is_intro() ? get_icon('edit') . ' ' . T_('Edit Intro') : '#', 'class' => button_class('text'))); } echo $params['item_title_line_after']; } ?> <?php if (!$Item->is_intro()) { // Don't display the following for intro posts ?> <div class="evo_post__info<?php if ($Skin->get_setting('posts_format') == 'simple') { echo ' special_posts_simple_layout__info'; } ?> ">
} } if ($bbcode_plugin_is_enabled && $commented_Item && $commented_Item->can_comment(NULL)) { // Display button to quote this comment echo '<a href="' . $commented_Item->get_permanent_url() . '?mode=quote&qc=' . $Comment->ID . '#form_p' . $commented_Item->ID . '" title="' . T_('Reply with quote') . '" class="' . button_class('text') . ' pull-left quote_button">' . get_icon('comments', 'imgtag', array('title' => T_('Reply with quote'))) . ' ' . T_('Quote') . '</a>'; } $Comment->reply_link(' ', ' ', '#', '#', 'pull-left'); /* Link for replying to the Comment */ if ($params['display_vote_helpful']) { // Display a voting tool $Comment->vote_helpful('', '', '&', true, true, array('helpful_text' => T_('Is this reply helpful?'), 'title_yes' => T_('Mark this reply as helpful!'), 'title_yes_voted' => T_('You think this reply is helpful'), 'title_no' => T_('Mark this reply as not helpful!'), 'title_no_voted' => T_('You think this reply is not helpful'), 'class' => 'vote_helpful')); } // Display Spam Voting system $Comment->vote_spam('', '', '&', true, true, array('title_spam' => T_('Mark this reply as spam!'), 'title_spam_voted' => T_('You think this reply is spam'), 'title_notsure' => T_('Mark this reply as not sure!'), 'title_notsure_voted' => T_('You are not sure in this reply'), 'title_ok' => T_('Mark this reply as OK!'), 'title_ok_voted' => T_('You think this reply is OK'))); echo '<div class="pull-right">'; $comment_redirect_url = rawurlencode($Comment->get_permanent_url()); $Comment->edit_link(' ', '', '#', T_('Edit this reply'), button_class('text'), '&', true, $comment_redirect_url); /* Link for editing */ echo ' <span class="' . button_class('group') . '">'; $delete_button_is_displayed = is_logged_in() && $current_User->check_perm('comment!CURSTATUS', 'delete', false, $Comment); $Comment->moderation_links(array('ajax_button' => true, 'class' => button_class('text'), 'redirect_to' => $comment_redirect_url, 'detect_last' => !$delete_button_is_displayed)); $Comment->delete_link('', '', '#', T_('Delete this reply'), button_class('text'), false, '&', true, false, '#', rawurlencode($commented_Item->get_permanent_url())); /* Link to backoffice for deleting */ echo '</span>'; echo '</div>'; ?> </div> <?php echo $params['comment_end']; $comment_template_counter++;
// Plugin is enabled and activated for comments $bbcode_plugin_is_enabled = true; } } if ($bbcode_plugin_is_enabled && $Item->can_comment(NULL)) { // Display button to quote this post echo '<a href="' . $Item->get_permanent_url() . '?mode=quote&qp=' . $Item->ID . '#form_p' . $Item->ID . '" title="' . T_('Reply with quote') . '" class="' . button_class('text') . ' pull-left quote_button">' . get_icon('comments', 'imgtag', array('title' => T_('Reply with quote'))) . ' ' . T_('Quote') . '</a>'; } echo '<div class="floatright">'; $Item->edit_link(array('before' => ' ', 'after' => '', 'title' => T_('Edit this topic'), 'text' => '#', 'class' => button_class('text'))); echo ' <span class="' . button_class('group') . '">'; // Set redirect after publish to the same category view of the items permanent url $redirect_after_publish = $Item->add_navigation_param($Item->get_permanent_url(), 'same_category', $current_cat); $Item->next_status_link(array('before' => ' ', 'class' => button_class('text'), 'post_navigation' => 'same_category', 'nav_target' => $current_cat), true); $Item->next_status_link(array('class' => button_class('text'), 'before_text' => '', 'post_navigation' => 'same_category', 'nav_target' => $current_cat), false); $Item->delete_link('', '', '#', T_('Delete this topic'), button_class('text'), false, '#', TS_('You are about to delete this post!\\nThis cannot be undone!'), get_caturl($current_cat)); echo '</span>'; echo '</div>'; ?> </div><!-- ../panel-footer --> </div><!-- ../panel panel-default --> </section><!-- ../table evo_content_block --> <?php $Item->locale_temp_switch(); // Temporarily switch to post locale (useful for multilingual blogs) ?> <?php // ------------------ FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE ------------------ skin_include('_item_feedback.inc.php', array_merge($params, array('disp_section_title' => false, 'disp_meta_comment_info' => false, 'comment_post_before' => '<br /><h4 class="evo_comment_post_title ellipsis">', 'comment_post_after' => '</h4>', 'comment_title_before' => '<div class="panel-heading posts_panel_title_wrapper"><div class="cell1 ellipsis"><h4 class="evo_comment_title panel-title">', 'comment_status_before' => '</h4></div>', 'comment_title_after' => '</div>', 'comment_avatar_before' => '<span class="evo_comment_avatar col-md-1 col-sm-2">', 'comment_avatar_after' => '</span>', 'comment_text_before' => '<div class="evo_comment_text col-md-11 col-sm-10">', 'comment_text_after' => '</div>')));
/** * Display link to vote a comment as SPAM if user has edit rights * * @param string to display before link * @param string to display after link * @param string glue between url params * @param boolean save context? * @param boolean true if create AJAX button * @param array Params */ function vote_spam($before = '', $after = '', $glue = '&', $save_context = true, $ajax_button = false, $params = array()) { $params = array_merge(array('display' => false, 'title_spam' => T_('Mark this comment as spam!'), 'title_spam_voted' => T_('You think this comment is spam'), 'title_notsure' => T_('Mark this comment as not sure!'), 'title_notsure_voted' => T_('You are not sure about this comment'), 'title_ok' => T_('Mark this comment as OK!'), 'title_ok_voted' => T_('You think this comment is OK'), 'title_empty' => T_('No votes on spaminess yet.'), 'button_group_class' => button_class('group')), $params); global $current_User; $this->get_Item(); if (!is_logged_in(false) || !$current_User->check_perm('blog_vote_spam_comments', 'edit', false, $this->Item->get_blog_ID())) { // If User has no permission to vote spam return false; } echo $before; $style = $params['display'] ? '' : ' style="display:none"'; echo '<div id="vote_spam_' . $this->ID . '" class="vote_spam"' . $style . '>'; $vote_result = $this->get_vote_spam_disabled(); if ($current_User->ID == $this->author_user_ID) { // Display only vote summary for users on their own comments $result_summary = $this->get_vote_summary('spam', array('result_title' => T_('Spam consensus:'), 'after_result' => '.')); echo !empty($result_summary) ? $result_summary : $params['title_empty']; } else { // Display form to vote echo T_('Spam Vote:') . ' '; echo '<span class="' . $params['button_group_class'] . '">'; foreach ($vote_result['icons_statuses'] as $vote_type => $vote_class) { // Print out 3 buttons for spam voting echo $this->get_vote_link('spam', $vote_type, $vote_class, $glue, $save_context, $ajax_button, $params); } echo '</span>'; if ($vote_result['is_voted']) { // Display vote summary if user already voted on this comment echo ' ' . $this->get_vote_summary('spam', array('result_title' => T_('Consensus:'), 'after_result' => '.')); } } echo '</div>'; echo $after; }
/** * Get the number of user sessions * * @param boolean set true to return the number of sessions as a link to the user sessions list * @return integer|string number of sessions or link to user sessions where the link text is the number of sessions */ function get_num_sessions($link_sessions = false) { global $DB; $num_sessions = $DB->get_var('SELECT count( sess_ID ) FROM T_sessions WHERE sess_user_ID = ' . $this->ID); if ($link_sessions && $num_sessions > 0) { return $num_sessions . ' - <a href="?ctrl=user&user_ID=' . $this->ID . '&user_tab=sessions" class="' . button_class() . ' middle" title="' . format_to_output(T_('Go to user activity'), 'htmlattr') . '">' . get_icon('magnifier', 'imgtag', array('title' => T_('Go to user activity'))) . '</a>'; } return $num_sessions; }
) );*/ // ------------------------- END OF PREV/NEXT POST LINKS ------------------------- // Link for editing: $action_links = $Item->get_edit_link(array('before' => '', 'after' => '', 'text' => $Item->is_intro() ? get_icon('edit') . ' ' . T_('Edit Intro') : '#', 'class' => button_class('text'))); // Link for duplicating: $action_links .= $Item->get_copy_link(array('before' => '', 'after' => '', 'text' => '#icon#', 'class' => button_class())); if ($Item->is_intro()) { // Link to edit category $ItemChapter =& $Item->get_main_Chapter(); if (!empty($ItemChapter)) { $action_links .= $ItemChapter->get_edit_link(array('text' => get_icon('edit') . ' ' . T_('Edit Cat'), 'class' => button_class('text'), 'redirect_page' => 'front')); } } if (!empty($action_links)) { // Group all action icons: $action_links = '<div class="' . button_class('group') . '">' . $action_links . '</div>'; } if ($Item->status != 'published') { $Item->format_status(array('template' => '<div class="evo_status evo_status__$status$ badge pull-right">$status_title$</div>')); } $Item->title(array('link_type' => $params['item_link_type'], 'before' => '<div class="evo_post_title"><h1>', 'after' => '</h1>' . $action_links . '</div>', 'nav_target' => false)); ?> <?php if ($disp == 'single') { ?> <div class="evo_container evo_container__item_single"> <?php // ------------------------- "Item Single" CONTAINER EMBEDDED HERE -------------------------- // Display container contents: skin_container(NT_('Item Single'), array('widget_context' => 'item', 'block_start' => '<div class="$wi_class$">', 'block_end' => '</div>', 'block_title_start' => '<h3>', 'block_title_end' => '</h3>', 'widget_item_tags_before' => '<div class="small text-muted">' . T_('Tags') . ': ', 'widget_item_tags_after' => '</div>', 'widget_item_tags_separator' => ', ', 'widget_item_small_print_before' => '<p class="small text-muted">', 'widget_item_small_print_after' => '</p>', 'widget_item_small_print_display_author' => false, 'widget_item_content_params' => $params));
$Item->edit_link(array('before' => '', 'after' => '', 'class' => button_class('text_primary'), 'text' => get_icon('edit_button') . ' ' . T_('Edit'))); // Display copy button if current user has the rights: $Item->copy_link(array('before' => '', 'after' => '', 'text' => '#icon#', 'class' => button_class())); echo '</span>'; echo '<span class="' . button_class('group') . '"> '; // Display the moderate buttons if current user has the rights: $status_link_params = array('class' => button_class('text'), 'redirect_to' => regenerate_url('', '&highlight=' . $Item->ID . '#item_' . $Item->ID, '', '&')); $Item->next_status_link($status_link_params, true); $Item->next_status_link($status_link_params, false); $next_status_in_row = $Item->get_next_status(false); if ($next_status_in_row && $next_status_in_row[0] != 'deprecated') { // Display deprecate button if current user has the rights: $Item->deprecate_link('', '', get_icon('move_down_grey', 'imgtag', array('title' => '')), '#', button_class()); } // Display delete button if current user has the rights: $Item->delete_link('', ' ', '#', '#', button_class('text'), false); echo '</span>'; ?> <div class="clear"></div> </div> <?php // _____________________________________ Displayed in SINGLE VIEW mode only _____________________________________ if ($action == 'view') { // We are looking at a single post, include files and comments: if ($comment_type == 'meta' && !$current_User->check_perm('meta_comment', 'view', false, $Item)) { // Current user cannot views meta comments $comment_type = 'feedback'; } if (isset($GLOBALS['files_Module'])) {
/** * Display a button to quick upload the files by drag&drop method * * @param integer ID of FileRoot object */ function display_dragdrop_upload_button($params = array()) { global $htsrv_url, $blog, $current_User; $params = array_merge(array('before' => '', 'after' => '', 'fileroot_ID' => 0, 'path' => '', 'list_style' => 'list', 'template_button' => '<div class="qq-uploader">' . '<div class="qq-upload-drop-area"><span>' . TS_('Drop files here to upload') . '</span></div>' . '<div class="qq-upload-button">#button_text#</div>' . '<ul class="qq-upload-list"></ul>' . '</div>', 'template_filerow' => '<li>' . '<span class="qq-upload-file"></span>' . '<span class="qq-upload-spinner"></span>' . '<span class="qq-upload-size"></span>' . '<a class="qq-upload-cancel" href="#">' . TS_('Cancel') . '</a>' . '<span class="qq-upload-failed-text">' . TS_('Failed') . '</span>' . '</li>', 'display_support_msg' => true, 'additional_dropzone' => '', 'filename_before' => '', 'LinkOwner' => NULL, 'display_status_success' => true, 'status_conflict_place' => 'default', 'conflict_file_format' => 'simple', 'resize_frame' => false, 'table_headers' => ''), $params); $FileRootCache =& get_FileRootCache(); $fm_FileRoot = $FileRootCache->get_by_ID($params['fileroot_ID']); if (!is_logged_in() || !$current_User->check_perm('files', 'add', false, $fm_FileRoot)) { // Don't display the button if current user has no permission to upload to the selected file root: return; } $root_and_path = $params['fileroot_ID'] . '::' . $params['path']; $quick_upload_url = $htsrv_url . 'quick_upload.php?upload=true' . (empty($blog) ? '' : '&blog=' . $blog); echo $params['before']; ?> <div id="file-uploader" style="width:100%"> <noscript> <p><?php echo T_('Please enable JavaScript to use file uploader.'); ?> </p> </noscript> </div> <input id="saveBtn" type="submit" style="display:none" name="saveBtn" value="<?php echo T_('Save modified files'); ?> " class="ActionButton" /> <script type="text/javascript"> if( 'draggable' in document.createElement('span') ) { var button_text = '<?php echo TS_('Drag & Drop files to upload here <br /><span>or click to manually select files...</span>'); ?> '; var file_uploader_note_text = '<?php echo TS_('Your browser supports full upload functionality.'); ?> '; } else { var button_text = '<?php echo TS_('Click to manually select files...'); ?> '; var file_uploader_note_text = '<?php echo TS_('Your browser does not support full upload functionality: You can only upload files one by one and you cannot use Drag & Drop.'); ?> '; } var url = <?php echo '"' . $quick_upload_url . '&' . url_crumb('file') . '"'; ?> ; var root_and_path = '<?php echo $root_and_path; ?> '; jQuery( '#fm_dirtree input[type=radio]' ).click( function() { url = "<?php echo $quick_upload_url; ?> "+"&root_and_path="+this.value+"&"+"<?php echo url_crumb('file'); ?> "; root_and_path = this.value; uploader.setParams({root_and_path: root_and_path}); } ); <?php if ($params['LinkOwner'] !== NULL) { // Add params to link a file right after uploading global $b2evo_icons_type; $link_owner_type = $params['LinkOwner']->type; $link_owner_ID = $link_owner_type == 'item' ? $params['LinkOwner']->Item->ID : $params['LinkOwner']->Comment->ID; echo 'url += "&link_owner=' . $link_owner_type . '_' . $link_owner_ID . '&b2evo_icons_type=' . $b2evo_icons_type . '"'; } ?> jQuery( document ).ready( function() { uploader = new qq.FileUploader( { element: document.getElementById( 'file-uploader' ), list_style: '<?php echo $params['list_style']; ?> ', additional_dropzone: '<?php echo $params['additional_dropzone']; ?> ', action: url, debug: true, onSubmit: function( id, fileName ) { var noresults_row = jQuery( 'tr.noresults' ); if( noresults_row.length ) { // Add table headers and remove "No results" row <?php if ($params['table_headers'] != '') { // Append table headers if they are defined ?> noresults_row.parent().parent().prepend( '<?php echo str_replace(array("'", "\n"), array("\\'", ''), $params['table_headers']); ?> ' ); <?php } ?> noresults_row.remove(); } }, onComplete: function( id, fileName, responseJSON ) { if( responseJSON.success != undefined ) { if( responseJSON.success.status == 'fatal' ) { var text = responseJSON.success.text; } else { var text = base64_decode( responseJSON.success.text ); if( responseJSON.success.specialchars == 1 ) { text = htmlspecialchars_decode( text ); } } <?php if ($params['list_style'] == 'list') { // List view ?> if( responseJSON.success.status != undefined && responseJSON.success.status == 'rename' ) { jQuery('#saveBtn').show(); } <?php } ?> } <?php if ($params['list_style'] == 'table') { // Table view ?> var this_row = jQuery( 'tr[rel=file_upload_' + id + ']' ); if( responseJSON.success == undefined || responseJSON.success.status == 'error' || responseJSON.success.status == 'fatal' ) { // Failed this_row.find( '.qq-upload-status' ).html( '<span class="red"><?php echo TS_('Upload ERROR'); ?> </span>' ); if( typeof( text ) == 'undefined' || text == '' ) { // Message for unknown error text = '<?php echo TS_('Server dropped the connection.'); ?> '; } this_row.find( '.qq-upload-file' ).append( ' <span class="result_error">' + text + '</span>' ); this_row.find( '.qq-upload-image, td.size' ).prepend( '<?php echo get_icon('warning_yellow'); ?> ' ); } else { // Success/Conflict var table_view = typeof( responseJSON.success.link_ID ) != 'undefined' ? 'link' : 'file'; var filename_before = '<?php echo str_replace("'", "\\'", $params['filename_before']); ?> '; if( filename_before != '' ) { filename_before = filename_before.replace( '$file_path$', responseJSON.success.path ); } var warning = ''; if( responseJSON.success.warning != '' ) { warning = '<div class="orange">' + responseJSON.success.warning + '</div>'; } // File name or url to view file var file_name = ( typeof( responseJSON.success.link_url ) != 'undefined' ) ? responseJSON.success.link_url : responseJSON.success.newname; if( responseJSON.success.status == 'success' ) { // Success upload <?php if ($params['display_status_success']) { // Display this message only if it is enabled ?> this_row.find( '.qq-upload-status' ).html( '<span class="green"><?php echo TS_('Upload OK'); ?> </span>' ); <?php } else { ?> this_row.find( '.qq-upload-status' ).html( '' ); <?php } ?> this_row.find( '.qq-upload-image' ).html( text ); this_row.find( '.qq-upload-file' ).html( filename_before + '<input type="hidden" value="' + responseJSON.success.newpath + '" />' + '<span class="fname">' + file_name + '</span>' + warning ); } else if( responseJSON.success.status == 'rename' ) { // Conflict on upload <?php $status_conflict_message = '<span class="orange">' . TS_('Upload Conflict') . '</span>'; if ($params['status_conflict_place'] == 'default') { // Default place for a conflict message ?> this_row.find( '.qq-upload-status' ).html( '<?php echo $status_conflict_message; ?> ' ); <?php } else { ?> this_row.find( '.qq-upload-status' ).html( '' ); <?php } ?> this_row.find( '.qq-upload-image' ).append( htmlspecialchars_decode( responseJSON.success.file ) ); this_row.find( '.qq-upload-file' ).html( filename_before + '<input type="hidden" value="' + responseJSON.success.newpath + '" />' + '<span class="fname">' + file_name + '</span>' <?php echo $params['status_conflict_place'] == 'before_button' ? "+ ' - " . $status_conflict_message . "'" : ''; ?> + ' - <a href="#" ' + 'class="<?php echo button_class('text'); ?> roundbutton_text_noicon qq-conflict-replace" ' + 'old="' + responseJSON.success.oldpath + '" ' + 'new="' + responseJSON.success.newpath + '">' + '<div><?php echo TS_('Use this new file to replace the old file'); ?> </div>' + '<div style="display:none"><?php echo TS_('Revert'); ?> </div>' + '</a>' + warning ); var old_file_obj = jQuery( 'input[type=hidden][value="' + responseJSON.success.oldpath + '"]' ); if( old_file_obj.length > 0 ) { old_file_obj.parent().append( ' <span class="orange"><?php echo TS_('(Old File)'); ?> </span>' ); } } if( table_view == 'link' ) { // Update the cells for link view, because these data exist in response this_row.find( '.qq-upload-link-id' ).html( responseJSON.success.link_ID ); this_row.find( '.qq-upload-link-actions' ).prepend( responseJSON.success.link_actions ); this_row.find( '.qq-upload-link-position' ).html( responseJSON.success.link_position ); } } <?php } else { // Simple list ?> jQuery( uploader._getItemByFileId( id ) ).append( text ); if( responseJSON.success == undefined && responseJSON != '' ) { // Disppay the fatal errors jQuery( uploader._getItemByFileId( id ) ).append( responseJSON ); } <?php } if ($params['resize_frame']) { // Resize frame after upload new image ?> update_iframe_height(); jQuery( 'img' ).on( 'load', function() { update_iframe_height(); } ); <?php } ?> }, template: '<?php echo str_replace('#button_text#', "' + button_text + '", $params['template_button']); ?> ', fileTemplate: '<?php echo $params['template_filerow']; ?> ', params: { root_and_path: root_and_path } } ); } ); <?php if ($params['resize_frame']) { // Resize frame after upload new image ?> function update_iframe_height() { var wrapper_height = jQuery( 'body' ).height(); jQuery( 'div#attachmentframe_wrapper', window.parent.document ).css( { 'height': wrapper_height, 'max-height': wrapper_height } ); } <?php } ?> <?php if ($params['list_style'] == 'table') { // A click event for button to replace old file with name ?> jQuery( document ).on( 'click', '.qq-conflict-replace', function() { var this_obj = jQuery( this ); var is_replace = this_obj.children( 'div:first' ).is( ':visible' ); var old_file_name = this_obj.attr( 'old' ); var old_file_obj = jQuery( 'input[type=hidden][value="' + old_file_name + '"]' ); // Element found with old file name on the page var old_file_exists = ( old_file_obj.length > 0 ); this_obj.hide(); // Highlight the rows with new and old files var tr_rows = this_obj.parent().parent().children( 'td' ); if( old_file_exists ) { tr_rows = tr_rows.add( old_file_obj.parent().parent().children( 'td' ) ); } tr_rows.css( 'background', '#FFFF00' ); // Remove previous errors tr_rows.find( 'span.error' ).remove(); jQuery.ajax( { // Replace old file name with new type: 'POST', url: '<?php echo get_secure_htsrv_url(); ?> async.php', data: { action: 'conflict_files', fileroot_ID: '<?php echo $params['fileroot_ID']; ?> ', path: '<?php echo $params['path']; ?> ', oldfile: old_file_name.replace( /^(.+\/)?([^\/]+)$/, '$2' ), newfile: this_obj.attr( 'new' ).replace( /^(.+\/)?([^\/]+)$/, '$2' ), format: '<?php echo $params['conflict_file_format']; ?> ', crumb_conflictfiles: '<?php echo get_crumb('conflictfiles'); ?> ' }, success: function( result ) { var data = jQuery.parseJSON( result ); if( typeof data.error == 'undefined' ) { // Success this_obj.show(); var new_filename_obj = this_obj.parent().find( 'span.fname' ); if( is_replace ) { // The replacing was executed, Change data of html elements this_obj.children( 'div:first' ).hide(); this_obj.children( 'div:last' ).show(); } else { // The replacing was reverting, Put back the data of html elements this_obj.children( 'div:first' ).show(); this_obj.children( 'div:last' ).hide(); } if( old_file_exists ) { // If old file element exists on the page, we can: // Swap old and new names var old_filename_obj = old_file_obj.parent().find( 'span.fname' ); var old_filename_obj_html = old_filename_obj.html(); old_filename_obj.html( new_filename_obj.html() ); new_filename_obj.html( old_filename_obj_html ); var old_icon_link = old_filename_obj.prev(); if( old_icon_link.length == 0 || old_icon_link.get(0).tagName != 'A' ) { old_icon_link = old_filename_obj.parent().prev(); } if( old_icon_link.length > 0 && old_icon_link.get(0).tagName == 'A' ) { // The icons exist to link files, We should swap them var old_href = old_icon_link.attr( 'href' ); old_icon_link.attr( 'href', new_filename_obj.prev().attr( 'href' ) ); new_filename_obj.prev().attr( 'href', old_href ); } } else { // No old file element, Get data from request new_filename_obj.html( is_replace ? data.old : data.new ); } } else { // Failed this_obj.show(); this_obj.parent().append( '<span class="error"> - ' + data.error + '</span>' ); } tr_rows.css( 'background', '' ); } } ); return false; } ); <?php } ?> <?php if ($params['display_support_msg']) { // Display a message about the dragdrop supproting by current browser ?> document.write( '<p class="note">' + file_uploader_note_text + '</p>' ); <?php } ?> </script> <?php echo $params['after']; }
/** * Display a comment corresponding the given comment id * * @param int comment id * @param string where to redirect after comment edit * @param boolean true to set the new redirect param, false otherwise * @param integer Comment index in the current list */ function echo_comment($comment_ID, $redirect_to = NULL, $save_context = false, $comment_index = NULL) { global $current_User, $localtimenow; $CommentCache =& get_CommentCache(); /** * @var Comment */ $Comment = $CommentCache->get_by_ID($comment_ID); $Item =& $Comment->get_Item(); $Blog =& $Item->get_Blog(); $is_published = $Comment->get('status') == 'published'; $expiry_delay = $Item->get_setting('comment_expiry_delay'); $is_expired = !empty($expiry_delay) && $localtimenow - mysql2timestamp($Comment->get('date')) > $expiry_delay; echo '<a name="c' . $comment_ID . '"></a>'; echo '<div id="comment_' . $comment_ID . '" class="bComment bComment'; // check if comment is expired if ($is_expired) { // comment is expired echo 'expired'; } elseif ($Comment->is_meta()) { // meta comment echo 'meta'; } else { // comment is not expired and not meta $Comment->status('raw'); } echo '">'; if ($current_User->check_perm('comment!CURSTATUS', 'moderate', false, $Comment) || $Comment->is_meta() && $current_User->check_perm('meta_comment', 'view', false, $Item)) { // User can moderate this comment OR Comment is meta and current user can view it echo '<div class="bSmallHead">'; echo '<div>'; if ($Comment->is_meta()) { // Display ID for each meta comment echo '<span class="badge badge-info">' . $comment_index . '</span> '; } echo '<div class="bSmallHeadRight">'; $Comment->permanent_link(array('before' => '', 'text' => $Comment->is_meta() ? T_('Meta link') : '#text#')); echo '</div>'; echo '<span class="bDate">'; $Comment->date(); echo '</span>@<span class = "bTime">'; $Comment->time('#short_time'); echo '</span>'; if ($Comment->is_meta()) { // Display only author for meta comment $Comment->author('', '', ' · ' . T_('Author') . ': ', ''); } else { // Display the detailed info for standard comment $Comment->author_email('', ' · Email: <span class="bEmail">', '</span>'); echo ' · <span class="bKarma">'; $Comment->spam_karma(T_('Spam Karma') . ': %s%', T_('No Spam Karma')); echo '</span>'; echo '</div>'; echo '<div style="padding-top:3px">'; if ($is_expired) { echo '<div class="bSmallHeadRight">'; echo '<span class="bExpired">' . T_('EXPIRED') . '</span>'; echo '</div>'; } $Comment->author_ip('IP: <span class="bIP">', '</span> · ', true, true); $Comment->ip_country('', ' · '); $Comment->author_url_with_actions('', true, true); } echo '</div>'; echo '</div>'; echo '<div class="bCommentContent">'; $Comment->format_status(array('template' => '<div class="floatright"><span class="note status_$status$"><span>$status_title$</span></span></div>')); if (!$Comment->is_meta()) { // Don't display the titles for meta comments echo '<div class="bCommentTitle">'; echo $Comment->get_title(); if (get_param('p') == '') { // Don't display this title on a post view page echo ' ' . T_('in response to') . ' <a href="?ctrl=items&blog=' . $Blog->ID . '&p=' . $Item->ID . '">' . $Item->dget('title') . '</a>'; } echo '</div>'; } echo '<div class="bCommentText">'; $Comment->rating(); $Comment->avatar('crop-top-80x80'); if ($current_User->check_perm('meta_comment', 'edit', false, $Comment)) { // Put the comment content into this container to edit by ajax echo '<div id="editable_comment_' . $Comment->ID . '" class="editable_comment_content">'; } $Comment->content('htmlbody', 'true'); if ($current_User->check_perm('meta_comment', 'edit', false, $Comment)) { // End of the container that is used to edit meta comment by ajax echo '</div>'; } echo '</div>'; echo '</div>'; echo '<div class="CommentActionsArea">'; echo '<div class="floatleft">'; // Display edit button if current user has the rights: $Comment->edit_link(' ', ' ', get_icon('edit_button') . ' ' . T_('Edit'), '#', button_class('text_primary') . ' w80px', '&', $save_context, $redirect_to); echo '<span class="' . button_class('group') . '">'; // Display publish NOW button if current user has the rights: $link_params = array('class' => button_class('text'), 'save_context' => $save_context, 'ajax_button' => true, 'redirect_to' => $redirect_to); $Comment->raise_link($link_params); // Display deprecate button if current user has the rights: $Comment->lower_link($link_params); $next_status_in_row = $Comment->get_next_status(false); if ($next_status_in_row && $next_status_in_row[0] != 'deprecated') { // Display deprecate button if current user has the rights: $Comment->deprecate_link('', '', get_icon('move_down_grey', 'imgtag', array('title' => '')), '#', button_class(), '&', true, true); } // Display delete button if current user has the rights: $Comment->delete_link('', '', '#', '#', button_class('text'), false, '&', $save_context, true, '#', $redirect_to); echo '</span>'; echo '</div>'; if (!$Comment->is_meta()) { // Display Spam Voting system $Comment->vote_spam('', '', '&', $save_context, true); } echo '<div class="clear"></div>'; echo '</div>'; } else { // No permissions to moderate of this comment, just preview echo '<div class="bSmallHead">'; echo '<div>'; echo '<div class="bSmallHeadRight">'; echo T_('Visibility') . ': '; echo '<span class="bStatus">'; $Comment->status(); echo '</span>'; echo '</div>'; echo '<span class="bDate">'; $Comment->date(); echo '</span>@<span class = "bTime">'; $Comment->time('#short_time'); echo '</span>'; echo '</div>'; echo '</div>'; if ($is_published) { echo '<div class="bCommentContent">'; echo '<div class="bCommentTitle">'; echo $Comment->get_title(); echo '</div>'; echo '<div class="bCommentText">'; $Comment->rating(); $Comment->avatar(); $Comment->content(); echo '</div>'; echo '</div>'; } echo '<div class="clear"></div>'; } echo '</div>'; // end }
$Form->hidden('subscriptions_form', '1'); $Form->hidden('user_ID', $edited_User->ID); $Form->hidden('edited_user_login', $edited_User->login); if (isset($Blog)) { $Form->hidden('blog', $Blog->ID); } if ($action != 'view') { // We can edit the values: $disabled = false; } else { // display only $disabled = true; } $has_messaging_perm = $edited_User->check_perm('perm_messaging', 'reply', false); $Form->begin_fieldset(T_('Email') . (is_admin_page() ? get_manual_link('user-notifications-tab') : '')); $email_fieldnote = '<a href="mailto:' . $edited_User->get('email') . '" class="' . button_class() . '">' . get_icon('email', 'imgtag', array('title' => T_('Send an email'))) . '</a>'; if ($action != 'view') { // We can edit the values: $Form->text_input('edited_user_email', $edited_User->email, 30, T_('Email address'), $email_fieldnote, array('maxlength' => 255, 'required' => true)); $disabled = false; } else { // display only $Form->info(T_('Email'), $edited_User->get('email'), $email_fieldnote); $disabled = true; } $Form->radio_input('edited_user_email_format', $UserSettings->get('email_format', $edited_User->ID), array(array('value' => 'auto', 'label' => T_('Automatic (HTML + Plain text)')), array('value' => 'html', 'label' => T_('HTML')), array('value' => 'text', 'label' => T_('Plain text'))), T_('Email format'), array('lines' => true)); $Form->end_fieldset(); $Form->begin_fieldset(T_('Communications')); $has_messaging_perm = $edited_User->check_perm('perm_messaging', 'reply', false); $messaging_options = array(array('PM', 1, T_('private messages on this site.'), $UserSettings->get('enable_PM', $edited_User->ID) && $has_messaging_perm, !$has_messaging_perm || $disabled)); $emails_msgform = $Settings->get('emails_msgform');
// Number of edited User's sessions $Form->info_field(T_('# of sessions'), $edited_User->get_num_sessions(true)); // Number of sent and received private messages $messages_sent = $edited_User->get_num_messages('sent'); if ($messages_sent > 0) { $messages_sent .= ' - <a href="' . $activity_tab_url . '#threads_result" class="' . button_class() . ' middle" title="' . format_to_output(T_('Go to user activity'), 'htmlattr') . '">' . get_icon('magnifier', 'imgtag', array('title' => T_('Go to user activity'))) . '</a>'; if ($current_User->check_perm('perm_messaging', 'abuse')) { $messages_sent .= ' - <a href="' . $admin_url . '?ctrl=abuse&colselect_submit=Filter+list&u=' . $edited_User->login . '">' . T_('Go to abuse management') . ' »</a>'; } $messages_sent .= ' - ' . action_icon(T_('Delete All') . '...', 'delete', $admin_url . '?ctrl=user&user_tab=deldata&user_ID=' . $edited_User->ID, ' ' . T_('Delete All') . '...', 3, 4, array('onclick' => 'return user_deldata( ' . $edited_User->ID . ', \'' . get_param('user_tab') . '\')')); $messages_sent .= get_manual_link('delete-user-data'); } $Form->info_field(T_('# of private messages sent'), $messages_sent); $messages_received = $edited_User->get_num_messages('received'); if ($messages_received > 0 && $current_User->check_perm('perm_messaging', 'abuse')) { $messages_received .= ' - <a href="' . $admin_url . '?ctrl=abuse&colselect_submit=Filter+list&u=' . $edited_User->login . '" class="' . button_class() . ' middle" title="' . format_to_output(T_('Go to abuse management'), 'htmlattr') . '">' . get_icon('magnifier', 'imgtag', array('title' => T_('Go to abuse management'))) . '</a>'; } $Form->info_field(T_('# of private messages received'), $messages_received); $edited_user_lastseen = $edited_User->get('lastseen_ts'); $Form->info_field(T_('Last seen on'), empty($edited_user_lastseen) ? '' : mysql2localedatetime($edited_user_lastseen)); $Form->info_field(T_('On IP'), $edited_User->get_last_session_param('ipaddress')); $Form->end_fieldset(); // Usage info $Form->begin_fieldset(T_('Reputation') . get_manual_link('user-admin-reputaion')); $Form->info(T_('Number of posts'), $edited_User->get_reputation_posts()); $Form->info(T_('Comments'), $edited_User->get_reputation_comments(array('view_type' => 'extended'))); $Form->info(T_('Photos'), $edited_User->get_reputation_files(array('file_type' => 'image', 'view_type' => 'extended'))); $Form->info(T_('Audio'), $edited_User->get_reputation_files(array('file_type' => 'audio'))); $Form->info(T_('Other files'), $edited_User->get_reputation_files(array('file_type' => 'other'))); $Form->info(T_('Spam fighter score'), $edited_User->get_reputation_spam()); $Form->end_fieldset();
/** * Show comments awaiting moderation * * @todo fp> move this to a more appropriate place * * @param integer blog ID * @param object CommentList * @param integer limit * @param array comment IDs to exclude * @param boolean TRUE - for script */ function show_comments_awaiting_moderation($blog_ID, $CommentList = NULL, $limit = 5, $comment_IDs = array(), $script = true) { global $current_User, $dispatcher; if (is_null($CommentList)) { // Inititalize CommentList $BlogCache =& get_BlogCache(); $Blog =& $BlogCache->get_by_ID($blog_ID, false, false); $CommentList = new CommentList2($Blog, NULL, 'CommentCache', 'cmnt_fullview_', 'fullview'); $exlude_ID_list = NULL; if (!empty($comment_IDs)) { $exlude_ID_list = '-' . implode(",", $comment_IDs); } $moderation_statuses = explode(',', $Blog->get_setting('moderation_statuses')); // Filter list: $CommentList->set_filters(array('types' => array('comment', 'trackback', 'pingback'), 'statuses' => $moderation_statuses, 'comment_ID_list' => $exlude_ID_list, 'post_statuses' => array('published', 'community', 'protected'), 'order' => 'DESC', 'comments' => $limit)); // Get ready for display (runs the query): $CommentList->display_init(); } $index = 0; $new_comment_IDs = array(); while ($Comment =& $CommentList->get_next()) { // Loop through comments: $new_comment_IDs[] = $Comment->ID; $index = $index + 1; // Only 5 commens should be visible, set hidden status for the rest $hidden_status = $index > 5 ? ' hidden_comment' : ''; echo '<div id="comment_' . $Comment->ID . '" class="dashboard_post dashboard_post_' . ($CommentList->current_idx % 2 ? 'even' : 'odd') . $hidden_status . '">'; /* OLD: echo '<div class="floatright"><span class="note status_'.$Comment->status.'"><span>'; $Comment->status(); echo '</span></span></div>'; NEW: */ $Comment->format_status(array('template' => '<div class="floatright"><span class="note status_$status$"><span>$status_title$</span></span></div>')); echo $Comment->get_author(array('before' => '<div class="dashboard_comment_avatar">', 'after' => '</div>', 'before_user' => '<div class="dashboard_comment_avatar">', 'after_user' => '</div>', 'link_text' => 'only_avatar', 'link_class' => 'user', 'thumb_size' => 'crop-top-80x80', 'thumb_class' => 'user')); echo '<h3 class="dashboard_comment_title">'; if ($Comment->status !== 'draft' || $Comment->author_user_ID == $current_User->ID) { // Display Comment permalink icon echo $Comment->get_permanent_link('#icon#') . ' '; } echo $Comment->get_title(array('author_format' => '<strong>%s</strong>', 'link_text' => 'login')); $comment_Item =& $Comment->get_Item(); echo ' ' . T_('in response to') . ' <a href="?ctrl=items&blog=' . $comment_Item->get_blog_ID() . '&p=' . $comment_Item->ID . '"><strong>' . $comment_Item->dget('title') . '</strong></a>'; echo '</h3>'; echo '<div class="notes">'; $Comment->rating(array('before' => '<div class="dashboard_rating">', 'after' => '</div> • ')); $Comment->date(); $Comment->author_url_with_actions('', true); $Comment->author_email('', ' • Email: <span class="bEmail">', '</span> • '); $Comment->author_ip('IP: <span class="bIP">', '</span> ', true, true); $Comment->ip_country(); $Comment->spam_karma(' • ' . T_('Spam Karma') . ': %s%', ' • ' . T_('No Spam Karma')); echo '</div>'; $Comment->content('htmlbody', true); echo '<div class="dashboard_action_area">'; // Display edit button if current user has the rights: $redirect_to = NULL; if (!$script) { // Set page, where to redirect, because the function is called from async.php (regenerate_url gives => async.php) global $admin_url; $redirect_to = $admin_url . '?ctrl=dashboard&blog=' . $blog_ID; } echo '<div class="floatleft">'; $Comment->edit_link(' ', ' ', get_icon('edit_button') . ' ' . T_('Edit'), '#', button_class('text_primary') . ' btn-sm w80px', '&', true, $redirect_to); echo '<span class="' . button_class('group') . ' btn-group-sm">'; // Display publish NOW button if current user has the rights: $Comment->publish_link('', '', '#', '#', button_class('text'), '&', true, true); // Display deprecate button if current user has the rights: $Comment->deprecate_link('', '', '#', '#', button_class('text'), '&', true, true); // Display delete button if current user has the rights: $Comment->delete_link('', '', '#', '#', button_class('text'), false, '&', true, true); echo '</span>'; echo '</div>'; // Display Spam Voting system $Comment->vote_spam('', '', '&', true, true, array('button_group_class' => button_class('group') . ' btn-group-sm')); echo '<div class="clear"></div>'; echo '</div>'; echo '</div>'; } if (!$script) { echo '<input type="hidden" id="new_badge" value="' . $CommentList->get_total_rows() . '"/>'; } }
} } // Add classes for first and last roundbuttons, because css pseudo-classes don't support to exclude hidden elements function update_moderation_buttons( selector, raise_status, lower_status ) { var parent_selector = '<?php echo button_class('group', true); ?> '; if( typeof( selector ) != 'undefined' ) { parent_selector = selector + ' ' + parent_selector; } selector = parent_selector + '<?php echo button_class('text', true); ?> '; // Clear previous classes of first and last visible buttons jQuery( selector ).removeClass( 'first-child last-child btn_next_status' ); // Make the raise and lower button are visible jQuery( selector + '.btn_raise_status_' + raise_status ).addClass( 'btn_next_status' ); jQuery( selector + '.btn_lower_status_' + lower_status ).addClass( 'btn_next_status' ); // Add classes for first and last buttons to fix round corners jQuery( selector + ':visible:first' ).addClass( 'first-child' ); jQuery( selector + ':visible:last' ).addClass( 'last-child' ); } </script> <?php