<file_sep><?php
class custom_video_player {
	function init() {
		$this->localeSection = "Custom Actions: Video Player";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Video Player", $this->localeSection),
			'iconCls' => 'fa fa-fw fa-play-circle-o',
			'useWith' => array('wvideo'),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
		global $config;
		\FileRun::checkPerms("download");
		$ext = \FM::getExtension($this->data['fileName']);
		$handlers = array(
			'flv' => 'flv',
			'm4v' => 'flv',
			'mpg' => 'mpg',
			'swf' => 'swf',
			'wmv' => 'wmv',
			'mov' => 'html5',
			'ogv' => 'html5',
			'mp4' => 'html5',
			'mkv' => 'html5',
			'webm' => 'html5'
		);
		$handle = $handlers[$ext];
		if (!$handle) {
			exit('The file type is not supported by this player.');
		}
		require(gluePath($this->path, $handle, "/display.php"));
	}

	function stream() {
		\FileRun::checkPerms("download");
		\FileRun\Utils\Downloads::sendFileToBrowser($this->data['filePath']);
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Video Player"
		));
		exit();
	}
}<file_sep><?php include_once realpath($_SERVER["DOCUMENT_ROOT"])."/setting/control.php"; ?>
<?php
$email = htmlentities($_POST['userEmail'], ENT_QUOTES, "UTF-8");
$password =  htmlentities($_POST['userPassword'], ENT_QUOTES, "UTF-8");

if (!RegexCheck($_regexMail,$email)){
	echo '
	<div class="alert alert-dismissible alert-danger">
	  <button type="button" class="close" data-dismiss="alert">&times;</button>
	  <strong>Error:</strong> <a href="#" class="alert-link">Please type correct email.
	</div>
	';
	exit();
}
if (!RegexCheck($_regexPassword,$email)){
	echo '
	<div class="alert alert-dismissible alert-danger">
	  <button type="button" class="close" data-dismiss="alert">&times;</button>
	  <strong>Error:</strong> <a href="#" class="alert-link">Please type correct password.
	</div>
	';
	exit();
}

echo '
	<div class="alert alert-dismissible alert-success">
	  <button type="button" class="close" data-dismiss="alert">&times;</button>
	  <strong>Success:</strong> You have successful logged!
	</div>';
sleep(3);
echo '<script>loadLoginNavigationBar();</script>';
exit();
?><file_sep><?php
class custom_office_web_viewer {

	var $online = true;

	function init() {
		$proto = isSSL() ? "https" : "http";
		$this->URL = $proto."://view.officeapps.live.com/op/view.aspx";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Office Web Viewer", 'Custom Actions: Office Web Viewer'),
			"icon" => 'images/icons/office.png',
			"extensions" => array(
				"doc", "docx", "docm", "dotm", "dotx",
				"xls", "xlsx", "xlsb", "xls", "xlsm",
				"ppt", "pptx", "ppsx", "pps", "pptm", "potm", "ppam", "potx", "ppsm"
			),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
	$url = $this->weblinks->getOneTimeDownloadLink($this->data['filePath']);
	if (!$url) {
		echo "Failed to setup weblink";
		exit();
	}
	\FileRun\Log::add(false, "preview", array(
		"relative_path" => $this->data['relativePath'],
		"full_path" => $this->data['filePath'],
		"method" => "Office Web Viewer"
	));
?>
<html>
<head>
	<title></title>
	<style>
		body {
			border: 0px;
			margin: 0px;
			padding: 0px;
			overflow:hidden;
		}
	</style>
</head>

<body>
<iframe scrolling="no" width="100%" height="100%" border="0" src="<?php echo $this->URL?>?src=<?php echo urlencode($url)?>">
</iframe> 
</body>
</html>
<?php
	}
}<file_sep><?php
global $app, $settings, $config;
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title></title>
	<link rel="stylesheet" type="text/css" href="css/style.css?v=<?php echo $settings->currentVersion;?>" />
	<link rel="stylesheet" type="text/css" href="css/ext.php?v=<?php echo $settings->currentVersion;?>" />
	<script type="text/javascript" src="js/min.php?extjs=1&v=<?php echo $settings->currentVersion;?>"></script>
	<script src="customizables/custom_actions/code_editor/app.js?v=<?php echo $settings->currentVersion;?>"></script>
	<script src="?module=fileman&section=utils&page=translation.js&sec=<?php echo S::forURL("Custom Actions: Text Editor")?>&lang=<?php echo S::forURL(\FileRun\Lang::getCurrent())?>"></script>
	<script src="customizables/custom_actions/code_editor/ace/ace.js" type="text/javascript" charset="utf-8"></script>
	<script src="customizables/custom_actions/code_editor/ace/ext-modelist.js" type="text/javascript" charset="utf-8"></script>
	<script>
		var URLRoot = '<?php echo S::safeJS($config['url']['root'])?>';
		var path = '<?php echo S::safeJS($this->data['relativePath'])?>';
		var filename = '<?php echo S::safeJS($this->data['fileName'])?>';
		var windowId = '<?php echo S::safeJS(S::fromHTML($_REQUEST['_popup_id']))?>';
		var charset = '<?php echo S::safeJS(S::fromHTML($_REQUEST['charset']))?>';
		var charsets = <?php
		$list = array();
		foreach($enc as $e) {
			$list[] = array($e);
		}
		echo json_encode($list);
		?>
	</script>
	<style>.ext-el-mask { background-color: white; }</style>
</head>

<body id="theBODY" onload="FR.init()">

<textarea style="display:none" id="textContents"><?php echo S::safeHTML(S::convert2UTF8($this->data['fileContents']))?></textarea>

</body>
</html><file_sep><?php
include_once $_phpPath."/setting/trigger/sqlstore.php"; // asdjnoqlinfkjvnu!Q@#EDASnkjnasdfkjn!@#E|+
include_once $_phpPath."/setting/trigger/emailstore.php"; // asdjnoqlinfkjvnu!Q@#EDASnkjnasdfkjn!@#E|++
include_once $_phpPath."/setting/trigger/smtpstore.php"; // asdjnoqlinfkjvnu!Q@#EDASnkjnasdfkjn!@#E|+++
include_once $_phpPath."/setting/installer/privatekey.php"; // Get Private Key

if ($_privateKey != NULL){
	$decryptPrivateKey = base64_decode(hex2bin(strrev($_privateKey)));
	$explodeKey = explode('|',$decryptPrivateKey);
	$selectedKey = array();
	foreach($explodeKey AS $key)
		{
		   if(strlen($key) > 1)
			  array_push($selectedKey,$key);
		}
}else{
	echo "<br><span color='red'>Cannot Define Private Key</span>";
	echo "<br><a href='".$_url."setting/installer/'>Please create the private key!</a>";	
	exit();	
}

if ($_sqlEncryptString != NULL){
function decryptSQLString($encryptSQLString, $iv_size, $privateKey){
	$ciphertext_dec = base64_decode($encryptSQLString);
    $iv_dec = substr($ciphertext_dec, 0, $iv_size);
    $ciphertext_dec = substr($ciphertext_dec, $iv_size);
    $plaintext_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $privateKey,
                                    $ciphertext_dec, MCRYPT_MODE_CBC, $iv_dec);
    return $plaintext_dec;
}

$sqlPackage = decryptSQLString($_sqlEncryptString, $selectedKey[1], $selectedKey[0]);
}else{
	echo "<br><span color='red'>Cannot Define SQL Connect Package</span>";
	echo "<br><a href='".$_url."setting/installer/'>Please config your database!</a>";	
	exit();
}
?><file_sep><?php include_once realpath($_SERVER["DOCUMENT_ROOT"])."/setting/control.php"; ?>
<?php
// Bug >
// Test
//echo ValidPassword(CreatingHash('1234'),'<PASSWORD>b<PASSWORD> <KEY>');
//echo ValidPassword(CreatingHash('1234'),CreatingSalt(CreatingHash('1234')));
// Perfect
$privateKey = "<KEY>";
$salt = "<KEY>";

echo encryptData("Test",$privateKey,$salt);
echo "<br>";
echo decryptData("6av<KEY>",$privateKey,$salt);

?><file_sep><?php

class custom_kml_viewer {

	var $online = true;

	function init() {
		$this->URL = 'https://earth.google.com/kmlpreview/';
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t('Google Earth', 'Custom Actions: Google Earth'),
			'icon' => 'images/icons/gearth.png',
			"extensions" => array("kml", "kmz"),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}

	function run() {
	$data = $this->weblinks->createForService($this->data['filePath'], 2, $this->data['shareInfo']['id']);
	$url = $this->weblinks->getURL(array(
			"id_rnd" => $data['id_rnd'],
			"filename" => $this->data['fileName']
		)
	);
	if (!$url) {
		echo "Failed to setup weblink";
		exit();
	}

	\FileRun\Log::add(false, "preview", array(
		"relative_path" => $this->data['relativePath'],
		"full_path" => $this->data['filePath'],
		"method" => "google-earth"
	));
?>
<html>
<head>
	<title></title>
	<style>
		body {
			border: 0px;
			margin: 0px;
			padding: 0px;
			overflow:hidden;
		}
	</style>
</head>

<body>
<iframe scrolling="no" width="100%" height="100%" border="0" src="<?php echo $this->URL?>#url=<?php echo urlencode($url)?>">
</iframe> 
</body>
</html>
<?php
	}
}<file_sep><?php
if ($sqlPackage != NULL){
	// TODO: Need to implement multiple DB Connect As Well
	// Seperate the Package
	$explodeSQLKey = explode('|',$sqlPackage);
	$selectedSQLKey = array();
	foreach($explodeSQLKey AS $key)
		{
		   if(strlen($key) > 1)
			  array_push($selectedSQLKey,$key);
		}
	
	// Globals Variable
	$GLOBALS['hostname'] = $selectedSQLKey[0];
	$GLOBALS['username'] = $selectedSQLKey[1];
	$GLOBALS['password'] = $selectedSQLKey[2];
	$GLOBALS['database'] = $selectedSQLKey[3];
	
	// Function to connect to DB
	function ConnectDB($hostname, $username, $password, $database){
		$_db = new mysqli($hostname, $username, $password, $database);
		if($_db->connect_error){
     		die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
		}
		return $_db;
	}
}else{
	consoleData("Please insert database information");
	echo "<br><a href='".$_url."setting/installer/'>Please config your database!</a>";	
	exit();
}
?><file_sep><?php
$url = $config['url']['root'];
$url .= "/?module=fileman_myfiles&section=ajax&page=thumbnail";
$url .= "&path=".S::forURL($this->data['relativePath']);
$url .= "&noCache=1";
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
    <title></title>
	<script>
		function run() {
			document.getElementById('imgHolder').innerHTML = '<img src="<?php echo $url?>&width='+encodeURIComponent(document.body.clientWidth)+'&height='+encodeURIComponent(document.body.clientHeight)+'" border="0" />';
		}
	</script>
	<style>body {margin:0px;padding:0px;}</style>
</head>

<body onload="javscript:run()">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td align="center" id="imgHolder"></td>
</tr>
</table>
</body>
</html><file_sep><?php

?>
<html>
<head>
	<title></title>
	<style>
		body {
			border: 0px;
			margin: 0px;
			padding: 0px;
			overflow:hidden;
		}
	</style>
	<!-- Load Feather code -->
	<script type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/imaging/v3/editor.js"></script>
	<!-- Instantiate Feather -->
	<script type='text/javascript'>
		var featherEditor = new Aviary.Feather({
			apiKey: '<KEY>',
			theme: 'light', displayImageSize: true,
			tools: 'all', noCloseButton: true, fileFormat: 'original',
			appendTo: 'injection_site',
			onLoad: function() {
				launchEditor('image1', '<?php echo S::safeJS($this->data['fileURL'])?>');
			},
			onSave: function(imageID, newURL) {
				var img = document.getElementById(imageID);
				img.src = newURL;
				with (window.parent) {
					Ext.Ajax.request({
						url: '<?php echo S::safeJS($this->data['saveURL'])?>&fromURL='+encodeURIComponent(newURL),
						callback: function(opts, succ, req) {
							FR.utils.reloadGrid();
							FR.UI.feedback(req.responseText);
						}
					});
				}
			},
			onError: function(errorObj) {alert(errorObj.message);}
		});
		function launchEditor(id, src) {
			featherEditor.launch({
				image: id,
				url: src
			});
			return false;
		}
	</script>
</head>

<body>
<div id="injection_site"></div>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td align="center" valign="middle">
	<img id="image1" style="display:none;" src="<?php echo $this->data['fileURL']?>" />
	</td>
</tr>
</table>
</body>
</html><file_sep><div class="container">

<hr>

<?php require_once $thisPageContent ?>

<hr>

<?php require_once $_phpPath."page/_layout/body/_footer.php"; ?>

</div>

<div class="downer-containner">

<?php if (!empty($thisPageDownerContent)){require_once $thisPageDownerContent;} ?>

</div><file_sep><?php
// Shortcut connect DB
function Db(){
	$_db = ConnectDB($GLOBALS['hostname'],$GLOBALS['username'],$GLOBALS['password'],$GLOBALS['database']);
	return $_db;
}
?><file_sep><nav class="navbar navbar-default" role="navigation" id="nav">

  <div class="container-fluid">

    <div class="navbar-header">

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>

      <a class="navbar-brand" href="#"><?php echo $_siteName;?></a> </div>

    <div class="collapse navbar-collapse" id="myNavbar">

      <ul class="nav navbar-nav">

        <li><a href="<?php echo $_url;?>">Home</a></li>

        <li><a href="<?php echo $_url;?>about">About</a></li>

        <li><a href="#">Page 2</a></li>

        <li><a href="#">Page 3</a></li>

      </ul>

      <ul class="nav navbar-nav navbar-right" id="userNavbar">

     

      </ul>

    </div>

  </div>

</nav>



<!-- Need auto get page --> 

<file_sep><?php
class custom_admin_indexer_test {
	function init() {
		$this->config = array(
			'localeSection' => 'Custom Actions: Admin: Text Indexer Test'
		);
		$this->JSconfig = array(
			'title' => $this->getString('Admin: Text Indexer Test'),
			'iconCls' => 'fa fa-fw fa-bug',
			'requiredUserPerms' => array('download'),
			"popup" => true,
			'width' => 500
		);
	}
	function isDisabled() {
		global $settings;
		return (!$settings->search_enable || !\FileRun\Perms::isSuperUser());
	}
	function getString($s) {
		return S::safeJS(\FileRun\Lang::t($s, $this->config['localeSection']));
	}
	function run() {
		$search = new \FileRun\Search();
		$tika = $search->getApacheTika();
		header('Content-type: text/plain; charset=UTF-8');
		if (\FM::isPlainText(array('fileName' => $this->data['fileName']))) {
			echo $tika->getText($this->data['filePath']);
		} else {
			echo S::convert2UTF8($tika->getText($this->data['filePath']));
		}
	}
}<file_sep><?php

$thisPageName = "About";

$thisPageMeta = "";

$thisPageHeading = $thisPageName;

$thisPageSubHeading = "PHP Easy";

$thisPageContent = $_SERVER['DOCUMENT_ROOT']."/page/about/view/aboutView.php";

$thisPageBreadCrumbUse = 1;

require_once $_SERVER['DOCUMENT_ROOT']."/page/_layout/_layout.php";





//echo realpath('.');

?><file_sep><?php

function RegexCheck($regexPattern, $string){
	return (preg_match($regexPattern,$string)?true:false);
}
function RedirectURL ($redirectInSecond, $toURL){
	return header( "refresh:".$redirectInSecond.";url=".$toURL."" );	
}
function ConsoleData($data) {
	echo (is_array($data)?"<script>console.log( 'Debug Objects: " . implode( ',', $data) . "' );</script>":"<script>console.log( 'Debug Objects: " . $data . "' );</script>");
}

function GetIpUser(){
	return (!empty($_SERVER['HTTP_CLIENT_IP']))?$ip = $_SERVER['HTTP_CLIENT_IP']:(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))?$ip = $_SERVER['HTTP_X_FORWARDED_FOR']:$ip = $_SERVER['REMOTE_ADDR'];
}
function ConnectSQL($connectString){
	
}
function FileReader ($fileDirectory){
	if ($openFile = fopen($fileDirectory, "r")){
		$readFile = fread($openFile,filesize($fileDirectory));
		fclose($openFile);
		return $readFile;
	}
		return "Cannot Read File";	
}
function FileWriter ($fileDirectory){
	
}

function GenerateLinkPath($path,$_url){
	$explode = explode("/",$path);
	$countExplode = count($explode);
	$link[0] = $_url;
	for ($x = 1; $x < $countExplode; $x++){
		$link[$x] = $link[$x-1].$explode[$x].'/';
		$result .= '<a href="'.substr($link[$x],0,-1).'">'.ucfirst($explode[$x]).'</a>'.' > ';
	}
	return substr($result,0,-2);
}
function GetAllFileInFolder($path){
	return array_diff(scandir($path),array('..', '.'));	
}
function GetAllFileInFolderWithType($path, $fileType){
	$listOfAllFile = array_diff(scandir($path),array('..', '.'));
	return preg_grep("/^.*\.(".$fileType.")$/", $listOfAllFile);
}
function PriorityKey($array, $value){
    $key = array_search($value, $array);
    if($key){
		unset($array[$key]);
		array_unshift($array, $value);  
    } 
	return $array;
}
function isSSL()
{
	if( !empty( $_SERVER['https'] ) )
		return true;

	if( !empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
		return true;

	return false;
}

include_once $_phpPath."setting/encrypt_library.php";
?>
<file_sep><?php

/////////////////////////////////////////////////

// Version 1

// Create priority for jquery.js must be load first

/*foreach (priorityKey(getAllFileInFolderWithType($_phpPath.'js', 'js'), "jquery-3.1.1.min.js") as $jsFile){

	echo '<script type="text/javascript" src="'.$_url.'js/'.$jsFile.'"></script>';

}

foreach (getAllFileInFolderWithType($_phpPath.'page'.(empty(substr($_SERVER['REQUEST_URI'],1))?'/index':$_SERVER['REQUEST_URI']).'/view/js', 'js') as $jsFile){

	echo '<script type="text/javascript" src="'.$_url.'page/'.(empty(substr($_SERVER['REQUEST_URI'],1))?'index':$_SERVER['REQUEST_URI']).'/view/js/'.$jsFile.'"></script>';

}





/*

Need to auto import .php, maybe delete js-top

*/



//////////////////////////////////////////////////

// Version 2

// TODO: Need re check some value get wrong

// TODO: Need to check if file has been include, must apply history $_SESSION['jsIncluded'] = List<String>

for ($x = 0; $x < $_countGetPath; $x++){

	// Get All Public Inheritent File

	$_combineLine[$x] = $_combineLine[$x - 1].$_getPath[$x].'/';
	 
	
	foreach (priorityKey(priorityKey(getAllFileInFolderWithType($_phpPath.'js'.$_combineLine[$x], 'js'), "bootstrap.min.js"), "jquery-3.1.1.min.js") as $jsFile){

		echo('<script type="text/javascript" src="'.$_url.'js'.$_combineLine[$x].$jsFile.'"></script>');

		//consoleData($jsFile);

	}

	// Include all .php except this file

	foreach (getAllFileInFolderWithType($_phpPath.'js'.$_combineLine[$x], 'php') as $jsFile){

		//echo('<script type="text/javascript" src="'.$_url.'js'.$_combineLine[$x].$jsFile.'"></script>');

		if (basename(__FILE__, '.') != $jsFile){ 

			//consoleData($jsFile);

			include_once $_phpPath.'js'.$_combineLine[$x].$jsFile;

		}

	}

	// Get Private File

	if ($x == ($_countGetPath - 1)){

		//consoleData($_phpPath.'js'.$_combineLine[$x].'private');

		foreach (getAllFileInFolderWithType($_phpPath.'js'.$_combineLine[$x].'private', 'js') as $jsFile){

			echo('<script type="text/javascript" src="'.$_url.'js'.$_combineLine[$x].'private/'.$jsFile.'"></script>');

		}

		foreach (getAllFileInFolderWithType($_phpPath.'js'.$_combineLine[$x].'private', 'php') as $jsFile){

			if (basename(__FILE__, '.') != $jsFile){ 

				//consoleData($jsFile);

				include_once $_phpPath.'js'.$_combineLine[$x].'private/'.$jsFile;

			}

		}

	}

}

?>

<script src="//fast.eager.io/kcBx5lOVwX.js"></script>

<file_sep><meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="<?php echo $_url;?>favicon.ico">
<?php
echo $_thisPageMeta;
?><file_sep>FR.UI.imagePreview = {
	UI: {}, items: new Ext.util.MixedCollection(),
	highDPIRatio: 2,
	blankSrc: 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==',
	init: function(clickedItem) {
		this.open = true;
		this.baseSrc = URLRoot+'/t.php';
		this.items.clear();
		if (!this.body) {
			this.body = Ext.getBody();
		}
		this.showMask();
		var startIndex = this.collectItems(clickedItem);
		this.createImageDOM();
		this.createUI();
		this.setItem(startIndex);
	},
	getNaturalSize: function (img) {
		if (Ext.isIE8) {
			var tmpImg = new Image();
			tmpImg.src = img.src;
			return {width: tmpImg.width, height: tmpImg.height};
		} else {
			return {width: img.naturalWidth, height: img.naturalHeight};
		}
	},
	createImageDOM: function() {
		if (!this.iconEl) {
			this.iconEl = Ext.DomHelper.append(this.body, {
				tag: 'img', alt: '', cls: 'fr-image-preview-icon', src: this.blankSrc
			}, true);
			this.iconEl.setVisibilityMode(Ext.Element.DISPLAY);
		}
		if (!this.loaderEl) {
			this.loaderEl = Ext.DomHelper.append(this.body, {tag: 'img'}, true);
			Ext.get(this.loaderEl).on('load', function () {
				if (this.loaderEl.settingBlankPixel) {
					this.loaderEl.settingBlankPixel = false;
					return false;
				}
				this.imgDOM.set({src: this.loaderEl.getAttribute('src')});
			}, this);
		}
		if (!this.imgDOM) {
			this.imgDOM = Ext.DomHelper.append(this.body,{
				tag: 'img', alt: '', cls: 'fr-image-preview', src: this.blankSrc
			}, true);
			this.imgDrag = new Ext.dd.DD(this.imgDOM, false, {moveOnly: true, scroll: false});
			this.imgDrag.lock();
			Ext.get(this.imgDOM).on('load', function () {
				if (this.imgDOM.settingBlankPixel) {
					this.imgDOM.settingBlankPixel = false;
					return false;
				}
				if (this.zoomed) {
					var min = this.body.getHeight();
					min = Math.round(min-10/100*min);
					var nSize = this.getNaturalSize(this.imgDOM.dom);
					this.UI.zoomSlider.setMinValue(min);
					this.UI.zoomSlider.setMaxValue(nSize.height);
					this.UI.zoomSlider.suspendEvents();
					this.UI.zoomSlider.setValue(nSize.height);
					this.UI.zoomSlider.resumeEvents();
				}
				this.adjustImageSize();
				if (this.isCached(true)) {
					this.iconEl.hide();
					this.imgDOM.setVisible(true);
				} else {
					this.iconEl.fadeOut({stopFx: true, duration: 0.2, useDisplay: true});
					this.imgDOM.fadeIn({stopFx: true});
				}
			}, this);
		}
	},
	createUI: function() {
		if (this.UI.tbarWrap) {
			if (FR.currentSection == 'trash'){
				this.commentsBtn.hide();
				this.downloadBtn.hide();
			} else {
				this.commentsBtn.show();
				this.downloadBtn.show();
			}
			this.hideUITask.cancel();
			this.UI.tbarWrap.show();
			this.UI.tbarEl.show();
			if (this.count > 1) {
				this.UI.navLeftWrap.show();
				this.UI.navLeft.show();
				this.UI.navRightWrap.show();
				this.UI.navRight.show();
			}
			this.nav.enable();
			return false;
		}
		this.UI.tbarWrap = Ext.DomHelper.append(this.body, {tag: 'div', cls: 'fr-prv-tbar-ct-wrap'}, true);
		this.UI.tbarEl = Ext.DomHelper.append(this.UI.tbarWrap, {tag: 'div', cls: 'fr-prv-tbar-ct'}, true);
		this.UI.icon = new Ext.Toolbar.Item({cls: 'fr-prv-tbar-icon'});
		this.UI.filename = new Ext.Toolbar.TextItem({cls: 'fr-prv-tbar-filename'});
		this.UI.pageInfo = new Ext.Toolbar.TextItem({cls: 'fr-prv-tbar-pageinfo', listeners: {'afterrender': FR.UI.tooltip('Use "Page Down" and "Page Up" to change the page')}});
		this.UI.status = new Ext.Toolbar.TextItem({cls: 'fr-prv-tbar-status'});
		this.UI.zoomSlider = new Ext.Slider({
			width: 110, minValue: 0, maxValue: 100, value: 100, hidden: true, cls: 'fr-prv-tbar-slider',
			listeners: {
				'change': function (s, v) {
					this.applyZoom.cancel();
					this.applyZoom.delay(50, false, this, [v]);
				},
				scope: this
			}
		});
		this.UI.zoomToggle = new Ext.Button({
			iconCls: 'fa fa-fw fa-arrows-alt fa-lg',
			enableToggle: true,
			toggleHandler: function(b, pressed) {
				if (pressed){
					this.initZoom();
				} else {
					this.cancelZoom();
					this.getMaxSize();
					this.loadThumb();
				}
			}, scope: this, listeners: {'afterrender': FR.UI.tooltip(FR.T('Zoom'))}
		});
		this.commentsBtn = new Ext.Button({
			iconCls: 'fa fa-fw fa-comments-o fa-lg',
			handler: this.showComments, scope: this, hidden: (!User.perms.read_comments || (FR.currentSection == 'trash')),
			listeners: {'afterrender': FR.UI.tooltip(FR.T('Comments'))}
		});
		this.downloadBtn = new Ext.Button({
			iconCls: 'fa fa-fw fa-download fa-lg',
			handler: this.download, scope: this, hidden: (FR.currentSection == 'trash'),
			listeners: {'afterrender': FR.UI.tooltip(FR.T('Download'))}
		});
		this.tbar = new Ext.Toolbar({
			autoCreate: {cls: 'fr-prv-tbar'},
			renderTo: this.UI.tbarEl,
			items: [
				this.UI.icon, this.UI.filename, this.UI.pageInfo,
				'->',
				this.UI.status,
				this.UI.zoomSlider,
				this.UI.zoomToggle,
				this.commentsBtn,
				this.downloadBtn,
				{
					iconCls: 'fa fa-fw fa-close fa-lg',
					handler: this.close, scope: this,
					listeners: {'afterrender': FR.UI.tooltip(FR.T('Close'))}
				}
			]
		});

		this.UI.navLeftWrap = Ext.DomHelper.append(this.body, {tag: 'div', cls: 'fr-prv-nav-left-wrap'}, true);
		this.UI.navLeft = Ext.DomHelper.append(this.UI.navLeftWrap, {tag: 'div', cls: 'fr-prv-nav-btn', style:'float:left', html: '<i class="fa fa-angle-left"></i>'}, true);
		this.UI.navLeft.on('click', this.previousItem, this);
		this.UI.navRightWrap = Ext.DomHelper.append(this.body, {tag: 'div', cls: 'fr-prv-nav-right-wrap'}, true);
		this.UI.navRight = Ext.DomHelper.append(this.UI.navRightWrap, {tag: 'div', cls: 'fr-prv-nav-btn', style:'float:right', html: '<i class="fa fa-angle-right"></i>'}, true);
		this.UI.navRight.on('click', this.nextItem, this);
		new Ext.ToolTip({
			target: this.UI.navRight, showDelay: 250,
			html: FR.T('Next'), anchor: 'left',
			baseCls: 'headerTbar-btn-tooltip'
		});
		new Ext.ToolTip({
			target: this.UI.navLeft, showDelay: 250,
			html: FR.T('Previous'), anchor: 'right',
			baseCls: 'headerTbar-btn-tooltip'
		});


		if (this.count == 1) {
			this.UI.navLeftWrap.hide();
			this.UI.navLeft.hide();
			this.UI.navRightWrap.hide();
			this.UI.navRight.hide();
		}
/*
		this.UI.tbarWrap.on('mouseleave', this.hideUI, this);
		this.UI.navLeftWrap.on('mouseleave', this.hideUI, this);
		this.UI.navRightWrap.on('mouseleave', this.hideUI, this);
		this.imgDOM.on('mouseleave', this.hideUI, this);

		this.UI.tbarWrap.on('mouseenter', this.showUI, this);
		this.imgDOM.on('mouseenter', this.showUI, this);
		this.UI.navLeftWrap.on('mouseenter', this.showUI, this);
		this.UI.navRightWrap.on('mouseenter', this.showUI, this);
*/
		this.setupKeys();
	},
	initZoom: function() {
		if (!this.zoomed) {
			this.UI.zoomSlider.show();
			this.imgDrag.unlock();
			this.maxW = 10000;
			this.maxH = 10000;
			this.zoomed = true;
			this.loadThumb();
		}
	},
	applyZoom: new Ext.util.DelayedTask(function(v) {
		this.imgDOM.setHeight(v).center();
	}),
	cancelZoom: function() {
		if (this.zoomed) {
			this.zoomed = false;
			this.UI.zoomSlider.hide();
			this.imgDrag.lock();
			this.UI.zoomToggle.toggle(false, true);
			this.getMaxSize();
		}
	},
	showUI: function() {this.showUITask.delay(50, false, this);},
	showUITask: new Ext.util.DelayedTask(function() {
		this.hideUITask.cancel();
		if (this.UI.hidden) {
			this.UI.hidden = false;
			this.UI.tbarEl.fadeIn({
				duration: .2,
				stopFx: true, /*callback: function () {
					this.UI.hidden = false;
				},*/ scope: this
			});
			if (this.count > 1) {
				this.UI.navLeft.fadeIn({duration: .2, stopFx: true});
				this.UI.navRight.fadeIn({duration: .2, stopFx: true});
			}
		}
	}),
	hideUI: function() {this.hideUITask.delay(1000, false, this);},
	hideUITask: new Ext.util.DelayedTask(function() {
		this.showUITask.cancel();
		if (!this.UI.hidden) {
			this.UI.hidden = true;
			this.UI.tbarEl.fadeOut({
				duration: 1,
				stopFx: true, /*callback: function () {
					this.UI.hidden = true;
				}, */scope: this
			});
			if (this.count > 1) {
				this.UI.navLeft.fadeOut({duration: 1, stopFx: true});
				this.UI.navRight.fadeOut({duration: 1, stopFx: true});
			}
		}
	}),
	setupKeys: function() {
		this.nav = new Ext.KeyNav(this.body, {
			'left' : function() {this.previousItem();},
			'right' : function(){this.nextItem();},
			'space' : function(){this.nextItem();},
			'up': function() {},
			'down': function() {},
			'pageUp': function() {this.previousPage();},
			'pageDown': function () {this.nextPage();},
			'enter' : function(){this.download();},
			'esc': function() {this.close();},
			scope : this
		});
	},
	collectItems: function(clickedItem) {
		var startIndex = 0;
		this.count = 0;
		FR.UI.gridPanel.store.each(function(item) {
			if (!item.data.isFolder && item.data.thumb && item.data.filetype != 'wvideo'){
				this.items.add(this.count, item.data);
				if (clickedItem == item) {
					startIndex = this.count;
				}
				this.count++;
			}
		}, this);
		return startIndex;
	},
	setItem: function(index, page) {
		this.hideComments();
		if (index != this.currentIndex) {
			this.cancelZoom();
		}
		this.currentIndex = index;
		this.currentItem = this.items.get(index);
		this.pageIndex = page || 0;
		this.currentPath = this.currentItem.path || FR.currentPath+'/'+this.currentItem.filename;
		this.fileSize = this.currentItem.filesize;
		this.UI.icon.update('<img src="images/fico/'+this.currentItem.icon+'" height="20" />');
		this.currentItem.extension = FR.utils.getFileExtension(this.currentItem.filename);
		this.UI.filename.setText(this.currentItem.filename);
		if (this.count > 1) {
			this.UI.status.setText(FR.T('%1 of %2 items').replace('%1', this.currentIndex+1).replace('%2', this.count));
		} else {
			this.UI.status.setText('&nbsp;');
		}
		var pageInfo = '&nbsp;';
		if (this.isMultiPage()) {
			if (this.pageIndex == 0) {
				pageInfo = FR.T('First page');
			} else {
				pageInfo = FR.T('Page %1').replace('%1', this.pageIndex + 1);
			}
		}
		this.UI.pageInfo.setText(pageInfo);
		if (!this.zoomed) {
			this.getMaxSize();
		}
		this.loadThumb();
	},
	nextItem: function() {
		var index = 0;
		if (this.currentIndex < this.count-1) {
			index = this.currentIndex+1;
		}
		this.setItem(index);
	},
	previousItem: function() {
		var index = this.count-1;
		if (this.currentIndex > 0) {
			index = this.currentIndex-1;
		}
		this.setItem(index);
	},
	nextPage: function() {
		if (!this.isMultiPage()) {return false;}
		this.setItem(this.currentIndex, this.pageIndex+1);
	},
	previousPage: function() {
		if (!this.isMultiPage()) {return false;}
		if (this.pageIndex > 0) {
			this.setItem(this.currentIndex, this.pageIndex-1);
		}
	},
	isCached: function(addNow) {
		var cacheId = this.maxW + ':' + this.maxH + ':' + this.pageIndex;
		if (!this.currentItem.cache) {
			this.currentItem.cache = new Ext.util.MixedCollection();
		} else {
			if (this.currentItem.cache.get(cacheId)) {
				return true;
			}
		}
		if (addNow) {
			this.currentItem.cache.add(cacheId, {});
		}
	},
	isMultiPage: function() {
		return (['pdf', 'tif'].indexOf(this.currentItem.extension) != -1);
	},
	loadThumb: function() {
		this.lastRequestedSize = {
			w: this.maxW,
			h: this.maxH
		};
		var src = this.baseSrc+'?p='+encodeURIComponent(this.currentPath);
		src += '&noCache=1';
		src += '&width='+this.maxW+'&height='+this.maxH;
		src += '&pageNo='+this.pageIndex;
		src += '&fsize='+this.fileSize;

		if (!this.isCached()) {
			if (this.currentItem.thumbURL) {
				//set thumb
				this.imgDOM.set({src: this.currentItem.thumbURL});
			} else {
				this.imgDOM.setVisible(false);
				this.iconEl.set({src: 'images/fico/' + this.currentItem.icon});
				this.iconEl.show();
				this.iconEl.center();
			}
			//load preview
			this.loaderEl.set({src: src});
			return false;
		}
		this.imgDOM.set({src: src});
	},
	showMask: function() {
		this.mask = this.body.mask();
		this.mask.addClass('darkMask');
		this.mask.on('click', function() {this.close();}, this);
	},
	hideMask: function() {
		this.body.unmask();
	},
	close: function() {
		this.hideComments();
		this.cancelZoom();
		this.hideUITask.cancel();
		this.UI.tbarWrap.hide();
		this.UI.tbarEl.hide();
		this.UI.navLeftWrap.hide();
		this.UI.navRightWrap.hide();
		this.UI.navLeft.hide();
		this.UI.navRight.hide();
		this.loaderEl.settingBlankPixel = true;
		this.loaderEl.set({src: this.blankSrc});
		this.imgDOM.settingBlankPixel = true;
		this.imgDOM.set({src: this.blankSrc});
		this.iconEl.set({src: this.blankSrc});
		this.nav.disable();
		this.iconEl.hide();
		this.imgDOM.setVisible(false);
		this.hideMask();
		this.open = false;
	},
	getMaxSize: function() {
		this.maxH = this.body.getHeight();
		this.maxW = this.body.getWidth();
		this.maxH = Math.round(this.maxH-10/100*this.maxH-30) * this.highDPIRatio;
		this.maxW = Math.round(this.maxW-10/100*this.maxW) * this.highDPIRatio;
	},
	adjustImageSize: function() {
		//if (!this.lastSize) {this.alignImage();return false;}
		//if (this.lastSize.h != this.maxH) {
			var h = Math.round(this.maxH / this.highDPIRatio);
			var nSize = this.getNaturalSize(this.imgDOM.dom);
			if (nSize.height < h) {
				h = nSize.height;
			}
			this.imgDOM.setHeight(h);
		//}
		this.alignImage();
	},
	alignImage: function() {
		this.imgDOM.alignTo(this.body, 'c-c', [0, 10]);
	},
	onWindowResize: function() {
		if (!this.open) {return false;}
		if (this.zoomed) {
			this.imgDOM.center();
			return false;
		}
		this.lastSize = {
			h: this.maxH,
			w: this.maxW
		};
		this.getMaxSize();
		if (this.maxH > this.lastRequestedSize.h || this.maxW > this.lastRequestedSize.w) {
			var nSize = this.getNaturalSize(this.imgDOM.dom);
			if (nSize.height < this.lastRequestedSize.h) {
			} else {
				this.newSize = 'larger';
			}
		} else {
			this.newSize = 'smaller';
		}
		this.adjustImageSize();
		if (this.newSize == 'larger') {
			this.loadThumb();
		}
	},
	download: function() {
		FR.actions.download([this.currentPath]);
	},
	showComments: function() {
		if (!this.cPanel) {
			this.cPanel = new FR.components.commentsPanel();
			this.cPanel.inputBox.on('focus', function() {this.nav.disable();}, this);
			this.cPanel.inputBox.on('blur', function() {this.nav.enable();}, this);
			this.cPanel.active = true;
			this.cWin = new Ext.Window({
				title: FR.T('Comments'), closeAction: 'hide',
				hideBorders: true, width: 300, height: 330, layout: 'fit',
				items: this.cPanel
			});
		}
		this.cWin.show();
		this.cWin.alignTo(this.body, 'br-br', [-50, -10]);
		this.cPanel.setItem(this.currentPath);
	},
	hideComments: function() {
		if (this.cWin) {
			this.cWin.hide();
		}
	}
};
Ext.EventManager.onWindowResize(function() {FR.UI.imagePreview.onWindowResize();});<file_sep><?php
function GenerateRandomString($length = 64) {
	$characters = '0123456789abcdefABCDEF';
	$charactersLength = strlen($characters);
	$randomString = '';
	for ($i = 0; $i < $length; $i++) {
		$randomString .= $characters[rand(0, $charactersLength - 1)];
	}
	return $randomString;
}

function EncryptKey($decryptkey){
	return strrev(bin2hex(base64_encode($decryptkey)));
}

function DecryptKey($encryptKey){
	return base64_decode(hex2bin(strrev($encryptKey)));
}

function CreatePrivateKey(){
	$privateKey = pack('H*', GenerateRandomString()); 
	$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
	$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
	$key = $privateKey."|".$iv_size."|".$iv."|+";
	$encryptKey = EncryptKey($key);
	
	return $encryptKey;
}


function CreatingHash($string){
	// Reverse
	$encryptStep[0] = strrev($string);
	// Bin2Hex
	$encryptStep[1] = bin2hex($encryptStep[0]);
	// Base 64 Encode 
	$encryptStep[2] = base64_encode($encryptStep[1]);
	// MD5 Encode  
	$encryptStep[3] = md5($encryptStep[2]); 
	// Hash512
	$encryptStep[4] = hash('sha512', $encryptStep[3]);
	// Finish Here
	return $encryptFinish = $encryptStep[4];
}
function CreatingSalt($string){
	// Create Salt
	$makeSalt[0] = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB), MCRYPT_DEV_URANDOM);
	$makeSalt[1] = '$6$'.substr(str_shuffle("!@#$%^&*()./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345‌​6789".$makeSalt[0]), 0, 25); 
	$makeSalt[2] = crypt($string,$makeSalt[1]);
	// Encrypt Salt
	$makeSalt[3] = bin2hex(strrev(base64_encode(strrev(base64_encode($makeSalt[2])))));
	// Finish Here
	return $makeSaltFinish = $makeSalt[3];
}
function ValidPassword($hashPassword,$salt){
	return (password_verify($hashPassword,base64_decode(strrev(base64_decode(strrev(hex2bin($salt)))))))?true:false;
}


function encryptData($decrypted, $privateKey, $password) { 
// Build a 256-bit $key which is a SHA256 hash of $salt and $password.
$key = hash('SHA256', $password . $privateKey, true);
// Build $iv and $iv_base64.  We use a block size of 128 bits (AES compliant) and CBC mode.  (Note: ECB mode is inadequate as IV is not used.)
srand(); $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND);
if (strlen($iv_base64 = rtrim(base64_encode($iv), '=')) != 22) return false;
// Encrypt $decrypted and an MD5 of $decrypted using $key.  MD5 is fine to use here because it's just to verify successful decryption.
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $decrypted . md5($decrypted), MCRYPT_MODE_CBC, $iv));
// We're done!
return $iv_base64 . $encrypted;
} 

function decryptData($encrypted, $privateKey, $password ) {
// Build a 256-bit $key which is a SHA256 hash of $salt and $password.
$key = hash('SHA256', $password . $privateKey, true);
// Retrieve $iv which is the first 22 characters plus ==, base64_decoded.
$iv = base64_decode(substr($encrypted, 0, 22) . '==');
// Remove $iv from $encrypted.
$encrypted = substr($encrypted, 22);
// Decrypt the data.  rtrim won't corrupt the data because the last 32 characters are the md5 hash; thus any \0 character has to be padding.
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($encrypted), MCRYPT_MODE_CBC, $iv), "\0\4");
// Retrieve $hash which is the last 32 characters of $decrypted.
$hash = substr($decrypted, -32);
// Remove the last 32 characters from $decrypted.
$decrypted = substr($decrypted, 0, -32);
// Integrity check.  If this fails, either the data is corrupted, or the password/salt was incorrect.
if (md5($decrypted) != $hash) return false;
// Yay!
return $decrypted;
}

?><file_sep><?php
$_privateKey = "";
?><file_sep><?php
/*
	Bing KML viewer
*/
class custom_bing_kml_viewer {
	var $online = true;
	function init() {
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Bing Maps", 'Custom Actions: Bing Maps'),
			"iconCls" => 'fa fa-fw fa-cloud', 'icon' => 'images/icons/bing.png',
			"extensions" => array("xml", "kmz", "kml"),
			"popup" => true
		);
	}
	function run() {
	$url = $this->weblinks->getOneTimeDownloadLink($this->data['filePath']);
	if (!$url) {
		echo "Failed to setup weblink";
		exit();
	}
	$proto = isSSL() ? "https" : "http";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>View with Bing</title>
    <script type="text/javascript" src="<?php echo $proto?>://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
<script type="text/javascript">
var map = null;
function EventMapLoad() {
	var shapeLayer = new VEShapeLayer();
	var shapeSpec = new VEShapeSourceSpecification(VEDataType.ImportXML,"<?php echo $url; ?>", shapeLayer);
	map.ImportShapeLayerData(shapeSpec);
}
function CreateMap() {
	map = new VEMap('myMap');
	//Api key is not mandatory, use only if you want generate access report on your bing account
	//map.SetCredentials("Your API KEY");
	map.onLoadMap = EventMapLoad;
	map.LoadMap(null, 3, VEMapStyle.Hybrid);
}
</script>
</head>
<body onload="CreateMap();">
    <div id="myMap" style="position:absolute;width: 100%; height: 100%;"></div>
</body>
</html>
<?php
	}
}<file_sep><?php

class custom_google_docs_viewer {

	var $online = true;

	function init() {
		$this->URL = "https://docs.google.com/viewer";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Google Docs Viewer", 'Custom Actions: Google Docs Viewer'),
			'icon' => 'images/icons/gdocs.png',
			"extensions" => array(
				"pdf", "ppt", "pptx", "doc", "docx", "xls", "xlsx", "dxf", "ps", "eps", "xps",
				"psd", "tif", "tiff", "bmp", "svg",
				"pages", "ai", "dxf", "ttf"
			),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}

	function run() {
	$url = $this->weblinks->getOneTimeDownloadLink($this->data['filePath']);
	if (!$url) {
		echo "Failed to setup weblink";
		exit();
	}
	\FileRun\Log::add(false, "preview", array(
		"relative_path" => $this->data['relativePath'],
		"full_path" => $this->data['filePath'],
		"method" => "Google Docs Viewer"
	));
?>
<html>
<head>
	<title></title>
	<style>
		body {
			border: 0px;
			margin: 0px;
			padding: 0px;
			overflow:hidden;
		}
	</style>
</head>

<body>
<iframe scrolling="no" width="100%" height="100%" border="0" src="<?php echo $this->URL?>?url=<?php echo urlencode($url)?>&embedded=true">
</iframe> 
</body>
</html>
<?php
	}
}<file_sep><?php
class custom_image_viewer {
	function init() {
		$this->localeSection = "Image Viewer";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Image Viewer", $this->localeSection),
			'iconCls' => 'fa fa-fw fa-picture-o',
			'useWith' => array('nothing'),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
		global $config;
		\FileRun::checkPerms("download");
		require(gluePath($this->path, "/display.php"));
	}
}<file_sep><?php

/*

$thisPageJs = "";

$thisPageCss = "";



// Need function get all css

// Need function get all js



*/

?>

<!-- Marketing Icons Section -->

<file_sep><?php include_once realpath($_SERVER["DOCUMENT_ROOT"])."/setting/control.php"; ?>
<?php

?>

<file_sep><?php
/*
 * Plugin for authenticating FileRun users against a LDAP directory
 *
 * */
class customAuth_ldap {
	var $error, $errorCode, $cid, $userRecord;
	function pluginDetails() {
		return array(
			'name' => 'LDAP',
			'description' => 'Authenticate users against LDAP.',
			'fields' => array(
				array(
					'name' => 'host',
					'label' => 'Server hostname',
					'default' => 'ldap.forumsys.com',
					'required' => true
				),
				array(
					'name' => 'port',
					'label' => 'Server port number',
					'default' => 389
				),
				array(
					'name' => 'bind_dn',
					'label' => 'Bind DN',
					'default' => 'cn=read-only-admin,dc=example,dc=com'
				),
				array(
					'name' => 'bind_password',
					'label' => 'Bind password',
					'default' => '<PASSWORD>'
				),
				array(
					'name' => 'user_dn',
					'label' => 'User DN template',
					'default' => 'uid={USERNAME},dc=example,dc=com',
					'required' => true
				),
				array(
					'name' => 'search_dn',
					'label' => 'Search DN',
					'default' => 'dc=example,dc=com',
					'required' => true
				),
				array(
					'name' => 'search_filter',
					'label' => 'Search filter template',
					'default' => '(&(uid={USERNAME})(objectClass=person))',
					'required' => true
				),
				array(
					'name' => 'allow_iwa_sso',
					'label' => 'Enable IWA SSO',
					'default' => 'yes',
					'required' => false
				),
				array(
					'name' => 'mapping_name',
					'label' => 'First name field',
					'default' => 'cn',
					'required' => true
				),
				array(
					'name' => 'mapping_name2',
					'label' => 'Last name field',
					'default' => 'cn'
				),
				array(
					'name' => 'mapping_email',
					'label' => 'E-mail field',
					'default' => 'mail'
				),
				array(
					'name' => 'mapping_company',
					'label' => 'Company name field',
					'default' => ''
				),
				array(
					'name' => 'test_username',
					'label' => 'Test username',
					'default' => 'einstein'
				),
				array(
					'name' => '<PASSWORD>_password',
					'label' => 'Test password',
					'default' => '<PASSWORD>'
				)
			)
		);
	}
	function pluginTest($opts) {

		$pluginInfo = self::pluginDetails();
		//check required fields
		foreach($pluginInfo['fields'] as $field) {
			if ($field['required'] && !$opts['auth_plugin_ldap_'.$field['name']]) {
				return 'The field "'.$field['label'].'" needs to have a value.';
			}
		}
		if (!function_exists('ldap_connect')) {
			return 'PHP is missing LDAP support! Make sure the LDAP PHP extension is enabled.';
		}
		$cid = ldap_connect($opts['auth_plugin_ldap_host'], $opts['auth_plugin_ldap_port']);
		if (!$cid) {
			return 'Connection to the LDAP server failed! Make sure the hostname and the port number are correct.';
		}
		ldap_set_option($cid, LDAP_OPT_PROTOCOL_VERSION, 3);
		ldap_set_option($cid, LDAP_OPT_REFERRALS, 0);
		if ($opts['auth_plugin_ldap_bind_dn']) {
			$rs = @ldap_bind($cid, $opts['auth_plugin_ldap_bind_dn'], $opts['auth_plugin_ldap_bind_password']);
			if (!$rs) {
				return "Bind with bind DN failed: ".ldap_error($cid);
			} else {
				echo 'Bind with bind DN successful!';
				echo '<br>';
			}
		} else {
			$user_dn = str_replace('{USERNAME}', $opts['auth_plugin_ldap_test_username'], $opts['auth_plugin_ldap_user_dn']);
			$rs = @ldap_bind($cid, $user_dn, $opts['auth_plugin_ldap_test_password']);
			if (!$rs) {
				return "Bind with test account failed: ".ldap_error($cid);
			} else {
				echo 'Bind with test account successful!';
				echo '<br>';
			}
		}

		$filter = str_replace("{USERNAME}", $opts['auth_plugin_ldap_test_username'], $opts['auth_plugin_ldap_search_filter']);
		echo 'Searching with filter: '.$filter;
		echo '<br>';
		$rs = @ldap_search($cid, $opts['auth_plugin_ldap_search_dn'], $filter);
		if (!$rs) {
			return "Failed to search for the LDAP record: ".ldap_error($cid);
		}
		$entry = ldap_first_entry($cid, $rs);
		if (!$entry) {
			return 'LDAP record not found. Verify the search filter.';
		}
		if ($opts['auth_plugin_ldap_bind_dn']) {
			$user_dn = ldap_get_dn($cid, $entry);
			echo 'User DN retrieved: '.$user_dn;
			echo '<br>';
			$rs = @ldap_bind($cid, $user_dn, $opts['auth_plugin_ldap_test_password']);
			if (!$rs) {
				return "Bind with test account failed: " . ldap_error($cid);
			} else {
				echo 'Bind with test account successful!';
				echo '<br>';
			}
		}
		echo 'Record found:';
		$attr = ldap_get_attributes($cid, $entry);
		$values = array();
		if (array($attr)) {
			echo '<div style="background-color:whitesmoke;margin:5px;border:1px solid silver">';
			foreach ($attr as $k => $a) {
				if (!is_numeric($k) && $k != 'count') {
					$values[$k] = $a[0];
					echo '<div style="margin-left:10px;">'.S::safeHTML($k).': '.S::safeHTML($a[0]).'</div>';
				}
			}
			echo '</div>';
		}
		echo 'Fields mapping:';
		echo '<div style="background-color:whitesmoke;margin:5px;border:1px solid silver">';
		echo '<div style="margin-left:10px;">Name ('.$opts['auth_plugin_ldap_mapping_name'].'): '.S::safeHTML($values[$opts['auth_plugin_ldap_mapping_name']]).'</div>';
		echo '<div style="margin-left:10px;">Last name ('.$opts['auth_plugin_ldap_mapping_name2'].'): '.S::safeHTML($values[$opts['auth_plugin_ldap_mapping_name2']]).'</div>';
		echo '<div style="margin-left:10px;">E-mail ('.$opts['auth_plugin_ldap_mapping_email'].'): '.S::safeHTML($values[$opts['auth_plugin_ldap_mapping_email']]).'</div>';
		if ($opts['auth_plugin_ldap_mapping_company']) {
			echo '<div style="margin-left:10px;">Company (' . $opts['auth_plugin_ldap_mapping_company'] . '): ' . S::safeHTML($values[$opts['auth_plugin_ldap_mapping_company']]) . '</div>';
		}
		echo '</div>';
		return 'The test was successful';

	}
	function getSetting($fieldName) {
		global $settings;
		$keyName = 'auth_plugin_ldap_'.$fieldName;
		return $settings->$keyName;
	}

	function ssoEnabled() {
		if ($this->getSetting('allow_iwa_sso') != 'yes') {
			$this->error = 'IWA SSO needs to be set to "yes" in the authentication plugin\'s settings';
			return false;
		}
		if (!$this->getSetting('bind_dn')) {
			$this->error = 'Plugins requires a bind_dn for SSO to work';
			return false;
		}
		return true;
	}
	
	function singleSignOn() {
		if (!$this->ssoEnabled()) {return false;}
		$rs = $this->ldapConnect();
		if (!$rs) {return false;}
		$username = S::fromHTML($_SERVER['AUTH_USER']);
		$backSlashPos = strpos($username, '\\');
		if ($backSlashPos !== false) {
			$username = substr($username, $backSlashPos+1);
		}
		if (!$username) {return false;}
		return $username;
	}

	function ldapConnect($username = false, $password = false) {
		if ($this->cid) {return true;}
		$this->cid = ldap_connect($this->getSetting('host'), $this->getSetting('port'));
		if (!$this->cid) {
			$this->errorCode = 'PLUGIN_CONFIG';
			$this->error = 'Connection to the LDAP server failed!';
			return false;
		}
		ldap_set_option($this->cid, LDAP_OPT_PROTOCOL_VERSION, 3);
		ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 0);
		if ($this->getSetting('bind_dn')) {
			$rs = @ldap_bind($this->cid, $this->getSetting('bind_dn'), $this->getSetting('bind_password'));
			if (!$rs) {
				//"Bind failed: ".ldap_error($cid);
				$this->errorCode = 'PLUGIN_CONFIG';
				$this->error = 'Authentication with the bind DN failed';
				return false;
			}
		} else {
			$user_bind_dn = str_replace('{USERNAME}', $username, $this->getSetting('user_dn'));
			$rs = @ldap_bind($this->cid, $user_bind_dn, $password);
			if (!$rs) {
				$this->errorCode = 'WRONG_PASS';
				$this->error = "Invalid password.";
				return false;
			}
		}
		return true;
	}

	function getUserInfo($username, $password = false) {
		$this->userRecord = $this->getRemoteUserRecord($username);
		if (!$this->userRecord) {
			$this->errorCode = 'USERNAME_NOT_FOUND';//allows fall back to local authentication
			$this->error = 'The username was not found in the remote database';
			return false;
		}
		$rs = $this->formatUserDetails($this->userRecord);
		if (!$rs) {return false;}
		$userData = $rs['userData'];
		$userPerms = $rs['userPerms'];
		$userGroups = $rs['userGroups'];
		if ($password) {//not present for SSO
			$userData['password'] = $password;
		}
		return array(
			'userData' => $userData,
			'userPerms' => $userPerms,
			'userGroups' => $userGroups
		);
	}

	function formatUserDetails($remoteRecord) {
		$remoteRecord = ldap_get_attributes($this->cid, $remoteRecord);
		$values = array();
		if (array($remoteRecord)) {
			foreach ($remoteRecord as $k => $a) {
				if (!is_numeric($k) && $k != 'count') {
					$values[$k] = $a[0];
				}
			}
		}
		$mapName = $this->getSetting('mapping_name');
		$mapName2 = $this->getSetting('mapping_name2');
		if ($mapName == $mapName2) {
			$name = $values[$mapName];
			$parts = explode(" ", $name);
			$name = array_pop($parts);
			$name2 = implode(" ", $parts);
		} else {
			$name = $values[$mapName];
			$name2 = $values[$mapName2];
		}
		$userData = array(
			'name' => $name,
			'name2' => $name2,
			'email' => $values[$this->getSetting('mapping_email')]
		);
		if ($values['uid']) {
			$userData['username'] = $values['uid'];
		}
		if ($values[$this->getSetting('mapping_company')]) {
			$userData['company'] = $values[$this->getSetting('mapping_company')];
		}
		$userPerms = array();
		if ($values['homeDirectory']) {
			$userPerms['homefolder'] = str_replace('\\', '/', $values['homeDirectory']);
		}
		if (!$userData['name']) {
			$this->error = 'Missing name for the user record';
			return false;
		}
		return array(
			'userData' => $userData,
			'userPerms' => $userPerms,
			'userGroups' => array('LDAP')
		);
	}

	function getRemoteUserRecord($username) {
		$filter = str_replace("{USERNAME}", $username, $this->getSetting('search_filter'));
		$rs = @ldap_search($this->cid, $this->getSetting('search_dn'), $filter);
		if (!$rs) {
			$this->errorCode = 'PLUGIN_CONFIG';
			$this->error = "Failed to search for the LDAP record: ".ldap_error($this->cid);
			return false;
		}
		return ldap_first_entry($this->cid, $rs);
	}

	function authenticate($username, $password) {
		$rs = $this->ldapConnect($username, $password);
		if (!$rs) {return false;}
		$this->userRecord = $this->getRemoteUserRecord($username);
		if (!$this->userRecord) {
			$this->errorCode = 'USERNAME_NOT_FOUND';//allows fall back to local authentication
			$this->error = 'The provided username is not valid';
			return false;
		}
		if ($this->getSetting('bind_dn')) {
			//binding was done with predefined credentials
			//check user provided credentials
			$user_dn = ldap_get_dn($this->cid, $this->userRecord);
			if (!$user_dn) {
				$this->errorCode = 'PLUGIN_CONFIG';
				$this->error = 'Failed to retrieve user DN for the found record!';
				return false;
			}
			$rs = @ldap_bind($this->cid, $user_dn, $password);
			if (!$rs) {
				$this->errorCode = 'WRONG_PASS';
				$this->error = "Invalid password.";
				return false;
			}
		}
		$rs = $this->getUserInfo($username, $password);
		return $rs;
	}

	function listAllUsers() {
		$rs = $this->ldapConnect();
		if (!$rs) {return false;}
		$filter = '(objectClass=person)';
		$dn = $this->getSetting('search_dn');
		$rs = @ldap_search($this->cid, $dn, $filter);
		if (!$rs) {
			$this->error = "Failed to retrieve LDAP records: ".ldap_error($this->cid);
			return false;
		}
		$rs = ldap_get_entries($this->cid, $rs);
		if (!is_array($rs)) {return false;}
		array_shift($rs);
		$list = array();
		foreach ($rs as $record) {
			$list[] = $this->formatUserDetails($record);
		}
		return $list;
	}

	function listRemovedUsers() {
		$rs = $this->ldapConnect();
		if (!$rs) {return false;}
		$filter = '(objectClass=person)';
		$dn = "ou=removed,dc=example,dc=com";//you need to configure this
		$rs = @ldap_search($this->cid, $dn, $filter);
		if (!$rs) {
			$this->error = "Failed to retrieve LDAP records: ".ldap_error($this->cid);
			return false;
		}
		$rs = ldap_get_entries($this->cid, $rs);
		if (!is_array($rs)) {return false;}
		array_shift($rs);
		$list = array();
		foreach ($rs as $record) {
			$list[] = $this->formatUserDetails($record);
		}
		return $list;
	}
}
<file_sep>FR.components.detailsPanel = Ext.extend(Ext.Panel, {
	metadataCache: new Ext.util.MixedCollection(),
	readMe: false,
	initComponent: function() {
		this.metaLoaderTask = new Ext.util.DelayedTask(function(){this.loadMeta()}, this);
		this.folderIcon = '<i class="fa fa-folder" style="font-size: 35px;color:#8F8F8F"></i>';
		Ext.apply(this, {
			title: '<i class="fa fa-fw fa-2x fa-info" style="font-size:2.1em"></i>',
			cls: 'fr-details-panel',
			autoScroll: true,
			html:
				'<div id="fr-details-previewbox" style="visibility:hidden">' +
					'<div class="title">' +
						'<div style="display:table-row">' +
						'<div id="fr-details-icon"></div>' +
						'<div id="fr-details-filename"></div>' +
						'</div>' +
					'</div>' +
					'<div style="clear:both;"></div>' +
					'<div class="thumb" id="fr-details-thumb" style="display:none"></div>' +
				'</div>'+
				'<div id="fr-details-info" style="display:none"></div>'+
				'<div id="fr-details-readme" style="display:none"></div>'+
				'<div id="fr-details-metadata" style="display:none"></div>',
			listeners: {
				'afterrender': function() {
					this.previewBox = Ext.get('fr-details-previewbox');
					this.fileNameEl = Ext.get('fr-details-filename');
					this.iconEl = Ext.get('fr-details-icon');
					this.thumbContainer = Ext.get('fr-details-thumb');
					this.thumbContainer.setVisibilityMode(Ext.Element.DISPLAY);
					this.thumbContainer.on('click', function(){
						if (this.item.filetype == 'img') {
							FR.UI.imagePreview.init(this.item);
						} else {
							FR.utils.showPreview(this.item);
						}
					}, this);
					this.infoEl = Ext.get('fr-details-info').enableDisplayMode();
					this.readMeEl = Ext.get('fr-details-readme').enableDisplayMode();
					this.metadataEl = Ext.get('fr-details-metadata').enableDisplayMode();

					this.body.first().on('contextmenu', function() {
						FR.UI.gridPanel.showContextMenu();
					});
				},
				'activate': function(p){
					p.active = true;
					this.gridSelChange();
				},
				'deactivate': function(p) {p.active = false;},
				'resize': function() {if (this.active && this.item) {this.updateQuickView();}},
				scope: this
			}
		});
		FR.components.detailsPanel.superclass.initComponent.apply(this, arguments);
	},
	onRender: function() {
		FR.components.detailsPanel.superclass.onRender.apply(this, arguments);
	},
	setReadMe: function(t) {this.readMe = t;},
	gridSelChange: function() {
		if (!this.active) {return false;}
		if (!FR.UI.tree.currentSelectedNode) {return false;}
		this.countSel = FR.UI.infoPanel.countSel;
		this.countAll = FR.UI.infoPanel.countAll;
		this.item = FR.UI.infoPanel.item;
		if (this.item) {
			this.itemPath = (this.item.data.path || FR.currentPath+'/'+this.item.data.filename);
		}
		this.updateQuickView();
	},
	reset: function() {
		this.metaLoaderTask.cancel();
		this.readMeEl.hide().update('');
		this.metadataEl.update('');
		this.infoEl.update('');
	},
	setItemTitle: function(itemTitle) {
		this.fileNameEl.update(itemTitle);
		this.previewBox.show();
	},
	setIcon: function(icon) {
		this.iconEl.update(icon);
	},
	updateQuickView: function() {
		if (!this.active) {return false;}
		this.reset();

		if (this.countSel == 1) {
			this.metadataEl.show();
			this.loadQuickView();
		} else {
			this.thumbContainer.hide();
			var iconCls = FR.UI.tree.currentSelectedNode.attributes.iconCls || 'fa-folder';
			this.setIcon('<i class="fa '+iconCls+'" style="font-size: 35px;color:#8F8F8F"></i>');
			this.setItemTitle(FR.UI.tree.currentSelectedNode.text);

			var size = '';
			if (this.countAll == 0) {
				var statusText = FR.T('There are no files in this folder.');
			} else {
				var sel;
				if (this.countSel == 0) {
					sel = FR.UI.gridPanel.store.data.items;
					if (this.countAll == 1) {
						statusText = FR.T('One item');
					} else if (this.countAll > 0) {
						statusText = FR.T('%1 items').replace('%1', this.countAll);
					}
				} else {
					sel = FR.UI.gridPanel.selModel.getSelections();
					statusText = FR.T('%1 items selected').replace('%1', this.countSel);
				}
				size = 0;
				Ext.each(sel, function (item) {
					if (item.data.isFolder) {
						size = false;
						return false;
					}
					size += parseInt(item.data.filesize);
				});
				if (size > 0) {
					size = Ext.util.Format.fileSize(size);
				} else {
					size = '';
				}
			}
			var info = '<div class="status">' +
				'<div class="text">'+statusText+'</div>' +
				'<div class="size">'+size+'</div>' +
				'<div style="clear:both"></div><div>';
			this.infoEl.update(info).show();
			if (this.readMe) {
				this.readMeEl.update(this.readMe).show();
			}
		}
	},
	loadQuickView: function() {
		var title = this.item.data.isFolder ? this.item.data.filename : FR.utils.dimExt(this.item.data.filename);
		if (this.item.data.isFolder) {
			this.setIcon(this.folderIcon);
			this.setItemTitle(title);
		} else {
			var iconSrc = 'images/fico/' + this.item.data.icon;
			this.setIcon('<img src="'+iconSrc+'" height="30" align="left" style="margin-right:5px;" />');
			this.setItemTitle(title);
		}
		this.thumbContainer.hide();
		this.thumbContainer.update('');
		if (this.item.data.thumb) {
			var imageSrc;
			if (this.item.data.thumbImg) {
				imageSrc = this.item.data.thumbImg.dom.src;
			} else {
				imageSrc = FR.UI.getThumbURL(this.item.data);
			}
			this.thumbImg = Ext.get(Ext.DomHelper.createDom({tag: 'img', cls:'detailsThumb'}));
			this.thumbImg.on('load', function() {
				if (this.thumbImg.dom) {
					var naturalWidth = this.thumbImg.dom.width;
					var maxWidth = FR.UI.infoPanel.getWidth();
					var w = maxWidth-45;
					if (naturalWidth < w) {w = naturalWidth;}
					this.thumbImg.set({width: w, height: 'auto'});
					this.thumbContainer.appendChild(this.thumbImg);
					this.thumbContainer.show();
				}
			}, this);
			this.thumbImg.set({src: imageSrc});
		}

		var info = '';
		if (['starred', 'search', 'webLinked', 'photos'].indexOf(FR.currentSection) !== -1) {
			var pInfo = FR.utils.pathInfo(this.item.data.path);
			info += '<tr>' +
			'<td class="fieldName">'+FR.T('Location')+'</td>' +
			'<td class="fieldValue"><a href="javascript:;" onclick="FR.utils.locateItem(\''+pInfo.dirname+'\', \''+pInfo.basename+'\')">'+FR.utils.humanFilePath(pInfo.dirname)+'</a></td>' +
			'</tr>';
		}

		if (FR.currentSection == 'trash') {
			info += '<tr>' +
			'<td class="fieldName">'+FR.T('Deleted from')+'</td>' +
			'<td class="fieldValue">'+this.item.data.trash_deleted_from+'</td>' +
			'</tr>';
		}

		if (!this.item.data.isFolder) {
			info += '<tr>' +
			'<td class="fieldName">' + FR.T('Size') + '</td>' +
			'<td class="fieldValue" title="' + Ext.util.Format.number(this.item.data.filesize, '0,000') + ' ' + FR.T('bytes') + '">' + this.item.data.nice_filesize + '</td>' +
			'</tr>';
		}

		info += '<tr>' +
		'<td class="fieldName">'+FR.T('Type')+'</td>' +
		'<td class="fieldValue">'+this.item.data.type+'</td>' +
		'</tr>';

		if (!this.item.data.isFolder) {
			if ((this.item.data.modified && this.item.data.created) && (this.item.data.modified.getTime() != this.item.data.created.getTime())) {
				info += '<tr>' +
				'<td class="fieldName">' + FR.T('Modified') + '</td>' +
				'<td class="fieldValue" ext:qtip="'+this.item.data.modified+'">' +
					(Settings.grid_short_date ? this.item.data.modifiedHuman : Ext.util.Format.date(this.item.data.modified, FR.T('Date Format: Files'))) +
				'</td>' +
				'</tr>';
			}
		}

		if (this.item.data.created) {
			info += '<tr>' +
			'<td class="fieldName">' + FR.T('Created') + '</td>' +
			'<td class="fieldValue" ext:qtip="'+this.item.data.created+'">' +
				(Settings.grid_short_date ? this.item.data.createdHuman : Ext.util.Format.date(this.item.data.created, FR.T('Date Format: Files'))) +
			'</td>' +
			'</tr>';
		}

		info = '<table cellspacing="1" width="100%">' + info + '</table>';
		this.infoEl.update(info).show();

		if (!this.item.data.isFolder) {
			if (this.metadataCache.containsKey(this.itemPath)) {
				this.metadataEl.update(this.metadataCache.get(this.itemPath));
			} else {
				this.metaLoaderTask.delay(500);
			}
		}
	},
	loadMeta: function() {
		if (!User.perms.metadata) {return false;}
		if (!this.item) {return false;}
		this.metadataEl.update('<span style="color:silver;font-size:9px;margin:5px;">'+FR.T('Loading metadata...')+'</span>');
		Ext.Ajax.request({
			url: FR.baseURL+'/?module=metadata&page=quick_view',
			params: {path: this.itemPath},
			callback: function(opts, succ, req) {
				if (req.responseText.length == 0) {return false;}
				if (!this.metadataCache.containsKey(this.itemPath)) {
					this.metadataCache.add(this.itemPath, req.responseText);
				} else {
					this.metadataCache.replace(this.itemPath, req.responseText);
				}
				this.metadataEl.update(req.responseText);
			}, scope: this
		});
	},
	editMeta: function() {
		FR.actions.openMetadata({title: this.item.data.filename, path: this.itemPath});
	}
});<file_sep><?php

require_once realpath('.')."/page/index/indexContent.php";

?><file_sep><?php

$thisPageName = "This is new page";

$thisPageMeta = "";

$thisPageHeading = "New page";

$thisPageSubHeading = "";

$thisPageUpperContent = $_SERVER['DOCUMENT_ROOT']."/page/index/view/newpageUpperView.php";

$thisPageDownerContent = "";

$thisPageCSS = $_SERVER['DOCUMENT_ROOT']."/page/index/view/css/cssNewpage.php";

$thisPageJS = $_SERVER['DOCUMENT_ROOT']."/page/index/view/js/jsNewpage.php";

$thisPageContent = $_SERVER['DOCUMENT_ROOT']."/page/index/view/newpageView.php";

$thisPageController = $_SERVER['DOCUMENT_ROOT']."/page/index/controller/controllerNewpage.php";

if (!empty($thisPageController)){require_once $thisPageController;}

require_once $_SERVER['DOCUMENT_ROOT']."/page/_layout/_layout.php";

//echo realpath('.');

?><file_sep><?php
class custom_zamzar {

	var $online = true;
	var $urlBase = 'https://sandbox.zamzar.com/v1';
	static $localeSection = 'Custom Actions: Zamzar';

	function init() {
		$this->settings = array(
			array(
				'key' => 'APIKey',
				'title' => self::t('API key'),
				'comment' => \FileRun\Lang::t('Get it from %1', 'Admin', array('<a href="https://developers.zamzar.com" target="_blank">https://developers.zamzar.com</a>'))
			)
		);
		$this->JSconfig = array(
            'nonTouch' => true,
			"title" => self::t("Zamzar"),
			'icon' => 'images/icons/zamzar.png',
			"popup" => true, 'width' => 580, 'height' => 400,
			"requiredUserPerms" => array("download", "upload")
		);
	}

	function isDisabled() {
		return (strlen(self::getSetting('APIKey')) == 0);
	}

	static function getSetting($k) {
		global $settings;
		$key = 'plugins_zamzar_'.$k;
		return $settings->{$key};
	}

	static function t($text, $vars = false) {
		return \FileRun\Lang::t($text, self::$localeSection, $vars);
	}

	function run() {
		global $fm;
		\FileRun::checkPerms("download");
		$ext = $fm->getExtension($this->data['fileName']);
		$url = $this->urlBase.'/formats/'.S::forURL($ext);
		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('GET', $url, [
				'auth' => [self::getSetting('APIKey'), '']
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			if ($e->getResponse()->getStatusCode() == 404) {
				echo "Zamzar doesn't seem to provide any conversion option for the ".mb_strtoupper($ext)." file type.";
				exit();
			} else {
				echo 'Error: '.$e->getResponse()->getStatusCode();
			}
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			echo 'Server error: '.$e->getResponse()->getStatusCode();
			exit();
		} catch (RuntimeException $e) {
			echo 'Error: '.$e->getMessage();
			exit();
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error checking status: empty server response!');
		}
		$rs = json_decode($rs, true);
		require($this->path."/display.php");
	}
	function requestConversion() {
		$url = $this->urlBase.'/jobs';
		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('POST', $url, [
				'auth' => [self::getSetting('APIKey'), ''],
				'multipart' => [
					[
						'name'     => 'target_format',
						'contents' => S::fromHTML($_POST['format'])
					],
					[
						'name'     => 'source_file',
						'contents' => fopen($this->data['filePath'], 'r')
					]
				]
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$rs = json_decode($e->getResponse()->getBody()->getContents(), true);
			jsonFeedback(false, 'Server error: '. $rs['errors'][0]['message']);
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			jsonFeedback(false, 'Server error: '.$e->getResponse()->getStatusCode());
		} catch (RuntimeException $e) {
			jsonFeedback(false, 'Error: '.$e->getMessage());
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error requesting conversion: empty server response!');
		}
		$rs = json_decode($rs, true);
		jsonOutput(array(
			'success' => true,
			'msg' => 'Zamzar: '. $rs['status'],
			'jobId' => $rs['id']
		));

	}
	function getStatus() {
		global $fm;
		$url = $this->urlBase.'/jobs/'.S::forURL(S::fromHTML($_POST['jobId']));

		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('GET', $url, [
				'auth' => [self::getSetting('APIKey'), '']
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$rs = json_decode($e->getResponse()->getBody()->getContents(), true);
			jsonOutput(array(
				'success' => false,
				'msg' => 'Zamzar status: '.$rs['status'],
				'status' => $rs['status']
			));
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			echo 'Server error: '.$e->getResponse()->getStatusCode();
			exit();
		} catch (RuntimeException $e) {
			echo 'Error: '.$e->getMessage();
			exit();
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error checking status: empty server response!');
		}
		$rs = json_decode($rs, true);

		$rs['output']['size'] = $fm->formatFileSize($rs['output']['size']);
		jsonOutput(array(
			'success' => true,
			'msg' => 'Zamzar: '.$rs['status'],
			'status' => $rs['status'],
			'fileId' => $rs['target_files'][0]['id']
		));
	}
	function downloadConverted() {
		global $myfiles, $fm;
		$tempFilePath = $this->data['filePath'].'.zamzar.tmp';
		$toFile = fopen($tempFilePath, "wb") or die("Failed to create temporary file");
		$http = new \GuzzleHttp\Client();
		$local = \GuzzleHttp\Psr7\stream_for($toFile);
		$newName = $fm->replaceExtension($this->data['fileName'], S::fromHTML($_POST['format']));
		$url = $this->urlBase.'/files/'.S::forURL(S::fromHTML($_POST['fileId'])).'/content';
		try {
			$response = $http->request('GET', $url, [
				'auth' => [self::getSetting('APIKey'), ''],
				'save_to' => $local
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$rs = json_decode($e->getResponse()->getBody()->getContents(), true);
			jsonOutput(array(
				'success' => false,
				'msg' => 'Zamzar status: '.$rs['status'],
				'status' => $rs['status']
			));
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			jsonFeedback(false, 'Server error: '.$e->getResponse()->getStatusCode());
		} catch (RuntimeException $e) {
			jsonFeedback(false, 'Error: '.$e->getMessage());
		}
		if ($response->getStatusCode() == 200) {
			fclose($toFile);
			$rs = $myfiles->newFile($fm->dirname($this->data['relativePath']), $newName, $tempFilePath, false, true);
			if (!$rs) {
				jsonFeedback(false, 'Failed to write file data.');
			}
			jsonOutput(array(
				'success' => true,
				'newFileName' => $newName
			));
		}
	}
}<file_sep><?php
function consoleData($data) {
		echo (is_array($data)?"<script>console.log( 'Debug Objects: " . implode( ',', $data) . "' );</script>":"<script>console.log( 'Debug Objects: " . $data . "' );</script>");
}
function generateRandomString($length = 64) {
	$characters = '0123456789abcdefABCDEF';
	$charactersLength = strlen($characters);
	$randomString = '';
	for ($i = 0; $i < $length; $i++) {
		$randomString .= $characters[rand(0, $charactersLength - 1)];
	}
	return $randomString;
}
function encryptSQLString($hostname, $username, $password, $database){
	try{
		$string = $hostname."|".$username."|".$password."|".$database."|+";
		// Create Private Key
		$privateKey = pack('H*', generateRandomString()); 
		$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
		$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
		$encryptKey = strrev(bin2hex(base64_encode($privateKey."|".$iv_size."|+")));
		// Insert to privatekey
		$fileOpen = fopen("./privatekey.php","w");
		(fwrite($fileOpen,'<?php $_privateKey = "'.$encryptKey.'";?>'))?consoleData("Create Private Key Success"):consoleData("Create Private Key Fail");
		fclose($fileOpen);
		$ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $privateKey,$string, MCRYPT_MODE_CBC, $iv);
		$ciphertext = $iv . $ciphertext;
		$ciphertext_base64 = base64_encode($ciphertext);
		$fileOpen = fopen("../trigger/sqlstore.php","w");
		(fwrite($fileOpen,'<?php $_sqlEncryptString = "'.$ciphertext_base64.'";?>'))?consoleData("Create Encrypt SQL String Success"):consoleData("Create Encrypt SQL String Fail");
		fclose($fileOpen);
		consoleData("SQL String has been encrypted: ".$ciphertext_base64);
	}catch (Exception $e){
		consoleData("Error when encrypt SQL String: ".$e->getMessage());	
	}
	return ;	
}
encryptSQLString($_POST['hostname'],$_POST['username'],$_POST['password'],$_POST['database']);
header("Location: http://".$_SERVER['SERVER_NAME']."/");
?><file_sep><?php

class custom_alternate_download {

	static $localeSection = "Custom Actions: Alternate Download";

	function init() {
		$this->settings = array(
			array(
				'key' => 'config',
				'title' => self::t('Configuration JSON'),
				'large' => true,
				'comment' => self::t('See <a href="%1" target="_blank">this page</a> for more information.', array('http://docs.filerun.com/alternate_downloads'))
			)
		);
		global $config;
		$postURL = $config['url']['root'].'/?module=custom_actions&action=alternate_download&method=run';
		$this->JSconfig = array(
			"title" => self::t("Alternate Download"),
			'iconCls' => 'fa fa-fw fa-download',
			'useWith' => array(
				'img', 'wvideo', 'mp3'
			),
			"fn" => "FR.UI.backgroundPost(false, '".\S::safeJS($postURL)."')",
			"requiredUserPerms" => array("download")
		);
	}

	function isDisabled() {
		return (strlen(self::getSetting('config')) == 0);
	}

	static function getSetting($k) {
		global $settings;
		$key = 'plugins_alternate_download_'.$k;
		return $settings->{$key};
	}

	function run() {
		global $fm;
		\FileRun::checkPerms("download");
		$cfg = self::getSetting('config');
		$this->config = json_decode($cfg, true);
		if (!$this->config) {
			$this->reportError('Failed to decode JSON config!');
		}
		if (!is_array($this->config['paths'])) {
			$this->reportError('The plugin is configured with an invalid JSON set!');
		}
		$parentPath = $fm->dirname($this->data['filePath']);
		$newParentPath = false;
		$newExt = false;
		foreach($this->config['paths'] as $path) {
			if ($fm->inPath($parentPath, $path['normal'])) {
				$newParentPath = $path['alternate'];
				$newExt = $path['extension'];
				$subPath = substr($parentPath, strlen($path['normal']));
				continue;
			}
		}
		if (!$newParentPath) {
			$this->reportNotFound();
		}
		if ($newExt) {
			$fileName = $fm->replaceExtension($this->data['fileName'], $newExt);
		} else {
			$fileName = $this->data['fileName'];
		}
		$newPath = gluePath($newParentPath, $subPath, $fileName);
		if (!is_file($newPath)) {
			$this->reportNotFound();
		}
		$fileSize = $fm->getFileSize($newPath);
		\FileRun\Utils\Downloads::sendHTTPFile($newPath);
		$bytesSentToBrowser = \FileRun\Utils\Downloads::$bytesSentToBrowser;
		$logData = array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"actual_path" => $newPath,
			"file_size" => $fileSize,
			"interface" => "alternate_download",
			'original_path' => $this->data['filePath'],
			"bytes_sent" => $bytesSentToBrowser
		);
		\FileRun\Log::add(false, "download", $logData);
	}

	static function t($text, $vars = false) {
		return \FileRun\Lang::t($text, self::$localeSection, $vars);
	}

	function reportNotFound() {
		return $this->reportError('No alternate download found for the selected file.');
	}

	function reportError($msg) {
		echo '<script>window.parent.FR.UI.feedback(\''.self::t($msg).'\');</script>';
		exit();
	}

}<file_sep><?php
class custom_code_editor {
	function init() {
		$this->localeSection = "Custom Actions: Text Editor";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Text Editor", $this->localeSection),
			'iconCls' => 'fa fa-fw fa-file-text-o',
			'useWith' => array('txt', 'noext'),
			"popup" => true,
			"createNew" => array(
				"title" => \FileRun\Lang::t("Text File", $this->localeSection),
				"options" => array(
					array(
						'fileName' => \FileRun\Lang::t('New Text File.txt', $this->localeSection),
						'title' => \FileRun\Lang::t('Plain Text', $this->localeSection),
						'iconCls' => 'fa fa-fw fa-file-text-o',
					),
					array(
						'fileName' => 'index.html',
						'title' => \FileRun\Lang::t('HTML', $this->localeSection),
						'iconCls' => 'fa fa-fw fa-file-code-o',
					),
					array(
						'fileName' => 'script.js',
						'title' => \FileRun\Lang::t('JavaScript', $this->localeSection),
						'iconCls' => 'fa fa-fw fa-file-code-o',
					),
					array(
						'fileName' => 'style.css',
						'title' => \FileRun\Lang::t('CSS', $this->localeSection),
						'iconCls' => 'fa fa-fw fa-file-code-o',
					),
					array(
						'fileName' => 'index.php',
						'title' => \FileRun\Lang::t('PHP', $this->localeSection),
						'iconCls' => 'fa fa-fw fa-file-code-o',
					),
					array(
						'fileName' => 'readme.md',
						'title' => \FileRun\Lang::t('Markdown', $this->localeSection),
						'iconCls' => 'fa fa-fw fa-file-code-o',
					),
					array(
						'fileName' => '',
						'title' => \FileRun\Lang::t('Other..', $this->localeSection),
						'iconCls' => 'fa fa-fw fa-file-text-o',
					)
				)
			),
			"requiredUserPerms" => array("download", "upload")
		);
	}
	function run() {
		\FileRun::checkPerms("download");
		$this->data['fileContents'] = file_get_contents(S::forFS($this->data['filePath']));
		$enc = mb_list_encodings();
		if ($_REQUEST['charset'] && in_array($_REQUEST['charset'], $enc)) {
			$this->data['fileContents'] = S::convert2UTF8($this->data['fileContents'], $_REQUEST['charset']);
		}
		require($this->path."/display.php");
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Code Editor"
		));
	}
	function saveChanges() {
		global $myfiles, $fm;
		\FileRun::checkPerms("upload");
		$textContents = S::fromHTML($_POST['textContents']);
		$charset = S::fromHTML($_POST['charset']);
		if ($charset != 'UTF-8') {
			$textContents = S::convertEncoding($textContents, 'UTF-8', $charset);
		}
		$rs = $myfiles->newFile($fm->dirname($this->data['relativePath']), $this->data['fileName'], false, $textContents);
		if ($rs) {
			jsonOutput(array("rs" => true, "filename" => $this->data['fileName'], "msg" => \FileRun\Lang::t("File successfully saved", $this->localeSection)));
		} else {
			jsonOutput(array("rs" => false, "msg" => $myfiles->error['msg']));
		}
	}
	function createBlankFile() {
		global $myfiles, $fm;
		 \FileRun::checkPerms("upload");
		if (strlen($this->data['fileName']) == 0) {
			jsonOutput(array("rs" => false, "msg" => \FileRun\Lang::t('Please type a file name', $this->localeSection)));
		} else {
			if (is_file($this->data['filePath'])) {
				jsonOutput(array("rs" => false, "msg" => \FileRun\Lang::t('A file with that name already exists', $this->localeSection)));
			}
			$rs = $myfiles->newFile($fm->dirname($this->data['relativePath']), $this->data['fileName'], false, "");
			if ($rs) {
				jsonOutput(array("rs" => true, 'path' => $this->data['relativePath'], "filename" => $this->data['fileName'], "msg" => \FileRun\Lang::t("File successfully created", $this->localeSection)));
			} else {
				jsonOutput(array("rs" => false, "msg" => $myfiles->error['msg']));
			}
		}
	}
}<file_sep><?php
class custom_open_in_browser {
	function init() {
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t('Open in browser', 'Custom Actions'),
			'iconCls' => 'fa fa-fw fa-eye',
			'useWith' => array('nothing'),
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
		\FileRun::checkPerms("download");
		$ext = \FM::getExtension($this->data['fileName']);
		if ($ext == 'pdf') {
			$browserIsiOS = preg_match("/iPhone|Android|iPad|iPod|webOS/", $_SERVER['HTTP_USER_AGENT']);
			$browserIsChrome = (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false);
			$browserIsFirefox = (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'firefox') !== false);
			$browserIsIE8OrLower = preg_match('/(?i)msie [2-8]/',$_SERVER['HTTP_USER_AGENT']);

			if (!$browserIsChrome && !$browserIsFirefox && !$browserIsIE8OrLower && !$browserIsiOS) {
				$url = '?module=custom_actions&action=pdfjs';
				$url .= "&path=".S::forURL(S::forHTML($this->data['relativePath']));
				siteRedirect($url);
			}
		}
		\FileRun\Utils\Downloads::sendFileToBrowser($this->data['filePath']);
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Open in browser"
		));
	}
}<file_sep><?php
require_once $_SERVER['DOCUMENT_ROOT']."/page/user/register/registerContent.php";
?><file_sep><?php include_once realpath($_SERVER["DOCUMENT_ROOT"])."/setting/control.php"; ?>
<script>
	// Need to be include
	function SetRegisterDialogToLoading(registerDialog){
		registerDialog.setType(BootstrapDialog.TYPE_PRIMARY);
		registerDialog.setMessage('Please wait ...');
		registerDialog.setTitle('PROCESSING');
		return;
	}
	function SetRegisterDialogToError(registerDialog, message){
		registerDialog.setType(BootstrapDialog.TYPE_DANGER);
		registerDialog.setMessage(message);
		registerDialog.setTitle('ERROR');
		return;
	}
	function OpenRegisterDialog(registerDialog){
		registerDialog.open();
		return;
	}
	function SetDialogInGeneral(registerDialog, message, title, type){
		registerDialog.setType('type-'+type);
		registerDialog.setMessage(message);
		registerDialog.setTitle(title);
		return;
	}
</script>
<script>
	// Initial Dialog
	var registerDialog = new BootstrapDialog();
	SetRegisterDialogToLoading(registerDialog);
	OpenRegisterDialog(registerDialog);
</script>
<?php
function SetRegisterDialogToError($message){
	echo "<script>SetRegisterDialogToError(registerDialog, '".$message."');</script>";
}
function SetDialogInGeneral($message, $title, $type){
	echo "<script>SetDialogInGeneral(registerDialog, '".$message."', '".$title."', '".$type."')</script>";
}
?>
<file_sep><?php
global $fm, $settings;

$getID3 = new getID3;
$fInfo = $getID3->analyze($this->data['filePath']);

$path = str_replace('&', '%26', $this->data['relativePath']);

$URL = $config['url']['root']."/";
$URL .= S::forURL("?");
$URL .= "module=custom_actions";
$URL .= S::forURL("&");
$URL .= "action=video_player";
$URL .= S::forURL("&");
$URL .= "method=stream";
$URL .= S::forURL("&");
$URL .= "path=".S::forURL($path);
?>
<html>
<head>
	<title></title>
	<style>
		body {
			background-color: black;
			border: 0px;
			margin: 0px;
			padding: 0px;
			overflow:hidden;
		}
	</style>
	<script type="text/javascript" charset="utf-8" src="<?php echo $config['url']['root']?>/js/swfobject/swfobject.js?v=<?php echo $settings->currentVersion;?>"></script>
</head>

<body>
	<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" style="height:100%" border="0">
	<tr>
		<td align="center" valign="middle">
		<div id="videoPlayer" style="width:100%;height:100%;"></div>
		<script type="text/javascript">
			var videoSize = {
				width: parseInt('<?php echo $fInfo['video']['resolution_x']?:0; ?>'),
				height: parseInt('<?php echo $fInfo['video']['resolution_y']?:0; ?>')
			};
			if (videoSize.width < 100 || videoSize.width > window.innerWidth) {
				videoSize.width = '100%';
			}
			if (videoSize.height < 100 || videoSize.width > window.innerHeight) {
				videoSize.height = '100%';
			}
			var flashVars = {
				video: "<?php echo $URL?>",
				skin: '<?php echo $config['url']['root']?>/customizables/custom_actions/video_player/flv/mySkin.swf?v=<?php echo $settings->currentVersion;?>',
				autoplay: 1,
				menu: false,
			};
			var params = {
				allowFullScreen: true,
				wmode: 'window',
				quality: 'high'
			}
			swfobject.embedSWF("<?php echo $config['url']['root']?>/customizables/custom_actions/video_player/flv/player.swf?v=<?php echo $settings->currentVersion;?>", "videoPlayer", videoSize.width, videoSize.height, "9.0.0", "js/swfobjectexpressInstall.swf", flashVars, params);
		</script>
		</td>
	</tr>
	</table>
</body>
</html><file_sep><?php require_once $_SERVER['DOCUMENT_ROOT']."/setting/config.php"; ?>
<?php
class Page(){
	function SystemPath($thisPagePath){
		return $_phpPath.$thisPagePath;
	}
	function Name($thisPageName){
		return $thisPageName;
	}
	function Meta($thisPageMeta){
		return $thisPageMeta;
	}
	function Heading($thisPageHeading){
		return $thisPageHeading;
	}
	function SubHeading($thisPageSubHeading){
		return $thisPageSubHeading;
	}
	function Controller(){
		
	}
}
?><file_sep><?php
$thisPageName = "Register";
$thisPageMeta = "";
$thisPageHeading = "Register New Account";
$thisPageContent = $_SERVER['DOCUMENT_ROOT']."/page/user/register/view/registerView.php";
$thisPageController = $_SERVER['DOCUMENT_ROOT']."/page/user/register/controller/registerController.php";
if (!empty($thisPageController)){require_once $thisPageController;}
require_once $_SERVER['DOCUMENT_ROOT']."/page/_layout/_layout.php";
?><file_sep><?php
/*
FileRun
The username is "superuser".
The password is " <PASSWORD> ".
*/
?><file_sep><?php
$_smtpEncryptString = "";
?><file_sep><?php

////////////////////////////////////////////////////

// Version 1

// Load general css

/*

foreach (getAllFileInFolderWithType($_phpPath.'css', 'css') as $cssFile){

	echo '<link rel="stylesheet" href="'.$_url.'css/'.$cssFile.'">';

}



foreach (getAllFileInFolderWithType($_phpPath.'page'.(empty(substr($_SERVER['REQUEST_URI'],1))?'/index':$_SERVER['REQUEST_URI']).'/view/css', 'css') as $cssFile){

	echo '<link rel="stylesheet" href="'.$_url.'page/'.(empty(substr($_SERVER['REQUEST_URI'],1))?'index':$_SERVER['REQUEST_URI']).'/view/css/'.$cssFile.'">';

}

*/



///////////////////////////////////////////////////

// Version 2

// On Work

// consoleData($_documentPath);

//

// On Test



// Get Private chi co minh no

/*

Vi du:

	css > product

	Tat ca cac file trong product chi co minh no dc xem





*/

// Va tat ca cac Public thi se co may thang khac nua

/*

Vi du:

	css > product > public

	css > product > viewdetail 

	

	view viewdetail se thua huong tu css product > public

	

	neu cay dai` hon

	

	css > product > viewdetail > item

	

	Thi item se thua huong cua

	css > product > public

	css > product > viewdetail > public

	



*/

// Should be in config.php to re-use





for ($x = 0; $x < $_countGetPath; $x++){

	// Get All Public Inheritent File

	$_combineLine[$x] = $_combineLine[$x - 1].$_getPath[$x].'/';

	//consoleData('Path: '.$_phpPath.'css'.$combineLine[$x]);

	//consoleData(getAllFileInFolderWithType($_phpPath.'css'.$combineLine[$x], 'css'));

	foreach (getAllFileInFolderWithType($_phpPath.'css'.$_combineLine[$x], 'css') as $cssFile){

		echo('<link rel="stylesheet" href="'.$_url.'css'.$_combineLine[$x].$cssFile.'">');

	}

	// Get Private File

	if ($x == ($_countGetPath - 1)){

		// consoleData($_phpPath.'css'.$_documentPath.'/private');

		foreach (getAllFileInFolderWithType($_phpPath.'css'.$_combineLine[$x].'private', 'css') as $cssFile){

			echo('<link rel="stylesheet" href="'.$_url.'css'.$_combineLine[$x].'private/'.$cssFile.'">');

		}

	}

}

?><file_sep><?php
use \CloudConvert\Api;

class custom_cloudconvert {

	var $online = true;
	static $localeSection = "Custom Actions: CloudConvert";

	function init() {
		$this->settings = array(
			array(
				'key' => 'APIKey',
				'title' => self::t('API Key'),
				'comment' => \FileRun\Lang::t('Get it from %1', 'Admin', array('<a href="https://cloudconvert.com/api" target="_blank">https://cloudconvert.com/api</a>'))
			)
		);
		$this->JSconfig = array(
            'nonTouch' => true,
			"title" => self::t("CloudConvert"),
			'icon' => 'images/icons/cloudconvert.png',
			"popup" => true, 'width' => 580, 'height' => 400,
			"requiredUserPerms" => array("download", "upload")
		);
	}

	function isDisabled() {
		return (strlen(self::getSetting('APIKey')) == 0);
	}

	static function getSetting($k) {
		global $settings;
		$key = 'plugins_cloudconvert_'.$k;
		return $settings->{$key};
	}

	static function t($text, $vars = false) {
		return \FileRun\Lang::t($text, self::$localeSection, $vars);
	}

	function run() {
		global $fm;
		\FileRun::checkPerms("download");
		$ext = $fm->getExtension($this->data['fileName']);
		$api = new Api(self::getSetting('APIKey'));
		$rs = $api->get('/conversiontypes', ['inputformat' => \S::forURL($ext)]);
		require($this->path."/display.php");
	}

	function requestConversion() {
		global $fm;
		$ext = $fm->getExtension($this->data['fileName']);
		$targetFormat = S::fromHTML($_POST['format']);
		$api = new Api(self::getSetting('APIKey'));
		try {
			$process = $api->convert([
				'inputformat' => $ext,
				'outputformat' => $targetFormat,
				'input' => 'upload',
				'filename' => $this->data['fileName'],
				'file' => fopen($this->data['filePath'], 'r'),
				'callback' => 'http://_INSERT_PUBLIC_URL_TO_/callback.php'
			]);

		} catch (\CloudConvert\Exceptions\ApiBadRequestException $e) {
			jsonFeedback(false, "Error: " . $e->getMessage());
		} catch (\CloudConvert\Exceptions\ApiConversionFailedException $e) {
			jsonFeedback(false, "Conversion failed, maybe because of a broken input file: " . $e->getMessage());
		}  catch (\CloudConvert\Exceptions\ApiTemporaryUnavailableException $e) {
			jsonFeedback(false, "API temporary unavailable: ".$e->getMessage());
		} catch (Exception $e) {
			jsonFeedback(false, "Error: " . $e->getMessage());
		}
		jsonOutput(array(
			'success' => true,
			'msg' => 'CloudConvert: '. $process->message,
			'url' => $process->url
		));

	}

	function getStatus() {
		global $fm;
		$url = S::fromHTML($_POST['statusURL']);
		if (strtolower(substr($url, 0, 6)) != 'https:') {
			$url = 'https:'.$url;
		}
		$api = new Api(self::getSetting('APIKey'));
		$process = new \CloudConvert\Process($api, $url);
		$process->refresh();

		if ($process->step == 'finished') {
			$tempFile = gluePath($this->data['filePath'].'.'.$process->output->size.'.upload');
			$rs = $process->download($tempFile);

			global $myfiles;
			$fileName = \FM::replaceExtension($this->data['fileName'], $process->output->ext);
			$rs = $myfiles->newFile($fm->dirname($this->data['relativePath']), $fileName, $tempFile, false, true);
			if (!$rs) {
				jsonOutput(array(
					'success' => false,
					'msg' => 'Failed to save the downloaded file',
					'step' => 'error'
				));
			}
			jsonOutput(array(
				'success' => true,
				'msg' => 'Converted file was saved',
				'step' => 'downloaded',
				'newFileName' => $fileName
			));
		}

		jsonOutput(array(
			'success' => false,
			'msg' => 'CloudConvert: '.$process->message,
			'step' => $process->step,
			'percent' => $process->percent,
			'output' => $process->output
		));
	}
}<file_sep><?php

$thisPageName = "Homepage";

$thisPageMeta = "";

$thisPageHeading = "Welcome to Modern Business";

$thisPageSubHeading = "";

$thisPageUpperContent = $_SERVER['DOCUMENT_ROOT']."/page/index/view/indexUpperView.php";

$thisPageDownerContent = "";

$thisPageContent = $_SERVER['DOCUMENT_ROOT']."/page/index/view/indexView.php";

$thisPageController = $_SERVER['DOCUMENT_ROOT']."/page/index/controller/controllerIndex.php";

if (!empty($thisPageController)){require_once $thisPageController;}

require_once $_SERVER['DOCUMENT_ROOT']."/page/_layout/_layout.php";

//echo realpath('.');
?><file_sep>// JavaScript Document

// This function need to be improve:

// Because if second level apply it will be wrong.

$(function() {

     var pgurl = window.location.href;

	 $("#nav ul li a").each(function(){

          if(/*regexCheck($(this).attr("href"), pgurl) ||*/ $(this).attr("href") == pgurl || $(this).attr("href") == '' )

          $(this).parent().addClass("active");

     })

	 

	 $("img").lazyload();

});





<file_sep><?php require_once $_SERVER['DOCUMENT_ROOT']."/setting/control.php"; ?>
<?php
// Should Include Auto get CSS and JS private only, Must check if include yes or not.
?><file_sep><?php
$_sqlEncryptString = "";
?><file_sep><html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title></title>
	<link rel="stylesheet" type="text/css" href="css/style.css?v=<?php echo $settings->currentVersion;?>" />
	<link rel="stylesheet" type="text/css" href="css/ext.php?v=<?php echo $settings->currentVersion;?>" />
	<script type="text/javascript" src="js/min.php?extjs=1&v=<?php echo $settings->currentVersion;?>"></script>
	<script src="customizables/custom_actions/audio_player/js/soundmanager2-nodebug-jsmin.js?v=<?php echo $settings->currentVersion;?>"></script>
	<script type="text/javascript" src="customizables/custom_actions/audio_player/js/app.js?v=<?php echo $settings->currentVersion;?>"></script>
	<script type="text/javascript" src="customizables/custom_actions/audio_player/js/aurora.js?v=<?php echo $settings->currentVersion;?>"></script>
	<script type="text/javascript" src="customizables/custom_actions/audio_player/js/flac.js?v=<?php echo $settings->currentVersion;?>"></script>
	<script type="text/javascript">
		var URLRoot = '<?php echo S::safeJS($config['url']['root'])?>';
		FR.popupId = '<?php echo S::safeJS(S::fromHTML($_REQUEST['_popup_id']))?>';
		FR.countFiles = <?php echo sizeof($audioFiles)?>;
		FR.files = <?php echo json_encode($audioFiles)?>;
		FR.currentIndex = <?php echo $currentIndex?>;
	</script>
	<style>
		.x-grid3-scroller {overflow-x: hidden;}
	</style>
</head>

<body id="theBODY" onload="FR.init()">
</body>
</html><file_sep>// JavaScript Document
function regexCheck(regexPattern, inputString){
  "use strict";	
  return (regexPattern.test(inputString))?true:false;
}

function emailPattern(){
	"use strict";
	const emailPattern = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	return emailPattern;
}

/*function passwordPattern(){
	const passwordPattern = //;
	return passwordPattern;
}
*/
function matching2WordsPattern(inputString){
	"use strict";
	const matching2WordsPattern = new RegExp("^("+inputString+")$");
	return matching2WordsPattern;
}

function passwordPattern(){
	"use strict";
	const passwordPattern = /^[^\s\"\']+$/;
	return passwordPattern;
}

function passwordComplexPattern(){
	"use strict";
	const passwordComplexPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*(_|[^\w])).+$/;
	return passwordComplexPattern;
}

function textPattern(){
	"use strict";
	const textPattern = /^[\d\w\s\!\@\#\$\%\^\&\*\(\)\+\-\.\_\-]+$/;
	return textPattern;
}
	<file_sep>FR.components.infoPanel = Ext.extend(Ext.Panel, {//if using TabPanel directly, there are layout problems
	baseCls: 'fr-info-panel',
	initComponent: function() {
		Ext.apply(this, {
			listeners: {
				'collapse': function() {
					FR.UI.actions.info.toggle(false, true);
				},
				'expand': function() {
					FR.UI.actions.info.toggle(true, true);
					this.gridSelChange();
				}
			}
		});
		FR.components.infoPanel.superclass.initComponent.apply(this, arguments);
	},
	customCollapse: function() {
		FR.localSettings.set('infoPanelState', 'collapsed');
		this.collapse();
	},
	customExpand: function() {
		FR.localSettings.set('infoPanelState', 'expanded');
		this.expand();
	},
	onRender: function() {
		FR.components.infoPanel.superclass.onRender.apply(this, arguments);
	},
	gridSelChange: function() {
		if (this.collapsed) {return false;}
		this.countSel = FR.UI.gridPanel.countSel;
		this.countAll = FR.UI.gridPanel.store.getCount();
		var showActivityTab = false;
		var hideCommentsTab = !User.perms.read_comments;
		if (this.countSel == 1) {
			this.item = FR.currentSelectedFile;
			if (FR.currentSection == 'trash' || this.item.data.isFolder) {
				hideCommentsTab = true
			} else {
				FR.UI.commentsPanel.setItem(this.item.data.path, this.item.data.comments);
			}
		} else {
			hideCommentsTab = true;
			this.tabPanel.unhideTabStripItem(1);
			if (FR.currentSection == 'myfiles') {
				this.tabPanel.unhideTabStripItem(1);
				showActivityTab = User.perms.file_history;
			} else if (FR.currentSection == 'sharedFolder') {
				showActivityTab = Settings.filelog_for_shares;
			}
			this.item = null;
		}
		if (!showActivityTab) {
			if (this.tabPanel.getActiveTab() == FR.UI.activityPanel) {
				this.tabPanel.setActiveTab(0);
			}
			this.tabPanel.hideTabStripItem(1);
		}
		if (hideCommentsTab) {
			if (this.tabPanel.getActiveTab() == FR.UI.commentsPanel) {
				FR.UI.infoPanel.tabPanel.setActiveTab(0);
			}
			this.tabPanel.hideTabStripItem(2);
		} else {
			this.tabPanel.unhideTabStripItem(2);
		}
		FR.UI.detailsPanel.gridSelChange();
	},
	folderChange: function() {
		FR.UI.detailsPanel.metadataCache.clear();
		if (this.tabPanel.getActiveTab() == FR.UI.activityPanel) {
			FR.UI.activityPanel.load();
		}
	}
});<file_sep>Need a function to get all information of the current login member

When request successful (After regex check)
Get privatekey of him => This key will need to encrypt all his data. Otherwise it will show there data in F12 which is not cool

Need function check exist file RETURN true false

Business layer implement => 

Access to db and do the business logic

Like have a coffeemachine need to find the employee responsible to the coffee machine

=> Code the get employee responsible in the business layer

Include it in the file controller

Call that function in there.

---------

Should put _partialLayout
 
---------

Control Email template

Replace @example to word that wanted

--------

Put escape string in to remove error

<<<<<<< HEAD

--------

V2.1:

config.php will include control.php => Version 1 migrate to version 2 is possible.

=======
--------

Cronjob: https://github.com/rse/jquery-schedule - http://shawnchin.github.io/jquery-cron/ - http://www.aegissofttech.com/Articles/use-of-jqeury-cron-in-dot-net-mvc-application.html

Log: https://github.com/remybach/jQuery.clientSideLogging
>>>>>>> origin/master
<file_sep>Current Version: 2.0.0.0 Alpha

Testing Server:
	
	Hostinger.vn, Hostfree.pw

Consider to update:

	Get absolute path file: NOT YET
		substr(__FILE__, 0, -strlen($_SERVER['SCRIPT_NAME']));

	Rewrite URL: DONE
		$URL/page/about
		to 
		$URL/about
		
		Multiple mini project in big project:
			Original: $URL/page/User/.../
			User/register/
			User/login/
			User/forgotpassword/
			User/viewdetails/
			User/index = User/

	Auto get CSS and JS in folder: DONE 1st Level
		Need: Create a function

	Auto Active Link in Navbar: DONE 1st Level
		Finish auto active link in first level page: Index, Contact, About
		Unfinish: Product > Viewdetail
		Need: 
			- Do loop to get all level of directory and go backward to active link.
			- Or: Find the url and active the link if inside link active outside do to apply on CSS.

	Lazyload: https://www.appelsiini.net/projects/lazyload
		Should be apply
		
***********************************************************************
Task:
	

	Planning Tomorrow Task:
		- Finish wiki for create new page, need to check the logic again.	
	
	Daily Task:	

	
***********************************************************************
****************This website template made by NeV3RmI******************
***********************************************************************

1/ Config

FOR RMIT Student:
Open File and change all the s3515215 to your student number

2/ Config MySQL

Open setting/mysql_config.php

Notice this template use [mysqli] not [mysql]

3/ Enable

JS

+ Bootstrap
+ Jquery

PHP
 
+ Connect MySQL
+ All link to one

Other Feature

+ GZIP Compression
+ .htaccess
+ .htpasswd<file_sep><?php

class custom_pixlr {

	var $online = true;
	var $localeSection = "Custom Actions: Pixlr";

	function init() {
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Pixlr", $this->localeSection),
			'icon' => 'images/icons/pixlr.png',
			"extensions" => array("jpg", "jpeg", "gif", "png", "psd", "bmp", "pxd"),
			"popup" => true, "external" => true,
			"requiredUserPerms" => array("download", "upload"),
			"createNew" => array(
				"title" => \FileRun\Lang::t("Image with Pixlr", $this->localeSection),
				"defaultFileName" => \FileRun\Lang::t("Untitled.png", $this->localeSection)
			)
		);
		$this->outputName = "image";
	}
	function run() {
		global $config;
		$weblinkInfo = $this->weblinks->createForService($this->data['filePath'], false, $this->data['shareInfo']['id']);
		if (!$weblinkInfo) {
			echo "Failed to setup weblink";
			exit();
		}
		$this->data['fileURL'] = $this->weblinks->getURL(array("id_rnd" => $weblinkInfo['id_rnd']));
		$this->data['saveURL'] = $this->weblinks->getSaveURL($weblinkInfo['id_rnd'], false, "pixlr");

		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Pixlr"
		));

		$proto = isSSL() ? "https" : "http";
		$url = $proto."://apps.pixlr.com/editor/";
		//$url .= "?method=POST";
		$url .= "?image=".urlencode($this->data['fileURL']);
		$url .= "&referrer=".urlencode($config['settings']['app_title']);
		$url .= "&target=".urlencode($this->data['saveURL']);
		$url .= "&title=".urlencode($this->data['fileName']);
		$url .= "&redirect=false";
		$url .= "&locktitle=true";
		$url .= "&locktype=true";
		header('Location: '.$url);
	}
	function createBlankFile() {
		global $myfiles, $fm;
		if (!\FileRun\Perms::check('upload')) {exit();}
		if (file_exists($this->data['filePath'])) {
			jsonOutput(array("rs" => false, "msg" => \FileRun\Lang::t('A file with the specified name already exists. Please try again.', $this->localeSection)));
		}
		$blankFilePath = gluePath($this->path, "blank.png");
		$rs = $myfiles->newFile($fm->dirname($this->data['relativePath']), $this->data['fileName'], $blankFilePath);
		if ($rs) {
			jsonOutput(array("rs" => true, 'path' => $this->data['relativePath'], "filename" => $this->data['fileName'], "msg" => \FileRun\Lang::t("Blank image created successfully", $this->localeSection)));
		} else {
			jsonOutput(array("rs" => false, "msg" => $myfiles->error['msg']));
		}
	}
	function getNewFileContents() {
		return file_get_contents(S::fromHTML($_GET['image']));
	}
}<file_sep><?php
class custom_handle_url {
    var $localeSection = 'Custom Actions: Link Opener';
	function init() {
		$this->JSconfig = array(
			'title' => \FileRun\Lang::t('Link Opener', $this->localeSection),
			'iconCls' => 'fa fa-fw fa-share-square-o',
			'extensions' => array('url'),
			'replaceDoubleClickAction' => true,
			'popup' => true,
            'requiredUserPerms' => array('download')
		);
	}
	function run() {
       \FileRun::checkPerms("download");
		$c = file($this->data['filePath']);
		foreach ($c as $r) {
			if (stristr($r, 'URL=') !== false) {
				header('Location: '.str_ireplace(array('URL=', '\''), array(''), $r));
				exit();
			}
		}
	}
}
<file_sep><script type="text/javascript">

function getURL(){

	return "<?php echo $_url?>";

}

</script><file_sep><?php
// Priority
$_phpPath = $_SERVER['DOCUMENT_ROOT']."/";
// Include User Config
include_once $_phpPath."setting/config.php";


// Configuration
$_q = "'";
$_p = '"';
$_url = "http".($_useHTTPs == 1 ? "s" : "")."://" . $_SERVER['SERVER_NAME']."/";
$_fullUrl = "http".($_useHTTPs == 1 ? "s" : "")."://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$_documentPath = $_SERVER['REQUEST_URI'];
$_getPath = explode("/",$_documentPath);
if ($_getPath[1] == "" || !isset($_getPath[1])){
	$_getPath[1] = "index";
}
$_countGetPath = count($_getPath);

// Page Setting
$_copyRight = "Copyright ".$_sitePublisher." &copy; ". $_siteCopyrightYear;

// PHP FUNCTION
	// PHP Library Include
	if ($_usePhpLibrary == 1){
		include_once $_phpPath."setting/php_library.php";
	}
	// Trigger Package: SQL, SMTP, Email
	if ($_useTrigger == 1){
		include_once $_phpPath."setting/trigger/trigger.php";
	}
		// Connecting MySQL
		if ($_useMysql == 1){
			include_once $_phpPath."setting/database_access.php";
			include_once $_phpPath."setting/mysql_config.php";
		}
	
	if ($_useGzipCompress == 1){
		if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start('ob_gzhandler'); else ob_start(); 	
	}
	if ($_useHTTPs == 1){
	}
	/*
	if ($turnofferror_s == 0){
		error_reporting(0);	
	}*/
	if ($_useSession == 1){
		session_start();
	}
?><file_sep><?php
//0-None, 1-Use
$_useTrigger = 1; // This include config for SMTP, Email, SQL
	$_useMysql = 1; 
$_usePhpLibrary = 1; 
$_useGzipCompress = 1;
$_useDebug = 1; // 0 - Off, 1 - Simple, 2 - All
$_useSession = 1;
$_useHTTPs = 1; // Learn how to make a free SSL: http://www.selfsignedcertificate.com/
$_useFileManager = 1;

// System Variable
$_siteName = "PHP Easy";
$_sitePublisher = "NeV3RmI";
$_siteCopyrightYear = "2013 - 2016";
$_siteVersion = "2.0.0.0";

// General Meta Variable


//Regex Library
$_regexMail = '/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/';
$_regexPassword = '/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*(_|[^\w])).+$/';


// Connect DB String
$_dbHostName = $selectedSQLKey[0];	
$_dbUsername = $selectedSQLKey[1];	
$_dbPassword = $selectedSQLKey[2];
$_dbDatabase = $selectedSQLKey[3];

?><file_sep><?php
$_emailEncryptString = "";
?><file_sep><?php

require_once $_SERVER['DOCUMENT_ROOT']."/page/about/aboutContent.php";

?><file_sep><?php
global $config, $settings, $fm;
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title></title>
	<link rel="stylesheet" type="text/css" href="css/ext.php?v=<?php echo $settings->currentVersion;?>" />
	<script type="text/javascript" src="js/min.php?extjs=1&v=<?php echo $settings->currentVersion;?>"></script>
	<script type="text/javascript" src="customizables/custom_actions/arch/grid.js?v=<?php echo $settings->currentVersion;?>"></script>
	<style>
		.x-grid3-cell {font-family: tahoma, arial, helvetica, sans-serif;}
	</style>
</head>

<body>
	<table id="theTable" width="100%">
		<thead>
			<tr class="header">
				<th name="filename">File name</td>
				<th name="size">Size</td>
				<th name="path">Path</td>
			</tr>
		</thead>
		<tbody>
		<?php
		$limit = 50;
		$i = 0;
		foreach ($list as $key => $item) {
			if ($i == $limit) {
				?>
				<tr>
					<td>Archive contains <?php echo $count-$limit;?> files more that are not displayed in this preview.</td>
					<td>&nbsp;</td>
				</tr>
				<?php
				break;
			}
			if ($item['checksum'] != "00000000") {
				if ($item['utf8_encoded']) {
					$srcEnc = "UTF-8";
				} else {
					if ($config['app']['encoding']['unzip']) {//convert from a predefined encoding
						$srcEnc = $config['app']['encoding']['unzip'];
					} else {
						$srcEnc = S::detectEncoding($item['filename']);
					}
				}

				$item['filename'] = \S::convert2UTF8($item['filename'], $srcEnc);
				if ($item['type'] == "file" && $item['filename']) {
				?>
				<tr>
					<td><img src="<?php echo $fm->getFileIconURL($item['filename']);?>" border="0" height="16" width="16"> <?php echo S::safeHTML($item['filename']);?></td>
					<td width="100"><?php echo $fm->formatFileSize($item['filesize']);?></td>
					<td><?php echo S::forHTML(gluePath("/", $item['path']), 1);?></td>
				</tr>
				<?php
				$i++;
				}
			}
		}
		?>
		</tbody>
	</table>
</body>
</html><file_sep>css and js is private to this page only<file_sep><?php
$config['app']['software_update']['url'] = 'https://www.filerun.com/updates/ionCube7';<file_sep><?php
if (isset($_GET['oauth2'])) {
	$files = array(
		'roboto/load.css',
		'normalize.css',
		'skeleton.css',
		'oauth2.css'
	);
} else if (isset($_GET['file_request'])) {
	$files = array(
		'roboto/load.css',
		'file_request.css'
	);
} else {
	$files = array(
		'roboto/load.css',
		//'_ext-all.css',
		'ext-all.min.css',
		'ext-filerun.css',
		'../js/ext/ux/ProgressColumn/ProgressColumn.css',
		'font-awesome/css/font-awesome.min.css'
	);
}

if (extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler")) {
	ini_set("zlib.output_compression", 1);
}

header("Content-type: text/css; charset: UTF-8");
header("Cache-control: public");
header("Pragma: cache");
header("Expires: " . gmdate ("D, d M Y H:i:s", time() + 31356000) . " GMT");

foreach ($files as $key => $file) {
	readfile($file);
	echo "\r\n";
}<file_sep><?php include_once realpath($_SERVER["DOCUMENT_ROOT"])."/setting/control.php"; ?>
 <li>
  <p class="navbar-text">Already have an account?</p>
</li>
<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><b>Login</b> <span class="caret"></span></a>
  <ul id="login-dp" class="dropdown-menu">
   <li>
   	<div class="row" id="loginMessage">
   		
   	</div>
   </li>
    <li>
      <div class="row">
        <div class="col-md-12"> Login via
          <div class="social-buttons"> <a href="#" class="btn btn-fb"><i class="fa fa-facebook"></i> Facebook</a> <a href="#" class="btn btn-tw"><i class="fa fa-twitter"></i> Twitter</a> </div>
          or
          <form class="form" accept-charset="UTF-8" id="userLoginForm">
            <div class="form-group">
              <label class="sr-only" for="exampleInputEmail2" id="userEmail">Email address</label>
              <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Email address" name="userEmail" required>
            </div>
            <div class="form-group">
              <label class="sr-only" for="exampleInputPassword2" id="userPassword">Password</label>
              <input type="<PASSWORD>" class="form-control" id="exampleInputPassword2" placeholder="<PASSWORD>" name="userPassword" required>
              <div class="help-block text-right"><a href="">Forget the password ?</a></div>
            </div>
            <div class="form-group"> <a class="btn btn-primary btn-block" id="userRequestLogin" onClick="submitForm('#userLoginForm')">Sign in</a> </div>
            <div class="checkbox">
              <label>
                <input type="checkbox" name="userKeepLogin">
                <span>Keep me logged-in</span> </label>
            </div>
          </form>
        </div>
        <div class="bottom text-center"> New here ? <a href="<?php echo $_url;?>user/register"><b>Join Us</b></a> </div>
      </div>
    </li>
  </ul>
</li>
<file_sep><?php include_once realpath($_SERVER["DOCUMENT_ROOT"])."/setting/control.php"; ?>
<?php include_once $_phpPath."page/user/register/partialview/addNewUserPartialView.php"; ?>
<?php
$email = $_POST['registerEmail'];
$password = $_POST['registerPassword'];
$retypePassword = $_POST['registerRetypePassword'];
$termAndCondition = $_POST['registerRuleAccepted'];

// Regex Value
if (!RegexCheck($_regexMail,$email)){
	SetRegisterDialogToError("Invalid type of email");
	exit();
};
if (!RegexCheck($_regexPassword,$password)){
	SetRegisterDialogToError("Invalid type of password");
	exit();
};
if (!RegexCheck($_regexPassword,$retypePassword)){
	SetRegisterDialogToError("Invalid type of retype password");
	exit();
};
if ($termAndCondition != "on"){
	SetRegisterDialogToError("You must agree term before sign up");
	exit();
};
// 

// Create Private Key
if ($privateKey = CreatePrivateKey()){
	if ($salt = CreatingSalt(CreatingHash($password))){
		$result = "Your Private Key: ".$privateKey."<br>Your Salt: ".$salt;
		SetDialogInGeneral($result,"Personal Details","primary");
	}else{
		SetRegisterDialogToError("Cannot create Salt");
		exit();
	}
}else{
	SetRegisterDialogToError("Cannot create Private Key");
	exit();
}

// Need to run independently
?><file_sep><?php

if (!empty($_SESSION['id'])){

	echo '<script type="text/javascript" defer>$(function(){loadLoginNavigationBar();});</script>';			

}else{

	echo '<script type="text/javascript" defer>$(function(){loadBeforeLoginNavigationBar();});</script>';	

}

?>

<file_sep><?php
chdir(dirname(dirname(__FILE__)));
if (isset($_GET['cpanel'])) {
	$files = array(
		'js/ext/ux/ScriptLoader.js',
		'js/cpanel/ext.overrides.js',
		'js/cpanel/app.js',
		'js/cpanel/tree.js',
		'js/cpanel/grid.js',
		'js/cpanel/layout.js',
		'js/fileman/user_chooser.js',
		'js/cpanel/userslist.comp.js',
		'js/cpanel/editform.comp.js',
		'js/genpass.js',
		'js/ext/ux/statusbar/StatusBar.js'
	);
} else if (isset($_GET['extjs'])) {
	if (isset($_GET['debug'])) {
		$files = array(
			'js/ext/adapter/ext/_ext-base-debug.js',
			'js/ext/_ext-all-debug-w-comments.js',
			'js/ext/ux/overrides.js',
			'js/ext/ux/LocalStorage.js',
			'js/ext/ux/FileRunPrompt.js',
			'js/ext/ux/ListPanel.js'
		);
	} else {
		$files = array(
			'js/ext/adapter/ext/ext-base.js',
			'js/ext/ext-all.js',
			'js/ext/ux/overrides.js',
			'js/ext/ux/LocalStorage.js',
			'js/ext/ux/FileRunPrompt.js',
			'js/ext/ux/ListPanel.js'
		);
	}
} else if (isset($_GET['weblink_gallery'])) {
		$files = array(
			'js/jquery/jquery.min.js',
			'js/nanobar.min.js',
			'js/headroom.min.js',
			'js/jquery/jG/jquery.justifiedGallery.min.js',
			'js/weblink.js'
		);
		if (isset($_GET['debug'])) {
			$files[] = 'js/jquery/swipebox/js/_jquery.swipebox.js';
		} else {
			$files[] = 'js/jquery/swipebox/js/jquery.swipebox.min.js';
		}
} else if (isset($_GET['file_request'])) {
	$files = array(
		'js/file_request.js'
	);
	if (isset($_GET['debug'])) {
		$files[] = 'js/flow/_flow.js';
		$files[] = 'js/flow/_flowfile.js';
		$files[] = 'js/flow/_flowchunk.js';
	} else {
		$files[] = 'js/flow/all-standalone.min.js';
	}
} else if (isset($_GET['flow'])) {
	if (isset($_GET['debug'])) {
		$files[] = 'js/flow/_flow.js';
		$files[] = 'js/flow/_flowfile.js';
		$files[] = 'js/flow/_flowchunk.js';
		$files[] = 'js/flow/_flowext.js';
	} else {
		$files[] = 'js/flow/all.min.js';
	}
} else if (isset($_GET['flow-standalone'])) {
	if (isset($_GET['debug'])) {
		$files[] = 'js/flow/_flow.js';
		$files[] = 'js/flow/_flowfile.js';
		$files[] = 'js/flow/_flowchunk.js';
	} else {
		$files[] = 'js/flow/all-standalone.min.js';
	}
} else {
	$files = array(
		'js/ext/ux/ProgressColumn/ProgressColumn.js',
		'js/ext/ux/GridDragSelector.js',
		'js/fileman/filerun.js',
		'js/fileman/toolbars_and_menus.js',
		'js/fileman/grid.js',
		'js/fileman/tree.js',
		'js/fileman/info_panel.js',
		'js/fileman/details_panel.js',
		'js/fileman/download_cart.js',
		'js/fileman/activity_panel.js',
		'js/fileman/comments_panel.js',
		'js/fileman/layout.js',
		'js/fileman/ui_utils.js',
		'js/fileman/actions.js',
		'js/fileman/image_viewer.js'
	);
	if (isset($_GET['debug'])) {
		$files[] = 'js/flow/_flow.js';
		$files[] = 'js/flow/_flowfile.js';
		$files[] = 'js/flow/_flowchunk.js';
		$files[] = 'js/flow/_flowext.js';
	} else {
		$files[] = 'js/flow/all.min.js';
	}
}


if (extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler")) {
	ini_set("zlib.output_compression", 1);
}

header("Content-Type: application/javascript; charset=UTF-8");
header("Cache-control: public");
header("Pragma: cache");
header("Expires: " . gmdate ("D, d M Y H:i:s", time() + 31356000) . " GMT");

foreach ($files as $key => $file) {
	readfile($file);
	echo "\r\n";
}<file_sep><?php
class custom_audio_player {
	function init() {
		$this->localeSection = "Custom Actions: Audio Player";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Audio Player", $this->localeSection),
			'iconCls' => 'fa fa-fw fa-music',
			'useWith' => array('mp3'),
			"popup" => true,
			'width' => 400, 'height' => 400,
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
		global $config, $settings, $fm;

		$folderRelativePath = \FM::dirname($this->data['relativePath']);
		$folderPath = \FM::dirname($this->data['filePath']);
		$ext = \FM::getExtension($this->data['fileName']);

		$audioFiles = array();
		$currentIndex = 0;

		if ($ext == "m3u" || $ext == "m3u8") {
			$lines = file($this->data['filePath']);
			foreach ($lines as $line) {
				if (substr($line, 0, 5) == "http:") {
					$audioFiles[] = array($line, $line);
				}
			}
		} else if ($ext == "pls") {
			$lines = file($this->data['filePath']);
			foreach ($lines as $line) {
				if (substr($line, 0, 4) == "File") {
					$pos = strpos($line, "=");
					$url = substr($line, $pos+1);
					$audioFiles[] = array($url, $url);
				}
			}
		} else {
			if (isset($config['app']['audioplayer']['playlist']) && !$config['app']['audioplayer']['playlist']) {
				$url = $config['url']['root'];
				$url .= "/?module=custom_actions&action=audio_player&method=stream";
				$url .= "&path=" . S::forURL(gluePath($folderRelativePath, $this->data['fileName']));
				$audioFiles[] = array($url, $this->data['fileName']);
				$currentIndex = 0;
			} else {
				$list = \FileRun\Files\Utils::listFolder($folderPath, false, false, false, true);
				if (is_array($list) && sizeof($list) > 0) {
					$i = 0;
					foreach ($list as $fileName) {
						$info = $fm->fileTypeInfo($fileName);
						if ($info['type'] == 'mp3') {
							$url = $config['url']['root'];
							$url .= "/?module=custom_actions&action=audio_player&method=stream";
							$url .= "&path=" . S::forURL(gluePath($folderRelativePath, $fileName));
							$audioFiles[$i] = array($url, $fileName);
							if ($fileName == $this->data['fileName']) {
								$currentIndex = $i;
							}
							$i++;
						}
					}
				}
			}
		}

		require($this->path."/display.php");
	}

	function stream() {
		\FileRun::checkPerms("download");
		\FileRun\Utils\Downloads::sendFileToBrowser($this->data['filePath']);
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Audio Player"
		));
		exit();
	}
}<file_sep><?php

$thisPageName = "500 ERROR";

$thisPageMeta = "";

$thisPageHeading = "ERROR";

$thisPageSubHeading = "500";

$thisPageContent = $_SERVER['DOCUMENT_ROOT']."/page/_layout/error/view/_404.php";

require_once $_SERVER['DOCUMENT_ROOT']."/page/_layout/_layout.php";

//echo realpath('.');

?><file_sep><?php
class custom_msoffice {

	var $online = true;

	var $ext = array(
		'word' => ["doc", "docx", "docm", "dotm", "dotx", "odt"],
		'excel' => ["xls", "xlsx", "xlsb", "xls", "xlsm", "ods"],
		'powerpoint' => ["ppt", "pptx", "ppsx", "pps", "pptm", "potm", "ppam", "potx", "ppsm", "odp"],
		'project' => ['mpp'],
		'visio' => ['vsd', 'vss', 'vst', 'vdx', 'vsx', 'vtx']
	);

	function init() {
		global $config;
		$postURL = $config['url']['root'].'/?module=custom_actions&action=msoffice&method=run';
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Office", 'Custom Actions: Office'),
			"icon" => 'images/icons/office.png',
			"extensions" => call_user_func_array('array_merge', $this->ext),
			"requiredUserPerms" => array("download"),
			"fn" => "FR.UI.backgroundPost(false, '".\S::safeJS($postURL)."')"
		);
	}
	function run() {
		$data = $this->weblinks->createForService($this->data['filePath'], 1);
		$args = array(
			"id_rnd" => $data['id_rnd'],
			"password" => $<PASSWORD>['<PASSWORD>']
		);
		//Allowed URIs must conform to the standards proposed in RFC 3987 – Internationalized Resource Identifiers (IRIs)
		//Characters identified as reserved in RFC 3986 should not be percent encoded.
		//Filenames must not contain any of the following characters: \ / : ? < > | " or *.
		$args['filename'] = str_replace('"', '_', $this->data['fileName']);

		$extension = \FM::getExtension($this->data['fileName']);
		$type = false;
		foreach($this->ext as $k => $extList) {
			if (in_array($extension, $extList)) {
				$type = $k;
				break;
			}
		}
		if (!$type) {return false;}
		$url = $this->weblinks->getURLRW($args);
		if (!$url) {
			echo "Failed to setup weblink";
			exit();
		}
		header('Location: ms-'.$type.':ofv|u|'.$url);
		exit();
	}
}<file_sep><body>

<?php require_once $_phpPath."page/_layout/body/_navigationbar.php"; ?>

<?php require_once $_phpPath."page/_layout/body/_header.php"; ?>

<?php require_once $_phpPath."page/_layout/body/_container.php"; ?>

<?php require_once $_phpPath."css/css.php"; ?>

<?php //if(!empty($thisPageCSS)){require_once $thisPageCSS;}

echo $thisPageCSS;

?>

<?php require_once $_phpPath."js/js.php"; ?>

<?php //if(!empty($thisPageJS)){require_once $thisPageJS;}

echo $thisPageJS;

?>

</body><file_sep>FR.spaceQuota = {
	store: new Ext.data.SimpleStore({
        fields: [
           {name: 'id', type: 'integer'}, {name: 'username'}, {name: 'name'}, {name: 'max'},
		   {name: 'maxNice'}, {name: 'used'}, {name: 'usedNice'}, {name: 'percent'}
        ]
    }),
	sb: new Ext.ux.StatusBar({id: 'my-status', defaultText:'&nbsp;'})
}
FR.spaceQuota.store.loadData(FR.users);
FR.spaceQuota.grid = new Ext.grid.GridPanel({
	title: FR.T('File space quota usage'), border: false,
	store: FR.spaceQuota.store,
	cm: new Ext.grid.ColumnModel({
		defaults: {sortable: true},
		columns: [
			{header: FR.T("Id"), width: 30, dataIndex: 'id', hidden: true},
			{header: '&nbsp;', width: 28, resizable: false, sortable: false, renderer: function(v, m, r) {return '<img src="a/?uid='+r.data.id+'" class="avatar-xs">';}},
			{id:'uname', header: FR.T("Name"), width: 150, dataIndex: 'name'},
			{id:'usrname', header: FR.T("Username"), width: 150, dataIndex: 'username'},
			{header: FR.T("Quota"), width: 75, renderer: function(v, m, r) {return r.data.maxNice;}, dataIndex: 'max'},
			{header: FR.T("Used"), width: 75, renderer: function(v, m, r) {
				if (r.data.max > 0 && (v >= r.data.max)) {
					return '<span style="color:red;">' +r.data.usedNice+ '</span>';
				} else {
					return r.data.usedNice;
				}
			}, dataIndex: 'used'},
			{header: FR.T("Usage"), width: 85, renderer: function(v, m, r) {
				if (v > FR.highlightLimit) {
					return '<span style="color:red;">' +v+ '%</span>';
				} else {
					if (v) {return v+'%';} else {return '';}
				}
			}, dataIndex: 'percent'}
		]
	}),
	bbar: FR.spaceQuota.sb,
	listeners: {
		'afterrender': function() {
			var data = FR.spaceQuota.store.data;
			if (data.length > 0) {
				FR.currentUID = 0;
				FR.spaceQuota.getQuota(data.items[FR.currentUID].data.id, data.items[FR.currentUID]);
			}
		},
		'destroy': function() {
			Ext.Ajax.abort(FR.spaceQuota.ajaxReq);
			FR.spaceQuota = false;
		}
	}
});

FR.spaceQuota.getQuota = function(uid, r) {
	if (FR.spaceQuota.sb) {
		FR.spaceQuota.sb.showBusy(FR.T('Calculating quota usage for "%1"...').replace('%1', r.data.name));
		this.ajaxReq = Ext.Ajax.request({
			url: FR.URLRoot+'/?module=cpanel&section=tools&page=space_quota&action=get&uid='+uid,
			method: 'GET',
			success: function(result, request) {
				try {
					rs = Ext.util.JSON.decode(result.responseText);
				} catch(er) {}
				if (rs && FR.spaceQuota) {
					r.set('max', rs.max);
					r.set('maxNice', rs.maxNice);
					r.set('used', rs.used);
					r.set('usedNice', rs.usedNice);
					r.set('percent', rs.percent);
					r.commit();
					FR.currentUID++;
					var data = FR.spaceQuota.store.data;
					if (data.items[FR.currentUID] && FR.spaceQuota) {
						FR.spaceQuota.getQuota(data.items[FR.currentUID].data.id, data.items[FR.currentUID]);
					} else {
						FR.spaceQuota.sb.clearStatus();
					}
				}
			}
		});
	}
}
Ext.getCmp('appTab').add(FR.spaceQuota.grid);
Ext.getCmp('appTab').doLayout();<file_sep><?php
$URL = $config['url']['root']."/?module=custom_actions&action=video_player&method=stream&path=".S::forURL($this->data['relativePath']);
?>
<html>
<head>
	<title></title>
	<style>body {border: 0px;margin: 0px;padding: 0px;overflow:hidden;}</style>
</head>

<body>

<script type="text/javascript" src="<?php echo $config['url']['root']?>/js/swfobject/swfobject.js"></script>
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" style="height:100%" border="0">
<tr>
	<td align="center" valign="middle">
	<div id="swf" style="width:100%;height:100%;">Loading Flash movie...</div>
	<script type="text/javascript">
		swfobject.embedSWF("<?php echo $URL?>", "swf", '100%', '100%', "9.0.124");
	</script>
	</td>
</tr>
</table>
</body>
</html><file_sep><?php

class custom_crypt {

	static $localeSection = 'Custom Actions: File Encryption';

	function init() {
		$pathToAESCrypt = 'H:/apps/tools/aescrypt.exe'; //and set the path here
		$this->config = array(
			'encrypt_command' => $pathToAESCrypt.' -e -p [%pass%] [%filePath%]',
			'decrypt_command' => $pathToAESCrypt.' -d -p [%pass%] [%filePath%]',
			'encrypted_file_extension' => 'aes',
			'debug' => false
		);
		$this->settings = array(
			array(
				'key' => 'pathToAESCrypt',
				'title' => self::t('Path to AESCrypt'),
				'comment' => self::t('Download and install AESCrypt from <a href="%1" target="_blank">here</a>.', array('https://www.aescrypt.com'))
			)
		);
		$this->JSconfig = array(
            'nonTouch' => true,
			'title' => self::t('AES File Encryption'),
			'iconCls' => 'fa fa-fw fa-lock',
			'requiredUserPerms' => array('upload', 'alter'),
			'fn' => 'FR.customActions.crypt.run()'
		);
	}
	function isDisabled() {
		return (strlen(self::getSetting('pathToAESCrypt')) == 0);
	}

	static function getSetting($k) {
		global $settings;
		$key = 'plugins_crypt_'.$k;
		return $settings->{$key};
	}

	static function t($text, $vars = false) {
		return \FileRun\Lang::t($text, self::$localeSection, $vars);
	}
	function run() {
		global $fm;
		if (!\FileRun\Perms::check("upload") || !\FileRun\Perms::check("download")) {
			jsonFeedback(false, self::t("The user doesn't have permission to use this function!"));
		} else {
			$deleteSrc = (S::fromHTML($_POST['deleteSrc']) == 1 ? true : false);
			if (is_file($this->data['filePath'])) {
				$extension = $fm->getExtension($this->data['fileName']);
				session_write_close();
				if ($extension == $this->config['encrypted_file_extension']) {
					$targetFileName = str_replace(".".$this->config['encrypted_file_extension'], "", $this->data['fileName']);
					$targetPath = gluePath($this->data['path'], $targetFileName);
					if (!file_exists($targetPath)) {
						$rs = $this->decrypt();
						if ($rs) {
							if ($deleteSrc) {
								$this->deleteSource();
							}
							\FileRun\Log::add(false, "file_decrypted", array(
								"relative_path" => $this->data['relativePath'],
								"to_relative_path" => gluePath($fm->dirname($this->data['relativePath']), $targetFileName),
								"full_path" => $this->data['filePath'],
								"to_full_path" => $targetPath,
								"method" => "AES"
							), $this->data['filePath']);
							jsonFeedback(true, self::t("The selected file was successfully decrypted."));
						} else {
							jsonFeedback(false, self::t("Failed to decrypt the selected file!"));
						}
					} else {
						jsonFeedback(false, self::t("A file named \"%1\" already exists!", array($targetFileName)));
					}
				} else {
					$targetFileName = $this->data['fileName'].".".$this->config['encrypted_file_extension'];
					$targetPath = gluePath($this->data['path'], $targetFileName);
					if (!file_exists($targetPath)) {
						$rs = $this->encrypt();
						if ($rs) {
							if ($deleteSrc) {
								$this->deleteSource();
							}
							\FileRun\Log::add(false, "file_encrypted", array(
								"relative_path" => $this->data['relativePath'],
								"to_relative_path" => gluePath($fm->dirname($this->data['relativePath']), $targetFileName),
								"full_path" => $this->data['filePath'],
								"to_full_path" => $targetPath,
								"method" => "AES"
							), $this->data['filePath']);
							jsonFeedback(true, self::t("The selected file was successfully encrypted."));
						} else {
							jsonFeedback(false, self::t("Failed to encrypt the selected file!"));
						}
					} else {
						jsonFeedback(false, self::t("A file named \"%1\" already exists!", array($targetFileName)));
					}
				}
			} else {
				jsonFeedback(false, self::t("The selected file was not found!"));
			}
		}
	}
	function JSinclude() {
		include(gluePath($this->path, "include.js.php"));
	}
	function encrypt() {
		$cmd = $this->parseCmd($this->config['encrypt_command']);
		return $this->runCmd($cmd);
	}
	function decrypt() {
		$cmd = $this->parseCmd($this->config['decrypt_command']);
		return $this->runCmd($cmd);
	}
	function parseCmd($cmd) {
		return str_replace(
			array("[%pass%]", "[%filePath%]"), 
			array($this->escapeshellarg(S::fromHTML($_POST['pass'])), $this->escapeshellarg($this->data['filePath'])),
		$cmd);
	}
	function escapeshellarg($s) {
		return '"'.addslashes($s).'"';
	}
	function deleteSource() {
		global $myfiles, $fm;
		return $myfiles->deleteFile($fm->dirname($this->data['relativePath']), $this->data['fileName'], $permanent = false);
	}
	function runCmd($cmd) {
		@exec($cmd, $return_text, $return_code);
		if ($return_code != 0) {
			if ($this->config['debug']) {
				echo " * command: ".$cmd."<br>";
				echo " * returned code: ".$return_code."<br>";
				echo " * returned text: "; print_r($return_text);
				flush();
			}
			return false;
		} else {
			return true;
		}
	}
}
<file_sep><?php
class custom_mediainfo {
	function init() {
		$this->config = array(
			'localeSection' => 'Custom Actions: MediaInfo'
		);
		$this->JSconfig = array(
			'title' => $this->getString('Media Info'),
			'iconCls' => 'fa fa-fw fa-info-circle',
			'requiredUserPerms' => array('download'),
			"popup" => true,
			'width' => 500
		);
	}
	function getString($s) {

		return S::safeJS(\FileRun\Lang::t($s, $this->config['localeSection']));
	}
	function run() {
		global $fm;



/*
		\FileRun\MetaTypes::$debug=true;
		global $db;
		//$db->debug=1;
		\FileRun\MetaTypes::auto($this->data['filePath']);exit();
*/
		//asdf(\FileRun\Media\Image\Image::fromFile($this->data['filePath'])->getXmp()->dom->saveHTML());

/*
				$rec = \FileRun\Media\Image\Image::fromFile($this->data['filePath'])->getReconcile();
				$rec->debug=true;
				asdf($rec->get('DateCreated'));
*/


		$getID3 = new getID3;
		$fInfo = $getID3->analyze($this->data['filePath']);
		//asdf($fInfo);
		require($this->path."/display.php");
	}
	function displayRow($title, $value) {

		$tmp = '';
		if (is_array($value)) {
			foreach($value as $v) {
				$tmp .= '<div>';
				$tmp .= S::safeHTML(S::forHTML($v));
				$tmp .= '</div>';
			}
		} else {
			$tmp = S::safeHTML(S::forHTML($value));
		}
		if (strlen($tmp) > 0 && $tmp != "0") {
			echo '<tr>';
				echo '<td>'.$title.'</td>';
				echo '<td>'.$tmp.'</td>';
			echo '</tr>';
		}
	}
}
<file_sep><?php
$getID3 = new getID3;
$fInfo = $getID3->analyze($this->data['filePath']);
$URL = $config['url']['root']."/?module=custom_actions&action=video_player&method=stream&path=".S::forURL($this->data['relativePath']);
?>
<html>
<head>
	<title></title>
	<style>
		body {
			border: 0;
			margin: 0;
			padding: 0;
			overflow: hidden;
		}
		video {
			position: absolute;
			min-width: 100%;
			min-height: 100%;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
		}
	</style>
</head>

<body>
<script>
	var videoSize = {
		width: parseInt('<?php echo $fInfo['video']['resolution_x']?:0; ?>'),
		height: parseInt('<?php echo $fInfo['video']['resolution_y']?:0; ?>')
	};

	var html = '<video controls="controls" autoplay="autoplay"';

	if (window.innerWidth < window.innerHeight) {
		var width = videoSize.width;
		if (videoSize.width > window.innerWidth) {
			width = window.innerWidth;
		}
		html += ' width="'+width+'"';
	} else {
		var height = videoSize.height;
		if (videoSize.height > window.innerHeight) {
			height = window.innerHeight;
		}
		html += ' height="'+height+'"';
	}

	html += ' src="<?php echo $URL?>"></video>';
	document.write(html);
</script>
</body>
</html><file_sep><?php include_once realpath($_SERVER["DOCUMENT_ROOT"])."/setting/config.php"; ?>
<?php
for ($x = 0; $x < 2; $x++){
	$v[$x] = htmlentities($_POST['v'.$x], ENT_QUOTES, "UTF-8");
}
emailValid($v[0]);
passwordValid($v[1]);
if ($encrypt_u_pwd_s == 1){
	$v[1] = creatingHash_Nev($v[1]);
	$u[0] = mysqli_query($connect5, "SELECT * FROM `user` WHERE `u_email`='".$v[0]."' AND `u_level` < '1000000'");
	$u[1] = mysqli_num_rows($u[0]);
	if ($u[1] == 1){
		while($r = mysqli_fetch_array($u[0])){
			$pwd = $r['<PASSWORD>'];
			$phn = $r['u_mphone'];
			$lel = $r['u_level'];
			$uid = $r['u_id'];
			$ugr = $r['gr_id'];
		}
	}else{
		echo 'Whether you has been banned or this account has been deleted!';
		exit();
	}
	if (validUserandPassin($v[1],$pwd) == true){
		$_SESSION['uema'] = $v[0];
		$_SESSION['upws'] = $v[1];
		$_SESSION['uphn'] = $phn;  
		$_SESSION['uuse'] = explode('@',$_SESSION['uema']); 
		$_SESSION['ulev'] = $lel;
		$_SESSION['uid'] = $uid;
		$_SESSION['grid'] = $ugr;
		echo '<script type="text/javascript">
		$("#formGetin").load("'.$url_s.'page/mainpage/insideloginbox.php");
		$("#alreadylogin").load("'.$url_s.'page/mainpage/insidenavigation.php");
		$("#loadingPage").load("'.$url_s.'page/mainpage/index/insided.php");
		$("#messageInfo").html("");
		</script>';
		exit();
	}else{
		echo 'Email/password is invalid';
		exit();		
	}
}else{
	$v[1] = creatingHash_Nev($v[1]);
	// Check user
	$u[0] = mysqli_query($connect5, "SELECT * FROM `user` WHERE `u_email`='".$v[0]."' AND `u_password`='".$v[1]."' AND  `u_level` < '1000000'");
	$u[1] = mysqli_num_rows($u[0]);
	if ($u[1] == 1){
		while($r = mysqli_fetch_array($u[0])){
			$_SESSION['ulev'] = $r['u_level'];
			$_SESSION['uid'] = $r['u_id'];
			$_SESSION['grid'] = $r['gr_id'];
		}
			$_SESSION['uema'] = $v[0];
			$_SESSION['upws'] = $v[1]; 
			$_SESSION['uuse'] = explode('@',$_SESSION['uema']); 
		echo '<script type="text/javascript">
		$("#formGetin").load("'.$url_s.'page/mainpage/insideloginbox.php");
		$("#alreadylogin").load("'.$url_s.'page/mainpage/insidenavigation.php");
		$("#loadingPage").load("'.$url_s.'page/mainpage/index/insided.php");
		$("#messageInfo").html("");
		</script>';
		exit();
	}else{
		echo 'Email/password is invalid';	
		exit();
	}
}
?>
<file_sep><?php require_once $_SERVER['DOCUMENT_ROOT']."/setting/control.php"; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<?php require_once $_phpPath."page/_layout/_head.php"; ?>

<?php require_once $_phpPath."page/_layout/_body.php"; ?>

</html><file_sep><?php

echo '<script>function privateIndexJS(){return;}</script>';

?><file_sep><?php
class custom_markdown_viewer {
	var $localeSection = 'Custom Actions: Markdown Viewer';
	function init() {
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Markdown Viewer", $this->localeSection),
			'iconCls' => 'fa fa-fw fa-quote-right',
			'extensions' => array('md'),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
		\FileRun::checkPerms("download");
		$this->data['fileContents'] = file_get_contents(S::forFS($this->data['filePath']));
		$enc = mb_list_encodings();
		if ($_REQUEST['charset'] && in_array($_REQUEST['charset'], $enc)) {
			$this->data['fileContents'] = S::convert2UTF8($this->data['fileContents'], $_REQUEST['charset']);
		}

?>
		<!DOCTYPE html>
		<html>
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
			<link href="<?php echo $this->url;?>/markdown.css" rel="stylesheet" />
		</head>
		<body class="markdown-body">
<?php echo \FileRun\Utils\Markup\Markdown::toHTML($this->data['fileContents']);?>
		</body>
		</html>
<?php
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Markdown Viewer"
		));
	}
}<file_sep>
-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 09, 2016 at 05:40 PM
-- Server version: 10.0.22-MariaDB
-- PHP Version: 5.2.17

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `u285953378_permi`
--

-- --------------------------------------------------------

--
-- Table structure for table `ActionPermission`
--

CREATE TABLE IF NOT EXISTS `ActionPermission` (
  `ActPerId` int(255) NOT NULL AUTO_INCREMENT,
  `UserId` int(255) NOT NULL,
  `GroupId` int(255) NOT NULL,
  `PageId` int(255) NOT NULL,
  `PermissionId` int(255) NOT NULL,
  `IsSuperUser` tinyint(1) NOT NULL,
  `ActPerAvailable` int(255) NOT NULL,
  PRIMARY KEY (`ActPerId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `Error`
--

CREATE TABLE IF NOT EXISTS `Error` (
  `ErrorId` int(255) NOT NULL AUTO_INCREMENT,
  `ErrorName` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `ErrorDescription` text COLLATE utf8_unicode_ci NOT NULL,
  `ErrorCodeName` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`ErrorId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `Group`
--

CREATE TABLE IF NOT EXISTS `Group` (
  `GroupId` int(255) NOT NULL AUTO_INCREMENT,
  `GroupName` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`GroupId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `Page`
--

CREATE TABLE IF NOT EXISTS `Page` (
  `PageId` int(255) NOT NULL AUTO_INCREMENT,
  `PageUrl` varchar(512) COLLATE utf8_unicode_ci NOT NULL,
  `PageName` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `PageAvailable` tinyint(1) NOT NULL,
  `PageMeta` text COLLATE utf8_unicode_ci NOT NULL,
  `PageIsSpecial` tinyint(1) NOT NULL,
  PRIMARY KEY (`PageId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `Permission`
--

CREATE TABLE IF NOT EXISTS `Permission` (
  `PermissionId` int(255) NOT NULL AUTO_INCREMENT,
  `PermissionName` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`PermissionId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `User`
--

CREATE TABLE IF NOT EXISTS `User` (
  `UserId` int(255) NOT NULL AUTO_INCREMENT,
  `UserName` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `UserPassword` varchar(1024) COLLATE utf8_unicode_ci NOT NULL,
  `UserLevel` tinyint(1) NOT NULL,
  PRIMARY KEY (`UserId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<file_sep><?php
global $app, $settings, $fm, $config;
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title></title>
	<link rel="stylesheet" type="text/css" href="css/style.css?v=<?php echo $settings->currentVersion;?>" />
	<link rel="stylesheet" type="text/css" href="customizables/custom_actions/zamzar/style.css?v=<?php echo $settings->currentVersion;?>" />
	<link rel="stylesheet" type="text/css" href="css/ext.php?v=<?php echo $settings->currentVersion;?>" />
	<script type="text/javascript" src="js/min.php?extjs=1&v=<?php echo $settings->currentVersion;?>"></script>
	<script src="customizables/custom_actions/zamzar/app.js?v=<?php echo $settings->currentVersion;?>"></script>
	<script src="?module=fileman&section=utils&page=translation.js&sec=<?php echo S::forURL("Custom Actions: Zamzar")?>&lang=<?php echo S::forURL(\FileRun\Lang::getCurrent())?>"></script>
	<script>
		var URLRoot = '<?php echo S::safeJS($config['url']['root'])?>';
		var path = '<?php echo S::safeJS($this->data['relativePath'])?>';
		var windowId = '<?php echo S::safeJS(S::fromHTML($_REQUEST['_popup_id']))?>';
	</script>
	<style>.ext-el-mask { background-color: white; }</style>
</head>

<body>
<div id="selectFormat">
	<div style="clear:both;margin:10px;">
		<?php
		if (sizeof($rs['targets']) > 0){
			echo self::t('Convert "%1" to:', array(S::safeHTML($this->data['fileName'])));
		} else {
			echo self::t('No conversion option found for the "%1" file type.', array(strtoupper(S::safeHTML($fm->getExtension($this->data['fileName'])))));
		}
		?>
	</div>
	<div style="max-width:600px">
	<?php
	foreach ($rs['targets'] as $format) {
		$fileTypeInfo = $fm->fileTypeInfo(false, $format['name']);
		?>
		<div class="format" data-format="<?php echo S::safeHTML($format['name']);?>">
		<img src="images/fico/<?php echo $fileTypeInfo['icon'];?>" width="96" height="96" border="0" />
			<?php echo S::safeHTML(strtoupper($format['name']))?>
		</div>
	<?php
	}
	?>
	</div>
</div>
</body>
</html><file_sep><?php
class custom_pdfjs {
	function init() {
		$this->localeSection = "Custom Actions: PDF Viewer";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("PDF Viewer", $this->localeSection),
			"iconCls" => 'fa fa-fw fa-file-pdf-o',
			"extensions" => array("pdf"),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
		require($this->path."/display.php");
	}
	function download() {
		\FileRun::checkPerms("download");
		$rs = \FileRun\Utils\Downloads::sendFileToBrowser($this->data['filePath']);
		if ($rs && ($rs == "unknown" || $rs == "final")) {
			\FileRun\Log::add(false, "preview", array(
				"relative_path" => $this->data['relativePath'],
				"full_path" => $this->data['filePath'],
				"method" => "PDF Viewer"
			));
		}
	}
}<file_sep><?php
/*
	Edit image files with Adobe Creative Cloud
*/
class custom_creative_cloud {
	var $online = true;
	function init() {
		$this->localeSection = "Custom Actions: Creative Cloud";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("Creative Cloud", $this->localeSection),
			"iconCls" => 'fa fa-fw fa-cloud', 'icon' => 'images/icons/creative_cloud.png',
			"extensions" => array("jpg", "jpeg", "png"),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
		$this->outputName = "imageOutput";
	}
	function run() {
		$weblinkInfo = $this->weblinks->createForService($this->data['filePath'], false, $this->data['shareInfo']['id']);
		if (!$weblinkInfo) {
			echo "Failed to setup weblink";
			exit();
		}
		$this->data['fileURL'] = $this->weblinks->getURL(array("id_rnd" => $weblinkInfo['id_rnd']));
		$this->data['saveURL'] = $this->weblinks->getSaveURL($weblinkInfo['id_rnd'], false, "creative_cloud");
		require($this->path."/display.php");
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Creative Cloud"
		));
	}
	
	function getNewFileContents() {
		$fromURL = S::fromHTML($_REQUEST['fromURL']);
		if (!$fromURL) {
			echo 'No URL specified';
			exit();
		}
		return file_get_contents($fromURL);
	}
}<file_sep><?php

class custom_autodesk {
	var $online = true;

	var $authURL = 'https://developer.api.autodesk.com/authentication/v1/authenticate';
	var $bucketsURL = 'https://developer.api.autodesk.com/oss/v1/buckets';
	var $registerURL = 'https://developer.api.autodesk.com/viewingservice/v1/register';
	var $viewURL = 'https://developer.api.autodesk.com/viewingservice/v1';
	var $authData = array();
	static $localeSection = 'Custom Actions: Autodesk';

	function init() {
		$this->settings = array(
			array(
				'key' => 'clientID',
				'title' => self::t('API client ID')
			),
			array(
				'key' => 'clientSecret',
				'title' => self::t('API client secret'),
				'comment' => \FileRun\Lang::t('Get them from %1', 'Admin', array('<a href="https://developer.autodesk.com" target="_blank">https://developer.autodesk.com</a>'))
			)
		);
		$this->JSconfig = array(
			"title" => self::t("Autodesk"),
			'icon' => 'images/icons/autodesk.png',
			"extensions" => array('3dm', '3ds', 'asm', 'cam360', 'catpart', 'catproduct', 'cgr', 'dae', 'dlv3', 'dwf', 'dwfx', 'dwg', 'dwt', 'dxf', 'exp', 'f3d', 'fbx', 'g', 'gbxml', 'iam', 'idw', 'ifc', 'ige', 'iges', 'igs', 'ipt', 'jt', 'model', 'neu', 'nwc', 'nwd', 'obj', 'prt', 'rvt', 'sab', 'sat', 'session', 'sim', 'sim360', 'skp', 'sldasm', 'sldprt', 'smb', 'smt', 'ste', 'step', 'stl', 'stla', 'stlb', 'stp', 'wire', 'x_b', 'x_t', 'xas', 'xpr'),
			"popup" => true,
			"requiredUserPerms" => array("download"),
			'loadingMsg' => \FileRun\Lang::t('Loading...')
		);
	}

	function isDisabled() {
		return (strlen(self::getSetting('clientID')) == 0) || (strlen(self::getSetting('clientSecret')) == 0);
	}

	static function getSetting($k) {
		global $settings;
		$key = 'plugins_autodesk_'.$k;
		return $settings->{$key};
	}

	static function t($text, $vars = false) {
		return \FileRun\Lang::t($text, self::$localeSection, $vars);
	}

	function run() {
		\FileRun::checkPerms("download");
		require($this->path."/display.php");
	}

	function start() {
		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('POST', $this->authURL, [
				'form_params' => [
					'client_id' => self::getSetting('clientID'),
					'client_secret' => self::getSetting('clientSecret'),
					'grant_type' => 'client_credentials',
					'scope' => 'data:read data:write bucket:create'
				]
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$rs = json_decode($e->getResponse()->getBody()->getContents(), true);
			jsonFeedback(false, 'Error while authenticating with Autodesk API: '. $rs['developerMessage']);
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			jsonFeedback(false, 'Server error: '.$e->getResponse()->getStatusCode());
		} catch (RuntimeException $e) {
			jsonFeedback(false, 'Error: '.$e->getMessage());
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error: empty server response!');
		}
		$rs = json_decode($rs, 1);
		if (!$rs['access_token']) {
			jsonFeedback(false, 'Error: missing acess token!');
		}
		$this->authData = $rs;

		$bucketKey = 'my-bucket-'.time();
		$rs = $this->createBucket($bucketKey);
		if (!$rs) {
			jsonFeedback(false, 'Error: failed to create bucket!');
		}
		$rs = $this->uploadFile($bucketKey);
		$urn = $rs['objects'][0]['id'];
		$rs = $this->registerFileWithService($urn);
		if ($rs) {
			jsonOutput(array('success' => true, 'msg' => \FileRun\Lang::t('Processing data...'), 'urn' => base64_encode($urn), 'access_token' => $this->authData['access_token']));
		}
	}

	function createBucket($key) {
		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('POST', $this->bucketsURL, [
				'headers' => [
					'Authorization' => 'Bearer ' . $this->authData['access_token']
				],
				'json' => [
					'bucketKey' => $key,
					'policy' => 'transient'
				]
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$response = $e->getResponse()->getBody()->getContents();
			$rs = @json_decode($response, true);
			if (!is_array($rs)) {
				jsonFeedback(false, 'Error while creating bucket: '. $response);
			}
			jsonFeedback(false, 'Error while creating bucket: '. $rs['reason']);
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			jsonFeedback(false, 'Server error: '.$e->getResponse()->getStatusCode());
		} catch (RuntimeException $e) {
			jsonFeedback(false, 'Error: '.$e->getMessage());
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error creating bucket: empty server response!');
		}
		return json_decode($rs, true);
	}

	function uploadFile($bucketKey) {
		global $fm;
		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('PUT', $this->bucketsURL.'/'.S::forURL($bucketKey).'/objects/'.S::forURL($this->data['fileName']), [
				'headers' => [
					'Authorization' => 'Bearer ' . $this->authData['access_token'],
					'Content-Length', $fm->getFileSize($this->data['filePath']),
					'Content-Type', 'application/octet-stream',
					'Expect', ''
				],
				'body' => fopen($this->data['filePath'], 'r')
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$rs = json_decode($e->getResponse()->getBody()->getContents(), true);
			jsonFeedback(false, 'Error while uploading file: '. $rs['reason']);
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			jsonFeedback(false, 'Server error: '.$e->getResponse()->getStatusCode());
		} catch (RuntimeException $e) {
			jsonFeedback(false, 'Error: '.$e->getMessage());
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error uploading file: empty server response!');
		}
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "Autodesk"
		));
		return json_decode($rs, true);
	}

	function registerFileWithService($urn) {
		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('POST', $this->registerURL, [
				'headers' => [
					'Authorization' => 'Bearer ' . $this->authData['access_token']
				],
				'json' => ['urn' => base64_encode($urn)]
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$rs = json_decode($e->getResponse()->getBody()->getContents(), true);
			jsonFeedback(false, 'Error while registering file with service: '. $rs['reason']);
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			jsonFeedback(false, 'Server error: '.$e->getResponse()->getStatusCode());
		} catch (RuntimeException $e) {
			jsonFeedback(false, 'Error: '.$e->getMessage());
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error registering file: empty server response!');
		}
		return json_decode($rs, true);
	}

	function checkStatus() {
		$urn = S::fromHTML($_REQUEST['urn']);
		$access_token = S::fromHTML($_REQUEST['access_token']);

		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('GET', $this->viewURL.'/'.$urn.'/status', [
				'headers' => [
					'Authorization' => 'Bearer ' . $access_token
				],
				'json' => ['urn' => base64_encode($urn)]
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			$rs = json_decode($e->getResponse()->getBody()->getContents(), true);
			jsonFeedback(false, 'Error checking status: '. $rs['reason']);
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			jsonFeedback(false, 'Server error: '.$e->getResponse()->getStatusCode());
		} catch (RuntimeException $e) {
			jsonFeedback(false, 'Error: '.$e->getMessage());
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error checking status: empty server response!');
		}
		$rs = json_decode($rs, true);
		$percent = strstr($rs['success'], '%', true);
		jsonOutput(array('success' => true, 'data' => $rs, 'percent' => $percent));
	}
}<file_sep><?php

class custom_onlyoffice {

	var $online = true;
	var $outputName = 'content';
	var $canEdit = array(
		'doc', 'docx', 'odt', 'rtf', 'txt',
		'xls', 'xlsx', 'ods', 'csv',
		'ppt', 'pptx', 'odp'
	);

	function init() {
		$this->settings = array(
			array(
				'key' => 'serverURL',
				'title' => self::t('ONLYOFFICE server URL'),
				'comment' => self::t('Download and install %1', array('<a href="https://github.com/ONLYOFFICE/DocumentServer" target="_blank">ONLYOFFICE DocumentServer</a>'))
			)
		);
		$this->JSconfig = array(
			"title" => self::t("ONLYOFFICE"),
			"popup" => true,
			'icon' => 'images/icons/onlyoffice.png',
			"loadingMsg" => self::t('Loading document in ONLYOFFICE. Please wait...'),
			'useWith' => array(
				'office'
			),
			"requiredUserPerms" => array(
				"download",
				"upload"
			),
			"createNew" => array(
				"title" => self::t("Document with ONLYOFFICE"),
				"options" => array(
					array(
						"fileName" => self::t("New Document.docx"),
						"title" => self::t("Word Document"),
						"iconCls" => 'fa fa-fw fa-file-word-o'
					),
					array(
						"fileName" => self::t("New Spreadsheet.xlsx"),
						"title" => self::t("Spreadsheet"),
						"iconCls" => 'fa fa-fw fa-file-excel-o'
					),
					array(
						"fileName" => self::t("New Presentation.pptx"),
						"title" =>  self::t("Presentation"),
						"iconCls" => 'fa fa-fw fa-file-powerpoint-o'
					)
				)
			)
		);
	}

	function isDisabled() {
		return (strlen(self::getSetting('serverURL')) == 0);
	}

	static function getSetting($k) {
		global $settings;
		$key = 'plugins_onlyoffice_'.$k;
		return $settings->{$key};
	}

	static function t($text, $vars = false) {
		$section = 'Custom Actions: ONLYOFFICE';
		return \FileRun\Lang::t($text, $section, $vars);
	}

	function getNewFileContents() {
		$body_stream = file_get_contents("php://input");
		if ($body_stream === false) {return false;}
		$this->POST = json_decode($body_stream, true);
		if ($this->POST["status"] != 2) {return false;}
		return file_get_contents($this->POST["url"]);
	}

	function saveFeedback($success, $message) {
		if ($this->POST["status"] != 2) {
			//ONLYOFFICE makes various calls to the save URL
			exit('{"error":0}');
		}
		if ($success) {
			exit('{"error":0}');
		} else {
			exit($message);
		}
	}
	
	function createBlankFile() {
		global $myfiles, $fm;
		if (!\FileRun\Perms::check('upload')) {exit();}
		$ext = $fm->getExtension($this->data['fileName']);
		if (!in_array($ext, $this->canEdit)) {
			jsonOutput(array("rs" => false, "msg" => self::t('The file extension needs to be one of the following: %1', array(implode(', ', $this->canEdit)))));
		}
		if (file_exists($this->data['filePath'])) {
			jsonOutput(array("rs" => false, "msg" => self::t('A file with the specified name already exists. Please try again.')));
		}
		$src = gluePath($this->path, 'blanks/blank.'.$ext);
		$rs = $myfiles->newFile($fm->dirname($this->data['relativePath']), $this->data['fileName'], $src);
		if ($rs) {
			jsonOutput(array("rs" => true, 'path' => $this->data['relativePath'], "filename" => $this->data['fileName'], "msg" => self::t("Blank file created successfully")));
		} else {
			jsonOutput(array("rs" => false, "msg" => $myfiles->error['msg']));
		}
	}

	function run() {
		global $fm;
		\FileRun::checkPerms("download");

		if (\FileRun\Perms::check('upload') && (!$this->data['shareInfo'] || ($this->data['shareInfo'] && $this->data['shareInfo']['perms_upload']))) {
			$weblinkInfo = $this->weblinks->createForService($this->data['filePath'], false, $this->data['shareInfo']['id']);
			if (!$weblinkInfo) {
				echo "Failed to setup saving weblink";
				exit();
			}
			$saveURL = $this->weblinks->getSaveURL($weblinkInfo['id_rnd'], false, "onlyoffice");
		} else {
			$saveURL = "";
		}

		$extension = $fm->getExtension($this->data['fileName']);

		if (in_array($extension, array('docx', 'doc','odt','txt','rtf','html','htm','mht','epub','pdf','djvu','xps'))) {
			$docType = 'text';
		} else if (in_array($extension, array('xlsx','xls','ods','csv'))) {
			$docType = 'spreadsheet';
		} else {
			$docType = 'presentation';
		}

		$url = $this->weblinks->getURL(array('id_rnd' => $weblinkInfo['id_rnd'], 'download' => 1));

		if (!$url) {
			echo "Failed to setup weblink";
			exit();
		}

		//add the action to the user activity log
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "ONLYOFFICE"
		));

		$mode = 'view';
		if (in_array($extension, $this->canEdit)) {
			$mode = 'edit';
		}

		global $auth;
		$author = \FileRun\Users::formatFullName($auth->currentUserInfo);

		$fileSize = \FM::getFileSize($this->data['filePath']);
		$documentKey = substr($fileSize.md5($this->data['filePath']), 0, 20);
?>
	<html>
	<head>
		<title></title>
		<style>
			body {
				border: 0;
				margin: 0;
				padding: 0;
				overflow:hidden;
			}
		</style>
	</head>

	<body>
	<div id="placeholder"></div>
	<script type="text/javascript" src="<?php echo self::getSetting('serverURL');?>/web-apps/apps/api/documents/api.js"></script>
	<script>
		var innerAlert = function (message) {
			if (console && console.log)
			console.log(message);
		};

		var onReady = function () {
			innerAlert("Document editor ready");
		};

		var onDocumentStateChange = function (event) {
			var title = document.title.replace(/\*$/g, "");
			document.title = title + (event.data ? "*" : "");
		};

		var onError = function (event) {
			if (event) innerAlert(event.data);
		};
		var docEditor = new DocsAPI.DocEditor("placeholder", {
			"documentType": "<?php echo $docType;?>",
			"type": "desktop",
			"document": {
				"fileType": "<?php echo $extension;?>",
				"key": "<?php echo $documentKey;?>",
				"title": "<?php echo \S::safeJS($this->data['fileName']);?>",
				"url": "<?php echo \S::safeJS($url);?>",
				"info": {
					"author": "<?php echo \S::safeJS($author);?>"
				}
			},
			"editorConfig": {
				"mode": '<?php echo $mode;?>',
				"lang": '<?php echo $this->getShortLangName(\FileRun\Lang::getCurrent());?>',
				"callbackUrl": "<?php echo \S::safeJS($saveURL);?>",
				"user": {
					"firstname": "<?php echo \S::safeJS($auth->currentUserInfo['name']);?>",
					"id": "<?php echo \S::safeJS($auth->currentUserInfo['id']);?>",
					"lastname": "<?php echo \S::safeJS($auth->currentUserInfo['name2']);?>"
				}
			},
			"customization": {
				'about': false,
				'comments': false,
				'feedback': false,
				'goback': false
			},
			"events": {
				'onReady': onReady,
				'onDocumentStateChange': onDocumentStateChange,
				'onError': onError
			}
		});
	</script>
	</body>
	</html>
	<?php
	}

	function getShortLangName($langName) {
		$codes = array(
			'basque' => 'eu',
			'brazilian portuguese' => 'pt',
			'chinese traditional' => 'zh',
			'chinese' => 'zh',
			'danish' => 'da',
			'dutch' => 'nl',
			'english' => 'en',
			'finnish' => 'fi',
			'french' => 'fr',
			'german' => 'de',
			'italian' => 'it',
			'polish' => 'pl',
			'romanian' => 'ro',
			'russian' => 'ru',
			'spanish' => 'es',
			'swedish' => 'sv',
			'turkish' => 'tr'
		);
		return $codes[$langName];
	}
}<file_sep>FR.initTree = function() {
	var t = new Ext.tree.TreePanel({
		id: 'FR-Tree-Panel', region: 'center',
		enableDD: !User.perms.read_only, ddGroup: 'TreeDD', dropConfig: {appendOnly:true}, bodyStyle: 'padding-top:1px;padding-bottom:30px;',
		animate: true, autoScroll: true, rootVisible: false, lines: false, useArrows: true,
		listeners: {
			'afterrender': function () {
				if (User.perms.upload) {
					FlowUtils.DropZoneManager.add({
						domNode: FR.UI.tree.panel.el.dom, overClass: 'x-tree-drag-append',
						findTarget: function (e) {
							var n,
								el = Ext.get(e.target);
							if (el && !el.hasClass('x-tree-node-el')) {el = el.parent('div.x-tree-node-el');}
							if (!el) {return false;}
							var treeNodeId = el.getAttribute('tree-node-id', 'ext');
							if (!treeNodeId) {return false;}
							var treeNode = FR.UI.tree.panel.getNodeById(treeNodeId);
							if (!treeNode) {return false;}
							if (['myfiles', 'sharedFolder'].indexOf(treeNode.attributes.section) != -1) {
								if (!treeNode.attributes.perms || treeNode.attributes.perms.upload) {
									return {el: el.dom, node: treeNode};
								}
							}
						},
						onDrop: function (e, target) {
							var up = new FR.components.uploadPanel({
								targetPath: target.node.getPath('pathname'), dropEvent: e
							});
							FR.UI.uploadWindow(FR.T('Upload to "%1"').replace('%1', target.node.text), up);
						},
						scope: this
					});
				}

				if (User.perms.alter) {
					FR.UI.tree.panel.on('nodedragover', function (e) {
						if (FR.currentSection == 'trash' || FR.currentSection == 'starred' || FR.currentSection == 'search' || FR.currentSection == 'webLinked' ||
							(e.dropNode && e.dropNode.attributes.readonly) ||
							(e.target.attributes.perms && (!e.target.attributes.perms.alter && !e.target.attributes.perms.upload)) ||
							(FR.currentPath == e.target.getPath('pathname'))
						) {
							e.cancel = true;
							return false;
						}
					});

					FR.UI.tree.panel.on('beforenodedrop', function (drop) {
						FR.actions.move(drop, drop.target.getPath('pathname'));
						return false;
					});
				}
			}, scope: this
		}
	});
	FR.UI.tree.panel = t;

	var ui = FR.components.TreeNodeCustomUI;
	var r = new Ext.tree.TreeNode({pathname: 'ROOT', allowDrag: false, allowDrop: false});
	t.setRootNode(r);
	FR.UI.tree.root = r;
	
	t.getSelectionModel().on('selectionchange', function(selectionModel, treeNode) {
		FR.UI.tree.onSelectionChange(selectionModel, treeNode);
	});
	t.getSelectionModel().on('beforeselect', function(selectionModel, treeNode) {
		if (treeNode.attributes.section == 'userWithShares') {treeNode.expand();if (treeNode.loaded) {treeNode.firstChild.select();}return false;}
		if (!treeNode.attributes.pathname) {return false;}
	});
	FR.UI.tree.loader = new Ext.tree.TreeLoader({
		dataUrl: this.myfilesBaseURL+'&page=tree',
		baseAttrs: {uiProvider: ui},
		listeners: {'beforeload': function(loader, node){loader.baseParams.path = node.getPath('pathname');}}
	});

	FR.UI.tree.searchResultsNode = new Ext.tree.TreeNode({
		text: FR.T('Search Results'), readonly: true, uiProvider: ui,
		leaf: false, allowDrag: false, allowDrop: false, hidden: true,
		iconCls: 'fa-search icon-gray', pathname: 'SEARCH', section: 'search'
	});
	r.appendChild(FR.UI.tree.searchResultsNode);
	FR.UI.tree.homeFolderNode = new Ext.tree.AsyncTreeNode({
		text: FR.T('My Files'), pathname: 'HOME', section: 'myfiles',
		iconCls: 'fa-folder', homefolder: true,
		allowDrag: false, allowDrop: !User.perms.read_only,
		custom: FR.homeFolderCfg.customAttr,
		loader: FR.UI.tree.loader,
		uiProvider: ui
	});
	r.appendChild(FR.UI.tree.homeFolderNode);

	r.appendChild(new Ext.tree.TreeNode({
		text: FR.T('Photos'), pathname: 'PHOTOS', section: 'photos',
		iconCls: 'fa-picture-o', uiProvider: ui, hidden: Settings.hidePhotos,
		leaf: false, allowDrag: false, allowDrop: false, readonly: true
	}));
	//text: FR.T('Music'), pathname: 'MUSIC', section: 'music', iconCls: 'fa-headphones',

	FR.UI.tree.sharesLoader = new Ext.tree.TreeLoader({
		dataUrl:FR.myfilesBaseURL+'&page=tree_shares&nocache=1',
		baseAttrs: {uiProvider: ui},
		listeners: {'beforeload': function(loader, node){loader.baseParams.path = node.getPath('pathname');}}
	});
	Ext.each(AnonShares, function(fld) {
		r.appendChild(new Ext.tree.AsyncTreeNode(Ext.apply(fld, {
			readonly: true, allowDrag: false, allowDrop: fld.perms.upload,
			loader: FR.UI.tree.sharesLoader, section: 'sharedFolder', uiProvider: ui
		})));
	});
	Ext.each(Sharing, function(usr) {
		r.appendChild(new Ext.tree.AsyncTreeNode({
			text: usr.name, pathname: usr.id, section: 'userWithShares',
			uid: usr.id, iconCls: 'avatar',
			allowDrag: false, allowDrop: false,
			loader: FR.UI.tree.sharesLoader, uiProvider: ui
		}));
	});
	FR.UI.tree.starredNode = new Ext.tree.TreeNode({
		text: FR.T('Starred'), readonly: true, uiProvider: ui,
		leaf: false, allowDrag: false, allowDrop: false, hidden: User.perms.read_only,
		iconCls: 'fa-star icon-gray', pathname: 'STARRED', section: 'starred'
	});
	r.appendChild(FR.UI.tree.starredNode);
	FR.UI.tree.webLinksNode = new Ext.tree.TreeNode({
		text: FR.T('Shared links'), readonly: true, uiProvider: ui,
		leaf: false, allowDrag: false, allowDrop: false, hidden: !User.perms.weblink,
		iconCls: 'fa-link icon-gray', pathname: 'WLINKED', section: 'webLinked'
	});
	r.appendChild(FR.UI.tree.webLinksNode);
	FR.UI.tree.trashNode = new Ext.tree.TreeNode({
		text: FR.T('Trash'), readonly: true, uiProvider: ui,
		leaf: false, allowDrag: false, allowDrop: false,
		iconCls: 'fa-trash icon-gray', pathname: 'TRASH', section: 'trash'
	});
	r.appendChild(FR.UI.tree.trashNode);
	if (!User.trashCount || User.perms.read_only) {
		FR.UI.tree.trashNode.getUI().hide();
	}

	FR.UI.tree.getCurrentPath = function() {
		return this.currentSelectedNode.getPath('pathname');
	};

	FR.UI.tree.onSelectionChange = function(selectionModel, treeNode) {
		FR.UI.tree.currentSelectedNode = treeNode;
		if (!treeNode) {return false;}
		var path = treeNode.getPath('pathname');
		if (path != FR.currentPath) {
            var section = treeNode.attributes.section;
			FR.UI.gridPanel.load(path);
			FR.currentFolderPerms = treeNode.attributes.perms ? treeNode.attributes.perms : false;
			FR.currentSection = treeNode.attributes.section;
			if (section == 'myfiles' || section == "sharedFolder") {
				treeNode.expand();
				FR.UI.actions.searchField.setSearchFolder(FR.currentPath, treeNode.text);
				if (FR.UI.gridPanel.dropZone) {
					FR.UI.gridPanel.dropZone.unlock();
				}
			} else {
				if (FR.UI.gridPanel.dropZone) {
					FR.UI.gridPanel.dropZone.lock();
				}
				FR.UI.actions.searchField.setSearchFolder('/ROOT/HOME', FR.T('My Files'));
			}
			if (section == 'search') {
				FR.UI.tree.searchResultsNode.getUI().show();
				FR.UI.tree.searchResultsNode.ensureVisible();
			}
			if (section == 'photos') {
				FR.UI.gridPanel.changeView('large', true);
			} else {
				FR.UI.gridPanel.restorePreviousView();
			}
			var gridCM = FR.UI.gridPanel.getColumnModel();
			gridCM.setHidden(gridCM.getIndexById('path'), (['starred', 'webLinked', 'search'].indexOf(section) == -1));
			gridCM.setHidden(gridCM.getIndexById('trash_deleted_from'), (section != 'trash'));
		}
	};

	FR.UI.tree.panel.on('contextmenu', function(node, e) {FR.UI.tree.showContextMenu(node,e);});
};

FR.UI.tree.reloadNode = function(treeNode, callback) {
	treeNode.loaded = false;
	treeNode.collapse();
	treeNode.expand(false, true, callback);
};

FR.UI.tree.updateIcon = function(treeNode) {
	treeNode.getUI().updateIcons();
};

FR.UI.tree.showContextMenu = function(node, e) {
	FR.UI.contextMenu.event({
		location: 'tree',
		target: node.attributes
	});
	if (e) {e.stopEvent();}
	return false;
};

FR.components.TreeNodeCustomUI = Ext.extend(Ext.tree.TreeNodeUI, {
	getIcons: function() {
		var n = this.node;
		var icons = '';
		if (n.attributes.custom) {
			if (n.attributes.custom.share) {
				icons += ' <i class="fa fa-user-plus"></i>';
			}
			if (n.attributes.custom.weblink) {
				icons += ' <i class="fa fa-link"></i>';
			}
			if (n.attributes.custom.sync) {
				icons += ' <i class="fa fa-retweet"></i>';
			}
			if (n.attributes.custom.notInfo) {
				icons += ' <i class="fa fa-bell-o"></i>';
			}
			if (n.attributes.custom.star) {
				icons += ' <i class="fa fa-star-o"></i>';
			}
		}
		if (n.attributes['new']) {
			icons += ' <i class="fa fa-asterisk icon-red"></i>';
		}
		return icons;
	},
	updateIcons: function() {
		this.frIconsNodeEl.update(this.getIcons());
	},
	renderElements : function(n, a, targetNode, bulkRender){
		this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
		var showMenuTrigger = (n.attributes.section == 'myfiles' || n.attributes.section == 'sharedFolder' || n.attributes.section == 'trash');
		var icons = this.getIcons();
		var nel,
			buf =
			'<li class="x-tree-node">' +
				'<div ext:tree-node-id="'+n.id+'" class="x-tree-node-el x-tree-node-leaf x-unselectable '+(a.cls || '')+'" unselectable="on">' +
					'<span class="x-tree-node-indent">'+this.indentMarkup+"</span>"+
					'<i class="x-tree-ec-icon fa fa-caret-right"></i>'+
					'<i '+(a.uid ?
						'style="background-image:url(\'a/?uid='+a.uid+'\')" class="avatar"' :
						'class="x-tree-node-icon fa fa-lg fa-fw icon-silver '+(a.iconCls || "fa-folder")+'"'
					)+' unselectable="on"></i>'+
					'<a hidefocus="on" class="x-tree-node-anchor">' +
						'<span unselectable="on">'+n.text+"</span>" +
						'<span style="color:silver">' + icons + '</span>' +
					"</a>" +
				(showMenuTrigger ? '<div class="nodeMenu"><div class="triangle"></div></div>':'') +
				'</div>'+
				'<ul class="x-tree-node-ct" style="display:none;"></ul>'+
			'</li>';

		if (bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())) {
			this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);
		} else {
			this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);
		}
		this.elNode = this.wrap.childNodes[0];
		this.ctNode = this.wrap.childNodes[1];
		var cs = this.elNode.childNodes;
		this.indentNode = cs[0];
		this.ecNode = cs[1];
		this.iconNode = cs[2];
		this.iconNodeEl = Ext.get(this.iconNode);
		this.anchor = cs[3];
		this.textNode = cs[3].firstChild;
		this.frIconsNodeEl = Ext.get(cs[3].lastChild);
		if (showMenuTrigger) {
			this.menuTriggerNode = cs[4];
			Ext.get(this.menuTriggerNode).on('click', function(e) {
				FR.UI.tree.showContextMenu(n, e);
				e.stopEvent();
			});
		}
	},
	updateExpandIcon : function(){
		if(this.rendered){
			var n = this.node,hasChild = n.hasChildNodes();
			if(hasChild || n.attributes.expandable){
				if (n.expanded){
					Ext.fly(this.ecNode).replaceClass('fa-caret-right', 'fa-caret-down');
				} else {
					Ext.fly(this.ecNode).replaceClass('fa-caret-down', 'fa-caret-right');
				}
			} else {
				Ext.fly(this.ecNode).removeClass('fa-caret-right');
			}
		}
	},
	beforeLoad : function() {
		var i = this.iconNodeEl;
		i.origCSSClass = i.getAttribute('class');
		i.set({'class': 'x-tree-node-icon fa fa-lg fa-fw icon-silver fa-refresh fa-spin'});
	},
	afterLoad : function() {
		this.iconNodeEl.set({'class': this.iconNodeEl.origCSSClass});
	}
});<file_sep><head>

<?php require_once $_phpPath."page/_layout/head/_generalmeta.php"; ?>

<title><?php echo $thisPageName?> | <?php echo $_siteName ?></title>

<?php //require_once $_phpPath."js/js_top.php"; ?>

</head><file_sep><div class="row">
<div class="row" id="registerStatus">
	
</div>
<form class="form-horizontal col-lg-offset-2 col-lg-8" id="registerNewAccount">
<fieldset class="well bs-component">
	<div class="form-group">
		<label for="inputEmail" class="col-lg-2 control-label">Email</label>
		<div class="col-lg-10">
			<input type="text" class="form-control" id="inputEmail" placeholder="Email" name="registerEmail">
			<label class="control-label bold" for="inputEmail" id="inputEmailStatus">&nbsp;</label>
		</div>
	</div>
	<div class="form-group">
		<label for="inputPassword" class="col-lg-2 control-label">Password</label>
		<div class="col-lg-10">
			<input type="password" class="form-control" id="inputPassword" placeholder="<PASSWORD>" name="registerPassword">
			<label class="control-label bold" for="inputPassword" id="inputPasswordStatus">&nbsp;</label>
		</div>
	</div>
	<div class="form-group">
		<label for="inputRetypePassword" class="col-lg-2 control-label">Retype Password</label>
		<div class="col-lg-10">
			<input type="password" class="form-control" id="inputRetypePassword" placeholder="<PASSWORD>" name="registerRetypePassword">
			<label class="control-label bold" for="inputRetypePassword" id="inputRetypePasswordStatus">&nbsp;</label>
		</div>
	</div>
	<div class="form-group">
		<div class="checkbox">
		 	<label class="col-lg-12 control-label text-center">
		 		<input type="checkbox" name="registerRuleAccepted" id="registerRuleAccepted">
		 		<span id="registerRuleAcceptedStatus bold">
			 	By signing up, you agree to the <?php echo $_siteName?> Service Terms & Conditions and the Privacy Policy.
			 	</span>
			</label>
		</div>
	</div>
	<div class="form-group">
		<div class="col-lg-12 float-right text-right">
			 <a class="btn btn-primary" id="submitNewAccount">Submit</a>
		</div>
	</div>
	<!--<div class="form-group">
		<div class="col-lg-10 col-lg-offset-2">
		  <button type="reset" class="btn btn-default">Cancel</button>
		  <button type="submit" class="btn btn-primary">Submit</button>
		</div>
	</div>-->
</fieldset> 
	</form>
</div><file_sep><?php

class custom_zoho {

	var $online = true;
	static $localeSection = "Custom Actions: Zoho";

	var $writerExtensions = array("doc", "docx", "html", "htm", "rtf", "txt", "odt");
	var $sheetExtensions = array("xls", "xlsx", "sxc", "csv", "ods", "tsv");
	var $showExtensions = array("ppt", "pptx", "pps", "odp", "sxi", "ppts", "ppsx");

	var $writerURL = "https://writer.zoho.com/writer/remotedoc.im";
	var $sheetURL = "https://sheet.zoho.com/sheet/remotedoc.im";
	var $showURL = "https://show.zoho.com/show/remotedoc.im";

	function init() {
		$this->settings = array(
			array(
				'key' => 'APIKey',
				'title' => self::t('API key'),
				'comment' => \FileRun\Lang::t('Get it from %1', 'Admin', array('<a href="https://zapi.zoho.com" target="_blank">https://zapi.zoho.com</a>'))
			)
		);
		$this->JSconfig = array(
			"title" => self::t("Zoho Editor"),
			'icon' => 'images/icons/zoho.png',
			"extensions" => array_merge($this->writerExtensions, $this->sheetExtensions, $this->showExtensions),
			"popup" => true,
			"requiredUserPerms" => array("download", 'upload'),
			"createNew" => array(
				"title" => self::t("Document with Zoho"),
				"options" => array(
					array(
						"fileName" => self::t("New Document.odt"),
						"title" => self::t("Word Document"),
						"icon" => 'images/icons/zwriter.png'
					),
					array(
						"fileName" => self::t("New Spreadsheet.ods"),
						"title" => self::t("Spreadsheet"),
						"icon" => 'images/icons/zsheet.png'
					),
					array(
						"fileName" => self::t("New Presentation.odp"),
						"title" =>  self::t("Presentation"),
						"icon" => 'images/icons/zshow.png'
					)
				)
			)
		);
	}

	function isDisabled() {
		return (strlen(self::getSetting('APIKey')) == 0);
	}

	static function getSetting($k) {
		global $settings;
		$key = 'plugins_zoho_'.$k;
		return $settings->{$key};
	}

	static function t($text, $vars = false) {
		return \FileRun\Lang::t($text, self::$localeSection, $vars);
	}

	function run() {
		global $fm, $auth;
		\FileRun::checkPerms("download");

		if (\FileRun\Perms::check('upload') && (!$this->data['shareInfo'] || ($this->data['shareInfo'] && $this->data['shareInfo']['perms_upload']))) {
			$weblinkInfo = $this->weblinks->createForService($this->data['filePath'], false, $this->data['shareInfo']['id']);
			if (!$weblinkInfo) {
				echo "Failed to setup saving weblink";
				exit();
			}
			$saveURL = $this->weblinks->getSaveURL($weblinkInfo['id_rnd'], false, "zoho");
		} else {
			$saveURL = "";
		}

		$extension = $fm->getExtension($this->data['fileName']);
		if (in_array($extension, $this->writerExtensions)) {
			$url = $this->writerURL;
		} else if (in_array($extension, $this->showExtensions)) {
			$url = $this->showURL;
		} else {
			$url = $this->sheetURL;
		}

		$post = array(
			['name' => 'apikey', 'contents' => self::getSetting('APIKey')],
			['name' => 'username', 'contents' => $auth->currentUserInfo['name']],
			['name' => 'output', 'contents' => 'url'],
			['name' => 'mode', 'contents' => 'collabedit'],
			['name' => 'filename', 'contents' => $this->data['fileName']],
			['name' => 'format', 'contents' => $extension],
			['name' => 'saveurl', 'contents' => $saveURL],
			['name' => 'content', 'contents' => fopen($this->data['filePath'], 'r')]
		);

		$d = \FileRun\MetaFields::getTable();
		$docIdMetaFieldId = $d->selectOneCol('id', array(array('system', '=', 1), array('name', '=', $d->q('zoho_collab'))));
		$metaFileId = FileRun\MetaFiles::getId($this->data['filePath']);
		if ($metaFileId) {
			$zohoDocId = \FileRun\MetaValues::get($metaFileId, $docIdMetaFieldId);
			if ($zohoDocId) {
				$post[] = ['name' => 'documentid', 'contents' => $zohoDocId];
				$post[] = ['name' => 'id', 'contents' => $zohoDocId];
			}
		} else {
			$post[] = ['name' => 'id', 'contents' => uniqid(rand())];
		}

		$http = new \GuzzleHttp\Client();
		try {
			$response = $http->request('POST', $url, [
				'headers' => ['User-Agent' => ''],
				'multipart' => $post
			]);
		} catch (\GuzzleHttp\Exception\ConnectException $e) {
			jsonFeedback(false, 'Network connection error: '.$e->getMessage());
		} catch (\GuzzleHttp\Exception\ClientException $e) {
			echo 'Server error: '.$e->getResponse()->getStatusCode();
			echo $e->getMessage();
			exit();
		} catch (\GuzzleHttp\Exception\ServerException $e) {
			echo 'Server error: '.$e->getResponse()->getStatusCode();
			echo $e->getMessage();
			exit();
		} catch (RuntimeException $e) {
			echo 'Error: '.$e->getMessage();
			exit();
		}
		$rs = $response->getBody()->getContents();
		if (!$rs) {
			jsonFeedback(false, 'Error uploading file: empty server response!');
		}
		$rs = $this->parseZohoReply($rs);
		if ($rs['RESULT'] != "FALSE") {
			//save document id for collaboration
			if ($rs['DOCUMENTID']) {
				\FileRun\MetaValues::setByPath($this->data['filePath'], $docIdMetaFieldId, $rs['DOCUMENTID']);
			}

			\FileRun\Log::add(false, "preview", array(
				"relative_path" => gluePath($this->data['relativePath'], $this->data['fileName']),
				"full_path" => $this->data['filePath'],
				"method" => "Zoho"
			));
			header("Location: ".$rs['URL']."");
			exit();
		} else {
			echo "<strong>Zoho:</strong>";
			echo "<div style=\"margin:5px;border:1px solid silver;padding:5px;overflow:auto;\"><pre>";
			echo $response;
			if (strstr($rs['warning'], "unable to import content")) {
				echo "\r\n\r\nZoho.com service does not support this type of documents or was not able to access this web server.";
			} else {
				echo $response;
			}
			echo "</pre></div>";
		}
	}
	function createBlankFile() {
		global $myfiles, $fm;
		if (!\FileRun\Perms::check('upload')) {exit();}
		if (file_exists($this->data['filePath'])) {
			jsonOutput(array("rs" => false, "msg" => self::t('A file with the specified name already exists. Please try again.')));
		}
		$rs = $myfiles->newFile($fm->dirname($this->data['relativePath']), $this->data['fileName'], false, "");
		if ($rs) {
			jsonOutput(array("rs" => true, 'path' => $this->data['relativePath'], "filename" => $this->data['fileName'], "msg" => self::t("Blank file created successfully")));
		} else {
			jsonOutput(array("rs" => false, "msg" => $myfiles->error['msg']));
		}
	}
	function getNewFileContents() {
		if ($_FILES['content']['tmp_name']) {
			return file_get_contents($_FILES['content']['tmp_name']);
		}
	}
	function parseZohoReply($reply) {
		$lines = explode("\n", $reply);
		$rs = array();
		foreach ($lines as $line) {
			$line = trim($line);
			$p = strpos($line, "=");
			$key = substr($line, 0, $p);
			$val = substr($line, $p+1);
			if (strlen($key) > 0) {
				$rs[$key] = $val;
			}
		}
		return $rs;
	}
}<file_sep><?php
class custom_webodf {
	function init() {
		$this->localeSection = "Custom Actions: OpenDocument Viewer";
		$this->JSconfig = array(
			"title" => \FileRun\Lang::t("OpenDocument Viewer", $this->localeSection),
			'iconCls' => 'fa fa-fw fa-file-text-o',
			"extensions" => array("odt", "ods", "odp"),
			"popup" => true,
			"requiredUserPerms" => array("download")
		);
	}
	function run() {
		require($this->path."/display.php");
	}
	function download() {
		\FileRun::checkPerms("download");
		\FileRun\Utils\Downloads::sendFileToBrowser($this->data['filePath']);
		\FileRun\Log::add(false, "preview", array(
			"relative_path" => $this->data['relativePath'],
			"full_path" => $this->data['filePath'],
			"method" => "OpenDocument Viewer"
		));
	}
}<file_sep><?php
class custom_contact_sheet {
	function init() {
		$this->config = array(
			'localeSection' => 'Custom Actions: Photo Proof Sheet'
		);
		$this->JSconfig = array(
			'title' => $this->getString('Create photo proof sheet'),
			'iconCls' => 'fa fa-fw fa-th',
			'requiredUserPerms' => array('download'),
			"ajax" => true,
			'width' => 400,
			'height' => 400,
			'multiple' => true,
			'onlyMultiple' => true
		);
	}
	function isDisabled() {
		global $settings;
		return !$settings->thumbnails_imagemagick;
	}
	function getString($s, $v = false) {

		return S::safeJS(\FileRun\Lang::t($s, $this->config['localeSection'], $v));
	}
	function run() {
		global $settings, $fm, $myfiles, $config;
		if (stripos($this->data['relativePath'], '/ROOT/HOME') === false) {
			$this->data['relativePath'] = '/ROOT/HOME';
		}
		if (sizeof($_POST['paths']) < 2) {
			exit('You need to select at least two files');
		}
		$imagemagick_convert = $settings->thumbnails_imagemagick_path;
		$filename = $fm->basename($imagemagick_convert);
		$graphicsMagick = false;
		if (in_array($filename, array('gm', 'gm.exe'))) {
			$graphicsMagick = true;
			$imagemagick_convert = $imagemagick_convert.' convert';
		}

		$cmd = str_replace('convert', 'montage', $imagemagick_convert);
		$cmd .= " -label \"%f\" -font Arial -pointsize 20 -background \"#ffffff\" -fill \"black\" -strip -define jpeg:size=600x500 -geometry 600x500+2+2";

		if (!$graphicsMagick) {
			if ($config['imagemagick_limit_resources']) {
				$cmd .= " -limit area 20mb";
				$cmd .= " -limit disk 500mb";
			}
			if (!$config['imagemagick']['no_auto_orient']) {
				$cmd .= " -auto-orient";
			}
		}

		if (sizeof($_POST['paths']) > 8) {
			$cmd .= ' -tile 2x4';
		} else {
			$cmd .= ' -tile 2x';
		}

		foreach ($_POST['paths'] as $relativePath) {
			$relativePath = S::fromHTML($relativePath);
			if (!\FileRun\Files\Utils::isCleanPath($relativePath)) {
				echo 'Invalid path!';
				exit();
			}
			if (\FileRun\Files\Utils::isSharedPath($relativePath)) {
				$pathInfo = \FileRun\Files\Utils::parsePath($relativePath);
				$shareInfo = \FileRun\Share::getInfoById($pathInfo['share_id']);
				if (!$shareInfo['perms_download']) {
					jsonOutput(array('success' => false, 'msg' => $this->getString('You are not allowed to access the requested file!')));
				}
			}
			$filePath = $myfiles->getUserAbsolutePath($relativePath);
			if (!file_exists($filePath)) {
				jsonOutput(array('success' => false, 'msg' => $this->getString('The file you are trying to process is no longer available!')));
			}
			$filename = $fm->basename($relativePath);
			$ext =  $fm->getExtension($filename);
			if ($this->isSupportedImageFile($ext)) {
				$cmd .= ' "'.$filePath;
				if (in_array($ext, array('tiff', 'tif', 'pdf', 'gif', 'ai', 'eps'))) {
					$cmd .= '[0]';
				}
				$cmd .= '"';
			}
		}
		$outputFilename = 'Contact_sheet_'.time().'.jpg';
		$outputPath = $myfiles->getUserAbsolutePath(gluePath($this->data['relativePath'], $outputFilename));
		$cmd .= ' "'.$outputPath.'"';

		if ($fm->os == "win") {
			$cmd .= "  && exit";
		} else {
			$cmd .= " 2>&1";
		}
		$return_text = array();
		$return_code = 0;
		session_write_close();
		exec($cmd, $return_text, $return_code);
		if ($return_code != 0) {
			jsonOutput(array('success' => false, 'msg' => $this->getString('Action failed: %1 %2', array($return_code, implode(',', $return_text)))));
		} else {
			\FileRun\Paths::addIfNotFound($outputPath);
			jsonOutput(array('success' => true, 'refresh' => 'true', 'highlight' => $outputFilename, 'msg' => $this->getString('Photo proof sheet successfuly created')));
		}
	}

	function isSupportedImageFile($ext) {
		global $settings, $fm;
		$ext = strtolower($ext);
		$typeInfo = $fm->fileTypeInfo(false, $ext);
		if ($typeInfo['type'] == "img") {
			return "gd";
		}
		if ($settings->thumbnails_imagemagick && in_array($ext, explode(",", strtolower($settings->thumbnails_imagemagick_ext)))) {
			return "imagemagick";
		}
		return false;
	}
}