示例#1
0
        $data = mysql_fetch_array($r);
        $size += $data['Index_length'] + $data['Data_length'];
    }
    $units = array(' B', ' KB', ' MB', ' GB', ' TB');
    for ($i = 0; $size > 1024; $i++) {
        $size /= 1024;
    }
    return round($size, 2) . $units[$i];
}
// open mysql connection:
$handle = mysql_connect(EZSQL_DB_HOST, EZSQL_DB_USER, EZSQL_DB_PASSWORD);
if (!$handle) {
    die('Connection failed!');
}
// get the size of all tables in this database:
$dbsize = CalcFullDatabaseSize(EZSQL_DB_NAME, $handle);
// close connection:
mysql_close($handle);
// Smarty Assign
if ($main_smarty) {
    $main_smarty->assign('sw_version', $sw_version);
    $main_smarty->assign('sw_members', $sw_members);
    $main_smarty->assign('sw_groups', $sw_groups);
    $main_smarty->assign('sw_links', $sw_links);
    $main_smarty->assign('sw_published', $sw_published);
    $main_smarty->assign('sw_new', $sw_new);
    $main_smarty->assign('sw_votes', $sw_votes);
    $main_smarty->assign('sw_comments', $sw_comments);
    $main_smarty->assign('sw_newuser', $sw_newuser);
    $main_smarty->assign('sw_dbsize', $sw_dbsize);
    $main_smarty->assign('phpver', $phpver);
示例#2
0
    if ($result) {
        update_config_file();
        include dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . AC_FOLDER_CACHE . DIRECTORY_SEPARATOR . 'data_admin_options.php';
        $result = $db->execute("\n\t\t\t\tUPDATE arrowchat_status \n\t\t\t\tSET announcement='0'\n\t\t\t");
        if ($result) {
            $msg = "The chat announcement is now being shown.";
            if ($push_on == 1) {
                $arrowpush->publish(array('channel' => 'arrowchat', 'message' => array('announcement' => array("data" => $_POST['announcement'], "read" => "0"))));
            }
        } else {
            $error = "There was a database error.  Please try again.";
        }
    } else {
        $error = "There was a database error.  Please try again.";
    }
}
// Get information for the page
$num_messages = $db->count_all("\n\t\tarrowchat\n\t");
$num_users = $db->count_all("\n\t\t" . TABLE_PREFIX . DB_USERTABLE . "\n\t");
$install_time = $db->fetch_row("\n\t\tSELECT config_value \n\t\tFROM arrowchat_config \n\t\tWHERE config_name = 'install_time'\n\t");
// Calculate overview information
$days_since = (time() - $install_time->config_value) / 86400;
$messages_day = $num_messages / $days_since;
$users_day = $num_users / $days_since;
$database_size = CalcFullDatabaseSize(DB_NAME);
// Process Smarty template
$smarty->assign('msg', $msg);
$smarty->assign('error', $error);
$smarty->display(dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout/pages_header.tpl");
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout/pages_index.php";
$smarty->display(dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout/pages_footer.tpl");