Welcome Guest ( Log In | Register )


> IPS Related Information

This section is focused on Invision Power Services products...

IPS, widely praised for the continuous efforts aimed to a stable, fast and efficient board system has brought to us Invision Power Board, but not only that..

Invision Power Gallery & Invision Community Blog allow the forum members :

  1. Host & publish images
  2. Host and link Blogs
  3. Integrate all that to the Invision Power Board

 
Reply to this topicStart new topic
> IPS Tutorials: IP.Downloads > IP.Downloads 2.0.0: Allow any url for url submissions
RSS Bot
post 28 May 2009, 05:09 PM
Post #1


yourforum Robot
Group Icon

Group: Private Members
Posts: 196639
Joined: 12-July 05
From: RSS World
Member No.: 125



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!

ps: the update of this tutorial was approved by bfarber, original author of this script for IP.Downloads 1.2.X. View the full article
Go to the top of the page
 
Bookmark this: Post to Del.icio.usPost to DiggPost to FacebookPost to GooglePost to SlashdotPost to StumbleUponPost to TechnoratiPost to YahooMyWeb
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th April 2024 - 11:09 AM
Skin and Graphics by Dan Ellis and Anubis. Hosting by Forums & More © 2005-2011.
InvisionGames - Your #1 Arcade Games Repository | AllSigs - Signatures for all | Rock Band + Guitar Hero = RockHero ! | The Remoters - Remote Assistance | FileMiners - You ask, We find