Your selection

You do not have any extensions in your selection yet.

Rating

  • Currently 5/5 Stars.

Share

Stats

  • 2676 views
  • 2058 downloads

Zikula / Plugins

DownloadUtil 1.0

Extension type: Plugin
Extension originally created by mumuri on May 23, 2009

Description
DownloadUtil is a utils class which allow you to securly download data from other websites.

what is the use of this plugin ?




When people are developping modules, they often need to download data from other server. In order to do that, there is a simple way with the function "fopen" and the directive "<tt class="parameter">allow_url_fopen". But this directive is evil, as it can allow hackers to download files from others servers and eventually to execute php code. The effect are even worst , if the directive "<tt class="parameter">allow_url_include" is activated. Indeed, people could include file from others servers.

With the developpement of hack as a business (look for botnet on google for details), lot of hack attempt happens everyday on your website, on an average website, you can hava 6000 hack attempt a week (try bad behavior to see the result on your site), this is not something that you can not consider in the creation of a website.

This class allow you to download data with curl, eventually if "curl" extension is not found, it will use "<tt class="parameter">allow_url_fopen" as a workaround. As most of the code was already in zikula (thumbnail module), you can just consider this class as a shortcut for easiily downloading data.

How to use it ?



I want to download a picture to a given file ...

Loader::loadClass("DownloadUtil",".");
$url_img="http://community.zikula.org/themes/community/images/logo.gif";
$fileName = FileUtil::generateRandomFilename(7,10,true,false,false).".temp";
        $isOk = DownloadUtil::getToFile($url_img,$fileName);
        if ($isOk ){
            // do stuff
        }


I want to download a remote text file(for instance a txt file with the current version name of your module in order to advice people for update)


Loader::loadClass("DownloadUtil",".");
$url="http://www.isi.edu/in-notes/rfc1591.txt";
$data = DownloadUtil::get($url);
echo $data;

Notes : thumbnail module is required , as it's holding the phpthumb library


Screenshots

Support Info
in the comments
TargetGroup
All
Status
Normal

DownloadUtil 1.0

Options

Version created by mumuri on May 23, 2009
Core support
(not supported)
(not supported)
(not supported)
(not supported)
Changelog
initial version
Status
Normal
Dependencies
Thumbnail (Required, Versions: all )

Comments

Write us your opinion about DownloadUtil. Bug reports and feature request should be submitted at the project's tracker though.

Note

Only registered users are allowed to add reviews.
Register an account or Log in.

Reviews

You tried DownloadUtil out or are using it? Share your experience and create a review about DownloadUtil.

Note

Only registered users are allowed to add reviews.
Register an account or Log in.

History

This graph shows how views and downloads developed. It also contains several events in form of vertical bars. Thereby are local events, as a new version or a comment, and global events, like for example new core releases or other appointments.

Powered by ModuleStudio 0.4.10