private function __construct($cookie = '') { $this->init(); $this->st = FN::i('module.user.login|sessionDB'); $this->checkCookie($cookie); $this->setSession(); }
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'); }
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); }
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); } }
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'); }
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]; }
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; }
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; } //权限 }
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'); }
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'); } }
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']); }
public function delete() { $user = FN::i('module.user'); $user->delete($_POST['uid']); return array('status' => 'success'); }
public function logout() { $user = FN::i('module.user'); $user->logout(); return array('success' => true); }
protected function _form($data, $field, $form = array(), $other = array()) { if (empty($other) && !is_array($form)) { $url = $form; $form = array(); $form['handle'] = $url; } if ($this->tagStatus && in_array($this->action, $this->tagList) && !empty($data[$this->tagStatus])) { $tag = FN::i('module.tag'); $tag_list = $tag->getList(array(), array('module_name' => $this->controllname)); $tag_list = $tag_list['list']; if (!empty($tag_list)) { if (empty($other['toolbar'])) { $this->_toolbar(array(), $other); } $list = $tag->searchTag($this->controllname, $data[$this->tagStatus]); $taginfo = array(); if (!empty($list)) { list($taginfo) = array_slice($list, 0, 1); $data[self::$tagField] = $taginfo['tag_id']; $taginfo = array_merge($taginfo, $tag_list[$taginfo['tag_id']]); } $tagbutton = array(); foreach ($tag_list as $key => $value) { $button = array('text' => $value['name'], 'handle' => 'manage.tag.list.add', 'param' => array($this->tagStatus), 'filter' => array($this->tagField => "/^(?!" . $value['id'] . ").*\$/"), 'data' => array('module_name' => $this->controllname, 'tag_id' => $value['id'], 'target_field' => $this->tagStatus), 'color' => $value['color'], 'autoOp' => 2); $tagbutton[] = $this->_parseroute($button, 'shortname', array('handle')); } $tagbutton[] = array('line' => true); $button = array('handle' => 'manage.tag.list.delete', 'param' => array($this->tagStatus), 'filter' => array($this->tagField => "/^\\d+\$/"), 'data' => array('module_name' => $this->controllname, 'target_field' => $this->tagStatus), 'autoOp' => 2); $tagbutton[] = $this->_parseroute($button, 'shortname', array('handle')); $item = array('text' => '标签设置:', 'icon' => 'pager', 'param' => array($this->tagStatus)); if ($taginfo) { $item = array('text' => '标签:' . $taginfo['name'], 'color' => $taginfo['color'], 'param' => array($this->tagStatus)); } else { $item = array('text' => '标签设置:', 'icon' => 'pager', 'param' => array($this->tagStatus)); } $this->_menu($tagbutton, $item); $other['toolbar']['items'][] = $item; } } $form['fields'] = $field; $form['data'] = $data; if (!empty($form['url'])) { $form['handle'] = $form['url']; } $this->_parseroute($form, 'name', array('handle')); //验证操作 if (!empty($form['validate'])) { $form['validate'] = $form['validate'] . '.view'; } $other['type'] = 'form'; $other['form'] = $form; return $other; }
public function getCode() { $codeClass = FN::i('module.code'); $codeClass->setType(get_called_class()); return $codeClass->getCode($this->user['uid']); }
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']); }
private function __construct($array) { $this->role = FN::i('module.right|roleDB'); $this->list = FN::i('module.right|listDB'); $this->setUser(FN::i('module.user')); }
private function __construct($array) { $this->tag = FN::i('module.tag|DB'); $this->taglist = FN::i('module.tag|listDB'); }
private function __construct() { $this->codelist = FN::i('module.code|listDB'); }
* 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;
public function update() { $devolve = FN::i('module.devolve'); $devolve->multiUpdate($_POST); return array('status' => 'success'); }