Пример #1
0
 public function SetGlobalVariables()
 {
     NewTemplater::SetGlobalVariable("my-displayname", $this->sDisplayName);
 }
Пример #2
0
<?php

/*
 * ReDonate is more free software. It is licensed under the WTFPL, which
 * allows you to do pretty much anything with it, without having to
 * ask permission. Commercial use is allowed, and no attribution is
 * required. We do politely request that you share your modifications
 * to benefit other developers, but you are under no enforced
 * obligation to do so :)
 * 
 * Please read the accompanying LICENSE document for the full WTFPL
 * licensing text.
 */
if (empty($_APP)) {
    die("Unauthorized.");
}
$uLogoutKey = $router->uParameters[1];
if (!empty($_SESSION['logout_key']) && $_SESSION['logout_key'] == $uLogoutKey) {
    unset($_SESSION['user_id']);
    unset($_SESSION['logout_key']);
    $sPageTitle = "Logged out";
    $sPageContents = NewTemplater::Render("logout", $locale->strings, array());
    NewTemplater::SetGlobalVariable("logged-in", false);
} else {
    throw new RouterException("No valid logout key specified.");
}
Пример #3
0
// While I realize this won't stop anyone who really wants to disable the "alert" system, it might prevent someone who knows nothing about PHP.
$sLicense = Core::GetSetting('license');
NewTemplater::SetGlobalVariable("License", $sLicense->sValue);
if ($sMail->sValue == 1) {
    include "./includes/library/sendgrid/SendGrid_loader.php";
} elseif ($sMail->sValue == 2) {
    include "./includes/library/mandril/mandril.php";
}
if (isset($_SESSION["user_id"])) {
    $sUser = new User($_SESSION["user_id"]);
    $_SESSION['permissions'] = $sUser->sPermissions;
    NewTemplater::SetGlobalVariable("Username", $sUser->sUsername);
    NewTemplater::SetGlobalVariable("UserPermissions", $sUser->sPermissions);
    $sPullVPS = $database->CachedQuery("SELECT * FROM vps WHERE `user_id` = :UserId", array('UserId' => $sUser->sId));
    if (!empty($sPullVPS)) {
        foreach ($sPullVPS->data as $key => $value) {
            $sServer = new Server($value["server_id"]);
            if ($sRequest == 'view.php') {
                if ($sId == $value["id"]) {
                    $sViewing = 1;
                } else {
                    $sViewing = 0;
                }
            } else {
                $sViewing = 0;
            }
            $sVPS[] = array("id" => $value["id"], "server_id" => $sServer->sId, "server_name" => $sServer->sName, "container_id" => $value["container_id"], "hostname" => $value["hostname"], "primary_ip" => $value["primary_ip"], "type" => ucfirst($value["type"]), "viewing" => $sViewing);
        }
    }
    NewTemplater::SetGlobalVariable("UserVPS", $sVPS);
}
Пример #4
0
function autoload_redonate($class_name)
{
    global $_APP;
    $class_name = str_replace("\\", "/", strtolower($class_name));
    if (file_exists("classes/{$class_name}.php")) {
        require_once "classes/{$class_name}.php";
    }
}
spl_autoload_register('autoload_redonate');
/* Set global templater variables */
NewTemplater::SetGlobalVariable("logged-in", !empty($_SESSION['user_id']));
if (!empty($_SESSION['user_id'])) {
    /* TODO: Handle being logged in to a non-existent user */
    $sCurrentUser = new User($_SESSION['user_id']);
    $sCurrentUser->SetGlobalVariables();
    NewTemplater::SetGlobalVariable("logout-key", $_SESSION['logout_key']);
}
NewTemplater::RegisterVariableHook("errors", "get_errors");
NewTemplater::RegisterVariableHook("notices", "get_notices");
function get_errors($fetch)
{
    if (isset($_SESSION['errors'])) {
        $errors = $_SESSION['errors'];
        if ($fetch === true) {
            /* We only want to clear out errors if a call to
             * actually retrieve the errors was made, not just
             * something like an isempty. */
            $_SESSION['errors'] = array();
        }
        return $errors;
    } else {
Пример #5
0
<?php

session_name('neon_auth');
require_once './includes/db.php';
require_once './includes/functions.php';
require_once './includes/global_settings.php';
require_once './includes/lib/net/ssh.php';
require_once './includes/lib/crypt/RSA.php';
include './includes/lib/net/sftp.php';
$sWriteLog = fopen($cphp_config->settings->commandlog, 'a');
$user_ssh = new Net_SSH2($sDefaultIP->sValue);
$user_sftp = new Net_SFTP($sDefaultIP->sValue);
if (isset($_SESSION['user_id'])) {
    $sUser = new User($_SESSION['user_id']);
    $LoggedIn = true;
    NewTemplater::SetGlobalVariable("Username", $sUser->sUsername);
    NewTemplater::SetGlobalVariable("UserId", $sUser->sId);
} else {
    $LoggedIn = false;
}
$sErrorMessage = NULL;
Пример #6
0
NewTemplater::SetGlobalVariable("PanelTitle", $sPanelTitle->sValue);
$sRegistrationEnabled = Core::GetSetting('registration_enabled');
NewTemplater::SetGlobalVariable("RegistrationEnabled", $sRegistrationEnabled->sValue);
$sForgotPasswordEnabled = Core::GetSetting('forgotpassword_enabled');
NewTemplater::SetGlobalVariable("ForgotPasswordEnabled", $sForgotPasswordEnabled->sValue);
$sDefaultIP = Core::GetSetting('default_ip');
if ($sDefaultIP->sValue == localhost) {
    $sServerIP = $_SERVER['SERVER_ADDR'];
    $sUpdateIP = $database->CachedQuery("UPDATE settings SET `setting_value` = :ServerIP WHERE `setting_name` = :SettingName", array(':ServerIP' => $sServerIP, ':SettingName' => 'default_ip'), 5);
    $sDefaultIP = Core::GetSetting('default_ip');
}
NewTemplater::SetGlobalVariable("DefaultIP", $sDefaultIP->sValue);
$sMaxPanelUploadSize = Core::GetSetting('max_panel_upload_size');
NewTemplater::SetGlobalVariable("MaxPanelUploadSize", $sMaxPanelUploadSize->sValue);
$sVersion = Core::GetSetting('version');
NewTemplater::SetGlobalVariable("Version", $sVersion->sValue);
function remove_magic_quotes($array)
{
    foreach ($array as $k => $v) {
        if (is_array($v)) {
            $array[$k] = remove_magic_quotes($v);
        } else {
            $array[$k] = stripslashes($v);
        }
    }
    return $array;
}
if (get_magic_quotes_gpc()) {
    $_GET = remove_magic_quotes($_GET);
    $_POST = remove_magic_quotes($_POST);
    $_COOKIE = remove_magic_quotes($_COOKIE);