New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom css #1874

Open
wants to merge 752 commits into
base: 2.1.27
from
Commits
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+75 −12
Diff settings

Always

Just for now

2.1.27

Improved offline file with full encryption and limited to 1 week
  • Loading branch information...
nilsteampassnet committed Oct 24, 2017
commit d064343e089192e9ea673e96a84312b83a649bee
Copy path View file
@@ -2602,21 +2602,21 @@ function(data) {
}
if (value.is_visible_active === 1) {
disabled_active_visible = '';
} else {
disabled_active_visible = ' disabled="disabled"';
} else {
disabled_active_visible = '';
}
// Prepare options lists
html_visible += '<option value="'+value.id+'"'+disabled+'>'+indentation+value.title+'</option>';
html_full_visible += '<option value="'+value.id+'">'+indentation+value.title+'</option>';
//html_active_visible += '<option value="'+value.id+'"'+disabled_active_visible+'>'+indentation+value.title+'</option>';
html_active_visible += '<option value="'+value.id+'"'+disabled_active_visible+'>'+indentation+value.title+'</option>';
});
// append new list
$("#categorie, #edit_categorie, #new_rep_groupe, #edit_folder_folder, #delete_rep_groupe").find('option').remove().end().append(html_visible);
$("#move_folder_id, #copy_in_folder").find('option').remove().end().append(html_full_visible);
//$("#copy_in_folder").find('option').remove().end().append(html_active_visible);
$("#move_folder_id").find('option').remove().end().append(html_full_visible);
$("#copy_in_folder").find('option').remove().end().append(html_active_visible);
// remove ROOT option if exists
$('#edit_folder_folder option[value="0"]').remove();
Copy path View file
@@ -264,7 +264,8 @@ function(data) {
{
type : "export_to_html_format_finalize",
file : file,
file_link : file_link
file_link : file_link,
pdf_password : pdf_password,
},
function(data) {
$("#offline_information").html('<i class="fa fa-download"></i>&nbsp;'+data[0].text);
Copy path View file
@@ -532,15 +532,18 @@
</style>
</head>
<body>
<input type="hidden" id="generation_date" value="'.GibberishAES::enc(time(), $post_pdf_password).'" />
<div id="header">
'.$SETTINGS_EXT['tool_name'].' - Off Line mode
</div>
<div style="margin:10px; font-size:9px;">
<i>This page was generated by <b>'.$_SESSION['name'].' '.$_SESSION['lastname'].'</b>, the '.date("Y/m/d H:i:s").'.</i>
<span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span>
</div>
<div id="information"></div>
<div style="margin:10px;">
Enter the decryption key : <input type="password" id="saltkey" />
Enter the decryption key : <input type="password" id="saltkey" onchange="uncryptTable()" />
&nbsp;<button onclic="uncryptTable()">Refresh</button>
</div>
<div>
<table id="itemsTable">
@@ -550,7 +553,8 @@
<th style="width:30%;">'.$LANG['description'].'</th>
<th style="width:5%;">'.$LANG['user_login'].'</th>
<th style="width:20%;">'.$LANG['url'].'</th>
</tr></thead>'
</tr></thead>
<tbody id="itemsTable_tbody">'
);
fclose($outstream);
@@ -624,7 +628,7 @@
}
//save in export file
$outstream = fopen($post_file, "a");
$outstream = fopen($post_file.'.txt', "a");
$lineType = "line1";
$idTree = "";
@@ -693,21 +697,79 @@
case "export_to_html_format_finalize":
// Load includes
include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
// read the content of the temporary file
$handle = fopen($post_file.'.txt', "r");
$contents = fread($handle, filesize($post_file.'.txt'));
fclose($handle);
if (is_file($post_file.'.txt')) {
unlink($post_file.'.txt');
}
// Encrypt its content
$contents = GibberishAES::enc($contents, $post_pdf_password);
// open file
$outstream = fopen($post_file, "a");
fputs(
$outstream,
'
'</tbody>
</table></div>
<input type="button" value="Hide all" onclick="hideAll()" />
<div id="footer" style="text-align:center;">
<a href="http://teampass.net/about/" target="_blank" style="">'.$SETTINGS_EXT['tool_name'].'&nbsp;'.$SETTINGS_EXT['version'].'&nbsp;'.$SETTINGS_EXT['copyright'].'</a>
</div>
<div id="enc_html" style="display:none;">'.$contents.'</div>
</body>
</html>
<script type="text/javascript">
function uncryptTable()
{
// uncrypt file generation date
try {
var file_date = decryptedTable = GibberishAES.dec(
document.getElementById("generation_date").value,
document.getElementById("saltkey").value
);
}
catch(e) {
console.info("Key not corrected");
document.getElementById("itemsTable_tbody").innerHTML = "";
document.getElementById("itemsTable").style.display = "none";
document.getElementById("info_page").innerHTML = "ERROR - " + e;
return false;
}
// Check date
if (~~(Date.now()/ 1000) - parseInt(file_date) < 604800) {
console.info("File is valid");
document.getElementById("info_page").innerHTML = "";
// Uncrypt the table
try {
var decryptedTable = GibberishAES.dec(
document.getElementById("enc_html").innerHTML,
document.getElementById("saltkey").value
);
}
catch(e) {
console.info("Key not corrected");
document.getElementById("itemsTable_tbody").innerHTML = "";
document.getElementById("itemsTable").style.display = "none";
document.getElementById("info_page").innerHTML = "ERROR - " + e;
return false;
}
document.getElementById("itemsTable_tbody").innerHTML = decryptedTable;
document.getElementById("itemsTable").style.display = "block";
} else {
document.getElementById("info_page").innerHTML = "This file is too old. It cannot be shown anymore!";
console.info("File is NOT valid any more!");
document.getElementById("itemsTable").style.display = "none";
}
}
function decryptme(id, string)
{
if (document.getElementById("saltkey").value != "") {
Copy path View file
@@ -3950,8 +3950,8 @@
// Is this folder an active folders? (where user can do something)
$is_visible_active = 0;
if (isset($_SESSION['list_restricted_folders_for_items']) === true
&& in_array($folder->id, $_SESSION['list_restricted_folders_for_items']) === true) {
if (isset($_SESSION['read_only_folders']) === true
&& in_array($folder->id, $_SESSION['read_only_folders']) === true) {
$is_visible_active = 1;
}
$arr_data['folders'][$inc]['is_visible_active'] = $is_visible_active;
ProTip! Use n and p to navigate between commits in a pull request.