From 3ff03dc4f0a72432b34c00da620272cf011e4ddd Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 29 Jul 2021 14:17:20 +1000 Subject: Publishing h-node.org code. - this is the h-node.org code, except - removed a js file (3x copies at three different locations) without license / copyright headers - /Js/linkToForm.js - /Public/Js/linkToForm.js - /admin/Public/Js/linkToForm.js - removed config files containing credentials - /Application/Include/params.php - /Config/Config.php - /admin/Application/Include/params.php - /admin/Config/Config.php - added license and copyright header to one php file - /admin/Library/ErrorReporting.php (almost identical to /Library/ErrorReporting.php which has the headers) --- .../Controllers/AdminregusersController.php | 101 +++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 h-source/admin/Application/Controllers/AdminregusersController.php (limited to 'h-source/admin/Application/Controllers/AdminregusersController.php') diff --git a/h-source/admin/Application/Controllers/AdminregusersController.php b/h-source/admin/Application/Controllers/AdminregusersController.php new file mode 100644 index 0000000..b4ed6ed --- /dev/null +++ b/h-source/admin/Application/Controllers/AdminregusersController.php @@ -0,0 +1,101 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class AdminregusersController extends Controller { + + function __construct($model, $controller, $queryString) { + parent::__construct($model, $controller, $queryString); + + $this->load('header_back'); + $this->load('footer_back','last'); + + $this->session('admin'); + $this->model('UsersModel'); + + $this->modelName = 'UsersModel'; + + $this->helper('Menu','adminregusers','panel/main'); + +// $this->m['UsersModel']->setFields('username,e_mail,has_confirmed,deleted,creation_date','sanitizeAll'); + + $this->setArgKeys(array('page:forceNat'=>1,'has_confirmed:sanitizeAll'=>'undef','deleted:sanitizeAll'=>'undef','id_group:sanitizeAll'=>'undef','token:sanitizeAll'=>'token')); + } + + public function main() + { + $this->shift(); + + Params::$nullQueryValue = 'undef'; + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->loadScaffold('main',array('popup'=>true,'popupType'=>'inclusive','mainMenu'=>'panel','recordPerPage'=>30)); + + $whereClauseArray = array( + 'has_confirmed' => $this->viewArgs['has_confirmed'], + 'deleted' => $this->viewArgs['deleted'], + 'id_group' => $this->viewArgs['id_group'], + ); + $this->scaffold->setWhereQueryClause($whereClauseArray); + + $this->scaffold->loadMain('regusers:id_user,regusers:username,regusers:e_mail,regusers:has_confirmed,regusers:deleted,smartDate|regusers:creation_date','regusers:id_user','link'); + $this->scaffold->setHead('USER ID,USERNAME,E-MAIL,HAS CONFIRMED?,DELETED?,DATE'); + $data['scaffold'] = $this->scaffold->render(); + $this->append($data); + $this->load('main'); + } + + public function associate() + { + $this->shift(0); + + $this->s['admin']->check(); + + if (!$this->s['admin']->checkCsrf($this->viewArgs['token'])) $this->redirect('panel/main/',2,'wrong token..'); + + $this->m['UsersModel']->printAssError = 'yes'; + $this->m['UsersModel']->updateTable('associate,dissociate'); + + $data['notice'] = $this->m['UsersModel']->notice; + + $data['menu'] = $this->h['Menu']->render('back'); + + $data['action'] = $this->baseUrl.'/adminregusers/associate'.$this->viewStatus; + + $data['groups'] = $this->m['UsersModel']->getFieldArray('reggroups:id_group','reggroups:name'); + + //get the name of the user whose id is $_POST['id_user'] + $users = $this->m['UsersModel']->db->select('regusers','username','id_user='.(int)$_POST['id_user']); + $data['user'] = $users[0]['regusers']['username']; + + //get the groups inside which the user is inserted + $this->m['UsersModel']->setWhereQueryClause(array('id_user'=>(int)$_POST['id_user'])); + $this->m['UsersModel']->orderBy = 'reggroups.id_group desc'; + $data['groupsUser'] = $this->m['UsersModel']->getAll('Boxes'); +// echo $this->m['UsersModel']->getQuery(); + + $this->set($data); + $this->load('associate'); + } +} \ No newline at end of file -- cgit v1.2.3