function config_folders_table_load($field_id, $raw) { $output = array(); foreach (config::search('/^folder_/') as $id => $path) { foreach (config::$fields["dir"]["builtin"] as $builtin_id => $builtin_path) { if ($builtin_id == $id) { continue 2; } } $output[] = array("id" => substr($id, 7), "path" => $path); } return $output; }
public static function get_folder_path($id) { if (!$id) { return ''; } static $folders = null; if (!config::config_exists()) { return false; } if ($folders === null) { config::load_config(); $folders = config::search('/^folder_/'); } return isset($folders['folder_' . $id]) ? $folders['folder_' . $id] : false; }
static function directories() { if (!config::config_exists()) { return array(); } $return = array(); foreach (config::search('/^folder_/') as $id => $path) { $id = substr($id, 7); $return[$id] = array("path" => $path); $return[$id]["write_required"] = $id == 'data' || $id == 'compiled' || $id == 'cached' || $id == 'dcss_compiled' || $id == 'form_compiled'; $return[$id]["exists"] = file::get_folder_path($id) !== false && @is_dir(get_file($id, '')->get_path()); $return[$id]["writable"] = @is_writable(get_file($id, '')->get_path()); $return[$id]["updatable"] = @is_writable(get_file($id, '')->get_write_path()); } return $return; }