function display_login_validator($params = array()) { global $rsc_url, $dummy_fields; $params = array_merge(array('login-id' => $dummy_fields['login']), $params); echo '<script type="text/javascript"> var login_icon_load = \'<img src="' . $rsc_url . 'img/ajax-loader.gif" alt="' . TS_('Loading...') . '" title="' . TS_('Loading...') . '" style="margin:2px 0 0 5px" align="top" />\'; var login_icon_available = \'' . get_icon('allowback', 'imgtag', array('title' => TS_('This username is available.'))) . '\'; var login_icon_exists = \'' . get_icon('xross', 'imgtag', array('title' => TS_('This username is already in use. Please choose another one.'))) . '\'; var login_text_empty = \'' . TS_('Choose an username.') . '\'; var login_text_available = \'' . TS_('This username is available.') . '\'; var login_text_exists = \'' . TS_('This username is already in use. Please choose another one.') . '\'; jQuery( "#register_form #' . $params['login-id'] . '" ).change( function() { // Validate if username is available var note_Obj = jQuery( this ).next().next(); if( jQuery( this ).val() == "" ) { // Login is empty jQuery( "#login_status" ).html( "" ); note_Obj.html( login_text_empty ).attr( "class", "notes" ); } else { // Validate login jQuery( "#login_status" ).html( login_icon_load ); jQuery.ajax( { type: "POST", url: "' . get_samedomain_htsrv_url() . 'anon_async.php", data: "action=validate_login&login="******"exists" ) { // Login already exists jQuery( "#login_status" ).html( login_icon_exists ); note_Obj.html( login_text_exists ).attr( "class", "notes red" ); } else { // Login is available jQuery( "#login_status" ).html( login_icon_available ); note_Obj.html( login_text_available ).attr( "class", "notes green" ); } } } ); } } ); </script>'; }
/** * Get secure htsrv url on the same domain as the http request came from * It is important on login and register calls * _init_hit.inc.php should be called before this call, because ReqHost and ReqPath must be initialized */ function get_secure_htsrv_url() { return get_samedomain_htsrv_url(true); }
/** * Get item edit modes * * @param integer blog ID * @param string action * @param string path to admin page * @param string tab switch params * @return array with modes */ function get_item_edit_modes($blog_ID, $action, $dispatcher, $tab_switch_params) { global $current_User; $BlogCache =& get_BlogCache(); $Blog =& $BlogCache->get_by_ID($blog_ID, false, false); $modes = array(); $modes['simple'] = array('text' => T_('Simple'), 'href' => $dispatcher . '?ctrl=items&action=' . $action . '&tab=simple&' . $tab_switch_params, 'onclick' => 'return b2edit_reload( document.getElementById(\'item_checkchanges\'), \'' . $dispatcher . '?ctrl=items&blog=' . $blog_ID . '\', null, {tab:\'simple\'} );'); $modes['expert'] = array('text' => T_('Expert'), 'href' => $dispatcher . '?ctrl=items&action=' . $action . '&tab=expert&' . $tab_switch_params, 'onclick' => 'return b2edit_reload( document.getElementById(\'item_checkchanges\'), \'' . $dispatcher . '?ctrl=items&blog=' . $blog_ID . '\', null, {tab:\'expert\'} );'); if ($Blog->get_setting('in_skin_editing') && ($current_User->check_perm('blog_post!published', 'edit', false, $Blog->ID) || get_param('p') > 0)) { // Show 'In skin' tab if Blog setting 'In-skin editing' is ON and User has a permission to publish item in this blog $mode_inskin_url = url_add_param($Blog->get('url'), 'disp=edit&' . $tab_switch_params); $mode_inskin_action = get_samedomain_htsrv_url() . 'item_edit.php'; $modes['inskin'] = array('text' => T_('In skin'), 'href' => $mode_inskin_url, 'onclick' => 'return b2edit_reload( document.getElementById(\'item_checkchanges\'), \'' . $mode_inskin_action . '\' );'); } return $modes; }
// - Contact: if ($is_logged_in && $current_User->ID != $User->ID && $current_User->check_perm('perm_messaging', 'reply') && $current_User->check_status('can_edit_contacts')) { // User is logged in, has messaging access permission and is not the same user as displayed user $is_contact = check_contact($User->ID); if ($is_contact === NULL) { // User is not in current User contact list, so allow "Add to my contacts" action $buttons[] = '<button type="button" class="btn btn-default" onclick="return user_contact_groups( ' . $User->ID . ' )">' . T_('Add to Contacts') . '</button>'; } elseif ($is_contact === false) { // User is blocked $buttons[] = '<button type="button" class="btn btn-danger" onclick="return user_contact_groups( ' . $User->ID . ' )">' . T_('Edit Blocked Contact') . '</button>'; } else { // User is on current User contact list $buttons[] = '<button type="button" class="btn btn-success" onclick="return user_contact_groups( ' . $User->ID . ' )">' . T_('Edit Contact') . '</button>'; } $buttons['group'] = array(); $contact_block_url = get_samedomain_htsrv_url() . 'action.php?mname=messaging&disp=contacts&user_ID=' . $user_ID . '&redirect_to=' . rawurlencode(regenerate_url()) . '&' . url_crumb('messaging_contacts'); if ($is_contact === NULL || $is_contact === true) { // Display a button to block user $buttons['group'][] = '<a href="' . $contact_block_url . '&action=block" class="btn btn-warning">' . '<button type="button">' . T_('Block Contact') . '</button>' . '</a>'; } else { // Display a button to unblock user $buttons['group'][] = '<a href="' . $contact_block_url . '&action=unblock" class="btn btn-danger">' . '<button type="button">' . T_('Unblock Contact') . '</button>' . '</a>'; } } // - Report: if ($is_logged_in && $current_User->ID != $User->ID && $current_User->check_status('can_report_user')) { // Current user must be logged in, cannot report own account, and must has a permission to report if (!isset($buttons['group'])) { $buttons['group'] = array(); } // get current User report from edited User
/** * Compose screen: display link files iframe * * @param object Form * @param object LinkOwner object * @param string iframe name * @param boolean true if creating new owner object, false otherwise * @param boolean true to allow folding for this fieldset, false otherwise */ function attachment_iframe(&$Form, &$LinkOwner, $iframe_name = NULL, $creating = false, $fold = false) { global $admin_url; global $current_User, $action; if ($LinkOwner->type == 'item' && !$LinkOwner->Item->get_type_setting('allow_attachments')) { // Attachments are not allowed for current post type return; } if (!isset($GLOBALS['files_Module'])) { return; } // Set title for modal window: $window_title = TS_('Attach files'); if ($LinkOwner->type == 'item') { // Item $window_title = format_to_js(sprintf(T_('Attach files to "%s"'), $LinkOwner->Item->get('title'))); } elseif ($LinkOwner->type == 'comment') { // Comment $window_title = format_to_js(sprintf(T_('Attach files to comment #%s'), $LinkOwner->Comment->ID)); } $fieldset_title = T_('Images & Attachments'); if ($creating) { // Creating new Item $fieldset_title .= ' ' . get_manual_link('images-attachments-panel') . ' - <a id="title_file_add" href="#" class="action_icon">' . get_icon('folder') . ' ' . T_('Attach existing files') . '</a>'; $Form->begin_fieldset($fieldset_title, array('id' => 'itemform_createlinks', 'fold' => $fold)); $Form->submit(array('actionArray[create_edit]', T_('Save post to start uploading files'), 'SaveEditButton')); if (get_param('p') > 0) { // Display a button to duplicate the attachments to new item: $Form->submit(array('actionArray[create_link]', T_('Save & Link files from original'), 'SaveEditButton')); } $Form->end_fieldset(); return; } // Editing link owner $Blog =& $LinkOwner->get_Blog(); if ($iframe_name == NULL) { $iframe_name = 'attach_' . generate_random_key(16); } $fieldset_title .= ' ' . get_manual_link('images-attachments-panel') . ' - ' . action_icon(T_('Refresh'), 'refresh', $admin_url . '?ctrl=links&action=edit_links&link_type=' . $LinkOwner->type . '&mode=iframe&iframe_name=' . $iframe_name . '&link_object_ID=' . $LinkOwner->get_ID(), T_('Refresh'), 3, 4, array('target' => $iframe_name)); if ($current_User->check_perm('files', 'view', false, $Blog->ID) && $LinkOwner->check_perm('edit', false)) { // Check that we have permission to edit owner: $attach_files_url = $admin_url . '?ctrl=files&fm_mode=link_object&link_type=item&link_object_ID=' . $LinkOwner->get_ID(); if ($linkowner_FileList = $LinkOwner->get_attachment_FileList(1)) { // Get first file of the Link Owner: $linkowner_File =& $linkowner_FileList->get_next(); if (!empty($linkowner_File) && $current_User->check_perm('files', 'view', false, $linkowner_File->get_FileRoot())) { // Obtain and use file root of first file: $linkowner_FileRoot =& $linkowner_File->get_FileRoot(); $attach_files_url .= '&root=' . $linkowner_FileRoot->ID; $attach_files_url .= '&path=' . dirname($linkowner_File->get_rdfs_rel_path()) . '/'; } } $fieldset_title .= ' - ' . action_icon(T_('Attach existing files'), 'folder', $attach_files_url, T_('Attach existing files'), 3, 4, array('onclick' => 'return link_attachment_window( \'' . $iframe_name . '\', \'' . $LinkOwner->type . '\', \'' . $LinkOwner->get_ID() . '\' )')) . action_icon(T_('Attach existing files'), 'permalink', $attach_files_url, T_('Attach existing files'), 1, 0, array('target' => '_blank')); } // Get a count of links in order to deny folding when there is at least one link $links_count = count($LinkOwner->get_Links()); $Form->begin_fieldset($fieldset_title, array('id' => 'itemform_links', 'fold' => $fold, 'deny_fold' => $links_count > 0)); echo '<div id="attachmentframe_wrapper">' . '<iframe src="' . $admin_url . '?ctrl=links&link_type=' . $LinkOwner->type . '&action=edit_links&mode=iframe&iframe_name=' . $iframe_name . '&link_object_ID=' . $LinkOwner->get_ID() . '" name="' . $iframe_name . '"' . ' width="100%" marginwidth="0" height="100%" marginheight="0" align="top" scrolling="auto" frameborder="0" id="attachmentframe"></iframe>' . '</div>'; $Form->end_fieldset(); ?> <script type="text/javascript"> <?php // Initialize JavaScript to build and open window echo_modalwindow_js(); ?> function link_attachment_window( iframe_name, link_owner_type, link_owner_ID, root, path, fm_highlight ) { openModalWindow( '<span class="loader_img loader_user_report absolute_center" title="<?php echo T_('Loading...'); ?> "></span>', '90%', '80%', true, '<?php echo $window_title; ?> ', '', true ); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> async.php', data: { 'action': 'link_attachment', 'iframe_name': iframe_name, 'link_owner_type': link_owner_type, 'link_owner_ID': link_owner_ID, 'crumb_link': '<?php echo get_crumb('link'); ?> ', 'root': typeof( root ) == 'undefined' ? '' : root, 'path': typeof( path ) == 'undefined' ? '' : path, 'fm_highlight': typeof( fm_highlight ) == 'undefined' ? '' : fm_highlight }, success: function(result) { openModalWindow( result, '90%', '80%', true, '<?php echo $window_title; ?> ', '' ); } } ); return false; } jQuery( document ).ready( function() { function update_attachment_frame_height() { var body_height = jQuery( '#attachmentframe' ).contents().find( 'body' ).height(); if( body_height == 0 ) { // Some browsers cannot get iframe body height correctly, Use this default min value: body_height = 91; } if( body_height > jQuery( '#attachmentframe_wrapper' ).height() ) { // Expand the frame height if it is more than wrapper height (but max height is 320px): jQuery( '#attachmentframe_wrapper' ).css( 'height', body_height < 320 ? body_height : 320 ); } // Set max-height on each iframe reload in order to avoid a space after upload button: jQuery( '#attachmentframe_wrapper' ).css( 'max-height', body_height ); } jQuery( '#attachmentframe' ).bind( 'load', function() { // Set proper height on frame loading: update_attachment_frame_height(); } ); jQuery( '#icon_folding_itemform_links, #title_folding_itemform_links' ).click( function() { // Use this hack to fix frame height on show attachments fieldset if it was hidden before: update_attachment_frame_height(); } ); jQuery( '#attachmentframe_wrapper' ).resizable( { // Make the frame wrapper resizable minHeight: 80, handles: 's', start: function( e, ui ) { // Create a temp div to disable the mouse over events inside the frame ui.element.append( '<div id="attachmentframe_disabler"></div>' ); }, stop: function( e, ui ) { // Remove the temp div element ui.element.find( '#attachmentframe_disabler' ).remove(); }, resize: function( e, ui ) { // Limit max height jQuery( '#attachmentframe_wrapper' ).resizable( 'option', 'maxHeight', jQuery( '#attachmentframe' ).contents().find( 'body' ).height() ); } } ); jQuery( document ).on( 'click', '#attachmentframe_wrapper .ui-resizable-handle', function() { // Increase height on click jQuery( '#attachmentframe_wrapper' ).css( 'height', jQuery( '#attachmentframe_wrapper' ).height() + 80 ); } ); } ); </script> <?php }
skin_keywords_tag(); ?> <?php skin_opengraph_tags(); ?> <?php robots_tag(); ?> <?php global $htsrv_url; $js_blog_id = ""; if (!empty($Blog)) { // Set global js var "blog_id" $js_blog_id = "\r\n\t\tvar blog_id = '" . $Blog->ID . "';"; } add_js_headline("// Paths used by JS functions:\n\t\tvar htsrv_url = '" . get_samedomain_htsrv_url() . "';" . $js_blog_id); ?> <meta name="generator" content="b2evolution <?php app_version(); ?> " /> <!-- Please leave this for stats --> <?php if ($Blog->get_setting('feed_content') != 'none') { // auto-discovery urls ?> <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php $Blog->disp('rss2_url', 'raw'); ?> " /> <link rel="alternate" type="application/atom+xml" title="Atom" href="<?php $Blog->disp('atom_url', 'raw');
* @global string */ $ReqHost = ''; if (!empty($_SERVER['HTTP_HOST'])) { $ReqHost = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']; } $ReqURL = $ReqHost . $ReqURI; $Debuglog->add('vars: $ReqHost: ' . $ReqHost, 'request'); $Debuglog->add('vars: $ReqURI: ' . $ReqURI, 'request'); $Debuglog->add('vars: $ReqPath: ' . $ReqPath, 'request'); /** * Same domain htsrv url. * * @global string */ $samedomain_htsrv_url = get_samedomain_htsrv_url(); /** * Secure htsrv url. * * @global string */ $secure_htsrv_url = get_secure_htsrv_url(); // on which page are we ? /* old: $pagenow = explode( '/', $_SERVER['PHP_SELF'] ); $pagenow = trim( $pagenow[(count($pagenow) - 1)] ); $pagenow = explode( '?', $pagenow ); $pagenow = $pagenow[0]; */ // find precisely the first occurrence of something.php in PHP_SELF, extract that and ignore any extra path. if (!preg_match('#/([A-Za-z0-9_\\-.]+\\.php[0-9]?)#i', $_SERVER['PHP_SELF'], $matches) && !preg_match('#/([A-Za-z0-9_\\-.]+\\.php[0-9]?)#i', $ReqURI, $matches)) {
} break; } if (!in_array($action, array('new_type', 'edit_type'))) { if ($edited_Item->ID > 0) { // Display a link to history if Item exists in DB $AdminUI->global_icon(T_('History'), '', $edited_Item->get_history_url(), $edited_Item->history_info_icon() . ' ' . T_('History'), 4, 3, array('style' => 'margin-right: 3ex')); // Params we need for tab switching $tab_switch_params = 'p=' . $edited_Item->ID; } else { $tab_switch_params = ''; } if ($Blog->get_setting('in_skin_editing') && ($current_User->check_perm('blog_post!published', 'edit', false, $Blog->ID) || get_param('p') > 0)) { // Show 'In skin' link if Blog setting 'In-skin editing' is ON and User has a permission to publish item in this blog $mode_inskin_url = url_add_param($Blog->get('url'), 'disp=edit&' . $tab_switch_params); $mode_inskin_action = get_samedomain_htsrv_url() . 'item_edit.php'; $AdminUI->global_icon(T_('In skin editing'), 'edit', $mode_inskin_url, ' ' . T_('In skin editing'), 4, 3, array('style' => 'margin-right: 3ex', 'onclick' => 'return b2edit_reload( document.getElementById(\'item_checkchanges\'), \'' . $mode_inskin_action . '\' );')); } $AdminUI->global_icon(T_('Cancel editing!'), 'close', $redirect_to, T_('Cancel'), 4, 2); init_tokeninput_js(); } break; case 'new_mass': $AdminUI->set_coll_list_params('blog_post_statuses', 'edit', array('ctrl' => 'items', 'action' => 'new')); // We don't check the following earlier, because we want the blog switching buttons to be available: if (!blog_has_cats($blog)) { $error_message = T_('Since this blog has no categories, you cannot post into it.'); if ($current_User->check_perm('blog_cats', 'edit', false, $blog)) { // If current user has a permission to create a category global $admin_url; $error_message .= ' ' . sprintf(T_('You must <a %s>create categories</a> first.'), 'href="' . $admin_url . '?ctrl=chapters&blog=' . $blog . '"');
/** * Initialize JavaScript for AJAX loading of regions, subregions and cities * * @param string Prefix of fields group * @param boolean TRUE if region is visible (subregion & city also are visible) */ function echo_regional_js($prefix, $region_visible) { if (!$region_visible) { // If region is NOT visible we don't need in these ajax functions return; } ?> <script type="text/javascript"> <?php /*jQuery( document ).ready( function() { if( jQuery( '#<?php echo $prefix; ?>_ctry_ID' ).val() > 0 && jQuery( '#<?php echo $prefix; ?>_rgn_ID option' ).length == 1 ) { // Preload a regions for case when country is selected as default but not saved in DB load_regions( jQuery( '#<?php echo $prefix; ?>_ctry_ID' ).val(), jQuery( '#<?php echo $prefix; ?>_rgn_ID' ).val() ); } } ); */ ?> jQuery( '#<?php echo $prefix; ?> _ctry_ID' ).change( function () { // Load option list with regions for seleted country load_regions( jQuery( this ).val(), 0 ); } ); jQuery( '#<?php echo $prefix; ?> _rgn_ID' ).change( function () { // Change option list with sub-regions load_subregions( jQuery( '#<?php echo $prefix; ?> _ctry_ID' ).val(), jQuery( this ).val() ); } ); jQuery( '#<?php echo $prefix; ?> _subrg_ID' ).change( function () { // Change option list with cities load_cities( jQuery( '#<?php echo $prefix; ?> _ctry_ID' ).val(), jQuery( '#<?php echo $prefix; ?> _rgn_ID' ).val(), jQuery( this ).val() ); } ); jQuery( '#button_refresh_region' ).click( function () { // Button - Refresh regions load_regions( jQuery( '#<?php echo $prefix; ?> _ctry_ID' ).val(), 0 ); return false; } ); jQuery( '#button_refresh_subregion' ).click( function () { // Button - Refresh sub-regions load_subregions( jQuery( '#<?php echo $prefix; ?> _ctry_ID' ).val(), jQuery( '#<?php echo $prefix; ?> _rgn_ID' ).val() ); return false; } ); jQuery( '#button_refresh_city' ).click( function () { // Button - Refresh cities load_cities( jQuery( '#<?php echo $prefix; ?> _ctry_ID' ).val(), jQuery( '#<?php echo $prefix; ?> _rgn_ID' ).val(), jQuery( '#<?php echo $prefix; ?> _subrg_ID' ).val() ); return false; } ); function load_regions( country_ID, region_ID ) { // Load option list with regions for seleted country jQuery( '#<?php echo $prefix; ?> _rgn_ID' ).next().find( 'button' ).hide().next().show(); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_regions_option_list&page=edit&mode=load_all&ctry_id=' + country_ID + '&rgn_id=' + region_ID, success: function( result ) { jQuery( '#<?php echo $prefix; ?> _rgn_ID' ).next().find( 'button' ).show().next().hide(); result = ajax_debug_clear( result ); var options = result.split( '-##-' ); jQuery( '#<?php echo $prefix; ?> _rgn_ID' ).html( options[0] ); jQuery( '#<?php echo $prefix; ?> _subrg_ID' ).html( options[1] ); jQuery( '#<?php echo $prefix; ?> _city_ID' ).html( options[2] ); } } ); } function load_subregions( country_ID, region_ID ) { // Load option list with sub-regions for seleted region jQuery( '#<?php echo $prefix; ?> _subrg_ID' ).next().find( 'button' ).hide().next().show(); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_subregions_option_list&page=edit&mode=load_all&ctry_id=' + country_ID + '&rgn_id=' + region_ID, success: function( result ) { jQuery( '#<?php echo $prefix; ?> _subrg_ID' ).next().find( 'button' ).show().next().hide(); result = ajax_debug_clear( result ); var options = result.split( '-##-' ); jQuery( '#<?php echo $prefix; ?> _subrg_ID' ).html( options[0] ); jQuery( '#<?php echo $prefix; ?> _city_ID' ).html( options[1] ); } } ); } function load_cities( country_ID, region_ID, subregion_ID ) { // Load option list with cities for seleted region or sub-region jQuery( '#<?php echo $prefix; ?> _city_ID' ).next().find( 'button' ).hide().next().show(); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_cities_option_list&page=edit&ctry_id=' + country_ID + '&rgn_id=' + region_ID + '&subrg_id=' + subregion_ID, success: function( result ) { jQuery( '#<?php echo $prefix; ?> _city_ID' ).html( ajax_debug_clear( result ) ); jQuery( '#<?php echo $prefix; ?> _city_ID' ).next().find( 'button' ).show().next().hide(); } } ); } </script> <?php }
/** * Callback to add filters on top of the result set * * @param Form */ function callback_filter_userlist(&$Form) { global $Settings, $current_User; $Form->hidden('filter', 'new'); $Form->text('keywords', get_param('keywords'), 20, T_('Name'), '', 50); echo '<span class="nowrap">'; $Form->checkbox('gender_men', get_param('gender_men'), T_('Men')); $Form->checkbox('gender_women', get_param('gender_women'), T_('Women')); echo '</span>'; if (!is_admin_page()) { echo '<br />'; } if (is_admin_page()) { // show this filters only on admin interface if ($current_User->check_perm('users', 'edit')) { // Show "Reported users" filter only for users with edit user permission $Form->checkbox('reported', get_param('reported'), T_('Reported users')); $Form->checkbox('custom_sender_email', get_param('custom_sender_email'), T_('Users with custom sender address')); $Form->checkbox('custom_sender_name', get_param('custom_sender_name'), T_('Users with custom sender name')); } $Form->select_input_array('account_status', get_param('account_status'), get_user_statuses(T_('All')), T_('Account status')); $GroupCache = new DataObjectCache('Group', true, 'T_groups', 'grp_', 'grp_ID', 'grp_name'); $group_options_array = array('-1' => T_('All (Ungrouped)'), '0' => T_('All (Grouped)')) + $GroupCache->get_option_array(); $Form->select_input_array('group', get_param('group'), $group_options_array, T_('User group'), '', array('force_keys_as_values' => true)); echo '<br />'; } if (user_country_visible()) { // Filter by country load_class('regional/model/_country.class.php', 'Country'); load_funcs('regional/model/_regional.funcs.php'); $CountryCache =& get_CountryCache(T_('All')); $Form->select_country('country', get_param('country'), $CountryCache, T_('Country'), array('allow_none' => true)); } if (user_region_visible()) { // Filter by region echo '<span id="region_filter"' . (!regions_exist(get_param('country'), true) ? ' style="display:none"' : '') . '>'; $Form->select_input_options('region', get_regions_option_list(get_param('country'), get_param('region')), T_('Region')); echo '</span>'; } if (user_subregion_visible()) { // Filter by subregion echo '<span id="subregion_filter"' . (!subregions_exist(get_param('region'), true) ? ' style="display:none"' : '') . '>'; $Form->select_input_options('subregion', get_subregions_option_list(get_param('region'), get_param('subregion')), T_('Sub-region')); echo '</span>'; } if (user_city_visible()) { // Filter by city echo '<span id="city_filter"' . (!cities_exist(get_param('country'), get_param('region'), get_param('subregion'), true) ? ' style="display:none"' : '') . '>'; $Form->select_input_options('city', get_cities_option_list(get_param('country'), get_param('region'), get_param('subregion'), get_param('city')), T_('City')); echo '</span>'; } echo '<br />'; $Form->interval('age_min', get_param('age_min'), 'age_max', get_param('age_max'), 3, T_('Age group')); echo '<br />'; $criteria_types = param('criteria_type', 'array/integer'); $criteria_values = param('criteria_value', 'array/string'); if (count($criteria_types) == 0) { // Init one criteria fieldset for first time $criteria_types[] = ''; $criteria_values[] = ''; } foreach ($criteria_types as $c => $type) { $value = trim(strip_tags($criteria_values[$c])); if ($value == '' && count($criteria_types) > 1 && $c > 0) { // Don't display empty field again after filter request continue; } if ($c > 0) { // Separator between criterias echo '<br />'; } $Form->output = false; $criteria_input = $Form->text('criteria_value[]', $value, 17, '', '', 50); $criteria_input .= get_icon('add', 'imgtag', array('rel' => 'add_criteria')); $Form->output = true; global $user_fields_empty_name; $user_fields_empty_name = T_('Select...'); $Form->select('criteria_type[]', $type, 'callback_options_user_new_fields', T_('Specific criteria'), $criteria_input); } if (user_region_visible()) { // JS functions for AJAX loading of regions, subregions & cities ?> <script type="text/javascript"> jQuery( '#country' ).change( function() { var this_obj = jQuery( this ); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_regions_option_list&ctry_id=' + jQuery( this ).val(), success: function( result ) { jQuery( '#region' ).html( ajax_debug_clear( result ) ); if( jQuery( '#region option' ).length > 1 ) { jQuery( '#region_filter' ).show(); } else { jQuery( '#region_filter' ).hide(); } load_subregions( 0 ); // Reset sub-regions } } ); } ); jQuery( '#region' ).change( function () { // Change option list with sub-regions load_subregions( jQuery( this ).val() ); } ); jQuery( '#subregion' ).change( function () { // Change option list with cities load_cities( jQuery( '#country' ).val(), jQuery( '#region' ).val(), jQuery( this ).val() ); } ); function load_subregions( region_ID ) { // Load option list with sub-regions for seleted region jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_subregions_option_list&rgn_id=' + region_ID, success: function( result ) { jQuery( '#subregion' ).html( ajax_debug_clear( result ) ); if( jQuery( '#subregion option' ).length > 1 ) { jQuery( '#subregion_filter' ).show(); } else { jQuery( '#subregion_filter' ).hide(); } load_cities( jQuery( '#country' ).val(), region_ID, 0 ); } } ); } function load_cities( country_ID, region_ID, subregion_ID ) { // Load option list with cities for seleted region or sub-region jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_cities_option_list&ctry_id=' + country_ID + '&rgn_id=' + region_ID + '&subrg_id=' + subregion_ID, success: function( result ) { jQuery( '#city' ).html( ajax_debug_clear( result ) ); if( jQuery( '#city option' ).length > 1 ) { jQuery( '#city_filter' ).show(); } else { jQuery( '#city_filter' ).hide(); } } } ); } </script> <?php } }
/** * Get an url to download file * * @param array Params * @return string|boolean URL or FALSE when Link object is broken */ function get_download_url($params = array()) { $params = array_merge(array('glue' => '&', 'type' => 'page'), $params); if (!($File =& $this->get_File()) || !($LinkOwner =& $this->get_LinkOwner())) { // Broken Link return false; } if ($LinkOwner->type == 'item' && $LinkOwner->Item) { // Use specific url for Item to download switch ($params['type']) { case 'action': // Get URL to froce download a file if ($File->get_ext() == 'zip') { // Provide direct url to ZIP files // NOTE: The same hardcoded place is in the file "htsrv/download.php", lines 56-60 return $File->get_url(); } else { // For other files use url through special file that forces a download action return get_samedomain_htsrv_url() . 'download.php?link_ID=' . $this->ID; } case 'page': default: // Get URL to display a page with info about file and item return url_add_param($LinkOwner->Item->get_permanent_url('', '', $params['glue']), 'download=' . $this->ID, $params['glue']); } } else { // Use standard url for all other types return $File->get_view_url(false); } }
/** * Load goals on changing of category */ function echo_onchange_goal_cat() { global $blog; ?> <script type="text/javascript"> jQuery( '#goal_cat_ID' ).change( function() { jQuery( '#goal_ID' ).next().find( 'img' ).show(); var cat_ID = jQuery( this ).val(); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> async.php', data: 'action=get_goals&cat_id=' + cat_ID + '&blogid=<?php echo $blog; ?> &crumb_itemgoal=<?php echo get_crumb('itemgoal'); ?> ', success: function( result ) { jQuery( '#goal_ID' ).html( ajax_debug_clear( result ) ).next().find( 'img' ).hide(); } } ); } ); </script> <?php }
// ---------------------- 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 ------------------------- // this will end a </section> ?> </article> </div> <?php // ----------------------- ITEM BLOCK END ----------------------- // Display a button to accept the terms OR info text if current user already accepted them: if (is_logged_in()) { // If user is logged in: if ($UserSettings->get('terms_accepted', $current_User->ID)) { // If current user already accepted: echo $params['terms_info_before'] . T_('You already accepted these terms.') . $params['terms_info_after']; } else { // Otherwise display a button to accept: $Form = new Form(get_samedomain_htsrv_url() . 'accept_terms.php'); $Form->begin_form(); $Form->hidden('redirect_to', $redirect_to); echo $params['terms_button_before']; $Form->button(array('submit', '', T_('I accept these terms'), 'btn-success btn-lg')); echo $params['terms_button_after']; $Form->end_form(); } } // Restore previous locale (Blog locale): locale_restore_previous(); }
/** * Get block/unblock icon * * @param block value * @param user ID * @return icon */ function contact_block($block, $user_ID, $user_status) { if ($user_status == 'closed') { return ''; } // set action url $action_url = regenerate_url(); if (!is_admin_page()) { // in front office the action will be processed by messaging module handle_htsrv_action() through action.php $action_url = get_samedomain_htsrv_url() . 'action.php?mname=messaging&disp=contacts&redirect_to=' . rawurlencode($action_url); } if ($block == 0) { return action_icon(T_('Block contact'), 'file_allowed', $action_url . '&action=block&user_ID=' . $user_ID . '&' . url_crumb('messaging_contacts')); } else { return action_icon(T_('Unblock contact'), 'file_not_allowed', $action_url . '&action=unblock&user_ID=' . $user_ID . '&' . url_crumb('messaging_contacts')); } }
/** * JS Behaviour: Output JavaScript code to moderate the comments * Vote on the comment * Change a status of the comment */ function echo_comment_moderate_js() { if (!is_logged_in(false)) { return false; } global $Blog; if (empty($Blog)) { return false; } ?> <script type="text/javascript"> /* <![CDATA[ */ function fadeIn( selector, color ) { if( jQuery( selector ).length == 0 ) { return; } if( jQuery( selector ).get(0).tagName == 'TR' ) { // Fix selector, <tr> cannot have a css property background-color selector = selector + ' td'; } var bg_color = jQuery( selector ).css( 'backgroundColor' ); jQuery( selector ).animate( { backgroundColor: color }, 200 ); return bg_color; } function fadeInStatus( selector, status ) { switch( status ) { case 'published': return fadeIn( selector, '#99EE44' ); case 'community': return fadeIn( selector, '#2E8BB9' ); case 'protected': return fadeIn( selector, '#FF9C2A' ); case 'review': return fadeIn( selector, '#CC0099' ); } } // Display voting tool when JS is enable jQuery( '.vote_spam' ).show(); // Set comments vote function setCommentVote( id, type, vote ) { var row_selector = '#comment_row_' + id; var highlight_class = ''; var color = ''; switch(vote) { case 'spam': color = fadeIn( row_selector, '#ffc9c9' ); highlight_class = 'roundbutton_red'; break; case 'notsure': color = fadeIn( row_selector, '#bbbbbb' ); break; case 'ok': color = fadeIn( row_selector, '#bcffb5' ); highlight_class = 'roundbutton_green'; break; } if( highlight_class != '' ) { jQuery( '#vote_'+type+'_'+id ).find( 'a.roundbutton, span.roundbutton' ).addClass( highlight_class ); } jQuery.ajax({ type: "POST", url: "<?php echo get_samedomain_htsrv_url(); ?> anon_async.php", data: { "blogid": "<?php echo $Blog->ID; ?> ", "commentid": id, "type": type, "vote": vote, "action": "set_comment_vote", "crumb_comment": "<?php echo get_crumb('comment'); ?> ", }, success: function(result) { if( color != '' ) { // Revert the color fadeIn( row_selector, color ); } jQuery("#vote_"+type+"_"+id).after( ajax_debug_clear( result ) ); jQuery("#vote_"+type+"_"+id).remove(); } }); } // Set comment status function setCommentStatus( id, status, redirect_to ) { var row_selector = '[id=comment_row_' + id + ']'; var color = fadeInStatus( row_selector, status ); jQuery.ajax({ type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: { 'blogid': '<?php echo $Blog->ID; ?> ', 'commentid': id, 'status': status, 'action': 'moderate_comment', 'redirect_to': redirect_to, 'crumb_comment': '<?php echo get_crumb('comment'); ?> ', }, success: function(result) { if( color != '' ) { // Revert the color fadeIn( row_selector, color ); } var statuses = ajax_debug_clear( result ).split( ':' ); var new_status = statuses[0]; if( new_status == '' ) { // Status was not changed return; } var class_name = jQuery( row_selector ).attr( 'class' ); class_name = class_name.replace( /vs_([a-z]+)/g, 'vs_' + new_status ); jQuery( row_selector ).attr( 'class', class_name ); update_moderation_buttons( row_selector, statuses[1], statuses[2] ); } }); } // 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 = '.roundbutton_group '; if( typeof( selector ) != 'undefined' ) { parent_selector = selector + ' ' + parent_selector; } selector = parent_selector + '.roundbutton_text'; // 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_' + raise_status ).addClass( 'btn_next_status' ); jQuery( selector + '.btn_lower_' + 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 }
{ result = ajax_debug_clear( result ); var options = result.split( '-##-' ); jQuery( '#r' ).html( options[0] ); jQuery( '#sr' ).html( options[1] ); } } ); } ); jQuery( '#r' ).change( function () { // Change option list with sub-regions load_subregions( jQuery( this ).val() ); } ); function load_subregions( region_ID ) { // Load option list with sub-regions for seleted region jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_subregions_option_list&rgn_id=' + region_ID, success: function( result ) { jQuery( '#sr' ).html( ajax_debug_clear( result ) ); } } ); } </script>
/** * Initialize JavaScript for AJAX changing of an accept status of organizations for each user */ function echo_user_organization_js() { global $current_User; if (!$current_User->check_perm('users', 'edit')) { // Only admins can change an accept status of organizations return; } ?> <script type="text/javascript"> jQuery( document ).on( 'click', 'span[rel^=org_status_]', function() { // Change an accept status of organization var this_obj = jQuery( this ); var params = '<?php global $b2evo_icons_type; echo empty($b2evo_icons_type) ? '' : '&b2evo_icons_type=' . $b2evo_icons_type; ?> '; jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> async.php', data: 'action=change_user_org_status&status=' + this_obj.attr( 'rel' ) + '&crumb_userorg=<?php echo get_crumb('userorg'); ?> ' + params, success: function( result ) { this_obj.after( ajax_debug_clear( result ) ).remove(); } } ); } ); </script> <?php }