function init() { if(!union::getconfig('enabled')) { echo '<script type="text/javascript">alert("'.lang('推广联盟未开启,转让会员中心!').'")</script>'; front::refresh(url::create('user/index')); } $user=''; if(cookie::get('login_username') &&cookie::get('login_password')) { $user=new user(); $user=$user->getrow(array('username'=>cookie::get('login_username'))); } if(!is_array($user) &&front::$act != 'into'&&front::$act != 'login'&&front::$act != 'register'&&front::$act != 'login_js'&&front::$act != 'login_success'&&front::$act != 'getpass'&&front::$act != 'edit'){ front::redirect(url::create('user/login')); }else{ if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) { $this->view->user = $user; $this->view->usergroupid = $user['groupid']; $obj = new usergroup(); $this->roles = $obj->getrow(array('groupid'=>$this->view->usergroupid)); } } $this->_user=new user; $this->view->form = $this->_user->get_form(); $this->view->field = $this->_user->getFields(); $this->view->primary_key=$this->_user->primary_key; $this->view->data = $this->view->user; $this->_union = new union(); $this->view->uniondata = $this->_union->getrow(array('userid'=>$this->view->data['userid'])); if(!$this->view->uniondata &&front::$act != 'register'&&front::$act != 'into') { echo '<script type="text/javascript">alert("'.lang('未申请账号,转入联盟申请页面!').'");window.location.href="'.url::create('union/register').'";</script>'; //front::refresh(url::create('union/register')); } $this->_pagesize=config::get('manage_pagesize'); }
public static function getRoles($groupid){ $group = usergroup::getInstance(); $groups = $group->getrow("groupid='$groupid'"); if($groups['powerlist'] != ''){ return unserialize($groups['powerlist']); } }
function get_form_field() { return array( 'groupid'=>array( 'selecttype'=>'select', 'select'=>form::arraytoselect(usergroup::option()), ), 'checked'=>array( 'selecttype'=>'radio', 'select'=>form::arraytoselect(form::yesornotoarray('审核')), ), ); }
function init() { $this->archive = new archive(); $this->category = category::getInstance(); $this->view->category = $this->category->category; if (front::get('page')) $page = front::get('page'); else $page = 1; $this->view->page = $page; front::check_type($page); $_catpage = category::categorypages(front::get('catid')); if ($_catpage) { $this->pagesize = $_catpage; } else { $this->pagesize = config::get('list_pagesize'); } front::check_type($this->pagesize); $announcement = new announcement(); $this->view->announcements = $announcement->getrows(null, 10); $this->view->usergroupid = 1000; front::check_type(cookie::get('login_username'), 'safe'); front::check_type(cookie::get('login_password'), 'safe'); $this->view->showarchive = archive::getInstance()->getrow(front::get('aid')); $addcontentuser = new user(); $addcontentuser = $addcontentuser->getrow(array('userid' => $this->view->showarchive['userid'])); if (is_array($addcontentuser)) { $this->view->adduser = $addcontentuser; } if (cookie::get('login_username') && cookie::get('login_password')) { $user = new user(); $user = $user->getrow(array('username' => cookie::get('login_username'))); if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) { $this->view->user = $user; $this->view->usergroupid = $user['groupid']; $obj = new usergroup(); $this->roles = $obj->getrow(array('groupid'=>$this->view->usergroupid)); } } }
function login_action() { cookie::del('passinfo'); //$_SESSION['test'] = 'test'; $this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])); if (front::post('submit')) { if ($this->view->loginfalse) { if (!session::get('verify') ||front::post('verify') <>session::get('verify')) { front::flash('验证码错误!'); $this->render(); exit; } } $user=new user(); $user=$user->getrow(array('username'=>front::post('username'),'password'=>md5(front::post('password')))); if (is_array($user)) { $roles = usergroup::getRoles($user['groupid']); session::set('roles',null); if($roles){ front::$isadmin=true; session::set('roles',$roles); }else{ front::alert('无权登录后台'); } if(!front::post('expire')){ cookie::set('login_username',$user['username']); cookie::set('login_password',front::cookie_encode($user['password'])); }else{ $expire = time() + front::post('expire'); cookie::set('login_username',$user['username'],$expire); cookie::set('login_password',front::cookie_encode($user['password']),$expire); } session::set('username',$user['username']); event::log('后台登录','成功'); require_once ROOT.'/celive/include/config.inc.php'; require_once ROOT.'/celive/include/celive.class.php'; $login=new celive(); $login->auth(); $GLOBALS['auth']->login(front::post('username'),front::post('password')); $GLOBALS['auth']->check_login1(); front::$user=$user; }elseif (!is_array(front::$user) ||!isset(front::$isadmin)) { cookie::set('loginfalse'.md5($_SERVER['REQUEST_URI']),(int) cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) +1,time() +3600); event::log('loginfalse','失败 user='******'username')); front::flash('密码错误或不存在该管理员!'); front::refresh(url('admin/login',true)); } } $this->render(); }
</span> </td> </tr> </table> </div> <div id="con_one_5" style="display:none"> <table border="0" cellspacing="0" cellpadding="0" id="table5" width="100%"> <thead> <tr class="th"> <th width="38%">会员组</th> <th width="30%">浏览</th> <th width="30%">下载</th> </tr> <?php foreach (usergroup::getInstance()->group as $group) { if ($group['groupid'] == '888') { continue; } ?> <tr> <td align="center"><?php echo $group['name']; ?> </td> <td align="center"><?php echo form::checkbox("_ranks[" . $group['groupid'] . "][view]", -1, @$data['_ranks'][$group['groupid']]['view']); ?> </td> <td align="center"><?php echo form::checkbox("_ranks[" . $group['groupid'] . "][down]", -1, @$data['_ranks'][$group['groupid']]['down']);
function usergroupname($gid) { return usergroup::name($gid); }
<?php /** * @Project : Openology Framework * @package frontend * @copyright (C) 2004 Openology Pte Ltd * @link http://www.openology.org/ * @author Andy Ma <*****@*****.**> * @Created on 2004-12-30 17:36:40 * @$Id: group_list.php 518 2005-03-17 06:45:17Z ken $ **/ include_once OOO_APP_MODULES . '/page.php'; include_once OOO_APP_CLASSES . '/usergroup.php'; include_once OOO_CORE . '/form/Form.php'; include_once OOO_CORE . '/form/FormController.php'; $group = new usergroup($DB); $arr_data = $group->selectAllusergroup(); $arr_checkbox = array(); for ($i = 0; $i < count($arr_data); $i++) { $arr_checkbox[$arr_data[$i]['id']] = ''; } $form = new Form('form1', 'index.php', 'post'); $checkbox1 =& $form->addElement('allcheckbox'); $checkbox2 =& $form->addElement('checkbox'); $checkbox2->setAttribute('id', 'delete'); $checkbox2->setAttribute('name', 'delete[]'); //$arr_checkbox = array(1=>'', 2=>''); $checkbox2->setAttribute('checkboxes', $arr_checkbox); $checkbox2->return_type = 'array'; $button1 =& $form->addElement('button'); $button1->setAttribute('id', 'newbutton');
// | | // | For the full copyright and license information, please view the COPYRIGHT | // | file that was distributed with this source code. If the COPYRIGHT file is | // | missing, please visit Openology homepage: http://www.openology.org/ | // +---------------------------------------------------------------------------+ // // $Id: include_once OOO_APP_MODULES . '/page.php'; include_once OOO_APP_CLASSES . '/usergroup.php'; include_once OOO_CORE . '/form/Form.php'; include_once OOO_CORE . '/form/FormController.php'; include_once OOO_LIB . '/phpgacl/gacl.class.php'; include_once OOO_LIB . '/phpgacl/gacl_api.class.php'; $gacl_api = new gacl_api($gacl_options); if ($op == 'editgroup') { $group = new usergroup($DB); $group->id = $_GET['group_id']; $arr_group = $group->selectusergroup(); $smarty->assign("function_title", 'Edit Group'); } else { $smarty->assign("function_title", 'Add Group'); } $arr_data = $gacl_api->get_objects('', 1, 'aco'); $arr_aco = array(); $arr_tmp = $arr_data['system']; $arr_checked = array(); for ($i = 0; $i < count($arr_tmp); $i++) { $obj_value = $arr_tmp[$i]; $obj_id = $gacl_api->get_object_id('system', $obj_value, 'aco'); $arr_obj = $gacl_api->get_object_data($obj_id, 'aco'); $arr_aco[$obj_value] = $arr_obj[0][3];
include_once OOO_APP_MODULES . '/page.php'; include_once OOO_APP_CLASSES . '/usergroup.php'; include_once OOO_APP_CLASSES . '/user.php'; include_once OOO_CORE . '/form/Form.php'; include_once OOO_CORE . '/form/FormController.php'; include_once OOO_CORE . '/gui/SmartyUtil.php'; include_once OOO_LIB . '/phpgacl/gacl.class.php'; include_once OOO_LIB . '/phpgacl/gacl_api.class.php'; $group_id = $_GET['id']; //group_id $gacl_api = new gacl_api($gacl_options); $id = $gacl_api->get_group_id($group_id, $group_id, 'ARO'); //aro group_id $arr_user = $gacl_api->get_group_objects($id, 'aro'); //aro object value $group = new usergroup($DB); if (is_array($arr_user)) { if (count($arr_user)) { $arr_in = $group->selectInUser($arr_user['users'], 1); $arr_out = $group->selectInUser($arr_user['users'], 0); } else { $user = new user($DB); $arr_out = $user->selectAlluser(1000, 1); } } $smartyutil = new SmartyUtil(); $arr_newin = $smartyutil->toSmartyArray($arr_in, 'name', 'id'); $arr_newout = $smartyutil->toSmartyArray($arr_out, 'name', 'id'); $form = new Form('form1', 'index.php', 'post'); $form->addRule('select_all(document.form1.select2);'); $select1 =& $form->addElement('select');
define(ROOT_PATH, '../'); include_once ROOT_PATH . 'includes/common.inc.php'; include_once ROOT_PATH . 'includes/template.inc.php'; include_once ROOT_PATH . 'classes/group.inc.php'; include_once ROOT_PATH . 'modules/authorisation/interface.inc.php'; //check if User is allowed to view this file // if ($userdata['user_level'] != 1) // { // error_report(AUTH_ERROR, 'no_admin' , __LINE__, __FILE__,$sql); // } $usergroup = $_GET['usergroup']; if (!isset($usergroup)) { $usergroup = 1; } $sel_group = new usergroup(); $sel_group->generate_from_id($usergroup); // if (isset($del_usergroup)) // { // // $del_group = new usergroup(); // $del_group->generate_from_id($del_usergroup); // $del_group->delete(); // // } // // // // // if (isset($HTTP_POST_VARS['new_usergroup'])) // {
// | Copyright (c) 2004-2005 Openology.org Team | // | | // | For the full copyright and license information, please view the COPYRIGHT | // | file that was distributed with this source code. If the COPYRIGHT file is | // | missing, please visit Openology homepage: http://www.openology.org/ | // +---------------------------------------------------------------------------+ // // $Id: include_once OOO_APP_MODULES . '/page.php'; include_once OOO_APP_CLASSES . '/usergroup.php'; include_once OOO_CORE . '/form/Form.php'; include_once OOO_CORE . '/form/FormController.php'; include_once OOO_LIB . '/phpgacl/gacl.class.php'; include_once OOO_LIB . '/phpgacl/gacl_api.class.php'; $gacl_api = new gacl_api($gacl_options); $usergroup = new usergroup($DB); if ($op == 'deletegroup') { $arr_id = $_POST['delete']; for ($i = 0; $i < count($arr_id); $i++) { $usergroup->id = $arr_id[$i]; $usergroup->deleteusergroup(); $id = $gacl_api->get_group_id($group->id, $group->id, 'ARO'); $gacl_api->del_group($id, true, 'ARO'); } } else { $usergroup->name = $_POST['name']; $usergroup->description = $_POST['description']; $aco_array = array(); $aco_array['system'] = array(); $aco_array['system'] = $_POST['permission']; if ($op == 'creategroup') {
$group['name'] = $row['name']; $usergroups[] = $group; } foreach ($HTTP_SESSION_VARS['default_usergroup_ids'] as $key => $group_ids) { $group_obj = new usergroup(); if ($group_obj->generate_from_id($group_ids) == OP_SUCCESSFUL) { $group['id'] = $group_obj->id; $group['name'] = $group_obj->get_name(); $default_usergroups[] = $group; } else { // delete unproper entries unset($HTTP_SESSION_VARS['default_usergroup_ids'][$key]); } } foreach ($HTTP_SESSION_VARS['registered_users_usergroup_ids'] as $key => $group_ids) { $group_obj = new usergroup(); if ($group_obj->generate_from_id($group_ids) == OP_SUCCESSFUL) { $group['id'] = $group_obj->id; $group['name'] = $group_obj->get_name(); $registered_users_usergroups[] = $group; } else { // delete unproper entries unset($HTTP_SESSION_VARS['registered_users_usergroup_ids'][$key]); } } $smarty->assign('default_usergroup_ids', $default_usergroups); $smarty->assign('registered_users_usergroup_ids', $registered_users_usergroups); @$smarty->assign('not_default_usergroup_ids', array_minus_array($usergroups, $default_usergroups)); @$smarty->assign('not_registered_users_usergroup_ids', array_minus_array($usergroups, $registered_users_usergroups)); $smarty->assign('installed_templates', get_installed_templates()); $smarty->assign('installed_language', get_installed_languages());
function getPrices($price) { if (cookie::get('login_username') && cookie::get('login_password')) { $user = new user(); $user = $user->getrow(array('username' => cookie::get('login_username'))); if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) { $obj = new usergroup(); $roles = $obj->getrow(array('groupid' => $user['groupid'])); } } if ($roles['discount'] != 0) { $newprice = $price * $roles['discount'] * 0.1; }else{ $newprice = $price; } return array('oldprice'=>$price,'price'=>$newprice,'groupname'=>$roles['name']); }