Esempio n. 1
0
 public function action_check()
 {
     $roles = GateKeeper::getRoles();
     if (!$roles || !count($roles)) {
         if (Controller::$debug) {
             Backend::addNotice('No roles setup, addings some');
         }
         $roles = $this->getDefaultRoles();
         if ($roles) {
             foreach ($roles as $role) {
                 GateKeeper::assign($role['role'], $role['access_type'], $role['access_id']);
                 if (Controller::$debug) {
                     Backend::addSuccess('Added role ' . $role['role']);
                 }
             }
         }
         $permits = $this->getDefaultPermissions();
         if ($permits) {
             foreach ($permits as $permit) {
                 GateKeeper::permit($permit['role'], $permit['control'], $permit['action'], $permit['subject'], $permit['subject_id']);
                 if (Controller::$debug) {
                     Backend::addSuccess('Added permission to ' . $role['action'] . ' to ' . $permit['role']);
                 }
             }
         }
     } else {
         if (Controller::$debug) {
             var_dump($roles);
         }
     }
 }
 public static function emailNotification($path, $isFile)
 {
     if (strlen(EncodeExplorer::getConfig('upload_email')) > 0) {
         $message = "This is a message to let you know that " . GateKeeper::getUserName() . " ";
         $message .= ($isFile ? "uploaded a new file" : "created a new directory") . " in Encode Explorer.\n\n";
         $message .= "Path : " . $path . "\n";
         $message .= "IP : " . $_SERVER['REMOTE_ADDR'] . "\n";
         mail(EncodeExplorer::getConfig('upload_email'), "Upload notification", $message);
     }
 }
Esempio n. 3
0
 public static function install(array $options = array())
 {
     $options['drop_table'] = array_key_exists('drop_table', $options) ? $options['drop_table'] : true;
     $toret = parent::install($options);
     foreach (self::getDefaults() as $assignment) {
         if (GateKeeper::assign($assignment['role'], $assignment['access_type'], $assignment['access_id'])) {
             Backend::addSuccess('Added assignment to ' . $assignment['role']);
             $toret = $toret && true;
         } else {
             Backend::addError('Could not add assignment to ' . $assignment['role']);
             $toret = false;
         }
     }
     return $toret;
 }
Esempio n. 4
0
    function outputHtml()
    {
        global $_ERROR;
        global $_START_TIME;
        ?>
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
        print $this->getConfig('lang');
        ?>
" lang="<?php 
        print $this->getConfig('lang');
        ?>
">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        print $this->getConfig('charset');
        ?>
">
<?php 
        css();
        ?>
<!-- <meta charset="<?php 
        print $this->getConfig('charset');
        ?>
" /> -->
<?php 
        if ($this->getConfig('log_file') != null && strlen($this->getConfig('log_file')) > 0 || $this->getConfig('thumbnails') != null && $this->getConfig('thumbnails') == true && $this->mobile == false || GateKeeper::isDeleteAllowed()) {
            ?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
<?php 
            if (GateKeeper::isDeleteAllowed()) {
                ?>
	$('td.del a').click(function(){
		var answer = confirm('Are you sure you want to delete : \'' + $(this).attr("data-name") + "\' ?");
		return answer;
	});
<?php 
            }
            if ($this->logging == true) {
                ?>
		function logFileClick(path)
		{
			 $.ajax({
					async: false,
					type: "POST",
					data: {log: path},
					contentType: "application/x-www-form-urlencoded; charset=UTF-8",
					cache: false
				});
		}

		$("a.file").click(function(){
			logFileClick("<?php 
                print $this->location->getDir(true, true, false, 0);
                ?>
" + $(this).html());
			return true;
		});
<?php 
            }
            if (EncodeExplorer::getConfig("thumbnails") == true && $this->mobile == false) {
                ?>
		function positionThumbnail(e) {
			xOffset = 30;
			yOffset = 10;
			$("#thumb").css("left",(e.clientX + xOffset) + "px");

			diff = 0;
			if(e.clientY + $("#thumb").height() > $(window).height())
				diff = e.clientY + $("#thumb").height() - $(window).height();

			$("#thumb").css("top",(e.pageY - yOffset - diff) + "px");
		}

		$("a.thumb").hover(function(e){
			$("#thumb").remove();
			$("body").append("<div id=\"thumb\"><img src=\"?thumb="+ $(this).attr("href") +"\" alt=\"Preview\" \/><\/div>");
			positionThumbnail(e);
			$("#thumb").fadeIn("medium");
		},
		function(){
			$("#thumb").remove();
		});

		$("a.thumb").mousemove(function(e){
			positionThumbnail(e);
			});

		$("a.thumb").click(function(e){$("#thumb").remove(); return true;});
<?php 
            }
            ?>
	});
//]]>
</script>
<?php 
        }
        ?>
<title><?php 
        if (EncodeExplorer::getConfig('main_title') != null) {
            print EncodeExplorer::getConfig('main_title');
        }
        ?>
</title>
</head>
<body class="<?php 
        print $this->mobile == true ? "mobile" : "standard";
        ?>
">
<?php 
        //
        // Print the error (if there is something to print)
        //
        if (isset($_ERROR) && strlen($_ERROR) > 0) {
            print "<div id=\"error\">" . $_ERROR . "</div>";
        }
        ?>
<div id="frame">
<?php 
        if (EncodeExplorer::getConfig('show_top') == true) {
            ?>
<div id="top">
	<a href="<?php 
            print $this->makeLink(false, false, null, null, null, "");
            ?>
"><span><?php 
            if (EncodeExplorer::getConfig('main_title') != null) {
                print EncodeExplorer::getConfig('main_title');
            }
            ?>
</span></a>
<?php 
            if (EncodeExplorer::getConfig("secondary_titles") != null && is_array(EncodeExplorer::getConfig("secondary_titles")) && count(EncodeExplorer::getConfig("secondary_titles")) > 0 && $this->mobile == false) {
                $secondary_titles = EncodeExplorer::getConfig("secondary_titles");
                print "<div class=\"subtitle\">" . $secondary_titles[array_rand($secondary_titles)] . "</div>\n";
            }
            ?>
</div>
<?php 
        }
        // Checking if the user is allowed to access the page, otherwise showing the login box
        if (!GateKeeper::isAccessAllowed()) {
            $this->printLoginBox();
        } else {
            if ($this->mobile == false && EncodeExplorer::getConfig("show_path") == true) {
                ?>
<div class="breadcrumbs">
<a href="?dir="><?php 
                print $this->getString("root");
                ?>
</a>
<?php 
                for ($i = 0; $i < count($this->location->path); $i++) {
                    print "&gt; <a href=\"" . $this->makeLink(false, false, null, null, null, $this->location->getDir(false, true, false, count($this->location->path) - $i - 1)) . "\">";
                    print $this->location->getPathLink($i, true);
                    print "</a>\n";
                }
                ?>
</div>
<?php 
            }
            ?>

<!-- START: List table -->
<table class="table">
<?php 
            if ($this->mobile == false) {
                ?>
<tr class="row one header">
	<td class="icon"> </td>
	<td class="name"><?php 
                print $this->makeArrow("name");
                ?>
</td>
	<td class="size"><?php 
                print $this->makeArrow("size");
                ?>
</td>
	<td class="changed"><?php 
                print $this->makeArrow("mod");
                ?>
</td>
	<?php 
                if ($this->mobile == false && GateKeeper::isDeleteAllowed()) {
                    ?>
	<td class="del"><?php 
                    print EncodeExplorer::getString("del");
                    ?>
</td>
	<?php 
                }
                ?>
</tr>
<?php 
            }
            ?>
<tr class="row two">
	<td class="icon"><img alt="dir" src="?img=directory" /></td>
	<td colspan="<?php 
            print $this->mobile == true ? 1 : (GateKeeper::isDeleteAllowed() ? 4 : 3);
            ?>
" class="long">
		<a class="item" href="<?php 
            print $this->makeLink(false, false, null, null, null, $this->location->getDir(false, true, false, 1));
            ?>
">..</a>
	</td>
</tr>
<?php 
            //
            // Ready to display folders and files.
            //
            $row = 1;
            //
            // Folders first
            //
            if ($this->dirs) {
                foreach ($this->dirs as $dir) {
                    $row_style = $row ? "one" : "two";
                    print "<tr class=\"row " . $row_style . "\">\n";
                    print "<td class=\"icon\"><img alt=\"dir\" src=\"?img=directory\" /></td>\n";
                    print "<td class=\"name\" colspan=\"" . ($this->mobile == true ? 1 : 2) . "\">\n";
                    print "<a href=\"" . $this->makeLink(false, false, null, null, null, $this->location->getDir(false, true, false, 0) . $dir->getNameEncoded()) . "\" class=\"item dir\">";
                    print $dir->getNameHtml();
                    print "</a>\n";
                    print "</td>\n";
                    if ($this->mobile != true) {
                        print "<td class=\"changed\">" . $this->formatModTime($dir->getModTime()) . "</td>\n";
                    }
                    if ($this->mobile == false && GateKeeper::isDeleteAllowed()) {
                        print "<td class=\"del\"><a data-name=\"" . htmlentities($dir->getName()) . "\" href=\"" . $this->makeLink(false, false, null, null, $this->location->getDir(false, true, false, 0) . $dir->getNameEncoded(), $this->location->getDir(false, true, false, 0)) . "\"><img src=\"?img=del\" alt=\"Delete\" /></a></td>";
                    }
                    print "</tr>\n";
                    $row = !$row;
                }
            }
            //
            // Now the files
            //
            if ($this->files) {
                $count = 0;
                foreach ($this->files as $file) {
                    $row_style = $row ? "one" : "two";
                    print "<tr class=\"row " . $row_style . (++$count == count($this->files) ? " last" : "") . "\">\n";
                    print "<td class=\"icon\"><img alt=\"" . $file->getType() . "\" src=\"" . $this->makeIcon($file->getType()) . "\" /></td>\n";
                    print "<td class=\"name\" colspan=\"1\">\n";
                    print "\t\t<a href=\"" . $this->location->getDir(false, true, false, 0) . $file->getNameEncoded() . "\"";
                    if (EncodeExplorer::getConfig('open_in_new_window') == true) {
                        print "target=\"_blank\"";
                    }
                    print " class=\"item file";
                    if ($file->isValidForThumb()) {
                        print " thumb";
                    }
                    print "\">";
                    print $file->getNameHtml();
                    if ($this->mobile == true) {
                        print "<span class =\"size\">" . $this->formatSize($file->getSize()) . "</span>";
                    }
                    print "</a>\n";
                    print "</td>\n";
                    if ($this->mobile != true) {
                        print "<td class=\"size\">" . $this->formatSize($file->getSize()) . "</td>\n";
                        print "<td class=\"changed\">" . $this->formatModTime($file->getModTime()) . "</td>\n";
                    }
                    if ($this->mobile == false && GateKeeper::isDeleteAllowed()) {
                        print "<td class=\"del\">\n\t\t\t\t<a data-name=\"" . htmlentities($file->getName()) . "\" href=\"" . $this->makeLink(false, false, null, null, $this->location->getDir(false, true, false, 0) . $file->getNameEncoded(), $this->location->getDir(false, true, false, 0)) . "\">\n\t\t\t\t\t<img src=\"?img=del\" alt=\"Delete\" />\n\t\t\t\t</a>\n\t\t\t</td>";
                    }
                    print "</tr>\n";
                    $row = !$row;
                }
            }
            //
            // The files and folders have been displayed
            //
            ?>

</table>
<!-- END: List table -->
<?php 
        }
        ?>
</div>

<?php 
        if (GateKeeper::isAccessAllowed() && GateKeeper::showLoginBox()) {
            ?>
<!-- START: Login area -->
<form enctype="multipart/form-data" method="post">
	<div id="login_bar">
	<?php 
            print $this->getString("username");
            ?>
:
	<input type="text" name="user_name" value="" id="user_name" />
	<?php 
            print $this->getString("password");
            ?>
:
	<input type="password" name="user_pass" id="user_pass" />
	<input type="submit" class="submit" value="<?php 
            print $this->getString("log_in");
            ?>
" />
	<div class="bar"></div>
	</div>
</form>
<!-- END: Login area -->
<?php 
        }
        if (GateKeeper::isAccessAllowed() && $this->location->uploadAllowed() && (GateKeeper::isUploadAllowed() || GateKeeper::isNewdirAllowed())) {
            ?>
<!-- START: Upload area -->
<form enctype="multipart/form-data" method="post">
	<div id="upload">
		<?php 
            if (GateKeeper::isNewdirAllowed()) {
                ?>
		<div id="newdir_container">
			<input name="userdir" type="text" class="upload_dirname" />
			<input type="submit" value="<?php 
                print $this->getString("make_directory");
                ?>
" />
		</div>
		<?php 
            }
            if (GateKeeper::isUploadAllowed()) {
                ?>
		<div id="upload_container">
			<input name="userfile" type="file" class="upload_file" />
			<input type="submit" value="<?php 
                print $this->getString("upload");
                ?>
" class="upload_sumbit" />
		</div>
		<?php 
            }
            ?>
		<div class="bar"></div>
	</div>
</form>
<!-- END: Upload area -->
<?php 
        }
        ?>
<!-- START: Info area -->
<div id="info">
<?php 
        if (GateKeeper::isUserLoggedIn()) {
            print "<a href=\"" . $this->makeLink(false, true, null, null, null, "") . "\">" . $this->getString("log_out") . "</a> | ";
        }
        if (EncodeExplorer::getConfig("mobile_enabled") == true) {
            print "<a href=\"" . $this->makeLink(true, false, null, null, null, $this->location->getDir(false, true, false, 0)) . "\">\n";
            print $this->mobile == true ? $this->getString("standard_version") : $this->getString("mobile_version") . "\n";
            print "</a> | \n";
        }
        if (GateKeeper::isAccessAllowed() && $this->getConfig("calculate_space_level") > 0 && $this->mobile == false) {
            print $this->getString("total_used_space") . ": " . $this->spaceUsed . " MB | ";
        }
        if ($this->mobile == false && $this->getConfig("show_load_time") == true) {
            printf($this->getString("page_load_time") . " | ", (microtime(TRUE) - $_START_TIME) * 1000);
        }
        ?>
<a href="http://encode-explorer.siineiolekala.net">Encode Explorer</a>
</div>
<!-- END: Info area -->
</body>
</html>

<?php 
    }
Esempio n. 5
0
$_IMAGES["wmv"] = $_IMAGES["video"];
$_IMAGES["xcf"] = $_IMAGES["graphics"];
$_IMAGES["xls"] = $_IMAGES["spreadsheet"];
$_IMAGES["xlsx"] = $_IMAGES["spreadsheet"];
$_IMAGES["xml"] = $_IMAGES["code"];
$_IMAGES["zip"] = $_IMAGES["archive"];
require "inc/EncodeExplorer.php";
require "inc/Dir.php";
require "inc/FileManager.php";
require "inc/File.php";
require "inc/GateKeeper.php";
require "inc/ImageServer.php";
require "inc/Location.php";
require "inc/Logger.php";
//
// This is where the system is activated.
// We check if the user wants an image and show it. If not, we show the explorer.
//
$encodeExplorer = new EncodeExplorer();
$encodeExplorer->init();
GateKeeper::init();
if (!ImageServer::showImage() && !Logger::logQuery()) {
    $location = new Location();
    $location->init();
    if (GateKeeper::isAccessAllowed()) {
        Logger::logAccess($location->getDir(true, false, false, 0), true);
        $fileManager = new FileManager();
        $fileManager->run($location);
    }
    $encodeExplorer->run($location);
}
Esempio n. 6
0
 public static function install(array $options = array())
 {
     $options['install_model'] = array_key_exists('install_model', $options) ? $options['install_model'] : false;
     $toret = parent::install($options);
     foreach (self::getDefaults() as $permit) {
         GateKeeper::permit($permit['role'], $permit['action'], $permit['subject'], $permit['subject_id'], $permit['control']);
         if (Controller::$debug) {
             Backend::addSuccess('Added permission to ' . $permit['action'] . ' to ' . $permit['role']);
         }
     }
     return $toret;
 }
 public static function showLoginBox()
 {
     if (!GateKeeper::isUserLoggedIn() && count(EncodeExplorer::getConfig("users")) > 0) {
         return true;
     }
     return false;
 }
Esempio n. 8
0
 function run($location)
 {
     if (isset($_POST['userdir']) && strlen($_POST['userdir']) > 0) {
         if ($location->uploadAllowed() && GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isNewdirAllowed()) {
             $this->newFolder($location, $_POST['userdir']);
         }
     }
     if (isset($_FILES['userfile']['name']) && strlen($_FILES['userfile']['name']) > 0) {
         if ($location->uploadAllowed() && GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isUploadAllowed()) {
             $this->uploadFile($location, $_FILES['userfile']);
         }
     }
     if (isset($_GET['del'])) {
         if (GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isDeleteAllowed()) {
             $split_path = Location::splitPath($_GET['del']);
             $path = "";
             for ($i = 0; $i < count($split_path); $i++) {
                 $path .= $split_path[$i];
                 if ($i + 1 < count($split_path)) {
                     $path .= "/";
                 }
             }
             if ($path == "" || $path == "/" || $path == "\\" || $path == ".") {
                 return;
             }
             if (is_dir($path)) {
                 FileManager::delete_dir($path);
             } else {
                 if (is_file($path)) {
                     FileManager::delete_file($path);
                 }
             }
         }
     }
 }
Esempio n. 9
0
 public function post_roles($userId)
 {
     $roles = Controller::getVar('roles');
     if (is_array($roles)) {
         foreach ($roles as $role) {
             if (GateKeeper::assign($role, 'users', $userId)) {
                 Backend::addSuccess('Added User to ' . $role);
             } else {
                 Backend::addError('Could not add User to ' . $role);
             }
         }
     }
     Controller::redirect();
 }
Esempio n. 10
0
<?php

/**
* Redirect User
*/
// check if any folder is assigned to the current user
if ($gateKeeper->isAccessAllowed() && $gateKeeper->getUserInfo('dir') !== null) {
    $userpatharray = array();
    $userpatharray = json_decode(GateKeeper::getUserInfo('dir'), true);
    // check if user has only one folder
    if (count($userpatharray) === 1) {
        $cleandir = substr($setUp->getConfig('starting_dir') . $userpatharray[0], 2);
        // check if user is trying to access to the root
        if (!isset($_GET['dir']) || strlen($_GET['dir']) < strlen($cleandir)) {
            ?>
            <script type="text/javascript">
                window.location.replace("?dir=<?php 
            echo $cleandir;
            ?>
");
            </script>                   
    <?php 
        }
    }
}
Esempio n. 11
0
    function outputHtml()
    {
        global $_ERROR;
        global $_START_TIME;
        ?>

<!DOCTYPE HTML>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
        print $this->getConfig('lang');
        ?>
" lang="<?php 
        print $this->getConfig('lang');
        ?>
">

<head>

<meta name="viewport" content="width=device-width" />

<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        print $this->getConfig('charset');
        ?>
">

<!-- <link rel="stylesheet" type="text/css" media="screen" href="localhost.css" /> -->


<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
            CSS
     ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

<style type="text/css">
    body
{
    background-color:#FFF;
    background-image: url("bg.jpg");  no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    font-family:Verdana;
    font-size:small
}

a
{
    color:#232323;
    text-decoration:none;
    display:block
}

a:hover
{
    text-decoration:underline
}

#top
{
    width:100%;
    padding-bottom:20px;
    background:none repeat scroll 0 0 #B6B7C6;
    text-align: center;

}

/*#top a span,#top a:hover,#top a span:hover
{
    color:#4493C4;
    text-align:center;
    font-size:large
}

#top a
{
    display:block;
    padding:20px 0 0
}

#top span
{
    display:block;
    letter-spacing:9px
}*/

div.subtitle
{
    width:80%;
    margin:0 auto;
    color:#68a9d2;
    text-align:center;
}

#frame
{
    background-color:#F2F2F2;
    border:1px solid #CDD2D6;
    margin:0 auto;
    max-width: 1010px;
    opacity: 0.8;
    /*overflow: auto;*/
    text-align:left;

    /*position: absolute;*/
    /*top: 10%;*/
    height: 90%;
    left: 8%;
    width: 80%;

}

#error
{
    max-width:450px;
    background-color:#FFE4E1;
    color:#000;
    padding:7pt;
    position:relative;
    margin:10pt auto;
    text-align:center;
    border:1px dotted #CDD2D6
}

input
{
    border:1px solid #CDD2D6
}

.bar
{
    width:100%;
    clear:both;
    height:1px
}

/* File list */
table.table
{
    width:100%;
    border-collapse:collapse
}

table.table td
{
    padding:3px;
    width:200px
}

table.table tr.row.two
{
    background-color:#c2c2c2;
    width:200px;
    float:left
}

table.table tr.row.one
{
    background-color:#c2c2c2;
    width:200px;
    float:left
}

table.table tr.row td.icon
{
    width:25px;
    padding-top:3px;
    padding-bottom:1px
}

table.table td.del
{
    width:25px
}

table.table tr.row td.size
{
    width:100px;
    text-align:right
}

table.table tr.row td.changed
{
    width:150px;
    text-align:center
}

table.table tr.header img
{
    vertical-align:bottom
}

table.table tr.row:hover
{
    background-color:#eee
}

table.table tr.row a:hover
{
    color:#EF4646;
    text-decoration:none
}

table img
{
    border:0
}

table.table tr
{
    margin-bottom:5px
}

/* Info area */
#info
{
    color:#000;
    font-family:Verdana;
    max-width:680px;
    position:relative;
    margin:0 auto;
    text-align:center
}

/* Thumbnail area */
#thumb
{
    position:absolute;
    border:1px solid #CDD2D6;
    background:#f8f9fa;
    display:none;
    padding:3px
}

#thumb img
{
    display:block
}

/* Login bar (at the bottom of the page) */
#login_bar
{
    margin:0 auto;
    margin-top:2px;
    max-width:680px
}

#login_bar input.submit
{
    float:right
}

/* Upload area */
#upload
{
    margin:0 auto;
    margin-top:2px;
    max-width:680px
}

#upload #password_container
{
    margin-right:20px
}

#upload #newdir_container,#upload #password_container
{
    float:left
}

#upload #upload_container
{
    float:right
}

#upload input.upload_dirname,#upload input.upload_password
{
    width:140px
}

#upload input.upload_file
{
    font-size:small
}

/* Breadcrumbs */
div.breadcrumbs
{
    display:block;
    padding:1px 3px;
    color:#676767;
    font-size:x-small
}

div.breadcrumbs a
{
    display:inline-block;
    color:#949494;
    padding:2px 0;
    font-size:small
}

/* Login area */
#login
{
    max-width:280px;
    text-align:right;
    margin:15px auto 50px
}

#login div
{
    display:block;
    width:100%;
    margin-top:5px
}

#login label
{
    width:120px;
    text-align:right
}

/* Mobile interface */
body.mobile #frame,body.mobile #info,body.mobile #upload
{
    max-width:none
}

body.mobile
{
    font-size:medium
}

body.mobile a.item
{
    display:block;
    padding:10px 0
}

body.mobile a.item span.size
{
    float:right;
    margin-left:10px
}

body.mobile table.table
{
    margin-bottom:30px
}

body.mobile table.table tr td
{
    border-top:1px solid #CDD2D6
}

body.mobile table.table tr.last td
{
    border-bottom:1px solid #CDD2D6
}

body.mobile #top
{
    padding-bottom:3px
}

body.mobile #top a
{
    padding-top:3px
}

body.mobile #upload #password_container,body.mobile #upload #upload_container,body.mobile #upload #newdir_container
{
    float:none;
    margin-top:5px
}

body.mobile #upload input.upload_dirname,body.mobile #upload input.upload_password
{
    width:240px
}

body.mobile #upload
{
    margin-bottom:15px
}

/* ::::::: Footer
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
.keyboard_key,#footer,#top
{
    background-color:#EEE;
    background-image:-moz-linear-gradient(top,whiteSmoke 0,#EEE 100%);
    background-image:-ms-linear-gradient(top,whiteSmoke 0,#EEE 100%);
    background-image:-o-linear-gradient(top,whiteSmoke 0,#EEE 100%);
    background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0%,whiteSmoke),color-stop(100%,#eee));
    background-image:-webkit-linear-gradient(top,whiteSmoke 0,#EEE 100%);
    background-image:linear-gradient(top,whiteSmoke 0,#eee 100%);
    background-repeat:repeat-x;
    color:#555;
    display:inline-block;
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5',endColorstr='#eeeeee',GradientType=0);
    font-size:11px;
    height:25px;
    line-height:15px;
    width:20em;
    padding:0 4px;
    text-align:left;
    border:1px solid #CCC;
    -webkit-border-radius:3px;
    -moz-border-radius:3px;
    border-radius:3px;
    -webkit-box-shadow:inset 0 1px 0 white,0 1px 0 #CCC;
    -moz-box-shadow:inset 0 1px 0 #fff,0 1px 0 #ccc;
    box-shadow:inset 0 1px 0 white,0 1px 0 #CCC;
    margin-right:5px;
/* added by dean */
    cursor:pointer
}

.keyboard_key:hover
{
    background:#e9e9ce;
/* Old browsers */
    background-image:-moz-linear-gradient(top,#EEE 0,#B3B5A8 100%);
    background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#EEE),color-stop(100%,#B3B5A8));
    background-image:-webkit-linear-gradient(top,#EEE 0,#B3B5A8 100%);
    background-image:-ms-linear-gradient(top,#EEE 0,#B3B5A8 100%);
    background-image:-o-linear-gradient(top,#EEE 0,#B3B5A8 100%);
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee',endColorstr='#f5f5f5',GradientType=0);
    background-image:linear-gradient(top,eee 0,#B3B5A8 100%)
}

.keyboard_key a
{
    width:17em
}

.icon
{
    max-width:2em
}

.name,.header,.back
{
/*max-width: 200px;*/
}

.header,.back
{
/*min-width: 231px;*/
}

#frame
{
    max-width:90%;
    padding:1.7%
}

#footer
{
    text-align:center;
    margin:0 40%;
    line-height:25px;
    background-image:-moz-linear-gradient(center top,#D2D2D2,#939393);
    background-image:-ms-linear-gradient(top,#D2D2D2,#939393);
    background-image:-o-linear-gradient(top,#D2D2D2,#939393);
    background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#D2D2D2),to(#939393));
    background-image:-webkit-linear-gradient(top,#D2D2D2,#939393);
    min-width:20%
}

#top
{
    background-image:-moz-linear-gradient(center top,#FAFAFA 0px,#FFF 100%);
    background-image:-ms-linear-gradient(top,#FAFAFA,#FFF);
    background-image:-o-linear-gradient(top,#FAFAFA,#FFF);
    background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#FAFAFA),to(#FFF));
    background-image:-webkit-linear-gradient(top,#FAFAFA,#FFF);
    margin-bottom:20px;
    width:97%;
    text-align: center;
    font-size: 1.4em;
}

#top a
{
    display:block;
    padding:0
}
#top .tl {
    position: relative;
    top: -7px;
    color: #BFC0CB;
}
.stylesHtml
{
    background-color:#E6EDF9;
    background-image:-moz-linear-gradient(top,#E6EDF9,#DAE5F5);
    background-image:-ms-linear-gradient(top,#E6EDF9,#DAE5F5);
    background-image:-o-linear-gradient(top,#E6EDF9,#DAE5F5);
    background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#E6EDF9),to(#DAE5F5));
    background-image:-webkit-linear-gradient(top,#E6EDF9,#DAE5F5)
}

.stylesIndex
{
    background-color:#BAC1CD;
    background-image:-moz-linear-gradient(top,#BAC1CD,#D1D7DE);
    background-image:-ms-linear-gradient(top,#BAC1CD,#D1D7DE);
    background-image:-o-linear-gradient(top,#BAC1CD,#D1D7DE);
    background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#BAC1CD),to(#D1D7DE));
    background-image:-webkit-linear-gradient(top,#BAC1CD,#D1D7DE)
}


/* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: *\
            Camios
\* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */

#frame {
    max-width: 90%;
    padding: 1.7%;
}


</style>



<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
            END CSS
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>

<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
            JS
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

<script type="text/javascript">
 $(document).ready(function() {
    $("tr td:contains('.html')").parent().addClass('stylesHtml');
    $("tr td:contains('index')").parent().addClass('stylesIndex');
});
</script>

<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
            END JS
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->


<!-- <meta charset="<?php 
        print $this->getConfig('charset');
        ?>
" /> -->

<?php 
        if ($this->getConfig('log_file') != null && strlen($this->getConfig('log_file')) > 0 || $this->getConfig('thumbnails') != null && $this->getConfig('thumbnails') == true && $this->mobile == false || GateKeeper::isDeleteAllowed()) {
            ?>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>

<script type="text/javascript">

//<![CDATA[

$(document).ready(function() {

<?php 
            if (GateKeeper::isDeleteAllowed()) {
                ?>

    $('td.del a').click(function(){

        var answer = confirm('Are you sure you want to delete : \'' + $(this).attr("data-name") + "\' ?");

        return answer;

    });

<?php 
            }
            if ($this->logging == true) {
                ?>

        function logFileClick(path)

        {

             $.ajax({

                    async: false,

                    type: "POST",

                    data: {log: path},

                    contentType: "application/x-www-form-urlencoded; charset=UTF-8",

                    cache: false

                });

        }



        $("a.file").click(function(){

            logFileClick("<?php 
                print $this->location->getDir(true, true, false, 0);
                ?>
" + $(this).html());

            return true;

        });

<?php 
            }
            if (EncodeExplorer::getConfig("thumbnails") == true && $this->mobile == false) {
                ?>

        function positionThumbnail(e) {

            xOffset = 30;

            yOffset = 10;

            $("#thumb").css("left",(e.clientX + xOffset) + "px");



            diff = 0;

            if(e.clientY + $("#thumb").height() > $(window).height())

                diff = e.clientY + $("#thumb").height() - $(window).height();



            $("#thumb").css("top",(e.pageY - yOffset - diff) + "px");

        }



        $("a.thumb").hover(function(e){

            $("#thumb").remove();

            $("body").append("<div id=\"thumb\"><img src=\"?thumb="+ $(this).attr("href") +"\" alt=\"Preview\" \/><\/div>");

            positionThumbnail(e);

            $("#thumb").fadeIn("medium");

        },

        function(){

            $("#thumb").remove();

        });



        $("a.thumb").mousemove(function(e){

            positionThumbnail(e);

            });



        $("a.thumb").click(function(e){$("#thumb").remove(); return true;});

<?php 
            }
            ?>

    });

//]]>

</script>

<?php 
        }
        ?>

<title><?php 
        if (EncodeExplorer::getConfig('main_title') != null) {
            print EncodeExplorer::getConfig('main_title');
        }
        ?>
</title>

</head>

<body class="<?php 
        print $this->mobile == true ? "mobile" : "standard";
        ?>
">

<?php 
        //
        // Print the error (if there is something to print)
        //
        if (isset($_ERROR) && strlen($_ERROR) > 0) {
            print "<div id=\"error\">" . $_ERROR . "</div>";
        }
        ?>

<div id="frame">

<?php 
        if (EncodeExplorer::getConfig('show_top') == true) {
            ?>

    <div id="top">
        <img src="localhost.jpg" alt="">
        <span class="tl">Mayccoll</span>


        <a href="<?php 
            // print $this->makeLink(false, false, null, null, null, "");
            ?>
"><span><?php 
            // if (EncodeExplorer::getConfig('main_title') != null)
            // print EncodeExplorer::getConfig('main_title');
            ?>
</span>
        </a>



    <?php 
            if (EncodeExplorer::getConfig("secondary_titles") != null && is_array(EncodeExplorer::getConfig("secondary_titles")) && count(EncodeExplorer::getConfig("secondary_titles")) > 0 && $this->mobile == false) {
                $secondary_titles = EncodeExplorer::getConfig("secondary_titles");
                print "<div class=\"subtitle\">" . $secondary_titles[array_rand($secondary_titles)] . "</div>\n";
            }
            ?>

    </div>
<div id="footer">
    <a href="phpmyadmin" target="_BLANK">phpmyadmin</a>
</div>
<?php 
        }
        // Checking if the user is allowed to access the page, otherwise showing the login box
        if (!GateKeeper::isAccessAllowed()) {
            $this->printLoginBox();
        } else {
            if ($this->mobile == false && EncodeExplorer::getConfig("show_path") == true) {
                ?>

    <div class="breadcrumbs">

    <a href="?dir="><?php 
                print $this->getString("root");
                ?>
</a>

    <?php 
                for ($i = 0; $i < count($this->location->path); $i++) {
                    print "&gt; <a href=\"" . $this->makeLink(false, false, null, null, null, $this->location->getDir(false, true, false, count($this->location->path) - $i - 1)) . "\">";
                    print $this->location->getPathLink($i, true);
                    print "</a>\n";
                }
                ?>

    </div>

<?php 
            }
            ?>



<!-- START: List table -->

<table class="table">

<?php 
            if ($this->mobile == false) {
                ?>

<tr class="header keyboard_key">
    <td class="icon">
        <img src="?img=directoryHome" alt="dir">
    </td>
    <td class="name">
        <?php 
                //print $this->makeArrow("name");
                ?>
        <a href="
            <?php 
                print $this->makeLink(false, false, null, null, null, "");
                ?>
        ">
            <span>
                <?php 
                if (EncodeExplorer::getConfig('main_title') != null) {
                    print EncodeExplorer::getConfig('main_title');
                }
                ?>
            </span>
        </a>
    </td>
    <td class="size">
        <?php 
                //print $this->makeArrow("size");
                ?>
    </td>
    <td class="changed">
        <?php 
                //print $this->makeArrow("mod");
                ?>
    </td>


    <?php 
                if ($this->mobile == false && GateKeeper::isDeleteAllowed()) {
                    ?>
    <td class="del">
        <?php 
                    // print EncodeExplorer::getString("del");
                    ?>
    </td>
    <?php 
                }
                ?>
</tr>

<?php 
            }
            ?>

<tr class="back keyboard_key">

    <td class="icon"><img alt="dir" src="?img=directory" /></td>

    <td colspan="<?php 
            print $this->mobile == true ? 2 : (GateKeeper::isDeleteAllowed() ? 4 : 3);
            ?>
" class="long">

        <a class="item" href="<?php 
            print $this->makeLink(false, false, null, null, null, $this->location->getDir(false, true, false, 1));
            ?>
">..</a>

    </td>

</tr>

<?php 
            //
            // Ready to display folders and files.
            //
            $row = 1;
            //
            // Folders first
            //
            if ($this->dirs) {
                foreach ($this->dirs as $dir) {
                    $row_style = $row ? "" : "";
                    print "<tr class=\" keyboard_key" . $row_style . "\">\n";
                    print "<td class=\"icon\"><img alt=\"dir\" src=\"?img=directory\" /></td>\n";
                    print "<td class=\"name\" colspan=\"" . ($this->mobile == true ? 2 : 3) . "\">\n";
                    print "<a href=\"" . $this->makeLink(false, false, null, null, null, $this->location->getDir(false, true, false, 0) . $dir->getNameEncoded()) . "\" class=\"item dir\">";
                    print $dir->getNameHtml();
                    print "</a>\n";
                    print "</td>\n";
                    if ($this->mobile == false && GateKeeper::isDeleteAllowed()) {
                        print "<td class=\"del\"><a data-name=\"" . htmlentities($dir->getName()) . "\" href=\"" . $this->makeLink(false, false, null, null, $this->location->getDir(false, true, false, 0) . $dir->getNameEncoded(), $this->location->getDir(false, true, false, 0)) . "\"><img src=\"?img=del\" alt=\"Delete\" /></a></td>";
                    }
                    print "</tr>\n";
                    $row = !$row;
                }
            }
            //
            // Now the files
            //
            if ($this->files) {
                $count = 0;
                foreach ($this->files as $file) {
                    $row_style = $row ? "" : "";
                    print "<tr class=\" keyboard_key" . $row_style . (++$count == count($this->files) ? " last" : "") . "\">\n";
                    print "<td class=\"icon\"><img alt=\"" . $file->getType() . "\" src=\"" . $this->makeIcon($file->getType()) . "\" /></td>\n";
                    print "<td class=\"name\">\n";
                    print "\t\t<a href=\"" . $this->location->getDir(false, true, false, 0) . $file->getNameEncoded() . "\"";
                    if (EncodeExplorer::getConfig('open_in_new_window') == true) {
                        print "target=\"_blank\"";
                    }
                    print " class=\"item file";
                    if ($file->isValidForThumb()) {
                        print " thumb";
                    }
                    print "\">";
                    print $file->getNameHtml();
                    if ($this->mobile == true) {
                        //print "<span class =\"size\">".$this->formatSize($file->getSize())."</span>";
                    }
                    print "</a>\n";
                    print "</td>\n";
                    if ($this->mobile != true) {
                        //print "<td class=\"size\">".$this->formatSize($file->getSize())."</td>\n";
                        //print "<td class=\"changed\">".$this->formatModTime($file->getModTime())."</td>\n";
                    }
                    if ($this->mobile == false && GateKeeper::isDeleteAllowed()) {
                        print "<td class=\"del\">\n\n                <a data-name=\"" . htmlentities($file->getName()) . "\" href=\"" . $this->makeLink(false, false, null, null, $this->location->getDir(false, true, false, 0) . $file->getNameEncoded(), $this->location->getDir(false, true, false, 0)) . "\">\n\n                    <img src=\"?img=del\" alt=\"Delete\" />\n\n                </a>\n\n            </td>";
                    }
                    print "</tr>\n";
                    $row = !$row;
                }
            }
            //
            // The files and folders have been displayed
            //
            ?>



</table>


<!-- END: List table

<?php 
        }
        ?>

</div> <!-- END frame -->



<?php 
        if (GateKeeper::isAccessAllowed() && GateKeeper::showLoginBox()) {
            ?>

<!-- START: Login area -->

<form enctype="multipart/form-data" method="post">

    <div id="login_bar">

    <?php 
            print $this->getString("username");
            ?>
:

    <input type="text" name="user_name" value="" id="user_name" />

    <?php 
            print $this->getString("password");
            ?>
:

    <input type="password" name="user_pass" id="user_pass" />

    <input type="submit" class="submit" value="<?php 
            print $this->getString("log_in");
            ?>
" />

    <div class="bar"></div>

    </div>

</form>

<!-- END: Login area -->

<?php 
        }
        if (GateKeeper::isAccessAllowed() && $this->location->uploadAllowed() && (GateKeeper::isUploadAllowed() || GateKeeper::isNewdirAllowed())) {
            ?>

<!-- START: Upload area -->

<form enctype="multipart/form-data" method="post">

    <div id="upload">

        <?php 
            if (GateKeeper::isNewdirAllowed()) {
                ?>

        <div id="newdir_container">

            <input name="userdir" type="text" class="upload_dirname" />

            <input type="submit" value="<?php 
                print $this->getString("make_directory");
                ?>
" />

        </div>

        <?php 
            }
            if (GateKeeper::isUploadAllowed()) {
                ?>

        <div id="upload_container">

            <input name="userfile" type="file" class="upload_file" />

            <input type="submit" value="<?php 
                print $this->getString("upload");
                ?>
" class="upload_sumbit" />

        </div>

        <?php 
            }
            ?>

        <div class="bar"></div>

    </div>

</form>

<!-- END: Upload area -->

<?php 
        }
        ?>

<!-- START: Info area -->

<!--

<div id="info">

<?php 
        if (GateKeeper::isUserLoggedIn()) {
            print "<a href=\"" . $this->makeLink(false, true, null, null, null, "") . "\">" . $this->getString("log_out") . "</a> | ";
        }
        if (EncodeExplorer::getConfig("mobile_enabled") == true) {
            print "<a href=\"" . $this->makeLink(true, false, null, null, null, $this->location->getDir(false, true, false, 0)) . "\">\n";
            print $this->mobile == true ? $this->getString("standard_version") : $this->getString("mobile_version") . "\n";
            print "</a> | \n";
        }
        if (GateKeeper::isAccessAllowed() && $this->getConfig("calculate_space_level") > 0 && $this->mobile == false) {
            print $this->getString("total_used_space") . ": " . $this->spaceUsed . " MB | ";
        }
        if ($this->mobile == false && $this->getConfig("show_load_time") == true) {
            printf($this->getString("page_load_time") . " | ", (microtime(TRUE) - $_START_TIME) * 1000);
        }
        ?>

<a href="http://encode-explorer.siineiolekala.net">Encode Explorer</a>

</div>

-->

<!-- END: Info area -->


</body>
</html>


<?php 
    }
Esempio n. 12
0
session_name($_CONFIG["session_name"]);
session_start();
require 'users.php';
require 'class.php';
$timeconfig = $_CONFIG['default_timezone'];
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
$chunk = new Chunk();
$encodeExplorer = new EncodeExplorer();
if (isset($_SESSION['lang'])) {
    $lang = $_SESSION['lang'];
} else {
    $lang = SetUp::getConfig("lang");
}
require "translations/" . $lang . ".php";
$gateKeeper = new GateKeeper();
if ($gateKeeper->isAccessAllowed() && $gateKeeper->isAllowed('upload_enable')) {
    if ($_SERVER['REQUEST_METHOD'] === 'GET') {
        if ($_GET['resumableChunkNumber'] == 1) {
            $firstChunk = true;
        } else {
            $firstChunk = false;
        }
        $resumabledata = $chunk->setupFilename($_GET['resumableFilename'], $_GET['resumableIdentifier']);
        $resumableFilename = $resumabledata['filename'];
        $extension = $resumabledata['extension'];
        $basename = $resumabledata['basename'];
        $fullfilepath = $_GET['loc'] . $resumableFilename;
        if (Utils::notList($extension, SetUp::getConfig("upload_allow_type")) == true || Utils::inList($extension, SetUp::getConfig("upload_reject_extension")) == true || Utils::inList($resumableFilename, array('.htaccess', '.htpasswd', '.ftpquota')) == true || substr($resumableFilename, 0, 1) === ".") {
            if ($_GET['resumableChunkNumber'] == 1) {
                $chunk->setError("<span><i class=\"fa fa-exclamation-triangle\"></i> " . $basename . "<strong>." . $extension . "</strong> " . SetUp::getLangString("upload_type_not_allowed") . "</span> ");
Esempio n. 13
0
<?php

require_once 'config.php';
require_once 'users.php';
require_once 'class.php';
require_once 'remember.php';
$cookies = new Cookies();
$encodeExplorer = new EncodeExplorer();
$encodeExplorer->init();
$gateKeeper = new GateKeeper();
$gateKeeper->init();
$setUp = new SetUp();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
$downloader = new Downloader();
$utils = new Utils();
$logger = new Logger();
$actions = new Actions();
$getcloud = $_POST["setdel"];
$hash = filter_input(INPUT_POST, "h", FILTER_SANITIZE_STRING);
$doit = filter_input(INPUT_POST, "doit", FILTER_SANITIZE_STRING);
$time = filter_input(INPUT_POST, "t", FILTER_SANITIZE_STRING);
if ($doit != $time * 12) {
    die('Direct access not permitted');
}
$alt = $setUp->getConfig('salt');
$altone = $setUp->getConfig('session_name');
if ($hash && $time && $gateKeeper->isUserLoggedIn() && $gateKeeper->isAllowed('delete_enable')) {
    if (md5($alt . $time) === $hash && $downloader->checkTime($time) == true) {
        foreach ($getcloud as $pezzo) {
Esempio n. 14
0
    file_put_contents('doc-admin/users.php', "<?php\n\n {$usr}" . var_export($_USERS, true) . ";\n");
}
global $_ERROR;
global $_WARNING;
global $_SUCCESS;
global $_IMAGES;
global $_USERS;
global $_DLIST;
require_once 'doc-admin/remember.php';
global $_REMEMBER;
$cookies = new Cookies();
$encodeExplorer = new EncodeExplorer();
$encodeExplorer->init();
require_once 'doc-admin/translations/' . $encodeExplorer->lang . '.php';
global $_TRANSLATIONS;
$gateKeeper = new GateKeeper();
$gateKeeper->init();
$setUp = new SetUp();
$location = new Location();
$location->init();
$downloader = new Downloader();
$updater = new Updater();
$updater->init();
$template = new Template();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
require_once 'doc-admin/token.php';
global $_TOKENS;
$resetter = new Resetter();
$resetter->init();
Esempio n. 15
0
<?php

require_once 'config.php';
require_once 'users.php';
require_once 'class.php';
require_once 'remember.php';
$cookies = new Cookies();
$encodeExplorer = new EncodeExplorer();
$encodeExplorer->init();
require_once 'translations/' . $encodeExplorer->lang . '.php';
$gateKeeper = new GateKeeper();
$gateKeeper->init();
$setUp = new SetUp();
$downloader = new Downloader();
$utils = new Utils();
$logger = new Logger();
$actions = new Actions();
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
$script_url = $setUp->getConfig('script_url');
$getfile = filter_input(INPUT_GET, "q", FILTER_SANITIZE_STRING);
$getfilelist = filter_input(INPUT_GET, "dl", FILTER_SANITIZE_STRING);
$getcloud = filter_input(INPUT_GET, "d", FILTER_SANITIZE_STRING);
$hash = filter_input(INPUT_GET, "h", FILTER_SANITIZE_STRING);
$supah = filter_input(INPUT_GET, "sh", FILTER_SANITIZE_STRING);
$playmp3 = filter_input(INPUT_GET, "audio", FILTER_SANITIZE_STRING);
$getpass = filter_input(INPUT_GET, "pw", FILTER_SANITIZE_STRING);
if ($getpass) {
    $getpass = urldecode($getpass);
}
Esempio n. 16
0
 /**
  * Check if all the parts exist, and 
  * gather all the parts of the file together
  *
  * @param string $location  - the final location
  * @param string $temp_dir  - the temporary directory holding all the parts of the file
  * @param string $fileName  - the original file name
  * @param string $chunkSize - each chunk size (in bytes)
  * @param string $totalSize - original file size (in bytes)
  * @param string $logloc    - relative location for log file
  *
  * @return uploaded file
  */
 public function createFileFromChunks($location, $temp_dir, $fileName, $chunkSize, $totalSize, $logloc)
 {
     global $chunk;
     $upload_dir = str_replace('\\', '', $location);
     $extension = File::getFileExtension($fileName);
     // count all the parts of this file
     $total_files = 0;
     foreach (scandir($temp_dir) as $file) {
         if (stripos($file, $fileName) !== false) {
             $total_files++;
         }
     }
     $finalfile = FileManager::safeExtension($fileName, $extension);
     // check that all the parts are present
     // the size of the last part is between chunkSize and 2*$chunkSize
     if ($total_files * $chunkSize >= $totalSize - $chunkSize + 1) {
         // create the final file
         if (($openfile = fopen($upload_dir . $finalfile, 'w')) !== false) {
             for ($i = 1; $i <= $total_files; $i++) {
                 fwrite($openfile, file_get_contents($temp_dir . '/' . $fileName . '.part' . $i));
             }
             fclose($openfile);
             // rename the temporary directory (to avoid access from other
             // concurrent chunks uploads) and than delete it
             if (rename($temp_dir, $temp_dir . '_UNUSED')) {
                 Actions::deleteDir($temp_dir . '_UNUSED');
             } else {
                 Actions::deleteDir($temp_dir);
             }
             $chunk->setSuccess(" <span><i class=\"fa fa-check-circle\"></i> " . $finalfile . " </span> ", "yep");
             $chunk->setUserUp($totalSize);
             $message = array('user' => GateKeeper::getUserInfo('name'), 'action' => 'ADD', 'type' => 'file', 'item' => $logloc . $finalfile);
             Logger::log($message, "");
             if (SetUp::getConfig("notify_upload")) {
                 Logger::emailNotification($logloc . $finalfile, 'upload');
             }
         } else {
             setError(" <span><i class=\"fa fa-exclamation-triangle\"></i> cannot create the destination file", "nope");
             return false;
         }
     }
 }