public static function instance($configuration, $killswitch = false) { if (!isset(self::$instance) || $killswitch) { $c = __CLASS__; self::$instance = new self($configuration); } return self::$instance; }
/* load the ajax class */ if (!file_exists('../libs/classes/class.ajax.php')) { exit('../libs/classes/class.ajax.php does not exist'); } include '../libs/classes/class.ajax.php'; /* load the openssl class */ if (!file_exists('../libs/classes/class.openssl.php')) { exit('../libs/classes/class.openssl.php does not exist'); } include '../libs/classes/class.openssl.php'; /* verify settings */ if (!verify($settings)) { exit($libs->JSONencode(array('error' => 'Please configure the config.php file'))); } /* handle for class object */ $openssl = openssl::instance($settings); if (!is_object($openssl)) { exit($libs->JSONencode(array('error' => 'An error occured when initializing the OpenSSL class'))); } if (!empty($_POST)) { /* ensure our ajax request passes required checks */ $ajax = new ajax(); if (!$ajax) { exit($libs->JSONencode(array('error' => 'AJAX request did not pass sanity checks'))); } /* make sure we have our necessary data, creates new keypair if not */ if (empty($_SESSION[$libs->_getRealIPv4()]['default']['private-key']) || empty($_SESSION[$libs->_getRealIPv4()]['default']['public-key'])) { create($settings, $openssl, $libs, 'default'); } /* * public key?