/**
  * Parses Module registry from local file or from remote peer
  *
  * @param string $host the host from which the registry has to be loaded (if null regitry is loaded locally)
  * @param string $port the port on the remote host (if null regitry is loaded locally)
  * @since 5.1
  * @return void
  */
 public function parseRegistry($host = null, $port = null)
 {
     $context = \Innomatic\Module\Server\ModuleServerContext::instance('\\Innomatic\\Module\\Server\\ModuleServerContext');
     $mode = $context->getConfig()->getKey('load_services_register');
     if ($host == null || $port == null) {
         //loading registry for the first time
         if ($mode == 'local') {
             print 'Module: services-extension loading netregistry locally' . "\n";
             $this->loadLocalRegistry('modules-netregistry.xml');
         } elseif ($mode == 'remote') {
             $r_address = $context->getConfig()->getKey('remote_address');
             $r_port = $context->getConfig()->getKey('remote_port');
             print "Module: services-extension loading netregistry from {$r_address}:{$r_port}" . "\n";
             $this->downloadRemoteRegistry($r_address, $r_port);
             $this->loadLocalRegistry('modules-netregistry-remote.xml');
         } else {
             Carthag::instance()->halt("error: check .ini file");
         }
     } else {
         //refreshing registry after a modification of the peers (es. ping timeout)
         print "Module: services-extension refreshing net-registry from {$host}:{$port}" . "\n";
         $this->downloadRemoteRegistry($host, $port);
         $this->loadLocalRegistry('modules-netregistry-remote.xml');
     }
 }
Exemplo n.º 2
0
 public function AmpConfig($configFile)
 {
     // Checks to see if the file is there
     if (file_exists($configFile)) {
         $fp = @fopen($configFile, 'r');
         if ($fp) {
             $this->mConfigFile = $configFile;
             $this->mOpened = true;
             while ($fl = @fgets($fp)) {
                 $trimmed_line = trim($fl);
                 if (substr($trimmed_line, 0, 1) != '#' and substr($trimmed_line, 0, 1) != ';' and strpos($trimmed_line, '=')) {
                     $key = substr($trimmed_line, 0, strpos($trimmed_line, '='));
                     $value = substr($trimmed_line, strpos($trimmed_line, '=') + 1);
                     $this->mConfigValues[trim($key)] = trim($value);
                 }
             }
             @fclose($fp);
         } else {
             $carthag = Carthag::instance();
             $carthag->halt('Could not open ' . $configFile);
         }
     } else {
         $carthag = Carthag::instance();
         $carthag->halt('Configuration file ' . $configFile . " doesn't exists");
     }
 }
Exemplo n.º 3
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();
}
Exemplo n.º 4
0
 public function huiXml($elemName, $elemArgs = '', $elemTheme = '', $dispEvents = '')
 {
     $this->HuiWidgetElement($elemName, $elemArgs, $elemTheme, $dispEvents);
     if (isset($this->mArgs['definitionfile']) and file_exists($this->mArgs['definitionfile'])) {
         $this->mDefinitionFile = $this->mArgs['definitionfile'];
         if (file_exists($this->mDefinitionFile)) {
             $this->mDefinition = file_get_contents($this->mDefinitionFile);
         }
     } else {
         if (isset($this->mArgs['definition'])) {
             $this->mDefinition =& $this->mArgs['definition'];
         }
     }
     $this->carthag = Carthag::instance();
     $this->cl = $this->carthag->getClassLoader();
 }
Exemplo n.º 5
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');
Exemplo n.º 6
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;
 }
Exemplo n.º 7
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();
 }
Exemplo n.º 8
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;
 }
 public function onReceiveData($clientId = null, $data = null)
 {
     //print('dati ricevuti');
     $response = new \Innomatic\Modules\Server\ModuleServerResponse();
     $raw_request = explode("\n", $data);
     $headers = array();
     $body = '';
     $body_start = false;
     $command_line = '';
     foreach ($raw_request as $line) {
         $line = trim($line);
         if (!$body_start and $line == '') {
             $body_start = true;
             continue;
         }
         if ($body_start) {
             $body .= $line . "\n";
         } else {
             if (strlen($command_line)) {
                 $headers[substr($line, 0, strpos($line, ':'))] = trim(substr($line, strpos($line, ':') + 1));
             } else {
                 $command_line = $line;
             }
         }
     }
     if (!isset($headers['User'])) {
         $headers['User'] = '';
     }
     if (!isset($headers['Password'])) {
         $headers['Password'] = '';
     }
     if ($this->authenticator->authenticate($headers['User'], $headers['Password'])) {
         $command = explode(' ', $command_line);
         switch ($command[0]) {
             case 'PING':
                 if ($this->authenticator->authorizeAction($headers['User'], 'ping')) {
                     $response->setBuffer("pong. (from " . $this->bindAddress . ":" . $this->port . ")\n");
                 } else {
                     $response->sendWarning(\Innomatic\Modules\Server\ModuleServerResponse::SC_FORBIDDEN, 'Action not authorized');
                 }
                 print "I've been pinged" . "\n";
                 break;
             case 'SHUTDOWN':
                 if ($this->authenticator->authorizeAction($headers['User'], 'shutdown')) {
                     $this->serversocket->sendData($clientId, "pinger server: shuting down.\n", true);
                     print "pinger server: shuting down" . "\n";
                     Carthag::instance()->halt("pinger server: terminated.");
                 } else {
                     $response->sendWarning(\Innomatic\Modules\Server\ModuleServerResponse::SC_FORBIDDEN, 'Action not authorized');
                 }
                 break;
             default:
                 $response->sendWarning(\Innomatic\Modules\Server\ModuleServerResponse::SC_BAD_REQUEST, 'Cannot hunderstand command');
         }
     } else {
         $response->sendWarning(\Innomatic\Modules\Server\ModuleServerResponse::SC_UNAUTHORIZED, 'Authentication needed');
     }
     $this->serversocket->sendData($clientId, $response->getResponse(), true);
     $this->serversocket->closeConnection();
 }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
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);
Exemplo n.º 12
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();
 }
Exemplo n.º 13
0
function main_phpinfo($eventData)
{
    phpinfo();
    $carthag = Carthag::instance();
    $carthag->halt();
}
Exemplo n.º 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;
 }
Exemplo n.º 15
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;
 }
Exemplo n.º 16
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');
Exemplo n.º 17
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)
{
Exemplo n.º 18
0
    public function abort($text, $forceInterface)
    {
        global $gEnv;
        OpenLibrary('hui.library');
        if (strlen($forceInterface)) {
            $interface = $forceInterface;
        } else {
            $interface = $this->interface;
        }
        if ($interface == Ampoliros::INTERFACE_EXTERNAL) {
            if (isset($gEnv['runtime']['external_interface_error_handler']) and function_exists($gEnv['runtime']['external_interface_error_handler'])) {
                $func = $gEnv['runtime']['external_interface_error_handler'];
                $func($text);
            } else {
                $interface = Ampoliros::INTERFACE_WEB;
                $this->interface = Ampoliros::INTERFACE_WEB;
            }
        }
        switch ($interface) {
            case Ampoliros::INTERFACE_GUI:
            case Ampoliros::INTERFACE_UNKNOWN:
            case Ampoliros::INTERFACE_REMOTE:
            case Ampoliros::INTERFACE_EXTERNAL:
                break;
            case Ampoliros::INTERFACE_CONSOLE:
                echo "\n" . $text . "\n";
                break;
            case Ampoliros::INTERFACE_WEB:
                $reg = Registry::instance();
                $tmp_hui = new Hui($reg->getEntry('amp.root.db'));
                $tmp_hui->LoadWidget('empty');
                //$tmp_elem = new HuiEmpty('empty');
                if (is_object($gEnv['hui']['theme']['handler'])) {
                    $die_image = $gEnv['hui']['theme']['handler']->mStyle['bigdot'];
                } else {
                    $die_image = '';
                }
                ?>
 
                                                <html>
                                                <head>
                                                <basefont face="Verdana">
                                                <title>Ampoliros</title>
                                                <link rel="stylesheet" type="text/css" href="<?php 
                echo $gEnv['hui']['theme']['handler']->mStyle['css'];
                ?>
">
                                                </head>
                                                
                                                <body bgcolor="white">
                                                
                                                <table border="0" cellspacing="0" cellpadding="0" align="center" width="200">
                                                <tr>
                                                    <td align="center"><a href="<?php 
                echo AMP_URL;
                ?>
"><img src="<?php 
                echo $die_image;
                ?>
" alt="Ampoliros" border="0"></a></td>
                                                </tr>
                                                <tr>
                                                <td>&nbsp; </td>
                                                </tr>
                                                <tr>
                                                <td align="center"><?php 
                echo $text;
                ?>
</td>
                                                </tr>
                                                </table>
                                                
                                                </body>
                                                </html>
                                                <?php 
                break;
        }
        $carthag = Carthag::instance();
        $carthag->halt();
    }
Exemplo n.º 19
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');
Exemplo n.º 20
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: ampoliros.php,v 1.2 2004-07-08 15:04:25 alex Exp $
if (!defined('AMPOLIROS')) {
    define('AMPOLIROS', true);
    // Carthag
    require 'carthag.php';
    $carthag = Carthag::instance();
    $carthag->startup();
    Carthag::package('com.solarix.ampoliros');
    class main extends Object
    {
        function main($args)
        {
            include 'ampconfigpath.php';
            import('com.solarix.ampoliros.core.Ampoliros');
            $amp = Ampoliros::instance('Ampoliros');
            $amp->bootstrap(AMP_CONFIG);
        }
    }
    $carthag->runAsEmbedded();
}
 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;
 }
Exemplo n.º 22
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');
Exemplo n.º 23
0
 public function render()
 {
     if (!$this->mBuilt) {
         $this->Build();
     }
     if ($this->mBuilt) {
         @header('P3P: CP="CUR ADM OUR NOR STA NID"');
         $carthag = Carthag::instance();
         $carthag->out->println($this->mLayout);
         return true;
     } else {
         import('com.solarix.ampoliros.io.log.Logger');
         $log = new Logger(AMP_LOG);
         $log->LogEvent('ampoliros.hui_library.hui_class.render', 'Unable to render hui', LOGGER_ERROR);
         $this->mLastError = Hui::RENDER_UNABLE_TO_RENDER;
     }
     return false;
 }