Files
resatennis_tyroltenn/IDrive/.config/preferences.php

559 lines
23 KiB
PHP
Executable File

<?php
include_once 'path.php';
if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true)
exit(header("Location:../index.php"));
if(!empty($userName)){
if($_SESSION['dedup']){
$nickNameExists = empty($hostName)?false:true;
$deviceIDExists = deviceIDExists();
}
/* For Exclude - Start*/
$partialData = array();
$fullData = array();
//excludeworkingfolder(); // Creating full path exclude file if not exists.
if(!isset($_SESSION['partialEntry']) && file_exists($excludePartialFilePath)) {
$sessionPartialEntry = file($excludePartialFilePath, FILE_IGNORE_NEW_LINES);
$_SESSION['partialEntry'] = $sessionPartialEntry;
}
if(!isset($_SESSION['fullEntry']) && file_exists($excludeFullFile)) {
$_SESSION['fullEntry'] = file($excludeFullFile, FILE_IGNORE_NEW_LINES);
}
/* For Exclude - End*/
/* For Backup Location - Start*/
$hostname = Scheduler::GetHost($userName);
/* For Proxy - Start*/
$accountSettingsFilePath = "$webDir/".SERVICE."/".USER_PROFILE."/".$_SESSION['nasUserName']."/$userName/ACCOUNT_SETTINGS_FILE";
$proxyString='';
if(file_exists($accountSettingsFilePath)){
$lines = readAccountSettingsFile();
$proxyString = trim($lines['PROXY']);
if($proxyString!='')
$proxy_Array = preg_split( "/[:@]/", $proxyString);
}else {
$proxy_Array[2] = isset($_SESSION['ipAddress'])?$_SESSION['ipAddress']:'';
$proxy_Array[3] = isset($_SESSION['port'])?$_SESSION['port']:'';
$proxy_Array[0] = isset($_SESSION['proxyUserName'])?$_SESSION['proxyUserName']:'';
$proxy_Array[1] = isset($_SESSION['proxyPassword'])?urlencode($_SESSION['proxyPassword']):'';
}
/* For Proxy - End*/
/* For Bandwidth throttle - Start*/
$bandwidthFilePath = Scheduler::$user_dir.BW_FILE;
$bandWidth='';
if(file_exists($bandwidthFilePath))
{
$bandWidth = file_get_contents($bandwidthFilePath);
$bandWidth = trim($bandWidth);
}
$bandWidth = $bandWidth==''?100:$bandWidth;
/* For Bandwidth throttle - End*/
/* Relative/Mirror Path - Start */
$relativeFile = Scheduler::$user_dir.RELATIVE_FILE;
$relativePathValue='';
$relativePathChecked = '';
$mirrorPathChecked = '';
if(file_exists($relativeFile))
{
$relativePathValue = file_get_contents($relativeFile);
$relativePathValue = trim(ltrim($relativePathValue, "--"));
}
if($relativePathValue=='no-relative'){
$relativePathChecked = "selected=''";
} else {
$mirrorPathChecked = "selected=''";
}
/* Relative/Mirror Path - End */
# check root level directory listing
isRootLevelDisplayEnabled();
} else {
$bandWidth = 100;
if($_SESSION['proxy_option']=='Manual' || $_SESSION['proxy_option']=='autodetect'){
$proxy_Array[2] = isset($_SESSION['ipAddress'])?$_SESSION['ipAddress']:'';
$proxy_Array[3] = isset($_SESSION['port'])?$_SESSION['port']:'';
$proxy_Array[0] = isset($_SESSION['proxyUserName'])?$_SESSION['proxyUserName']:'';
$proxy_Array[1] = isset($_SESSION['proxyPassword'])?$_SESSION['proxyPassword']:'';
}
}
?>
<div class="container body_wrap preference_page">
<div class="preference">
<div class="tabs_section">
<ul>
<li class="general_tab selected">
<div class="tabs"> General</div>
</li>
<li class="excludes_tab">
<div class="tabs "> Exclude</div>
</li>
<li class="advance_tab">
<div class="tabs "> Network</div>
</li>
</ul>
</div>
<!-- End tab1_wrap -->
<div class="tab1_wrap">
<div class="exclude backup_location">
<div class="backup_innerwrap">
<div class="show_files">
<span><input type="checkbox" name="showHide" id="showHide" value="" <?php if($_SESSION['showHidden']=="Show") {echo "checked='checked'";}?>/>Show hidden files and folders</span>
<div class="clear_both"></div>
<!-- Commented by anil and need to make the status checked by default for release -->
<span class="displaylvl" style="display: block;"><input type="checkbox" id="displayRootChk" value="" <?php if((!isset($_SESSION['displayRoot'])) || (isset($_SESSION['displayRoot']) && $_SESSION['displayRoot'] === 1)){ echo "checked='checked'"; }?> />Root level listing</span>
</div>
<div class="cdploaction">
<h3>Continuous Data Protection</h3>
<div><input type="checkbox" name="multipleEngineEnable" id="multipleEngineEnable" value="" <?php if($_SESSION['multipleEngineEnable'] != 2) { echo "checked='checked'"; }?> /> Upload multiple file chunks simultaneously <div class="cdp_tooltip">?
<div class="cdp_tooltip_block" style="display: none;">
<span class="cdp_tooltip_block_arrow"></span>
<p>On enabling this option, application will try to upload multiple file chunks simultaneously to improve the data transfer speed. To get optimum transfer speed, ensure availability of high internet bandwidth during backup.</p>
</div>
</div>
</div>
</div>
<div class="bkplocation" <?php if ('twotier' == $machine || $_SESSION['dedup']) echo "style='display:none'"; ?> >
<h3>Backup Location</h3>
<form>
<p>Application is configured to backup to <input type="text" class="input" name="backupLocation" id="backupLocation" readonly="true" title="<?php echo htmlentities($hostname,ENT_QUOTES) ?>" value="<?php echo htmlentities($hostname,ENT_QUOTES) ?>" />
<!-- <input type="hidden" name="backupLocationLength" id="backupLocationLength" value="<?php //echo strlen($hostname) ?>" /> -->
<input type="button" id="file_browse" value="..."> folder. </p>
<div class="mirror_path">
<ul class="mirror_ul">
<li class="mirror_selectbox">
<select class="path_selected" name="pathType" id="pathType">
<option value="relative" <?php print $mirrorPathChecked; ?>>Mirror Path</option>
<option value="no-relative" <?php print $relativePathChecked; ?>>Relative Path</option>
</select>
<div class="show_files">
<input type="hidden" name="hiddenStatus" id="hiddenStatus" value="<?php if($_SESSION['showHidden']=="Show"){echo "1";} else {echo "2"; } ?>"/>
<input type="hidden" name="hiddenEngineStatus" id="hiddenEngineStatus" value="<?php if($_SESSION['multipleEngineEnable']=="2"){echo "2";} else {echo "4"; } ?>"/>
<?php if($machine == SYNOLOGY_LOCAL || QNAP == $machine || ASUSTOR == $machine || NETGEAR_LOCAL == $machine){ ?>
<input type="hidden" id="displayRoot" name="displayRoot" value="<?php echo (($_SESSION['displayRoot'] === 1)? 1 : 0); ?>" />
<?php } ?>
</div>
</li>
<li class="mirror_txt">
for backup.
</li>
</ul>
</div>
</form>
</div>
<!-- bkplocation -->
<?php //if("twotier" == $machine ){ ?>
<div class="logint_option_text" style="display: none">
<h3>IDrive Cloud Account Credentials</h3>
<p class="lot_description">Your account details are displayed here.</p>
<div class="lot-wrap">
<div class="lotw_name"> <span class="lotw_user">Username:</span> <span class="lotw_id"><?php print $userName; ?></span> <span class="lotw_logout">Logout</span> </div>
</div>
</div>
<?php //} ?>
</div>
<!-- backup_innerwrap -->
</div>
</div>
<div class="tab2_wrap"> <!-- Start General tabs -->
<div class="exclude exclude_backup1 ">
<div class="excludeContainer">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody><tr class="pref_mainHeader">
<td class="excludeheader table_header " colspan="4">
<p class="left">Exclude files/folders with full path names</p>
<div class="right"> <div class="addnew requirements" id="addFullExclude">Add</div> </div>
</td>
</tr>
<tr class="excludeheader header_part ">
<td width="3%" class="file_check"><input type="checkbox" class="checkcontrol" id="maincheckFull"><label class="mainCheck">All</label></td>
<td width="40%" class="fname" colspan="2">Files / folders with full path names </td>
<td align="right" width="27%" class="backupset_chk_delete" id="removeSelectedFullPath"> <span> Remove </span></td>
</tr>
</tbody></table>
<div class="nfiles" id="noFullPath"><?php print NO_FULL_PATHS;?></div>
<div class="excludefiles" style="overflow: hidden;">
<form id="fullPathForm" name="fullPathForm" method="POST">
<table id="excludeFullPath" width="100%" border="0" cellspacing="0" cellpadding="0" class="folderBackupContent">
<?php
if (isset($_SESSION['fullEntry'])) {
$disable = "";
$disabled_row = "";
$fullPathName = trim($_SESSION['fullEntry'][0]);
// Find whether the file/folder exists.
$fileInfos = array();
parse_str(validateFileList($excludeFullFile, '/'), $listVal);
$fileInfos = $listVal['fileInfos'];
if (!empty($fullPathName)) {
if ($fullPathName == getOriginalServicePath())
{
$disable = 'class ="deny" style="pointer-events:none;"';
$disabled_row = 'style="background-color:#dae4ea"';
}
}
$cssSpanClassName='';
for($index = 0; $index < sizeof($_SESSION['fullEntry']); ($index = $index + 4)) {
$fullPathName = trim($_SESSION['fullEntry'][$index]);
$img = $_SESSION['fullEntry'][$index + 1];
$fileInfo = $fileInfos[($index / 4)];
$cssClassName = '';
$fileMissingEle = '';
if ($fileInfo === '0') {
$cssSpanClassName = 'class="file_missing_filename"';
$cssClassName = 'class="file_missing"';
$fileMissingEle = '<span class="file_missing_text">';
$fileMissingEle .= ($img . ' is missing');
$fileMissingEle .= '</span>';
}
$imgType = ($img != '') ? $img : 'folder';
if(!empty($fullPathName)){
$fullPathName = htmlentities($fullPathName, ENT_QUOTES);
$displayFullPathName = $fullPathName;
if($machine=='twotier'){
$displayFullPathName = substr($fullPathName,$twoTierSharePathLength);
}
echo "<tr ".$disabled_row ." " . $cssClassName .">
<td class=\"file_check\"> <input type=\"checkbox\" ><input type=\"hidden\" name=\"selectedFull[]\" value=\"$fullPathName\">
<input type=\"hidden\" name=\"imgType[]\" value=\"$imgType\">
<label ".$disable ."> files </label></td>
<td class=\"cont_heading\" title=\"$displayFullPathName\"><img src=\"include/images/idq_ico_$imgType.png\" ><span $cssSpanClassName " . (($fileMissingEle != '')? "style=\"max-width: 620px;\"" : '') . ">".str_replace(" ","&nbsp;",$displayFullPathName)."</span>" . $fileMissingEle ."</td>
</tr>";
$disable = "";
$disabled_row = "";
}
}
}
?>
</table>
</form>
</div>
</div>
<!-- excludeContainer -->
<!-- displayController -->
</div>
<div class="exclude exclude_backup2 partial_header">
<div class="displayController">
<div class="excludeContainer">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody><tr class="pref_mainHeader">
<td class="excludeheader table_header" colspan="4"><p class="left">Exclude files/folders with partial names</p>
<div class="addController">
<input type="text" class="input" id="fileName" placeholder="Enter Partial names" autocomplete="off">
<input type="submit" id="partial_name_submit" class="submitbtn" value="" alt="add" title="add">
</div>
</td>
</tr>
</tbody></table>
<table cellspacing="0" cellpadding="0" border="0" width="100%" class="main_chk_table">
<tbody>
<tr class="excludeheader header_part ">
<td width="3%" class="file_check"><input type="checkbox" class="checkcontrol" id="maincheckPartial"><label class="mainCheck">All</label></td>
<td width="40%" class="fname" colspan="2"> Files / folders with partial names </td>
<td align="right" width="27%" class="backupset_chk_delete" id="removeSelectedPartialName"> <span> Remove </span></td>
</tr>
</tbody>
</table>
<div id="noPartialName" class="nfiles"><?php print NO_PARTIAL_PATHS;?></div>
<div class="excludefiles">
<form id="partialNameForm" name="partialNameForm" method="POST">
<table id="selectedPartialName" width="100%" border="0" cellspacing="0" cellpadding="0" class="folderBackupContent">
<?php
if(isset($_SESSION['partialEntry']))
{
for($index = 0; $index < sizeof($_SESSION['partialEntry']); $index++)
{
$partialFileName = $_SESSION['partialEntry'][$index];
$partialFileName = htmlentities($partialFileName, ENT_QUOTES);
if(!empty($partialFileName) && $partialFileName!='\/.'){
print "<tr><td class=\"file_check\"><input type=\"checkbox\">
<input type=\"hidden\" name=\"selectedPartial[]\" value=\"$partialFileName\"><label >files</label></td>
<td class=\"cont_heading\" title=\"$partialFileName\"><img src=\"include/images/idq_ico_partialName.png\"><span>".str_replace(" ","&nbsp;",$partialFileName)."</span></td></tr>";
}
}
}
?>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- End tab2_wrap -->
<div class="tab3_wrap">
<form id="proxyForm" name="proxyForm" method="POST">
<div class="proxy_wrap">
<div class="proxy_inner">
<h3 class="prHeader"> Proxy setting</h3>
<div class="proxy_col">
<ul class="proxy_option">
<li>
<div class="opt_list">
<input type="radio" value="No-Proxy" name="proxy_option" <?php if(empty($proxy_Array[2])){ print 'checked="checked"';} ?>>
<label> No Proxy</label>
</div>
</li>
<li>
<div class="opt_list">
<input type="radio" name="proxy_option" value="autodetect" <?php if(!empty($proxy_Array[2]) && $_SESSION['proxy_option']=='autodetect'){ print 'checked="checked"';} ?>>
<label> Auto-detect</label>
</div>
</li>
<li>
<div class="opt_list">
<input type="radio" value="Manual" name="proxy_option"<?php if(!empty($proxy_Array[2]) && $_SESSION['proxy_option']!='autodetect'){ print 'checked="checked"';} ?>>
<label> Manual</label>
</div>
</li>
</ul>
<div class="proxy_set">
<div class="proxy_set_disable" <?php if(!empty($proxy_Array[0])){ print 'style="height:0px;"';} else if(!empty($proxy_Array[2])){ print 'style="height:95px;"';} ?>></div>
<div class="proxy_set1">
<label class="proxy_label1">Server</label><input type="textbox" id="ipAddress" name="ipAddress" value="<?php if(!empty($proxy_Array[2])) print $proxy_Array[2]; ?>">
<label class="proxy_label2">Port</label><input type="textbox" name="port" maxlength="5" value="<?php if(!empty($proxy_Array[3])) print $proxy_Array[3]; ?>">
</div>
<div class="proxy_set2">
<input type="checkbox" value="prox-password" id="proxyServerPassword" name="proxyServerPassword" <?php if(!empty($proxy_Array[0])){ print 'checked=""';} ?>>
<label> Proxy server requires password</label>
</div>
<div class="proxy_set3">
<p><label class="proxy_label1">Username</label><input type="textbox" name="userName" autocomplete="off" value="<?php if(!empty($proxy_Array[0])) print urldecode($proxy_Array[0]); ?>"></p>
<p><label class="proxy_label2">Password</label><input type="password" name="password" autocomplete="off" value="<?php if(!empty($proxy_Array[1])) print base64_encode($proxy_Array[1]); ?>"></p>
</div>
</div>
</div>
<!-- proxy_col -->
<div class="network_in_con">
<h3 class="bthrotle"> Bandwidth throttle</h3>
<p>You can set the Internet bandwidth to be used by the application for backups.</p>
<div class="throttle_col">
<div class="throttle_scroll">
<div id="bandwidth-throttle">
<table onselectstart="return false;" class="trackbar" style="width:300px;">
<tbody>
<tr>
<td class="l">
<div id="leftBlock" style="width: 150px;">
<span style="right: 0.24px;">50</span>
<span class="limit">0</span>
<img width="5" height="17" alt="" src="include/images/b_l.gif" ondragstart="return false;" id="leftBegun">
</div>
</td>
<td id="centerBlock" class="c"></td>
<td class="r">
<div id="rightBlock" style="width: 150px;">
<span style="left: 0.24px;"></span>
<span class="limit">100</span>
<img width="5" height="17" alt="" src="include/images/b_r.gif" ondragstart="return false;" id="rightBegun">
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="txtvalue"><input type="hidden" name="bandWidth" id="bandWidth" value="<?php print $bandWidth; ?>" /></div>
</div>
</div>
</div>
</div>
<!-- proxy_inner -->
</div> </form>
<!-- proxy_wrap -->
</div>
<!-- End tab3_wrap -->
</div>
</div>
<!--popup starts Add Folders/Files to your exclude list -->
<div id="excludepopup" class="popup_container popContent downPop popLeft preferences">
<section class="popup_header">
<h4>Add files/folders to your exclude list</h4>
<span class="popup_close_btn hide_popup"></span>
</section>
<section class="popup_body">
<div id="excludeFullError" class="common_msg">
<p>Please select folder/file to add exclude list</p>
<a class="close_info" href="javascript:void(0)">
<img width="16" height="16" src="include/images/close.png" alt="close" title="Close">
</a>
</div>
<div class="exclude popup_set_exclude">
<div class="excludeContainer excludeBackupFilePath">
<div id="fullPathBreadCrumb" class="breadcrumb"><a href="javascript:void(0);" alt="/" class="getDirList">/</a></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="folderBackupContent">
<tbody><tr class="excludeheader header_part prefexcludeheader">
<td width="3%" class="file_check"> <input type="checkbox" id="maincheck" class="checkcontrol"><label class="mainCheck">All</label> </td>
<td class="fname cont_heading">File/Folder name</td>
<td class="file_size">Size</td>
<td class="file_date">Date modified</td>
<td></td>
</tr>
</tbody></table>
<div class="ajax_loader"><p>loader...</p></div>
<div class="nfiles"><?php print NO_FILES;?></div>
<!-- Load Folders/Files from Disk - Start -->
<div id="loadFullPath">
<?php include("fullPathSelection.php"); ?>
</div>
<!-- Load Folders/Files from Disk - End -->
</div>
</div>
<!-- End file table -->
<div class="clear"></div>
</section>
<section class="popup_footer">
<div class="btncontainer">
<input type="submit" id="add_full_path" class="addButton" value="Add to exclude list">
<input type="submit" id="cancel_full_path" class="addButton" value="Cancel">
</div>
</section>
</div>
<!--popup starts Add Folders/Files to your exclude list -->
<div class="popup_container popContent Backuplocation_popup popLeft preferences">
<section class="popup_header">
<h4>Select your backup location</h4>
<span class="popup_close_btn hide_popup"></span>
</section>
<section class="popup_body">
<div class="common_msg" id="permissionError" style="display: none;">
<p>Error Message Here</p>
<a href="javascript:void(0)" class="close_info">
<img width="16" height="16" title="Close" alt="close" src="include/images/close.png">
</a>
</div>
<!-- files table -->
<div class="exclude popup_set_exclude">
<div class="excludeContainer">
<div id="backupLocationBreadCrumb" class="breadcrumb preferenceBreadCrumb"><a href="javascript:void(0);" alt="/" class="getDirList">/</a></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="folderBackupContent">
<tbody><tr class="excludeheader header_part ">
<td class="cont_heading" width="100%">File/Folder name</td>
<!-- <td width="15%">Size</td>
<td width="16%">Date modified</td> -->
</tr>
</tbody></table>
<div class="ajax_loader"><p>loader...</p></div>
<div class="nfiles"><?php print NO_FILES;?></div>
<!-- Load Folders/Files from Disk - Start -->
<div id="loadBackupLocation">
<!-- Display folders here-->
</div>
<!-- Load Folders/Files from Disk - End -->
</div>
</div>
<!-- End file table -->
<div class="clear"></div>
</section>
<section class="popup_footer">
<div class="btncontainer">
<input type="submit" id="addLocation" class="addButton" value=" Ok ">
<input type="submit" class="scheduleBtn popup_cancelBtn" value="Cancel">
</div>
</section>
</div>
<script type="text/javascript">
/* Preferences by Senthil */
var currDirPath='/';
preferenceChanged=0;
/* Document Ready - Start */
jQuery(document).ready(function() {
hideShowNoFiles();
storeAddedFullPath();
markSelectedJobItems('fullExclude');
$('.cdploaction .cdp_tooltip').mouseenter(function(){
$('.cdp_tooltip_block').css('display','block');
});
$('.cdploaction .cdp_tooltip').mouseleave(function(){
$('.cdp_tooltip_block').css('display','none');
});
$('.cdploaction label').click(function(){ $(this).toggleClass('label_checked'); });
});
/* Document Ready - End */
//changing path selected in preference page by Sajana K
jQuery(document).ready(function() {
$(document).on('change','#pathType',function(){
var backupPathtype = $('#pathType').val();
if(backupPathtype == "relative")
backupModeSet='mirror';
else
backupModeSet='relative';
});
});
/* Added for Tracker - By UI Team */
jQuery(document).ready(function(){
if(jQuery('#registered_user').html()!=''){
jQuery('#bandwidth-throttle').trackbar({
onMove : function() {
if(this.leftValue!=jQuery('#bandWidth').val()){
startTimeoutForAutoPost('preferences');
}
jQuery('#bandWidth').val(this.leftValue);
},
dual : false, // two intervals
width : 300, // px
leftLimit : 0, // unit of value
leftValue : <?php print $bandWidth; ?>, // unit of value
rightLimit : 100, // unit of value
rightValue : 50, // unit of value
});
} else {
$('.tabs_section ul li').removeClass('selected');
$(".tabs_section li.advance_tab").addClass('selected');
$('.tab3_wrap').show();
$('.tab1_wrap,.tab2_wrap').hide();
if(jQuery('#proxyServerPassword').attr('checked')=='checked'){
jQuery('.proxy_set_disable').css('height','0px');
}
}
var storedPassword = jQuery(".proxy_set3 input[name='password']").val();
if(storedPassword!=''){
jQuery(".proxy_set3 input[name='password']").val(base64_decode(storedPassword));
}
var disableProxy = jQuery(".proxy_set_disable").css('height');
if(disableProxy=='175px'){
jQuery('.proxy_set1 input,.proxy_set3 input').attr('disabled','disabled').addClass('proxy_wrap_gry_input');
} else {
jQuery('.proxy_set1 input,.proxy_set3 input').removeAttr('disabled','disabled').removeClass('proxy_wrap_gry_input');
}
});
/* Added for Tracker - By UI Team */
</script>