<?PHP

//FOR ajax link

require '../inc/page.zip.php';
require '../inc/conf.php';
require _Core.'/extender.php';
require _Core.'/template.php';
require _Core.'/engine.php';


$self = new Engine;
$self->__init();

if(!is_file(_RootFolder.'/tmp/script/link.js')){

	if(!is_dir(_RootFolder.'/tmp/script')) mkdir(_RootFolder.'/tmp/script');
	file_put_contents(_RootFolder.'/tmp/script/link.js', 'var link = [];');
}

$fcontent = file_get_contents(_RootFolder.'/tmp/script/link.js');

$link = '';
if($_GET['urltype'] == 'append')
	$link = $self->appendLink($_GET['url'], explode(',', $_GET['hide_id']));
else
	$link = $self->Link($_GET['url'], explode(',', $_GET['hide_id']));

if(!preg_match("/link\[\'".md5($_GET['url'])."\']/i", $fcontent))
	file_put_contents(_RootFolder.'/tmp/script/link.js', file_get_contents(_RootFolder.'/tmp/script/link.js')."\n".'link[\''.md5($_GET['url']).'\'] = \''.addslashes($link).'\';');
echo $link;
$self->end();

?>