aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-03-28 01:26:37 +0000
committerrvelices <rv-github@modusoptimus.com>2006-03-28 01:26:37 +0000
commit7690f9bb8bfe33b6d0e85c6473f8d39a4fddf0df (patch)
tree80fc0ff864a27cbf3597a0dfbb094fc744cf039d
parent51a4de797c76dbda26741acacbda76013caa5f64 (diff)
fix: php 5 errors and warnings
improve: put back update remote site from local listing.xml functionality (allow_url_fopen is false on several ISPs) git-svn-id: http://piwigo.org/svn/trunk@1107 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/site_manager.php93
-rw-r--r--admin/site_reader_remote.php35
-rw-r--r--admin/site_update.php22
-rw-r--r--include/calendar_base.class.php10
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php1
-rw-r--r--language/fr_FR.iso-8859-1/admin.lang.php1
-rw-r--r--picture.php8
-rw-r--r--template/yoga/admin/site_manager.tpl19
8 files changed, 136 insertions, 53 deletions
diff --git a/admin/site_manager.php b/admin/site_manager.php
index b1cfff58e..6060b603f 100644
--- a/admin/site_manager.php
+++ b/admin/site_manager.php
@@ -6,9 +6,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2006-01-31 21:46:26 -0500 (Tue, 31 Jan 2006) $
-// | last modifier : $Author: rvelices $
-// | revision : $Revision: 1020 $
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
@@ -111,21 +111,24 @@ SELECT COUNT(id) AS count
{
if ($is_remote)
{
- $clf_url = $url.'create_listing_file.php';
- $clf_url.= '?action=test';
- $clf_url.= '&version='.PHPWG_VERSION;
- if ($lines = @file($clf_url))
+ if ( ! isset($_POST['no_check']) )
{
- $first_line = strip_tags($lines[0]);
- if (!preg_match('/^PWG-INFO-2:/', $first_line))
+ $clf_url = $url.'create_listing_file.php';
+ $clf_url.= '?action=test';
+ $clf_url.= '&version='.PHPWG_VERSION;
+ if ($lines = @file($clf_url))
{
- array_push($page['errors'],
- l10n('site_err').' : '.$first_line);
+ $first_line = strip_tags($lines[0]);
+ if (!preg_match('/^PWG-INFO-2:/', $first_line))
+ {
+ array_push($page['errors'],
+ l10n('site_err').' : '.$first_line);
+ }
+ }
+ else
+ {
+ array_push($page['errors'], l10n('site_err_remote_file_not_found') );
}
- }
- else
- {
- array_push($page['errors'], l10n('site_err_remote_file_not_found') );
}
}
else
@@ -210,11 +213,24 @@ $template->assign_vars( array(
// | remote sites list |
// +-----------------------------------------------------------------------+
+if ( is_file(PHPWG_ROOT_PATH.'listing.xml') )
+{
+ $xml_content = getXmlCode(PHPWG_ROOT_PATH.'listing.xml');
+ $local_listing_site_url = getAttribute(
+ getChild($xml_content, 'informations'),
+ 'url'
+ );
+ if ( !url_is_remote($local_listing_site_url) )
+ {
+ $local_listing_site_url = null;
+ }
+}
+
$query = '
SELECT s.*, COUNT(c.id) AS nb_categories, SUM(c.nb_images) AS nb_images
-FROM '.SITES_TABLE.' AS s LEFT JOIN '.CATEGORIES_TABLE.' AS c
-ON s.id=c.site_id
-GROUP BY s.id'.
+ FROM '.SITES_TABLE.' AS s LEFT JOIN '.CATEGORIES_TABLE.' AS c
+ ON s.id=c.site_id
+ GROUP BY s.id'.
';';
$result = pwg_query($query);
@@ -254,12 +270,43 @@ while ($row = mysql_fetch_array($result))
);
}
- if ($row['id'] != 1)
- {
- $template->assign_block_vars( 'sites.site.delete',
- array('U_DELETE' => $base_url.'delete') );
- }
+ if ($row['id'] != 1)
+ {
+ $template->assign_block_vars( 'sites.site.delete',
+ array('U_DELETE' => $base_url.'delete') );
+ }
+
+ if ( isset($local_listing_site_url) and
+ $row['galleries_url']==$local_listing_site_url )
+ {
+ $local_listing_site_id = $row['id'];
+ $template->assign_block_vars( 'local_listing',
+ array(
+ 'URL' => $local_listing_site_url,
+ )
+ );
+
+ $template->assign_block_vars( 'local_listing.update',
+ array(
+ 'U_SYNCHRONIZE' => $update_url.'&amp;local_listing=1'
+ )
+ );
+ }
}
+if ( isset($local_listing_site_url) and !isset($local_listing_site_id) )
+{
+ $template->assign_block_vars( 'local_listing',
+ array(
+ 'URL' => $local_listing_site_url,
+ )
+ );
+
+ $template->assign_block_vars( 'local_listing.create',
+ array('NAME' => $local_listing_site_url)
+ );
+}
+
+
$template->assign_var_from_handle('ADMIN_CONTENT', 'site_manager');
?> \ No newline at end of file
diff --git a/admin/site_reader_remote.php b/admin/site_reader_remote.php
index 1810b955b..03ad7d45a 100644
--- a/admin/site_reader_remote.php
+++ b/admin/site_reader_remote.php
@@ -6,9 +6,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2005-12-03 17:03:58 -0500 (Sat, 03 Dec 2005) $
-// | last modifier : $Author: plg $
-// | revision : $Revision: 967 $
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
@@ -31,12 +31,13 @@ class RemoteSiteReader
{
var $site_url;
+var $listing_url;
var $site_dirs;
var $site_files;
var $insert_attributes;
var $update_attributes;
-function RemoteSiteReader($url)
+function RemoteSiteReader($url, $listing_url)
{
$this->site_url = $url;
$this->insert_attributes = array(
@@ -45,6 +46,15 @@ function RemoteSiteReader($url)
$this->update_attributes = array(
'representative_ext', 'has_high', 'filesize', 'width', 'height'
);
+
+ if (!isset($listing_url))
+ {
+ $this->listing_url = $this->site_url.'/listing.xml';
+ }
+ else
+ {
+ $this->listing_url = $listing_url;
+ }
}
/**
@@ -55,24 +65,23 @@ function RemoteSiteReader($url)
function open()
{
global $errors;
-
- $listing_file = $this->site_url.'/listing.xml';
- if (@fopen($listing_file, 'r'))
+
+ if (@fopen($this->listing_url, 'r'))
{
$this->site_dirs = array();
$this->site_files = array();
- $xml_content = getXmlCode($listing_file);
+ $xml_content = getXmlCode($this->listing_url);
$info_xml_element = getChild($xml_content, 'informations');
if (getAttribute($info_xml_element , 'phpwg_version') != PHPWG_VERSION)
{
array_push(
$errors,
array(
- 'path' => $listing_file,
+ 'path' => $this->listing_url,
'type' => 'PWG-ERROR-VERSION'
)
);
-
+
return false;
}
@@ -80,9 +89,9 @@ function open()
$this->update_attributes,
explode(',', getAttribute($info_xml_element, 'metadata'))
);
-
+
$this->build_structure($xml_content, '', 0);
-
+
return true;
}
else
@@ -90,7 +99,7 @@ function open()
array_push(
$errors,
array(
- 'path' => $listing_file,
+ 'path' => $this->listing_url,
'type' => 'PWG-ERROR-NOLISTING'
)
);
diff --git a/admin/site_update.php b/admin/site_update.php
index e422b697c..b68ce2b28 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -6,9 +6,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2005-12-03 17:03:58 -0500 (Sat, 03 Dec 2005) $
-// | last modifier : $Author: plg $
-// | revision : $Revision: 967 $
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
@@ -86,7 +86,13 @@ $infos = array();
if ($site_is_remote)
{
include_once(PHPWG_ROOT_PATH.'admin/site_reader_remote.php');
- $site_reader = new RemoteSiteReader($site_url);
+ $local_listing = null;
+ if ( isset($_GET['local_listing'])
+ and $_GET['local_listing'] )
+ {
+ $local_listing = PHPWG_ROOT_PATH.'listing.xml';
+ }
+ $site_reader = new RemoteSiteReader($site_url, $local_listing);
}
else
{
@@ -431,7 +437,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
'type' => 'PWG-UPDATE-1'
)
);
-
+
continue;
}
@@ -453,12 +459,12 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
: null,
'path' => $path,
);
-
+
array_push(
$inserts,
$insert
);
-
+
array_push(
$insert_links,
array(
@@ -724,7 +730,7 @@ if (isset($_POST['submit']) and preg_match('/^metadata/', $_POST['sync'])
}
}
$update_fields = $site_reader->get_update_attributes();
- $update_fields = array_merge($update_fields, 'date_metadata_update');
+ $update_fields = array_merge($update_fields, array('date_metadata_update'));
$fields =
array(
'primary' => array('id'),
diff --git a/include/calendar_base.class.php b/include/calendar_base.class.php
index ee17c1ac7..7a1356db8 100644
--- a/include/calendar_base.class.php
+++ b/include/calendar_base.class.php
@@ -5,9 +5,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2006-01-27 02:11:43 +0100 (ven, 27 jan 2006) $
-// | last modifier : $Author: rvelices $
-// | revision : $Revision: 1014 $
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
@@ -181,7 +181,7 @@ class CalendarBase
{
$nav_bar .= '<span class="'.$class_prefix.'">';
$url = duplicate_index_url(
- array('chronology_date'=>array_merge($date_components,$item)),
+ array('chronology_date'=>array_merge($date_components,array($item))),
array( 'start' )
);
$nav_bar .= '<a href="'.$url.'">';
@@ -207,7 +207,7 @@ class CalendarBase
{
$nav_bar .= '<span class="'.$class_prefix.'">';
$url = duplicate_index_url(
- array('chronology_date'=>array_merge($date_components,'any')),
+ array('chronology_date'=>array_merge($date_components,array('any'))),
array( 'start' )
);
$nav_bar .= '<a href="'.$url.'">';
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index fe0d5cd64..f4cd1c294 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -301,6 +301,7 @@ $lang['remote_site_clean'] = 'clean';
$lang['remote_site_clean_hint'] = 'remove remote listing.xml file';
$lang['remote_site_generate'] = 'generate listing';
$lang['remote_site_generate_hint'] = 'generate file listing.xml on remote site';
+$lang['remote_site_local_create'] = 'Create this site';
$lang['remote_site_local_found'] = 'A local listing.xml file has been found for ';
$lang['remote_site_local_update'] = 'read local listing.xml and update';
$lang['remote_site_test'] = 'test';
diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php
index 810716154..a8ede8c34 100644
--- a/language/fr_FR.iso-8859-1/admin.lang.php
+++ b/language/fr_FR.iso-8859-1/admin.lang.php
@@ -301,6 +301,7 @@ $lang['remote_site_clean'] = 'nettoyer';
$lang['remote_site_clean_hint'] = 'supprimer le fichier listing.xml distant';
$lang['remote_site_generate'] = 'générer le listing';
$lang['remote_site_generate_hint'] = 'générer le fichier listing.xml sur le site distant';
+$lang['remote_site_local_create'] = 'Créer ce site';
$lang['remote_site_local_found'] = 'Un fichier listing.xml local a été trouvé pour ';
$lang['remote_site_local_update'] = 'lire le listing.xml local et mettre à jour';
$lang['remote_site_test'] = 'tester';
diff --git a/picture.php b/picture.php
index 98f5dc027..91a944bc9 100644
--- a/picture.php
+++ b/picture.php
@@ -27,7 +27,6 @@
define('PHPWG_ROOT_PATH','./');
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
-include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
include(PHPWG_ROOT_PATH.'include/section_init.inc.php');
// Check Access and exit when user status is not ok
@@ -165,6 +164,7 @@ UPDATE '.CATEGORIES_TABLE.'
}
case 'rate' :
{
+ include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
rate_picture($page['image_id'], $_GET['rate']);
redirect($url_self);
}
@@ -756,8 +756,10 @@ if (isset($_GET['slideshow']))
include(PHPWG_ROOT_PATH.'include/picture_rate.inc.php');
include(PHPWG_ROOT_PATH.'include/picture_comment.inc.php');
-include(PHPWG_ROOT_PATH.'include/picture_metadata.inc.php');
-
+if ($metadata_showable and isset($_GET['metadata']))
+{
+ include(PHPWG_ROOT_PATH.'include/picture_metadata.inc.php');
+}
//------------------------------------------------------------ log informations
pwg_log( 'picture', $title_img, $picture['current']['file'] );
diff --git a/template/yoga/admin/site_manager.tpl b/template/yoga/admin/site_manager.tpl
index 924a910aa..fd07662f9 100644
--- a/template/yoga/admin/site_manager.tpl
+++ b/template/yoga/admin/site_manager.tpl
@@ -1,4 +1,4 @@
-<!-- $Id: remote_site.tpl 980 2005-12-10 15:24:53Z chrisaga $ -->
+<!-- $Id$ -->
<div class="titrePage">
<ul class="categoryActions">
<li><a href="{U_HELP}" onclick="popuphelp(this.href); return false;" title="{lang:Help}"><img src="{themeconf:icon_dir}/help.png" class="button" alt="(?)"></a></li>
@@ -16,6 +16,23 @@
</div>
<!-- END remote_output -->
+<!-- BEGIN local_listing -->
+{lang:remote_site_local_found} {local_listing.URL}
+<!-- BEGIN create -->
+<form action="" method="post">
+ <p>
+ {lang:remote_site_local_create}:
+ <input type="hidden" name="no_check" value="1"/>
+ <input type="hidden" name="galleries_url" value="{local_listing.URL}" />
+ <input type="submit" name="submit" value="{lang:submit}"/>
+ </p>
+</form>
+<!-- END create -->
+<!-- BEGIN update -->
+<a href="{local_listing.update.U_SYNCHRONIZE}" title="{lang:remote_site_local_update}">{lang:site_synchronize}</a>
+<!-- END update -->
+<!-- END local_listing -->
+
<!-- BEGIN sites -->
<table border="1" cellpadding="0" cellspacing="0">
<!-- BEGIN site -->