I was sick of the poor phpMyAdmin implementation on some hosting control panels and I tried to integrate PMA in a module inside MODx.
Unfortunately PMA uses frames itself, and can’t be used inside frames.
So i searched for an alternative, and
SQL Buddy (
http://sqlbuddy.com) does perfectly the job, and without all the jargon of PMA.
Choose DB, see/alter table structures, crud tables data, import, export, optimize, drop, all you need, without what you don’t usually need.
Very useful if you develop with your tables in the db and you need to work often with them or data frequently, I love it inside my MODx Manager interface, just two clicks away.
This has some security involvements: your DB is just two clicks away for anyone can load a Manager module too, for example.
Or how it exposes your DB username and password in the html of the page when a user that has access to modules loads it (only if you load it inside the Manager, being logged, it creates that html page).
Here it is the modxbuddy.inc.php file for installation instructions and extended notes on security.
The zip file is attached at end.
<?php
/*
* MODxBuddy Module
* Version: 0.132alpha
* Date: Feb 2010
*
* Simple MySQL db management
* with SQL Buddy 1.3.2
* by Calvin Lough
* http://sqlbuddy.com
*
* Author: Marco Bonetti - kudo - www.kudolink.com
* Contact: marco@ (my domain)
*
* Installation:
* _ Unpack in the "assets/modules" folder;
* _ Create new module "MODxBuddy";
* _ Insert the next line in the content of the module (w/o the asterisk):
* include $modPath.'/modxbuddy.inc.php';
* _ Insert this in the Configuration Tab, correcting the path if needed:
* &modPath=Path;string;../assets/modules/MODxBuddy
* _ Use it wisely!
*
* *********************************************
* >>>>> ATTENTION!!! Security notes <<<<<
* *********************************************
* No, it's not a good idea to have this tool around when other people have
* access to the MODx Manager.
*
* Consider it a shortcut to your db while developing.
*
* It doesn't checks user permissions: MODx does to know if the role of the
* user can access the module, but if the user has access no other checks
* are between that user and your DB deletion.
* YOU ARE WARNED: USE THIS SOFTWARE AT YOUR OWN RISK.
*
* It's safe from out of the Manager, no username or pwd is stored anwhere,
* it just gets the configuration from the $modx object.
* But, to log you in the SQLBuddy instance pressing the button, it writes
* your DB Username and DB Password in the html, virtually exposing those
* to users that have access to the module and know how to read the source
* of the page.
*
* This is acceptable only if you alone, or very trusted people, manage the
* site.
* Otherwise, untrusted people may be able to read your MySQL account data.
* YOU ARE WARNED: USE THIS SOFTWARE AT YOUR OWN RISK.
*/
if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
global $modx;
$page = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>MODx</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="media/style/MODxCarbon/style.css" />
<title>SQL Buddy for MODx</title>
<style type="text/css">
#modxbuddy button,
#modxbuddy .buttlink {
color: #222c36;
font-weight: bold;
font-size: 12px;
background: #c7ced2 url(images/misc/button-gradient.png) repeat-x top left;
padding: 4px 6px;
white-space: nowrap;
vertical-align: top;
text-decoration: none;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
-webkit-text-shadow: 0 1px 1px #fff;
-moz-text-shadow: 0 1px 1px #fff;
text-shadow: 0 1px 1px #fff;
border:1px solid #8ea4be;
outline: none;
width: auto;
}
</style>
</head>
<body id="modxbuddy">
<h1>MODxBuddy</h1>
<div id="actions">
<ul class="actionButtons">
<li id="Button1"><a href="#" onclick="document.location.href="index.php?a=106";"><img src="media/style/MODxCarbon/images/icons/stop.png" /> Close MODxBuddy</a></li>
</ul>
</div>
<div class="sectionHeader">Loading MODxBuddy</div>
<div class="sectionBody">
<form action="'.$modPath.'/login.php" method="POST">
<table width="99%" border="0" cellspacing="5" cellpadding="0">
<tr style="height: 24px;">
<td>
<span class="warning">WARNING!</span><br />
<span class="comment">Don\'t enter MODxBuddy if you don\'t know what you\'re doing!</span>
</td>
<td>
<input type="hidden" name="HOST" value="'. $modx->db->config['host'] .'" />
<input type="hidden" name="USER" value="'. $modx->db->config['user'] .'" />
<input type="hidden" name="PASS" value="'. $modx->db->config['pass'] .'" />
<ul class="actionButtons">
<li id="Button1">
<button name="ADAPTER" value="mysql">
<img src="media/style/MODxCarbon/images/icons/save.png" /> MODxBuddy
</button>
</li>
</ul>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>';
echo $page;
?>
This is alpha and it does the job for what I built it for. I don’t think I will ever develop this further, maybe I can think of creating a MODxCarbon-like theme for it... maybe
If you’ve problems with SQL Buddy, get help at the
official site.
Comments, tests, improvements appreciated.