<?php
+#die(print_r(posix_getpwnam('nico'),true));
+#die(print_r(posix_getpwuid(posix_getuid()),true));
+#die(print_r(pathinfo('~/.gitconfig'),true));
+#die(file_exists(realpath('~/.gitconfig')) ? 'yes' : 'no');
$CONF['_rent'] = array(
'Title' => 'Rent',
'notice' => 'Micro foncier 4BE',
),
);
+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[2],posix_getpwnam('nico')['dir'],$m[0]);
+ return str_replace($m[1],posix_getpwuid(posix_getuid())['dir'],$m[0]);
+ },$path);
+}
+
+#die(untilde('~/.gitconfig'));
+if (!empty($_SERVER['DOCUMENT_ROOT'])) {
+ $CONF['_rent']['tables']['tenant'] = array(
+ 'row_parse_post' => function(&$r) {
+ $url = '/data/tenant';
+
+ if (
+ (
+ (!$doc=$r['doc']) and file_exists( $dir = $_SERVER['DOCUMENT_ROOT'].$url.'/'.$r['id'] )
+ ) or (
+ ( $dir = untilde($r['doc']) )
+ and file_exists($dir) and is_dir($dir)
+ and ($url='' or 1)
+ )
+ ) {
+ #debug($_SERVER['DOCUMENT_ROOT'].'/data/tenant/');
+ foreach (ls_dir($dir,true) as $p) {
+ #$r['doc'] .= '/data/tenant/'.$p;
+ $r['doc'] .= sprintf('<a href="%s" class="small">%s</a> ',"$url/$p",preg_replace('@^.*?([^/\.]+).*?$@','\1',$p));
+ }
+ }
+ },
+ );
+}
+
$CONF['rent'] = array (
'order' => 5,
'pdo' => 'sqlite:/opt/rent/rent.db',
this.str2a = function(elems,compact,class_exp_file) {
compact = (typeof compact === 'undefined') ? true : compact;
- class_exp_file = (typeof class_exp_file === 'undefined') ? 'dir|path' : class_exp_file;
+ class_exp_file = (typeof class_exp_file === 'undefined') ? 'doc|dir|path' : class_exp_file;
$(elems).each(function(){
var text = $(this).text();
if (text == '') return;
+ if (text != $(this).html()) return; // contents html
// Search /home
var url = text