Beispiel #1
0
/**
 * Move an album token up and down
 * @global type $input
 * @global type $repository_path
 * @global type $user_files_path
 */
function album_token_move()
{
    global $input;
    global $repository_path;
    global $user_files_path;
    $album = $input['album'];
    $index = (int) $input['index'];
    $upDown = $input['up_down'];
    $new_index = $upDown == 'up' ? $index - 1 : $index + 1;
    ezmam_repository_path($repository_path);
    user_prefs_repository_path($user_files_path);
    user_prefs_token_swap($_SESSION['user_login'], $index, $new_index);
    acl_update_permissions_list();
    log_append('moved_album_token', 'album token moved from ' . $index . ' to ' . $new_index);
    // lvl, action, album, index_src, index_dest
    trace_append(array('1', 'album_token_move', $album, $index, $new_index));
    view_main(false);
}
Beispiel #2
0
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
require 'config.inc';
include "lib_template.php";
session_start();
$input = array_merge($_GET, $_POST);
$action = isset($input['action']) ? $input['action'] : "";
$redraw = false;
switch ($action) {
    // No action selected: we choose to display the homepage again
    default:
        // TODO: check session var here
        view_main();
}
/**
 * Displays the main frame, without anything on the right side
 */
function view_main()
{
    // TODO
    // include_once template_getpath('main.php');
    echo "<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        \n        <!--\n        * EZCAST EZadmin \n        * Copyright (C) 2014 Université libre de Bruxelles\n        *\n        * Written by Michel Jansens <*****@*****.**>\n        * \t\t    Arnaud Wijns <*****@*****.**>\n        *                   Antoine Dewilde\n        *                   Thibaut Roskam\n        *\n        * This software is free software; you can redistribute it and/or\n        * modify it under the terms of the GNU Lesser General Public\n        * License as published by the Free Software Foundation; either\n        * version 3 of the License, or (at your option) any later version.\n        *\n        * This software is distributed in the hope that it will be useful,\n        * but WITHOUT ANY WARRANTY; without even the implied warranty of\n        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n        * Lesser General Public License for more details.\n        *\n        * You should have received a copy of the GNU Lesser General Public\n        * License along with this software; if not, write to the Free Software\n        * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n        -->\n\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n        <title>EZcast</title>\n    </head>\n    <body>Hello World</body>\n</html>";
}
Beispiel #3
0
/**
 * Effectively logs the user in
 * @param string $login
 * @param string $passwd
 */
function user_login($login, $passwd)
{
    global $input;
    global $template_folder;
    global $error;
    global $ezmanager_url;
    // 0) Sanity checks
    if (empty($login) || empty($passwd)) {
        $error = template_get_message('empty_username_password', get_lang());
        view_login_form();
        die;
    }
    $login_parts = explode("/", $login);
    // checks if runas
    if (count($login_parts) == 2) {
        if (!file_exists('admin.inc')) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
        include 'admin.inc';
        //file containing an assoc array of admin users
        if (!isset($admin[$login_parts[0]])) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
    }
    $res = checkauth(strtolower($login), $passwd);
    if (!$res) {
        $error = checkauth_last_error();
        view_login_form();
        die;
    }
    // 1) Initializing session vars
    $_SESSION['podman_logged'] = "LEtimin";
    // "boolean" stating that we're logged
    $_SESSION['user_login'] = $res['login'];
    $_SESSION['user_real_login'] = $res['real_login'];
    $_SESSION['user_full_name'] = $res['full_name'];
    $_SESSION['user_email'] = $res['email'];
    //check flash plugin or GET parameter no_flash
    if (!isset($_SESSION['has_flash'])) {
        //no noflash param when login
        //check flash plugin
        if ($input['has_flash'] == 'N') {
            $_SESSION['has_flash'] = false;
        } else {
            $_SESSION['has_flash'] = true;
        }
    }
    // 2) Initializing the ACLs
    acl_init($login);
    // 3) Setting correct language
    set_lang($input['lang']);
    if (count(acl_authorized_albums_list()) == 0) {
        error_print_message(template_get_message('not_registered', get_lang()), false);
        log_append('warning', $res['login'] . ' tried to access ezmanager but doesn\'t have permission to manage any album.');
        session_destroy();
        view_login_form();
        die;
    }
    // 4) Resetting the template path to the one of the language chosen
    template_repository_path($template_folder . get_lang());
    // 5) Logging the login operation
    log_append("login");
    // 6) Displaying the page
    header("Location: " . $ezmanager_url);
    view_main();
}
Beispiel #4
0
/**
 * Effectively logs the user in
 * @param string $login
 * @param string $passwd
 */
function user_login($login, $passwd)
{
    global $input;
    global $template_folder;
    global $error;
    global $ezadmin_url;
    // 0) Sanity checks
    if (empty($login) || empty($passwd)) {
        $error = template_get_message('empty_username_password', get_lang());
        view_login_form();
        die;
    }
    $login_parts = explode("/", $login);
    // checks if runas
    if (count($login_parts) >= 2) {
        $error = "No runas here !";
        view_login_form();
        die;
    }
    if (!file_exists('admin.inc')) {
        $error = "User not authorized";
        view_login_form();
        die;
    }
    include 'admin.inc';
    //file containing an assoc array of admin users
    if (!isset($users[$login_parts[0]])) {
        $error = "User not authorized";
        view_login_form();
        die;
    }
    $res = checkauth(strtolower($login), $passwd);
    if (!$res) {
        $error = checkauth_last_error();
        view_login_form();
        die;
    }
    // 1) Initializing session vars
    $_SESSION['podcastcours_logged'] = "LEtimin";
    // "boolean" stating that we're logged
    $_SESSION['user_login'] = $login;
    $_SESSION['user_real_login'] = $res['real_login'];
    $_SESSION['user_full_name'] = $res['full_name'];
    $_SESSION['user_email'] = $res['email'];
    // 3) Setting correct language
    set_lang($input['lang']);
    // 4) Resetting the template path to the one of the language chosen
    template_repository_path($template_folder . get_lang());
    // 5) Logging the login operation
    log_append("login");
    // 6) Displaying the page
    header("Location: " . $ezadmin_url);
    view_main();
}
Beispiel #5
0
define("TN_VERSION", "1.0");
define("HOST_UP", 0);
define("HOST_DOWN", 1);
define("HOST_UNREACHABLE", 2);
define("STATE_OK", 0);
define("STATE_WARNING", 1);
define("STATE_CRITICAL", 2);
define("STATE_UNKNOWN", 3);
$HOST_STATUS_BY = array(HOST_UP => "Up", HOST_DOWN => "Down", HOST_UNREACHABLE => "Unreachable");
$SERVICE_STATUS_BY = array(STATE_OK => "OK", STATE_WARNING => "Warning", STATE_CRITICAL => "Critical", STATE_UNKNOWN => "Unknown");
$BASE_URL = $_SERVER["SCRIPT_NAME"];
$status = parse_status_file($STATUS_FILE);
$global_stats = calc_global_stats($status);
switch ($_REQUEST["page"]) {
    case NULL:
        view_main($global_stats, $status);
        break;
    case "downtime":
        view_downtime($global_stats, $status);
        break;
    case "schedule_downtime":
        command_schedule_downtime($global_stats, $status);
        break;
    default:
        trigger_error("unknown page: " . htmlspecialchars($_GET["page"], ENT_QUOTES), E_USER_NOTICE);
}
function begin_html()
{
    global $BASE_URL;
    ?>
<!DOCTYPE html>