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
domainepublic
alternc
Commits
9489d4f7
Commit
9489d4f7
authored
Mar 27, 2014
by
Benjamin Sonntag
Browse files
Merge branch 'master' of alternc.org:alternc
parents
566980a5
b2f5a132
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
9489d4f7
...
...
@@ -605,6 +605,7 @@ nightlybuild/READMEFIRST -text
nightlybuild/build.sh -text
nightlybuild/mchroot.sh -text
nightlybuild/nightly.key -text
phpunit/tests/_datasets/domaines.yml -text
po/alternc-admintools.pot -text
po/fr/LC_MESSAGES/.svnignore -text
po/fr/LC_MESSAGES/alternc-admintools.po -text
...
...
@@ -614,7 +615,6 @@ roundcube/class/m_roundcube.php -text
roundcube/roundcube-install -text
roundcube/roundcube_alternc_logo.png -text
roundcube/templates/apache2/roundcube.conf -text
roundcube/templates/logrotate.d/roundcube-core -text
roundcube/templates/roundcube/main.inc.php -text
roundcube/templates/roundcube/plugins/managesieve/config.inc.php -text
roundcube/templates/roundcube/plugins/password/config.inc.php -text
...
...
@@ -663,6 +663,7 @@ src/quota-warning.sh -text
src/quota_delete -text
src/quota_edit -text
src/quota_get -text
src/quota_get_all -text
src/quota_init -text
src/rebuild_all_webconf.sh -text
src/sendmail -text
...
...
bureau/admin/adm_dodel.php
View file @
9489d4f7
...
...
@@ -35,24 +35,18 @@ if (!$admin->enabled) {
}
$fields
=
array
(
"
d
"
=>
array
(
"request"
,
"array"
,
array
()),
"
accountList
"
=>
array
(
"request"
,
"array"
,
array
()),
"del_confirm"
=>
array
(
"request"
,
"string"
,
""
),
);
getFields
(
$fields
);
if
(
$del_confirm
==
"y"
){
if
(
!
is_array
(
$accountList
))
{
$accountList
[]
=
$accountList
;
}
reset
(
$accountList
);
while
(
list
(
$key
,
$val
)
=
each
(
$accountList
))
{
$error
=
""
;
foreach
(
$accountList
as
$key
=>
$val
)
{
if
(
!
$admin
->
checkcreator
(
$val
))
{
__
(
"This page is restricted to authorized staff"
);
exit
();
}
$error
=
""
;
if
(
!
(
$u
=
$admin
->
get
(
$val
))
||
!
$admin
->
del_mem
(
$val
))
{
$error
.
=
sprintf
(
_
(
"Member '%s' does not exist"
),
$val
)
.
"<br />"
;
}
else
{
...
...
@@ -77,12 +71,14 @@ if($del_confirm == "y"){
<input
type=
"hidden"
name=
"del_confirm"
value=
"y"
/>
<p
class=
"alert alert-warning"
>
<?php
__
(
"WARNING : Confirm the deletion of the users"
);
?>
</p>
<p>
<?php
foreach
(
$accountList
as
$userid
){
$membre
=
$admin
->
get
(
$userid
);
echo
"<input type=
\"
hidden
\"
name=
\"
d[]
\"
value=
\"
$userid
\"
/>"
.
$membre
[
'login'
]
.
"<br/>"
;
}
?>
<ul>
<?php
foreach
(
$accountList
as
$userid
){
$membre
=
$admin
->
get
(
$userid
);
echo
"<li><input type=
\"
hidden
\"
name=
\"
accountList[]
\"
value=
\"
$userid
\"
/>"
.
$membre
[
'login'
]
.
"</li>"
;
}
?>
</ul>
</p>
<blockquote>
<input
type=
"submit"
class=
"inb ok"
name=
"confirm"
value=
"
<?php
__
(
"Yes, delete those accounts"
);
?>
"
/>
...
...
bureau/admin/adm_list.php
View file @
9489d4f7
...
...
@@ -174,7 +174,7 @@ if (!is_array($accountList) || empty($accountList)) {
<?php
if
(
$val
[
"su"
])
{
?>
<td
id=
"user_
<?php
echo
$val
[
"uid"
];
?>
"
>
</td>
<?php
}
else
{
?>
<td><input
type=
"checkbox"
class=
"inc"
name=
"
d
[]"
id=
"user_
<?php
echo
$val
[
"uid"
];
?>
"
value=
"
<?php
echo
$val
[
"uid"
];
?>
"
/></td>
<td><input
type=
"checkbox"
class=
"inc"
name=
"
accountList
[]"
id=
"user_
<?php
echo
$val
[
"uid"
];
?>
"
value=
"
<?php
echo
$val
[
"uid"
];
?>
"
/></td>
<?php
}
// val['su'] ?>
<
td
<?
php
if
(
$val
[
"su"
])
echo
'style="color: red"'
;
?>
>
<label
for=
"user_
<?php
echo
$val
[
"uid"
];
?>
"
><b>
<?php
echo
$val
[
"login"
]
?>
</b></label></td>
<td><a
title=
"
<?php
__
(
"Send an email"
);
?>
"
href=
"mailto:
<?php
echo
$val
[
"mail"
];
?>
"
>
<?php
echo
$val
[
"nom"
]
.
" "
.
$val
[
"prenom"
]
?>
</a>
</td>
...
...
@@ -250,7 +250,7 @@ if ($mem->user["admlist"] == 1) { // SHORT MODE
if
(
$val
[
"su"
])
{
echo
'<td> </td>'
;
}
else
{
echo
'<td align="center"><input type="checkbox" class="inc" name="
d
[]" value="'
.
$val
[
"uid"
]
.
'" id="id_c_'
.
$val
[
"uid"
]
.
'" /></td>'
;
echo
'<td align="center"><input type="checkbox" class="inc" name="
accountList
[]" value="'
.
$val
[
"uid"
]
.
'" id="id_c_'
.
$val
[
"uid"
]
.
'" /></td>'
;
}
// if $val["su"]
?>
<td
align=
"center"
>
...
...
bureau/admin/adm_mxaccount.php
View file @
9489d4f7
...
...
@@ -51,7 +51,7 @@ if ($newlogin) {
// Add an account
if
(
$mail
->
add_slave_account
(
$newlogin
,
$newpass
))
{
$error
=
_
(
"The requested account address has been created. It is now allowed."
);
$newlogin
=
false
;
$newpass
=
false
;
$newlogin
=
''
;
$newpass
=
''
;
}
}
...
...
bureau/admin/adm_var_edit.php
View file @
9489d4f7
...
...
@@ -138,7 +138,7 @@ function var_input($infotype, $name, $value='') {
break
;
case
"boolean"
:
echo
"<input type='hidden' name='
$name
' value='0' />"
;
// This way, there is allways something send, even if checkbox is unchecked
echo
"<input type='checkbox' id='add_
$id
' name='
$name
' value='1' "
;
cbox
(
$value
);
echo
" />"
;
echo
"<input type='checkbox' id='add_
$id
' name='
$name
' value='1' "
;
cbox
(
(
bool
)
$value
);
echo
" />"
;
break
;
default
:
echo
"WTF ? Dunno what to do with a "
.
$infotype
[
'type'
];
...
...
@@ -251,7 +251,7 @@ foreach ( $variables->strata_order as $strata) {
foreach
(
$allvars
[
'FQDN_CREATOR'
]
as
$ttk
=>
$ttv
)
{
if
(
isset
(
$ttv
[
$var
])
&&
is_array
(
$ttv
[
$var
]))
{
echo
sprintf
(
_
(
"Overwritted by %s"
),
$members
[
$ttk
][
'login'
])
.
" → "
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
echo
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
edit_var
(
$ttv
[
$var
]);
}
echo
"<br/>"
;
...
...
@@ -267,7 +267,7 @@ foreach ( $variables->strata_order as $strata) {
foreach
(
$allvars
[
'FQDN'
]
as
$ttk
=>
$ttv
)
{
if
(
isset
(
$ttv
[
$var
])
&&
is_array
(
$ttv
[
$var
]))
{
echo
sprintf
(
_
(
"Overwritted by %s"
),
$panel_url
[
$ttk
])
.
" → "
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
echo
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
edit_var
(
$ttv
[
$var
]);
}
echo
"<br/>"
;
...
...
@@ -283,7 +283,7 @@ foreach ( $variables->strata_order as $strata) {
foreach
(
$allvars
[
'CREATOR'
]
as
$ttk
=>
$ttv
)
{
if
(
isset
(
$ttv
[
$var
])
&&
is_array
(
$ttv
[
$var
]))
{
echo
sprintf
(
_
(
"Overwritted by %s"
),
$members
[
$ttk
][
'login'
])
.
" → "
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
echo
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
edit_var
(
$ttv
[
$var
]);
}
echo
"<br/>"
;
...
...
@@ -299,7 +299,7 @@ foreach ( $variables->strata_order as $strata) {
foreach
(
$allvars
[
'MEMBER'
]
as
$ttk
=>
$ttv
)
{
if
(
isset
(
$ttv
[
$var
])
&&
is_array
(
$ttv
[
$var
]))
{
echo
sprintf
(
_
(
"Overwritted by %s"
),
$members
[
$ttk
][
'login'
])
.
" → "
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
echo
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
echo
"<a href='javascript:edit_var("
.
$ttv
[
$var
][
'id'
]
.
");'>"
;
$variables
->
display_valueraw_html
(
$ttv
[
$var
][
'value'
],
$var
);
echo
"</a>"
;
edit_var
(
$ttv
[
$var
]);
}
echo
"<br/>"
;
...
...
bureau/admin/adm_variables.php
View file @
9489d4f7
...
...
@@ -92,7 +92,7 @@ echo _("See the vars for the account")." ";
echo
"<select name='member_id'>"
;
eoption
(
$ml
,
$member_id
);
echo
"</select>"
;
echo
" "
.
_
(
"logged via"
)
.
" "
;
echo
"<select name='fqdn_id'>"
;
eoption
(
$dom
->
get_panel_url_list
(),
$fqdn_id
);
echo
"</select> "
;
echo
"<input type='submit' class='ina' value=
\"
"
;
echo
ehe
(
_
(
"View"
));
echo
"
\"
/>"
;
echo
"<input type='submit' class='ina' value=
\"
"
;
ehe
(
_
(
"View"
));
echo
"
\"
/>"
;
?>
</form>
...
...
bureau/admin/head.php
View file @
9489d4f7
...
...
@@ -37,14 +37,17 @@ if (!isset($charset) || ! $charset) $charset="UTF-8";
if
(
file_exists
(
"styles/style-custom.css"
)
)
{
echo
'<link rel="stylesheet" href="styles/style-custom.css" type="text/css" />'
;
}
$favicon
=
variable_get
(
'favicon'
,
'favicon.ico'
,
'You can specify a favicon, for example /images/my_logo.ico'
,
array
(
array
(
'desc'
=>
'URL'
,
'type'
=>
'string'
)));
?>
<link
rel=
"stylesheet"
href=
"styles/style-empty.css"
type=
"text/css"
title=
"Default - Desktop TNG"
/>
<link
rel=
"alternate stylesheet"
href=
"styles/style-bluedesktop10.css"
type=
"text/css"
title=
"Blue Desktop 1.0"
/>
<link
rel=
"alternate stylesheet"
href=
"styles/style-hw.css"
type=
"text/css"
title=
"Halloween"
/>
<link
rel=
"Shortcut Icon"
href=
"favicon
.ico
"
type=
"image/ico"
/>
<link
rel=
"icon"
href=
"favicon
.ico
"
type=
"image/ico"
/>
<link
rel=
"Shortcut Icon"
href=
"
<?php
echo
$
favicon
;
?>
"
type=
"image/ico"
/>
<link
rel=
"icon"
href=
"
<?php
echo
$
favicon
;
?>
"
type=
"image/ico"
/>
<script
src=
"js/alternc.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.min_embedded.js"
type=
"text/javascript"
></script>
...
...
bureau/admin/hta_del.php
View file @
9489d4f7
...
...
@@ -35,11 +35,12 @@ reset($_POST);
while
(
list
(
$key
,
$val
)
=
each
(
$_POST
))
{
if
(
substr
(
$key
,
0
,
4
)
==
"del_"
)
{
// Effacement du dossier $val
$r
=
$hta
->
DelDir
(
$val
);
if
(
!
$r
)
{
$error
.
=
$err
->
errstr
()
.
"<br />"
;
// $r=$hta->DelDir($val);
$return
=
$hta
->
DelDir
(
$val
);
if
(
!
$return
)
{
$error
.
=
$err
->
errstr
()
.
"<br />"
;
}
else
{
$error
.
=
sprintf
(
_
(
"The protected folder %s has been successfully unprotected"
),
$val
)
.
"<br />"
;
$error
.
=
sprintf
(
_
(
"The protected folder %s has been successfully unprotected"
),
$val
)
.
"<br />"
;
}
}
}
...
...
bureau/class/class_system_bind.php
View file @
9489d4f7
...
...
@@ -143,7 +143,7 @@ class system_bind {
*
* @global m_dom $dom
* @param string $domain
* @return
string
* @return
array
*/
function
get_domain_summary
(
$domain
=
false
)
{
global
$dom
;
...
...
bureau/class/functions.php
View file @
9489d4f7
...
...
@@ -44,7 +44,7 @@ function fl($str) { return str_replace("<","<",str_replace("\"",""",$str
* @param struing $type
* @return mixed
*/
function
variable_get
(
$name
,
$default
=
null
,
$createit_comment
=
null
,
$type
=
null
)
{
function
variable_get
(
$name
,
$default
=
null
,
$createit_comment
=
null
,
$type
=
null
)
{
global
$variables
;
return
$variables
->
variable_get
(
$name
,
$default
,
$createit_comment
,
$type
);
}
...
...
@@ -66,16 +66,16 @@ function variable_get($name, $default = null, $createit_comment = null, $type=nu
*/
function
checkhostallow
(
$domain
,
$dns
)
{
global
$L_NS1
,
$L_NS2
,
$db
,
$dom
;
$sizefound
=
0
;
$found
=
""
;
$sizefound
=
0
;
$found
=
""
;
$db
->
query
(
"SELECT tld,mode FROM tld;"
);
while
(
$db
->
next_record
())
{
list
(
$key
,
$val
)
=
$db
->
Record
;
list
(
$key
,
$val
)
=
$db
->
Record
;
if
(
substr
(
$domain
,
-
1
-
strlen
(
$key
))
==
"."
.
$key
)
{
if
(
$sizefound
<
strlen
(
$key
))
{
$sizefound
=
strlen
(
$key
);
$found
=
$key
;
$fmode
=
$val
;
$sizefound
=
strlen
(
$key
);
$found
=
$key
;
$fmode
=
$val
;
}
}
}
...
...
@@ -88,10 +88,10 @@ function checkhostallow($domain,$dns) {
return
-
2
;
if
(
$fmode
>
2
)
// OK, in the case 3 4 5
return
$found
;
$n1
=
false
;
$n2
=
false
;
for
(
$i
=
0
;
$i
<
count
(
$dns
);
$i
++
)
{
if
(
strtolower
(
$dns
[
$i
])
==
strtolower
(
$L_NS1
))
$n1
=
true
;
if
(
strtolower
(
$dns
[
$i
])
==
strtolower
(
$L_NS2
))
$n2
=
true
;
$n1
=
false
;
$n2
=
false
;
for
(
$i
=
0
;
$i
<
count
(
$dns
);
$i
++
)
{
if
(
strtolower
(
$dns
[
$i
])
==
strtolower
(
$L_NS1
))
$n1
=
true
;
if
(
strtolower
(
$dns
[
$i
])
==
strtolower
(
$L_NS2
))
$n2
=
true
;
}
if
(
$fmode
==
1
&&
$n1
)
// OK
return
$found
;
...
...
@@ -109,16 +109,16 @@ function checkhostallow($domain,$dns) {
*/
function
checkhostallow_nodns
(
$domain
)
{
global
$db
;
$sizefound
=
0
;
$found
=
""
;
$sizefound
=
0
;
$found
=
""
;
$db
->
query
(
"SELECT tld,mode FROM tld;"
);
while
(
$db
->
next_record
())
{
list
(
$key
,
$val
)
=
$db
->
Record
;
list
(
$key
,
$val
)
=
$db
->
Record
;
if
(
substr
(
$domain
,
-
1
-
strlen
(
$key
))
==
"."
.
$key
)
{
if
(
$sizefound
<
strlen
(
$key
))
{
$sizefound
=
strlen
(
$key
);
$found
=
$key
;
$fmode
=
$val
;
$sizefound
=
strlen
(
$key
);
$found
=
$key
;
$fmode
=
$val
;
}
}
}
...
...
@@ -149,12 +149,12 @@ function get_remote_ip() {
function
checkurl
(
$url
)
{
// TODO : add a path/file check
if
(
substr
(
$url
,
0
,
7
)
!=
"http://"
&&
substr
(
$url
,
0
,
8
)
!=
"https://"
&&
substr
(
$url
,
0
,
6
)
!=
"ftp://"
)
return
false
;
if
(
substr
(
$url
,
0
,
7
)
==
"http://"
)
$fq
=
substr
(
$url
,
7
);
if
(
substr
(
$url
,
0
,
8
)
==
"https://"
)
$fq
=
substr
(
$url
,
8
);
if
(
substr
(
$url
,
0
,
6
)
==
"ftp://"
)
$fq
=
substr
(
$url
,
6
);
$f
=
explode
(
"/"
,
$fq
);
if
(
!
is_array
(
$f
))
$f
=
array
(
$f
);
$t
=
checkfqdn
(
$f
[
0
]);
if
(
substr
(
$url
,
0
,
7
)
==
"http://"
)
$fq
=
substr
(
$url
,
7
);
if
(
substr
(
$url
,
0
,
8
)
==
"https://"
)
$fq
=
substr
(
$url
,
8
);
if
(
substr
(
$url
,
0
,
6
)
==
"ftp://"
)
$fq
=
substr
(
$url
,
6
);
$f
=
explode
(
"/"
,
$fq
);
if
(
!
is_array
(
$f
))
$f
=
array
(
$f
);
$t
=
checkfqdn
(
$f
[
0
]);
if
(
$t
)
return
false
;
return
true
;
}
...
...
@@ -235,8 +235,8 @@ function checkfqdn($fqdn) {
// 4. Le fqdn ne fait qu'un seul membre (il n'est donc pas fq...)
if
(
strlen
(
$fqdn
)
>
255
)
return
1
;
$members
=
explode
(
"."
,
$fqdn
);
if
(
count
(
$members
)
>
1
)
$ret
=
0
;
else
$ret
=
4
;
$members
=
explode
(
"."
,
$fqdn
);
if
(
count
(
$members
)
>
1
)
$ret
=
0
;
else
$ret
=
4
;
reset
(
$members
);
while
(
list
(
$key
,
$val
)
=
each
(
$members
))
{
if
(
strlen
(
$val
)
>
63
)
...
...
@@ -262,10 +262,10 @@ function checkfqdn($fqdn) {
*/
function
checkuserpath
(
$path
)
{
global
$mem
;
$user
=
$mem
->
user
[
"login"
];
$usar
=
substr
(
$user
,
0
,
1
);
$user
=
$mem
->
user
[
"login"
];
$usar
=
substr
(
$user
,
0
,
1
);
if
(
substr
(
$path
,
0
,
1
)
!=
"/"
)
$path
=
"/"
.
$path
;
$path
=
"/"
.
$path
;
$rpath
=
realpath
(
ALTERNC_HTML
.
"/
$usar
/
$user$path
"
);
if
(
!
$rpath
)
{
// if file or directory does not exist
...
...
@@ -310,7 +310,7 @@ function cbox($test, $echo = TRUE) {
if
(
$test
)
{
$return
=
" checked=
\"
checked
\"
"
;
}
else
{
$return
=
''
;
$return
=
''
;
}
if
(
$echo
){
echo
$return
;
...
...
@@ -331,7 +331,7 @@ function selected($bool, $echo = TRUE) {
if
(
$bool
)
{
$return
=
" selected=
\"
selected
\"
"
;
}
else
{
$return
=
''
;
$return
=
''
;
}
if
(
$echo
){
echo
$return
;
...
...
@@ -347,7 +347,7 @@ function selected($bool, $echo = TRUE) {
* @param integer $affiche
* @return string
*/
function
ecif
(
$test
,
$tr
,
$fa
=
""
,
$affiche
=
1
)
{
function
ecif
(
$test
,
$tr
,
$fa
=
""
,
$affiche
=
1
)
{
if
(
$test
){
$retour
=
$tr
;
}
...
...
@@ -375,7 +375,7 @@ function __($str) {
* @param string $fa
* @return string
*/
function
ife
(
$test
,
$tr
,
$fa
=
""
)
{
function
ife
(
$test
,
$tr
,
$fa
=
""
)
{
if
(
$test
){
return
$tr
;
}
...
...
@@ -388,33 +388,33 @@ function ife($test,$tr,$fa="") {
* @param integer $html
* @return string
*/
function
format_size
(
$size
,
$html
=
0
)
{
function
format_size
(
$size
,
$html
=
0
)
{
// Retourne une taille formatt�e en Octets, Kilo-octets, M�ga-octets ou Giga-Octets, avec 2 d�cimales.
if
(
"-"
==
$size
)
{
return
$size
;
}
$size
=
(
float
)
$size
;
$size
=
(
float
)
$size
;
if
(
$size
<
1024
)
{
$r
=
$size
;
$r
=
$size
;
if
(
$size
!=
1
)
{
$r
.
=
" "
.
_
(
"Bytes"
);
}
else
{
$r
.
=
" "
.
_
(
"Byte"
);
}
}
else
{
$size
=
$size
/
1024
;
$size
=
$size
/
1024
;
if
(
$size
<
1024
)
{
$r
=
round
(
$size
,
2
)
.
" "
.
_
(
"Kb"
);
$r
=
round
(
$size
,
2
)
.
" "
.
_
(
"Kb"
);
}
else
{
$size
=
$size
/
1024
;
$size
=
$size
/
1024
;
if
(
$size
<
1024
)
{
$r
=
round
(
$size
,
2
)
.
" "
.
_
(
"Mb"
);
$r
=
round
(
$size
,
2
)
.
" "
.
_
(
"Mb"
);
}
else
{
$size
=
$size
/
1024
;
$size
=
$size
/
1024
;
if
(
$size
<
1024
)
{
$r
=
round
(
$size
,
2
)
.
" "
.
_
(
"Gb"
);
$r
=
round
(
$size
,
2
)
.
" "
.
_
(
"Gb"
);
}
else
{
$r
=
round
(
$size
/
1024
,
2
)
.
" "
.
_
(
"Tb"
);
$r
=
round
(
$size
/
1024
,
2
)
.
" "
.
_
(
"Tb"
);
}
}
}
...
...
@@ -448,17 +448,17 @@ function linkhelp($hid) {
* @return string
*/
function
format_date
(
$format
,
$date
)
{
$d
=
substr
(
$date
,
8
,
2
);
$m
=
substr
(
$date
,
5
,
2
);
$y
=
substr
(
$date
,
0
,
4
);
$h
=
substr
(
$date
,
11
,
2
);
$i
=
substr
(
$date
,
14
,
2
);
$d
=
substr
(
$date
,
8
,
2
);
$m
=
substr
(
$date
,
5
,
2
);
$y
=
substr
(
$date
,
0
,
4
);
$h
=
substr
(
$date
,
11
,
2
);
$i
=
substr
(
$date
,
14
,
2
);
if
(
$h
>
12
)
{
$hh
=
$h
-
12
;
$am
=
"pm"
;
$hh
=
$h
-
12
;
$am
=
"pm"
;
}
else
{
$hh
=
$h
;
$am
=
"am"
;
$hh
=
$h
;
$am
=
"am"
;
}
return
sprintf
(
$format
,
$d
,
$m
,
$y
,
$h
,
$i
,
$hh
,
$am
);
}
...
...
@@ -482,13 +482,13 @@ function ssla($str) {
* @return string Retourne le mot de passe crypt�
* @access private
*/
function
_md5cr
(
$pass
,
$salt
=
""
)
{
function
_md5cr
(
$pass
,
$salt
=
""
)
{
if
(
!
$salt
)
{
$chars
=
"./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
for
(
$i
=
0
;
$i
<
12
;
$i
++
)
{
$chars
=
"./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
for
(
$i
=
0
;
$i
<
12
;
$i
++
)
{
$salt
.
=
substr
(
$chars
,(
mt_rand
(
0
,
strlen
(
$chars
))),
1
);
}
$salt
=
"$1$"
.
$salt
;
$salt
=
"$1$"
.
$salt
;
}
return
crypt
(
$pass
,
$salt
);
}
...
...
@@ -536,7 +536,7 @@ function pretty_months($months) {
* @return string Code html pour le drop-down
* @access private
*/
function
duration_list
(
$name
,
$selected
=
0
)
{
function
duration_list
(
$name
,
$selected
=
0
)
{
$res
=
"<select name=
\"
$name
\"
id=
\"
$name
\"
class=
\"
inl
\"
>"
;
foreach
(
array
(
0
,
1
,
2
,
3
,
4
,
6
,
12
,
24
)
as
$dur
)
{
...
...
@@ -568,10 +568,10 @@ function duration_list($name, $selected=0) {
* @param string $cur
* @param boolean $onedim
*/
function
eoption
(
$values
,
$cur
,
$onedim
=
false
)
{
function
eoption
(
$values
,
$cur
,
$onedim
=
false
)
{
if
(
is_array
(
$values
))
{
foreach
(
$values
as
$k
=>
$v
)
{
if
(
$onedim
)
$k
=
$v
;
if
(
$onedim
)
$k
=
$v
;
echo
"<option value=
\"
$k
\"
"
;
if
(
$k
==
$cur
)
echo
" selected=
\"
selected
\"
"
;
echo
">"
.
$v
.
"</option>"
;
...
...
@@ -697,15 +697,15 @@ function list_properties_order($a, $b) {
* @param boolean $echo
* @return string
*/
function
pager
(
$offset
,
$count
,
$total
,
$url
,
$before
=
""
,
$after
=
""
,
$echo
=
TRUE
)
{
function
pager
(
$offset
,
$count
,
$total
,
$url
,
$before
=
""
,
$after
=
""
,
$echo
=
TRUE
)
{
$return
=
""
;
$offset
=
intval
(
$offset
);
$count
=
intval
(
$count
);
$total
=
intval
(
$total
);
if
(
$offset
<=
0
)
$offset
=
"0"
;
if
(
$count
<=
1
)
$count
=
"1"
;
if
(
$total
<=
0
)
$total
=
"0"
;
if
(
$total
<
$offset
)
$offset
=
max
(
0
,
$total
-
$count
);
$offset
=
intval
(
$offset
);
$count
=
intval
(
$count
);
$total
=
intval
(
$total
);
if
(
$offset
<=
0
)
$offset
=
"0"
;
if
(
$count
<=
1
)
$count
=
"1"
;
if
(
$total
<=
0
)
$total
=
"0"
;
if
(
$total
<
$offset
)
$offset
=
max
(
0
,
$total
-
$count
);
if
(
$total
<=
$count
)
{
// When there is less element than 1 complete page, just don't do anything :-D
return
true
;
...
...
@@ -722,17 +722,17 @@ function pager($offset,$count,$total,$url,$before="",$after="",$echo = TRUE) {
if
(
$total
>
(
2
*
$count
))
{
// On n'affiche le pager central (0 1 2 ...) s'il y a au moins 2 pages.
$return
.
=
" - "
;
if
((
$total
<
(
$count
*
10
))
&&
(
$total
>
$count
))
{
// moins de 10 pages :
for
(
$i
=
0
;
$i
<
$total
/
$count
;
$i
++
)
{
$o
=
$i
*
$count
;
for
(
$i
=
0
;
$i
<
$total
/
$count
;
$i
++
)
{
$o
=
$i
*
$count
;
if
(
$offset
==
$o
)
{
$return
.
=
$i
.
" "
;
}
else
{
$return
.
=
"<a href
=
\"
"
.
str_replace
(
"%%offset%%"
,
$o
,
$url
)
.
"
\"
>
$i
</a> "
;
$return
.
=
"<a href
=
\"
"
.
str_replace
(
"%%offset%%"
,
$o
,
$url
)
.
"
\"
>
$i
</a> "
;
}
}
}
else
{
// Plus de 10 pages, on affiche 0 1 2 , 2 avant et 2 apr�s la page courante, et les 3 dernieres
for
(
$i
=
0
;
$i
<=
2
;
$i
++
)
{
$o
=
$i
*
$count
;
for
(
$i
=
0
;
$i
<=
2
;
$i
++
)
{
$o
=
$i
*
$count
;
if
(
$offset
==
$o
)
{
$return
.
=
$i
.
" "
;
}
else
{
...
...
@@ -741,11 +741,11 @@ function pager($offset,$count,$total,$url,$before="",$after="",$echo = TRUE) {
}
if
(
$offset
>=
$count
&&
$offset
<
(
$total
-
2
*
$count
))
{
// On est entre les milieux ...
// On affiche 2 avant jusque 2 apr�s l'offset courant mais sans d�border sur les indices affich�s autour
$start
=
max
(
3
,
intval
(
$offset
/
$count
)
-
2
);
$end
=
min
(
intval
(
$offset
/
$count
)
+
3
,
intval
(
$total
/
$count
)
-
3
);
$start
=
max
(
3
,
intval
(
$offset
/
$count
)
-
2
);
$end
=
min
(
intval
(
$offset
/
$count
)
+
3
,
intval
(
$total
/
$count
)
-
3
);
if
(
$start
!=
3
)
$return
.
=
" ... "
;
for
(
$i
=
$start
;
$i
<
$end
;
$i
++
)
{
$o
=
$i
*
$count
;
for
(
$i
=
$start
;
$i
<
$end
;
$i
++
)
{
$o
=
$i
*
$count
;
if
(
$offset
==
$o
)
{
$return
.
=
$i
.
" "
;
}
else
{
...
...
@@ -756,8 +756,8 @@ function pager($offset,$count,$total,$url,$before="",$after="",$echo = TRUE) {
}
else
{
$return
.
=
" ... "
;
}
for
(
$i
=
intval
(
$total
/
$count
)
-
3
;
$i
<
$total
/
$count
;
$i
++
)
{
$o
=
$i
*
$count
;
for
(
$i
=
intval
(
$total
/
$count
)
-
3
;
$i
<
$total
/
$count
;
$i
++
)
{
$o
=
$i
*
$count
;
if
(
$offset
==
$o
)
{
$return
.
=
$i
.
" "
;
}
else
{
...
...
@@ -769,7 +769,7 @@ function pager($offset,$count,$total,$url,$before="",$after="",$echo = TRUE) {
}
// Shall-we show the next page link ?
if
(
$offset
+
$count
<
$total
)
{
$o
=
$offset
+
$count
;
$o
=
$offset
+
$count
;
$return
.
=
"<a href=
\"
"
.
str_replace
(
"%%offset%%"
,
$o
,
$url
)
.
"
\"
alt=
\"
(Ctl/Alt-s)
\"
title=
\"
(Alt-s)
\"
accesskey=
\"
s
\"
>"
.
_
(
"Next Page"
)
.
"</a> "
;
}
else
{
$return
.
=
_
(
"Next Page"
)
.
" "
;
...
...
@@ -808,8 +808,8 @@ function create_pass($length = 8){
* @param string $fields_to_fill2
* @return int
*/
function
display_div_generate_password
(
$pass_size
=
DEFAULT_PASS_SIZE
,
$fields_to_fill1
=
""
,
$fields_to_fill2
=
""
)
{
$id
=
rand
(
1
,
1000
);
function
display_div_generate_password
(
$pass_size
=
DEFAULT_PASS_SIZE
,
$fields_to_fill1
=
""
,
$fields_to_fill2
=
""
)
{
$id
=
rand
(
1
,
1000
);
echo
"<div id='z
$id
' style='display:none;'><a href=
\"
javascript:generate_password_html('
$id
',
$pass_size
,'
$fields_to_fill1
','
$fields_to_fill2
');
\"
>"
;
__
(
"Clic here to generate a password"
);
echo
"</a></div>"
;
...
...
@@ -825,9 +825,9 @@ function display_div_generate_password($pass_size=DEFAULT_PASS_SIZE, $fields_to_
* @param int $width
* @param int $height
*/
function
display_browser
(
$dir
=
""
,
$caller
=
"main.dir"
,
$width
=
350
,
$height
=
450
)
{
function
display_browser
(
$dir
=
""
,
$caller
=
"main.dir"
,
$width
=
350
,
$height
=
450
)
{
// Browser id
$bid
=
"b"
.
rand
(
1
,
1000
);
$bid
=
"b"
.
rand
(
1
,
1000
);
echo
"<script type=
\"
text/javascript
\"
>
<!--
$(function() {
...
...
@@ -863,27 +863,6 @@ function display_browser($dir="", $caller="main.dir", $width=350, $height=450) {
}
/**
* Insere un $wrap_string tous les $max caracteres dans $message
*
* @param string $message
* @param int $max
* @param string $wrap_string
* @return string
*/
function
auto_wrap
(
$message
=
""
,
$max
=
10
,
$wrap_string
=
"<wbr/>"
)
{
$cpt
=
0
;
$mot
=
split
(
" "
,
$message
);
while
(
isset
(
$mot
[
$cpt
])
&&
(
$mot
[
$cpt
]
!=
""
)){
if
(
@
strlen
(
$mot
[
$cpt
])
>
$max
){
$nvmot
=
chunk_split
(
$mot
[
$cpt
],
$max
,
$wrap_string
);
$message
=
str_replace
(
$mot
[
$cpt
],
$nvmot
,
$message
);
}
$cpt
++
;
}
return
$message
;
}
/**
* Converts HSV to RGB values
* -----------------------------------------------------