Exemplo n.º 1
0
 public static function initialize()
 {
     static::loadConfig();
     DateTime::setTimeZone();
     ErrorHandler::initialize();
     HTTP::setRequestType();
 }
Exemplo n.º 2
0
 protected function init()
 {
     global $PHP_SELF, $login_request, $cfgModules, $oscTemplate;
     $OSCOM_Cookies = new Cookies();
     Registry::set('Cookies', $OSCOM_Cookies);
     try {
         $OSCOM_Db = Db::initialize();
         Registry::set('Db', $OSCOM_Db);
     } catch (\Exception $e) {
         include OSCOM::getConfig('dir_root', 'Shop') . 'includes/error_documents/maintenance.php';
         exit;
     }
     Registry::set('Hooks', new Hooks());
     Registry::set('MessageStack', new MessageStack());
     // set the application parameters
     $Qcfg = $OSCOM_Db->get('configuration', ['configuration_key as k', 'configuration_value as v']);
     //, null, null, null, 'configuration'); // TODO add cache when supported by admin
     while ($Qcfg->fetch()) {
         define($Qcfg->value('k'), $Qcfg->value('v'));
     }
     // Used in the "Backup Manager" to compress backups
     define('LOCAL_EXE_GZIP', 'gzip');
     define('LOCAL_EXE_GUNZIP', 'gunzip');
     define('LOCAL_EXE_ZIP', 'zip');
     define('LOCAL_EXE_UNZIP', 'unzip');
     // set php_self in the global scope
     $req = parse_url($_SERVER['SCRIPT_NAME']);
     $PHP_SELF = substr($req['path'], strlen(OSCOM::getConfig('http_path')));
     $OSCOM_Session = Session::load();
     Registry::set('Session', $OSCOM_Session);
     $OSCOM_Session->start();
     $OSCOM_Language = new Language();
     Registry::set('Language', $OSCOM_Language);
     // set the language
     if (!isset($_SESSION['language']) || isset($_GET['language'])) {
         if (isset($_GET['language']) && !empty($_GET['language']) && $OSCOM_Language->exists($_GET['language'])) {
             $OSCOM_Language->set($_GET['language']);
         }
         $_SESSION['language'] = $OSCOM_Language->get('code');
     }
     // redirect to login page if administrator is not yet logged in
     if (!isset($_SESSION['admin'])) {
         $redirect = false;
         $current_page = $PHP_SELF;
         // if the first page request is to the login page, set the current page to the index page
         // so the redirection on a successful login is not made to the login page again
         if ($current_page == FILENAME_LOGIN && !isset($_SESSION['redirect_origin'])) {
             $current_page = FILENAME_DEFAULT;
         }
         if ($current_page != FILENAME_LOGIN) {
             if (!isset($_SESSION['redirect_origin'])) {
                 $_SESSION['redirect_origin'] = ['page' => $current_page, 'get' => []];
             }
             // try to automatically login with the HTTP Authentication values if it exists
             if (!isset($_SESSION['auth_ignore'])) {
                 if (isset($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']) && !empty($_SERVER['PHP_AUTH_PW'])) {
                     $_SESSION['redirect_origin']['auth_user'] = $_SERVER['PHP_AUTH_USER'];
                     $_SESSION['redirect_origin']['auth_pw'] = $_SERVER['PHP_AUTH_PW'];
                 }
             }
             $redirect = true;
         }
         if (!isset($login_request) || isset($_GET['login_request']) || isset($_POST['login_request']) || isset($_COOKIE['login_request']) || isset($_SESSION['login_request']) || isset($_FILES['login_request']) || isset($_SERVER['login_request'])) {
             $redirect = true;
         }
         if ($redirect == true) {
             OSCOM::redirect(FILENAME_LOGIN, isset($_SESSION['redirect_origin']['auth_user']) ? 'action=process' : '');
         }
     }
     // include the language translations
     $OSCOM_Language->loadDefinitions('main');
     // Prevent LC_ALL from setting LC_NUMERIC to a locale with 1,0 float/decimal values instead of 1.0 (see bug #634)
     $system_locale_numeric = setlocale(LC_NUMERIC, 0);
     setlocale(LC_ALL, explode(';', OSCOM::getDef('system_locale')));
     setlocale(LC_NUMERIC, $system_locale_numeric);
     $current_page = basename($PHP_SELF);
     if ($OSCOM_Language->definitionsExist(pathinfo($current_page, PATHINFO_FILENAME))) {
         $OSCOM_Language->loadDefinitions(pathinfo($current_page, PATHINFO_FILENAME));
     }
     $oscTemplate = new \oscTemplate();
     $cfgModules = new \cfg_modules();
     if (!FileSystem::isWritable(ErrorHandler::getDirectory())) {
         Registry::get('MessageStack')->add('The log directory is not writable. Please allow the web server to write to: ' . FileSystem::displayPath(ErrorHandler::getDirectory()));
     }
 }
Exemplo n.º 3
0
</td>
      <td class="text-right"><?php 
        echo $f['size'];
        ?>
</td>
      <td class="action"><a href="<?php 
        echo OSCOM::link('error_log.php', 'action=view&log=' . $f['key']);
        ?>
"><i class="fa fa-file-text-o" title="<?php 
        echo OSCOM::getDef('button_view');
        ?>
"></i></a></td>
    </tr>

<?php 
    }
    ?>

  </tbody>
</table>

<p>
  <?php 
    echo OSCOM::getDef('log_directory', ['path' => FileSystem::displayPath(ErrorHandler::getDirectory())]);
    ?>
</p>

<?php 
}
require $oscTemplate->getFile('template_bottom.php');
require 'includes/application_bottom.php';
Exemplo n.º 4
0
    foreach ($cl_box_groups as $groups) {
        echo '<li><a>' . HTML::outputProtected($groups['heading']) . ' <span class="caret"></span></a>
              <ul class="dropdown-menu">';
        foreach ($groups['apps'] as $app) {
            echo '<li><a href="' . $app['link'] . '">' . HTML::outputProtected($app['title']) . '</a></li>';
        }
        echo '  </ul>
            </li>';
    }
    ?>

          </ul>
        </li>

<?php 
    if (count(glob(ErrorHandler::getDirectory() . 'errors-*.txt')) > 0) {
        ?>

        <li><a href="<?php 
        echo OSCOM::link('error_log.php');
        ?>
"><i class="fa fa-exclamation-circle text-danger"></i></a>
          <ul class="dropdown-menu">
            <li><a href="<?php 
        echo OSCOM::link('error_log.php');
        ?>
">View Error Log</a></li>
          </ul>
        </li>

<?php