12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- Lib::loadClass('RouteToolBase');
- Lib::loadClass('UI');
- Lib::loadClass('Response');
- Lib::loadClass('Theme');
- require_once dirname(__FILE__) . '/../auth.php'; // Theme_Auth_panel_biall_net
- // class name must have the same name as file
- // index.php?_route=UrlAction_ChangeUser - uruchamia defaultAction
- class RouteTool_ChangeUser extends RouteToolBase {
- function handleAuth() {
- $id = V::get('id', '', $_POST);
- $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);
- if (!$id || !in_array($id, $authIds)) {
- return Response::sendRedirect( "index.php" );
- }
- foreach ($_SESSION['PANEL_BN_USERS'] as $item) {
- if ($id != $item['ID']) continue;
- // trigger_error(date("Y-m-d H:i:s") . "\t" . "panel_bn/RouteTool_ChangeUser changed to({$id})", E_USER_NOTICE);
- @session_start();
- $_SESSION['ADM_ID'] = $item['ID'];
- // 'ADM_ACCOUNT' => $item['LOGIN'], // AUTHORIZE_USER, ADM_ACCOUNT
- $_SESSION['ADM_NAME'] = implode(" ", [ $item['P_NAME'], $item['P_NAME_SECOND'] ]); // ADM_NAME
- $_SESSION['ADM_COMPANY'] = $item['BILLING_OWNER']; // ADM_COMPANY
- session_write_close();
- sleep(1);
- // 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;
- }
- function defaultAction() {
- UI::gora();
- echo '<h1>ChangeUser Tool</h1>';
- UI::dol();
- }
- }
|