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(); }
function main_editprofile($eventData) { global $env, $amp_locale, $hui_mainframe, $hui_titlebar, $gEnv; $prof_query =& $env['ampdb']->execute('SELECT * ' . 'FROM xmlrpcprofiles ' . 'WHERE id=' . $eventData['profileid']); $prof_data = $prof_query->Fields(); $methods_query =& $env['ampdb']->Execute('SELECT module,name,unsecure,catalog ' . 'FROM xmlrpcmethods ' . 'ORDER BY module, name'); if ($methods_query->NumRows()) { $nodes = $sec = $desc = array(); $prev_catalog = $tmp_locale = ''; while (!$methods_query->eof) { $nodes[$methods_query->Fields('module')][] = $methods_query->Fields('name'); $sec[$methods_query->Fields('module')][$methods_query->Fields('name')] = $methods_query->Fields('unsecure') == $env['ampdb']->fmttrue ? false : true; $tmp_description = ''; if (strlen($methods_query->Fields('catalog'))) { if ($prev_catalog != $methods_query->Fields('catalog')) { $tmp_locale = new Locale($methods_query->Fields('catalog'), $gEnv['root']['locale']['language']); } $desc[$methods_query->Fields('module')][$methods_query->Fields('name')] = $tmp_locale->GetStr($methods_query->Fields('name')); $prev_catalog = $methods_query->Fields('catalog'); } $methods_query->MoveNext(); } $row = 0; $headers[0]['label'] = ''; $headers[1]['label'] = $amp_locale->GetStr('xmlrpcmodule_header'); $headers[2]['label'] = ''; $headers[3]['label'] = $amp_locale->GetStr('xmlrpcmethod_header'); $headers[4]['label'] = $amp_locale->GetStr('docstring_header'); $headers[5]['label'] = $amp_locale->GetStr('security_header'); $hui_methods_table = new HuiTable('methodstable', array('headers' => $headers, 'rowsperpage' => '15', 'pagesactionfunction' => 'editprofile_list_action_builder', 'pagenumber' => $eventData['editprofilepage'], 'sessionobjectusername' => $eventData['profileid'])); while (list($module, $methods) = each($nodes)) { $xprofile = new XmlRpcProfile($env['ampdb'], $eventData['profileid']); $node_state = $xprofile->NodeCheck(XMLRPCPROFILE_NODETYPE_MODULE, $module); switch ($node_state) { case XMLRPCPROFILE_MODULENODE_FULLYENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['greenball']; $enabled = true; break; case XMLRPCPROFILE_MODULENODE_PARTIALLYENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['goldball']; $enabled = true; break; case XMLRPCPROFILE_MODULENODE_NOTENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['redball']; $enabled = false; break; } $hui_methods_table->AddChild(new HuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 0); $hui_methods_table->AddChild(new HuiLabel('modulelabel' . $row, array('label' => $module)), $row, 1); $hui_module_toolbar[$row] = new HuiToolBar('moduletoolbar' . $row); if ($enabled) { $disable_action[$row] = new HuiEventsCall(); $disable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $disable_action[$row]->AddEvent(new HuiEvent('pass', 'disablenode', array('nodetype' => XMLRPCPROFILE_NODETYPE_MODULE, 'module' => $module, 'profileid' => $eventData['profileid']))); $hui_disable_button[$row] = new HuiButton('disablebutton' . $row, array(label => $amp_locale->GetStr('disablenode_label'), 'horiz' => 'true', 'themeimage' => 'lock', 'action' => $disable_action[$row]->GetEventsCallString())); $hui_module_toolbar[$row]->AddChild($hui_disable_button[$row]); } if (!$enabled or $node_state == XMLRPCPROFILE_MODULENODE_PARTIALLYENABLED) { $enable_action[$row] = new HuiEventsCall(); $enable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $enable_action[$row]->AddEvent(new HuiEvent('pass', 'enablenode', array('nodetype' => XMLRPCPROFILE_NODETYPE_MODULE, 'module' => $module, 'profileid' => $eventData['profileid']))); $hui_enable_button[$row] = new HuiButton('enablebutton' . $row, array(label => $amp_locale->GetStr('enablenode_label'), 'horiz' => 'true', 'themeimage' => 'unlock', 'action' => $enable_action[$row]->GetEventsCallString())); $hui_module_toolbar[$row]->AddChild($hui_enable_button[$row]); } $hui_methods_table->AddChild($hui_module_toolbar[$row], $row, 6); $row++; while (list(, $method) = each($methods)) { $node_state = $xprofile->NodeCheck(XMLRPCPROFILE_NODETYPE_METHOD, $module, $method); switch ($node_state) { case XMLRPCPROFILE_METHODNODE_ENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['greenball']; $enabled = true; break; case XMLRPCPROFILE_METHODNODE_NOTENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['redball']; $enabled = false; break; } $hui_methods_table->AddChild(new HuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 2); $hui_methods_table->AddChild(new HuiLabel('methodlabel' . $row, array('label' => $method)), $row, 3); $img = $sec[$module][$method] == true ? 'button_ok' : 'button_cancel'; $secure_image = $hui_methods_table->mThemeHandler->mIconsBase . $hui_methods_table->mThemeHandler->mIconsSet['actions'][$img]['base'] . '/actions/' . $hui_methods_table->mThemeHandler->mIconsSet['actions'][$img]['file']; $hui_methods_table->AddChild(new HuiLabel('desclabel' . $row, array('label' => $desc[$module][$method])), $row, 4); $hui_methods_table->AddChild(new HuiImage('secure' . $row, array('imageurl' => $secure_image)), $row, 5); $hui_method_toolbar[$row] = new HuiToolBar('methodtoolbar' . $row); if ($enabled) { $disable_action[$row] = new HuiEventsCall(); $disable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $disable_action[$row]->AddEvent(new HuiEvent('pass', 'disablenode', array('nodetype' => XMLRPCPROFILE_NODETYPE_METHOD, 'method' => $method, 'module' => $module, 'profileid' => $eventData['profileid']))); $hui_disable_button[$row] = new HuiButton('disablebutton' . $row, array(label => $amp_locale->GetStr('disablenode_label'), 'horiz' => 'true', 'themeimage' => 'lock', 'action' => $disable_action[$row]->GetEventsCallString())); $hui_method_toolbar[$row]->AddChild($hui_disable_button[$row]); } else { $enable_action[$row] = new HuiEventsCall(); $enable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $enable_action[$row]->AddEvent(new HuiEvent('pass', 'enablenode', array('nodetype' => XMLRPCPROFILE_NODETYPE_METHOD, 'method' => $method, 'module' => $module, 'profileid' => $eventData['profileid']))); $hui_enable_button[$row] = new HuiButton('enablebutton' . $row, array(label => $amp_locale->GetStr('enablenode_label'), 'horiz' => 'true', 'themeimage' => 'unlock', 'action' => $enable_action[$row]->GetEventsCallString())); $hui_method_toolbar[$row]->AddChild($hui_enable_button[$row]); } $hui_methods_table->AddChild($hui_method_toolbar[$row], $row, 6); $row++; } } $hui_mainframe->AddChild($hui_methods_table); } $hui_titlebar->mTitle .= ' - ' . $prof_data['profilename'] . ' - ' . $amp_locale->GetStr('editprofile_title'); }
function main_default($eventData) { global $env, $gEnv, $hui_mainframe, $hui_titlebar, $amp_locale; //$mod_cfg = new ModuleConfig( $env['ampdb'], 'ampoliros' ); $themes_query =& $env['ampdb']->Execute('SELECT name,catalog ' . 'FROM huithemes '); while (!$themes_query->eof) { $tmp_locale = new Locale($themes_query->Fields('catalog'), $gEnv['site']['locale']['language']); $elements[$themes_query->Fields('name')] = $tmp_locale->GetStr($themes_query->Fields('name')); $themes_query->MoveNext(); } asort($elements); $xml_def = '<vertgroup><name>vgroup</name><args><halign>center</halign></args><children> <form><name>theme</name><args><action type="encoded">' . urlencode(build_events_call_string('', array(array('main', 'default', ''), array('pass', 'settheme', '')))) . '</action></args><children> <grid><name>themegrid</name><children> <label row="0" col="0"><name>themelabel</name><args><label type="encoded">' . urlencode($amp_locale->GetStr('themes_label')) . '</label></args></label> <listbox row="1" col="0"><name>theme</name><args><elements type="array">' . huixml_encode($elements) . '</elements><default>' . ($env['hui']['theme']['name'] ? $env['hui']['theme']['name'] : $env['hui']['theme']['default']) . '</default><disp>pass</disp><size>10</size></args></listbox> </children></grid> <submit><name>submit</name><args><caption type="encoded">' . urlencode($amp_locale->GetStr('settheme_submit')) . '</caption></args></submit> </children></form> </children></vertgroup>'; $hui_mainframe->AddChild(new HuiXml('page', array('definition' => $xml_def))); $hui_titlebar->mTitle .= ' - ' . $amp_locale->GetStr('themes_title'); }
* */ // Initialization // require 'auth.php'; OpenLibrary('hui.library'); OpenLibrary('ampcentral-server.library'); OpenLibrary('locale.library'); OpenLibrary('ampshared.library'); $gHui = new Hui($gEnv['root']['db']); $gHui->LoadWidget('xml'); $gHui->LoadWidget('amppage'); $gHui->LoadWidget('amptoolbar'); $gLocale = new Locale('ampcentral-server_root_server', $gEnv['root']['locale']['language']); $gPage_content = $gStatus = $gToolbars = $gXml_def = ''; $gPage_title = $gLocale->GetStr('ampcentral-server.title'); $gMenu = get_ampoliros_root_menu_def($gEnv['root']['locale']['language']); $gToolbars['repository'] = array('repository' => array('label' => $gLocale->GetStr('repository.toolbar'), 'themeimage' => 'view_text', 'action' => build_events_call_string('', array(array('main', 'default', '')))), 'newrepository' => array('label' => $gLocale->GetStr('newrepository.toolbar'), 'themeimage' => 'filenew', 'action' => build_events_call_string('', array(array('main', 'newrepository', ''))))); $gToolbars['modules'] = array('modules' => array('label' => $gLocale->GetStr('modules.toolbar'), 'themeimage' => 'view_detailed', 'action' => build_events_call_string('', array(array('main', 'modules', '')))), 'newrepository' => array('label' => $gLocale->GetStr('newmodule.toolbar'), 'themeimage' => 'filenew', 'action' => build_events_call_string('', array(array('main', 'newmodule', ''))))); // Action dispatcher // $gAction_disp = new HuiDispatcher('action'); // ----- Repositories ------ // $gAction_disp->AddEvent('newrepository', 'action_newrepository'); function action_newrepository($eventData) { global $gEnv, $gLocale, $gStatus; $rep = new AmpCentralRepository($gEnv['root']['db']); if ($rep->Create($eventData['name'], $eventData['description'], $eventData['logevents'] == 'on' ? true : false)) { $gStatus = $gLocale->GetStr('repository_created.status');
$hui->LoadWidget('progressbar'); $hui->LoadWidget('radio'); $hui->LoadWidget('sessionkey'); $hui->LoadWidget('statusbar'); $hui->LoadWidget('string'); $hui->LoadWidget('submit'); $hui->LoadWidget('tab'); $hui->LoadWidget('table'); $hui->LoadWidget('text'); $hui->LoadWidget('titlebar'); $hui->LoadWidget('toolbar'); $hui->LoadWidget('treemenu'); $hui->LoadWidget('vertframe'); $hui->LoadWidget('vertgroup'); $hui->LoadWidget('xml'); $hui_page = new HuiPage('page', array('title' => $amp_locale->GetStr('sites_title'))); $hui_mainvertgroup = new HuiVertGroup('mainvertgroup'); $hui_titlebar = new HuiTitleBar('titlebar', array('title' => $amp_locale->GetStr('sites_title'), 'icon' => 'package')); $hui_mainvertgroup->AddChild($hui_titlebar); $menu_frame = new HuiHorizGroup('menuframe'); $menu_frame->AddChild(new HuiMenu('magellanmainmenu', array('menu' => get_ampoliros_root_menu_def($env['sitelocale'])))); $hui_mainvertgroup->AddChild($menu_frame); // Main tool bar // $hui_maintoolbar = new HuiToolBar('maintoolbar'); $home_action = new HuiEventsCall(); $home_action->AddEvent(new HuiEvent('main', 'default', '')); $hui_homebutton = new HuiButton('homebutton', array('label' => $amp_locale->GetStr('sites_button'), 'themeimage' => 'view_detailed', 'horiz' => 'true', 'action' => $home_action->GetEventsCallString())); $hui_maintoolbar->AddChild($hui_homebutton); if ($gEnv['core']['edition'] == AMP_EDITION_ENTERPRISE) { $site_query =& $gEnv['root']['db']->Execute('SELECT count(*) AS sites ' . 'FROM sites');
*/ require "auth.php"; if (!defined("LOCALE_LIBRARY")) { include LIBRARY_PATH . "locale.library"; } if (!defined("OOPHTML_LIBRARY")) { include LIBRARY_PATH . "oophtml.library"; } if (!defined("ADMINGUI_LIBRARY")) { include LIBRARY_PATH . "admingui.library"; } if (!defined("MODULES_LIBRARY")) { include LIBRARY_PATH . "modules.library"; } $adloc = new Locale("xmlrpcgateway", AMP_LOCALE); $page = new HtmlPage($adloc->GetStr("title")); $page->add(pagecaption($adloc->GetStr("title"))); $modcfg = new moduleconfig($env["ampdb"], "xmlrpcgateway"); switch ($env["disp"]["pass"]) { case "setcfg": $modcfg->setkey("DEST_HOST", $env["disp"]["desthost"]); $modcfg->setkey("DEST_PORT", $env["disp"]["destport"]); $modcfg->setkey("DEST_CGI", $env["disp"]["destcgi"]); break; } switch ($env["disp"]["act"]) { case "def": $table[0][0] = new htmltext($adloc->GetStr("hostdesc")); $table[1][0] = new htmlformtext("", "desthost", $modcfg->getkey("DEST_HOST"), "", 20); $table[0][1] = new htmltext($adloc->GetStr("hostnote")); $table[0][1]->colspan = 2;
// ----- Initialization ----- // require './auth.php'; Carthag::import('com.solarix.ampoliros.locale.Locale'); Carthag::import('com.solarix.ampoliros.locale.LocaleCountry'); Carthag::import('com.solarix.ampoliros.hui.Hui'); Carthag::import('com.solarix.ampoliros.hui.HuiEventsCall'); OpenLibrary('ampshared.library'); Carthag::import('com.solarix.ampoliros.maintenance.AmpolirosMaintenanceHandler'); $gLocale = new Locale('amp_root_maintenance', $gEnv['root']['locale']['language']); $gHui = new Hui($gEnv['root']['db']); $gHui->LoadWidget('xml'); $gHui->LoadWidget('amppage'); $gHui->LoadWidget('amptoolbar'); $gXml_def = $gPage_status = ''; $gPage_title = $gLocale->GetStr('maintenance.title'); $gToolbars['main'] = array('ampoliros' => array('label' => $gLocale->GetStr('general.toolbar'), 'themeimage' => 'configure', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'default', '')))), 'general' => array('label' => $gLocale->GetStr('ampoliros.toolbar'), 'themeimage' => 'configure', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'ampoliros', ''))))); $gToolbars['help'] = array('help' => array('label' => $gLocale->GetStr('help.toolbar'), 'themeimage' => 'help', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'help', ''))))); // ----- Action dispatcher ----- // $gAction_disp = new HuiDispatcher('action'); $gAction_disp->AddEvent('clear_systemlogs', 'action_clear_systemlogs'); function action_clear_systemlogs($eventData) { global $gPage_status, $gLocale; OpenLibrary('ampoliros_logs.maintenance', HANDLER_PATH); $maint = new AmpolirosLogsMaintenance(); $maint->mCleanAmpLog = true; $maint->mCleanAmpDbLog = true; $maint->mCleanPhpLog = true; $maint->mCleanRemoteLog = true;
// $Id: security.php,v 1.21 2004-07-14 13:15:37 alex Exp $ // ----- Initialization ----- // require './auth.php'; import('com.solarix.ampoliros.locale.Locale'); import('com.solarix.ampoliros.hui.Hui'); import('com.solarix.ampoliros.hui.HuiEventsCall'); import('com.solarix.ampoliros.security.SecurityLayer'); OpenLibrary('ampshared.library'); $gLocale = new Locale('amp_root_security', $gEnv['root']['locale']['language']); $gHui = new Hui($gEnv['root']['db']); $gHui->LoadWidget('xml'); $gHui->LoadWidget('amppage'); $gHui->LoadWidget('amptoolbar'); $gXml_def = $gPage_status = ''; $gPage_title = $gLocale->GetStr('security.title'); $gToolbars['main'] = array('check' => array('label' => $gLocale->GetStr('check.toolbar'), 'themeimage' => 'viewmag', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'default', '')))), 'settings' => array('label' => $gLocale->GetStr('settings.toolbar'), 'themeimage' => 'configure', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'settings', ''))))); $gToolbars['help'] = array('help' => array('label' => $gLocale->GetStr('help.toolbar'), 'themeimage' => 'help', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'help', ''))))); // ----- Action dispatcher ----- // $gAction_disp = new HuiDispatcher('action'); $gAction_disp->AddEvent('set_security_preset', 'action_set_security_preset'); function action_set_security_preset($eventData) { global $gEnv, $gLocale, $gPage_status; $amp_security = new SecurityLayer(); $amp_security->SetPredefinedLevel($eventData['preset']); $gPage_status = $gLocale->GetStr('security_settings_set.status'); } $gAction_disp->AddEvent('set_access_prefs', 'action_set_access_prefs'); function action_set_access_prefs($eventData)
$args['dbuser'] = AMP_DBUSER; $args['dbpass'] = AMP_DBPASS; $args['dbtype'] = AMP_DBTYPE; $args['dblog'] = AMP_DBLOG; $layer = new DBLayerFactory(); $tmpdb = $layer->NewDBLayer($args); if ($tmpdb->Connect($args)) { $loc_country = new LocaleCountry($country); $country_language = $loc_country->Language(); $language_locale = new Locale('amp_misc_locale', AMP_LANG); $selected_language = $pass_disp->GetEventData(); $selected_language = $selected_language['language']; $hui_vgroup = new HuiVertGroup('vgroup'); $language_query =& $tmpdb->Execute('SELECT * ' . 'FROM languages'); while (!$language_query->eof) { $languages[$language_query->Fields('langshort')] = $language_locale->GetStr($language_query->Fields('langname')); $language_query->MoveNext(); } $hui_locale_grid = new HuiGrid('localegrid'); $hui_locale_grid->AddChild(new HuiLabel('languagelabel', array('label' => $amp_locale->GetStr('language_label'))), 0, 0); $hui_locale_grid->AddChild(new HuiComboBox('language', array('disp' => 'pass', 'elements' => $languages, 'default' => $selected_language ? $selected_language : $country_language)), 0, 1); $hui_vgroup->AddChild($hui_locale_grid); $hui_vgroup->AddChild(new HuiHorizBar('horizbar1')); $hui_vgroup->AddChild(new HuiLabel('deflanglabel', array('label' => sprintf($amp_locale->GetStr('countrylanguage_label'), $languages[$country_language])))); $form_events_call = new HuiEventsCall(); $form_events_call->AddEvent(new HuiEvent('pass', 'setlanguage', '')); $form_events_call->AddEvent(new HuiEvent('main', 'language', '')); $hui_form = new HuiForm('language', array('action' => $form_events_call->GetEventsCallString())); $hui_form->AddChild($hui_vgroup); $next_action = new HuiEventSCall(); $next_action->AddEvent(new HuiEvent('pass', 'setlanguage', ''));
<?php require 'auth.php'; OpenLibrary('hui.library'); OpenLibrary('ampcentral-client.library'); OpenLibrary('locale.library'); OpenLibrary('ampshared.library'); $gHui = new Hui($gEnv['root']['db']); $gHui->LoadWidget('xml'); $gHui->LoadWidget('amppage'); $gHui->LoadWidget('amptoolbar'); $gLocale = new Locale('ampcentral-client_root_client', $gEnv['root']['locale']['language']); $gPage_content = $gStatus = $gToolbars = $gXml_def = ''; $gPage_title = $gLocale->GetStr('ampcentral-client.title'); $gMenu = get_ampoliros_root_menu_def($gEnv['root']['locale']['language']); $gToolbars['repository'] = array('repository' => array('label' => $gLocale->GetStr('repository.toolbar'), 'themeimage' => 'view_text', 'action' => build_events_call_string('', array(array('main', 'default', ''))), 'horiz' => 'true'), 'newrepository' => array('label' => $gLocale->GetStr('newrepository.toolbar'), 'themeimage' => 'filenew', 'action' => build_events_call_string('', array(array('main', 'newrepository', ''))), 'horiz' => 'true')); // Action dispatcher // $gAction_disp = new HuiDispatcher('action'); $gAction_disp->AddEvent('newrepository', 'action_newrepository'); function action_newrepository($eventData) { global $gEnv, $gLocale, $gStatus; $remote_ac = new AmpCentralRemoteServer($gEnv['root']['db']); if ($remote_ac->Add($eventData['accountid'])) { $gStatus = $gLocale->GetStr('repository_added.status'); } else { $gStatus = $gLocale->GetStr('repository_not_added.status'); } } $gAction_disp->AddEvent('removerepository', 'action_removerepository');
function main_language($eventData) { global $env, $hui_mainframe, $hui_titlebar, $amp_locale, $pass_disp, $hui_mainstatus; $loc_country = new LocaleCountry($env[$env['currentuser'] . '-country']); $country_language = $loc_country->Language(); $language_locale = new Locale('amp_misc_locale', $env[$env['currentuser'] . '-language']); $selected_language = $pass_disp->GetEventData(); $selected_language = $selected_language['language']; $hui_vgroup = new HuiVertGroup('vgroup'); $language_query =& $env['ampdb']->Execute('SELECT * ' . 'FROM languages'); while (!$language_query->eof) { $languages[$language_query->Fields('langshort')] = $language_locale->GetStr($language_query->Fields('langname')); $language_query->MoveNext(); } $hui_locale_grid = new HuiGrid('localegrid', array('rows' => '1', 'cols' => '3')); $hui_locale_grid->AddChild(new HuiLabel('languagelabel', array('label' => $amp_locale->GetStr('language_label'))), 0, 0); $hui_locale_grid->AddChild(new HuiComboBox('language', array('disp' => 'pass', 'elements' => $languages, 'default' => $selected_language ? $selected_language : $env[$env['currentuser'] . '-language'])), 0, 1); $hui_locale_grid->AddChild(new HuiSubmit('submit1', array('caption' => $amp_locale->GetStr('language_submit'))), 0, 2); $hui_vgroup->AddChild($hui_locale_grid); $hui_vgroup->AddChild(new HuiHorizBar('horizbar1')); $hui_vgroup->AddChild(new HuiLabel('deflanglabel', array('label' => sprintf($amp_locale->GetStr('countrylanguage_label'), $languages[$country_language])))); $form_events_call = new HuiEventsCall(); $form_events_call->AddEvent(new HuiEvent('pass', 'setlanguage', '')); $form_events_call->AddEvent(new HuiEvent('main', 'language', '')); $hui_form = new HuiForm('languageform', array('action' => $form_events_call->GetEventsCallString())); $hui_form->AddChild($hui_vgroup); $hui_mainframe->AddChild($hui_form); $hui_titlebar->mTitle .= ' - ' . $amp_locale->GetStr('language_title'); }
$hui->LoadWidget('progressbar'); $hui->LoadWidget('radio'); $hui->LoadWidget('sessionkey'); $hui->LoadWidget('statusbar'); $hui->LoadWidget('string'); $hui->LoadWidget('submit'); $hui->LoadWidget('tab'); $hui->LoadWidget('table'); $hui->LoadWidget('text'); $hui->LoadWidget('titlebar'); $hui->LoadWidget('toolbar'); $hui->LoadWidget('treemenu'); $hui->LoadWidget('vertframe'); $hui->LoadWidget('vertgroup'); $hui->LoadWidget('xml'); $hui_page = new HuiPage('page', array('title' => $amp_locale->GetStr('modules_title'))); $hui_mainvertgroup = new HuiVertGroup('mainvertgroup'); $hui_titlebar = new HuiTitleBar('titlebar', array('title' => $amp_locale->GetStr('modules_title'), 'icon' => 'kpackage')); $hui_mainvertgroup->AddChild($hui_titlebar); $menu_frame = new HuiHorizGroup('menuframe'); $menu_frame->AddChild(new HuiMenu('magellanmainmenu', array('menu' => get_ampoliros_root_menu_def($env['sitelocale'])))); $hui_mainvertgroup->AddChild($menu_frame); // Main tool bar // $hui_maintoolbar = new HuiToolBar('maintoolbar'); $home_action = new HuiEventsCall(); $home_action->AddEvent(new HuiEvent('main', 'default', '')); $hui_homebutton = new HuiButton('homebutton', array('label' => $amp_locale->GetStr('modules_button'), 'themeimage' => 'view_detailed', 'horiz' => 'true', 'action' => $home_action->GetEventsCallString())); $hui_maintoolbar->AddChild($hui_homebutton); $new_action = new HuiEventsCall(); $new_action->AddEvent(new HuiEvent('main', 'newmodule', ''));
unset($tmp_eventscall); $cont_b++; $pagesquery->MoveNext(); } } } if ($group_data['name'] == 'ampoliros') { $pagesquery =& $env['db']->execute('SELECT * ' . 'FROM rootpages ' . 'WHERE groupid=0 ' . 'OR groupid IS NULL ' . 'ORDER BY name'); if ($pagesquery) { $pagesnum = $pagesquery->numrows(); if ($pagesnum > 0) { while (!$pagesquery->eof) { $pagedata = $pagesquery->fields(); if (strlen($pagedata['catalog']) > 0) { $tmploc = new Locale($pagedata['catalog'], AMP_LANG); $descstr = $tmploc->GetStr($pagedata['name']); } $tmp_eventscall = new HuiEventsCall($pagedata['location']); $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') {
public function startSite($siteId, $userId = '') { $result = false; $this->setMode(Ampoliros::MODE_SITE); global $env; if (isset($GLOBALS['gEnv']['runtime']['site']['init']) and $GLOBALS['gEnv']['runtime']['site']['init'] == true) { return; } // Site id // $GLOBALS['gEnv']['site']['id'] = $siteId; $env['currentsite'] =& $GLOBALS['gEnv']['site']['id']; $env['currentsiteid'] =& $env['currentsite']; // Site data // $sitesquery = $GLOBALS['gEnv']['root']['db']->Execute('SELECT * FROM sites WHERE siteid=' . $GLOBALS['gEnv']['root']['db']->Format_Text($siteId)); if ($sitesquery->NumRows()) { $GLOBALS['gEnv']['site']['data'] = $sitesquery->Fields(); $env['sitedata'] =& $GLOBALS['gEnv']['site']['data']; $sitesquery->Free(); // Check if site is active // if ($this->getInterface() != Ampoliros::INTERFACE_WEB and $GLOBALS['gEnv']['site']['data']['siteactive'] == $GLOBALS['gEnv']['root']['db']->fmtfalse) { $this->abort('Site disabled'); } // Site log // define('SITE_LOG', SITESTUFF_PATH . $GLOBALS['gEnv']['site']['data']['siteid'] . '/log/site.log'); $GLOBALS['gEnv']['site']['log'] = SITE_LOG; // Current site serial number // $GLOBALS['gEnv']['site']['serial'] = $GLOBALS['gEnv']['site']['data']['id']; $env['currentsiteserial'] = $GLOBALS['gEnv']['site']['serial']; // Site database // $dbargs['dbtype'] = $GLOBALS['gEnv']['site']['data']['sitedbtype']; $dbargs['dbname'] = $GLOBALS['gEnv']['site']['data']['sitedbname']; $dbargs['dbhost'] = $GLOBALS['gEnv']['site']['data']['sitedbhost']; $dbargs['dbport'] = $GLOBALS['gEnv']['site']['data']['sitedbport']; $dbargs['dbuser'] = $GLOBALS['gEnv']['site']['data']['sitedbuser']; $dbargs['dbpass'] = $GLOBALS['gEnv']['site']['data']['sitedbpassword']; $dbargs['dblog'] = $GLOBALS['gEnv']['site']['data']['sitedblog']; $GLOBALS['gEnv']['site']['dblog'] =& $GLOBALS['gEnv']['site']['data']['sitedblog']; $db_fact = new DBLayerFactory(); $GLOBALS['gEnv']['site']['db'] = $db_fact->NewDBLayer($dbargs); $env['db'] = $GLOBALS['gEnv']['site']['db']; if (!$GLOBALS['gEnv']['site']['db']->Connect($dbargs)) { if (!defined('MISC_LIBRARY')) { include LIBRARY_PATH . 'misc.library'; } $adloc = new Locale('amp_misc_auth', $GLOBALS['gEnv']['root']['locale']['language']); AmpDie($adloc->GetStr('nodb')); } // Hui theme // $tmpquery = $GLOBALS['gEnv']['site']['db']->Execute('SELECT val ' . 'FROM sitesettings ' . 'WHERE keyname=' . $GLOBALS['gEnv']['site']['db']->Format_Text('sitetheme')); $GLOBALS['gEnv']['site']['theme'] = $tmpquery->Fields('val'); // Site cgi // if (strlen($GLOBALS['gEnv']['site']['data']['siteurl'])) { $tmp = parse_url($GLOBALS['gEnv']['site']['data']['siteurl']); $GLOBALS['gEnv']['site']['cgi'] = $tmp['scheme'] . '://' . $tmp['host'] . CGI_URL; } else { $GLOBALS['gEnv']['site']['cgi'] = CGI_URL; } $env['sitecgi'] =& $GLOBALS['gEnv']['site']['cgi']; unset($tmp); // Site country // $tmpquery = $GLOBALS['gEnv']['site']['db']->Execute('SELECT val ' . 'FROM sitesettings ' . 'WHERE keyname=' . $GLOBALS['gEnv']['site']['db']->Format_Text('sitecountry')); $GLOBALS['gEnv']['site']['locale']['country'] = strlen($tmpquery->Fields('val')) ? $tmpquery->Fields('val') : AMP_COUNTRY; $env['sitecountry'] = $GLOBALS['gEnv']['site']['locale']['country']; // Site language // $tmpquery = $GLOBALS['gEnv']['site']['db']->Execute('SELECT val ' . 'FROM sitesettings ' . 'WHERE keyname=' . $GLOBALS['gEnv']['site']['db']->Format_Text('sitelanguage')); $GLOBALS['gEnv']['site']['locale']['language'] = strlen($tmpquery->Fields('val')) ? $tmpquery->Fields('val') : AMP_LANG; $env['sitelanguage'] = $GLOBALS['gEnv']['site']['locale']['language']; // User // if (!strlen($userId)) { $userId = $siteId; } // User id // $GLOBALS['gEnv']['user']['id'] = $userId; $env['currentuser'] =& $GLOBALS['gEnv']['user']['id']; // Hui theme // $tmpquery = $GLOBALS['gEnv']['site']['db']->Execute('SELECT val ' . 'FROM sitesettings ' . 'WHERE keyname=' . $GLOBALS['gEnv']['site']['db']->Format_Text($GLOBALS['gEnv']['user']['id'] . '-theme')); $GLOBALS['gEnv']['user']['theme'] = $tmpquery->Fields('val'); if (!strlen($GLOBALS['gEnv']['user']['theme'])) { if (!strlen($GLOBALS['gEnv']['site']['theme'])) { import('com.solarix.ampoliros.module.ModuleConfig'); $mod_cfg = new ModuleConfig($GLOBALS['gEnv']['root']['db'], 'ampoliros'); if (strlen($mod_cfg->GetKey('hui-root-theme'))) { $GLOBALS['gEnv']['site']['theme'] = $mod_cfg->GetKey('hui-root-theme'); if (!strlen($GLOBALS['gEnv']['site']['theme'])) { $GLOBALS['gEnv']['site']['theme'] = $GLOBALS['gEnv']['hui']['theme']['default']; } } else { $GLOBALS['gEnv']['site']['theme'] = $GLOBALS['gEnv']['hui']['theme']['default']; } unset($mod_cfg); } $GLOBALS['gEnv']['user']['theme'] = $GLOBALS['gEnv']['site']['theme']; } $GLOBALS['gEnv']['hui']['theme']['name'] = $GLOBALS['gEnv']['user']['theme']; // User country // $tmpquery = $GLOBALS['gEnv']['site']['db']->Execute('SELECT val FROM sitesettings WHERE keyname=' . $GLOBALS['gEnv']['site']['db']->Format_Text($GLOBALS['gEnv']['user']['id'] . '-country')); $GLOBALS['gEnv']['user']['locale']['country'] = $env[$GLOBALS['gEnv']['user']['id'] . '-country'] = strlen($tmpquery->Fields('val')) ? $tmpquery->Fields('val') : $GLOBALS['gEnv']['site']['locale']['country']; $env['currentuser-country'] = $GLOBALS['gEnv']['user']['locale']['country']; // User language // $tmpquery = $GLOBALS['gEnv']['site']['db']->Execute('SELECT val FROM sitesettings WHERE keyname=' . $GLOBALS['gEnv']['site']['db']->Format_Text($GLOBALS['gEnv']['user']['id'] . '-language')); $GLOBALS['gEnv']['user']['locale']['language'] = $env[$GLOBALS['gEnv']['user']['id'] . '-language'] = strlen($tmpquery->Fields('val')) ? $tmpquery->Fields('val') : $GLOBALS['gEnv']['site']['locale']['language']; $env['currentuser-language'] = $GLOBALS['gEnv']['user']['locale']['language']; $env['sitelocale'] = $GLOBALS['gEnv']['user']['locale']['language']; // Old one $tmpquery = $GLOBALS['gEnv']['root']['db']->Execute('SELECT id,fname,lname,email,groupid FROM users WHERE username='******'gEnv']['root']['db']->Format_Text($GLOBALS['gEnv']['user']['id'])); // User datas // $GLOBALS['gEnv']['user']['group'] = $tmpquery->Fields('groupid'); $GLOBALS['gEnv']['user']['serial'] = $tmpquery->Fields('id'); $GLOBALS['gEnv']['user']['data']['lname'] = $tmpquery->Fields('lname'); $GLOBALS['gEnv']['user']['data']['fname'] = $tmpquery->Fields('fname'); $GLOBALS['gEnv']['user']['data']['email'] = $tmpquery->Fields('email'); $env['currentusercname'] = $tmpquery->Fields('fname') . ' ' . $tmpquery->Fields('lname'); $env['currentgroupserial'] = $GLOBALS['gEnv']['user']['group']; $env['currentuserserial'] = $GLOBALS['gEnv']['user']['serial']; $tmpquery->Free(); $result = true; } $GLOBALS['gEnv']['runtime']['site']['init'] = true; return $result; }
$gHui->LoadWidget('radio'); $gHui->LoadWidget('sessionkey'); $gHui->LoadWidget('statusbar'); $gHui->LoadWidget('string'); $gHui->LoadWidget('submit'); $gHui->LoadWidget('tab'); $gHui->LoadWidget('table'); $gHui->LoadWidget('text'); $gHui->LoadWidget('titlebar'); $gHui->LoadWidget('toolbar'); $gHui->LoadWidget('treemenu'); $gHui->LoadWidget('vertframe'); $gHui->LoadWidget('vertgroup'); $gHui->LoadWidget('xml'); $gPage_content = $gPage_status = ''; $gPage_title = $gLocale->GetStr('advanced.title'); $gToolbars_array['main'] = array('main' => array('label' => $gLocale->GetStr('default.button'), 'themeimage' => 'configure', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'default', '')))), 'processes' => array('label' => $gLocale->GetStr('processes.button'), 'themeimage' => 'run', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'processes', ''))))); $gToolbars_array['help'] = array('help' => array('label' => $gLocale->GetStr('help.button'), 'themeimage' => 'help', 'horiz' => 'true', 'action' => build_events_call_string('', array(array('main', 'help', ''))))); $gState = ''; // Pass dispatcher // $gPass_disp = new HuiDispatcher('pass'); $gPass_disp->AddEvent('setadvanced', 'pass_setadvanced'); function pass_setadvanced($eventData) { global $gPage_status, $gLocale, $gEnv, $gState; $amp_state = ''; switch ($eventData['ampstate']) { case Ampoliros::STATE_DEBUG: $amp_state_str = 'DEBUG'; $amp_state = 'debug';
$hui->LoadWidget('page'); $hui->LoadWidget('progressbar'); $hui->LoadWidget('radio'); $hui->LoadWidget('sessionkey'); $hui->LoadWidget('statusbar'); $hui->LoadWidget('string'); $hui->LoadWidget('submit'); $hui->LoadWidget('tab'); $hui->LoadWidget('table'); $hui->LoadWidget('text'); $hui->LoadWidget('titlebar'); $hui->LoadWidget('toolbar'); $hui->LoadWidget('treemenu'); $hui->LoadWidget('vertframe'); $hui->LoadWidget('vertgroup'); $hui_page = new HuiPage('page', array('title' => $amp_locale->GetStr('password_title'))); $hui_mainvertgroup = new HuiVertGroup('mainvertgroup'); $hui_titlebar = new HuiTitleBar('titlebar', array('title' => $amp_locale->GetStr('password_title'), 'icon' => 'password')); $hui_mainvertgroup->AddChild($hui_titlebar); // Main tool bar // $hui_maintoolbar = new HuiToolBar('maintoolbar'); $home_action = new HuiEventsCall(); $home_action->AddEvent(new HuiEvent('main', 'default', '')); $hui_homebutton = new HuiButton('homebutton', array('label' => $amp_locale->GetStr('chpasswd_button'), 'themeimage' => 'edit', 'horiz' => 'true', 'action' => $home_action->GetEventsCallString())); $hui_maintoolbar->AddChild($hui_homebutton); // Help tool bar // $hui_helptoolbar = new HuiToolBar('helpbar'); $main_disp = new HuiDispatcher('main'); $event_name = $main_disp->GetEventName();
function SendReport($maintenanceResult) { $result = false; $cfg = new ConfigFile(AMP_CONFIG); $email = $cfg->Value('MAINTENANCE_REPORTS_EMAIL'); if ($cfg->Value('MAINTENANCE_REPORTS_ENABLED') == '1' and strlen($email) and is_array($maintenanceResult)) { $result_text = ''; Carthag::import('com.solarix.ampoliros.locale.Locale'); $locale = new Locale('amp_root_maintenance', $GLOBALS['gEnv']['root']['locale']['language']); $tasks_list = $this->GetTasksList(); foreach ($maintenanceResult as $task => $result) { $result_text .= "\n" . '--> ' . $tasks_list[$task]['description'] . "\n" . ($result ? $locale->GetStr('report_task_ok.label') : $locale->GetStr('report_task_failed.label')) . "\n"; } $result = mail($email, '[AMPOLIROS MAINTENANCE REPORT] - Scheduled maintenance report about ' . AMP_NAME . '.' . AMP_DOMAIN, 'This is the scheduled maintenance report about ' . AMP_NAME . '.' . AMP_DOMAIN . "\n\n" . '== MAINTENANCE RESULTS ==' . "\n" . $result_text); } return $result; }
function main_editprofile($eventData) { global $env, $amp_locale, $hui_mainframe, $hui_titlebar; $prof_query =& $env['db']->execute('SELECT * ' . 'FROM groups ' . 'WHERE id=' . $eventData['profileid']); $prof_data = $prof_query->Fields(); $groups_query =& $env['db']->Execute('SELECT * ' . 'FROM admingroups ' . 'ORDER BY name'); if ($groups_query->NumRows()) { $perm = new Permissions($env['db'], $eventData['profileid']); $row = 0; $headers[0]['label'] = ''; $headers[1]['label'] = $amp_locale->GetStr('admingroup_header'); $headers[2]['label'] = ''; $headers[3]['label'] = $amp_locale->GetStr('adminpage_header'); $hui_groups_table = new HuiTable('groupsstable', array('headers' => $headers)); while (!$groups_query->eof) { $group_data = $groups_query->Fields(); $temp_locale = new Locale($group_data['catalog'], $env['sitelocale']); $node_state = $perm->Check($group_data['id'], PERMISSIONS_NODETYPE_GROUP); switch ($node_state) { case PERMISSIONS_NODE_FULLYENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['greenball']; $enabled = true; break; case PERMISSIONS_NODE_PARTIALLYENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['goldball']; $enabled = true; break; case PERMISSIONS_NODE_NOTENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['redball']; $enabled = false; break; } $hui_groups_table->AddChild(new HuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 0); $hui_groups_table->AddChild(new HuiLabel('grouplabel' . $row, array('label' => $temp_locale->GetStr($group_data['name']))), $row, 1); $hui_group_toolbar[$row] = new HuiToolBar('grouptoolbar' . $row); if ($enabled) { $disable_action[$row] = new HuiEventsCall(); $disable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $disable_action[$row]->AddEvent(new HuiEvent('pass', 'disablenode', array('ntype' => PERMISSIONS_NODETYPE_GROUP, 'node' => $group_data['id'], 'gid' => $eventData['profileid']))); $hui_disable_button[$row] = new HuiButton('disablebutton' . $row, array(label => $amp_locale->GetStr('disablenode_label'), 'themeimage' => 'lock', 'action' => $disable_action[$row]->GetEventsCallString())); $hui_group_toolbar[$row]->AddChild($hui_disable_button[$row]); } if (!$enabled or $node_state == PERMISSIONS_NODE_PARTIALLYENABLED) { $enable_action[$row] = new HuiEventsCall(); $enable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $enable_action[$row]->AddEvent(new HuiEvent('pass', 'enablenode', array('ntype' => PERMISSIONS_NODETYPE_GROUP, 'node' => $group_data['id'], 'gid' => $eventData['profileid']))); $hui_enable_button[$row] = new HuiButton('enablebutton' . $row, array(label => $amp_locale->GetStr('enablenode_label'), 'themeimage' => 'unlock', 'action' => $enable_action[$row]->GetEventsCallString())); $hui_group_toolbar[$row]->AddChild($hui_enable_button[$row]); } $hui_groups_table->AddChild($hui_group_toolbar[$row], $row, 4); $row++; $pages_query = $env['db']->Execute('SELECT * ' . 'FROM adminpages ' . 'WHERE groupid=' . $group_data['id'] . ' ' . 'ORDER BY name'); while (!$pages_query->eof) { $page_data = $pages_query->Fields(); $temp_locale = new Locale($page_data['catalog'], $env['sitelocale']); $node_state = $perm->Check($page_data['id'], 'page'); switch ($node_state) { case PERMISSIONS_NODE_FULLYENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['greenball']; $enabled = true; break; case PERMISSIONS_NODE_NOTENABLED: $icon = $hui_mainframe->mThemeHandler->mStyle['redball']; $enabled = false; break; } $hui_groups_table->AddChild(new HuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 2); $hui_groups_table->AddChild(new HuiLabel('methodlabel' . $row, array('label' => $temp_locale->GetStr($page_data['name']))), $row, 3); $hui_page_toolbar[$row] = new HuiToolBar('pagetoolbar' . $row); if ($enabled) { $disable_action[$row] = new HuiEventsCall(); $disable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $disable_action[$row]->AddEvent(new HuiEvent('pass', 'disablenode', array('ntype' => PERMISSIONS_NODETYPE_PAGE, 'node' => $page_data['id'], 'gid' => $eventData['profileid']))); $hui_disable_button[$row] = new HuiButton('disablebutton' . $row, array(label => $amp_locale->GetStr('disablenode_label'), 'themeimage' => 'lock', 'action' => $disable_action[$row]->GetEventsCallString())); $hui_page_toolbar[$row]->AddChild($hui_disable_button[$row]); } else { $enable_action[$row] = new HuiEventsCall(); $enable_action[$row]->AddEvent(new HuiEvent('main', 'editprofile', array('profileid' => $eventData['profileid']))); $enable_action[$row]->AddEvent(new HuiEvent('pass', 'enablenode', array('ntype' => PERMISSIONS_NODETYPE_PAGE, 'node' => $page_data['id'], 'gid' => $eventData['profileid']))); $hui_enable_button[$row] = new HuiButton('enablebutton' . $row, array(label => $amp_locale->GetStr('enablenode_label'), 'themeimage' => 'unlock', 'action' => $enable_action[$row]->GetEventsCallString())); $hui_page_toolbar[$row]->AddChild($hui_enable_button[$row]); } $hui_groups_table->AddChild($hui_page_toolbar[$row], $row, 4); $row++; $pages_query->MoveNext(); } $groups_query->MoveNext(); } $hui_mainframe->AddChild($hui_groups_table); } $hui_titlebar->mTitle .= ' - ' . $prof_data['groupname'] . ' - ' . $amp_locale->GetStr('editprofile_title'); }
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(); }
// Initialization // require 'auth.php'; OpenLibrary('configman.library'); OpenLibrary('locale.library'); OpenLibrary('hui.library'); OpenLibrary('ampshared.library'); OpenLibrary('jpcache.library'); $gEnv['runtime']['modules']['jpcache']['cacheon'] = 0; $gLocale = new Locale('jpcache_root_jpcache', $gEnv['root']['locale']['language']); $gHui = new Hui($gEnv['root']['db']); $gHui->LoadWidget('amppage'); $gHui->LoadWidget('amptoolbar'); $gHui->LoadWidget('xml'); $gPage_content = $gStatus = $gToolbars = ''; $gTitle = $gLocale->GetStr('jpcache.title'); $gMenu = get_ampoliros_root_menu_def($gEnv['root']['locale']['language']); $gToolbars['main'] = array('main' => array('label' => $gLocale->GetStr('default.button'), 'themeimage' => 'configure', 'action' => build_events_call_string('', array(array('main', 'default', '')))), 'stats' => array('label' => $gLocale->GetStr('stats.button'), 'themeimage' => 'folder', 'action' => build_events_call_string('', array(array('main', 'stats', '')))), 'erase' => array('label' => $gLocale->GetStr('erasecache.button'), 'themeimage' => 'edittrash', 'action' => build_events_call_string('', array(array('main', 'default', ''), array('action', 'erasecache', ''))), 'needconfirm' => 'true', 'confirmmessage' => $gLocale->GetStr('erase.confirm'))); /* $gToolbars['help'] = array( 'help' => array( 'label' => $gLocale->GetStr( 'help.button' ), 'themeimage' => 'help', 'action' => build_events_call_string( '', array( array( 'main', 'help', '' ) ) ) ) ); */ // Action dispatcher // $gAction_disp = new HuiDispatcher('action'); $gAction_disp->AddEvent('setprefs', 'action_setprefs'); function action_setprefs($eventData) {
<?php require 'auth.php'; OpenLibrary('hui.library'); OpenLibrary('modules.library'); OpenLibrary('locale.library'); $gYaps_locale = new Locale('yaps', AMP_LANG); $gHui = new Hui($env['ampdb']); $gHui->LoadWidget('amppage'); $gHui->LoadWidget('amptoolbar'); $gHui->LoadWidget('xml'); $gHui->LoadWidget('empty'); $gPage_content = $gStatus = $gMenu = $gToolbars = ''; $gTitle = $gYaps_locale->GetStr('yaps_title'); $action_disp = new HuiDispatcher('action'); $action_disp->AddEvent('setsettings', 'action_setsettings'); function action_setsettings($eventData) { global $env, $gStatus, $gYaps_locale; $mod_settings = new ModuleConfig($env['ampdb'], 'yaps'); $mod_settings->SetKey('gs_exec', $eventData['gsexec']); $gStatus = $gYaps_locale->GetStr('settingsset_status'); } $action_disp->Dispatch(); $main_disp = new HuiDispatcher('main'); $main_disp->AddEvent('default', 'main_default'); function main_default($eventData) { global $env, $gYaps_locale, $gTitle, $gPage_content; $mod_settings = new ModuleConfig($env['ampdb'], 'yaps'); $gs_exec = $mod_settings->GetKey('gs_exec');