}
$magnet = false;
if ($file['tmp_name']) {
preg_match('/.*\\.torrent$/', $file['name'], $matches);
if (!$file['size'] || $file['error'] || !$matches) {
$API->error($API->LANG->_('You uploaded invalid .torrent file (zero size, not .torrent extension or upload error)'));
}
require_once 'classes' . DS . 'Torrent.php';
$torrent = new Torrent($file['tmp_name']);
if ($torrent->errors()) {
$API->error($API->LANG->_('There is something wrong with your torrent file'));
}
// do not preform cheks on torrents
//$torrent->announce(false);
//$torrent->announce(array('http://pixi.appaddict.org:2710/announce'));
$magnet = $torrent->magnet();
}
require_once 'itgw.inc.php';
$data = get_itunes_info($trackid, $type, $store);
if (!$appdata && !$data) {
$API->TPL->assign('trackid', $trackid);
$API->TPL->display('no-app-error-itunes.tpl');
die;
} elseif ($data) {
$data['last_parse_itunes'] = $data;
update_application($data, $trackid);
}
if (!$appdata && $data) {
if ($data['price'] == 'Free') {
$paidfreeapps = $API->DB->query_row("SELECT (SELECT COUNT(DISTINCT links.trackid) FROM links LEFT JOIN apps ON links.trackid=apps.trackid WHERE apps.price='Free' AND links.uploader_id={$API->account['id']}) AS free, (SELECT COUNT(DISTINCT links.trackid) FROM links LEFT JOIN apps ON links.trackid=apps.trackid WHERE apps.price!='Free' AND links.uploader_id={$API->account['id']}) AS paid");
$paid_apps = $paidfreeapps['paid'];