private function savePropertiesToLog() { $logConfig = Core::getInstance()->getConfig()['log']; if ($logConfig['saveToDB'] and $logConfig['saveResponse']) { DBLog::getInstance()->save($this->getPropertiesForLog()); } }
public function createKeys($private_key_bits = 1024) { $new_key_pair = openssl_pkey_new(array("private_key_bits" => $private_key_bits, "private_key_type" => OPENSSL_KEYTYPE_RSA)); openssl_pkey_export($new_key_pair, $private_key_pem); $details = openssl_pkey_get_details($new_key_pair); $public_key_pem = $details['key']; $config = Core::getInstance()->getConfig()['keys']; $publicPemFile = $config['ours']['public']; return file_put_contents($this->privatePemFile, $private_key_pem) && file_put_contents($publicPemFile, $public_key_pem); }
private function __construct() { /** @var $core Core */ $core = Core::getInstance(); $config = $core->getConfig(); $this->dsn = $config['db']['dsn']; $this->username = $config['db']['username']; $this->password = $config['db']['password']; $this->properties = []; }
<?php /** * Created by PhpStorm. * User: cherepakha * Date: 06.02.15 * Time: 12:14 */ spl_autoload_extensions(".php"); spl_autoload_register(); $config = __DIR__ . '/config/config.php'; use core\Core; use core\signature\Signature; Core::getInstance()->setConfig($config); //var_dump($_SERVER); $var = $_SERVER['HTTP_HOST'] . '/index.php?' . $_SERVER['QUERY_STRING']; $sign = Signature::getInstance()->sign($var); echo urlencode($sign);
public function checkRequest() { $config = Core::getInstance()->getConfig(); if ($this->_remoteAddr != $config['ps']['address']) { Error::getInstance()->сatchError('WRONG_SOURCE'); } else { $this->checkSign(); $this->checkRequestByAction(); } }
/** * 获取请求类 * @return Core\Request */ function req() { return \Core\Core::getInstance()->getRequest(); }