$jp_cfg->SetValue('CACHE_ON', $eventData['cacheon'] == 'on' ? '1' : '0'); $jp_cfg->SetValue('USE_GZIP', $eventData['usegzip'] == 'on' ? '1' : '0'); $jp_cfg->SetValue('CACHE_POST', $eventData['cachepost'] == 'on' ? '1' : '0'); $gStatus = $gLocale->GetStr('prefs_set.status'); } $gAction_disp->AddEvent('erasecache', 'action_erasecache'); function action_erasecache($eventData) { global $gEnv, $gStatus, $gLocale; cache_erase(); $gStatus = $gLocale->GetStr('cache_erased.status'); } $gAction_disp->Dispatch(); // Main dispatcher // $gMain_disp = new HuiDispatcher('main'); $gMain_disp->AddEvent('default', 'main_default'); function main_default($eventData) { global $gEnv, $gLocale, $gPage_content; $jp_cfg = new ConfigFile(CONFIG_PATH . 'jpcache.cfg', true); $xml_def = '<vertgroup><name>prefs</name><children> <form><name>prefs</name><args><method>post</method><action type="encoded">' . urlencode(build_events_call_string('', array(array('main', 'default', ''), array('action', 'setprefs', '')))) . '</action></args><children> <grid><name>prefs</name><children> <label row="0" col="0"><name>cachetime</name><args><label type="encoded">' . urlencode($gLocale->GetStr('cachetime.label')) . '</label></args></label> <string row="0" col="1"><name>cachetime</name><args><disp>action</disp><size>5</size><value>' . $jp_cfg->Value('CACHE_TIME') . '</value></args></string> <label row="1" col="0"><name>cacheon</name><args><label type="encoded">' . urlencode($gLocale->GetStr('cacheon.label')) . '</label></args></label> <checkbox row="1" col="1"><name>cacheon</name><args><disp>action</disp><checked>' . ($jp_cfg->Value('CACHE_ON') == '1' ? 'true' : 'false') . '</checked></args></checkbox> <label row="2" col="0"><name>usegzip</name><args><label type="encoded">' . urlencode($gLocale->GetStr('usegzip.label')) . '</label></args></label> <checkbox row="2" col="1"><name>usegzip</name><args><disp>action</disp><checked>' . ($jp_cfg->Value('USE_GZIP') == '1' ? 'true' : 'false') . '</checked></args></checkbox> <label row="3" col="0"><name>cachepost</name><args><label type="encoded">' . urlencode($gLocale->GetStr('cachepost.label')) . '</label></args></label>
$gPage_status = $gLocale->GetStr('access_log_erased.status'); } $gAction_disp->AddEvent('logout_sessions', 'action_logout_sessions'); function action_logout_sessions($eventData) { global $gLocale, $gPage_status; $amp_security = new SecurityLayer(); foreach ($eventData['sessions'] as $id => $session) { $amp_security->LogoutSession($session); } $gPage_status = $gLocale->GetStr('sessions_logged_out.status'); } $gAction_disp->Dispatch(); // ----- Main dispatcher ----- // $gMain_disp = new HuiDispatcher('main'); function default_tab_builder($tab) { return build_events_call_string('', array(array('main', 'default', array('tab' => $tab)))); } $gMain_disp->AddEvent('default', 'main_default'); function main_default($eventData) { global $gEnv, $gXml_def, $gLocale, $gPage_title; //$tabs[0]['label'] = $gLocale->GetStr( 'currentactivities.tab' ); $tabs[0]['label'] = $gLocale->GetStr('accesslog.tab'); $tabs[1]['label'] = $gLocale->GetStr('loggedusers.tab'); $tabs[2]['label'] = $gLocale->GetStr('securitycheck.tab'); $amp_security = new SecurityLayer(); $security_check = $amp_security->SecurityCheck(); $logged_users = $amp_security->GetLoggedSessions();
} if ($gEnv['site']['id'] == $gEnv['user']['id']) { $pass_disp->AddEvent('setmotd', 'pass_setmotd'); function pass_setmotd($eventData) { global $gEnv, $amp_locale, $hui_mainstatus; OpenLibrary('sites.library'); $site = new Site($gEnv['root']['db'], $gEnv['site']['id'], $gEnv['site']['db']); $site->SetMotd($eventData['motd']); $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('motd_set.status'); } } $pass_disp->Dispatch(); // Main dispatcher // $main_disp = new HuiDispatcher('main'); $main_disp->AddEvent('default', 'main_default'); function main_default($eventData) { global $env, $amp_locale, $hui_mainframe, $hui_titlebar; $prof_query =& $env['db']->Execute('SELECT * ' . 'FROM groups ' . 'ORDER BY groupname'); $profiles = array(); while (!$prof_query->eof) { $prof_data = $prof_query->Fields(); $profiles[$prof_data['id']] = $prof_data['groupname']; $prof_query->MoveNext(); } if (count($profiles)) { $headers[0]['label'] = $amp_locale->GetStr('profilename_header'); $row = 0; $hui_profiles_table = new HuiTable('profilestable', array('headers' => $headers));
function methods_list_action_builder($pageNumber) { $tmp_main_disp = new HuiDispatcher('main'); $event_data = $tmp_main_disp->GetEventData(); return build_events_call_string('', array(array('main', 'showmethods', array('methodspage' => $pageNumber, 'accountid' => $event_data['accountid'])))); }
$temp_user->ChPasswd($eventData['newpassworda']); $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('passwordchanged_status'); } else { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('wrongoldpassword_status'); } } else { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('newpasswordisempty_status'); } } else { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('newpasswordnomatch_status'); } } $pass_disp->Dispatch(); // Main dispatcher // $main_disp = new HuiDispatcher('main'); $main_disp->AddEvent('default', 'main_default'); function main_default($eventData) { global $hui_mainframe, $amp_locale, $hui_titlebar; $hui_grid = new HuiGrid('grid', array('rows' => '3', 'cols' => '2')); $hui_grid->AddChild(new HuiLabel('oldpasswordlabel', array('label' => $amp_locale->GetStr('amppasswordold_label'))), 0, 0); $hui_grid->AddChild(new HuiString('oldpassword', array('disp' => 'pass', 'password' => 'true')), 0, 1); $hui_grid->AddChild(new HuiLabel('newpasswordalabel', array('label' => $amp_locale->GetStr('amppassworda_label'))), 1, 0); $hui_grid->AddChild(new HuiString('newpassworda', array('disp' => 'pass', 'password' => 'true')), 1, 1); $hui_grid->AddChild(new HuiLabel('newpasswordblabel', array('label' => $amp_locale->GetStr('amppasswordb_label'))), 2, 0); $hui_grid->AddChild(new HuiString('newpasswordb', array('disp' => 'pass', 'password' => 'true')), 2, 1); $hui_vgroup = new HuiVertGroup('vertgroup', array('align' => 'center')); $hui_vgroup->AddChild($hui_grid); $hui_vgroup->AddChild(new HuiSubmit('submit', array('caption' => $amp_locale->GetStr('amppasschange_submit')))); $form_events_call = new HuiEventsCall();
$pass_disp->AddEvent('cleansitedblog', 'pass_cleansitedblog'); function pass_cleansitedblog($eventData) { global $env, $hui_mainstatus, $amp_locale; $query =& $env['ampdb']->execute('SELECT sitedblog ' . 'FROM sites ' . 'WHERE id=' . $eventData['siteid']); $temp_log = new Logger($query->Fields('sitedblog')); if ($temp_log->CleanLog()) { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('logcleaned_status'); } else { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('lognotcleaned_status'); } } $pass_disp->Dispatch(); // Main dispatcher // $main_disp = new HuiDispatcher('main'); function sites_list_action_builder($pageNumber) { return build_events_call_string('', array(array('main', 'default', array('sitespage' => $pageNumber)))); } $main_disp->AddEvent('default', 'main_default'); function main_default($eventData) { global $env, $hui_mainframe, $amp_locale, $pass_disp, $hui_mainstatus; $query =& $env['ampdb']->execute('SELECT * ' . 'FROM sites ' . 'ORDER BY sitename'); $modules_query =& $env['ampdb']->execute('SELECT id ' . 'FROM modules ' . 'WHERE onlyextension <> ' . $env['ampdb']->Format_Text($env['ampdb']->fmttrue)); if ($query->NumRows() > 0) { $headers[0]['label'] = $amp_locale->GetStr('status_header'); $headers[1]['label'] = $amp_locale->GetStr('siteid_header'); $headers[2]['label'] = $amp_locale->GetStr('sitename_header'); $headers[3]['label'] = $amp_locale->GetStr('sitecreationdate_header');
function versions_list_action_builder($pageNumber) { $tmp_main_disp = new HuiDispatcher('main'); $event_data = $tmp_main_disp->GetEventData(); return build_events_call_string('', array(array('main', 'moduleversions', array('pagenumber' => $eventData['pagenumber'], 'id' => $event_data['id'])))); }
function debugger_tab_action_builder($tab) { $tmp_main_disp = new HuiDispatcher('main'); $event_data = $tmp_main_disp->GetEventData(); return build_events_call_string('', array(array('main', 'debug', array('activetab' => $tab, 'pid' => $event_data['pid'])))); }
$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(); } if (isset($GLOBALS['gEnv']['runtime']['disp']['hui']['login'])) { $login_disp = new HuiDispatcher('login'); $login_disp->AddEvent('login', 'login_login'); function login_login($eventData) { $userquery = $GLOBALS['gEnv']['root']['db']->Execute('SELECT * FROM users WHERE username='******'gEnv']['root']['db']->Format_Text($eventData['username']) . ' AND password='******'gEnv']['root']['db']->Format_Text(md5($eventData['password']))); if ($userquery->NumRows()) { session_register('AMP_AUTH_USER'); $_SESSION['AMP_AUTH_USER'] = $eventData['username']; import('com.solarix.ampoliros.security.SecurityLayer'); $amp_security = new SecurityLayer(); $amp_security->LogAccess($eventData['username'], false, false, $_SERVER['REMOTE_ADDR']); unset($amp_security); } else { DoAuth(true); } // unset( $AMPROOT_AUTH_USER );
} } $gPage_status = $gLocale->GetStr('settings_set.status'); } $gAction_disp->AddEvent('run_maintenance', 'action_run_maintenance'); function action_run_maintenance($eventData) { global $gPage_status, $gLocale; require 'ampmaintenance.php'; $gEnv['core']['interface'] = AMP_INTERFACE_WEB; $gPage_status = $gLocale->GetStr('maintenance_done.status'); } $gAction_disp->Dispatch(); // ----- Main dispatcher ----- // $gMain_disp = new HuiDispatcher('main'); function general_tab_builder($tab) { return build_events_call_string('', array(array('main', 'default', array('tab' => $tab)))); } $gMain_disp->AddEvent('default', 'main_default'); function main_default($eventData) { global $gEnv, $gXml_def, $gLocale, $gPage_title; $main = new AmpolirosMaintenanceHandler(); $main_time = $main->GetLastMaintenanceTime(); $tasks = $main->GetTasksList(); $tabs[0]['label'] = $gLocale->GetStr('general_status.tab'); $tabs[1]['label'] = $gLocale->GetStr('general_report.tab'); $tabs[2]['label'] = $gLocale->GetStr('general_tasks.tab'); $country = new LocaleCountry($GLOBALS['gEnv']['root']['locale']['country']);
function modules_tab_action_builder($tab) { $main_disp = new HuiDispatcher('main'); $event_data = $main_disp->GetEventData(); return build_events_call_string('', array(array('main', 'repositorymodules', array('id' => $event_data['id'], 'repid' => $event_data['repid'], 'tab' => $tab)))); }
$hui->LoadWidget('submit'); $hui->LoadWidget('table'); $hui->LoadWidget('text'); $hui->LoadWidget('titlebar'); $hui->LoadWidget('vertframe'); $hui->LoadWidget('vertgroup'); $hui_page = new HuiPage('page', array('title' => $amp_locale->GetStr('ampsetup_title'), 'javascript' => "parent.frames.sum.location.reload()\nparent.frames.header.location.reload()")); $hui_mainvertgroup = new HuiVertGroup('mainvertgroup'); $hui_titlebar = new HuiTitleBar('titlebar', array('title' => $amp_locale->GetStr('ampsetup_title'), 'closewidget' => 'false', 'newwindowwidget' => 'false')); $hui_mainvertgroup->AddChild($hui_titlebar); $hui_mainframe1 = new HuiHorizFrame('mainframe'); $hui_mainframe = new HuiVertGroup('mainvertgroup2'); $hui_mainstatus = new HuiStatusBar('mainstatusbar'); // Pass dispatcher // $pass_disp = new HuiDispatcher('pass'); $pass_disp->AddEvent('checksystem', 'pass_checksystem'); function pass_checksystem($eventData) { global $hui_mainstatus, $amp_locale, $log; setup_checksystem($eventData, $log); } $pass_disp->AddEvent('installfiles', 'pass_installfiles'); function pass_installfiles($eventData) { setup_installfiles($eventData, $log); global $hui_mainstatus, $amp_locale, $log; } $pass_disp->AddEvent('setedition', 'pass_setedition'); function pass_setedition($eventData) {
} $pass_disp->AddEvent('cleanphplog', 'pass_cleanphplog'); function pass_cleanphplog($eventData) { global $env, $hui_mainstatus, $amp_locale; $temp_log = new Logger(PHP_LOG); if ($temp_log->CleanLog()) { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('logcleaned_status'); } else { $hui_mainstatus->mArgs['status'] = $amp_locale->GetStr('lognotcleaned_status'); } } $pass_disp->Dispatch(); // Main dispatcher // $main_disp = new HuiDispatcher('main'); $main_disp->AddEvent('sysinfo', 'main_sysinfo'); function main_sysinfo($eventData) { global $env, $hui_mainframe, $amp_locale, $pass_disp, $hui_mainstatus; /*$headers[0]['label'] = $amp_locale->GetStr( 'status_header' ); $headers[1]['label'] = $amp_locale->GetStr( 'moduleid_header' ); $headers[2]['label'] = $amp_locale->GetStr( 'modactivationdate_header' ); $headers[3]['label'] = $amp_locale->GetStr( 'moddeps_header' );*/ $hui_info_table = new HuiTable('sysinfotable', ''); // Required features // /ampcgi/ alias // $row = 0; if (@fopen(((isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://') . AMP_HOST . CGI_URL . 'clear.gif', 'r')) { $ball = $hui_mainframe->mThemeHandler->mStyle['greenball'];
function show_module_action_builder($pageNumber) { $tmp_main_disp = new HuiDispatcher('main'); $event_data = $tmp_main_disp->GetEventData(); return build_events_call_string('', array(array('main', 'showmodule', array('pagenumber' => $pageNumber, 'modid' => $event_data['modid'])))); }