Esempio n. 1
0
 private function __construct($array)
 {
     $this->nav = FN::i('module.nav|DB');
     $this->log = FN::i('module.log|DB');
     $this->right_list = FN::i('module.right|listDB');
     $this->tag = FN::i('module.tag|DB');
     $this->taglist = FN::i('module.tag|listDB');
 }
Esempio n. 2
0
 protected function _handle_after($result)
 {
     if (empty($result['error'])) {
         //日志
         $log = FN::i('module.log');
         $arr = array('log_info' => $_POST, 'result' => $result, 'module_name' => $this->controllname . '.' . $action);
         $log->add($arr);
     }
 }
Esempio n. 3
0
 public function add($arr)
 {
     $user = FN::i('module.user');
     $arr['datetime'] = time();
     $arr['user_id'] = $user->getUid();
     $arr['log_info'] = FNbase::setEscape(serialize($arr['log_info']), true);
     $arr['result'] = FNbase::setEscape(serialize($arr['result']), true);
     $this->log->add($arr);
 }
Esempio n. 4
0
 public function delete()
 {
     $tag = FN::i('module.tag');
     if (empty($_POST[$_POST['target_field']])) {
         return array('error' => 'noparam');
     }
     $tag->deleteTag($_POST['module_name'], $_POST[$_POST['target_field']]);
     return array('success' => 'success');
 }
Esempio n. 5
0
 public static function parsePath($dir)
 {
     $Symbol = substr($dir, 0, 1);
     switch ($Symbol) {
         case '%':
             return sys_get_temp_dir() . '/' . substr($dir, 1);
             //缓存目录
         //缓存目录
         default:
             parent::parsePath($dir);
     }
 }
Esempio n. 6
0
 public function setRelate($class)
 {
     if ($class == $this->className) {
         return false;
     }
     if (empty($this->classArray[$class])) {
         $className = FN::i($class);
         $this->classArray[$class] = new $className();
         $this->classArray[$class]->user =& $this->user;
     }
     unset($this->relatedClass);
     $this->relateClass =& $this->classArray[$class];
 }
Esempio n. 7
0
 public function __construct($relay_host = "", $smtp_port = 25, $auth = false, $user, $pass)
 {
     $this->debug = FALSE;
     $this->smtp_port = $smtp_port;
     $this->relay_host = $relay_host;
     $this->time_out = 30;
     $this->auth = $auth;
     $this->user = $user;
     $this->pass = $pass;
     $this->log_file = "";
     $this->sock = FALSE;
     $this->charset = FN::getConfig('global/charset');
 }
Esempio n. 8
0
 public function verifyCode($code, $update = false)
 {
     $codeClass = FN::i('module.code');
     $codeClass->setType(get_called_class());
     $uid = $codeClass->verifyCode($code, 86400);
     if (empty($uid)) {
         return false;
     }
     $this->_setUser($uid, 'uid');
     if ($update) {
         $codeClass->updateCode();
     }
     return true;
 }
Esempio n. 9
0
 public static function getInstance($array)
 {
     if (!empty($array['api'])) {
         $server = FN::F('layer.api.' . $array['api'] . '.server');
         if (empty($server)) {
             return false;
         }
         $class = get_called_class();
         $server->setClass(new $class());
         $server->init($array);
         $server->start();
         return true;
     }
     return false;
 }
Esempio n. 10
0
 static function getInstance($array)
 {
     if (empty(self::$_Instance)) {
         if (!empty($array['proxy'])) {
             self::$_Instance = FN::F('layer.api.restcache.proxy');
             self::$_Instance->setProxy($array['proxy']);
         } elseif (!empty($array['cache'])) {
             self::$_Instance = new self();
             self::$_Instance->setCache($array['cache']);
         } else {
             return false;
         }
     }
     return self::$_Instance;
 }
Esempio n. 11
0
 protected function _init_before($action)
 {
     //登录
     $user = FN::i('module.user');
     if (!$user->isLogin()) {
         echo json_encode(array('error' => 'nologin'));
         //前端页面判断,弹出登录框
         exit;
     }
     if (!$user->isManager()) {
         echo json_encode(array('error' => 'nomanage'));
         //非管理员,弹出提示框
         exit;
     }
     //权限
 }
Esempio n. 12
0
 public static function initServer($config)
 {
     $smarty = new SmartyBC();
     $config = array_merge(self::$_Default, $config);
     if ($config['compile_dir'] == self::$_Default['compile_dir']) {
         $config['compile_dir'] .= md5($config['template_dir']) . '/';
     }
     if ($config['cache_dir'] == self::$_Default['cache_dir']) {
         $config['cache_dir'] .= md5($config['template_dir']) . '/';
     }
     FN::setKey($config, $config, true);
     foreach ($config as $key => $value) {
         $smarty->{$key} = $value;
     }
     return $smarty;
 }
Esempio n. 13
0
 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']);
 }
Esempio n. 14
0
 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');
     }
 }
Esempio n. 15
0
 public function delete()
 {
     $log = FN::i('module.log');
     if (!$this->isBatch()) {
         $id = $_POST['id'];
     } else {
         $str = '';
         $arr = $this->getBatch();
         foreach ($arr as $k) {
             foreach ($k as $k2) {
                 $str .= $k2 . ',';
             }
         }
         $id = substr($str, 0, -1);
     }
     if (!empty($id)) {
         $log->delete("id in ({$id})");
     }
     return array('status', 'success');
 }
Esempio n. 16
0
 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;
     }
 }
Esempio n. 17
0
 public function delete()
 {
     $tag = FN::i('module.tag');
     if (!$this->isBatch()) {
         if (empty($_POST['id'])) {
             return array('error' => 'noparam');
         }
         $tag->delete($_POST['id']);
         return array('success' => 'success');
     } else {
         $id_arr = array();
         $arr = $this->getBatch();
         foreach ($arr as $k) {
             if (empty($k['id'])) {
                 return array('error' => 'noparam');
             }
         }
         foreach ($arr as $k) {
             $tag->delete($k['id']);
         }
         return array('success' => 'success');
     }
 }
Esempio n. 18
0
 public function baselist()
 {
     $user = FN::i('module.user');
     $page_info = $this->getPageInfo();
     if (!$page_info) {
         $right = FN::i('module.right');
         $role_list = $right->getRoleList();
         $role_list = $this->_listdata($role_list['list']);
         $role_list = $role_list['Rows'];
         $field = array(array('name' => 'username', 'display' => '用户名'), array('name' => 'role_id', 'display' => '所属角色', 'type' => 'select', 'select' => $role_list, 'textField' => 'name', 'valueField' => 'id'), array('name' => 'status', 'display' => '状态', 'type' => 'select', 'select' => $this->_parseSelect(array(1 => '通过', 0 => '禁止'))));
         $grid = $other = array();
         $search_data = array();
         $search_field = array(array('name' => 'username', 'display' => '用户名'));
         $this->_search($search_data, $search_field, $other);
         $toolbar = array(array('view' => 'manage.user.add', 'icon' => 'add', 'window' => true), array('view' => 'manage.user.edit', 'icon' => 'modify', 'param' => array('uid'), 'window' => true), array('handle' => 'manage.user.delete', 'icon' => 'delete', 'param' => array('uid'), 'batch' => true, 'confirm' => '删除确认!'));
         $this->_toolbar($toolbar, $grid);
         $other['dblclick'] = array('param' => array('uid'), 'view' => 'manage.user.edit', 'window' => true);
         $this->_parseroute($other['dblclick']);
         return $this->_list($field, $grid, $other);
     }
     $pagesize = $page_info['pagesize'];
     $p = ($page_info['page'] - 1) * $pagesize;
     $search = $this->getSearchInfo();
     $search['is_manage'] = 0;
     if (isset($search['username'])) {
         $search['username'] = '******' . $search['username'] . '%"';
     }
     $result = $user->getList(array('limit' => array($p, $pagesize)), $search);
     if ($result['total'] > 0) {
         foreach ($result['list'] as $key => $value) {
             unset($value['password']);
             $result[$key] = $value;
         }
     }
     return $this->_listdata($result['list'], $result['total']);
 }
Esempio n. 19
0
 public function run($url = '')
 {
     if (empty($this->RouteArray)) {
         return false;
     }
     $url = empty($url) ? ($this->HOST ? $this->HOST : '') . FNbase::getRequestUri() : $url;
     $rule = $this->parseRoute($url);
     if (!$rule) {
         return false;
     }
     if (!empty($rule['result'])) {
         //$为变量说明符
         $pos = strpos($rule['class'], '$');
         if ($pos !== false) {
             //参数需转换
             $search_arr = $replace_arr = array();
             foreach ($rule['result'] as $key => $value) {
                 if (is_array($value)) {
                     continue;
                 }
                 $search_arr[] = '$' . $key;
                 $replace_arr[] = $value;
             }
             $rule['class'] = str_replace($search_arr, $replace_arr, $rule['class']);
         }
     }
     if ($this->DEBUG) {
         var_dump($rule['result'], $rule['class']);
     }
     $this->DEBUG = false;
     //返回执行类
     return FN::i($rule['class'], $rule['result']);
 }
Esempio n. 20
0
 function halt($message = '', $sql = '')
 {
     //@file_put_contents(FRAME_DATA.'sql.log','[MYSQL]['.$this->errno().']'.date('Y-m-d H:m:i').':'.$this->error().' '.$sql."\r\n",FILE_APPEND);
     echo $message;
     if (FN::getConfig('debug/sql')) {
         echo '[' . $this->errno() . ']' . date('Y-m-d H:m:i') . ':' . $this->error() . ' ' . $sql;
     }
 }
Esempio n. 21
0
 public static function getControllName()
 {
     return substr(FN::callName(get_called_class(), 'handle', false), strlen('controller.'));
 }
Esempio n. 22
0
 public function setType($type, $all = true)
 {
     if (empty($type)) {
         return false;
     }
     if ($all) {
         $type = FN::lastName($type);
     }
     $this->type = array_search($type, self::$_TypeArray);
     return $this->type;
 }
Esempio n. 23
0
 public function update()
 {
     $devolve = FN::i('module.devolve');
     $devolve->multiUpdate($_POST);
     return array('status' => 'success');
 }
Esempio n. 24
0
 private function __construct($array)
 {
     $this->role = FN::i('module.right|roleDB');
     $this->list = FN::i('module.right|listDB');
     $this->setUser(FN::i('module.user'));
 }
Esempio n. 25
0
<?php

include_once 'fn/fn.php';
include_once 'config.php';
FN::setConfig($config);
FN::initProject();
$route = FN::F('tools.route');
FN::map('route', $route);
//基本控制器
$route->route('main', array('rule' => '', 'class' => 'controller.manage.main|view', 'default' => array('action' => 'main')));
//视图/执行控制器
$route->route('manage', array('rule' => ':type:controller.:action.:op:param', 'class' => 'controller.$type.$controller|$op', 'extend' => array('controller' => array('(\\.\\w+)*', 'parseSlice', array(1)), 'op' => '(view|handle)', 'param' => array('(\\/\\w+)*', 'parseParam', array('/')))));
$route->run();
Esempio n. 26
0
 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];
 }
Esempio n. 27
0
 public function getCode()
 {
     $codeClass = FN::i('module.code');
     $codeClass->setType(get_called_class());
     return $codeClass->getCode($this->user['uid']);
 }
Esempio n. 28
0
 function halt($message = '', $sql = '')
 {
     //@file_put_contents(FRAME_DATA.'sql.log','[MSSQL]'.date('Y-m-d H:m:i').':'.$sql."\r\n",FILE_APPEND);
     if (!FN::getConfig('debug/sql')) {
         $sql = '';
     }
     echo $message . '<br />' . $sql;
 }
Esempio n. 29
0
 private function __construct($array)
 {
     $this->tag = FN::i('module.tag|DB');
     $this->taglist = FN::i('module.tag|listDB');
 }
Esempio n. 30
0
 * Created by JetBrains PhpStorm.
 * User: taoqili
 * Date: 12-1-16
 * Time: 上午11:44
 * To change this template use File | Settings | File Templates.
 */
header("Content-Type: text/html; charset=utf-8");
error_reporting(E_ERROR | E_WARNING);
$path = 'upload/';
//最好使用缩略图地址,否则当网速慢时可能会造成严重的延时
$action = htmlspecialchars($_POST["action"]);
$id = $_POST["id"];
$domain = $_POST["domain"];
if ($action == 'get' && !empty($id) && !empty($domain)) {
    require_once 'fn/fn.php';
    $fileserver = FN::i('file');
    $array = $fileserver->select($domain, $id);
    foreach ($array as $file) {
        echo $fileserver->getUrl() . $file->file['filename'] . "ue_separate_ue";
    }
}
/*
	if ( $action == "get" ) {
		$files = getfiles( $path );
		if ( !$files ) return;
		rsort($files,SORT_STRING);
		$str = "";
		foreach ( $files as $file ) {
			$str .= $file . "ue_separate_ue";
		}
		echo $str;