Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
don
Commits
c2d13c2b
Commit
c2d13c2b
authored
Oct 13, 2018
by
Guinness
Browse files
Fix path for pi-billion
# Conflicts: # app/controller/cron.php
parents
a5769117
0cbb27fc
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
app/controller/admin.php
View file @
c2d13c2b
...
@@ -57,7 +57,7 @@ class Admin extends Controller
...
@@ -57,7 +57,7 @@ class Admin extends Controller
if
(
!
$f3
->
get
(
'SESSION.admin'
))
{
if
(
!
$f3
->
get
(
'SESSION.admin'
))
{
$mapper
=
new
\
DB\SQL\Mapper
(
$f3
->
get
(
'DB'
),
'admins'
);
$mapper
=
new
\
DB\SQL\Mapper
(
$f3
->
get
(
'DB'
),
'admins'
);
$auth
=
new
\
Auth
(
$mapper
,
array
(
'id'
=>
'user_id'
,
'pw'
=>
'password'
));
$auth
=
new
\
Auth
(
$mapper
,
array
(
'id'
=>
'user_id'
,
'pw'
=>
'password'
));
$success
=
$auth
->
basic
(
'Admin::hash_password'
);
$success
=
$auth
->
basic
(
'
\Controller\
Admin::hash_password'
);
if
(
!
$success
)
{
if
(
!
$success
)
{
$f3
->
error
(
401
);
$f3
->
error
(
401
);
}
else
{
}
else
{
...
...
app/controller/bank.php
View file @
c2d13c2b
...
@@ -168,7 +168,7 @@ class Bank extends Controller
...
@@ -168,7 +168,7 @@ class Bank extends Controller
// Puis envoi du mail
// Puis envoi du mail
if
(
$user
[
"email"
])
{
if
(
$user
[
"email"
])
{
$mailer
=
new
SMTP
(
SMTP_HOST
,
SMTP_PORT
,
SMTP_SECURITY
,
SMTP_USER
,
SMTP_PW
);
$mailer
=
new
\
SMTP
(
SMTP_HOST
,
SMTP_PORT
,
SMTP_SECURITY
,
SMTP_USER
,
SMTP_PW
);
$cb_log
->
write
(
"Sending email for id: "
.
$id
.
" at "
.
$user
[
'email'
]);
$cb_log
->
write
(
"Sending email for id: "
.
$id
.
" at "
.
$user
[
'email'
]);
$mailer
->
set
(
'From'
,
"contact@laquadrature.net"
);
$mailer
->
set
(
'From'
,
"contact@laquadrature.net"
);
$mailer
->
set
(
'FromName'
,
"La Quadrature du Net"
);
$mailer
->
set
(
'FromName'
,
"La Quadrature du Net"
);
...
...
app/controller/cron.php
View file @
c2d13c2b
...
@@ -41,7 +41,7 @@ class Cron extends Controller
...
@@ -41,7 +41,7 @@ class Cron extends Controller
// We do have our IDs
// We do have our IDs
// We need to create a PDF
// We need to create a PDF
$lock
=
@
fopen
(
"tmp/piplomes.lock"
,
"ab"
);
$lock
=
@
fopen
(
"
../
tmp/piplomes.lock"
,
"ab"
);
if
(
$lock
)
{
if
(
$lock
)
{
flock
(
$lock
,
LOCK_EX
);
flock
(
$lock
,
LOCK_EX
);
foreach
(
$pdfs
as
$pdf
)
{
foreach
(
$pdfs
as
$pdf
)
{
...
@@ -64,9 +64,9 @@ class Cron extends Controller
...
@@ -64,9 +64,9 @@ class Cron extends Controller
// Let's trash the garbage
// Let's trash the garbage
foreach
(
array
(
'tex'
,
'aux'
,
'pdf'
,
'log'
)
as
$ext
)
{
foreach
(
array
(
'tex'
,
'aux'
,
'pdf'
,
'log'
)
as
$ext
)
{
@
unlink
(
dirname
(
__FILE__
)
.
"/../tmp/pplome."
.
$ext
);
@
unlink
(
dirname
(
__FILE__
)
.
"/../
../
tmp/pplome."
.
$ext
);
}
}
// We now have only fr or en templates
// We now have only fr or en templates
if
(
$pdf
[
'lang'
]
==
'fr'
)
{
if
(
$pdf
[
'lang'
]
==
'fr'
)
{
$pdf
[
'lang'
]
=
'fr_FR'
;
$pdf
[
'lang'
]
=
'fr_FR'
;
...
@@ -76,10 +76,11 @@ class Cron extends Controller
...
@@ -76,10 +76,11 @@ class Cron extends Controller
}
}
$logger
->
write
(
"Language is "
.
$pdf
[
'lang'
]
.
""
);
$logger
->
write
(
"Language is "
.
$pdf
[
'lang'
]
.
""
);
$template
=
file_get_contents
(
dirname
(
__FILE__
)
.
"/../locales/"
.
$pdf
[
'lang'
]
.
"/LC_MESSAGES/plome.tex"
);
$template
=
file_get_contents
(
dirname
(
__FILE__
)
.
"/../
../
locales/"
.
$pdf
[
'lang'
]
.
"/LC_MESSAGES/plome.tex"
);
// We will open the pi-decimals file
// We will open the pi-decimals file
$pi
=
fopen
(
dirname
(
__FILE__
)
.
"/../static/pi-billion/pi-billion.txt"
,
"rb"
);
$pi
=
fopen
(
dirname
(
__FILE__
)
.
"/../../www/static/pi-billion/pi-billion.txt"
,
"rb"
);
if
(
!
$pi
)
{
if
(
!
$pi
)
{
$logger
->
write
(
"FATAL: Can't open decimals"
);
$logger
->
write
(
"FATAL: Can't open decimals"
);
exit
();
exit
();
...
@@ -100,7 +101,7 @@ class Cron extends Controller
...
@@ -100,7 +101,7 @@ class Cron extends Controller
// Let's replace the templates with values
// Let's replace the templates with values
file_put_contents
(
file_put_contents
(
dirname
(
__FILE__
)
.
"/../tmp/pplome.tex"
,
dirname
(
__FILE__
)
.
"/../
../
tmp/pplome.tex"
,
str_replace
(
str_replace
(
"%%DECIMALES%%"
,
"%%DECIMALES%%"
,
$decimales
,
$decimales
,
...
@@ -118,13 +119,13 @@ class Cron extends Controller
...
@@ -118,13 +119,13 @@ class Cron extends Controller
// Let's create the pdf from the template
// Let's create the pdf from the template
$logger
->
write
(
"Building the pdf from the tex template"
);
$logger
->
write
(
"Building the pdf from the tex template"
);
$command
=
'TEXINPUTS='
.
dirname
(
__FILE__
)
.
'/tex/:$TEXINPUTS '
;
$command
=
'TEXINPUTS='
.
dirname
(
__FILE__
)
.
'/
../../
tex/:$TEXINPUTS '
;
// We need to set an env variable first
// We need to set an env variable first
putenv
(
'TEXINPUTS='
.
dirname
(
__FILE__
)
.
'/../tex:'
.
getenv
(
'TEXINPUTS'
));
putenv
(
'TEXINPUTS='
.
dirname
(
__FILE__
)
.
'/../
../
tex:'
.
getenv
(
'TEXINPUTS'
));
$command
.
=
'/usr/bin/pdflatex '
;
$command
.
=
'/usr/bin/pdflatex '
;
$command
.
=
'-output-directory='
.
dirname
(
__FILE__
)
.
"/../tmp "
;
$command
.
=
'-output-directory='
.
dirname
(
__FILE__
)
.
"/../
../
tmp "
;
$command
.
=
dirname
(
__FILE__
)
.
"/../tmp/pplome.tex"
;
$command
.
=
dirname
(
__FILE__
)
.
"/../
../
tmp/pplome.tex"
;
$logger
->
write
(
$command
);
$logger
->
write
(
$command
);
exec
(
$command
,
$output
,
$return
);
exec
(
$command
,
$output
,
$return
);
foreach
(
$output
as
$line
)
{
foreach
(
$output
as
$line
)
{
...
@@ -141,11 +142,11 @@ class Cron extends Controller
...
@@ -141,11 +142,11 @@ class Cron extends Controller
// Move the pdf to its position
// Move the pdf to its position
@
unlink
(
PIPLOME_PATH
.
$pdf
[
'hash'
]
.
".pdf"
);
@
unlink
(
PIPLOME_PATH
.
$pdf
[
'hash'
]
.
".pdf"
);
$logger
->
write
(
"Moving pdf to "
.
PIPLOME_PATH
.
$pdf
[
'hash'
]
.
".pdf"
);
$logger
->
write
(
"Moving pdf to "
.
PIPLOME_PATH
.
$pdf
[
'hash'
]
.
".pdf"
);
@
rename
(
dirname
(
__FILE__
)
.
"/../tmp/pplome.pdf"
,
PIPLOME_PATH
.
$pdf
[
'hash'
]
.
".pdf"
);
@
rename
(
dirname
(
__FILE__
)
.
"/../
../
tmp/pplome.pdf"
,
PIPLOME_PATH
.
$pdf
[
'hash'
]
.
".pdf"
);
// Let's trash the garbage
// Let's trash the garbage
foreach
(
array
(
'tex'
,
'aux'
,
'pdf'
,
'log'
)
as
$ext
)
{
foreach
(
array
(
'tex'
,
'aux'
,
'pdf'
,
'log'
)
as
$ext
)
{
@
unlink
(
dirname
(
__FILE__
)
.
"/../tmp/pplome."
.
$ext
);
@
unlink
(
dirname
(
__FILE__
)
.
"/../
../
tmp/pplome."
.
$ext
);
}
}
// Saving the pathin database
// Saving the pathin database
...
@@ -167,17 +168,18 @@ class Cron extends Controller
...
@@ -167,17 +168,18 @@ class Cron extends Controller
$result
=
$db
->
query
(
"SELECT dons.id as id,
$result
=
$db
->
query
(
"SELECT dons.id as id,
decimale,
decimale,
users.pseudo as nom,
users.pseudo as nom,
lang
lang,
pdf
FROM dons
FROM dons
LEFT JOIN users ON dons.user_id = users.id
LEFT JOIN users ON dons.user_id = users.id
WHERE dons.status IN (1, 4, 101)
WHERE dons.status IN (1, 4, 101)
AND dons.id='"
.
\
Utils
::
asl
(
$args
[
'id'
])
.
"'"
);
AND dons.id='"
.
\
Utils
::
asl
(
$args
[
'id'
])
.
"'"
);
$pdf
=
$result
->
fetch
(
\
PDO
::
FETCH_ASSOC
);
$pdf
=
$result
->
fetch
(
\
PDO
::
FETCH_ASSOC
);
$fp
=
fopen
(
PIPLOME_PATH
.
$pdf
[
'
hash
'
]
.
".pdf"
,
"rb"
);
$fp
=
fopen
(
PIPLOME_PATH
.
$pdf
[
'
pdf
'
]
.
".pdf"
,
"rb"
);
if
(
$fp
)
{
if
(
$fp
)
{
$fsize
=
filesize
(
PIPLOME_PATH
.
$pdf
[
'
hash
'
]
.
".pdf"
);
$fsize
=
filesize
(
PIPLOME_PATH
.
$pdf
[
'
pdf
'
]
.
".pdf"
);
header
(
"Content-Type: application/pdf"
);
header
(
"Content-Type: application/pdf"
);
header
(
"Content-Disposition: attachment; filename=
\"
"
.
$pdf
[
'
hash
'
]
.
".pdf
\"
"
);
header
(
"Content-Disposition: attachment; filename=
\"
"
.
$pdf
[
'
pdf
'
]
.
".pdf
\"
"
);
header
(
"Content-Length:
$fsize
"
);
header
(
"Content-Length:
$fsize
"
);
while
(
!
feof
(
$fp
))
{
while
(
!
feof
(
$fp
))
{
$buffer
=
fread
(
$fp
,
2048
);
$buffer
=
fread
(
$fp
,
2048
);
...
...
app/controller/perso.php
View file @
c2d13c2b
...
@@ -179,7 +179,7 @@ class Perso extends Controller
...
@@ -179,7 +179,7 @@ class Perso extends Controller
// On le renvoie par email
// On le renvoie par email
// On utilise le système SMTP de fat free
// On utilise le système SMTP de fat free
$mailer
=
new
SMTP
(
SMTP_HOST
,
SMTP_PORT
,
SMTP_SECURITY
,
SMTP_USER
,
SMTP_PW
);
$mailer
=
new
\
SMTP
(
SMTP_HOST
,
SMTP_PORT
,
SMTP_SECURITY
,
SMTP_USER
,
SMTP_PW
);
$mailer
->
set
(
'From'
,
$f3
->
get
(
'mail.from'
));
$mailer
->
set
(
'From'
,
$f3
->
get
(
'mail.from'
));
$mailer
->
set
(
'To'
,
$f3
->
get
(
'email'
));
$mailer
->
set
(
'To'
,
$f3
->
get
(
'email'
));
$mailer
->
set
(
'Subject'
,
_
(
"Renouvellement de mot de passe"
));
$mailer
->
set
(
'Subject'
,
_
(
"Renouvellement de mot de passe"
));
...
...
composer.lock
View file @
c2d13c2b
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment