Файл: adultscript-2.0.3-pro/files/admin/modules/grab/scripts/grab.php
Строк: 49
<?php
define('_CONSOLE', true);
define('_VALID', true);
define('_ADMIN', true);
set_time_limit(0);
$base_dir = dirname(__FILE__);
$base_dir = realpath($base_dir.'/../../../../');
require $base_dir.'/libraries/bootstrap.php';
$log_file = TMP_DIR.'/logs/grab_log';
$url = (isset($_SERVER['argv']['1'])) ? $_SERVER['argv']['1'] : NULL;
$user_id = (isset($_SERVER['argv']['2'])) ? (int) $_SERVER['argv']['2'] : NULL;
$category = (isset($_SERVER['argv']['3'])) ? (int) $_SERVER['argv']['3'] : NULL;
$status = (isset($_SERVER['argv']['4'])) ? (int) $_SERVER['argv']['4'] : NULL;
$unique = (isset($_SERVER['argv']['5'])) ? (int) $_SERVER['argv']['5'] : NULL;
if (isset($url) && isset($user_id) && isset($category) && isset($status)) {
VFile::write($log_file, 'Processing: '.$url.' - '.$user_id.' - '.$category.' - '.$status.'!'."n", TRUE);
if (VValid::url($url)) {
$gcfg = VF::cfg('module.grab');
$parts = explode('/', str_replace(array('http://www.', 'http://'), '', $url));
if (isset($parts['0'])) {
$site = $parts['0'];
if (isset($gcfg['sites'][$site])) {
$site = VFile::strip_ext($site);
$component_file = ADMIN_DIR.'/modules/grab/grabers/'.$site.'.php';
$component_name = 'VComponent_Admin_grab_'.$site;
if (file_exists($component_file) && is_file($component_file)) {
require ADMIN_DIR.'/modules/grab/components/grab.php';
require $component_file;
$grabber = new $component_name($url, $user_id, $category, $status, $unique);
$grabber->background = true;
if ($grabber->get_videos()) {
if ($grabber->get('video_already')) {
VFile::write($log_file, $grabber->get('video_already'). ' videos are already added to your site!'."n", TRUE);
}
} else {
VFile::write($log_file, implode("n", $grabber->get('errors')), TRUE);
}
} else {
VFile::write($log_file, 'Failed to load grabber component file!'."n", TRUE);
}
} else {
VFile::write($log_file, 'Site ('.$site.') is not a supported grab site!'."n", TRUE);
}
} else {
VFile::write($log_file, 'Failed to get site name!'."n", TRUE);
}
} else {
VFile::write($log_file, 'Grab url is not a valid url address!'."n", TRUE);
}
} else {
VFile::write($log_file, 'Invalid (or incomplete) arguments!'."n", TRUE);
}
?>