default_user settings in file manager - thoughts?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't have a clean patch for this.. apologies in advance.

What this does is change the way the file manager plugin config file
works, allows a 'default_user' config line that is used if the username
isn't specified already. This way you can set a default quota limit and 
file root for file manager and you don't have to specify every user. It 
also creates the users' directory upon login. This requires a small 
change in file_manager.php and a larger change in functions.php.

In file_manager.users (the config file) you can add a line at the BOTTOM
of the file like so:

default_user /var/local/squirrelmail/files 40MB x@xxxxx 0 0 0

The $username will get appended to the path for the user's base dir.
The base dir will get auto created upon login. It'll only be used if the
user isn't specified already in the config file ABOVE the default_user.

This isn't for everybody, but may be appropriate in some environments, 
and this code has not been heavily tested yet.


-------------------------------------------------
file_manager.php:

just before line 1882, add this:
    // create the dir if it doesn't exist
    // this might be very unsafe thing to do..
    // you have been warned!
    if((!is_dir($cwd)) && ($cwd == $baseDir))
         mkdir($cwd, intval($defaultFolderPerms, 8));

    if ($DIR = opendir($cwd))     // line 1882

--------------------------------------------------


functions.php:

Right below the '}' on line 173, add this:

// this is a duplication of the if(){ ... } above
// but with the $username used to set a single basedir
elseif ($configSettings[1][0] == 'default_user')
{
  $numberOfFields = sizeof($configSettings[1]);
  $file_manager_user_config[$username]['allowEditBinary'] =
$configSettings[1][$numberOfFields - 1];
  $file_manager_user_config[$username]['allowChmod'] =
$configSettings[1][$numberOfFields - 2];
  $file_manager_user_config[$username]['allowLinks'] =
$configSettings[1][$numberOfFields - 3];
  $file_manager_user_config[$username]['adminMail'] =
$configSettings[1][$numberOfFields - 4];

  $numberOfBaseDirs = 1;
  for ( ; $numberOfBaseDirs < $numberOfFields - 5; $numberOfBaseDirs++)
  {
   $file_manager_user_config[$username]['baseDir1'] =
$configSettings[1][1] . '/' . $username;
  }
  $quota = $configSettings[1][$numberOfFields - 5];
  if (is_numeric($quota) || is_numeric(get_real_size($quota)))
  {
   $file_manager_user_config[$username]['quota'] = $quota;
   $numberOfBaseDirs--;
  }
  else
  {
   $file_manager_user_config[$username]['baseDir' . $numberOfBaseDirs] =
$quota;
   $file_manager_user_config[$username]['quota'] = '';
  }
  $foundUserConfig = 1;
  break;
} // end of default_user elseif

----------------------------------------------


Ken


-- 
Ken Anderson
Pacific.Net



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--
squirrelmail-users mailing list
Posting Guidelines: http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List Archives: http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user
List Archives:  http://sourceforge.net/mailarchive/forum.php?forum_id=2995
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux