Пример #1
0
function main_page($redrawFrames = FALSE)
{
    Carthag::import('com.solarix.ampoliros.hui.Hui');
    global $gEnv;
    if (!$redrawFrames and is_object($gEnv['root']['db']) and !defined('AMPOLIROS_SETUP_PHASE')) {
        import('com.solarix.ampoliros.module.ModuleConfig');
        $mod_cfg = new ModuleConfig($gEnv['root']['db'], 'ampoliros');
        $amp_logo_disabled = $mod_cfg->GetKey('ampoliros-biglogo-disabled');
    } else {
        $amp_logo_disabled = 0;
    }
    $hui = new Hui($gEnv['root']['db'], true);
    $hui->LoadWidget('page');
    $hui->LoadWidget('vertgroup');
    $hui->LoadWidget('button');
    $page_params['title'] = 'Ampoliros';
    $page_params['border'] = 'false';
    if ($redrawFrames) {
        $page_params['javascript'] = "parent.frames.sum.location.reload()\nparent.frames.header.location.reload()";
    }
    $hui_page = new HuiPage('page', $page_params);
    $hui_vertgroup = new HuiVertGroup('vertgroup', array('align' => 'center', 'groupalign' => 'center', 'groupvalign' => 'middle', 'height' => '100%'));
    $hui_buttons_group = new HuiVertGroup('buttons_group', array('align' => 'center', 'groupalign' => 'center', 'groupvalign' => 'middle', 'height' => '0%'));
    if ($amp_logo_disabled != '1') {
        if ($gEnv['core']['edition'] == AMP_EDITION_ASP) {
            $edition = '_asp';
        } else {
            $edition = '_enterprise';
        }
        if (isset($hui_page->mThemeHandler->mStyle['bigdot' . $edition])) {
            $bigdot_image = $hui_page->mThemeHandler->mStyle['bigdot' . $edition];
        } else {
            $bigdot_image = $hui_page->mThemeHandler->mStyle['bigdot'];
        }
        $hui_button = new HuiButton('button', array('action' => 'http://www.ampoliros.com', 'target' => '_top', 'image' => $bigdot_image, 'highlight' => 'false'));
        $hui_buttons_group->AddChild($hui_button);
    }
    if (!$redrawFrames and is_object($gEnv['root']['db']) and !defined('AMPOLIROS_SETUP_PHASE')) {
        // OEM personalization
        //
        $oem_biglogo_filename = $mod_cfg->GetKey('oem-biglogo-filename');
        $oem_url = $mod_cfg->GetKey('oem-url');
        if ($mod_cfg->GetKey('oem-biglogo-disabled') != '1') {
            if (strlen($oem_biglogo_filename) and file_exists(CGI_PATH . $oem_biglogo_filename)) {
                $oem_button = new HuiButton('oembutton', array('action' => strlen($oem_url) ? $oem_url : 'http://www.ampoliros.com', 'target' => '_top', 'image' => CGI_URL . $oem_biglogo_filename, 'highlight' => 'false'));
                $hui_buttons_group->AddChild($oem_button);
            }
        }
    }
    $hui_vertgroup->AddChild($hui_buttons_group);
    $hui_page->AddChild($hui_vertgroup);
    $hui->AddChild($hui_page);
    $hui->Render();
}
Пример #2
0
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// $Id: profiles.php,v 1.23 2004-07-08 15:04:25 alex Exp $
require './auth.php';
Carthag::import('com.solarix.ampoliros.io.log.Logger');
Carthag::import('com.solarix.ampoliros.locale.Locale');
OpenLibrary('hui.library');
OpenLibrary('users.library');
$log = new Logger(AMP_LOG);
$amp_locale = new Locale('amp_site_profiles', $gEnv['user']['locale']['language']);
$hui = new Hui($env['ampdb']);
$hui->LoadWidget('button');
$hui->LoadWidget('checkbox');
$hui->LoadWidget('combobox');
$hui->LoadWidget('date');
$hui->LoadWidget('empty');
$hui->LoadWidget('file');
$hui->LoadWidget('formarg');
$hui->LoadWidget('form');
$hui->LoadWidget('grid');
$hui->LoadWidget('helpnode');
Пример #3
0
 public function removeGroup($deleteuserstoo)
 {
     $result = false;
     import('com.solarix.ampoliros.util.Hook');
     $hook = new Hook($this->mrAmpDb, 'ampoliros', 'site.group.remove');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $this->siteserial, 'groupid' => $this->groupid)) == HOOK_RESULT_OK) {
         if ($this->groupid != 0) {
             if ($this->mrSiteDb->Execute('DELETE FROM groups ' . 'WHERE id=' . (int) $this->groupid)) {
                 // Check if we must delete users in this group
                 if ($deleteuserstoo == true) {
                     $usersquery =& $this->mrAmpDb->Execute('SELECT id ' . 'FROM users ' . 'WHERE siteid=' . (int) $this->siteserial . ' AND groupid=' . (int) $this->groupid);
                     $numusers = $usersquery->NumRows();
                     if ($numusers > 0) {
                         // Remove users in this group
                         while (!$usersquery->eof) {
                             $usdata = $usersquery->Fields();
                             Carthag::import('com.solarix.ampoliros.site.user.User');
                             $tmpuser = new user($this->mrAmpDb, $this->siteserial, $usdata['id']);
                             $tmpuser->removeuser();
                             $usersquery->MoveNext();
                             //delete $tmpuser;
                         }
                     }
                 } else {
                     $this->mrAmpDb->Execute("UPDATE users SET groupid = '0' WHERE groupid=" . (int) $this->groupid . ' AND siteid =' . $this->siteserial);
                 }
                 if ($hook->CallHooks('groupremoved', $this, array('siteserial' => $this->siteserial, 'groupid' => $this->groupid)) != HOOK_RESULT_OK) {
                     $result = false;
                 }
                 $this->groupid = 0;
             }
         } else {
             import('com.solarix.ampoliros.io.log.Logger');
             $log = new Logger(AMP_LOG);
             $log->LogEvent('ampoliros.users_library.group_class.removegroup', "Attempted to call a member of an object that doesn't refer to any group", LOGGER_ERROR);
         }
     }
     return $result;
 }
Пример #4
0
 *
 */
// $Id: unlock.php,v 1.16 2004-07-08 15:04:26 alex Exp $
define('AMPOLIROS_OVERRIDE_LOCK', TRUE);
require 'amproot.php';
require AMP_PATH . 'auth.php';
$amp = Ampoliros::instance('Ampoliros');
$amp->setInterface(Ampoliros::INTERFACE_WEB);
// Erase all semaphores
if ($handle = opendir(TMP_PATH . 'semaphores')) {
    while (($file = readdir($handle)) !== false) {
        if ($file != '.' and $file != '..') {
            @unlink(TMP_PATH . 'semaphores/' . $file);
        }
    }
    closedir($handle);
}
// Erase system upgrading lock if it exists
if (file_exists(AMP_UPGRADINGSYSTEM_LOCK)) {
    if (@unlink(AMP_UPGRADINGSYSTEM_LOCK)) {
        Carthag::import('com.solarix.ampoliros.io.log.Logger');
        $tmp_log = new Logger($gEnv['root']['log']);
        $tmp_log->LogEvent('Ampoliros', 'Ampoliros has been unlocked.', LOGGER_NOTICE);
        $message = 'System unlocked.';
    } else {
        $message = 'Unable to unlock system.';
    }
} else {
    $message = 'System was not locked.';
}
$amp->abort($message);
Пример #5
0
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// $Id: xmlrpc.php,v 1.27 2004-07-08 15:04:25 alex Exp $
require './auth.php';
Carthag::import('com.solarix.ampoliros.io.log.Logger');
Carthag::import('com.solarix.ampoliros.locale.Locale');
Carthag::import('com.solarix.ampoliros.hui.Hui');
Carthag::import('com.solarix.ampoliros.webservices.xmlrpc.XmlRpcAccount');
Carthag::import('com.solarix.ampoliros.webservices.xmlrpc.XmlRpcProfile');
Carthag::import('com.solarix.ampoliros.webservices.xmlrpc.XmlRpcUser');
Carthag::import('com.solarix.ampoliros.webservices.xmlrpc.XmlRpc_Client');
OpenLibrary('ampshared.library');
$log = new Logger(AMP_LOG);
$amp_locale = new Locale('amp_root_xmlrpc', $gEnv['root']['locale']['language']);
$hui = new Hui($env['ampdb']);
$hui->LoadWidget('button');
$hui->LoadWidget('checkbox');
$hui->LoadWidget('combobox');
$hui->LoadWidget('date');
$hui->LoadWidget('empty');
$hui->LoadWidget('file');
$hui->LoadWidget('formarg');
$hui->LoadWidget('form');
$hui->LoadWidget('grid');
$hui->LoadWidget('helpnode');
$hui->LoadWidget('horizbar');
Пример #6
0
 public function removeUser()
 {
     import('com.solarix.ampoliros.util.Hook');
     $hook = new Hook($this->mrAmpDb, 'ampoliros', 'site.user.remove');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $this->siteserial, 'userid' => $this->userid)) == HOOK_RESULT_OK) {
         if ($this->userid != 0) {
             $result = $this->mrAmpDb->Execute('DELETE FROM users ' . 'WHERE siteid=' . (int) $this->siteserial . ' ' . 'AND id=' . (int) $this->userid);
             // Remove user dir
             $site_query =& $GLOBALS['gEnv']['root']['db']->Execute('SELECT siteid ' . 'FROM sites ' . 'WHERE id=' . (int) $this->siteserial);
             OpenLibrary('misc.library');
             if (SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/' . $this->username != SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/') {
                 RecRemoveDir(SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/' . $this->username, 0755);
             }
             // Remove cached items
             Carthag::import('com.solarix.ampoliros.datatransfer.cache.CacheGarbageCollector');
             $cache_gc = new CacheGarbageCollector();
             $cache_gc->RemoveUserItems((int) $this->userid);
             //$this->htp->remuser( $this->username );
             if ($hook->CallHooks('userremoved', $this, array('siteserial' => $this->siteserial, 'userid' => $this->userid)) != HOOK_RESULT_OK) {
                 $result = false;
             }
             $this->userid = 0;
         }
     }
     return $result;
 }
Пример #7
0
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// $Id: sites.php,v 1.39 2004-07-08 15:04:25 alex Exp $
require './auth.php';
Carthag::import('com.solarix.ampoliros.io.log.Logger');
Carthag::import('com.solarix.ampoliros.locale.Locale');
Carthag::import('com.solarix.ampoliros.hui.Hui');
Carthag::import('com.solarix.ampoliros.site.Site');
OpenLibrary('configman.library');
OpenLibrary('modules.library');
OpenLibrary('users.library');
OpenLibrary('ampshared.library');
$log = new Logger(AMP_LOG);
$amp_locale = new Locale('amp_root_sites', $gEnv['root']['locale']['language']);
$hui = new Hui($env['ampdb']);
$hui->LoadWidget('amptoolbar');
$hui->LoadWidget('button');
$hui->LoadWidget('checkbox');
$hui->LoadWidget('combobox');
$hui->LoadWidget('date');
$hui->LoadWidget('empty');
$hui->LoadWidget('file');
$hui->LoadWidget('formarg');
Пример #8
0
 function Disable($siteid)
 {
     $result = FALSE;
     import('com.solarix.ampoliros.util.Hook');
     $hook = new Hook($this->ampdb, 'ampoliros', 'module.disable');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $siteid, 'modserial' => $this->serial)) == HOOK_RESULT_OK) {
         if ($this->serial) {
             // Checks if the module exists in modules table
             //
             $modquery =& $this->ampdb->Execute('SELECT * FROM modules WHERE id=' . (int) $this->serial);
             if ($modquery->NumRows() == 1) {
                 $moddata = $modquery->Fields();
                 if ($moddata['onlyextension'] != $this->ampdb->fmttrue) {
                     // Checks if the structure file still exists
                     //
                     if (file_exists(MODULE_PATH . $moddata['modid'] . '/' . Module::STRUCTURE_FILE)) {
                         $this->modname = $moddata['modid'];
                         $sitequery = $this->ampdb->Execute('SELECT * FROM sites WHERE id=' . $this->ampdb->Format_Text((int) $siteid));
                         $sitedata = $sitequery->Fields();
                         $args['dbtype'] = $sitedata['sitedbtype'];
                         $args['dbname'] = $sitedata['sitedbname'];
                         $args['dbhost'] = $sitedata['sitedbhost'];
                         $args['dbport'] = $sitedata['sitedbport'];
                         $args['dbuser'] = $sitedata['sitedbuser'];
                         $args['dbpass'] = $sitedata['sitedbpassword'];
                         $args['dblog'] = $sitedata['sitedblog'];
                         import('com.solarix.ampoliros.db.DBLayerFactory');
                         $db_fact = new DBLayerFactory();
                         $this->sitedb = $db_fact->NewDBLayer($args);
                         $this->sitedb->Connect($args);
                         // Dependencies check
                         //
                         $this->unmetdeps = array();
                         $this->unmetsuggs = array();
                         $moddeps = new ModuleDep($this->ampdb);
                         $pendingdeps = $moddeps->CheckSiteDependingModules($this->modname, $sitedata['siteid'], FALSE);
                         $modenabled = $moddeps->IsEnabled($this->modname, $sitedata['siteid']);
                         // If dependencies are ok, go on
                         //
                         if ($pendingdeps == FALSE and $modenabled == TRUE) {
                             $result = $this->HandleStructure(MODULE_PATH . $moddata['modid'] . '/' . Module::STRUCTURE_FILE, Module::INSTALL_MODE_DISABLE, MODULE_PATH . $moddata['modid'] . '/', $siteid);
                             $modquery = $this->ampdb->Execute('SELECT id FROM modules WHERE modid=' . $this->ampdb->Format_Text($this->modname));
                             $this->ampdb->Execute('DELETE FROM activemodules WHERE moduleid=' . (int) $this->serial . ' AND siteid=' . $this->ampdb->Format_Text($siteid));
                             $this->ampdb->Execute('DELETE FROM disabledsubmodules WHERE moduleid=' . (int) $this->serial . ' AND siteid=' . (int) $siteid);
                             if ($GLOBALS['gEnv']['core']['config']->Value('ALERT_ON_MODULE_SITE_OPERATION') == '1') {
                                 Carthag::import('com.solarix.ampoliros.security.SecurityLayer');
                                 $amp_security = new SecurityLayer();
                                 $amp_security->SendAlert('Module ' . $moddata['modid'] . ' has been disabled from site ' . $sitedata['siteid']);
                                 unset($amp_security);
                             }
                             if ($hook->CallHooks('moduledisabled', $this, array('siteserial' => $siteid, 'modserial' => $this->serial)) != HOOK_RESULT_OK) {
                                 $result = false;
                             }
                         } else {
                             if ($modenabled == FALSE) {
                             } else {
                                 $this->unmetdeps = $pendingdeps;
                             }
                         }
                         //if ( $result == TRUE ) $this->mLog->LogEvent( 'Ampoliros', 'Uninstalled module '.$this->modname, LOGGER_NOTICE );
                         $sitequery->Free();
                     } else {
                         import('com.solarix.ampoliros.io.log.Logger');
                         $log = new Logger(AMP_LOG);
                         $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'Structure file ' . MODULE_PATH . $moddata['modid'] . '/' . Module::STRUCTURE_FILE . ' for module ' . $moddata['modid'] . ' was not found', LOGGER_ERROR);
                     }
                 } else {
                     import('com.solarix.ampoliros.io.log.Logger');
                     $log = new Logger(AMP_LOG);
                     $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'Tried to disable module ' . $moddata['modid'] . ', but it is an extension only module', LOGGER_ERROR);
                 }
             } else {
                 import('com.solarix.ampoliros.io.log.Logger');
                 $log = new Logger(AMP_LOG);
                 $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'A module with serial ' . $this->serial . ' was not found in modules table', LOGGER_ERROR);
             }
             $modquery->Free();
         } else {
             import('com.solarix.ampoliros.io.log.Logger');
             $log = new Logger(AMP_LOG);
             $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'Empty module serial', LOGGER_ERROR);
         }
     }
     return $result;
 }
Пример #9
0
 function login_logout($eventData)
 {
     Carthag::import('com.solarix.ampoliros.security.SecurityLayer');
     $amp_security = new SecurityLayer();
     $amp_security->LogAccess($_SESSION['AMP_AUTH_USER'], true, false, $_SERVER['REMOTE_ADDR']);
     session_unregister('AMP_AUTH_USER');
     unset($_SESSION['AMP_AUTH_USER']);
     unset($amp_security);
     DoAuth();
 }
 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;
 }
Пример #11
0
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// $Id: network.php,v 1.20 2004-07-08 15:04:25 alex Exp $
require './auth.php';
Carthag::import('com.solarix.ampoliros.io.log.Logger');
Carthag::import('com.solarix.ampoliros.locale.Locale');
Carthag::import('com.solarix.ampoliros.hui.Hui');
OpenLibrary('misc.library');
OpenLibrary('ampshared.library');
$log = new logger(AMP_LOG);
$amp_locale = new locale("amp_root_network", $gEnv['root']['locale']['language']);
// Initialization
//
$hui = new Hui($env['ampdb']);
$hui->LoadWidget('button');
$hui->LoadWidget('checkbox');
$hui->LoadWidget('combobox');
$hui->LoadWidget('date');
$hui->LoadWidget('empty');
$hui->LoadWidget('file');
$hui->LoadWidget('formarg');
$hui->LoadWidget('form');
Пример #12
0
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
// $Id: maintenance.php,v 1.19 2004-07-08 15:04:24 alex Exp $
// ----- 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)
{
Пример #13
0
 function DoAuth($wrong = false, $reason = '')
 {
     global $gEnv;
     $amp_locale = new Locale('amp_misc_auth', $gEnv['root']['locale']['language']);
     $amp = Ampoliros::instance('Ampoliros');
     $amp->startRoot();
     $hui = new Hui($gEnv['root']['db']);
     $hui->LoadWidget('button');
     $hui->LoadWidget('empty');
     $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('amprootlogin'), '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('amprootlogin'), '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_ROOT_LOGIN') == '1') {
             Carthag::import('com.solarix.ampoliros.security.SecurityLayer');
             $amp_security = new SecurityLayer();
             $amp_security->SendAlert('Wrong root local login from remote address ' . $_SERVER['REMOTE_ADDR']);
             $amp_security->LogFailedAccess('', true, $_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['root_login_attempts'])) {
             $_SESSION['root_login_attempts']++;
             if ($_SESSION['root_login_attempts'] >= $max_attempts) {
                 AmpDie($amp_locale->GetStr('wrongpwd'));
             }
         } else {
             $_SESSION['root_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();
 }
Пример #14
0
 public function logFailedAccess($user = '', $root = false, $ip = '')
 {
     Carthag::import('com.solarix.ampoliros.io.log.Logger');
     $log = new Logger($this->mAccessLog);
     $log->LogEvent('ampoliros', 'Wrong access from ' . ($root ? 'root ' : 'user ' . $user . ' ') . (strlen($ip) ? 'from address ' . $ip : ''), LOGGER_NOTICE);
     return true;
 }
Пример #15
0
 public function remove()
 {
     $result = false;
     $hook = new Hook($this->ampdb, 'ampoliros', 'site.remove');
     if ($hook->CallHooks('calltime', $this, '') == HOOK_RESULT_OK) {
         $query = $this->ampdb->Execute('SELECT * ' . 'FROM sites ' . 'WHERE id=' . (int) $this->siteserial);
         $data = $query->Fields();
         // Disables all modules
         //
         $this->DisableAllModules($this->siteserial);
         $args['dbname'] = $data['sitedbname'];
         $args['dbhost'] = $data['sitedbhost'];
         $args['dbport'] = $data['sitedbport'];
         $args['dbuser'] = $data['sitedbuser'];
         $args['dbpass'] = $data['sitedbpass'];
         $args['dbtype'] = $data['sitedbtype'];
         $args['dblog'] = $data['sitedblog'];
         $this->sitedb->Close();
         $this->sitedb->DropDB($args);
         // Remove cached items
         //
         Carthag::import('com.solarix.ampoliros.datatransfer.cache.CacheGarbageCollector');
         $cache_gc = new CacheGarbageCollector();
         $cache_gc->RemoveSiteItems((int) $data['id']);
         // Removes site users
         //
         $this->RemoveAllUsers();
         // Removes site from amp database
         //
         $this->ampdb->Execute('DELETE FROM sites ' . 'WHERE id=' . (int) $data['id']);
         $this->ampdb->Execute('DELETE FROM disabledsubmodules ' . 'WHERE siteid=' . $this->siteserial);
         import('com.solarix.ampoliros.io.log.Logger');
         $log = new Logger(AMP_LOG);
         $log->LogEvent($data['siteid'], 'Removed site ' . $data['siteid'], LOGGER_NOTICE);
         if (!empty($data['siteid'])) {
             RecRemoveDir(SITESTUFF_PATH . $data['siteid']);
         }
         if ($hook->CallHooks('siteremoved', $this, '') == HOOK_RESULT_OK) {
             $result = true;
         }
         global $gEnv;
         if ($gEnv['core']['config']->Value('ALERT_ON_SITE_OPERATION') == '1') {
             Carthag::import('com.solarix.ampoliros.security.SecurityLayer');
             $amp_security = new SecurityLayer();
             $amp_security->SendAlert('Site ' . $data['siteid'] . ' has been removed');
             unset($amp_security);
         }
     }
     return $result;
 }