function get_fk_lookups_data($tablename, $fk_lookups)
{
    $lookups_data = array();
    $fk_defs = get_foreignkeys($tablename, 'S');
    foreach ($fk_defs as $colname => $defs) {
        // skip foreign keys with more than FKLOOKUP_ENTRIES values
        if (!isset($GLOBALS['s_tables'][$defs['table']]['count'])) {
            $GLOBALS['s_tables'][$defs['table']]['count'] = get_table_count($defs['table']);
        }
        if ($GLOBALS['s_tables'][$defs['table']]['count'] > FKLOOKUP_ENTRIES) {
            continue;
        }
        $value_field = ifsetor($fk_lookups[$colname], $defs['column']);
        if ($value_field != $defs['column']) {
            $value_field = "COALESCE(" . $value_field . ", '')" . " || ' - '" . ' || ' . $defs['column'];
        }
        $sql = 'SELECT ' . $defs['column'] . ', ' . $value_field . ' FROM ' . $defs['table'] . ' ORDER BY ' . $value_field . ' ASC';
        $res = fbird_query($GLOBALS['dbhandle'], $sql) or ib_error(__FILE__, __LINE__, $sql);
        $data = array();
        while ($row = fbird_fetch_row($res)) {
            $data[trim($row[0])] = trim($row[1]);
        }
        fbird_free_result($res);
        $lookups_data[$colname] = array('table' => $defs['table'], 'column' => $defs['column'], 'data' => $data);
    }
    return $lookups_data;
}
Beispiel #2
0
     if (empty($blog)) {
         // Posts
         $chart_data[] = array('title' => T_('Posts'), 'value' => $post_all_counter, 'type' => 'number');
     }
     if (empty($blog)) {
         // Slugs
         $chart_data[] = array('title' => T_('Slugs'), 'value' => get_table_count('T_slug'), 'type' => 'number');
         // Comments
         $chart_data[] = array('title' => T_('Comments'), 'value' => get_table_count('T_comments'), 'type' => 'number');
     }
     // Files
     $chart_data[] = array('title' => T_('Files'), 'value' => get_table_count('T_files'), 'type' => 'number');
     // Conversations
     $chart_data[] = array('title' => T_('Conversations'), 'value' => get_table_count('T_messaging__thread'), 'type' => 'number');
     // Messages
     $chart_data[] = array('title' => T_('Messages'), 'value' => get_table_count('T_messaging__message'), 'type' => 'number');
     $stat_item_Widget = new Widget('block_item');
     $stat_item_Widget->title = T_('System metrics');
     $stat_item_Widget->disp_template_replaced('block_start');
     display_charts($chart_data);
     $stat_item_Widget->disp_template_raw('block_end');
 }
 //---- END OF - System stats ----//
 $block_item_Widget = new Widget('block_item');
 $block_item_Widget->title = T_('Updates from b2evolution.net');
 $block_item_Widget->disp_template_replaced('block_start');
 // Note: hopefully, the updates will have been downloaded in the shutdown function of a previous page (including the login screen)
 // However if we have outdated info, we will load updates here.
 // Let's clear any remaining messages that should already have been displayed before...
 $Messages->clear();
 if (b2evonet_get_updates() !== NULL) {
Beispiel #3
0
 echo "<table align='center' cellspacing='0' cellpadding='0'>\n<tr>\n";
 echo "<td valign='top'>\n";
 echo "<table align='center' cellspacing='0' cellpadding='0'>\n<tr>\n";
 echo "<td colspan='2' class='tbl2' align='left'>" . $locale['451'] . "</td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='right' class='tbl'>" . $locale['414'] . "</td>\n";
 echo "<td class='tbl'>" . $db_name . "</td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='right' class='tbl'>" . $locale['415'] . "</td>\n";
 echo "<td class='tbl'>" . $db_prefix . "</td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='right' class='tbl'>" . $locale['452'] . "</td>\n";
 echo "<td class='tbl'>" . parsebytesize(get_database_size(), 2, false) . " (" . get_table_count() . " " . $locale['419'] . ")</td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='right' class='tbl'>" . $locale['453'] . "</td>\n";
 echo "<td class='tbl'>" . parsebytesize(get_database_size($db_prefix), 2, false) . " (" . get_table_count($db_prefix) . " " . $locale['419'] . ")</td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='left' colspan='2' class='tbl2'>" . $locale['454'] . "</td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='right' class='tbl'>" . $locale['431'] . " <span style='color:#ff0000'>*</span></td>\n";
 echo "<td class='tbl'><input type='text' name='backup_filename' value='backup_" . stripsiteinput($settings['sitename']) . "_" . date('Y-m-d-Hi') . "' class='textbox' style='width:200px;' /></td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='right' class='tbl'>" . $locale['455'] . "</td>\n";
 echo "<td class='tbl'><select name='backup_type' class='textbox' style='width:150px;'>\n";
 if (function_exists("gzencode")) {
     echo "<option value='.gz' selected='selected'>.sql.gz " . $locale['456'] . "</option>\n";
 }
 echo "<option value='.sql'>.sql</option>\n";
 echo "</select></td>\n";
 echo "</tr>\n<tr>\n";
 echo "<td align='right' class='tbl'>" . $locale['460'] . " <span style='color:#ff0000'>*</span></td>\n";
Beispiel #4
0
function show_statistics($conn)
{
    $donations_total = get_table_total($conn, 'donations');
    $expenses_total = get_table_total($conn, 'expenses');
    $difference = $donations_total - $expenses_total;
    p_print("There has been <b>\${$donations_total}</b> in donations and <b>\${$expenses_total}</b> in expenses for a net total of <b>\${$difference}</b>.");
    $donations_count = get_table_count($conn, 'donations');
    $expenses_count = get_table_count($conn, 'expenses');
    p_print("There have been <b>{$donations_count}</b> donations and <b>{$expenses_count}</b> expense(s).");
}
Beispiel #5
0
    $side_item_Widget = new Widget('side_item');
    $side_item_Widget->title = T_('System stats');
    $side_item_Widget->disp_template_replaced('block_start');
    echo '<div class="dashboard_sidebar">';
    echo '<ul>';
    echo '<li>' . sprintf(T_('%s Users'), get_table_count('T_users')) . '</li>';
    echo '<li>' . sprintf(T_('%s Blogs'), get_table_count('T_blogs')) . '</li>';
    echo '<li>' . sprintf(T_('%s Posts'), $post_all_counter = (int) get_table_count('T_items__item')) . '</li>';
    echo '<ul>';
    echo '<li>' . sprintf(T_('%s on web'), $post_through_admin = (int) $global_Cache->get('post_through_admin')) . '</li>';
    echo '<li>' . sprintf(T_('%s by XMLRPC'), $post_through_xmlrpc = (int) $global_Cache->get('post_through_xmlrpc')) . '</li>';
    echo '<li>' . sprintf(T_('%s by email'), $post_through_email = (int) $global_Cache->get('post_through_email')) . '</li>';
    echo '<li>' . sprintf(T_('%s unknown'), $post_all_counter - $post_through_admin - $post_through_xmlrpc - $post_through_email) . '</li>';
    echo '</ul>';
    echo '<li>' . sprintf(T_('%s Slugs'), get_table_count('T_slug')) . '</li>';
    echo '<li>' . sprintf(T_('%s Comments'), get_table_count('T_comments')) . '</li>';
    echo '<li>' . sprintf(T_('%s Files'), get_table_count('T_files')) . '</li>';
    echo '<li>' . sprintf(T_('%s Conversations'), get_table_count('T_messaging__thread')) . '</li>';
    echo '<li>' . sprintf(T_('%s Messages'), get_table_count('T_messaging__message')) . '</li>';
    echo '</ul>';
    echo '</div>';
    $side_item_Widget->disp_template_raw('block_end');
    /*
     * DashboardAdminSide to be added here (anyone?)
     */
    echo '</td></tr></table>';
    // End payload block:
    $AdminUI->disp_payload_end();
}
// Display body bottom, debug info and close </html>:
$AdminUI->disp_global_footer();