public static function isAccessAllowed()
 {
     if (!GateKeeper::isLoginRequired() || GateKeeper::isUserLoggedIn()) {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
    public function printLoginBox()
    {
        ?>
		<div id="login">
		<form enctype="multipart/form-data" action="<?php 
        print $this->makeLink(false, false, null, null, null, "");
        ?>
" method="post">
		<?php 
        if (GateKeeper::isLoginRequired()) {
            $require_username = false;
            foreach (EncodeExplorer::getConfig("users") as $user) {
                if ($user[0] != null && strlen($user[0]) > 0) {
                    $require_username = true;
                    break;
                }
            }
            if ($require_username) {
                ?>
			<div><label for="user_name"><?php 
                print $this->getString("username");
                ?>
:</label>
			<input type="text" name="user_name" value="" id="user_name" /></div>
			<?php 
            }
            ?>
			<div><label for="user_pass"><?php 
            print $this->getString("password");
            ?>
:</label>
			<input type="password" name="user_pass" id="user_pass" /></div>
			<div><input type="submit" value="<?php 
            print $this->getString("log_in");
            ?>
" class="button" /></div>
		</form>
		</div>
	<?php 
        }
    }
Exemplo n.º 3
0
    if (stripos($useragent, 'android') !== false) {
        $downloader->androidDownload($headers['file'], $headers['filename'], $headers['file_size']);
    } else {
        // resumable download
        $downloader->resumableDownload($headers['file'], $headers['filename'], $headers['file_size'], $headers['content_type'], $headers['disposition']);
    }
    $logger->logDownload($headers['trackfile']);
    exit;
} elseif ($getfile && $hash && $downloader->checkFile($getfile) == true && md5($alt . $getfile . $altone . $alt) === $hash) {
    /**
     * download single file, 
     * play Audio or show PDF 
     * (for logged users)
     */
    $headers = $downloader->getHeaders($getfile, $playmp3);
    if ($gateKeeper->isUserLoggedIn() && $downloader->subDir($headers['dirname']) == true || $gateKeeper->isLoginRequired() == false) {
        // download file if Android
        if (stripos($useragent, 'android') !== false) {
            $downloader->androidDownload($headers['file'], $headers['filename'], $headers['file_size']);
        } else {
            // resumable download
            $downloader->resumableDownload($headers['file'], $headers['filename'], $headers['file_size'], $headers['content_type'], $headers['disposition']);
        }
        if ($headers['content_type'] == "audio/mp3") {
            $logger->logPlay($headers['trackfile']);
        } else {
            $logger->logDownload($headers['trackfile']);
        }
        exit;
    }
    $_SESSION['error'] = "<i class=\"fa fa-ban\"></i> Access denied";