aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2008-11-23 17:23:57 +0000
committerpatdenice <patdenice@piwigo.org>2008-11-23 17:23:57 +0000
commitc74e2ab49ee08101b38b3904a49037fcd6f9403c (patch)
treeb1c5cdaa0af1f3e63ad4375bdef1d3e5576a1b86 /admin/include
parent61d8bf79c169e601b480bf54fc393c453b8874a0 (diff)
- Add home and identification buttons after installation.
- Use fetchRemote function for remote site actions. - Corrections in fetchRemote fnction. - Move PLUGIN_PICTURE_BEFORE in picture.tpl. git-svn-id: http://piwigo.org/svn/trunk@2902 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include')
-rw-r--r--admin/include/functions.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index a8193d3af..fc11101fc 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1948,6 +1948,21 @@ function cat_admin_access($category_id)
*/
function fetchRemote($src, &$dest, $user_agent='Piwigo', $step=0)
{
+ // Try to retrieve data from local file?
+ if (!url_is_remote($src))
+ {
+ $content = @file_get_contents($src);
+ if ($content !== false)
+ {
+ is_resource($dest) ? @fwrite($dest, $content) : $dest = $content;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
// After 3 redirections, return false
if ($step > 3) return false;
@@ -1964,8 +1979,9 @@ function fetchRemote($src, &$dest, $user_agent='Piwigo', $step=0)
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = @curl_exec($ch);
$header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE);
+ $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
@curl_close($ch);
- if ($content !== false)
+ if ($content !== false and $status >= 200 and $status < 400)
{
if (preg_match('/Location:\s+?(.+)/', substr($content, 0, $header_length), $m))
{