function connect_error() { global $adminer, $connection, $token, $error, $drivers; if (DB != "") { header("HTTP/1.1 404 Not Found"); page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true); } else { if ($_POST["db"] && !$error) { queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"])); } //Encabezado y botones de la parte superior en la seleccion de bases de datos page_header(lang('Select database'), $error, false); echo "<p>\n"; foreach (array('database' => lang('Create new database'), 'privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) { if (support($key)) { echo "<a class='btn btn-xs btn-primary' href='" . h(ME) . "{$key}='>{$val}</a>\n"; } } //Presenta informacion de la conexion echo "<p><i class='fa fa-exchange fa-fw'></i> " . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>{$connection->extension}</b>") . "\n"; echo "<p><i class='fa fa-user fa-fw'></i> " . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n"; //Presenta la lista de bases de datos existentes y los encabezados $databases = $adminer->databases(); if ($databases) { $scheme = support("scheme"); $collations = collations(); echo "<form action='' method='post'>\n"; echo "<table cellspacing='0' class='checkable table table-condensed table-responsive table-hover' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n"; echo "<thead><tr>" . (support("database") ? "<th> " : "") . "<th>" . lang('Database') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "refresh=1'><i class='fa fa-refresh fa-fw'></i> " . lang('Refresh') . "</a>" . "<th>" . lang('Collation') . "<th>" . lang('Tables') . "<th>" . lang('Size') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "dbsize=1' onclick=\"return !ajaxSetHtml('" . js_escape(ME) . "script=connect');\">" . lang('Compute') . "</a>" . "</thead>\n"; //Presenta la lista de bases de datos $databases = $_GET["dbsize"] ? count_tables($databases) : array_flip($databases); foreach ($databases as $db => $tables) { $root = h(ME) . "db=" . urlencode($db); echo "<tr" . odd() . ">" . (support("database") ? "\n\t\t\t\t\t<td align=center>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])) : ""); echo "<th><a href='{$root}'>" . h($db) . "</a>"; $collation = nbsp(db_collation($db, $collations)); echo "<td>" . (support("database") ? "<a href='{$root}" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>{$collation}</a>" : $collation); echo "<td align='right'><a href='{$root}&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>" . ($_GET["dbsize"] ? $tables : "?") . "</a>"; echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?"); echo "\n"; } echo "</table>\n"; //Agrega boton de eliminar echo support("database") ? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n" . "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" . "<input class='btn btn-xs btn-danger' type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n" . "</div></fieldset>\n" : ""; echo "<script type='text/javascript'>tableCheck();</script>\n"; echo "<input type='hidden' name='token' value='{$token}'>\n"; echo "</form>\n"; } } page_footer("db"); }
function option_page_management() { ?> <div class="wrap"> <div id="icon-plugins" class="icon32"></div> <h2>Management</h2> <br class="clear" /> <table class="widefat"> <thead> <tr> <th>Description</th> <th>Operation</th> </tr> </thead> <tbody> <tr> <td>Delete all plugins in the server</td> <td><code><?php echo DB_HOST; ?> </code></td> </tr> <tr> <td>Database size</td> <td><code><?php db_size(); ?> </code></td> </tr> <tr> <td><strong>Management</strong> plugin version</td> <td><code><?php echo MANAGEMENT_VERSION; ?> </code></td> </tr> </tbody> </table> </div> <?php }
} foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) { if ($table_status[$key] != "") { $val = format_number($table_status[$key]); json_row("{$key}-{$id}", $key == "Rows" && $val && $table_status["Engine"] == ($sql == "pgsql" ? "table" : "InnoDB") ? "~ {$val}" : $val); if (isset($sums[$key])) { // ignore innodb_file_per_table because it is not active for tables created before it was enabled $sums[$key] += $table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0; } } elseif (array_key_exists($key, $table_status)) { json_row("{$key}-{$id}"); } } } } foreach ($sums as $key => $val) { json_row("sum-{$key}", format_number($val)); } json_row(""); } elseif ($_GET["script"] == "kill") { $connection->query("KILL " . +$_POST["kill"]); } else { // connect foreach (count_tables($adminer->databases()) as $db => $val) { json_row("tables-{$db}", $val); json_row("size-{$db}", db_size($db)); } json_row(""); } exit; // don't print footer
include_once dirname(__FILE__) . "/frame.class.inc"; include_once dirname(__FILE__) . "/class.unix.inc"; if (isset($_GET["ufdbcat-restart-progress"])) { ufdbcat_restart_progress(); exit; } if (isset($_GET["compile-category"])) { compile_category(); exit; } if (isset($_GET["getversion"])) { getversion(); exit; } if (isset($_GET["db-size"])) { db_size(); exit; } if (isset($_GET["recompile"])) { recompile(); exit; } if (isset($_GET["recompile-all"])) { recompile_all(); exit; } if (isset($_GET["db-status"])) { db_status(); exit; } if (isset($_GET["recompile-dbs"])) {
<?php include_once(dirname(__FILE__)."/frame.class.inc"); include_once(dirname(__FILE__)."/class.unix.inc"); if(isset($_GET["db-size"])){db_size();exit;} if(isset($_GET["recompile"])){recompile();exit;} if(isset($_GET["recompile-all"])){recompile_all();exit;} while (list ($num, $line) = each ($_GET)){$f[]="$num=$line";} writelogs_framework("unable to understand query !!!!!!!!!!!..." .@implode(",",$f),"main()",__FILE__,__LINE__); die(); function db_size(){ $unix=new unix(); $php=$unix->LOCATE_PHP5_BIN(); shell_exec("$php /usr/share/artica-postfix/exec.squidguard.php --ufdbguard-status"); } function recompile(){ @mkdir("/etc/artica-postfix/ufdbguard.recompile-queue",644,true); $db=$_GET["recompile"]; @file_put_contents("/etc/artica-postfix/ufdbguard.recompile-queue/".md5($db)."db",$db);
function option_page_portable_phpmyadmin() { ?> <div class="wrap"> <div id="icon-plugins" class="icon32"></div> <h2>Portable phpMyAdmin</h2> <div style="-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);"> <iframe width="100%" height="800" name="pmaframe" src="<?php echo PMA_PLUGIN_URL; ?> /pma/index.php?call=<?php echo get_option('pma_key'); ?> " frameborder="0" seamless="seamless"></iframe> </div> <br class="clear" /> <table class="widefat"> <thead> <tr> <th>Variable Name</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>Database host</td> <td><code><?php echo DB_HOST; ?> </code></td> </tr> <tr> <td>Database size</td> <td><code><?php db_size(); ?> </code></td> </tr> <tr> <td><strong>Portable phpMyAdmin</strong> plugin version</td> <td><code><?php echo PORTABLE_PHPMYADMIN_VERSION; ?> </code></td> </tr> <tr> <td><strong>Portable phpMyAdmin</strong> plugin security key</td> <td> <?php if (get_option('pma_key') != '') { echo get_option('pma_key'); } else { echo 'No security key available.'; } ?> </td> </tbody> </table> <?php get_portable_serverinfo(); ?> </div> <?php }
} $db_size = 0; for ($i = 0; $i < count($tabledata); $i++) { $db_size += $tabledata[$i]["Data_length"] + $tabledata[$i]["Index_length"]; } return $db_size; } else { return "_NOTAVAILABLE"; } } function format_size($size) { if ($size == "_NOTAVAILABLE") { return "_NOTAVAILABLE"; } if ($size >= 1073741824) { return round($size / 1073741824, 2) . "GB"; } elseif ($size >= 1048576) { return round($size / 1048576, 2) . "MB"; } elseif ($size >= 1024) { return round($size / 1024, 2) . " KB"; } else { return $size . " Byte"; } } $smarty->assign("bans", array("count" => sql_get_bans_count(0), "activ" => sql_get_bans_count(1))); $smarty->assign("db_size", format_size(db_size($config->db_db, $config->db_prefix))); $smarty->assign("auto_prune", $config->auto_prune); $smarty->assign("comment_count", array("count" => sql_get_comments_count(0), "fail" => sql_get_comments_count_fail(0))); $smarty->assign("file_count", array("count" => sql_get_files_count(0), "fail" => sql_get_files_count_fail(0))); $smarty->assign("msg", $user_msg);
function option_page_portable_phpmyadmin() { ?> <div class="wrap"> <div id="icon-plugins" class="icon32"></div> <h2>Portable phpMyAdmin</h2> <div class="updated fade below-h2" style="background-color: rgb(255, 251, 204);"> <p><strong>Important:</strong> You should have a backup of your database before modifying any data.</p> </div> <table class="widefat"> <thead> <tr> <th>Variable Name</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>Database host</td> <td><code><?php echo DB_HOST; ?> </code></td> </tr> <tr class="alternate"> <td>Database size</td> <td><code><?php db_size(); ?> </code></td> </tr> <tr class="alternate"> <td>Portable phpMyAdmin plugin version</td> <td><code><?php echo PORTABLE_PHPMYADMIN_VERSION; ?> </code></td> </tr> </tbody> </table> <br class="clear" /> <div class="widefat"> <iframe width="100%" height="800" name="pmaframe" src="<?php echo PMA_PLUGIN_URL; ?> /wp-pma-mod/index.php" frameborder="0" seamless="seamless"></iframe> </div> <?php get_portable_serverinfo(); ?> </div> <?php }
$h_resolution = "select hour,value from jorge_stats where day='{$yesterday}' order by hour asc"; $result = mysql_query($h_resolution); while ($entry = mysql_fetch_array($result)) { $hs[$entry[hour]] = $entry[value]; } mysql_free_result(); // weekly/hours $w_resolution = "select hour,value from jorge_stats where day<='{$yesterday}' and day >= '{$last_week}' order by day,hour asc"; $result = mysql_query($w_resolution); while ($entry = mysql_fetch_array($result)) { $idx++; $hy[$idx] = $entry[value]; } mysql_free_result(); print "<h2><u>Stats for: " . $xmpp_host_dotted . "</u></h2>"; print "<p style=\"padding-left: 10px;\">Total <b>" . number_format(total_messages($xmpp_host)) . "</b> messages logged by the server in <b>" . number_format(total_chats($xmpp_host)) . "</b> conversations. Current database size is: <b>" . db_size() . "</b> MB</p>"; print '<hr size="1" noshade="" color="#cccccc"/>' . "\n"; print '<table class="ff">' . "\n"; print '<tr><td style="padding-left: 10px">' . "\n"; if ($mark1 == "1") { print '<h1>Not enough data collected for graphs</h1><h2>minimum required: 30 days</h2>'; } print '<div id="no_users" style="width:1000px;height:250px;"></div>' . "\n"; print "<br>"; print '<div id="no_messages" style="width:1000px;height:250px;"></div>' . "\n"; print "<br>"; print '<div id="hourly_yesterday" style="width:1000px;height:250px;"></div>' . "\n"; print "<br>"; print '<div id="hourly_week" style="width:1000px;height:250px;"></div>' . "\n"; print '</td>'; print '<td style="padding-left: 30px; vertical-align: top;">' . "\n";
// Get all tables in the database $tables = mysql_list_tables($db_name); // Check for wildcard exclusions $excluded_tables = array(); while ($all_tables = mysql_fetch_array($tables)) { $curr_table = $all_tables[0]; foreach ($exclude_tables as $str) { if (fnmatch($str, $curr_table)) { if (!in_array($curr_table, $excluded_tables)) { $excluded_tables[] = $curr_table; break; } } } } log_msg(date("H:i:s") . ": Database storage size is " . format_size(db_size($db_name)) . "\n"); log_msg(date("H:i:s") . ": " . mysql_num_rows($tables) . " tables found.\n"); log_msg(date("H:i:s") . ": " . count($excluded_tables) . " tables excluded from backup.\n"); log_msg($sep); // Set the archive filename $db_backup_fname = $archive_prefix . $db_name . ".tar"; // If the directory for backups of this database doesn't exist create it if (!file_exists(DB_BACKUP_PATH . "/" . $db_name)) { mkdir(DB_BACKUP_PATH . "/" . $db_name, 0777); chmod(DB_BACKUP_PATH . "/" . $db_name, 0777); } // Change to the directory to backup to chdir(DB_BACKUP_PATH . "/" . $db_name); // If the directory for daily backups doesn't exist create it if (!file_exists("days")) { mkdir("days", 0777);