error_reporting(error_reporting() & (-1 ^ E_DEPRECATED)); } #Include main classes and files require "external/libs/Smarty.class.php"; require "core/classes/template.class.php"; require "core/classes/user.class.php"; require "core/classes/main.class.php"; require "core/menu.php"; #Initialize our classes $smarty = new Smarty(); $template = new Template($settings['tempPath'], $settings['langPath'], $smarty); #Load the user from the database (if he is logged in) if (GetCookie('hbb')) { $uid = $db->SafeString(GetCookie('hbb')); $userClass = new User($uid); $user = $userClass->loadData(); } #Setting up classes $smarty->debugging = false; $smarty->caching = false; $smarty->cache_lifetime = 120; $template->language = 'English'; $template->theme = 'Paper'; #The 'get' variables that we use to proccess requests $page = GetGet('page'); $pageid = GetGet('id'); #Anwsering requests (From this file, we do all of the back-end logic and display the theme templates) require "core/controllers/main.php"; #Destroy our database connection upon exiting the script $db->DestroyConnection(); #Flush the buffer
} } elseif (intval(Tools::getRequest('toggleStatus')) > 0) { $object = new User(intval(Tools::getRequest('toggleStatus'))); if (Validate::isLoadedObject($object)) { $object->toggleStatus(); } if (is_array($object->_errors) and count($object->_errors) > 0) { $errors = $object->_errors; } else { echo '<div class="conf">更新对象状态成功</div>'; } } $table = new UIAdminTable('user', 'User', 'id_user'); $table->header = array(array('sort' => false, 'isCheckAll' => 'itemsBox[]', 'name' => 'id_user'), array('name' => 'id_user', 'title' => 'ID', 'filter' => 'string'), array('name' => 'name', 'title' => '昵称', 'filter' => 'string'), array('name' => 'email', 'title' => '邮箱', 'filter' => 'string'), array('name' => 'active', 'title' => '状态', 'filter' => 'bool'), array('name' => 'upd_date', 'title' => '最后登录'), array('name' => 'add_date', 'title' => '注册时间'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'delete'))); $filter = $table->initFilter(); $orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'id_user'; $orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'desc'; $limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50'; $p = Tools::G('p') ? Tools::G('p') == 0 ? 1 : Tools::G('p') : 1; $result = User::loadData($p, $limit, $orderBy, $orderWay, $filter); if (isset($errors)) { UIAdminAlerts::MError($errors); } $breadcrumb = new UIAdminBreadcrumb(); $breadcrumb->home(); $breadcrumb->add(array('title' => '用户', 'active' => true)); $bread = $breadcrumb->draw(); $btn_group = array(array('type' => 'a', 'title' => '新用户', 'href' => 'index.php?rule=user_edit', 'class' => 'btn-success', 'icon' => 'plus')); echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb'); $btn_group = array(array('type' => 'button', 'title' => '批量删除', 'confirm' => '你确定要删除选中项?', 'name' => 'deleteItems', 'class' => 'btn-danger', 'icon' => 'remove')); echo UIViewBlock::area(array('title' => '用户列表', 'table' => $table, 'result' => $result, 'limit' => $limit, 'btn_groups' => $btn_group), 'table');