Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
5a21d904
Commit
5a21d904
authored
14 years ago
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: add function to encrypt/decrypt in sql files
parent
5b44e2c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/install/mysql/migration/3.0.0-3.1.0.sql
+4
-4
4 additions, 4 deletions
htdocs/install/mysql/migration/3.0.0-3.1.0.sql
htdocs/install/upgrade.php
+6
-0
6 additions, 0 deletions
htdocs/install/upgrade.php
htdocs/lib/admin.lib.php
+26
-0
26 additions, 0 deletions
htdocs/lib/admin.lib.php
with
36 additions
and
4 deletions
htdocs/install/mysql/migration/3.0.0-3.1.0.sql
+
4
−
4
View file @
5a21d904
...
...
@@ -27,10 +27,10 @@ ALTER TABLE llx_propal MODIFY model_pdf varchar(255);
-- Delete old constants
DELETE
FROM
llx_const
WHERE
name
=
'MAIN_MENU_BARRETOP'
;
DELETE
FROM
llx_const
WHERE
name
=
'MAIN_MENUFRONT_BARRETOP'
;
DELETE
FROM
llx_const
WHERE
name
=
'MAIN_MENU_BARRELEFT'
;
DELETE
FROM
llx_const
WHERE
name
=
'MAIN_MENUFRONT_BARRELEFT'
;
DELETE
FROM
llx_const
WHERE
__DECRYPT
(
'name'
)
__
=
'MAIN_MENU_BARRETOP'
;
DELETE
FROM
llx_const
WHERE
__DECRYPT
(
'name'
)
__
=
'MAIN_MENUFRONT_BARRETOP'
;
DELETE
FROM
llx_const
WHERE
__DECRYPT
(
'name'
)
__
=
'MAIN_MENU_BARRELEFT'
;
DELETE
FROM
llx_const
WHERE
__DECRYPT
(
'name'
)
__
=
'MAIN_MENUFRONT_BARRELEFT'
;
ALTER
TABLE
llx_facture_fourn
ADD
COLUMN
ref_ext
varchar
(
30
)
AFTER
entity
;
ALTER
TABLE
llx_commande_fournisseur
ADD
COLUMN
ref_ext
varchar
(
30
)
AFTER
entity
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/install/upgrade.php
+
6
−
0
View file @
5a21d904
...
...
@@ -107,6 +107,12 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$conf
->
db
->
name
=
$dolibarr_main_db_name
;
$conf
->
db
->
user
=
$dolibarr_main_db_user
;
$conf
->
db
->
pass
=
$dolibarr_main_db_pass
;
// Load type and crypt key
if
(
empty
(
$dolibarr_main_db_encryption
))
$dolibarr_main_db_encryption
=
0
;
$conf
->
db
->
dolibarr_main_db_encryption
=
$dolibarr_main_db_encryption
;
if
(
empty
(
$dolibarr_main_db_cryptkey
))
$dolibarr_main_db_cryptkey
=
''
;
$conf
->
db
->
dolibarr_main_db_cryptkey
=
$dolibarr_main_db_cryptkey
;
$db
=
new
DoliDb
(
$conf
->
db
->
type
,
$conf
->
db
->
host
,
$conf
->
db
->
user
,
$conf
->
db
->
pass
,
$conf
->
db
->
name
,
$conf
->
db
->
port
);
if
(
$db
->
connected
==
1
)
...
...
This diff is collapsed.
Click to expand it.
htdocs/lib/admin.lib.php
+
26
−
0
View file @
5a21d904
...
...
@@ -218,6 +218,32 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='')
// Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes)
if
(
!
$silent
)
print
'<tr><td valign="top">'
.
$langs
->
trans
(
"Request"
)
.
' '
.
(
$i
+
1
)
.
" sql='"
.
$newsql
.
"'</td></tr>
\n
"
;
dol_syslog
(
'Admin.lib::run_sql Request '
.
(
$i
+
1
)
.
' sql='
.
$newsql
,
LOG_DEBUG
);
// Replace for encrypt data
if
(
preg_match_all
(
'/__ENCRYPT\(\'([^\,]+)\'\)__/i'
,
$newsql
,
$reg
))
{
$num
=
count
(
$reg
[
0
]);
for
(
$i
=
0
;
$i
<
$num
;
$i
++
)
{
$from
=
$reg
[
0
][
$i
];
$to
=
$db
->
encrypt
(
$reg
[
1
][
$i
],
1
);
$newsql
=
str_replace
(
$from
,
$to
,
$newsql
);
}
}
// Replace for decrypt data
if
(
preg_match_all
(
'/__DECRYPT\(\'([^\,]+)\'\)__/i'
,
$newsql
,
$reg
))
{
$num
=
count
(
$reg
[
0
]);
for
(
$i
=
0
;
$i
<
$num
;
$i
++
)
{
$from
=
$reg
[
0
][
$i
];
$to
=
$db
->
decrypt
(
$reg
[
1
][
$i
]);
$newsql
=
str_replace
(
$from
,
$to
,
$newsql
);
}
}
// Replace __x__ with rowid of insert nb x
while
(
preg_match
(
'/__([0-9]+)__/'
,
$newsql
,
$reg
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment