private static function setDataBase() { if (empty(self::$conn)) { $dbhost = knl_lib_Config::getInstance()->get_dbhost(); $dbuser = knl_lib_Config::getInstance()->get_dbuser(); $dbpassword = knl_lib_Config::getInstance()->get_dbpassword(); $dbname = knl_lib_Config::getInstance()->get_dbname(); self::$conn = NewADOConnection(knl_lib_Config::getInstance()->get_dbdriver()); self::$conn->Connect($dbhost, $dbuser, $dbpassword, $dbname); self::$conn->EXECUTE("set names 'utf8'"); self::$conn->debug = knl_lib_Config::getInstance()->get_dbdebug(); } }
public function datatime_br_to_mysql($data) { if (!empty($data)) { if ($data != "00-00-0000 00:00:00") { $timezone = new DateTimeZone(knl_lib_Config::getInstance()->get_timezone()); $data = new DateTime($data, $timezone); $data = $data->format("Y-m-d H:i:s"); echo $data; die; } } return $data; }
<?php //error_reporting(E_ALL | E_STRICT); function __autoload($class_name) { if (substr($class_name, 0, 4) == 'knl_') { if (substr($class_name, 0, 7) == 'knl_dao') { $location = "dao/" . substr($class_name, 8) . ".php"; } else { if (substr($class_name, 0, 9) == 'knl_model') { $location = "model/" . substr($class_name, 10) . ".php"; } else { $location = str_replace("_", "/", substr($class_name, 4)) . ".php"; } } if (file_exists($location)) { require_once $location; } else { throw new Exception("Classe {$class_name} não foi encontrada"); } } } $path = './lib/adodb5' . PATH_SEPARATOR . "./lib/mailer"; set_include_path(get_include_path() . PATH_SEPARATOR . $path); date_default_timezone_set(knl_lib_Config::getInstance()->get_timezone()); require_once "adodb.inc.php"; header('Content-type: text/html; charset=utf-8'); $shell = isset($argv) ? $argv : array(); knl_controller_FrontController::dispatch($shell);