We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16429
    • 254 Posts
    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 smiley

    If you’ve problems with SQL Buddy, get help at the official site.

    Comments, tests, improvements appreciated.
      kudo
      www.kudolink.com - webdesign (surprised?)

      [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
      • 31309
      • 70 Posts
      it works) just one secure note - it shows all databases of %dbuser% , it would be more secure to display just database that this copy of modx uses it..
        • 16429
        • 254 Posts
        That’s a feature of SQL Buddy.
          kudo
          www.kudolink.com - webdesign (surprised?)

          [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
          • 22980
          • 84 Posts
          I feel like I’m missing something really immense here. How do you install modules w/ Revolution?
            • 4971
            • 964 Posts
            Modules are for the Evolution version of MODx...
            Custom Manager Pages are for Revolution

            so I guess this addon/extra is for Evo...
              Website: www.mercologia.com
              MODX Revo Tutorials:  www.modxperience.com

              MODX Professional Partner
              • 22980
              • 84 Posts
              been doing some reading.. shouldn’t be too hard to repackage I think!
                • 26903
                • 1,336 Posts
                Jumping in a bit here, on and off I’m working on a Janitor 3PC for revo(more off than on actually), I’ve added an SQLBuddy tab that pulls in SQLBuddy, the screenshots show it better. Eventually the 3PC will have more tabs to do more stuff once i get round to doing this.
                  Use MODx, or the cat gets it!
                  • 22980
                  • 84 Posts
                  Ooh looks very promising! I ran in to more than I though trying to get SQL Buddy working as a namespace - modules could just be loaded as iframes, but I guess not here. Silly of me to assume.

                  Anyway, can you tell more about Janitor 3PC? What is it? A quick google is mysteriously unfufilling!
                    • 26903
                    • 1,336 Posts
                    It is an iframe, just linked into a MODx panel on a 3PC tab, works OK though.

                    Janitor is just an idea I’m having to help people do site maintenance, like a janitor is responsible for building maintenance. I’m not sure yet exactly what’s needed but we can have tabs for this for DB stuff, some MODx specific stuff like truncating manager logs etc. permissions checks, maybe a backup/restore facility maybe other stuff that I can come up with and code. I’m kinda interested in timed events, i.e a nice interface to crontab, or even MYSQL’s event handler.

                    People tend to use a variety of tools to do all this, maybe we can collect them together better and front end it for easier use.

                    It only exists in my private SVN repo’s at the mo, so you won’t see it, actually I guess I should open a thread for this under ’in development’ to collect ideas etc.
                      Use MODx, or the cat gets it!
                      • 22980
                      • 84 Posts
                      Sounds cool. How do you implement your 3PC?