aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/site_manager.php93
-rw-r--r--admin/site_reader_remote.php35
-rw-r--r--admin/site_update.php22
3 files changed, 106 insertions, 44 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.'&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'),