Esempio n. 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();
}
Esempio n. 2
0
 *   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: header.php,v 1.13 2004-07-08 15:04:25 alex Exp $
require './auth.php';
import('com.solarix.ampoliros.hui.Hui');
$hui = new Hui($env['ampdb']);
$hui->LoadWidget('button');
$hui->LoadWidget('image');
$hui->LoadWidget('label');
$hui->LoadWidget('link');
$hui->LoadWidget('page');
$hui->LoadWidget('vertgroup');
$hui_page = new HuiPage('page', array('title' => 'Ampoliros - ' . $env['sitedata']['sitename'], 'border' => 'false'));
$hui_page->mArgs['background'] = $hui_page->mThemeHandler->mStyle['menuback'];
$hui_mainvertgroup = new HuiVertGroup('mainvertgroup', array('align' => 'center'));
$hui_mainvertgroup->AddChild(new HuiButton('amplogo', array('action' => AMP_URL, 'target' => '_top', 'image' => $hui_page->mThemeHandler->mStyle['middot'], 'highlight' => 'false')));
$hui_mainvertgroup->AddChild(new HuiLabel('label', array('label' => $env['sitedata']['sitename'], 'nowrap' => 'true', 'align' => 'center')));
if (strlen($env['currentusercname'])) {
    $hui_mainvertgroup->AddChild(new HuiLabel('labelname', array('label' => $env['currentusercname'])));
}
$hui_page->AddChild($hui_mainvertgroup);
$hui->AddChild($hui_page);
$hui->Render();
Esempio n. 3
0
  <button><name>submit</name>
    <args>
      <label type="encoded">' . urlencode($gLocale->GetStr('setprefs.submit')) . '</label>
      <themeimage>button_ok</themeimage>
      <horiz>true</horiz>
      <frame>true</frame>
      <formsubmit>prefs</formsubmit>
      <action type="encoded">' . urlencode(build_events_call_string('', array(array('main', 'default', ''), array('action', 'setprefs', '')))) . '</action>
    </args>
  </button>
</children></vertgroup>';
    $gPage_content = new HuiXml('page', array('definition' => $xml_def));
}
$gMain_disp->AddEvent('stats', 'main_stats');
function main_stats($eventData)
{
    global $gEnv, $gLocale, $gPage_content;
    $xml_def = '<vertgroup><name>stats</name><children>
    <grid><name>prefs</name><children>
      <label row="0" col="0"><name>cacheobjects</name><args><label type="encoded">' . urlencode($gLocale->GetStr('cacheobjects.label')) . '</label></args></label>
      <string row="0" col="1"><name>cacheobjects</name><args><readonly>true</readonly><size>5</size><value>' . cache_objects() . '</value></args></string>
    </children></grid>
</children></vertgroup>';
    $gPage_content = new HuiXml('page', array('definition' => $xml_def));
}
$gMain_disp->Dispatch();
// Rendering
//
$gHui->AddChild(new HuiAmpPage('page', array('pagetitle' => $gTitle, 'menu' => $gMenu, 'toolbars' => array(new HuiAmpToolBar('main', array('toolbars' => $gToolbars))), 'maincontent' => $gPage_content, 'status' => $gStatus)));
$gHui->Render();
Esempio n. 4
0
 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();
 }
Esempio n. 5
0
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();
}