function dashboard_section_system_info($params, $return = null)
{
    global $tables, $smarty;
    // Set the dashboard code name here
    $name = 'system_info';
    // If the section is disabled then skip it on dashboard
    if ($params['mode'] == 'dashboard' && $params['sections'][$name]['active'] === '0') {
        return $return;
    }
    // Define basic data for configuration
    $return[$name] = array('title' => 'System Information', 'description' => 'This is example of dashboard section explains how to build your own widget', 'active' => 1, 'pos' => 60, 'size' => 'small', 'frame' => 1, 'header' => 1);
    if ($params['mode'] == 'setting') {
        return $return;
    }
    // Add content for dashboard in 'dashboard' mode
    // Define either content or template name or both
    // Categories counter
    $cat_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['categories']}");
    $facet_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['clean_urls_custom_facet_urls']}");
    cw_system_messages_add('category_count', cw_get_langvar_by_name('lbl_category') . ' | ' . cw_get_langvar_by_name('lbl_facet_count') . ' - <a href="index.php?target=categories">' . $cat_cnt . '</a> | <a href="index.php?target=custom_facet_urls">' . $facet_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Products counter
    $product_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['products']}");
    cw_system_messages_add('product_count', cw_get_langvar_by_name('lbl_product_count') . ' -
	<a href="index.php?target=products&mode=search&new_search=1">' . $product_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Orders counter
    $order_cnt = cw_query_hash("SELECT status, count(*)  FROM {$tables['docs']} WHERE type='O' GROUP BY status", 'status', false, true);
    $msg = cw_get_langvar_by_name('lbl_order_count') . ' -';
    foreach ($order_cnt as $status => $count) {
        $msg .= ' <a href="index.php?target=docs_O&mode=search&data[status]=' . $status . '" class="order_' . $status . '" title="' . $status . '">&nbsp;' . $count . '&nbsp;</a>';
    }
    cw_system_messages_add('order_count', $msg, constant('SYSTEM_MESSAGE_SYSTEM'));
    // Customers counter
    $customer_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['customers']} WHERE usertype='C'");
    cw_system_messages_add('customer_count', cw_get_langvar_by_name('lbl_customer_count') . ' - 
	<a href="index.php?target=user_C&mode=search&new_search=1">' . $customer_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Mail counter
    $mail_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['mail_spool']} WHERE send=0");
    cw_system_messages_add('mail_count', cw_get_langvar_by_name('lbl_mail_queue') . ' - 
	<a href="index.php?target=mail_queue">' . $mail_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    // Sess counter
    $sess_cnt = cw_query_first_cell("SELECT count(*) FROM {$tables['sessions_data']} WHERE expiry>" . cw_core_get_time());
    cw_system_messages_add('session_count', cw_get_langvar_by_name('lbl_active_sessions') . ' - 
	<a href="index.php?target=sessions">' . $sess_cnt . '</a>', constant('SYSTEM_MESSAGE_SYSTEM'));
    cw_event('on_dashboard_system_info');
    // Handlers must add lines via cw_system_messages_add (type = SYSTEM_MESSAGE_SYSTEM)
    /*
     * GET SYSTEM MESSAGES
     */
    $system_messages = cw_system_messages(constant('SYSTEM_MESSAGE_SYSTEM'), true);
    $smarty->assign('system_info', $system_messages);
    $return[$name]['template'] = 'addons/dashboard/admin/sections/system_info.tpl';
    if (empty($system_messages)) {
        unset($return[$name]);
    }
    return $return;
}
}
$run_periods = array('regular' => 59, 'hourly' => SECONDS_PER_HOUR, 'daily' => SECONDS_PER_DAY, 'weekly' => SECONDS_PER_WEEK, 'biweekly' => SECONDS_PER_WEEK * 2, 'monthly' => SECONDS_PER_DAY * 30, 'annually' => SECONDS_PER_DAY * 365);
$time = time();
// Check unfinished cron
if ($last_run['flag']) {
    // Flag is raised - previous cron runs
    // Log this issue
    cw_log_add('cron', "Warning: new cron started while previous #{$last_run['counter']} is not finished or crashed", false);
    if ($time - $last_run['regular'] < $run_periods['regular'] * 15) {
        echo "skip";
        // Skip this cron several "regular times" in case the previous execution does something normal but long
        exit(0);
    }
    // Flag is raised too long, something wrong with scheduled tasks
    // System message
    cw_system_messages_add('cron_not_finished', "New cron started while previous #{$last_run['counter']} is not finished or crushed", SYSTEM_MESSAGE_COMMON, SYSTEM_MESSAGE_ERROR);
}
$last_run['flag']++;
// Cron started
$counter = ++$last_run['counter'];
db_query("REPLACE {$tables['config']} (name, config_category_id, value) values ('last_cron_run',1,'" . mysql_real_escape_string(serialize($last_run)) . "')");
$time_dump = date('H:i', $time);
list($hour, $minute) = explode(':', $time_dump);
$log['init'] = '#' . $counter . ': ' . $log['init'];
cw_load('cron');
if (empty($manual_run)) {
    // New cron handlers are functions
    // Subscribe to one of this event with all your crontab functions, see cw_event_listen
    // on_cron_regular, on_cron_hourly, on_cron_daily and so on (see above)
    $tasks = $last_run['queue'];
    foreach ($run_periods as $p => $s) {