Miscellaneous fixes and updates
Change php requirement to 5.4
This commit is contained in:
parent
761c6fef9f
commit
235f810dd3
@ -48,7 +48,7 @@ function log_fatal()
|
||||
$error = error_get_last();
|
||||
|
||||
// types of errors that are fatal
|
||||
$fatal = array(E_ERROR, E_PARSE, E_RECOVERABLE_ERROR);
|
||||
$fatal = [E_ERROR, E_PARSE, E_RECOVERABLE_ERROR];
|
||||
|
||||
// Log error.
|
||||
if(in_array($error['type'], $fatal))
|
||||
@ -61,11 +61,20 @@ register_shutdown_function('OpenSQLManager\log_fatal');
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Make sure php-gtk works
|
||||
// Make sure wxphp works
|
||||
if ( ! class_exists('wxApp'))
|
||||
{
|
||||
// Try to load wxphp if possible
|
||||
if (function_exists('dl') && in_array(php_sapi_name(), ['cli', 'embed']))
|
||||
{
|
||||
$name = 'wxwidgets.'.PHP_SHLIB_SUFFIX;
|
||||
dl($name);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error("wxPHP not found. Please load the wxPHP extension in your php.ini", E_USER_ERROR);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure pdo exists
|
||||
@ -93,7 +102,7 @@ function exception_error_handler($errno, $errstr, $errfile, $errline)
|
||||
|
||||
// Do this after the two compatibility checks for cleaner output
|
||||
// Note that this will throw exceptions on notices
|
||||
set_error_handler("OpenSQLManager\exception_error_handler", -1);
|
||||
set_error_handler('OpenSQLManager\exception_error_handler', -1);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@ -138,7 +147,7 @@ function osm_autoload($class)
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Load everything so that we don't have to do requires later
|
||||
// Load all the common classes, and register the autoloader
|
||||
array_map('OpenSQLManager\do_include', glob(BASE_DIR.'/common/*.php'));
|
||||
spl_autoload_register('OpenSQLManager\osm_autoload');
|
||||
|
||||
|
@ -18,10 +18,11 @@ I've put together this package from the latest wxPHP windows package. It's avail
|
||||
* php5-postgresql
|
||||
* php5-sqlite
|
||||
* php5-ssh2
|
||||
* Compile wxPHP extension
|
||||
* Run via terminal in the OpenSQLManager folder using `php OpenSQLManager.php`
|
||||
|
||||
## PHP Requirements
|
||||
* Version 5.3.*
|
||||
* Version 5.4+
|
||||
* [wxPHP](http://wxphp.org/) PHP Extension
|
||||
* OpenSSL
|
||||
* JSON
|
||||
|
@ -1,6 +1,6 @@
|
||||
DON'T BE A DICK PUBLIC LICENSE
|
||||
DON'T BE A JERK PUBLIC LICENSE
|
||||
|
||||
Version 1, December 2009
|
||||
Version 2, November 2012
|
||||
|
||||
Copyright (C) 2012 Timothy J Warren <tim@timshomepage.net>
|
||||
|
||||
@ -8,20 +8,20 @@ DON'T BE A DICK PUBLIC LICENSE
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DON'T BE A DICK PUBLIC LICENSE
|
||||
DON'T BE A JERK PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
1. Do whatever you like with the original work, just don't be a dick.
|
||||
1. Do whatever you like with the original work, just don't be a JERK.
|
||||
|
||||
Being a dick includes - but is not limited to - the following instances:
|
||||
Being a JERK includes - but is not limited to - the following instances:
|
||||
|
||||
1a. Outright copyright infringement - Don't just copy this and change the name.
|
||||
1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick.
|
||||
1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick.
|
||||
1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a JERK.
|
||||
1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER JERK.
|
||||
|
||||
2. If you become rich through modifications, related works/services, or supporting the original work,
|
||||
share the love. Only a dick would make loads off this work and not buy the original works
|
||||
share the love. Only a JERK would make loads off this work and not buy the original works
|
||||
creator(s) a pint.
|
||||
|
||||
3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes
|
||||
you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back.
|
||||
you a DONKEY JERK. Fix the problem yourself. A non-JERK would submit the fix back.
|
@ -37,7 +37,7 @@ function array_to_object($array)
|
||||
|
||||
$obj = new \StdClass();
|
||||
|
||||
foreach($array as $k => &$v)
|
||||
foreach($array as $k => $v)
|
||||
{
|
||||
$obj->$k = $v;
|
||||
}
|
||||
|
@ -68,12 +68,19 @@ class Settings {
|
||||
if( ! is_file($path))
|
||||
{
|
||||
//Create the file!
|
||||
touch($path);
|
||||
file_put_contents($path, '{}');
|
||||
$this->current = new \stdClass();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->current = json_decode(file_get_contents($path));
|
||||
|
||||
if (empty($this->current))
|
||||
{
|
||||
$this->current = new \stdClass();
|
||||
file_put_contents($path, '{}');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add the DB object under the settings if it doesn't already exist
|
||||
|
@ -64,6 +64,13 @@ class Connection_Sidebar extends \wxPanel {
|
||||
*/
|
||||
private $list;
|
||||
|
||||
/**
|
||||
* Reference to the parent of the current object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $parent;
|
||||
|
||||
/**
|
||||
* Return the current instance of the class
|
||||
*
|
||||
@ -90,28 +97,13 @@ class Connection_Sidebar extends \wxPanel {
|
||||
*/
|
||||
public function __construct($parent)
|
||||
{
|
||||
$this->parent =& $parent;
|
||||
|
||||
// Create the frame
|
||||
parent::__construct($parent, 1);
|
||||
|
||||
$this->list = new \wxListCtrl($parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_LIST|wxLC_SINGLE_SEL);
|
||||
$this->settings =& Settings::get_instance();
|
||||
$this->list->Connect(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, array($this, 'menu'));
|
||||
|
||||
// Create a button for adding new connections
|
||||
$new_conn = new \wxButton($this, self::BTN_ADD, 'New Connection');
|
||||
$new_conn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, array($this, 'add_conn'));
|
||||
|
||||
// Layout the connection list
|
||||
$this->_layout();
|
||||
|
||||
// Add a sizer
|
||||
$sizer = new \wxBoxSizer(wxVERTICAL);
|
||||
$sizer->add($this->list, 1, wxALL|wxEXPAND);
|
||||
$sizer->add($new_conn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM|wxEXPAND, 5);
|
||||
|
||||
$this->SetSizer($sizer);
|
||||
$this->Layout();
|
||||
$this->Fit();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -187,8 +179,16 @@ class Connection_Sidebar extends \wxPanel {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _layout()
|
||||
public function _layout()
|
||||
{
|
||||
$this->list = new \wxListCtrl($this->parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_LIST|wxLC_SINGLE_SEL);
|
||||
$this->settings =& Settings::get_instance();
|
||||
$this->list->Connect(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, array($this, 'menu'));
|
||||
|
||||
// Create a button for adding new connections
|
||||
$new_conn = new \wxButton($this, self::BTN_ADD, 'New Connection');
|
||||
$new_conn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, array($this, 'add_conn'));
|
||||
|
||||
// Add the actual connections
|
||||
$conns = $this->settings->get_dbs();
|
||||
|
||||
@ -196,6 +196,15 @@ class Connection_Sidebar extends \wxPanel {
|
||||
{
|
||||
$this->list->InsertItem(0, $c->name);
|
||||
}
|
||||
|
||||
// Add a sizer
|
||||
$sizer = new \wxBoxSizer(wxVERTICAL);
|
||||
$sizer->add($this->list, 1, wxALL|wxEXPAND);
|
||||
$sizer->add($new_conn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM|wxEXPAND, 5);
|
||||
|
||||
$this->SetSizer($sizer);
|
||||
$this->Layout();
|
||||
$this->Fit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,13 @@ class Connection_Manager extends \wxFrame {
|
||||
*/
|
||||
protected $labels = array();
|
||||
|
||||
/**
|
||||
* Reference to the parent Control
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* Create the window
|
||||
*
|
||||
@ -56,6 +63,7 @@ class Connection_Manager extends \wxFrame {
|
||||
*/
|
||||
public function __construct($parent, $params = array())
|
||||
{
|
||||
$this->parent =& $parent;
|
||||
parent::__construct($parent, 32, "Connection Manager", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxSTAY_ON_TOP | wxRESIZE_BORDER);
|
||||
|
||||
// Save a reference to the settings class
|
||||
@ -213,6 +221,10 @@ class Connection_Manager extends \wxFrame {
|
||||
}
|
||||
|
||||
$this->settings->add_db($params->name, $params);
|
||||
|
||||
$this->parent->Update();
|
||||
|
||||
$this->Destroy();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -314,7 +326,7 @@ class Connection_Manager extends \wxFrame {
|
||||
{
|
||||
\Query($params);
|
||||
}
|
||||
catch (\PDOException $e)
|
||||
catch (\Exception $e)
|
||||
{
|
||||
error("Error connecting to database: \n\n" . $e->getMessage());
|
||||
return;
|
||||
|
@ -85,7 +85,7 @@ class Main extends \wxFrame {
|
||||
*/
|
||||
public function quit()
|
||||
{
|
||||
$this->Destroy();
|
||||
$this->__destruct();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -95,7 +95,7 @@ class Main extends \wxFrame {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function about()
|
||||
public function about()
|
||||
{
|
||||
$dlg = new \wxAboutDialogInfo();
|
||||
|
||||
@ -117,6 +117,16 @@ class Main extends \wxFrame {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Layout tabs for databases, tables, &c;
|
||||
*/
|
||||
public function load_tabs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Layout the main interface
|
||||
* Create menus, hboxes, vboxs and other widgets
|
||||
@ -181,7 +191,6 @@ class Main extends \wxFrame {
|
||||
|
||||
}
|
||||
|
||||
|
||||
$this->SetMenuBar($menu_bar);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user