$tmp_eventscall->AddEvent(new HuiEvent('main', 'default', '')); $el[$group_data['id']]['groupelements'][$cont_b]['name'] = $descstr; $el[$group_data['id']]['groupelements'][$cont_b]['image'] = $pagedata['iconfile']; $el[$group_data['id']]['groupelements'][$cont_b]['action'] = $tmp_eventscall->GetEventsCallString() . '&act=def'; $el[$group_data['id']]['groupelements'][$cont_b]['themesized'] = 'true'; unset($tmp_eventscall); $cont_b++; $pagesquery->MoveNext(); } } } } if ($group_data['name'] == 'tools') { $logout_events_call = new HuiEventsCall('index.php'); $logout_events_call->AddEvent(new HuiEvent('login', 'logout', '')); $cont_a++; $el[$group_data['id']]['groupelements'][$cont_a]['name'] = $amp_menu_locale->GetStr('logout'); $el[$group_data['id']]['groupelements'][$cont_a]['image'] = $hui_page->mThemeHandler->mIconsBase . $hui_page->mThemeHandler->mIconsSet['apps']['error']['base'] . '/apps/' . $hui_page->mThemeHandler->mIconsSet['apps']['error']['file']; $el[$group_data['id']]['groupelements'][$cont_a]['action'] = $logout_events_call->GetEventsCallString(); $el[$group_data['id']]['groupelements'][$cont_a]['target'] = 'parent'; } $groups_query->MoveNext(); $cont_a++; } } $hui_vertframe = new HuiVertFrame('vertframe'); $hui_vertframe->AddChild(new HuiTreeMenu('treemenu', array('elements' => $el, 'width' => '120', 'target' => 'groupop', 'allgroupsactive' => 'false'))); $hui_mainvertgroup->AddChild($hui_vertframe); $hui_page->AddChild($hui_mainvertgroup); $hui->AddChild($hui_page); $hui->Render();
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(); }
function sum_page() { global $gEnv; $amp_locale = new Locale('amp_root_menu', AMP_LANG); import('com.solarix.ampoliros.module.ModuleConfig'); $mod_cfg = new ModuleConfig($gEnv['root']['db'], 'ampoliros'); $hui = new Hui($gEnv['root']['db'], TRUE); $hui->LoadWidget('table'); $hui->LoadWidget('page'); $hui->LoadWidget('vertgroup'); $hui->LoadWidget('vertframe'); $hui->LoadWidget('treemenu'); $hui_page = new HuiPage('page', array('title' => 'Ampoliros' . (strlen(AMP_HOST) ? ' - ' . AMP_HOST . (strlen(AMP_DOMAIN) ? '.' . AMP_DOMAIN : '') : ''), 'border' => 'false')); $hui_page->mArgs['background'] = $hui_page->mThemeHandler->mStyle['menuback']; $hui_mainvertgroup = new HuiVertGroup('mainvertgroup'); $el[1]['groupname'] = 'Ampoliros'; $cont = 1; $query =& $gEnv['root']['db']->Execute('SELECT id FROM sites'); if ($query->NumRows()) { $el[1]['groupelements'][$cont]['name'] = $amp_locale->GetStr('siteadmin'); $el[1]['groupelements'][$cont]['image'] = $hui_page->mThemeHandler->mStyle['siteaccess']; $el[1]['groupelements'][$cont]['action'] = 'admin/'; $el[1]['groupelements'][$cont]['themesized'] = 'true'; $cont++; } $el[1]['groupelements'][$cont]['name'] = $amp_locale->GetStr('rootadmin'); $el[1]['groupelements'][$cont]['image'] = $hui_page->mThemeHandler->mStyle['rootaccess']; $el[1]['groupelements'][$cont]['action'] = 'root/'; $el[1]['groupelements'][$cont]['themesized'] = 'true'; if ($mod_cfg->GetKey('ampoliros-link-disabled') != '1') { $el[1]['groupelements'][++$cont]['name'] = $amp_locale->GetStr('amphome'); $el[1]['groupelements'][$cont]['image'] = $hui_page->mThemeHandler->mStyle['ampminilogo']; $el[1]['groupelements'][$cont]['action'] = 'http://www.ampoliros.com/'; $el[1]['groupelements'][$cont]['target'] = 'op'; $el[1]['groupelements'][$cont]['themesized'] = 'true'; } if ($mod_cfg->GetKey('solarix-link-disabled') != '1') { $el[1]['groupelements'][++$cont]['name'] = $amp_locale->GetStr('solarixhome'); $el[1]['groupelements'][$cont]['image'] = $hui_page->mThemeHandler->mStyle['solarixminilogo']; $el[1]['groupelements'][$cont]['action'] = 'http://www.solarix.biz/'; $el[1]['groupelements'][$cont]['target'] = 'op'; $el[1]['groupelements'][$cont]['themesized'] = 'true'; } if ($mod_cfg->GetKey('oem-link-disabled') != '1') { $oem_link_filename = $mod_cfg->GetKey('oem-link-filename'); if (strlen($oem_link_filename) and file_exists(CGI_PATH . $oem_link_filename)) { $el[1]['groupelements'][++$cont]['name'] = $mod_cfg->GetKey('oem-name'); $el[1]['groupelements'][$cont]['image'] = CGI_URL . $oem_link_filename; $el[1]['groupelements'][$cont]['action'] = $mod_cfg->GetKey('oem-url'); $el[1]['groupelements'][$cont]['target'] = 'parent'; $el[1]['groupelements'][$cont]['themesized'] = 'false'; } } $hui_vertframe = new HuiVertFrame('vertframe'); $hui_vertframe->AddChild(new HuiTreeMenu('treemenu', array('elements' => $el, 'width' => '120', 'target' => 'parent', 'allgroupsactive' => 'true'))); $hui_mainvertgroup->AddChild($hui_vertframe); $hui_page->AddChild($hui_mainvertgroup); $hui->AddChild($hui_page); $hui->Render(); }