From 7690f9bb8bfe33b6d0e85c6473f8d39a4fddf0df Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 28 Mar 2006 01:26:37 +0000 Subject: 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 --- admin/site_manager.php | 93 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 23 deletions(-) (limited to 'admin/site_manager.php') 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 -- cgit v1.2.3