require_once 'session.ppp' ;
require_once 'local.ppp' ;
require_once 'conf.ppp' ;
require_once 'baselib.ppp' ;
require_once 'wwwsec.ppp' ;
require_once 'librepo.ppp' ;
# $DEBUG = 2 ;
get_config () ;
$conn = db_connect_or_die () ;
assert_login () ;
$TIT = REPO_TIT ( 'load' ) ;
html_start ( $TIT ) ;
if ( ! $USER ) { html_exit ( "repo load : not authorised" ) ; }
$USER_GROUPS = user_group_ids () ;
foreach ( $_POST as $key => $val )
{ echo "_POST : key ($key) val ($val)
\n" ; }
$RID = GETVAR ( 'RID' ) ;
if ( ! $RID ) { html_exit ( "no RID" ) ; }
$repo = get_repo ( $RID ) ;
if ( ! $repo -> is_writer () )
{ html_exit ( "no commit rights for " . $repo -> repo_name () ) ; }
if ( $repo -> revision () )
{ html_exit ( "not at revision 0 : " . $repo -> repo_name () ) ; }
foreach ( $_FILES [ 'userfile' ] as $key => $val )
{ echo "_FILES [ 'userfile' ] : key ($key) val ($val)
\n" ; }
# key (name) val (zx10.jpg)
# key (type) val (image/jpeg)
# key (tmp_name) val (/tmp/phpDShpQg)
# key (error) val (0)
# key (size) val (49259)
$nam = $_FILES [ 'userfile' ] [ 'name' ] ;
$err = $_FILES [ 'userfile' ] [ 'error' ] ;
$tmp = $_FILES [ 'userfile' ] [ 'tmp_name' ] ;
$typ = $_FILES [ 'userfile' ] [ 'type' ] ;
$cat = 'cat' ;
$zip = 'not compressed' ;
if ( preg_match ( '/gzip/', $typ )
or preg_match ( '/\.gz$/i', $nam )
)
{ $cat = 'zcat -c' ;
$zip = 'gzip compressed' ;
}
printf ( "
... assuming data is $zip
\n" ) ;
$cmd = sprintf
( "%s %s | %s load %s"
, $cat
, $tmp
, SVN_ADMIN_CMD ()
, $repo -> repo_dir ()
) ;
printf ( "%s
\n", $cmd ) ;
if ( $err ) { html_exit ( "repo load : some error occurred" ) ; }
echo "
\n" ; system ( $cmd ) ; echo "\n" ; html_end () ; # phpinfo() ; ?>