function main_deleteuser($eventData) { global $env, $hui_mainframe, $amp_locale, $hui_titlebar; $user_query =& $env['ampdb']->execute('SELECT * ' . 'FROM users ' . 'WHERE id=' . $eventData['userid']); $user_data = $user_query->Fields(); $hui_vgroup = new HuiVertGroup('removereqvgroup', array('halign' => 'center', 'groupalign' => 'center')); $hui_hgroup1 = new HuiHorizGroup('removereqhgroup', array('align' => 'middle', 'width' => '0%')); $hui_hgroup1->AddChild(new HuiLabel('removereqlabel', array('label' => sprintf($amp_locale->GetStr('removeuserquestion_label'), $user_data['username'])))); $hui_vgroup->AddChild($hui_hgroup1); $hui_hgroup2 = new HuiHorizGroup('removereqhgroup', array('align' => 'middle', 'groupalign' => 'center')); $remove_action = new HuiEventSCall(); $remove_action->AddEvent(new HuiEvent('main', 'users', '')); $remove_action->AddEvent(new HuiEvent('pass', 'removeuser', array('uid' => $eventData['userid']))); $remove_button = new HuiButton('removebutton', array('label' => $amp_locale->GetStr('okremoveuser_button'), 'horiz' => 'true', 'themeimage' => 'button_ok', 'action' => $remove_action->GetEventsCallString())); $remove_frame = new HuiHorizFrame('removeframe'); $remove_frame->AddChild($remove_button); $hui_hgroup2->AddChild($remove_frame); $dontremove_action = new HuiEventsCall(); $dontremove_action->AddEvent(new HuiEvent('main', 'users', '')); $dontremove_button = new HuiButton('dontremovebutton', array('label' => $amp_locale->GetStr('dontremoveuser_button'), 'horiz' => 'true', 'themeimage' => 'stop', 'action' => $dontremove_action->GetEventsCallString())); $dontremove_frame = new HuiHorizFrame('dontremoveframe'); $dontremove_frame->AddChild($dontremove_button); $hui_hgroup2->AddChild($dontremove_frame); $ok_action = new HuiEventsCall(); $ok_action->AddEvent(new HuiEvent('main', 'default', '')); $hui_ok_form = new HuiForm('okform', array('action')); $hui_vgroup->AddChild($hui_hgroup2); $hui_mainframe->AddChild($hui_vgroup); $hui_titlebar->mTitle .= ' - ' . $user_data['username'] . ' - ' . $amp_locale->GetStr('removeuser_title'); }
$hui_maintoolbar->AddChild($hui_homebutton); // Help tool bar // $hui_helptoolbar = new HuiToolBar('helpbar'); $main_disp = new HuiDispatcher('main'); $event_name = $main_disp->GetEventName(); if (strcmp($event_name, 'help')) { $help_action = new HuiEventsCall(); $help_action->AddEvent(new HuiEvent('main', 'help', array('node' => $event_name))); $hui_helpbutton = new HuiButton('helpbutton', array('label' => $amp_locale->GetStr('help_button'), 'themeimage' => 'help', 'horiz' => 'true', 'action' => $help_action->GetEventsCallString())); $hui_helptoolbar->AddChild($hui_helpbutton); } // Toolbar frame // $hui_toolbarframe = new HuiHorizGroup('toolbarframe'); $hui_toolbarframe->AddChild($hui_maintoolbar); $hui_toolbarframe->AddChild($hui_helptoolbar); $hui_mainvertgroup->AddChild($hui_toolbarframe); $hui_mainframe = new HuiHorizFrame('mainframe'); $hui_mainstatus = new HuiStatusBar('mainstatusbar'); // Pass dispatcher // $pass_disp = new HuiDispatcher('pass'); $pass_disp->AddEvent('edit', 'pass_edit'); function pass_edit($eventData) { global $env, $hui_mainstatus, $amp_locale; if ($eventData['newpassworda'] == $eventData['newpasswordb']) { if (strlen($eventData['newpassworda'])) { $temp_user = new User($env['ampdb'], $env['currentsiteserial']); $temp_user->SetUserIdByUsername($env['currentuser']);
function DoAuth($wrong = false, $reason = '') { global $gEnv; $amp_locale = new Locale('amp_misc_auth', AMP_LANG); $amp = Ampoliros::instance('Ampoliros'); $amp->startRoot(); $hui = new Hui($gEnv['root']['db']); $hui->LoadWidget('button'); $hui->LoadWidget('formarg'); $hui->LoadWidget('form'); $hui->LoadWidget('grid'); $hui->LoadWidget('horizbar'); $hui->LoadWidget('horizframe'); $hui->LoadWidget('horizgroup'); $hui->LoadWidget('image'); $hui->LoadWidget('label'); $hui->LoadWidget('link'); $hui->LoadWidget('page'); $hui->LoadWidget('sessionkey'); $hui->LoadWidget('statusbar'); $hui->LoadWidget('string'); $hui->LoadWidget('submit'); $hui->LoadWidget('titlebar'); $hui->LoadWidget('vertframe'); $hui->LoadWidget('vertgroup'); $hui_page = new HuiPage('loginpage', array('title' => $amp_locale->GetStr('amplogin'), 'border' => 'false')); $hui_topgroup = new HuiVertGroup('topgroup', array('align' => 'center', 'groupalign' => 'center', 'groupvalign' => 'middle', 'height' => '100%')); $hui_maingroup = new HuiVertGroup('maingroup', array('align' => 'center')); $hui_titlebar = new HuiTitleBar('titlebar', array('title' => $amp_locale->GetStr('amplogin'), 'closewidget' => 'false', 'newwindowwidget' => 'false')); $hui_mainbframe = new HuiVertFrame('vframe', array('align' => 'center')); $hui_mainframe = new HuiHorizGroup('horizframe'); $hui_mainstatus = new HuiStatusBar('mainstatusbar'); // Main frame // $hui_grid = new HuiGrid('grid', array('rows' => '2', 'cols' => '2')); $hui_grid->AddChild(new HuiLabel('usernamelabel', array('label' => $amp_locale->GetStr('username'))), 0, 0); $hui_grid->AddChild(new HuiString('username', array('disp' => 'login')), 0, 1); $hui_grid->AddChild(new HuiLabel('passwordlabel', array('label' => $amp_locale->GetStr('password'))), 1, 0); $hui_grid->AddChild(new HuiString('password', array('disp' => 'login', 'password' => 'true')), 1, 1); $hui_vgroup = new HuiVertGroup('vertgroup', array('align' => 'center')); //$hui_vgroup->AddChild( new HuiLabel( 'titlelabel', array( 'label' => $amp_locale->GetStr( 'amprootlogin' ) ) ) ); $hui_vgroup->AddChild($hui_grid); $hui_vgroup->AddChild(new HuiSubmit('submit', array('caption' => $amp_locale->GetStr('enter')))); $form_events_call = new HuiEventsCall(); $form_events_call->AddEvent(new HuiEvent('login', 'login', '')); $form_events_call->AddEvent(new HuiEvent('main', 'default', '')); $hui_form = new HuiForm('form', array('action' => $form_events_call->GetEventsCallString())); $hui_hgroup = new HuiHorizGroup('horizgroup', array('align' => 'middle')); // $hui_hgroup -> AddChild(new HuiButton('amplogo', array('image' => $hui_page -> mThemeHandler -> mStyle['middot'], 'action' => AMP_URL, 'highlight' => false))); $hui_hgroup->AddChild(new HuiButton('password', array('themeimage' => 'password', 'themeimagetype' => 'big', 'action' => AMP_URL, 'highlight' => false))); $hui_hgroup->AddChild($hui_vgroup); $hui_form->AddChild($hui_hgroup); $hui_mainframe->AddChild($hui_form); // Wrong account check // if ($wrong) { if ($gEnv['core']['config']->Value('ALERT_ON_WRONG_LOCAL_USER_LOGIN') == '1') { Carthag::import('com.solarix.ampoliros.security.SecurityLayer'); global $login_disp; $event_data = $login_disp->GetEventData(); $amp_security = new SecurityLayer(); $amp_security->SendAlert('Wrong user local login for user ' . $event_data['username'] . ' from remote address ' . $_SERVER['REMOTE_ADDR']); $amp_security->LogFailedAccess($event_data['username'], false, $_SERVER['REMOTE_ADDR']); unset($amp_security); } $sleep_time = $gEnv['core']['config']->Value('WRONG_LOGIN_DELAY'); if (!strlen($sleep_time)) { $sleep_time = 1; } $max_attempts = $gEnv['core']['config']->Value('MAX_WRONG_LOGINS'); if (!strlen($max_attempts)) { $max_attempts = 3; } sleep($sleep_time); if (isset($_SESSION['site_login_attempts'])) { $_SESSION['site_login_attempts']++; if ($_SESSION['site_login_attempts'] >= $max_attempts) { AmpDie($amp_locale->GetStr('wrongpwd')); } } else { $_SESSION['site_login_attempts'] = 1; } if ($reason) { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr($reason); } else { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('wrongpwd'); } } else { $_SESSION['site_login_attempts'] = 0; } // Page render // $hui_maingroup->AddChild($hui_titlebar); //$hui_maingroup->AddChild( new HuiButton( 'amplogo', array( 'image' => CGI_URL.'ampbigdot.gif', 'action' => AMP_URL ) ) ); $hui_mainbframe->AddChild($hui_mainframe); $hui_mainbframe->AddChild(new HuiHorizBar('hb')); $hui_mainbframe->AddChild(new HuiLink('copyright', array('label' => $amp_locale->GetStr('auth_copyright.label'), 'link' => 'http://www.solarix.it/', 'target' => '_blank'))); $hui_maingroup->AddChild($hui_mainbframe); $hui_maingroup->AddChild($hui_mainstatus); $hui_topgroup->AddChild($hui_maingroup); $hui_page->AddChild($hui_topgroup); $hui->AddChild($hui_page); $hui->Render(); $carthag = Carthag::instance(); $carthag->halt(); }
$hui_accountstoolbar->AddChild($hui_newaccountbutton); // Help tool bar // $hui_helptoolbar = new HuiToolBar('helpbar'); $main_disp = new HuiDispatcher('main'); $event_name = $main_disp->GetEventName(); if (strcmp($event_name, 'help')) { $help_action = new HuiEventsCall(); $help_action->AddEvent(new HuiEvent('main', 'help', array('node' => $event_name))); $hui_helpbutton = new HuiButton('helpbutton', array('label' => $amp_locale->GetStr('help_button'), 'themeimage' => 'help', 'horiz' => 'true', 'action' => $help_action->GetEventsCallString())); $hui_helptoolbar->AddChild($hui_helpbutton); } // Toolbar frame // $hui_toolbarframe = new HuiHorizGroup('toolbarframe'); $hui_toolbarframe->AddChild($hui_profilestoolbar); $hui_toolbarframe->AddChild($hui_userstoolbar); $hui_toolbarframe->AddChild($hui_accountstoolbar); $hui_toolbarframe->AddChild($hui_helptoolbar); $hui_mainvertgroup->AddChild($hui_toolbarframe); $hui_mainframe = new HuiHorizFrame('mainframe'); $hui_mainstatus = new HuiStatusBar('mainstatusbar'); // Pass dispatcher // $pass_disp = new HuiDispatcher('pass'); $pass_disp->AddEvent('adduser', 'pass_adduser'); function pass_adduser($eventData) { global $env, $hui_mainstatus, $amp_locale; $result = false; $xuser = new XmlRpcUser($env['ampdb']);
$hui_hgroup1 = new HuiHorizGroup('nexthgroup', array('align' => 'middle', 'groupalign' => 'center')); $hui_hgroup1->AddChild(new HuiLabel('nextlabel', array('label' => $amp_locale->GetStr('cleanup_label')))); $hui_vgroup->AddChild($hui_hgroup1); $next_action = new HuiEventSCall(); $next_action->AddEvent(new HuiEvent('pass', 'cleanup', '')); $next_button = new HuiButton('nextbutton', array('label' => $amp_locale->GetStr('next_button'), 'horiz' => 'true', 'image' => CGI_URL . 'hui-forward.gif', 'action' => $next_action->GetEventsCallString())); $hui_vgroup->AddChild(new HuiHorizBar('hr')); $hui_vgroup->AddChild($next_button); setup_check_log($hui_vgroup); $hui_mainframe->AddChild($hui_vgroup); } else { if (!file_exists(TMP_PATH . '.done')) { $hui_titlebar->mTitle .= ' - ' . $amp_locale->GetStr('finish_title'); $hui_vgroup = new HuiVertGroup('nextvgroup', array('halign' => 'left', 'groupalign' => 'left')); $hui_hgroup1 = new HuiHorizGroup('nexthgroup', array('align' => 'middle', 'groupalign' => 'center')); $hui_hgroup1->AddChild(new HuiLabel('nextlabel', array('label' => $amp_locale->GetStr('finish_label')))); $hui_vgroup->AddChild($hui_hgroup1); $next_action = new HuiEventSCall(); $next_action->AddEvent(new HuiEvent('pass', 'finish', '')); $next_button = new HuiButton('nextbutton', array('label' => $amp_locale->GetStr('next_button'), 'horiz' => 'true', 'image' => CGI_URL . 'hui-forward.gif', 'action' => $next_action->GetEventsCallString())); $hui_vgroup->AddChild(new HuiHorizBar('hr')); $hui_vgroup->AddChild($next_button); setup_check_log($hui_vgroup); $hui_mainframe->AddChild($hui_vgroup); } } } } } } }