private function __construct() { $config = FN::serverConfig('database', $this->_link); if (empty($config) || !in_array($config['drive'], array('mongodb'))) { $this->_error = 5; //配置错误 return false; } $this->_db = FN::server('database', $this->_link); $dbname = $this->_db->selectDB($this->_dbname); if (empty($this->_prefix)) { $this->_gridfs = $dbname->getGridFS(); } else { $this->_gridfs = $dbname->getGridFS($this->_prefix); } if ($this->_onlyimage && !$this->_mime) { $this->_mime = array('image/gif', 'image/png', 'image/jpeg'); } }
private function __construct($array) { $this->template = FN::server('template', $this->_link); if (defined('FN_WEB_PATH')) { //如果是web访问,传递路径变量 $this->template->assign('url', FN_WEB_PATH); if ($this->dir) { $this->template->assign('dir', $this->dir); $this->template->assign('static', FN_WEB_PATH . 'static/' . $this->dir); } else { $this->template->assign('static', FN_WEB_PATH . 'static/'); } } $this->ajax = FNbase::isAJAX(); $this->param = empty($array['param']) ? array() : $array['param']; $this->default = $array; $this->_init(); $this->_view(empty($this->default['view']) ? '' : $this->default['view']); }
private function __construct() { $config = FN::serverConfig('database', $this->_link); if (empty($config) || !in_array($config['drive'], array('mysql', 'mssql'))) { $this->_error = 5; //配置错误 return false; } $this->_db = FN::server('database', $this->_link); if (!empty($config['prefix'])) { $this->table = $config['prefix'] . $this->table; } //实现表前缀添加 if (!in_array($this->_pkey, $this->_field)) { $this->_pkey = null; } if (empty($this->_pkey)) { $this->_aint = false; } }
private function __construct($array, $class) { $this->classname = $class; $this->controllname = call_user_func_array(array($this->classname, 'getControllName'), array()); $this->template = FN::server('template', $this->_link); if (defined('FN_WEB_PATH')) { //如果是web访问,传递路径变量 $web_path = FN::getConfig('global/web_path'); if (!$web_path) { $web_path = FN_WEB_PATH; } $this->template->assign('url', $web_path); $this->template->assign('static', $web_path . 'static/'); } $this->action = empty($array['action']) ? '' : $array['action']; $this->param = empty($array['param']) ? array() : $array['param']; $_POST = FNbase::setEscape($_POST); $this->param = array_merge($this->param, $_POST); $this->ajax = FNbase::isAJAX(); $this->_init_before($this->action); $this->_init($this->action); $result = $this->_view($this->action); $this->_view_after($result); }
private function _getCache($key) { if (empty($this->userCache) || empty($this->userCache[$key])) { $cache = FN::server('cache'); $this->userCache[$key] = unserialize($cache->get('user/' . $key)); } return $this->userCache[$key]; }