<?php
require_once('inc/langHeader.inc'); 
require_once('inc/auth.inc'); 
require_once('inc/common.inc'); 
require_once('inc/errorMessages.inc'); 
require_once('inc/bookmarkFunc.inc'); 
require_once('inc/dialogError.php'); 
require_once('inc/Page.inc'); 
require_once('inc/HtmlElements.inc'); 
function x_1($x_2) { 
$x_3 = new x_4(); 
$x_5 = Array('/script/mainFunc.js', '/script/actionsFunc.js'); 
$x_3->x_5($x_5); 
$x_3->x_2($x_2); 
$x_3->x_6(); 
exit(); 
} 
$x_7 = new x_8(); 
$x_9 = $_POST["x_a"]; 
$x_b = $_POST['x_c']; 
$x_d -> getSessionVariable('currentDir', &$x_e); 
$x_d -> getUrlForPath($x_e, &$x_f); 
$x_f = '/browse'.$x_f; 
switch ($x_9) { 
case 'mkDir': 
$x_g = $_POST['x_h']; 
$x_i = $_POST['x_j']; 
$x_k = str_replace('\\\\', '\\', $x_i.'\\'.$x_g); 
$x_d->getUrlForPath($x_i, &$x_l); 
$x_d->getUrlForPath($x_k, &$x_m); 
if ('' == $x_b || $x_b != $x_c) { 
$x_n = 1; 
$x_o = -1; 
} else { 
$x_n = $x_d->makeDirectory($x_k, &$x_o); 
} 
if ($x_n == 0) { 
$x_2 = $x_7->x_p($x_i, 'errorMessageServer') 
. $x_7->x_p($x_g, 'errorMessageFolder') 
. $x_7->x_q('', $x_l, 'pathCurrent') 
. $x_7->x_q('', $x_m, 'pathNew') 
. '<script>' 
. $x_7->x_r('errorMessageFolder') 
. $x_7->x_r('errorMessageServer') 
. $x_7->x_s('pathNew') 
. $x_7->x_s('goToPath', 'pathCurrent') 
. $x_7->x_t('waitPhase', 'endPhase') 
. '</script>'; 
} elseif ($x_n == 1) { 
if ($x_g != '') { 
$x_u = x_v($x_o); 
} else { 
$x_u = '<kerio:text id="errorMessage_emptyFolderName" />'; 
} 
$x_2 = $x_7->x_p($x_u, 'errorMessage') 
. '<script>' 
. (-1 == $x_o ? 'window.top.document.getElementById("okButton_error").style.display = "none";' : '') 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} 
break; 
case 'rename': 
$x_w =$_POST['x_x']; 
$x_y = $_POST['x_z']; 
if ('' == $x_b || $x_b != $x_c) { 
$x_n = sslvpn_ERR_Failure; 
$x_o = -1; 
} else { 
$x_n = $x_d -> renameFile(urldecode($x_w), urldecode($x_y), &$x_o); 
} 
if ($x_n == sslvpn_ERR_Ok ) { 
$x_2 = $x_7->x_p('"<strong>' . x_10(urldecode($x_w)) 
. '</strong>"&nbsp;<kerio:text id="rename_succ_renamed"/>&nbsp;"<strong>' 
. urldecode($x_y) . '</strong>"', 'errorMessageSucc') 
. $x_7->x_q('', str_replace('/browse', '', $x_f), 'pathCurrent') 
. '<script>' 
. $x_7->x_s('goToPath', 'pathCurrent') 
. $x_7->x_r('errorMessageSucc') 
. $x_7->x_t('waitPhase', 'endPhase') 
. '</script>'; 
} else { 
if($x_n == sslvpn_ERR_Parameters ) { 
$x_2 = $x_7->x_p('<kerio:text id="actions_rename_badchars" />', 'errorMessage'); 
} else { 
$x_u = x_v($x_o); 
if ('' == $x_y) { 
$x_u .= '<br>' . '<kerio:text id="errorMessage_checkFileFolderName" />'; 
} 
$x_2 = $x_7->x_p($x_u, 'errorMessage'); 
} 
$x_2 .= '<script>' 
. (-1 == $x_o ? 'window.top.document.getElementById("okButton_error").style.display = "none";' : '') 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} 
break; 
case 'delete': 
if ('' == $x_b || $x_b != $x_c) { 
$x_o = -1; 
} else { 
$x_11 = Array(); 
$x_12 = unserialize($_POST['x_13']); 
} 
if (is_array($x_12) && !empty($x_12) && $x_o != -1) { 
$x_14 = 0; 
if ($x_12['dirs']) { 
foreach ($x_12['dirs'] as $x_15 => $x_16) { 
$x_17 = $x_d -> removeDirectory(urldecode(urldecode($x_16)), &$x_o); 
if ($x_o != 0) { 
$x_11['dirs'][x_10(urldecode($x_16))] = x_v($x_o); 
$x_18['dirs'][] = $x_16; 
$x_14++; 
} 
} 
} 
if ($x_12['files']) { 
foreach ($x_12['files'] as $x_19 => $x_1a) { 
$x_17 = $x_d -> eraseFile(urldecode(urldecode($x_1a)), &$x_o); 
if ($x_o != 0) { 
$x_11['files'][x_10(urldecode($x_1a))] = x_v($x_o); 
$x_18['files'][] = $x_1a; 
$x_14++; 
} 
} 
} 
if (count($x_11) != 0) { 
$x_1b = count($x_11['dirs']) + count($x_11['files']); 
$x_1c = count($x_12['dirs']) + count($x_12['files']); 
$x_2 = $x_7->x_p(x_1d($x_11), 'errorMessage') 
. $x_7->x_p($x_1b, 'notDeletedCount') 
. '<script>' 
. 'window.top.document.getElementById("notDeletedMessage").style.display = "block";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_r('notDeletedCount') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. ($x_1b != $x_1c ? 'x_1e("/browse' . addslashes($x_e) . '", 1)' : '') 
. '</script>'; 
if (isset($x_18) && (count($x_18['files']) + count($x_18['dirs'])) > 0) { 
$x_2 .= '<form name="frm" action="inc/getValues.php" target="executeWindow" method="POST">'; 
if (count($x_18['dirs']) != 0) { 
foreach ($x_18['dirs'] as $x_1f) { 
$x_2 .= $x_7->x_q('', $x_1f, 'dir[]') . '<br>'; 
} 
} 
if (count($x_18['files']) != 0) { 
foreach ($x_18['files'] as $x_w) { 
$x_2 .= $x_7->x_q('', $x_w, 'file[]') . '<br>'; 
} 
} 
$x_2 .= $x_7->x_q('hidden', 'copy', 'mode') . '</form>'; 
} 
} else { 
$x_2 = $x_7->x_q('', str_replace('/browse', '', $x_f), 'pathCurrent') 
. '<script>' 
. $x_7->x_s('goToPath', 'pathCurrent') 
. $x_7->x_t('waitPhase', 'endPhase') 
. '</script>'; 
} 
} elseif (-1 == $x_o) { 
$x_2 = $x_7->x_p(x_v($x_o), 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("notDeletedMessage").style.display = "none";' 
. 'window.top.document.getElementById("okButton_error").style.display = "none";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} 
break; 
case 'move': 
case 'copy': 
if ('move' == $x_9) { 
$x_1g = 'move'; 
} else { 
$x_1g = 'copy'; 
} 
if ('' == $x_b || $x_b != $x_c) { 
$x_o = -1; 
$x_2 = $x_7->x_p(x_v($x_o), 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("actionFailedMessage").style.display = "none";' 
. 'window.top.document.getElementById("okButton_error").style.display = "none";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} else { 
$x_12 = unserialize($_POST['x_13']); 
$x_1h = $_POST['x_j']; 
$x_1i = $x_1h; 
$x_1j = Array(); 
if (strpos($x_1h, ':') === false) { 
if (count($x_12['dirs']) === 0) { 
$x_n = $x_d -> getFileAttributes($x_1i, &$x_1k, &$x_o); 
$x_1l = 0; 
$x_1m = 0; 
if ($x_n == 1) { 
$x_1m = 1; 
} 
foreach ($x_1k as $x_1n => $x_1o) { 
switch ($x_1o){ 
case sslvpn_FA_Directory: 
$x_1l = 1; 
break; 
} 
} 
$x_1p = 'block'; 
if ($x_1l == 1) { 
foreach ($x_12['files'] as $x_19 => $x_1q) { 
$x_1r = urldecode($x_1q); 
$x_1s = $x_1i.'\\'.x_10($x_1r); 
if ('copy' == $x_9) { 
$x_n = $x_d -> copyFile(urldecode($x_1r), urldecode($x_1s), &$x_o); 
} elseif ('move' == $x_9) { 
$x_n = $x_d -> moveFile(urldecode($x_1r), urldecode($x_1s), &$x_o); 
} 
if (1 == $x_n) { 
$x_1j['files'][x_10($x_1r)] = x_v($x_o); 
$x_1t['files'][] = $x_1r; 
} 
} 
} elseif ($x_1l == 0 && count($x_12['files']) == 1) { 
$x_1r = $x_12['files'][0]; 
$x_1s = $x_1i; 
if ('copy' == $x_9) { 
$x_n = $x_d -> copyFile(urldecode($x_1r), urldecode($x_1s), &$x_o); 
} elseif ('move' == $x_9) { 
$x_n = $x_d -> moveFile(urldecode($x_1r), urldecode($x_1s), &$x_o); 
} 
if (1 == $x_n) { 
$x_1j['files'][x_10($x_1r)] = x_v($x_o); 
$x_1t['files'][] = $x_1r; 
} 
$x_1u = explode ('\\', urldecode($x_1h)); 
$x_1v = count($x_1u); 
$x_1h = ''; 
foreach ($x_1u as $x_1w => $x_1x) 
if ($x_1w < ($x_1v-1) && strlen(trim($x_1x)) != 0) 
$x_1h .= '\\'.$x_1x; 
$x_1p = 'block'; 
} elseif ($x_1l == 0 && $x_12['files'] != 1) { 
$x_1y = count($x_12['dirs']) + count($x_12['files']); 
$x_2 = $x_7->x_p( 
('copy' == $x_1g ? 
'<kerio:text id="actions_copy_more_in_one"/>' : 
'<kerio:text id="actions_move_more_in_one"/>'), 
'errorMessage') 
. $x_7->x_p($x_1y, 'notCount') 
. '<script>' 
. 'window.top.document.getElementById("actionFailedMessage").style.display = "block";' 
. $x_7->x_r('notCount') 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
x_1($x_2); 
} 
} 
} else { 
$x_1j['files'][x_10($x_1h)] = "<kerio:text id='actions_copy_badchars'/>"; 
} 
if ($x_12['dirs'] && count($x_12['dirs']) != 0) { 
$x_1u = Array(); 
$x_1u['dirs'] = Array(); 
foreach ($x_12['dirs'] as $x_1f) { 
if ('copy' == $x_1g) { 
$x_1u['dirs'][x_10(urldecode($x_1f))] = '<kerio:text id="actions_copy_over_dirs"/>'; 
} else { 
$x_1u['dirs'][x_10(urldecode($x_1f))] = '<kerio:text id="actions_move_over_dirs"/>'; 
} 
$x_1t['dirs'][] = $x_1f; 
} 
$x_1j = array_merge($x_1u, $x_1j); 
} 
if (count($x_1j) == 0) { 
$x_d->getUrlForPath($x_1h, &$x_1z); 
$x_2 = $x_7->x_p($x_1i, 'targetDir') 
. $x_7->x_q('', str_replace('/browse', '', $x_f), 'pathCurrent') 
. $x_7->x_q('', $x_1z, 'pathNew') 
. '<script>' 
. 'window.top.document.getElementById("actionFailedMessage").style.display = "block";' 
. 'window.top.document.getElementById("radioTable").style.display = "'. $x_1p . '";' 
. $x_7->x_s('pathCurrent') 
. $x_7->x_s('pathNew') 
. $x_7->x_s('goToPath', 'pathCurrent') 
. $x_7->x_r('targetDir') 
. $x_7->x_t('waitPhase', 'endPhase') 
. '</script>'; 
} else { 
$x_1y = count($x_1j['dirs']) + count($x_1j['files']); 
$x_2 = $x_7->x_p($x_1y, 'notCount') 
. $x_7->x_p(x_1d($x_1j), 'errorMessage'); 
if (isset($x_1t) && (count($x_1t['files']) + count($x_1t['dirs'])) > 0) { 
$x_2 .= '<form name="frm" action="inc/getValues.php" target="executeWindow" method="POST">'; 
if (count($x_1t['dirs']) != 0) { 
foreach ($x_1t['dirs'] as $x_1f) { 
$x_2 .= $x_7->x_q('text', $x_1f, 'dir[]') . '<br>'; 
} 
} 
if (count($x_1t['files']) != 0) { 
foreach ($x_1t['files'] as $x_w) { 
$x_2 .= $x_7->x_q('text', $x_w, 'file[]') . '<br>'; 
} 
} 
$x_2 .= $x_7->x_q('hidden', 'copy', 'mode') . '</form>'; 
} 
$x_2 .= '<script>' 
. $x_7->x_r('errorMessage') 
. $x_7->x_r('notCount') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} 
} 
break; 
case 'bookmarkInsert': 
$x_20 = 'dialogBookmarkInsert'; 
case 'addToBookmarks': 
if ($x_9 == 'addToBookmarks') 
$x_20 = 'dialogAddToBookmarks'; 
if ('' == $x_b || $x_b != $x_c) { 
$x_o = -1; 
} 
$x_21 = $_POST['x_22']; 
if (strlen(trim($x_21['path'])) != 0 && $x_o != -1) { 
$x_21['description'] = htmlspecialchars($x_21['description']); 
$x_21['path'] = x_23($x_21['path']); 
$x_21['description'] = htmlspecialchars($x_21['description']); 
$x_24 = x_25($x_21); 
if (!isset($x_21['enabled'])) { 
$x_21['enabled'] = 0; 
} 
echo $x_24; 
switch ($x_24) { 
case 'badChar': 
$x_2 .= $x_7->x_p('<kerio:text id="bookmarks_badChar"/>', 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("okButton_error").style.display = "block";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
x_1($x_2); 
break; 
case 'ok': 
$x_2 .= $x_7->x_p($x_1i, 'targetDir') 
. $x_7->x_p(htmlspecialchars($x_21['path']), 'bookmarkPathSucc') 
. $x_7->x_q('', ('addToBookmarks' == $x_9 ? '/bookmarks.php?refresh[]=bookmarkWindow' : '/bookmarks.php'), 'pathCurrent') 
. '<script>' 
. $x_7->x_r('bookmarkPathSucc') 
. $x_7->x_s('goToPath', 'pathCurrent') 
. $x_7->x_t('waitPhase', 'endPhase') 
. '</script>'; 
x_1($x_2); 
break; 
case 'dupKey': 
$x_2 .= $x_7->x_p('<kerio:text id="bookmarks_exists"/>', 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("okButton_error").style.display = "block";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
x_1($x_2); 
break; 
default: 
echo x_26("<kerio:text id='unknown_error'/>", Array('cancel'), 'Insert Bookmark', '', 190); 
break; 
} 
} elseif ($x_o != -1) { 
$x_2 = $x_7->x_p('<kerio:text id="bookmarks_fill_path"/>', 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("okButton_error").style.display = "block";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} else { 
$x_2 = $x_7->x_p(x_v($x_o), 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("okButton").style.display = "none";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} 
echo x_26("<kerio:text id='bookmarks_fill_path'/>", Array('back', 'cancel'), '', 190); 
break; 
case 'bookmarkDelete': 
if ('' == $x_b || $x_b != $x_c) { 
$x_o = -1; 
} else { 
$x_27 = unserialize($_POST['x_28']); 
} 
if (-1 == $x_o) { 
$x_2 = $x_7->x_p(x_v($x_o), 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("okButton_error").style.display = "none";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} elseif (!isset($x_27) || !is_array($x_27)) { 
$x_2 .= $x_7->x_p('<kerio:text id="unknown_error"/>', 'errorMessage') 
. '<script>' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
x_1($x_2); 
} else { 
$x_11 = Array(); 
foreach ($x_27 as $x_21) { 
$x_1u = x_29($x_21); 
if ($x_1u != 'ok') 
$x_11[] = '<tr title="'.$x_21['path'].'">


											<td width="16"><img src="/nonauth/gfx/tb_bookmark.gif" width="16" height="16" border="0" align="absmiddle"></td>


											<td>&nbsp;'.(strlen($x_21['description'])!=0 ? $x_21['description'] : $x_21['path']).'</td>


											<td nowrap>'."<kerio:text id='unable_find'/>".'</td>


											</tr>'; 
} 
if (empty($x_11)) { 
$x_2 .= $x_7->x_q('', '/bookmarks.php', 'pathCurrent') 
. '<script>' 
. $x_7->x_s('goToPath', 'pathCurrent') 
. $x_7->x_t('waitPhase', 'endPhase') 
. '</script>'; 
x_1($x_2); 
} else { 
$x_2 .= $x_7->x_p(print_r($x_11, true), 'errorMessage') 
. '<script>' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
x_1($x_2); 
} 
} 
break; 
case 'bookmarkEdit': 
if ('' == $x_b || $x_b != $x_c) { 
$x_o = -1; 
} else { 
$x_21 = unserialize($_POST['x_2a']); 
$x_2b['path'] = $_POST['x_22']['path']; 
$x_2b['description'] = htmlspecialchars($_POST['x_22']['description']); 
} 
if (-1 == $x_o) { 
$x_2 = $x_7->x_p(x_v($x_o), 'errorMessage') 
. '<script>' 
. 'window.top.document.getElementById("okButton_error").style.display = "none";' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} elseif ((!isset($x_21) || !is_array($x_21)) || (!isset($x_2b) || !is_array($x_2b))) { 
exit(); 
} else { 
if (strlen(trim($x_2b['path'])) != 0) { 
if (!isset($x_21['enabled'])) { 
$x_21['enabled'] = 0; 
} 
if (!isset($x_2b['enabled'])) { 
$x_2b['enabled'] = 0; 
} 
$x_2c = x_2d($x_21, $x_2b); 
switch ($x_2c) { 
case 'badChar': 
$x_2 = $x_7->x_p('<kerio:text id="bookmarks_badChar"/>', 'errorMessage') 
. '<script>' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
x_1($x_2); 
break; 
case 'ok': 
$x_2 = $x_7->x_p($x_1i, 'targetDir') 
. $x_7->x_p($x_21['path'].' (<i>' . str_replace('&amp;', '&', $x_21['description']) . '</i>)' 
, 'bookmarkOldReport') 
. $x_7->x_p($x_2b['path'].' (<i>'.$x_2b['description'].'</i>)', 'bookmarkNewReport') 
. $x_7->x_q('', '/bookmarks.php', 'pathCurrent') 
. '<script>' 
. $x_7->x_r('bookmarkOldReport') 
. $x_7->x_r('bookmarkNewReport') 
. $x_7->x_s('goToPath', 'pathCurrent') 
. $x_7->x_t('waitPhase', 'endPhase') 
. '</script>'; 
x_1($x_2); 
break; 
case 'dupKey': 
$x_2 = $x_7->x_p('<kerio:text id="bookmarks_exists"/>', 'errorMessage') 
. '<script>' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
x_1($x_2); 
break; 
default: 
echo x_26("<kerio:text id='unknown_error'/>", Array('cancel'), 'Edit Bookmark', '', 190); 
break; 
} 
} else { 
$x_2 = $x_7->x_p('<kerio:text id="bookmarks_fill_path"/>', 'errorMessage') 
. '<script>' 
. $x_7->x_r('errorMessage') 
. $x_7->x_t('waitPhase', 'errorPhase') 
. '</script>'; 
} 
} 
break; 
default: 
break; 
} 
x_1($x_2); 
?>
