Merge branch 'development' of http://git.westgis.ac.cn:8000/lijianxuan/westdc-core into development
This commit is contained in:
commit
05d1788002
|
@ -1,20 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Westdc\Db;
|
namespace Westdc\Db;
|
||||||
|
|
||||||
use Zend\Config\Config as Zend_Config;
|
use Westdc\Helpers\Config;
|
||||||
|
|
||||||
class Pdo extends \PDO
|
class Pdo extends \PDO
|
||||||
{
|
{
|
||||||
private $debug = 0; //调试模式
|
|
||||||
|
|
||||||
private $config_local_path = "config/autoload/local.php";
|
|
||||||
|
|
||||||
function __construct($DSN = NULL)
|
function __construct($DSN = NULL)
|
||||||
{
|
{
|
||||||
if (!empty($DSN)) {
|
if (!empty($DSN)) {
|
||||||
parent::__construct($DSN);
|
parent::__construct($DSN);
|
||||||
} else {
|
} else {
|
||||||
$config_local = new Zend_Config(include $this->config_local_path);
|
$config_local = Config::get('local');
|
||||||
|
|
||||||
$dsn = "pgsql:host={$config_local->db->hostname};"
|
$dsn = "pgsql:host={$config_local->db->hostname};"
|
||||||
. "port={$config_local->db->port};"
|
. "port={$config_local->db->port};"
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Westdc\Helpers;
|
namespace Westdc\Helpers;
|
||||||
|
|
||||||
use \Zend\Authentication\AuthenticationService;
|
use Zend\Authentication\AuthenticationService;
|
||||||
use \Zend\Authentication\Storage\Session as SessionStorage;
|
use Zend\Authentication\Storage\Session as SessionStorage;
|
||||||
use \Westdc\Helpers\Config;
|
|
||||||
|
|
||||||
class Auth
|
class Auth
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,26 +3,43 @@ namespace Westdc\Helpers;
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
private $config_path = array(
|
|
||||||
'local' => "config/autoload/local.php",
|
|
||||||
'global' => "config/autoload/global.php"
|
|
||||||
);
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
//$reader = new \Zend\Config\Reader\Ini();
|
//$reader = new \Zend\Config\Reader\Ini();
|
||||||
//$data = $reader->fromFile('config/config.ini');
|
//$data = $reader->fromFile('config/config.ini');
|
||||||
}
|
}
|
||||||
|
|
||||||
static function get($type = 'global')
|
static function get($configName = 'global')
|
||||||
{
|
{
|
||||||
$config_path = array(
|
if(defined(CONFIG_PATH))
|
||||||
'local' => "config/autoload/local.php",
|
{
|
||||||
'global' => "config/autoload/global.php",
|
throw new \RuntimeException('Not found the config files path');
|
||||||
'file' => "config/autoload/file.php"
|
}
|
||||||
|
|
||||||
|
$config_path = CONFIG_PATH;
|
||||||
|
|
||||||
|
if(empty($configName))
|
||||||
|
$configName = "global.php";
|
||||||
|
|
||||||
|
if(!preg_match("/(\\/|\\\)$/",$config_path))
|
||||||
|
{
|
||||||
|
$config_path .= "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
$config_names = array(
|
||||||
|
'local' => "local.php",
|
||||||
|
'global' => "global.php",
|
||||||
|
'file' => "file.php"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$configFile = $config_path .'autoload/' . $config_names[$configName];
|
||||||
|
|
||||||
|
unset($config_path);
|
||||||
|
unset($configName);
|
||||||
|
|
||||||
$config = new \Zend\Config\Config(include $config_path[$type]);
|
$config = new \Zend\Config\Config(include $configFile);
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,15 @@ namespace Westdc\Helpers;
|
||||||
|
|
||||||
use \Zend\Authentication\AuthenticationService;
|
use \Zend\Authentication\AuthenticationService;
|
||||||
use \Zend\Authentication\Storage\Session as SessionStorage;
|
use \Zend\Authentication\Storage\Session as SessionStorage;
|
||||||
use \Westdc\Helpers\Config;
|
|
||||||
use Westdc\Helpers\MobileDetect;
|
|
||||||
use View as view;
|
use View as view;
|
||||||
|
|
||||||
class Layout
|
class Layout
|
||||||
{
|
{
|
||||||
public $config;
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->config = Config::get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置网页标题
|
//设置网页标题
|
||||||
|
@ -26,8 +24,8 @@ class Layout
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = $matches->getParam('action');
|
// $action = $matches->getParam('action');
|
||||||
$controller = $matches->getParam('controller');
|
// $controller = $matches->getParam('controller');
|
||||||
|
|
||||||
$viewHelperManager = $e->getApplication()->getServiceManager()->get('viewHelperManager');
|
$viewHelperManager = $e->getApplication()->getServiceManager()->get('viewHelperManager');
|
||||||
|
|
||||||
|
@ -36,15 +34,7 @@ class Layout
|
||||||
// Setting a separator string for segments
|
// Setting a separator string for segments
|
||||||
$headTitleHelper->setSeparator(' - ');
|
$headTitleHelper->setSeparator(' - ');
|
||||||
|
|
||||||
if(isset($this->config->title_map->$controller->action->$action))
|
return;
|
||||||
{
|
|
||||||
$headTitleHelper->append($this->config->title_map->$controller->action->$action->title);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($this->config->title_map->$controller))
|
|
||||||
{
|
|
||||||
$headTitleHelper->append($this->config->title_map->$controller->title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//导航条按钮激活
|
//导航条按钮激活
|
||||||
|
|
|
@ -45,8 +45,12 @@ class Tools {
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
$handle = popen("$cmd 2>&1", 'r');
|
$handle = popen("$cmd 2>&1", 'r');
|
||||||
$read = '';
|
|
||||||
while ($read = fread($handle, 20096)) {
|
while ($read = fread($handle, 20096)) {
|
||||||
|
|
||||||
|
if(!mb_detect_encoding($read, 'UTF-8', true))
|
||||||
|
iconv("GB2312","UTF-8",$read);
|
||||||
|
|
||||||
$response[] = trim($read);
|
$response[] = trim($read);
|
||||||
}
|
}
|
||||||
pclose($handle);
|
pclose($handle);
|
||||||
|
|
Loading…
Reference in New Issue