$message = $unsaved_message_params['message']; $email_author = $unsaved_message_params['sender_name']; $email_author_address = $unsaved_message_params['sender_address']; } echo str_replace('$form_title$', $params['msgform_form_title'], $params['skin_form_before']); $Form = new Form($submit_url); $Form->switch_template_parts($params['skin_form_params']); $Form->begin_form('bComment'); $Form->add_crumb('newmessage'); if (isset($Blog)) { $Form->hidden('blog', $Blog->ID); } $Form->hidden('recipient_id', $recipient_id); $Form->hidden('post_id', $post_id); $Form->hidden('comment_id', $comment_id); $Form->hidden('redirect_to', url_rel_to_same_host($redirect_to, get_secure_htsrv_url())); $Form->info(T_('To'), $recipient_link); // Note: we use funky field names in order to defeat the most basic guestbook spam bots: // email form $Form->text_input($dummy_fields['name'], $email_author, 40, T_('From'), T_('Your name.'), array('maxlength' => 50, 'class' => 'wide_input', 'required' => true)); $Form->text_input($dummy_fields['email'], $email_author_address, 40, T_('Email'), T_('Your email address. (Will <strong>not</strong> be displayed on this site.)'), array('maxlength' => 150, 'class' => 'wide_input', 'required' => true)); $Form->text_input($dummy_fields['subject'], $subject, 40, T_('Subject'), T_('Subject of your message.'), array('maxlength' => 255, 'class' => 'wide_input', 'required' => true)); $Form->textarea($dummy_fields['content'], $message, 15, T_('Message'), T_('Plain text only.'), 35, 'wide_textarea', true); $Plugins->trigger_event('DisplayMessageFormFieldset', array('Form' => &$Form, 'recipient_ID' => &$recipient_id, 'item_ID' => $post_id, 'comment_ID' => $comment_id)); // Form buttons: echo $Form->begin_field(NULL, ''); // Standard button to send a message $Form->button_input(array('name' => 'submit_message_' . $recipient_id, 'class' => 'submit', 'value' => T_('Send message'))); // Additional buttons from plugins $Plugins->trigger_event('DisplayMessageFormButton', array('Form' => &$Form, 'recipient_ID' => &$recipient_id, 'item_ID' => $post_id, 'comment_ID' => $comment_id)); echo $Form->end_field();
/** * Get the rotate avatar icons * * @param integer File ID * @param array Params * @return string HTML text with 3 icons to rotate avatar */ function get_rotate_avatar_icons($file_ID, $params = array()) { // Make sure we are not missing any param: $params = array_merge(array('before' => '<br />', 'after' => '', 'text' => '', 'user_tab' => 'avatar'), $params); // Init links to rotate avatar if (is_admin_page()) { // Back-office $url_rotate_90_left = regenerate_url('', 'user_tab=' . $params['user_tab'] . '&user_ID=' . $this->ID . '&action=rotate_avatar_90_left&file_ID=' . $file_ID . '&' . url_crumb('user'), '', '&'); $url_rotate_180 = regenerate_url('', 'user_tab=' . $params['user_tab'] . '&user_ID=' . $this->ID . '&action=rotate_avatar_180&file_ID=' . $file_ID . '&' . url_crumb('user'), '', '&'); $url_rotate_90_right = regenerate_url('', 'user_tab=' . $params['user_tab'] . '&user_ID=' . $this->ID . '&action=rotate_avatar_90_right&file_ID=' . $file_ID . '&' . url_crumb('user'), '', '&'); } else { // Front-office global $Blog; $url_rotate_90_left = get_secure_htsrv_url() . 'profile_update.php?user_tab=' . $params['user_tab'] . '&blog=' . $Blog->ID . '&user_ID=' . $this->ID . '&action=rotate_avatar_90_left&file_ID=' . $file_ID . '&' . url_crumb('user'); $url_rotate_180 = get_secure_htsrv_url() . 'profile_update.php?user_tab=' . $params['user_tab'] . '&blog=' . $Blog->ID . '&user_ID=' . $this->ID . '&action=rotate_avatar_180&file_ID=' . $file_ID . '&' . url_crumb('user'); $url_rotate_90_right = get_secure_htsrv_url() . 'profile_update.php?user_tab=' . $params['user_tab'] . '&blog=' . $Blog->ID . '&user_ID=' . $this->ID . '&action=rotate_avatar_90_right&file_ID=' . $file_ID . '&' . url_crumb('user'); } $html = $params['before']; $html .= action_icon(T_('Rotate this picture 90° to the left'), 'rotate_left', $url_rotate_90_left, '', 0, 0, array('style' => 'margin-right:4px')); $html .= action_icon(T_('Rotate this picture 180°'), 'rotate_180', $url_rotate_180, '', 0, 0, array('style' => 'margin-right:4px')); $html .= action_icon(T_('Rotate this picture 90° to the right'), 'rotate_right', $url_rotate_90_right, $params['text'], empty($params['text']) ? 0 : 3, empty($params['text']) ? 0 : 4); $html .= $params['after']; return $html; }
// Load the AdminUI class for the skin. $user_tab = param('user_tab', 'string'); global $current_User, $UserSettings, $is_admin_page; $admin_skin = $UserSettings->get('admin_skin', $current_User->ID); $is_admin_page = true; require_once $adminskins_path . $admin_skin . '/_adminUI.class.php'; $AdminUI = new AdminUI(); } else { // Load Blog skin $BlogCache =& get_BlogCache(); $Blog =& $BlogCache->get_by_ID($blog_ID, true); $skin_ID = $Blog->get_skin_ID(); $SkinCache =& get_SkinCache(); $Skin =& $SkinCache->get_by_ID($skin_ID); } $display_mode = 'js'; $form_action = get_secure_htsrv_url() . 'profile_update.php'; require $inc_path . 'users/views/_user_groups.form.php'; break; default: $Ajaxlog->add(T_('Incorrect action!'), 'error'); break; } $disp = NULL; $ctrl = NULL; if ($current_debug || $current_debug_jslog) { // debug is ON $Ajaxlog->display(NULL, NULL, true, 'all', array('error' => array('class' => 'jslog_error', 'divClass' => false), 'note' => array('class' => 'jslog_note', 'divClass' => false)), 'ul', 'jslog'); } echo '<!-- Ajax response end -->'; exit(0);
if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } load_class('regional/model/_country.class.php', 'Country'); global $Blog, $Session, $Messages, $inc_path; global $action, $user_profile_only, $edited_User, $form_action; if (!is_logged_in()) { // must be logged in! echo '<p class="error">' . T_('You are not logged in.') . '</p>'; return; } // set params if (!isset($params)) { $params = array(); } $params = array_merge(array('display_profile_tabs' => true, 'profile_tabs' => array('block_start' => '<div class="tabs">', 'item_start' => '<div class="option">', 'item_end' => '</div>', 'item_selected_start' => '<div class="selected">', 'item_selected_end' => '</div>', 'block_end' => '</div><div class="clear"></div>'), 'form_action' => get_secure_htsrv_url() . 'profile_update.php'), $params); $form_action = $params['form_action']; $user_profile_only = true; // check if there is unsaved User object stored in Session $edited_User = $Session->get('core.unsaved_User'); if ($edited_User == NULL) { // edited_User is the current_User $edited_User = $current_User; } else { // unsaved user exists, delete it from Session $Session->delete('core.unsaved_User'); if ($edited_User->ID != $current_User->ID) { // edited user ID must be the same as current User debug_die('Inconsistent state, you are allowed to edit only your profile'); } }
/** * Registers headlines required to autocomplete the user logins * * @param string alias, url or filename (relative to rsc/css, rsc/js) for JS/CSS files */ function init_autocomplete_login_js($relative_to = 'rsc_url') { require_js('#jquery#', $relative_to); // dependency // Use hintbox plugin of jQuery // Add jQuery hintbox (autocompletion). // Form 'username' field requires the following JS and CSS. // fp> TODO: think about a way to bundle this with other JS on the page -- maybe always load hintbox in the backoffice // dh> Handle it via http://www.appelsiini.net/projects/lazyload ? // dh> TODO: should probably also get ported to use jquery.ui.autocomplete (or its successor) require_css('jquery/jquery.hintbox.css', $relative_to); require_js('jquery/jquery.hintbox.min.js', $relative_to); add_js_headline('jQuery( document ).ready( function() { jQuery( "input.autocomplete_login" ).hintbox( { url: "' . get_secure_htsrv_url() . 'async.php?action=get_login_list", matchHint: true, autoDimentions: true } ); } );'); }
/** * Display the widget! * * @param array MUST contain at least the basic display params */ function display($params) { global $Blog, $Settings, $Session, $redirect_to, $dummy_fields; if (is_logged_in()) { // No display when user is already registered return false; } if ($Settings->get('newusers_canregister') != 'yes' || !$Settings->get('quick_registration')) { // Display error message when quick registration is disabled echo '<p class="error">' . T_('Quick registration is currently disabled on this system.') . '</p>'; return false; } // Restore the typed in params from the redirected page: $widget_param_input_err_messages = $Session->get('param_input_err_messages_' . $this->ID); $widget_param_input_values = $Session->get('param_input_values_' . $this->ID); if (!empty($widget_param_input_err_messages)) { // Convert param errors to global $param_input_err_messages that is used to display an error text under input field global $param_input_err_messages; $param_input_err_messages = $widget_param_input_err_messages; } // Clear the temp session vars $Session->delete('param_input_err_messages_' . $this->ID); $Session->delete('param_input_values_' . $this->ID); $Session->dbsave(); $this->init_display($params); if (isset($this->BlockCache)) { // Do NOT cache some of these links are using a redirect_to param, which makes it page dependent. // Note: also beware of the source param. // so this will be cached by the PageCache; there is no added benefit to cache it in the BlockCache // (which could have been shared between several pages): $this->BlockCache->abort_collect(); } echo $this->disp_params['block_start']; $redirect_to = param('redirect_to', 'url', regenerate_url('', '', '', '&')); $this->disp_title(); echo $this->disp_params['block_body_start']; if (!empty($this->disp_params['intro'])) { // Intro text echo '<p>' . $this->disp_params['intro'] . '</p>'; } $Form = new Form(get_secure_htsrv_url() . 'register.php', 'register_form', 'post'); $Form->begin_form(); $Form->add_crumb('regform'); $Form->hidden('action', 'quick_register'); $Form->hidden('inskin', true); $Form->hidden('blog', $Blog->ID); $Form->hidden('widget', $this->ID); $Form->hidden('redirect_to', $redirect_to); // E-mail $email_value = isset($widget_param_input_values[$dummy_fields['email']]) ? $widget_param_input_values[$dummy_fields['email']] : ''; $Form->text_input($dummy_fields['email'], $email_value, 50, T_('Your email'), '', array('maxlength' => 255, 'class' => 'input_text', 'required' => true)); if ($this->disp_params['ask_firstname'] != 'no') { // First name $firstname_value = isset($widget_param_input_values['firstname']) ? $widget_param_input_values['firstname'] : ''; $Form->text_input('firstname', $firstname_value, 18, T_('First name'), '', array('maxlength' => 50, 'class' => 'input_text', 'required' => $this->disp_params['ask_firstname'] == 'required')); } if ($this->disp_params['ask_lastname'] != 'no') { // Last name $lastname_value = isset($widget_param_input_values['lastname']) ? $widget_param_input_values['lastname'] : ''; $Form->text_input('lastname', $lastname_value, 18, T_('Last name'), '', array('maxlength' => 50, 'class' => 'input_text', 'required' => $this->disp_params['ask_lastname'] == 'required')); } // Submit button $Form->begin_fieldset('', array('class' => 'fieldset field_register_btn')); $Form->button_input(array('value' => $this->disp_params['button'], 'class' => 'submit')); $Form->end_fieldset(); $Form->end_form(); echo $this->disp_params['block_body_end']; echo $this->disp_params['block_end']; if (!empty($widget_param_input_err_messages)) { // Clear param errors here because we already display them above // Don't display them twice on another widget form $param_input_err_messages = NULL; } return true; }
if ($action != 'view') { // We can edit the values: if ($action != 'new') { // Get other pictures (not main avatar) $user_avatars = $edited_User->get_avatar_Links(); $forbid_link = ''; if (is_admin_page()) { $ctrl_param = '?ctrl=user&user_tab=avatar&user_ID=' . $edited_User->ID; if ($current_User->can_moderate_user($edited_User->ID)) { $forbid_link = action_icon(T_('Forbid using as main profile picture'), 'move_down_orange', $ctrl_param . '&action=forbid_avatar&' . url_crumb('user'), ' ' . T_('Forbid using as main profile picture'), 3, 4) . '<br />'; } $remove_picture_url = $ctrl_param . '&action=remove_avatar&' . url_crumb('user'); $delete_picture_url = $ctrl_param . '&action=delete_avatar&file_ID=' . $edited_User->avatar_file_ID . '&' . url_crumb('user'); } else { $remove_picture_url = get_secure_htsrv_url() . 'profile_update.php?user_tab=avatar&blog=' . $Blog->ID . '&action=remove_avatar&' . url_crumb('user'); $delete_picture_url = get_secure_htsrv_url() . 'profile_update.php?user_tab=avatar&blog=' . $Blog->ID . '&action=delete_avatar&file_ID=' . $edited_User->avatar_file_ID . '&' . url_crumb('user'); } if ($edited_User->has_avatar() || count($user_avatars)) { // If user uploaded at least one profile picture $change_picture_title = T_('Change') . ' »'; $change_picture_icon = 'edit'; } else { // If user has no profile picture yet $change_picture_title = T_('Upload now') . ' »'; $change_picture_icon = 'move_up_green'; } // Main profile picture with action icons to modify it $user_pictures = '<div class="avatartag main image_rounded">' . $edited_User->get_avatar_imgtag('crop-top-320x320', 'avatar', 'top', true, '', 'user', '160x160') . '<div class="avatar_actions">' . action_icon($change_picture_title, $change_picture_icon, get_user_settings_url('avatar', $edited_User->ID), ' ' . $change_picture_title, 3, 4); if ($edited_User->has_avatar() && ($avatar_Link =& $edited_User->get_avatar_Link())) { // Display these actions only for existing avatar file $user_pictures .= '<br />' . action_icon(T_('No longer use this as main profile picture'), 'move_down', $remove_picture_url, ' ' . T_('No longer use this as main profile picture'), 3, 4) . '<br />' . $forbid_link . action_icon(T_('Delete this profile picture'), 'delete', $delete_picture_url, ' ' . T_('Delete this profile picture'), 3, 4, array('onclick' => 'return confirm(\'' . TS_('Are you sure want to delete this picture?') . '\');')) . '<br />' . $edited_User->get_rotate_avatar_icons($edited_User->avatar_file_ID, array('before' => '', 'after' => '<br />', 'text' => ' ' . T_('Rotate'), 'user_tab' => 'avatar')) . $edited_User->get_crop_avatar_icon($edited_User->avatar_file_ID, array('before' => '', 'after' => '', 'text' => ' ' . T_('Crop'), 'user_tab' => 'avatar', 'onclick' => 'return user_crop_avatar( ' . $edited_User->ID . ', ' . $edited_User->avatar_file_ID . ', \'avatar\' )'));
$form_title = ''; $form_class = 'fform user_report_form'; $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n"; if ($display_mode != 'js') { if (!$user_profile_only) { echo_user_actions($Form, $edited_User, $action); } $form_text_title = T_('Report User'); // used for js confirmation message on leave the changed form $form_title = get_usertab_header($edited_User, '', $form_text_title); } $Form->begin_form($form_class, $form_title, array('title' => isset($form_text_title) ? $form_text_title : $form_title)); $Form->hidden_ctrl(); if (is_admin_page()) { // Params for backoffice $Form->hidden('user_tab', $user_tab); $Form->hidden('is_backoffice', 1); } else { // Params for frontoffice global $Blog; $Form->hidden('blog', $Blog->ID); } $close_icon = ''; if ($display_mode == 'js') { // Display a close link for popup window $close_icon = action_icon(T_('Close this window'), 'close', '', '', 0, 0, array('id' => 'close_button', 'class' => 'floatright')); } $Form->begin_fieldset(T_('Report User') . $close_icon, array('class' => 'fieldset clear')); user_report_form(array('Form' => $Form, 'user_ID' => $edited_User->ID, 'crumb_name' => 'user', 'cancel_url' => get_secure_htsrv_url() . 'profile_update.php?' . (is_admin_page() ? 'is_backoffice=1&' : '') . 'action=remove_report&' . 'user_ID=' . $edited_User->ID . '&' . (empty($Blog) || is_admin_page() ? '' : 'blog=' . $Blog->ID . '&') . url_crumb('user'))); $Form->end_fieldset(); $Form->end_form();
<?php /** * This is the form to change a password * * This file is part of the evoCore framework - {@link http://evocore.net/} * See also {@link https://github.com/b2evolution/b2evolution}. * * @license GNU GPL v2 - {@link http://b2evolution.net/about/gnu-gpl-license} * * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/} * * @package htsrv */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } // Header $page_title = T_('Change password'); $wrap_width = '650px'; require dirname(__FILE__) . '/_html_header.inc.php'; // Change password form $params = array('display_profile_tabs' => false, 'display_abandon_link' => false, 'button_class' => ' btn-lg', 'skin_form_params' => $login_form_params, 'form_action' => get_secure_htsrv_url() . 'login.php', 'form_button_action' => 'updatepwd', 'form_hidden_crumb' => 'regform', 'check_User_from_Session' => false); $disp = 'pwdchange'; // Select a form to change a password $Session->set('core.unsaved_User', $forgetful_User); require skin_fallback_path('_profile.disp.php', 6); // Footer require dirname(__FILE__) . '/_html_footer.inc.php';
// fp> TODO: a javascript REFRAME feature would ne neat here: selecting a square area of the img and saving it as a new avatar image if ($current_User->ID == $edited_User->ID || $current_User->check_perm('users', 'edit')) { // Upload or select: global $Settings; if ($Settings->get('upload_enabled') && $Settings->get('fm_enable_roots_user')) { // Upload is enabled and we have permission to use it... $user_avatars = $edited_User->get_avatar_Files(); if (count($user_avatars) > 0) { $info_content = ''; foreach ($user_avatars as $uFile) { if (is_admin_page()) { $url_update = regenerate_url('', 'user_tab=avatar&user_ID=' . $edited_User->ID . '&action=update_avatar&file_ID=' . $uFile->ID . '&' . url_crumb('user'), '', '&'); $url_delete = regenerate_url('', 'user_tab=avatar&user_ID=' . $edited_User->ID . '&action=delete_avatar&file_ID=' . $uFile->ID . '&' . url_crumb('user'), '', '&'); } else { $url_update = get_secure_htsrv_url() . 'profile_update.php?user_tab=avatar&blog=' . $Blog->ID . '&user_ID=' . $edited_User->ID . '&action=update_avatar&file_ID=' . $uFile->ID . '&' . url_crumb('user'); $url_delete = get_secure_htsrv_url() . 'profile_update.php?user_tab=avatar&blog=' . $Blog->ID . '&user_ID=' . $edited_User->ID . '&action=delete_avatar&file_ID=' . $uFile->ID . '&' . url_crumb('user'); } $info_content .= '<div class="avatartag avatar_rounded">'; $info_content .= $uFile->get_tag('', '', '', '', 'crop-top-80x80', 'original', $edited_User->login, 'lightbox[user_pictures]'); $info_content .= '<br />' . action_icon(T_('Use as main picture'), 'move_up', $url_update, T_('Main'), 3, 4, array(), array('style' => 'margin-right:4px')); $info_content .= '<br />' . action_icon(T_('Delete this picture'), 'xross', $url_delete, T_('Delete'), 3, 4, array('onclick' => 'return confirm(\'' . TS_('Are you sure want to delete this picture?') . '\');'), array('style' => 'margin-right:4px')); $info_content .= $edited_User->get_rotate_avatar_icons($uFile->ID); $info_content .= '</div>'; } $Form->info(T_('Other pictures'), $info_content); } $Form->hidden('action', 'upload_avatar'); // The following is mainly a hint to the browser. $Form->hidden('MAX_FILE_SIZE', $Settings->get('upload_maxkb') * 1024); // Upload $info_content = '<input name="uploadfile[]" type="file" size="10" />';
$info_content .= '<div class="avatartag avatar_rounded">'; $info_content .= $user_Link->get_tag(array('before_image' => '', 'before_image_legend' => '', 'after_image_legend' => '', 'after_image' => '', 'image_size' => 'crop-top-160x160', 'image_link_title' => $edited_User->login, 'image_link_rel' => 'lightbox[user_pictures]')); if ($user_Link->File->get('can_be_main_profile')) { // Link to set picture as Main $url_update = is_admin_page() ? regenerate_url('', 'user_tab=avatar&user_ID=' . $edited_User->ID . '&action=update_avatar&file_ID=' . $user_Link->File->ID . '&' . url_crumb('user'), '', '&') : get_secure_htsrv_url() . 'profile_update.php?user_tab=avatar&blog=' . $Blog->ID . '&user_ID=' . $edited_User->ID . '&action=update_avatar&file_ID=' . $user_Link->File->ID . '&' . url_crumb('user'); $info_content .= '<br />' . action_icon(T_('Use as main picture'), 'move_up', $url_update, T_('Main'), 3, 4, array(), array('style' => 'margin-right:4px')); } elseif (is_admin_page() && $can_moderate_user) { // Link to Restore picture if it was forbidden (only for admins) $url_restore = regenerate_url('', 'user_tab=avatar&user_ID=' . $edited_User->ID . '&action=restore_avatar&file_ID=' . $user_Link->File->ID . '&' . url_crumb('user'), '', '&'); $info_content .= '<br />' . action_icon(T_('Restore to use as main picture'), 'move_up', $url_restore, T_('Restore'), 3, 4, array(), array('style' => 'margin-right:4px')); } else { // Display empty line $info_content .= '<br />'; } // Link to Delete picture $url_delete = is_admin_page() ? regenerate_url('', 'user_tab=avatar&user_ID=' . $edited_User->ID . '&action=delete_avatar&file_ID=' . $user_Link->File->ID . '&' . url_crumb('user'), '', '&') : get_secure_htsrv_url() . 'profile_update.php?user_tab=avatar&blog=' . $Blog->ID . '&user_ID=' . $edited_User->ID . '&action=delete_avatar&file_ID=' . $user_Link->File->ID . '&' . url_crumb('user'); $info_content .= '<br />' . action_icon(T_('Delete this picture'), 'delete', $url_delete, T_('Delete'), 3, 4, array('onclick' => 'return confirm(\'' . TS_('Are you sure want to delete this picture?') . '\');'), array('style' => 'margin-right:4px')); // Links to rotate picture $info_content .= $edited_User->get_rotate_avatar_icons($user_Link->File->ID); $info_content .= $edited_User->get_crop_avatar_icon($user_Link->File->ID, array('onclick' => 'return user_crop_avatar( ' . $edited_User->ID . ', ' . $user_Link->File->ID . ' )')); if (is_admin_page() && $can_moderate_user) { // Only if current user can edit this user // Display a message about the duplicated profile picture $info_content .= $user_Link->File->get_duplicated_files_message(array('message' => '<div class="duplicated_avatars">' . get_icon('warning_yellow', 'imgtag', array('style' => 'padding-left:16px')) . ' ' . T_('Also used by: %s') . '</div>')); } $info_content .= '</div>'; } $Form->info(T_('Other pictures'), $info_content); } $Form->hidden('action', 'upload_avatar'); // The following is mainly a hint to the browser.
} }); } ); <?php global $current_User; if (is_admin_page() && is_logged_in() && $current_User->check_perm('users', 'moderate', false)) { // If user can edit the users - Init js to edit user level by AJAX ?> jQuery(document).ready( function() { jQuery('.user_level_edit').each( function() { if( jQuery( this ).find( 'a' ).length == 0 ) { jQuery( this ).removeClass( 'user_level_edit' ); } } ); <?php $user_levels = array(); for ($l = 0; $l <= 10; $l++) { $user_levels[$l] = $l; } // Print JS to edit an user level echo_editable_column_js(array('column_selector' => '.user_level_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=user_level_edit&' . url_crumb('userlevel'), 'options' => $user_levels, 'new_field_name' => 'new_user_level', 'ID_value' => 'jQuery( ":first", jQuery( this ).parent() ).text()', 'ID_name' => 'user_ID', 'print_init_tags' => false)); ?> }); <?php } ?> </script>
/** * Open crop user modal window */ function echo_user_crop_avatar_window() { global $admin_url; if (is_admin_page()) { // Ajax params for backoffice $ajax_url = $admin_url; $ajax_params = "'ctrl': 'user',\n\t\t\t\t'user_tab': 'crop',\n\t\t\t\t'user_tab_from': user_tab_from,\r\n"; } else { // Ajax params for frontoffice global $blog; $ajax_url = get_secure_htsrv_url() . 'anon_async.php'; $ajax_params = "'blog': '{$blog}',\n\t\t\t\t'disp': 'avatar',\n\t\t\t\t'action': 'crop',\r\n"; } ?> <script type="text/javascript"> <?php // Initialize JavaScript to build and open window echo_modalwindow_js(); ?> function user_crop_avatar( user_ID, file_ID, user_tab_from ) { if( typeof( user_tab_from ) == 'undefined' ) { user_tab_from = 'avatar'; } var max_size = 750; var min_size = 320; var viewport_width = jQuery( window ).width(); var viewport_height = jQuery( window ).height(); //console.log( 'viewport', viewport_width, viewport_height ); // Set sizes for modal window: var window_width = viewport_width; var window_height = viewport_height; // Limit window with max & min sizes: window_height = ( window_height > max_size ) ? max_size : ( ( window_height < min_size ) ? min_size : window_height ); window_width = ( window_width > max_size ) ? max_size : ( ( window_width < min_size ) ? min_size : window_width ); //console.log( 'window', window_width, window_height ); // Set margins for normal view of wide screens: var margin_size_width = 170; var margin_size_height = viewport_height > max_size ? 170 : 205; if( viewport_width <= 900 ) { // When width is less than 900px then preview thumbnails are located under big picture, so height margin should be more margin_size_width = 35; margin_size_height = 325; } //console.log( 'margins', margin_size_width, margin_size_height ); // Set image sizes: var image_width = window_width - margin_size_width; var image_height = window_height - margin_size_height; var image_min_size = 130; // Limit image with min size: image_width = ( image_width < image_min_size ) ? image_min_size : image_width; image_height = ( image_height < image_min_size ) ? image_min_size : image_height; //console.log( 'image', image_width, image_height ); // Open modal window with loading animation while ajax request is executing below: openModalWindow( '<span class="loader_img loader_user_report absolute_center" title="<?php echo T_('Loading...'); ?> "></span>', window_width+'px', window_height+'px', true, '<?php echo TS_('Crop profile picture'); ?> ', [ '<?php echo TS_('Crop'); ?> ', 'btn-primary hide' ], true ); // Execute ajax request to load a crop tool: jQuery.ajax( { type: 'POST', url: '<?php echo $ajax_url; ?> ', data: { <?php echo $ajax_params; ?> 'user_ID': user_ID, 'file_ID': file_ID, 'image_width' : image_width, 'image_height' : image_height, 'display_mode': 'js', 'crumb_user': '******'user'); ?> ', }, success: function( result ) { openModalWindow( result, window_width+'px', window_height+'px', true, '<?php echo TS_('Crop profile picture'); ?> ', [ '<?php echo TS_('Crop'); ?> ', 'btn-primary hide' ] ); } } ); return false; } </script> <?php }
$email = utf8_strtolower(param($dummy_fields['email'], 'string', '')); $firstname = param('firstname', 'string', ''); $gender = param('gender', 'string', false); $source = param('source', 'string', 'register form'); $redirect_to = param('redirect_to', 'url', ''); $return_to = param('return_to', 'url', ''); if ($register_user = $Session->get('core.register_user')) { // Get an user data from predefined session (after adding of a comment) $login = preg_replace('/[^a-z0-9 ]/i', '', $register_user['name']); $login = str_replace(' ', '_', $login); $login = substr($login, 0, 20); $email = $register_user['email']; $Session->delete('core.register_user'); } // set secure htsrv url with the same domain as the request has $secure_htsrv_url = get_secure_htsrv_url(); echo str_replace('$form_title$', $params['register_form_title'], $params['skin_form_before']); $Form = new Form($secure_htsrv_url . 'register.php', 'register_form', 'post'); if (!is_null($params['register_form_params'])) { // Use another template param from skin $Form->switch_template_parts($params['register_form_params']); } $Form->add_crumb('regform'); $Form->hidden('inskin', true); if (isset($Blog)) { // for in-skin form $Form->hidden('blog', $Blog->ID); } // disp register form $Form->begin_form($params['form_class_register']); $Plugins->trigger_event('DisplayRegisterFormBefore', array('Form' => &$Form, 'inskin' => true));
} $Results->cols[] = array('th' => T_('Back-office access'), 'order' => 'gset_value', 'td' => '%grp_row_backoffice( #gset_value# )%', 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Level'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap small' . ($has_perm_users_edit ? ' group_level_edit' : ''), 'order' => 'grp_level', 'default_dir' => 'D', 'td' => $has_perm_users_edit ? '<a href="#" rel="$grp_level$">$grp_level$</a>' : '$grp_level$'); function grp_actions(&$row) { global $usedgroups, $Settings, $current_User; $r = ''; if ($current_User->check_perm('users', 'edit', false)) { $r = action_icon(T_('Edit this group...'), 'edit', regenerate_url('ctrl,action', 'ctrl=groups&action=edit&grp_ID=' . $row->grp_ID)); $r .= action_icon(T_('Duplicate this group...'), 'copy', regenerate_url('ctrl,action', 'ctrl=groups&action=new&grp_ID=' . $row->grp_ID)); if ($row->grp_ID != 1 && $row->grp_ID != $Settings->get('newusers_grp_ID') && !in_array($row->grp_ID, $usedgroups)) { // delete $r .= action_icon(T_('Delete this group!'), 'delete', regenerate_url('ctrl,action', 'ctrl=groups&action=delete&grp_ID=' . $row->grp_ID . '&' . url_crumb('group'))); } else { $r .= get_icon('delete', 'noimg'); } } return $r; } $Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap', 'td' => '%grp_actions( {row} )%'); // Display results: $Results->display(); if ($current_User->check_perm('users', 'edit', false)) { // If user can edit the users - Init js to edit group level by AJAX $group_levels = array(); for ($l = 0; $l <= 10; $l++) { $group_levels[$l] = $l; } // Print JS to edit a group level echo_editable_column_js(array('column_selector' => '.group_level_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=group_level_edit&' . url_crumb('grouplevel'), 'options' => $group_levels, 'new_field_name' => 'new_group_level', 'ID_value' => 'jQuery( ":first", jQuery( this ).parent() ).text()', 'ID_name' => 'group_ID')); }
$Results->cols[] = array('th' => T_('Anon. contact form submits'), 'td' => '$aipr_contact_email_count$', 'order' => 'aipr_contact_email_count', 'default_dir' => 'D'); $Results->cols[] = array('th' => T_('Block count'), 'td' => '$aipr_block_count$', 'order' => 'aipr_block_count', 'default_dir' => 'D'); // Get additional columns from the Plugins $Plugins->trigger_event('GetAdditionalColumnsTable', array('table' => 'ipranges', 'column' => 'aipr_IPv4start', 'Results' => $Results)); if ($current_User->check_perm('spamblacklist', 'edit')) { // Check permission to edit IP ranges: /** * Get actions links for IP range * * @param integer IP range ID * @param string Current tab value * @return string HTML links to edit and delete IP range */ function antispam_ipranges_actions($aipr_ID, $tab_param) { global $admin_url; // A link to edit IP range $r = action_icon(T_('Edit this IP range...'), 'properties', $admin_url . '?ctrl=antispam' . $tab_param . '&tab3=ipranges&iprange_ID=' . $aipr_ID . '&action=iprange_edit'); // A link to delete IP range $r .= action_icon(T_('Delete this IP range!'), 'delete', regenerate_url('iprange_ID,action', 'iprange_ID=' . $aipr_ID . '&action=iprange_delete&' . url_crumb('iprange'))); return $r; } $Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'td' => '%antispam_ipranges_actions( #aipr_ID#, "' . $tab_param . '" )%'); } $Results->global_icon(T_('Add a new IP range...'), 'new', regenerate_url('action', 'action=iprange_new'), T_('New IP range') . ' »', 3, 4, array('class' => 'action_icon btn-primary')); $Results->display(); if ($current_User->check_perm('spamblacklist', 'edit')) { // Check permission to edit IP ranges: // Print JS to edit status of IP range echo_editable_column_js(array('column_selector' => '.iprange_status_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=iprange_status_edit&' . url_crumb('iprange'), 'options' => aipr_status_titles(), 'new_field_name' => 'new_status', 'ID_value' => 'jQuery( ":first", jQuery( this ).parent() ).text()', 'ID_name' => 'iprange_ID', 'colored_cells' => true)); }
/** * Registers headlines required to autocomplete the user logins * * @param string alias, url or filename (relative to rsc/css, rsc/js) for JS/CSS files * @param string Library: 'hintbox', 'typeahead' */ function init_autocomplete_login_js($relative_to = 'rsc_url', $library = 'hintbox') { global $blog; require_js('#jquery#', $relative_to); // dependency switch ($library) { case 'typeahead': // Use typeahead library of bootstrap add_js_headline('jQuery( document ).ready( function() { jQuery( "input.autocomplete_login" ).typeahead( null, { displayKey: "login", source: function ( query, cb ) { jQuery.ajax( { url: "' . get_secure_htsrv_url() . 'async.php?action=get_login_list", type: "post", data: { q: query, data_type: "json" }, dataType: "JSON", success: function( logins ) { var json = new Array(); for( var l in logins ) { json.push( { login: logins[ l ] } ); } cb( json ); } } ); } } ); ' . get_prevent_key_enter_js('input.autocomplete_login') . ' } );'); break; case 'hintbox': default: // Use hintbox plugin of jQuery // Add jQuery hintbox (autocompletion). // Form 'username' field requires the following JS and CSS. // fp> TODO: think about a way to bundle this with other JS on the page -- maybe always load hintbox in the backoffice // dh> Handle it via http://www.appelsiini.net/projects/lazyload ? // dh> TODO: should probably also get ported to use jquery.ui.autocomplete (or its successor) require_css('jquery/jquery.hintbox.css', $relative_to); require_js('jquery/jquery.hintbox.min.js', $relative_to); add_js_headline('jQuery( document ).on( "focus", "input.autocomplete_login", function() { var ajax_params = ""; if( jQuery( this ).hasClass( "only_assignees" ) ) { ajax_params = "&user_type=assignees&blog=' . $blog . '"; } jQuery( this ).hintbox( { url: "' . get_secure_htsrv_url() . 'async.php?action=get_login_list" + ajax_params, matchHint: true, autoDimentions: true } ); ' . get_prevent_key_enter_js('input.autocomplete_login') . ' } );'); break; } }
$SQL->SELECT('SQL_NO_CACHE ivc_ID, ivc_code, ivc_expire_ts, ivc_source, ivc_grp_ID, grp_name, grp_level'); $SQL->FROM('T_users__invitation_code'); $SQL->FROM_add('INNER JOIN T_groups ON grp_ID = ivc_grp_ID'); $count_SQL = new SQL(); $count_SQL->SELECT('SQL_NO_CACHE COUNT( ivc_ID )'); $count_SQL->FROM('T_users__invitation_code'); $Results = new Results($SQL->get(), 'ivc_', '-D', $UserSettings->get('results_per_page'), $count_SQL->get()); $Results->title = T_('Invitation codes') . get_manual_link('invitation-codes-list'); /* * Table icons: */ if ($current_User->check_perm('users', 'edit', false)) { // create new group link $Results->global_icon(T_('Create a new invitation code...'), 'new', '?ctrl=invitations&action=new', T_('Add invitation code') . ' »', 3, 4, array('class' => 'action_icon btn-primary')); } $Results->cols[] = array('th' => T_('ID'), 'order' => 'ivc_ID', 'th_class' => 'shrinkwrap', 'td_class' => 'right', 'td' => '$ivc_ID$'); $Results->cols[] = array('th' => T_('Expires'), 'order' => 'ivc_expire_ts', 'td_class' => 'shrinkwrap', 'td' => '$ivc_expire_ts$'); $Results->cols[] = array('th' => T_('Group'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'order' => 'grp_name', 'td' => '$grp_name$ ($grp_level$)'); $Results->cols[] = array('th' => T_('Code'), 'order' => 'ivc_code', 'td' => $current_User->check_perm('users', 'edit', false) ? '<a href="' . $admin_url . '?ctrl=invitations&action=edit&ivc_ID=$ivc_ID$"><b>$ivc_code$</b></a>' : '$ivc_code$'); $Results->cols[] = array('th' => T_('Code'), 'order' => 'ivc_code', 'td' => '<a href="' . get_secure_htsrv_url() . 'register.php?invitation=$ivc_code$">' . T_('Link') . '</a>'); $Results->cols[] = array('th' => T_('Source'), 'order' => 'ivc_source', 'td' => '$ivc_source$'); if ($current_User->check_perm('users', 'edit', false)) { function ivc_actions(&$row) { $r = action_icon(T_('Edit this invitation code...'), 'edit', regenerate_url('ctrl,action', 'ctrl=invitations&ivc_ID=' . $row->ivc_ID . '&action=edit')) . action_icon(T_('Duplicate this invitation code...'), 'copy', regenerate_url('ctrl,action', 'ctrl=invitations&ivc_ID=' . $row->ivc_ID . '&action=new')) . action_icon(T_('Delete this invitation code!'), 'delete', regenerate_url('ctrl,action', 'ctrl=invitations&ivc_ID=' . $row->ivc_ID . '&action=delete&' . url_crumb('invitation'))); return $r; } $Results->cols[] = array('th' => T_('Actions'), 'td_class' => 'shrinkwrap', 'td' => '%ivc_actions( {row} )%'); } // Display results: $Results->display();
/** * 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']; }
echo $ChapterCache->recurse($callbacks, $subset_ID, NULL, 0, 0, array('sorted' => true)); $Table->display_body_end(); $Table->display_list_end(); echo $Table->params['content_end']; echo $results_params['after']; /* fp> TODO: maybe... (a general group move of posts would be more useful actually) echo '<p class="note">'.T_('<strong>Note:</strong> Deleting a category does not delete posts from that category. It will just assign them to the parent category. When deleting a root category, posts will be assigned to the oldest remaining category in the same collection (smallest category number).').'</p>'; */ global $Settings, $dispatcher; // Use a wrapper div to have margin around the form echo '<div id="form_wrapper" style="margin: 2ex auto 1ex">'; $Form = new Form(NULL, 'cat_order_checkchanges', 'post', 'compact'); $Form->begin_form('fform', T_('Category order') . get_manual_link('categories_order')); $Form->add_crumb('collection'); $Form->hidden('ctrl', 'coll_settings'); $Form->hidden('action', 'update'); $Form->hidden('blog', $Blog->ID); $Form->hidden('tab', 'chapters'); $Form->radio_input('category_ordering', $Blog->get_setting('category_ordering'), array(array('value' => 'alpha', 'label' => T_('Alphabetically')), array('value' => 'manual', 'label' => T_('Manually'))), T_('Sort categories'), array('note' => '(' . T_('Note: can be overridden for sub-categories') . ')')); $Form->end_form(array(array('submit', 'submit', T_('Save Changes!'), 'SaveButton'))); echo '</div>'; // form wrapper end if (!$Settings->get('allow_moving_chapters')) { // TODO: check perm echo '<p class="alert alert-info">' . sprintf(T_('<strong>Note:</strong> Moving categories across blogs is currently disabled in the %sblogs settings%s.'), '<a href="' . $dispatcher . '?ctrl=collections&tab=blog_settings#fieldset_wrapper_categories">', '</a>') . '</p> '; } //Flush fadeout $Session->delete('fadeout_array'); // Print JS to edit order of the chapters inline echo_editable_column_js(array('column_selector' => '.cat_order_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=cat_order_edit&blogid=' . $Blog->ID . '&' . url_crumb('catorder'), 'new_field_name' => 'new_cat_order', 'ID_value' => 'jQuery( this ).attr( "rel" )', 'ID_name' => 'cat_ID', 'field_type' => 'text'));
// Initialize funky display vars now: global $postIDlist, $postIDarray; $postIDlist = $ItemList->get_page_ID_list(); $postIDarray = $ItemList->get_page_ID_array(); // DISPLAY table now: $ItemList->display(NULL, $result_fadeout); // Print JS to edit a task priority echo_editable_column_js(array('column_selector' => '.task_priority_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=item_task_edit&field=priority&' . url_crumb('itemtask'), 'options' => item_priority_titles(), 'new_field_name' => 'new_priority', 'ID_value' => 'jQuery( this ).attr( "rel" )', 'ID_name' => 'post_ID', 'colored_cells' => true)); // Print JS to edit a task assigned // Load current blog members into cache: $UserCache =& get_UserCache(); // Load only first 21 users to know when we should display an input box instead of full users list $UserCache->load_blogmembers($Blog->ID, 21, false); // Init this array only for <select> when we have less than 21 users, otherwise we use <input> field with autocomplete feature $field_type = count($UserCache->cache) < 21 ? 'select' : 'text'; $task_assignees = array(0 => T_('No user')); if ($field_type == 'select') { foreach ($UserCache->cache as $User) { $task_assignees[$User->ID] = $User->login; } } echo_editable_column_js(array('column_selector' => '.task_assigned_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=item_task_edit&field=assigned&' . url_crumb('itemtask'), 'options' => $task_assignees, 'new_field_name' => $field_type == 'select' ? 'new_assigned_ID' : 'new_assigned_login', 'ID_value' => 'jQuery( this ).attr( "rel" )', 'ID_name' => 'post_ID', 'field_type' => $field_type, 'field_class' => 'autocomplete_login only_assignees', 'null_text' => TS_('No user'))); // Print JS to edit a task status $ItemStatusCache =& get_ItemStatusCache(); $ItemStatusCache->load_all(); $task_statuses = array(0 => T_('No status')); foreach ($ItemStatusCache->cache as $ItemStatus) { $task_statuses[$ItemStatus->ID] = $ItemStatus->name; } echo_editable_column_js(array('column_selector' => '.task_status_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=item_task_edit&field=status&' . url_crumb('itemtask'), 'options' => $task_statuses, 'new_field_name' => 'new_status', 'ID_value' => 'jQuery( this ).attr( "rel" )', 'ID_name' => 'post_ID'));
/** * GLOBAL HEADER - APP TITLE, LOGOUT, ETC. * * @return string */ function get_page_head() { global $app_shortname, $app_version, $current_User, $htsrv_url_sensitive, $admin_url, $baseurl, $rsc_url; $secure_htsrv_url = get_secure_htsrv_url(); $r = ' <div id="header"> <div id="headinfo"> <span id="headfunctions">' . '<a href="' . $secure_htsrv_url . 'login.php?action=logout&redirect_to=' . rawurlencode(url_rel_to_same_host($admin_url, $secure_htsrv_url)) . '">' . T_('Logout') . '</a> <img src="' . $rsc_url . 'icons/close.gif" width="14" height="14" border="0" class="top" alt="" title="' . T_('Logout') . '" /></a> </span> ' . $app_shortname . ' v <strong>' . $app_version . '</strong> </div> <h1>' . $this->get_title_for_titlearea() . '</h1> </div> '; return $r; }
/** * Display a voting form * * @param array Params */ function display_voting_form($params = array()) { $params = array_merge(array('vote_type' => 'file', 'vote_ID' => 0, 'display_like' => true, 'display_noopinion' => true, 'display_dontlike' => true, 'display_inappropriate' => true, 'display_spam' => true, 'title_text' => T_('My vote:'), 'title_like' => T_('I like this picture'), 'title_like_voted' => T_('You like this!'), 'title_noopinion' => T_('I have no opinion'), 'title_noopinion_voted' => T_('You have no opinion on this.'), 'title_dontlike' => T_('I don\'t like this picture'), 'title_dontlike_voted' => T_('You don\'t like this.'), 'title_inappropriate' => T_('I think the content of this picture is inappropriate'), 'title_spam' => T_('I think this picture was posted by a spammer')), $params); if (!is_logged_in() || empty($params['vote_ID'])) { return; } global $current_User, $DB; $params_like = array('id' => 'votingLike', 'title' => $params['title_like']); $params_noopinion = array('id' => 'votingNoopinion', 'title' => $params['title_noopinion']); $params_dontlike = array('id' => 'votingDontlike', 'title' => $params['title_dontlike']); $params_inappropriate = array('id' => 'votingInappropriate', 'title' => $params['title_inappropriate']); $params_spam = array('id' => 'votingSpam', 'title' => $params['title_spam']); switch ($params['vote_type']) { // Get a voting results for current user case 'file': // Picture $SQL = new SQL('Get file voting for current user'); $SQL->SELECT('fvot_like AS result, fvot_inappropriate AS inappropriate, fvot_spam AS spam'); $SQL->FROM('T_files__vote'); $SQL->WHERE('fvot_file_ID = ' . $DB->quote($params['vote_ID'])); $SQL->WHERE_and('fvot_user_ID = ' . $DB->quote($current_User->ID)); $vote = $DB->get_row($SQL->get()); $params_spam['class'] = 'cboxCheckbox'; break; case 'comment': // Comment $SQL = new SQL(); $SQL->SELECT('cmvt_helpful AS result'); $SQL->FROM('T_comments__votes'); $SQL->WHERE('cmvt_cmt_ID = ' . $DB->quote($params['vote_ID'])); $SQL->WHERE_and('cmvt_user_ID = ' . $DB->quote($current_User->ID)); $SQL->WHERE_and('cmvt_helpful IS NOT NULL'); $vote = $DB->get_row($SQL->get()); break; } if (empty($vote) || is_null($vote->result)) { // Current user didn't vote for this file yet $icon_like = 'thumb_up'; $icon_noopinion = 'ban'; $icon_dontlike = 'thumb_down'; $type_voted = ''; } else { // Current user already voted for this file, We should set a disabled icons correctly switch ($vote->result) { case '-1': // Don't like $type_voted = 'dontlike'; $icon_like = 'thumb_up_disabled'; $icon_noopinion = 'ban_disabled'; $icon_dontlike = 'thumb_down'; $params_dontlike['class'] = 'voted'; $params_dontlike['title'] = $params['title_dontlike_voted']; unset($params_dontlike['id']); break; case '0': // No opinion $type_voted = 'noopinion'; $icon_like = 'thumb_up_disabled'; $icon_noopinion = 'ban'; $icon_dontlike = 'thumb_down_disabled'; $params_noopinion['class'] = 'voted'; $params_noopinion['title'] = $params['title_noopinion_voted']; unset($params_noopinion['id']); break; case '1': // Like $type_voted = 'like'; $icon_like = 'thumb_up'; $icon_noopinion = 'ban_disabled'; $icon_dontlike = 'thumb_down_disabled'; $params_like['class'] = 'voted'; $params_like['title'] = $params['title_like_voted']; unset($params_like['id']); break; } } $checked_inappropriate = ''; $checked_spam = ''; if (!empty($vote)) { // Current user already marked this file if (!empty($vote->inappropriate)) { // File is marked as 'Inappropriate' $checked_inappropriate = ' checked="checked"'; } if (!empty($vote->spam)) { // File is marked as 'Spam' $checked_spam = ' checked="checked"'; } } echo '<span>' . $params['title_text'] . '</span>'; // Set this url for case when JavaScript is not enabled $url = get_secure_htsrv_url() . 'anon_async.php?action=voting&vote_type=' . $params['vote_type'] . '&vote_ID=' . $params['vote_ID'] . '&' . url_crumb('voting'); $redirect_to = regenerate_url(); if (strpos($redirect_to, 'async.php') === false) { // Append a redirect param $url .= '&redirect_to=' . $redirect_to; } if ($params['display_like']) { // Display 'Like' icon $tag_icon = get_icon($icon_like, 'imgtag', $params_like); if ($type_voted == 'like') { echo $tag_icon; } else { $url_like = $url . '&vote_action=like'; $class = strpos($icon_like, 'disabled') !== false ? ' rollover_sprite' : ''; echo '<a href="' . $url_like . '" class="action_icon' . $class . '">' . $tag_icon . '</a>'; } } if ($params['display_noopinion']) { // Display 'No opinion' icon $tag_icon = get_icon($icon_noopinion, 'imgtag', $params_noopinion); if ($type_voted == 'noopinion') { echo $tag_icon; } else { $url_noopinion = $url . '&vote_action=noopinion'; $class = strpos($icon_noopinion, 'disabled') !== false ? ' rollover_sprite' : ''; echo '<a href="' . $url_noopinion . '" class="action_icon' . $class . '">' . $tag_icon . '</a>'; } } if ($params['display_dontlike']) { // Display 'Dont like' icon $tag_icon = get_icon($icon_dontlike, 'imgtag', $params_dontlike); if ($type_voted == 'dontlike') { echo $tag_icon; } else { $url_dontlike = $url . '&vote_action=dontlike'; $class = strpos($icon_dontlike, 'disabled') !== false ? ' rollover_sprite' : ''; echo '<a href="' . $url_dontlike . '" class="action_icon' . $class . '">' . $tag_icon . '</a>'; } } if ($params['display_inappropriate'] || $params['display_spam']) { // Display separator between icons and checkboxes echo '<span class="separator"> </span>'; } if ($params['display_inappropriate']) { // Display 'Inappropriate' checkbox echo '<label for="' . $params_inappropriate['id'] . '" title="' . $params_inappropriate['title'] . '">' . '<input type="checkbox" id="' . $params_inappropriate['id'] . '" name="' . $params_inappropriate['id'] . '"' . $checked_inappropriate . ' />' . '<span>' . T_('Inappropriate') . '</span>' . '</label>'; } if ($params['display_spam']) { // Display 'Spam' checkbox echo '<label for="' . $params_spam['id'] . '" class="' . $params_spam['class'] . '" title="' . $params_spam['title'] . '">' . '<input type="checkbox" id="' . $params_spam['id'] . '" name="' . $params_spam['id'] . '"' . $checked_spam . ' />' . '<span>' . T_('Spam') . '</span>' . '</label>'; } // Create a hidden input with current ID echo '<input type="hidden" id="votingID" value="' . $params['vote_ID'] . '" />'; }
return $regions_count; } $Results->cols[] = array('th' => T_('Regions'), 'td_class' => 'center', 'td' => '%country_regions_count( #ctry_ID# )%', 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Default Currency'), 'td_class' => 'center', 'order' => 'curr_code', 'td' => '$curr_shortcut$ $curr_code$'); /* * ACTIONS TD: */ function ctry_td_actions($ctry_enabled, $ctry_ID) { $r = ''; $redirect_ctrl = param('ctrl', 'string', 'countries'); if ($ctry_enabled == true) { $r .= action_icon(T_('Disable the country!'), 'deactivate', regenerate_url('ctrl,action', 'ctrl=countries&action=disable_country&ctry_ID=' . $ctry_ID . '&redirect_ctrl=' . $redirect_ctrl . '&' . url_crumb('country'))); } else { $r .= action_icon(T_('Enable the country!'), 'activate', regenerate_url('ctrl,action', 'ctrl=countries&action=enable_country&ctry_ID=' . $ctry_ID . '&redirect_ctrl=' . $redirect_ctrl . '&' . url_crumb('country'))); } $r .= action_icon(T_('Edit this country...'), 'edit', regenerate_url('ctrl,action', 'ctrl=countries&ctry_ID=' . $ctry_ID . '&action=edit')); $r .= action_icon(T_('Duplicate this country...'), 'copy', regenerate_url('ctrl,action', 'ctrl=countries&ctry_ID=' . $ctry_ID . '&action=new')); $r .= action_icon(T_('Delete this country!'), 'delete', regenerate_url('ctrl,action', 'ctrl=countries&ctry_ID=' . $ctry_ID . '&action=delete&' . url_crumb('country'))); return $r; } if ($current_User->check_perm('options', 'edit', false)) { $Results->cols[] = array('th' => T_('Actions'), 'td' => '%ctry_td_actions( #ctry_enabled#, #ctry_ID# )%', 'td_class' => 'shrinkwrap'); $Results->global_icon(T_('Create a new country ...'), 'new', regenerate_url('ctrl,action', 'ctrl=countries&action=new'), T_('New country') . ' »', 3, 4, array('class' => 'action_icon btn-primary')); } $Results->display(); if ($current_User->check_perm('options', 'edit')) { // Check permission to edit Country: // Print JS to edit a country status echo_editable_column_js(array('column_selector' => '.country_status_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=country_status_edit&' . url_crumb('country'), 'options' => ctry_status_titles(), 'new_field_name' => 'new_status', 'ID_value' => 'jQuery( this ).attr( "id" )', 'ID_name' => 'ctry_ID', 'colored_cells' => true)); }
if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } load_class('regional/model/_country.class.php', 'Country'); global $Blog, $Session, $Messages, $inc_path; global $action, $user_profile_only, $edited_User, $form_action; if (!is_logged_in()) { // must be logged in! echo '<p class="error">' . T_('You are not logged in.') . '</p>'; return; } // set params if (!isset($params)) { $params = array(); } $params = array_merge(array('display_profile_tabs' => true, 'profile_tabs' => array('block_start' => '<div class="tabs">', 'item_start' => '<div class="option">', 'item_end' => '</div>', 'item_selected_start' => '<div class="selected">', 'item_selected_end' => '</div>', 'block_end' => '</div><div class="clear"></div>'), 'form_action' => get_secure_htsrv_url() . 'profile_update.php', 'form_class_user_avatar' => 'evo_form', 'form_class_user_identity' => 'evo_form', 'form_class_user_pass' => 'evo_form', 'form_class_user_pref' => 'evo_form', 'form_class_user_subs' => 'evo_form'), $params); $form_action = $params['form_action']; $user_profile_only = true; // check if there is unsaved User object stored in Session $edited_User = $Session->get('core.unsaved_User'); if ($edited_User == NULL) { // edited_User is the current_User $edited_User = $current_User; } else { // unsaved user exists, delete it from Session $Session->delete('core.unsaved_User'); if ($edited_User->ID != $current_User->ID) { // edited user ID must be the same as current User debug_die('Inconsistent state, you are allowed to edit only your profile'); } }