* This file is part of the b2evolution/evocms project - {@link http://b2evolution.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/}.
 * Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
 *
 * @package admin
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
global $edited_Domain;
// Determine if we are creating or updating...
global $action;
$creating = $action == 'domain_new';
$Form = new Form(NULL, 'domain_checkchanges', 'post', 'compact');
$Form->global_icon(T_('Cancel editing!'), 'close', regenerate_url('action,domain_ID'));
$Form->begin_form('fform', $creating ? T_('New Domain') : T_('Domain'));
$Form->add_crumb('domain');
$Form->hidden('action', 'domain_update');
$Form->hidden('dom_ID', $edited_Domain->ID);
$Form->hidden_ctrl();
$Form->hidden('tab', get_param('tab'));
$Form->hidden('tab_from', get_param('tab_from'));
$Form->hidden('tab3', get_param('tab3'));
$Form->text_input('dom_name', $edited_Domain->get('name'), 50, T_('Name'), '', array('maxlength' => 250, 'required' => true));
$Form->select_input_array('dom_type', $edited_Domain->get('type'), stats_dom_type_titles(), T_('Referrer type'), '', array('force_keys_as_values' => true, 'required' => true));
$Form->select_input_array('dom_status', $edited_Domain->get('status'), stats_dom_status_titles(), T_('Spam status'), '', array('force_keys_as_values' => true, 'background_color' => stats_dom_status_colors(), 'required' => true));
$Form->end_form(array(array('submit', 'submit', $creating ? T_('Record') : T_('Save Changes!'), 'SaveButton')));
Example #2
0
/**
 * Get domain status title by value
 *
 * @param string Domain status value
 * @param boolean TRUE to escape quotes in titles
 * @return string Domain status title
 */
function stats_dom_status_title($dom_status, $escape_quotes = false)
{
    $dom_status_titles = stats_dom_status_titles($escape_quotes);
    return isset($dom_status_titles[$dom_status]) ? $dom_status_titles[$dom_status] : $dom_status;
}
    $Form->checkbox('dtyp_searcheng', $dtyp_searcheng, T_('Search engines'));
    $Form->checkbox('dtyp_aggregator', $dtyp_aggregator, T_('Feed aggregators'));
    $Form->checkbox('dtyp_email', $dtyp_email, T_('Email domains'));
    $Form->checkbox('dtyp_unknown', $dtyp_unknown, T_('Unknown'));
}
if (get_param('ctrl') == 'antispam') {
    // Set url when we view this page from antispam controller
    $current_url = $admin_url . '?ctrl=antispam&tab3=domains';
} else {
    // Default url for stats controller
    $current_url = $admin_url . '?ctrl=stats&tab=domains&tab3=' . $tab3 . '&blog=' . $blog;
}
$Results->filter_area = array('callback' => 'filter_basedomains', 'url_ignore' => 'results_refdom_page,dtyp_normal,dtyp_searcheng,dtyp_aggregator,dtyp_unknown', 'presets' => array('browser' => array(T_('Regular'), $current_url . '&dtyp_normal=1'), 'robot' => array(T_('Search engines'), $current_url . '&dtyp_searcheng=1'), 'rss' => array(T_('Aggregators'), $current_url . '&dtyp_aggregator=1'), 'email' => array(T_('Email'), $current_url . '&dtyp_email=1'), 'unknown' => array(T_('Unknown'), $current_url . '&dtyp_unknown=1'), 'all' => array(T_('All'), $current_url)));
$Results->title = $page_title . get_manual_link('referring-domains-tab');
$Results->cols[] = array('th' => T_('Domain name'), 'order' => 'dom_name', 'td' => '$dom_name$', 'total' => '<strong>' . T_('Global total') . '</strong>');
$Results->cols[] = array('th' => T_('Type'), 'order' => 'dom_type', 'td_class' => 'dom_type_edit', 'td' => $current_User->check_perm('stats', 'edit') ? '<a href="#" rel="$dom_type$">%stats_dom_type_title( #dom_type# )%</a>' : '%stats_dom_type_title( #dom_type# )%', 'total' => '');
$Results->cols[] = array('th' => T_('Status'), 'order' => 'dom_status', 'td_class' => 'dom_status_edit', 'td' => $current_User->check_perm('stats', 'edit') ? '<a href="#" rel="$dom_status$">%stats_dom_status_title( #dom_status# )%</a>' : '%stats_dom_status_title( #dom_status# )%', 'total' => '', 'extra' => array('style' => 'background-color: %stats_dom_status_color( "#dom_status#" )%;', 'format_to_output' => false));
if ($tab3 == 'top') {
    // Display the hit counts
    $Results->cols[] = array('th' => T_('Hit count'), 'order' => 'hit_count', 'td_class' => 'right', 'total_class' => 'right', 'td' => '$hit_count$', 'total' => $total_hit_count);
    $Results->cols[] = array('th' => T_('Hit %'), 'order' => 'hit_count', 'td_class' => 'right', 'total_class' => 'right', 'td' => '%percentage( #hit_count#, ' . $total_hit_count . ' )%', 'total' => '%percentage( 100, 100 )%');
}
// Display results:
$Results->display();
if ($current_User->check_perm('stats', 'edit')) {
    // Check permission to edit Domains:
    // Print JS to edit a domain type
    echo_editable_column_js(array('column_selector' => '.dom_type_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=dom_type_edit&' . url_crumb('domtype'), 'options' => stats_dom_type_titles(true), 'new_field_name' => 'new_dom_type', 'ID_value' => 'jQuery( ":first", jQuery( this ).parent() ).text()', 'ID_name' => 'dom_name'));
    // Print JS to edit a domain status
    echo_editable_column_js(array('column_selector' => '.dom_status_edit', 'ajax_url' => get_secure_htsrv_url() . 'async.php?action=dom_status_edit&' . url_crumb('domstatus'), 'options' => stats_dom_status_titles(true), 'new_field_name' => 'new_dom_status', 'ID_value' => 'jQuery( ":first", jQuery( this ).parent() ).text()', 'ID_name' => 'dom_name', 'colored_cells' => true));
}
Example #4
0
    $domain_status = $Domain ? $Domain->get('status') : 'unknown';
    $domain_status_icon = '<div id="initial_referer_status_icon" class="status_icon">' . stats_dom_status_icon($domain_status) . '</div>';
    if ($current_User->check_perm('stats', 'edit')) {
        // User can edit Domain
        global $admin_url;
        $initial_referer_domain = $domain_name = url_part($initial_referer, 'host');
        $domain_status_action = '';
        if (!$Domain || $initial_referer_domain != $Domain->get('name')) {
            // Link to create a new domain
            $domain_status_action .= action_icon(sprintf(T_('Add domain %s'), $initial_referer_domain), 'new', $admin_url . '?ctrl=stats&amp;tab=domains&amp;action=domain_new&amp;dom_name=' . $initial_referer_domain . '&amp;dom_status=blocked');
        }
        if ($Domain) {
            // Link to edit existing domain
            $domain_status_action .= action_icon(sprintf(T_('Edit domain %s'), $Domain->get('name')), 'edit', $admin_url . '?ctrl=stats&amp;tab=domains&amp;action=domain_edit&amp;dom_ID=' . $Domain->ID);
        }
        $Form->select_input_array('edited_initial_referer_status', $domain_status, stats_dom_status_titles(), T_('Initial referer status'), '', array('force_keys_as_values' => true, 'background_color' => stats_dom_status_colors(), 'field_suffix' => $domain_status_icon . $domain_status_action));
    } else {
        // Only view status of Domain
        $Form->info(T_('Initial referer status'), $domain_status_icon . stats_dom_status_title($domain_status));
    }
}
//$registration_ts = strtotime( $edited_User->get( 'datecreated' ) );
if ($edited_User->check_status('is_closed')) {
    $account_close_ts = $UserSettings->get('account_close_ts', $edited_User->ID);
    $account_close_date = empty($account_close_ts) ? T_('Unknown date') : format_to_output(date2mysql($account_close_ts));
    //$days_on_site = empty( $account_close_ts ) ? T_( 'Unknown' ) : ( round( ( $account_close_ts - $registration_ts ) / 86400/* 60*60*24 */) );
} else {
    $account_close_date = 'n/a';
    //$days_on_site = ( round( ( $servertimenow - $registration_ts ) / 86400/* 60*60*24 */) );
}
$Form->info_field(T_('Account closed on'), $account_close_date);