*
* This program is free software; you can redistribute it and/or modify
@@ -26,59 +26,71 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
-$what=$_REQUEST["what"];
-$export_type=$_REQUEST["export_type"];
-$file=isset($_POST['filename_template']) ? $_POST['filename_template'] : '';
-
$langs->load("admin");
-if (! $user->admin) accessforbidden();
+$what=GETPOST("what");
+$export_type=GETPOST("export_type");
+$file=GETPOST('filename_template');
+$sortfield = GETPOST("sortfield");
+$sortorder = GETPOST("sortorder");
+$page = GETPOST("page");
+if (! $sortorder) $sortorder="DESC";
+if (! $sortfield) $sortfield="date";
+if ($page < 0) { $page = 0; }
+$limit = $conf->liste_limit;
+$offset = $limit * $page;
+
+if (! $user->admin) accessforbidden();
if ($file && ! $what)
{
//print DOL_URL_ROOT.'/dolibarr_export.php';
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired",$langs->transnoentities("ExportMethod"))));
- /*
- print ''.$langs->trans("ErrorFieldRequired",$langs->trans("ExportMethod")).'
';
- print '
';
- */
exit;
}
+/*
+ * Actions
+ */
+
+// None
+
/*
* View
-*/
-
-$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
-llxHeader('','',$help_url);
-
-$form=new Form($db);
-$formfile = new FormFile($db);
-
-print_fiche_titre($langs->trans("Backup"),'','setup');
+ */
+// Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit=600;
-if (!empty($ExecTimeLimit)) {
- // Cette page peut etre longue. On augmente le delai autorise.
- // Ne fonctionne que si on est pas en safe_mode.
+if (!empty($ExecTimeLimit))
+{
$err=error_reporting();
error_reporting(0); // Disable all errors
//error_reporting(E_ALL);
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
error_reporting($err);
}
-if (!empty($MemoryLimit)) {
+if (!empty($MemoryLimit))
+{
@ini_set('memory_limit', $MemoryLimit);
}
+$form=new Form($db);
+$formfile = new FormFile($db);
+
+$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
+llxHeader('','',$help_url);
+
+print_fiche_titre($langs->trans("Backup"),'','setup');
+
+
// Start with empty buffer
$dump_buffer = '';
$dump_buffer_len = 0;
-// We send fake headers to avoid browser timeout when buffering
+// We will send fake headers to avoid browser timeout when buffering
$time_start = time();
@@ -132,8 +144,9 @@ if ($what == 'mysql')
}
else
{
- $param.=" -d";
+ $param.=" -d"; // No row information (no data)
}
+ $param.=" --default-character-set=utf8"; // We always save output into utf8 charset
$paramcrypted=$param;
$paramclear=$param;
if (! empty($dolibarr_main_db_pass))
@@ -333,7 +346,8 @@ if ($what)
}
}
-$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
+$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
+$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'',1,0,'',0,$langs->trans("PreviousDumpFiles"));
if ($result == 0)
{
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 851fa959541..eb047e0b0a0 100755
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -57,9 +57,9 @@ $page = GETPOST("page");
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.name";
-if ($page < 0) { $page = 0 ; }
+if ($page < 0) { $page = 0; }
$limit = $conf->liste_limit;
-$offset = $limit * $page ;
+$offset = $limit * $page;
$langs->load("companies");
$titre=$langs->trans("ListOfContacts");
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 8dabb714504..52287a01dc2 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -171,10 +171,10 @@ class FormFile
* @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete)
* @param string $filedir Directory to scan
* @param string $urlsource Url of origin page (for return)
- * @param int $genallowed Generation is allowed (1/0 or array of formats)
+ * @param int $genallowed Generation is allowed (1/0 or array list of templates)
* @param int $delallowed Remove is allowed (1/0)
* @param string $modelselected Model to preselect by default
- * @param string $allowgenifempty Show warning if no model activated
+ * @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning)
* @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* @param int $iconPDF Show only PDF icon with link (1/0)
* @param int $maxfilenamelength Max length for filename shown
@@ -536,18 +536,19 @@ class FormFile
* @param string $relativepath Relative path of docs (autodefined if not provided)
* @param int $permtodelete Permission to delete
* @param int $useinecm Change output for use in ecm module
- * @param string $textifempty Text to show if filearray is empty
+ * @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
* @param int $maxlength Maximum length of file name shown
+ * @param string $title Title before list
* @return int <0 if KO, nb of files shown if OK
*/
- function list_of_documents($filearray,$object,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0)
+ function list_of_documents($filearray,$object,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='')
{
global $user, $conf, $langs;
global $bc;
global $sortfield, $sortorder, $maxheightmini;
// Show list of existing files
- if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
+ if (empty($useinecm)) print_titre($title?$title:$langs->trans("AttachedFiles"));
//else { $bc[true]=''; $bc[false]=''; };
$url=$_SERVER["PHP_SELF"];
print '';
@@ -614,7 +615,8 @@ class FormFile
print '';
}
print "
";
- // Fin de zone
+
+ return $nboffiles;
}