function imce_initiate_profile in IMCE 6.2
Same name and namespace in other branches
- 6 inc/page.inc \imce_initiate_profile()
- 7 inc/imce.page.inc \imce_initiate_profile()
Initiate and return configuration profile for the $user.
3 calls to imce_initiate_profile()
- imce_content in inc/
imce.page.inc - Returns the content of the file browser.
- imce_js in inc/
imce.page.inc - Ajax operations. q=imce&jsop={op}
- theme_imce_user_page in inc/
imce.page.inc - Returns the html for user's file browser tab.
File
- inc/
imce.page.inc, line 728 - Implements the file browser.
Code
function imce_initiate_profile($user) {
//check user profile and translate tokens in directory paths and evaluate php paths.
if ($imce = imce_user_profile($user)) {
// Allow alteration of raw profile
foreach (variable_get('imce_custom_init', array()) as $func => $state) {
if ($state && function_exists($func)) {
$func($imce, $user);
}
}
imce_process_directories($imce, $user);
if (!empty($imce['directories'])) {
$imce['uid'] = (int) $user->uid;
$imce['url'] = url($_GET['q']);
$imce['clean'] = variable_get('clean_url', 0) == 1;
$imce['absurls'] = variable_get('imce_settings_absurls', 0) == 1;
$private = variable_get('file_downloads', '') == FILE_DOWNLOADS_PRIVATE;
$imce['furl'] = $private ? url('system/files') : base_path() . file_directory_path();
$imce['filesize'] *= 1048576;
//convert from Mb to byte
$imce['quota'] *= 1048576;
$imce['tuquota'] *= 1048576;
$imce['filenum'] = (int) $imce['filenum'];
//check and set the active directory
if ($info = imce_working_directory($imce)) {
$imce['direct'] = isset($imce['directories'][$info['name']]);
$imce['directories'][$info['name']] = $info;
$imce['dir'] = $info['name'];
$imce['perm'] = $info;
//copy permissions of the active directory.
unset($imce['perm']['name']);
}
else {
drupal_set_message(t('Unable to get a working directory for the file browser!'), 'error');
$imce['dir'] = FALSE;
$imce['error'] = TRUE;
}
return $imce;
}
drupal_set_message(t('There is no valid directory specified for the file browser!'), 'error');
}
else {
drupal_set_message(t('You do not have access to any configuration profile to use the file browser!'), 'error');
}
return FALSE;
}