From f4fe71a7fec4baffd2cda9908f5a9b3eaff011c4 Mon Sep 17 00:00:00 2001 From: bafbes Date: Sat, 18 Apr 2015 20:59:00 +0100 Subject: [PATCH 1/8] Update filefunc.inc.php --- htdocs/filefunc.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 48d662774ae..13b2d8d1669 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -8,6 +8,7 @@ * Copyright (C) 2005 Simon Tosser * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2015 Bahfir Abbes * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 92494cd1ec8f7c632fca4deba0ada39c46a6d83a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 18 Apr 2015 22:09:19 +0200 Subject: [PATCH 2/8] fix : #2640 --- htdocs/install/pgsql/functions/functions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 3bf5255a5fc..37d5630fbea 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -119,7 +119,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EX CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printer_ipp FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE OR REPLACE FUNCTION update_modified_column_date_m() RETURNS TRIGGER AS $$ BEGIN NEW.date_m = now(); RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_m(); From a8f60a5c183788d3921b309d707be59b4742e840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 18 Apr 2015 22:11:11 +0200 Subject: [PATCH 3/8] Revert "Sanitize for security." This reverts commit 1598a5d3a6a27ce44d7d8d73583d07c96776fe5d. --- htdocs/filefunc.inc.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 07ae3919f57..48d662774ae 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -66,15 +66,12 @@ $conffiletoshow = "htdocs/conf/conf.php"; //$conffile = "/etc/dolibarr/conf.php"; //$conffiletoshow = "/etc/dolibarr/conf.php"; -// Replace conf filename with "conf" parameter on url by GET -if (GETPOST('conf')) -{ - setcookie('dolconf', GETPOST('conf'),0,'/'); - $conffile = 'conf/' . dol_sanitizeFileName(GETPOST('conf')) . '.php'; -} -else -{ - $conffile = 'conf/' . dol_sanitizeFileName((!empty($_COOKIE['dolconf']) ? $_COOKIE['dolconf'] : 'conf') . '.php'); +//replace conf filename with "conf" parameter on url by GET +if (!empty($_GET['conf'])) { + setcookie('dolconf', $_GET['conf'],0,'/'); + $conffile = 'conf/' . $_GET['conf'] . '.php'; +} else { + $conffile = 'conf/' . (!empty($_COOKIE['dolconf']) ? $_COOKIE['dolconf'] : 'conf') . '.php'; } From 7cec7879e43e03e9997e632c8b0e7459be079b48 Mon Sep 17 00:00:00 2001 From: Tommaso Basilici Date: Sat, 18 Apr 2015 22:18:46 +0200 Subject: [PATCH 4/8] issue #2584 - output on a table + search for unused strings --- dev/translation/sanity_check_en_langfiles.php | 165 +++++++++++++++++- 1 file changed, 162 insertions(+), 3 deletions(-) diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 17dab085259..b6c3bcac440 100644 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -1,5 +1,5 @@ +/* Copyright (c) 2015 Tommaso Basilici * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,8 +15,129 @@ * along with this program. If not, see . */ +echo ""; +echo ""; + +echo ""; + +echo ""; +echo "

If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used

"; +echo "

IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly

"; +echo "

Happy translating :)

"; + +// directory containing the php and lang files +$htdocs = "../../htdocs/"; // directory containing the english lang files -$workdir = "../../htdocs/langs/en_US/"; +$workdir = $htdocs."langs/en_US/"; $files = scandir($workdir); $exludefiles = array('.','..','README'); @@ -36,6 +157,7 @@ foreach ($files AS $file) { $row_array = explode('=',$row); $langstrings_3d[$path_file['basename']][$line+1]=$row_array[0]; $langstrings_full[]=$row_array[0]; + $langstrings_dist[$row_array[0]]=$row_array[0]; } } } @@ -55,6 +177,43 @@ foreach ($langstrings_3d AS $filename => $file) { echo "

Duplicate strings in lang files in $workdir

"; echo "
";
-print_r($dups);
 
+echo " ";
+echo "";
+echo "";
+foreach ($dups as $string => $pages) {
+	echo "";
+	echo "";
+	echo "";
+}
+echo "";
+echo "
StringFile and lines
$string"; + foreach ($pages AS $page => $lines ) { + echo "$page "; + foreach ($lines as $line => $nothing) { + echo "($line) "; + } + echo "
"; + } + echo "
"; + + +if ($_REQUEST['unused'] == 'true') { + + foreach ($langstrings_dist AS $value){ + $search = '\'trans("'.$value.'")\''; + $string = 'grep -R -m 1 -F --include=*.php '.$search.' '.$htdocs.'*'; + exec($string,$output); + if (empty($output)) { + $unused[$value] = true; + echo $value.'
'; + } + } + + echo "

Strings in en_US that are never used

"; + echo "
";
+	print_r($unused);
+}
+echo "";
+echo "";
 ?>
\ No newline at end of file

From 38cfbe48977a0a08a1f27b85605fa5a349cd5bd1 Mon Sep 17 00:00:00 2001
From: Tommaso Basilici 
Date: Sat, 18 Apr 2015 22:37:23 +0200
Subject: [PATCH 5/8] issue #2584 - added a counter

---
 dev/translation/sanity_check_en_langfiles.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php
index b6c3bcac440..b1ccca39dee 100644
--- a/dev/translation/sanity_check_en_langfiles.php
+++ b/dev/translation/sanity_check_en_langfiles.php
@@ -175,14 +175,17 @@ foreach ($langstrings_3d AS $filename => $file) {
 	}
 }
 
-echo "

Duplicate strings in lang files in $workdir

"; +echo "

Duplicate strings in lang files in $workdir - ".count($dups)." found

"; echo "
";
 
 echo " ";
-echo "";
+echo "";
 echo "";
+$count = 0;
 foreach ($dups as $string => $pages) {
+	$count++;
 	echo "";
+	echo "";
 	echo "";
 	echo "
StringFile and lines
#StringFile and lines
$count$string"; foreach ($pages AS $page => $lines ) { From 2a8cf5f8be9c4d54e651a363a8bddd833e123c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 18 Apr 2015 22:50:40 +0200 Subject: [PATCH 6/8] Fixed problem with last PR #2654 --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index e697b370504..947d80af51c 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -536,4 +536,4 @@ CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product ( -- Feature request: A page to merge two thirdparties into one #2613 ALTER TABLE llx_categorie_societe CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL; ALTER TABLE llx_societe CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL; - +ALTER TABLE llx_user CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL; From f2018b7946426a5a0f298bc9f2879e116e712033 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 18 Apr 2015 22:59:20 +0200 Subject: [PATCH 7/8] fix bug #2652 --- htdocs/comm/askpricesupplier/card.php | 2 +- htdocs/comm/propal.php | 2 +- htdocs/compta/facture.php | 2 +- htdocs/compta/facture/mergepdftool.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/fichinter/card.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/install/mysql/tables/llx_user.sql | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index 3e6abe98b2d..b87a579b0e8 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -1730,7 +1730,7 @@ if ($action == 'create') /* * Action presend */ - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if ($action == 'presend') diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e6876637dcf..c5cd570c241 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2308,7 +2308,7 @@ if ($action == 'create') * Action presend */ //Select mail models is same action as presend - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if ($action == 'presend') diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 01df11a61ab..3cf9456fbe7 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3734,7 +3734,7 @@ if ($action == 'create') print '
'; //Select mail models is same action as presend - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if ($action != 'prerelance' && $action != 'presend') diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index efe16af1fb9..3f3315fda04 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -530,7 +530,7 @@ if ($resql) print '
'; - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if (! empty($mode) && $action == 'presend') diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c937d5a3621..879b66ebb39 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1514,7 +1514,7 @@ else if ($id || $ref) * Action presend */ //Select mail models is same action as presend - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if ($action == 'presend') diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index d1fb92a33ab..b0f0e2695ec 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1732,7 +1732,7 @@ else if ($id > 0 || ! empty($ref)) /* * Action presend */ - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if ($action == 'presend') diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index fd6c076ecf7..fe6751c28f2 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2246,7 +2246,7 @@ elseif (! empty($object->id)) /* * Action presend */ - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if ($action == 'presend') diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 45f300c8a89..4c401c2c540 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2499,7 +2499,7 @@ else /* * Show mail form */ - if (!empty(GETPOST('modelselected'))) { + if (GETPOST('modelselected')) { $action = 'presend'; } if ($action == 'presend') diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 20b876b6f37..90af79c4385 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -52,7 +52,7 @@ create table llx_user admin smallint DEFAULT 0, module_comm smallint DEFAULT 1, module_compta smallint DEFAULT 1, - fk_soc integer, + fk_soc integer, fk_socpeople integer, fk_member integer, fk_user integer, -- Hierarchic parent From 11e1d0310c588e42edc0dcd3c86fab8aefbb1e27 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 18 Apr 2015 23:00:22 +0200 Subject: [PATCH 8/8] typo --- htdocs/install/mysql/tables/llx_user.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 90af79c4385..a4c04f4e864 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -52,7 +52,7 @@ create table llx_user admin smallint DEFAULT 0, module_comm smallint DEFAULT 1, module_compta smallint DEFAULT 1, - fk_soc integer, + fk_soc integer, fk_socpeople integer, fk_member integer, fk_user integer, -- Hierarchic parent