* | * \----- 测试组 */ $tableUserGroups =& FLEA::getSingleton('FLEA_Acl_Table_UserGroups'); /* @var $tableUserGroups FLEA_Acl_Table_UserGroups */ $group = array('name' => '开发组', 'roles' => array($roles['Developer'])); $tableUserGroups->create($group); $parent = $tableUserGroups->find(array('name' => '开发组')); $group = array('name' => 'QeePHP Team', 'parent_id' => $parent['user_group_id'], 'roles' => array($roles['Developer'])); $tableUserGroups->create($group); $group = array('name' => 'PHPChina Team', 'parent_id' => $parent['user_group_id'], 'roles' => array($roles['Developer'])); $tableUserGroups->create($group); $group = array('name' => '测试组', 'parent_id' => $parent['user_group_id'], 'roles' => array($roles['Tester'], array_merge($roles['Developer'], array('#JOIN#' => array('is_include' => 0))))); $tableUserGroups->create($group); $groups = $tableUserGroups->findAll(); $groups = array_to_hashmap($groups, 'name'); /** * 创建用户,并分配到各个组 */ $tableUsers =& FLEA::getSingleton('FLEA_Acl_Table_Users'); /* @var $tableUsers FLEA_Acl_Table_Users */ $users = array(array('username' => 'liaoyulei', 'password' => '123456', 'email' => '*****@*****.**', 'user_group_id' => $groups['QeePHP Team']['user_group_id']), array('username' => 'liwei', 'password' => '123456', 'email' => '*****@*****.**', 'user_group_id' => $groups['QeePHP Team']['user_group_id']), array('username' => 'liye', 'password' => '123456', 'email' => '*****@*****.**', 'user_group_id' => $groups['QeePHP Team']['user_group_id']), array('username' => 'dali', 'password' => '123456', 'email' => '*****@*****.**', 'user_group_id' => $groups['QeePHP Team']['user_group_id'])); $tableUsers->createRowset($users); /** * 为用户指派单独的角色 */ $user = $tableUsers->find(array('username' => 'liaoyulei')); $user['roles'][] = $roles['ProjectManager']; $tableUsers->update($user); $user = $tableUsers->find(array('username' => 'liye')); $user['roles'][] = $roles['Tester'];
function make_tag_action() { chkpw('cache_tag'); header('Cache-control: private, must-revalidate'); set_time_limit(0); if(!front::$get['tag']){ front::$get['tag'] = front::$post['tag']; } if(!front::$get['submit']){ front::$get['submit'] = front::$post['submit']; } $otag=new tag(); $tags=$otag->getrows("",0); //var_dump($tags); $tags = $this->view->hottags = array_to_hashmap($tags,'tagid','tagname'); if (!front::get('submit')) return; if(!config::get('tag_html')||!front::$get['tag']){ front::flash("没有设置生成html!"); front::redirect(front::$from); return; } $tagid = front::$get['tag']; $tag = $tags[$tagid]; $pinyin = pinyin::get($tag); $arctag=new arctag(); $archive_num=$arctag->rec_count('tagid='.$tagid); front::$record_count = $archive_num; $pagesize = config::get('list_pagesize'); front::$pages = $pagesize; $cpage = ceil($archive_num/$pagesize); $j=0; for($i=1;$i<=$cpage;$i++){ $path = 'tags/'.$pinyin.'_'.$tagid.'_'.$i.'.html'; tool::mkdir(dirname($path)); $data = file_get_contents(config::get('site_url').'index.php?case=tag&act=show&tag='.urlencode($tag).'&page='.$i); if(file_put_contents($path, $data)){ $j++; } } if ($j > 0){ front::flash("成功生成html <b>$j</b> 页!"); front::redirect(front::$from); }else{ front::flash("没有数据生成html!"); front::redirect(front::$from); } }