By default, IP.Downloads 2.0.0 will check the submitted url and verify that the extension is allowed. Some users have expressed a desire to allow any urls (e.g. so that they can submit rapidshare or megaupload urls to the download manager), which isn't possible via any setting presently.
To do this, backup (important!), open admin/applications_addon/ips/downloads/modules_public/post/submit.php and find:
if( $this->registry->getClass('idmFunctions')->canSubmitLinks() )
{
require_once( IPSLib::getAppDir( 'downloads' ) . '/sources/storage/url.php' );
$urlStorageEngine = new urlStorageEngine( $this->registry, $category );
}
Add below:
$file['file_url'] = trim($this->request['file_url']);
$extension = explode( ".", $save_array['file_realname'] );
$filetype = strtolower( array_pop( $extension ) );
$file['file_size'] = $this->registry->getClass('idmFunctions')->obtainRemoteFileSize();
If you want to use the BLACKLIST feature of IP.Board 3.0.0, use this script intead:
if ( $this->settings['ipb_use_url_filter'] )
{
$list_type = $this->settings['ipb_url_filter_option'] == "black" ? "blacklist" : "whitelist";
if( $this->settings['ipb_url_' . $list_type ] )
{
$list_values = array();
$list_values = explode( "\n", str_replace( "\r", "", $this->settings['ipb_url_' . $list_type ] ) );
if ( $list_type == "whitelist" )
{
$list_values[] = "http://{$_SERVER['HTTP_HOST']}/*";
}
if ( count( $list_values ) )
{
$this->registry->class_localization->loadLanguageFile( 'public_post', 'forums' );
$good_url = 0;
foreach( $list_values as $my_url )
{
if( !trim($my_url) )
{
continue;
}
$my_url = preg_quote( $my_url, '/' );
$my_url = str_replace( "\*", "(.*?)", $my_url );
if ( $list_type == "blacklist" )
{
if( preg_match( '/' . $my_url . '/i', trim($this->request['file_url']) ) )
{
$this->registry->output->addContent( $this->registry->getClass('idmFunctions')->produceError( 'domain_not_allowed' ) );
$this->_continueForm( $type );
return;
}
}
else
{
if ( preg_match( '/' . $my_url . '/i', $option ) )
{
$good_url = 1;
}
}
}
if ( ! $good_url AND $list_type == "whitelist" )
{
$this->registry->output->addContent( $this->registry->getClass('idmFunctions')->produceError( 'domain_not_allowed' ) );
$this->_continueForm( $type );
return;
}
}
}
}
$file['file_url'] = trim($this->request['file_url']);
$extension = explode( ".", $save_array['file_realname'] );
$filetype = strtolower( array_pop( $extension ) );
$file['file_size'] = $this->registry->getClass('idmFunctions')->obtainRemoteFileSize();
This way, if you had blocked some URLs on blacklist (like megaupload, rapidshare, etc.), it won't be possible to post link to them!
In both cases, find:
else if( $error_number > 1 )
Change to:
else if( $error_number > 2 )
ps: the update of this tutorial was approved by bfarber, original author of this script for IP.Downloads 1.2.X. Wyświetl pełny artykuł