);
$CONF['nb-sqlite'] = array (
- 'pdo' => 'sqlite:/opt/rent/nb.db',
+ 'pdo' => 'sqlite:'.nb::untilde('~nico/ownCloud/var/lib/sqlite/nb.db'),
'_import' => '_rent',
);
return 1;
-function untilde($path) {
- if (!function_exists('posix_getuid')) return $path;
- return preg_replace_callback('/^(~)(\w+)?/',function($m){
-
- $uid = fileowner(!empty($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : __FILE__);
- if (!empty($m[2])) return str_replace($m[2],posix_getpwnam($uid)['dir'],$m[0]);
-
- return str_replace($m[1],posix_getpwuid(posix_getuid())['dir'],$m[0]);
- },$path);
-}
-
function tenant_doc(&$r) { return rent_doc('tenant',$r); }
function place_doc(&$r) { return rent_doc('place',$r); }
# Absolute path
or (
- ( $dir = untilde($r['doc']) )
+ ( $dir = nb::untilde($r['doc']) )
and file_exists($dir) and is_dir($dir)
and ($url='' or 1)
)
}
+ public static function untilde($path) {
+ if (!function_exists('posix_getuid')) return $path;
+ return preg_replace_callback('/^(~)(\w+)?/',function($m){
+
+ if (!empty($m[2])) return str_replace($m[1].$m[2],posix_getpwnam($m[2])['dir'],$m[0]);
+
+ return str_replace($m[1],posix_getpwuid(posix_getuid())['dir'],$m[0]);
+ },$path);
+ }
} # < Class
?>