|
@@ -12,6 +12,9 @@ require_once dirname(__FILE__) . '/../auth.php'; // Theme_Auth_panel_biall_net
|
|
class RouteTool_ChangeUser extends RouteToolBase {
|
|
class RouteTool_ChangeUser extends RouteToolBase {
|
|
|
|
|
|
function handleAuth() {
|
|
function handleAuth() {
|
|
|
|
+ $idAdmin = V::get('id_admin', '', $_GET);
|
|
|
|
+ if ($idAdmin && User::isAdmin()) return $this->handleRootAuth($idAdmin);
|
|
|
|
+
|
|
$id = V::get('id', '', $_POST);
|
|
$id = V::get('id', '', $_POST);
|
|
$authIds = (!empty($_SESSION['PANEL_BN_USERS'])) ? array_map(V::makePick('ID'), $_SESSION['PANEL_BN_USERS']) : [];
|
|
$authIds = (!empty($_SESSION['PANEL_BN_USERS'])) ? array_map(V::makePick('ID'), $_SESSION['PANEL_BN_USERS']) : [];
|
|
// trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser to({$id}) ids:[".implode(",", $authIds)."]", E_USER_NOTICE);
|
|
// trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser to({$id}) ids:[".implode(",", $authIds)."]", E_USER_NOTICE);
|
|
@@ -33,8 +36,48 @@ class RouteTool_ChangeUser extends RouteToolBase {
|
|
// trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser ses: { ID: {$_SESSION['ID']}, ADM_NAME: {$_SESSION['ADM_NAME']} }", E_USER_NOTICE);
|
|
// trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser ses: { ID: {$_SESSION['ID']}, ADM_NAME: {$_SESSION['ADM_NAME']} }", E_USER_NOTICE);
|
|
}
|
|
}
|
|
|
|
|
|
- Response::sendRedirect( "index.php" );
|
|
|
|
- exit;
|
|
|
|
|
|
+ return Response::sendRedirect( "index.php" );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function handleRootAuth($idAdmin) {
|
|
|
|
+ if (!User::isAdmin()) {
|
|
|
|
+ return Response::sendRedirect( "index.php" );
|
|
|
|
+ }
|
|
|
|
+ // trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser root: { ID: {$_SESSION['ID']}, ADM_NAME: {$_SESSION['ADM_NAME']} }", E_USER_NOTICE);
|
|
|
|
+ $_SESSION['PANEL_BN_USERS'] = [];
|
|
|
|
+ $_SESSION['PANEL_BN_USERS'][] = [
|
|
|
|
+ 'ID' => User::getID(),
|
|
|
|
+ 'LOGIN' => User::getLogin(),
|
|
|
|
+ 'P_NAME' => User::getName(),
|
|
|
|
+ 'P_NAME_SECOND' => '',
|
|
|
|
+ 'BILLING_OWNER' => '3', // BN
|
|
|
|
+ ];
|
|
|
|
+ $userInfo = DB::getPDO()->fetchFirst("
|
|
|
|
+ select
|
|
|
|
+ c.ID as `ID`
|
|
|
|
+ , c.user_mail_contact as `LOGIN`
|
|
|
|
+ , c.P_NAME as `P_NAME`
|
|
|
|
+ , c.P_NAME_SECOND as `P_NAME_SECOND`
|
|
|
|
+ , c.BILLING_OWNER as `BILLING_OWNER`
|
|
|
|
+ from COMPANIES as c
|
|
|
|
+ where c.ID = :id
|
|
|
|
+ ", [
|
|
|
|
+ ':id' => $idAdmin,
|
|
|
|
+ ]);
|
|
|
|
+ $_SESSION['PANEL_BN_USERS'][] = $userInfo;
|
|
|
|
+
|
|
|
|
+ // trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser root ses bn users: " . json_encode($_SESSION['PANEL_BN_USERS']), E_USER_NOTICE);
|
|
|
|
+ $_SESSION['PANEL_BN_USER_SELECTED'] = $idAdmin;
|
|
|
|
+
|
|
|
|
+ // $_SESSION['ADM_ID'] = $userInfo['ID'];
|
|
|
|
+ // // 'ADM_ACCOUNT' => $userInfo['LOGIN'], // AUTHORIZE_USER, ADM_ACCOUNT
|
|
|
|
+ // $_SESSION['ADM_NAME'] = implode(" ", [ $userInfo['P_NAME'], $userInfo['P_NAME_SECOND'] ]); // ADM_NAME
|
|
|
|
+ // $_SESSION['ADM_COMPANY'] = $userInfo['BILLING_OWNER']; // ADM_COMPANY
|
|
|
|
+ session_write_close();
|
|
|
|
+ // trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser root/ses: { ID: {$_SESSION['ID']}, ADM_NAME: {$_SESSION['ADM_NAME']} }", E_USER_NOTICE);
|
|
|
|
+ sleep(1);
|
|
|
|
+
|
|
|
|
+ return Response::sendRedirect( "index.php" );
|
|
}
|
|
}
|
|
|
|
|
|
function defaultAction() {
|
|
function defaultAction() {
|