Changeset 2105
- Timestamp:
- 04/10/08 20:40:08 (4 months ago)
- Files:
-
- alternc/trunk/bureau/admin/bro_main.php (modified) (3 diffs)
- alternc/trunk/bureau/class/m_bro.php (modified) (1 diff)
- alternc/trunk/debian/changelog (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
alternc/trunk/bureau/admin/bro_main.php
r2104 r2105 108 108 } 109 109 break; 110 case 7: // Changement de permissions [ML] 111 if (!$bro->ChangePermissions($R, $d, $perm)) { 112 print $err->errstr(); 113 } 114 break; 110 115 } 111 116 } … … 174 179 } 175 180 181 /* [ML] Changer les permissions : */ 182 if ($formu==2 && $_REQUEST['actperms'] && count($d)) { 183 echo "<form action=\"bro_main.php\" method=\"post\">\n"; 184 echo "<input type=\"hidden\" name=\"R\" value=\"$R\" />\n"; 185 echo "<input type=\"hidden\" name=\"formu\" value=\"7\" />\n"; 186 echo "<p>"._("Permissions")."</p>"; 187 188 $tmp_absdir = $bro->convertabsolute($R,0); 189 190 echo "<table border=\"1\">"; // FIXME, marco, ajouter classe css? 191 echo "<tr>"; 192 // echo "<th>" . 'File' . "</th><th> </th><th>Owner</th><th>Group</th><th>Other</th>"; // FIXME , i18n 193 echo "<th>" . 'File' . "</th><th>Permissions</th>"; // FIXME, i18n 194 echo "</tr>"; 195 196 for ($i=0;$i<count($d);$i++) { 197 $d[$i]=ssla($d[$i]); 198 $stats = stat($tmp_absdir . '/' . $d[$i]); 199 $modes = $stats[2]; 200 201 echo "<tr>"; 202 echo "<td>".$d[$i]."</td>"; 203 204 // Owner 205 echo "<td>"; 206 echo "<input type=\"hidden\" name=\"d[$i]\" value=\"".$d[$i]."\" />"; 207 // echo "<label>read <input type=\"checkbox\" name=\"perm[$i][r]\" value=\"1\" ". (($modes & 0000400) ? 'checked="checked"' : '') ." />"; 208 echo "<label>write <input type=\"checkbox\" name=\"perm[$i][w]\" value=\"1\" ". (($modes & 0000200) ? 'checked="checked"' : '') ." />"; 209 echo "</td>"; 210 211 echo "</tr>"; 212 } 213 214 echo "</table>"; 215 216 echo "<p><input type=\"submit\" class=\"inb\" name=\"submit\" value=\""._("Change permissions")."\" /></p>"; 217 echo "</form>\n"; 218 echo "<hr />\n"; 219 } 220 176 221 /* We draw the file list and button bar only if there is files here ! */ 177 222 if (count($c)) { … … 190 235 191 236 <input type="submit" class="inb" name="actrename" value="<?php __("Rename"); ?>" /> 237 <input type="submit" class="inb" name="actperms" value="<?php __("Permissions"); ?>" /> <!-- [ML] --> 192 238 193 239 <input type="submit" class="inb" name="actcopy" value="<?php __("Copy to"); ?>" /> alternc/trunk/bureau/class/m_bro.php
r2101 r2105 383 383 } 384 384 } 385 return true; 386 } 387 388 /* ----------------------------------------------------------------- */ 389 /** Change les droits d'acces aux fichier de $d du dossier $R en $p 390 * @param string $R dossier dans lequel se trouve les fichiers à renommer. 391 * @param array of string $old Ancien nom des fichiers 392 * @param array of string $new Nouveau nom des fichiers 393 * @return boolean TRUE si les fichiers ont été renommés, FALSE si une erreur s'est produite. 394 */ 395 function ChangePermissions($R,$d,$perm) { 396 global $err; 397 $absolute=$this->convertabsolute($R,0); 398 if (!$absolute) { 399 $err->raise("bro",1); 400 return false; 401 } 402 for ($i=0;$i<count($d);$i++) { 403 $d[$i]=ssla($d[$i]); // strip slashes if needed 404 if (!strpos($d[$i],"/")) { // caractère / interdit dans le nom du fichier 405 // @rename($absolute."/".$old[$i],$absolute."/".$old[$i].$alea); 406 $m = fileperms($absolute."/". $d[$i]); 407 408 // pour l'instant on se limite a "write" pour owner, puisque c'est le seul 409 // cas interessant compte tenu de la conf de Apache pour AlternC.. 410 if ($perm[$i]['w']) { 411 $m = $m | 128; 412 } else { 413 $m = $m ^ 128; 414 } 415 $m = $m | ($perm[$i]['w'] ? 128 : 0); // 0600 416 chmod($absolute."/".$d[$i], $m); 417 echo "chmod " . sprintf('%o', $m) . " file, was " . sprintf('%o', fileperms($absolute."/". $d[$i])). " -- " . $perm[$i]['w']; 418 } 419 } 420 385 421 return true; 386 422 } alternc/trunk/debian/changelog
r2104 r2105 4 4 Marc Angles, sponsored by Koumbit 5 5 * styles can now be changed locally in admin/styles/base.css 6 * crude implementation of a permission change interface in the file browser 6 7 7 8 -- Antoine Beaupré <anarcat@koumbit.org> Thu, 10 Apr 2008 13:56:22 -0400
