Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
domainepublic
alternc
Commits
c8f477c3
Commit
c8f477c3
authored
Apr 10, 2008
by
Antoine Beaupré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crude implementation of permission change in the file browser
Contributed by: Mathieu Lutfy Sponsored by: Koumbit
parent
9517d27d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
0 deletions
+83
-0
bureau/admin/bro_main.php
bureau/admin/bro_main.php
+46
-0
bureau/class/m_bro.php
bureau/class/m_bro.php
+36
-0
debian/changelog
debian/changelog
+1
-0
No files found.
bureau/admin/bro_main.php
View file @
c8f477c3
...
...
@@ -107,6 +107,11 @@ if ($formu) {
print
$err
->
errstr
();
}
break
;
case
7
:
// Changement de permissions [ML]
if
(
!
$bro
->
ChangePermissions
(
$R
,
$d
,
$perm
))
{
print
$err
->
errstr
();
}
break
;
}
}
...
...
@@ -173,6 +178,46 @@ if ($formu==2 && $actrename && count($d)) {
echo
"<hr />
\n
"
;
}
/* [ML] Changer les permissions : */
if
(
$formu
==
2
&&
$_REQUEST
[
'actperms'
]
&&
count
(
$d
))
{
echo
"<form action=
\"
bro_main.php
\"
method=
\"
post
\"
>
\n
"
;
echo
"<input type=
\"
hidden
\"
name=
\"
R
\"
value=
\"
$R
\"
/>
\n
"
;
echo
"<input type=
\"
hidden
\"
name=
\"
formu
\"
value=
\"
7
\"
/>
\n
"
;
echo
"<p>"
.
_
(
"Permissions"
)
.
"</p>"
;
$tmp_absdir
=
$bro
->
convertabsolute
(
$R
,
0
);
echo
"<table border=
\"
1
\"
>"
;
// FIXME, marco, ajouter classe css?
echo
"<tr>"
;
// echo "<th>" . 'File' . "</th><th> </th><th>Owner</th><th>Group</th><th>Other</th>"; // FIXME , i18n
echo
"<th>"
.
'File'
.
"</th><th>Permissions</th>"
;
// FIXME, i18n
echo
"</tr>"
;
for
(
$i
=
0
;
$i
<
count
(
$d
);
$i
++
)
{
$d
[
$i
]
=
ssla
(
$d
[
$i
]);
$stats
=
stat
(
$tmp_absdir
.
'/'
.
$d
[
$i
]);
$modes
=
$stats
[
2
];
echo
"<tr>"
;
echo
"<td>"
.
$d
[
$i
]
.
"</td>"
;
// Owner
echo
"<td>"
;
echo
"<input type=
\"
hidden
\"
name=
\"
d[
$i
]
\"
value=
\"
"
.
$d
[
$i
]
.
"
\"
/>"
;
// echo "<label>read <input type=\"checkbox\" name=\"perm[$i][r]\" value=\"1\" ". (($modes & 0000400) ? 'checked="checked"' : '') ." />";
echo
"<label>write <input type=
\"
checkbox
\"
name=
\"
perm[
$i
][w]
\"
value=
\"
1
\"
"
.
((
$modes
&
0000200
)
?
'checked="checked"'
:
''
)
.
" />"
;
echo
"</td>"
;
echo
"</tr>"
;
}
echo
"</table>"
;
echo
"<p><input type=
\"
submit
\"
class=
\"
inb
\"
name=
\"
submit
\"
value=
\"
"
.
_
(
"Change permissions"
)
.
"
\"
/></p>"
;
echo
"</form>
\n
"
;
echo
"<hr />
\n
"
;
}
/* We draw the file list and button bar only if there is files here ! */
if
(
count
(
$c
))
{
...
...
@@ -189,6 +234,7 @@ document.write("<input type=\"button\" value=\"<?php __("all/none"); ?>\" class=
<input
type=
"submit"
class=
"inb"
name=
"actdel"
value=
"
<?php
__
(
"Delete"
);
?>
"
/>
<input
type=
"submit"
class=
"inb"
name=
"actrename"
value=
"
<?php
__
(
"Rename"
);
?>
"
/>
<input
type=
"submit"
class=
"inb"
name=
"actperms"
value=
"
<?php
__
(
"Permissions"
);
?>
"
/>
<!-- [ML] -->
<input
type=
"submit"
class=
"inb"
name=
"actcopy"
value=
"
<?php
__
(
"Copy to"
);
?>
"
/>
...
...
bureau/class/m_bro.php
View file @
c8f477c3
...
...
@@ -385,6 +385,42 @@ class m_bro {
return
true
;
}
/* ----------------------------------------------------------------- */
/** Change les droits d'acces aux fichier de $d du dossier $R en $p
* @param string $R dossier dans lequel se trouve les fichiers à renommer.
* @param array of string $old Ancien nom des fichiers
* @param array of string $new Nouveau nom des fichiers
* @return boolean TRUE si les fichiers ont été renommés, FALSE si une erreur s'est produite.
*/
function
ChangePermissions
(
$R
,
$d
,
$perm
)
{
global
$err
;
$absolute
=
$this
->
convertabsolute
(
$R
,
0
);
if
(
!
$absolute
)
{
$err
->
raise
(
"bro"
,
1
);
return
false
;
}
for
(
$i
=
0
;
$i
<
count
(
$d
);
$i
++
)
{
$d
[
$i
]
=
ssla
(
$d
[
$i
]);
// strip slashes if needed
if
(
!
strpos
(
$d
[
$i
],
"/"
))
{
// caractère / interdit dans le nom du fichier
// @rename($absolute."/".$old[$i],$absolute."/".$old[$i].$alea);
$m
=
fileperms
(
$absolute
.
"/"
.
$d
[
$i
]);
// pour l'instant on se limite a "write" pour owner, puisque c'est le seul
// cas interessant compte tenu de la conf de Apache pour AlternC..
if
(
$perm
[
$i
][
'w'
])
{
$m
=
$m
|
128
;
}
else
{
$m
=
$m
^
128
;
}
$m
=
$m
|
(
$perm
[
$i
][
'w'
]
?
128
:
0
);
// 0600
chmod
(
$absolute
.
"/"
.
$d
[
$i
],
$m
);
echo
"chmod "
.
sprintf
(
'%o'
,
$m
)
.
" file, was "
.
sprintf
(
'%o'
,
fileperms
(
$absolute
.
"/"
.
$d
[
$i
]))
.
" -- "
.
$perm
[
$i
][
'w'
];
}
}
return
true
;
}
/* ----------------------------------------------------------------- */
/** Recoit un champ file upload (Global) et le stocke dans le dossier $R
* Le champ file-upload originel doit s'appeler "userfile" et doit
...
...
debian/changelog
View file @
c8f477c3
...
...
@@ -3,6 +3,7 @@ alternc (0.9.7+dev) stable; urgency=low UNRELEASED
* standardisation of the web interface, along with some esthetic changes, by
Marc Angles, sponsored by Koumbit
* styles can now be changed locally in admin/styles/base.css
* crude implementation of a permission change interface in the file browser
-- Antoine Beaupré <anarcat@koumbit.org> Thu, 10 Apr 2008 13:56:22 -0400
...
...
Write
Preview
Markdown
is supported
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