<% include_once( "../modules/utils.inc.php" );
$u = $sessionUserId = $_COOKIE["c_uid"];
$tok = $authenticated = $_COOKIE["c_pass_token"];
if( $tok && $tok == md5( getPasswdForUser( $u ))) {
include_once( "$modules/header.inc.php" );
%>
<br />
<%
$b = get_bookmarks_info( $u );
$file_name = $b["file_name"];
$field_name = $b["field_name"];
$dir = $b["dir"];
$path = $b["path"];
$max_allowed_links = 1000;
$max_allowed_tags = 500;
$cmd = "$bin/import-bookmarks.pl $dir/$file_name";
$result = exec( $cmd );
if( preg_match( "/SUCCESS/", $result )) {
# extraceet whatever delimeter the perl used from the result XML:
$delimeter = preg_replace( '/^[^"]+"([^"]+).*/', "\${1}", $result );
$links = file( $dir . "/" . $config->get_import_links_cache_file_name() );
$tags = file( $dir . "/" . $config->get_import_tags_cache_file_name() );
$ls = sizeof( $links );
$ts = sizeof( $tags );
if( ($ls < $max_allowed_links && $ts < $max_allowed_tags) || is_privileged_importer( $u ) ) {
#tell( "Debugging Check:", "We found " . $ls . " links and " . $ts . " tags, which is allowed. Proceeding." );
include_once( "do-random-checks.inc.php" );
include_once( "de-dupe-lists.inc.php" );
include_once( "present-clean-pre-flight-input.inc.php" );
} else
fatal( "We found " . $ls . " links and " . $ts . " tags, which is more than we allow to be imported. Please email the administrators for help importing your sizeable links collection.<p />-- The Management" );
} else {
fatal( "$result : couldn't parse result of $bin/import-bookmarks.pl $dir/$file_name" );
}
include_once( "$modules/footer.inc.php" );
} else {
warn( "Please log in first..." );
echo bounceTo( $site . "/login?bounceToPage=import/" );
}
%>