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

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

View File

@ -202,7 +202,11 @@ class m_bro {
$db->query("UPDATE browser SET lastdir='$dir' WHERE uid='$cuid';");
$absolute=$this->convertabsolute($dir,false);
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;
}
$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.
*/
function ChangePermissions($R,$d,$perm,$verbose=false) {
global $err;
global $err,$action;
$absolute=$this->convertabsolute($R,false);
if (!$absolute) {
$err->raise("bro",_("File or folder name is incorrect"));
@ -1102,9 +1106,11 @@ class m_bro {
* @access private
*/
function _delete($file) {
global $err;
// permet d'effacer de nombreux fichiers
@set_time_limit(0);
//chmod($file,0777);
$err->log("bro", "_delete($file)");
if (is_dir($file)) {
$handle=opendir($file);
while($filename=readdir($handle)) {

View File

@ -198,19 +198,19 @@ while ($rr=$action->get_action()){
$returned = execute_cmd("$FIXPERM -u", $params["uid"]);
break;
case "CHMOD" :
$filename=$params["file"];
$filename=$params["filename"];
$perms=$params["perms"];
// Checks the file or directory exists
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
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
else if( !chmod($filename, $perms)) {
$errorsList=array("Fail: cannot create ".$params["dst"]);
$errorsList=array("Fail: cannot change perms ($perms) on filename ($filename)");
}
break;
@ -282,7 +282,12 @@ while ($rr=$action->get_action()){
// If an error occured, notify it to the admin
if(count($errorsList)) {
mail_it();
mail_it();
if( (php_sapi_name() === 'cli') ){
echo _("errors were met");
var_dump($errorsList);
}
}
// Unlock the script
@ -290,4 +295,4 @@ if(count($errorsList)) {
unlink(ALTERNC_DO_ACTION_LOCK);
// Exit this script
exit(0);
exit(0);