Merge branch 'stable-3.1' of alternc.org:alternc into stable-3.1

This commit is contained in:
Benjamin Sonntag 2014-09-29 17:37:15 +02:00
commit 3ae25c759e
3 changed files with 21 additions and 12 deletions

View File

@ -195,7 +195,6 @@ class m_action {
function set($type, $user, $parameters) { function set($type, $user, $parameters) {
global $db, $err; global $db, $err;
$err->log("action", "set", $type); $err->log("action", "set", $type);
$serialized = serialize($parameters); $serialized = serialize($parameters);
switch ($type) { switch ($type) {
case 'chmod': case 'chmod':
@ -229,8 +228,7 @@ class m_action {
$err->raise("action", _("Error setting actions")); $err->raise("action", _("Error setting actions"));
return false; return false;
} }
$this->do_action(); return $this->do_action();
return true;
} }
/** /**

View File

@ -202,7 +202,11 @@ class m_bro {
$db->query("UPDATE browser SET lastdir='$dir' WHERE uid='$cuid';"); $db->query("UPDATE browser SET lastdir='$dir' WHERE uid='$cuid';");
$absolute=$this->convertabsolute($dir,false); $absolute=$this->convertabsolute($dir,false);
if (!$absolute || !file_exists($absolute)) { if (!$absolute || !file_exists($absolute)) {
$err->raise('bro',_("This directory do not exist")); $err->raise('bro',_("This directory do not exist."));
return false;
}
if (!is_readable($absolute)) {
$err->raise('bro',_("This directory is not readable."));
return false; return false;
} }
$c=array(); $c=array();
@ -552,7 +556,7 @@ class m_bro {
* @return boolean TRUE Si les fichiers ont t renomms, FALSE si une erreur s'est produite. * @return boolean TRUE Si les fichiers ont t renomms, FALSE si une erreur s'est produite.
*/ */
function ChangePermissions($R,$d,$perm,$verbose=false) { function ChangePermissions($R,$d,$perm,$verbose=false) {
global $err; global $err,$action;
$absolute=$this->convertabsolute($R,false); $absolute=$this->convertabsolute($R,false);
if (!$absolute) { if (!$absolute) {
$err->raise("bro",_("File or folder name is incorrect")); $err->raise("bro",_("File or folder name is incorrect"));
@ -1102,9 +1106,11 @@ class m_bro {
* @access private * @access private
*/ */
function _delete($file) { function _delete($file) {
global $err;
// permet d'effacer de nombreux fichiers // permet d'effacer de nombreux fichiers
@set_time_limit(0); @set_time_limit(0);
//chmod($file,0777); //chmod($file,0777);
$err->log("bro", "_delete($file)");
if (is_dir($file)) { if (is_dir($file)) {
$handle=opendir($file); $handle=opendir($file);
while($filename=readdir($handle)) { while($filename=readdir($handle)) {

View File

@ -198,19 +198,19 @@ while ($rr=$action->get_action()){
$returned = execute_cmd("$FIXPERM -u", $params["uid"]); $returned = execute_cmd("$FIXPERM -u", $params["uid"]);
break; break;
case "CHMOD" : case "CHMOD" :
$filename=$params["file"]; $filename=$params["filename"];
$perms=$params["perms"]; $perms=$params["perms"];
// Checks the file or directory exists // Checks the file or directory exists
if( !is_dir($filename) && ! is_file($filename)){ if( !is_dir($filename) && ! is_file($filename)){
$errorsList=array("Fail: cannot create ".$params["dst"]); $errorsList=array("Fail: cannot retrieve CHMOD filename" );
} }
// Checks the perms are correct // Checks the perms are correct
else if ( !is_int( $perms)){ else if ( !is_int( $perms)){
$errorsList=array("Fail: cannot create ".$params["dst"]); $errorsList=array("Fail: Incorrect perms : $perms");
} }
// Attempts to change the rights on the file or directory // Attempts to change the rights on the file or directory
else if( !chmod($filename, $perms)) { else if( !chmod($filename, $perms)) {
$errorsList=array("Fail: cannot create ".$params["dst"]); $errorsList=array("Fail: cannot change perms ($perms) on filename ($filename)");
} }
break; break;
@ -283,6 +283,11 @@ while ($rr=$action->get_action()){
// If an error occured, notify it to the admin // If an error occured, notify it to the admin
if(count($errorsList)) { if(count($errorsList)) {
mail_it(); mail_it();
if( (php_sapi_name() === 'cli') ){
echo _("errors were met");
var_dump($errorsList);
}
} }
// Unlock the script // Unlock the script