Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Štvrtok, 28. marec 2024

Súbor: [Platon] / Metafox / admin / _core.php (stiahnutie)

Revízia 1.4, Sat Aug 13 23:06:17 2005 UTC (18 years, 7 months ago) by nepto


Zmeny od 1.3: +4 -4 [lines]

Changed some string occurences of phpMyEzin to Metafox.

<?php

/*
 * Metafox - enterprise content management system
 *
 * admin/_core.php - admin core file
 * ____________________________________________________________
 *
 * Developed by Ondrej Jombik <nepto@platon.sk>
 * Copyright (c) 2001-2005 Platon SDG, http://platon.sk/
 * All rights reserved.
 *
 * See README file for more information about this software.
 * See COPYING file for license information.
 *
 * Download the latest version from
 * http://platon.sk/projects/Metafox/
 */

/* $Platon: Metafox/admin/_core.php,v 1.3 2005/06/10 14:36:23 nepto Exp $ */

/* MAINTAINANCE: This file is maintained in Metafox project and distributed
   across the particular projects accordingly. */

header('Pragma: no-cache');                                    // HTTP/1.0
header('Cache-Control: no-cache, must-revalidate');              // HTTP/1.1
header('Expires: Mon, 01 Jun 1981 05:00:00 GMT');              // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified

chdir('inc/');
require_once 'init.inc.php';
chdir('../');

require_once 'inc/functions.inc.php';
require_once 'Platon.php';
require_once 'Auth/AuthDB.php';
$ezin_auth === false && $ezin_auth = new AuthDB($ezin_auth_options);
isset($ezin_admin_action) || $ezin_admin_action = '';

/* If admin's authentifaction function was defined, use it. */
if (strlen($ezin_cfg['admin_auth_function']) > 0) {
    $ezin_auth->setLoggedFunction($ezin_cfg['admin_auth_function']);
}

if ($ezin_admin_action == 'logout') {
    if ($ezin_auth->getAuth()) {
        $ezin_auth->logout();
        if (strlen($ezin_cfg['admin_auth_function']) > 0 /* <-- consider if this is neccessary */
                && strlen($ezin_cfg['admin_auth_logout_redirect']) > 0) {
            header('Location: '.ezin_adjust_link($ezin_cfg['admin_auth_logout_redirect']));
            exit;
        }
    } else {
        header('Location: http://'.$_SERVER['HTTP_HOST'].$ezin_cfg['url'].$ezin_sys['dir']['admin']);
        exit;
    }
}

if (strlen($ezin_cfg['admin_auth_function']) > 0
        && function_exists($ezin_cfg['admin_auth_function'])
        && (string) @$ezin_cfg['admin_auth_function']() == '') {
    if ($ezin_auth->getAuth()) {
        $ezin_auth->logout();
    } else {
        if (strlen($ezin_cfg['admin_auth_login_redirect']) > 0) {
            header('Location: '.ezin_adjust_link($ezin_cfg['admin_auth_login_redirect']));
            exit;
        }
    }
}


if (! $ezin_auth->getAuth()) { // not logged in case
    
    switch ($ezin_auth->getStatus()) {
        case AUTH_DB_NOT_LOGGED: require 'inc-html/login.html';   break;
        case AUTH_DB_LOGGED_OUT: require 'inc-html/logout.html';  break;
        case AUTH_DB_FAILED:     require 'inc-html/logfail.html'; break;
        case AUTH_DB_TIMEOUT:    require 'inc-html/timeout.html'; break;
        case AUTH_DB_EXPIRED:    require 'inc-html/expired.html'; break;
        default:
             echo '<center>';
             echo '<p><big><b>Unknown status ('; // )
             echo $ezin_auth->getStatus().')</b></big>';
             echo '</center>';
             break;
    }

} else { // logged in case

    $ezin_USER = $ezin_auth->getUserInfo();

    if (empty($ezin_USER['role_login'])) {
        echo 'You\'re not allowed to log in.<br>';
        $ezin_auth->logout();
    } else {

        echo '<table class="ezin-admin-main">' . "\n";
        echo '<tr><td class="ezin-admin-main" align="left" valign="top">';
        echo '<!-- Metafox::ADMIN::MENU -->';
        require_once 'inc-html/bar-title.html';
        require_once 'inc/menu.inc.php';

        foreach ($ezin_ADMIN_MENU as $ar) {
            $ok = 0;
            if (0) { /* change if's 0 to 1 to get all menu links */
                $ok = 1;
            } elseif (! isset($ar['column'])) {
                $ok = 1;
            } elseif (is_array($ar['column'])) {
                foreach ($ar['column'] as $col) {
                    if (ezin_admin_check_list_privileges($ezin_USER[$col])) {
                        $ok = 1;
                        break;
                    }
                }
            } elseif (ezin_admin_check_list_privileges($ezin_USER[$ar['column']])) {
                $ok = 1;
            }
            if ($ok) {
                echo '<strong><big>&middot;</big></strong>&nbsp;';
                echo '<a href="'.$ar['link'].'">'.$ar['caption'].'</a><br>'."\n";
            }
        }

        require_once 'inc-html/bar-info.html';
        echo '<!-- /Metafox::ADMIN::MENU --></td>',"\n";
        echo '<td width="100%" align="left" valign="top" class="ezin-admin-main">';
        echo '<!-- Metafox::ADMIN::CONTENT -->',"\n";

        switch ($ezin_admin_action) {
            /*
             * Empty action
             */
            case '': 
                require 'inc-html/welcome.html';
                break;

                /*
                 * File management action
                 */
            case 'file_management':
                if (ezin_admin_check_list_privileges($ezin_USER['role_file_management'])) {
                    $ezin_admin_orig_dir = getcwd(); 
                    Platon::chdir_back($ezin_sys['dir']['admin']);
                    if (@file_exists($ezin_sys['dir']['upload'])) {
                        chdir('lib/phpWebFileManager/');
                        require_once 'index.php';
                        chdir($ezin_admin_orig_dir);
                    } else {
                        chdir($ezin_admin_orig_dir);
                        require 'inc-html/nofilemngdir.html';
                    }
                } else {
                    require 'inc-html/permdenied.html';
                }
                break;

                /*
                 * Database manipulation action
                 */
            default:
                foreach ($ezin_ADMIN_MENU as $ar) {
                    if (isset($ar['action']) && ! strcmp($ar['action'], $ezin_admin_action)) {
                        $inc_filename = 'inc-db/'.$ar['inc_file'];
                        if (@file_exists($inc_filename) && @is_file($inc_filename) && @is_readable($inc_filename)) {
                            require_once $inc_filename;
                        } else {
                            require 'inc-html/failure.html';
                        }
                        break;
                    }
                }
                break;
        };

        echo '<!-- /Metafox::ADMIN::CONTENT --></td></tr>';
        if (@file_exists('inc-html/signature.html')) {
            echo '<tr><td class="ezin-admin-main" colspan="2">';
            echo '<!-- Metafox::ADMIN::SIGNATURE -->',"\n";
            require 'inc-html/signature.html';
            echo '<!-- /Metafox::ADMIN::SIGNATURE --></td></tr>';
        }
        echo '</table>'."\n";
    }
}


chdir('inc/');
require_once 'destroy.inc.php';
chdir('../');

?>

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok