mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
remove remote sites feature
git-svn-id: http://piwigo.org/svn/trunk@13488 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -38,43 +38,6 @@ if (!empty($_POST) or isset($_GET['action']))
|
||||
check_pwg_token();
|
||||
}
|
||||
|
||||
/**
|
||||
* requests the given $url (a remote create_listing_file.php) and fills a
|
||||
* list of lines corresponding to request output
|
||||
*
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
function remote_output($url)
|
||||
{
|
||||
global $template, $page;
|
||||
|
||||
if (fetchRemote($url, $result))
|
||||
{
|
||||
$lines = explode("\r\n", $result);
|
||||
// cleaning lines from HTML tags
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
$line = trim(strip_tags($line));
|
||||
if (preg_match('/^PWG-([A-Z]+)-/', $line, $matches))
|
||||
{
|
||||
$template->append(
|
||||
'remote_output',
|
||||
array(
|
||||
'CLASS' => 'remote'.ucfirst(strtolower($matches[1])),
|
||||
'CONTENT' => $line
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($page['errors'], l10n('file create_listing_file.php on remote site was not found'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template init |
|
||||
// +-----------------------------------------------------------------------+
|
||||
@@ -86,14 +49,15 @@ $template->set_filenames(array('site_manager'=>'site_manager.tpl'));
|
||||
if (isset($_POST['submit']) and !empty($_POST['galleries_url']))
|
||||
{
|
||||
$is_remote = url_is_remote( $_POST['galleries_url'] );
|
||||
if ($is_remote)
|
||||
{
|
||||
fatal_error('remote sites not supported');
|
||||
}
|
||||
$url = preg_replace('/[\/]*$/', '', $_POST['galleries_url']);
|
||||
$url.= '/';
|
||||
if (! $is_remote)
|
||||
if ( ! (strpos($url, '.') === 0 ) )
|
||||
{
|
||||
if ( ! (strpos($url, '.') === 0 ) )
|
||||
{
|
||||
$url = './' . $url;
|
||||
}
|
||||
$url = './' . $url;
|
||||
}
|
||||
|
||||
// site must not exists
|
||||
@@ -110,38 +74,10 @@ SELECT COUNT(id) AS count
|
||||
}
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
if ($is_remote)
|
||||
if ( ! file_exists($url) )
|
||||
{
|
||||
if ( ! isset($_POST['no_check']) )
|
||||
{
|
||||
$clf_url = $url.'create_listing_file.php';
|
||||
$get_data = array(
|
||||
'action' => 'test',
|
||||
'version' => PHPWG_VERSION,
|
||||
);
|
||||
if (fetchRemote($clf_url, $result, $get_data))
|
||||
{
|
||||
$lines = explode("\r\n", $result);
|
||||
$first_line = strip_tags($lines[0]);
|
||||
if (!preg_match('/^PWG-INFO-2:/', $first_line))
|
||||
{
|
||||
array_push($page['errors'],
|
||||
l10n('an error happened').' : '.$first_line);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($page['errors'], l10n('file create_listing_file.php on remote site was not found') );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // local directory
|
||||
if ( ! file_exists($url) )
|
||||
{
|
||||
array_push($page['errors'],
|
||||
l10n('Directory does not exist').' ['.$url.']');
|
||||
}
|
||||
array_push($page['errors'],
|
||||
l10n('Directory does not exist').' ['.$url.']');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,24 +112,6 @@ SELECT galleries_url
|
||||
list($galleries_url) = pwg_db_fetch_row(pwg_query($query));
|
||||
switch($_GET['action'])
|
||||
{
|
||||
case 'generate' :
|
||||
{
|
||||
$title = $galleries_url.' : '.l10n('generate listing');
|
||||
remote_output($galleries_url.'create_listing_file.php?action=generate');
|
||||
break;
|
||||
}
|
||||
case 'test' :
|
||||
{
|
||||
$title = $galleries_url.' : '.l10n('test');
|
||||
remote_output($galleries_url.'create_listing_file.php?action=test&version='.PHPWG_VERSION);
|
||||
break;
|
||||
}
|
||||
case 'clean' :
|
||||
{
|
||||
$title = $galleries_url.' : '.l10n('clean');
|
||||
remote_output($galleries_url.'create_listing_file.php?action=clean');
|
||||
break;
|
||||
}
|
||||
case 'delete' :
|
||||
{
|
||||
delete_site($page['site']);
|
||||
@@ -212,23 +130,6 @@ $template->assign(
|
||||
)
|
||||
);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | 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 c.site_id, COUNT(DISTINCT c.id) AS nb_categories, COUNT(i.id) AS nb_images
|
||||
FROM '.CATEGORIES_TABLE.' AS c LEFT JOIN '.IMAGES_TABLE.' AS i
|
||||
@@ -266,16 +167,6 @@ while ($row = pwg_db_fetch_assoc($result))
|
||||
'U_SYNCHRONIZE' => $update_url
|
||||
);
|
||||
|
||||
if ($is_remote)
|
||||
{
|
||||
$tpl_var['remote'] =
|
||||
array(
|
||||
'U_TEST' => $base_url.'test',
|
||||
'U_GENERATE' => $row['galleries_url'].'create_listing_file.php?action=generate',
|
||||
'U_CLEAN' => $base_url.'clean',
|
||||
);
|
||||
}
|
||||
|
||||
if ($row['id'] != 1)
|
||||
{
|
||||
$tpl_var['U_DELETE'] = $base_url.'delete';
|
||||
@@ -289,30 +180,7 @@ while ($row = pwg_db_fetch_assoc($result))
|
||||
$tpl_var['plugin_links'] = $plugin_links;
|
||||
|
||||
$template->append('sites', $tpl_var);
|
||||
|
||||
if ( isset($local_listing_site_url) and
|
||||
$row['galleries_url']==$local_listing_site_url )
|
||||
{
|
||||
$local_listing_site_id = $row['id'];
|
||||
$template->assign( 'local_listing',
|
||||
array(
|
||||
'URL' => $local_listing_site_url,
|
||||
'U_SYNCHRONIZE' => $update_url.'&local_listing=1'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($local_listing_site_url) and !isset($local_listing_site_id) )
|
||||
{
|
||||
$template->assign( 'local_listing',
|
||||
array(
|
||||
'URL' => $local_listing_site_url,
|
||||
'CREATE' => true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'site_manager');
|
||||
?>
|
||||
|
||||
@@ -1,249 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based photo gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | 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 |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
|
||||
// provides data for site synchronization from a remote listing.xml
|
||||
class RemoteSiteReader
|
||||
{
|
||||
|
||||
var $site_url;
|
||||
var $listing_url;
|
||||
var $site_dirs;
|
||||
var $site_files;
|
||||
var $insert_attributes;
|
||||
var $metadata_attributes;
|
||||
|
||||
function RemoteSiteReader($url, $listing_url)
|
||||
{
|
||||
$this->site_url = $url;
|
||||
$this->insert_attributes = array(
|
||||
'tn_ext',
|
||||
);
|
||||
$this->update_attributes = array(
|
||||
'tn_ext', 'representative_ext', 'has_high',
|
||||
);
|
||||
$this->metadata_attributes = array(
|
||||
'filesize', 'width', 'height', 'high_filesize', 'high_width', 'high_height',
|
||||
);
|
||||
|
||||
if (!isset($listing_url))
|
||||
{
|
||||
$this->listing_url = $this->site_url.'listing.xml';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->listing_url = $listing_url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this remote site ok ?
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
function open()
|
||||
{
|
||||
global $errors;
|
||||
|
||||
if ($xml_content = getXmlCode($this->listing_url))
|
||||
{
|
||||
$this->site_dirs = array();
|
||||
$this->site_files = array();
|
||||
$info_xml_element = getChild($xml_content, 'informations');
|
||||
if (getAttribute($info_xml_element , 'phpwg_version') != PHPWG_VERSION)
|
||||
{
|
||||
array_push(
|
||||
$errors,
|
||||
array(
|
||||
'path' => $this->listing_url,
|
||||
'type' => 'PWG-ERROR-VERSION'
|
||||
)
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$additional_metadata = getAttribute($info_xml_element, 'metadata');
|
||||
|
||||
if ($additional_metadata != '')
|
||||
{
|
||||
$this->metadata_attributes = array_merge(
|
||||
$this->metadata_attributes,
|
||||
explode(',', $additional_metadata)
|
||||
);
|
||||
}
|
||||
|
||||
$this->build_structure($xml_content, '', 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push(
|
||||
$errors,
|
||||
array(
|
||||
'path' => $this->listing_url,
|
||||
'type' => 'PWG-ERROR-NOLISTING'
|
||||
)
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// retrieve xml sub-directories fulldirs
|
||||
function get_full_directories($basedir)
|
||||
{
|
||||
$dirs = array();
|
||||
foreach ( array_keys($this->site_dirs) as $dir)
|
||||
{
|
||||
$full_dir = $this->site_url . $dir;
|
||||
if ($full_dir != $basedir
|
||||
and strpos($full_dir, $basedir) === 0
|
||||
)
|
||||
{
|
||||
array_push($dirs, $full_dir);
|
||||
}
|
||||
}
|
||||
return $dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hash with all elements (images and files) inside the full $path
|
||||
* according to listing.xml
|
||||
* @param string $path recurse in this directory only
|
||||
* @return array like "pic.jpg"=>array('tn_ext'=>'jpg' ... )
|
||||
*/
|
||||
function get_elements($path)
|
||||
{
|
||||
$elements = array();
|
||||
foreach ( $this->site_dirs as $dir=>$files)
|
||||
{
|
||||
$full_dir = $this->site_url . $dir;
|
||||
if (strpos($full_dir, $path) === 0)
|
||||
{
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$data = $this->get_element_attributes(
|
||||
$file,
|
||||
$this->insert_attributes
|
||||
);
|
||||
$elements[$file] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
// returns the name of the attributes that are supported for
|
||||
// files update/synchronization
|
||||
function get_update_attributes()
|
||||
{
|
||||
return $this->update_attributes;
|
||||
}
|
||||
|
||||
function get_element_update_attributes($file)
|
||||
{
|
||||
return $this->get_element_attributes(
|
||||
$file,
|
||||
$this->update_attributes
|
||||
);
|
||||
}
|
||||
|
||||
// returns the name of the attributes that are supported for
|
||||
// metadata update/synchronization according to listing.xml
|
||||
function get_metadata_attributes()
|
||||
{
|
||||
return $this->metadata_attributes;
|
||||
}
|
||||
|
||||
// returns a hash of attributes (metadata+width,...) for file
|
||||
function get_element_metadata($file, $has_high = false)
|
||||
{
|
||||
return $this->get_element_attributes(
|
||||
$file,
|
||||
$this->metadata_attributes
|
||||
);
|
||||
}
|
||||
|
||||
//-------------------------------------------------- private functions --------
|
||||
/**
|
||||
* Returns a hash of image/file attributes
|
||||
* @param string $file fully qualified file name
|
||||
* @param array $attributes specifies which attributes to retrieve
|
||||
* returned
|
||||
*/
|
||||
function get_element_attributes($file, $attributes)
|
||||
{
|
||||
$xml_element = $this->site_files[$file];
|
||||
if (!isset($xml_element))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
$data = array();
|
||||
foreach($attributes as $att)
|
||||
{
|
||||
if (getAttribute($xml_element, $att) != '')
|
||||
{
|
||||
$val = getAttribute($xml_element, $att);
|
||||
$data[$att] = addslashes($val);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
// recursively parse the xml_content for later usage
|
||||
function build_structure($xml_content, $basedir, $level)
|
||||
{
|
||||
$temp_dirs = getChildren($xml_content, 'dir'.$level);
|
||||
foreach ($temp_dirs as $temp_dir)
|
||||
{
|
||||
$dir_name = $basedir;
|
||||
if ($dir_name != '' )
|
||||
{
|
||||
$dir_name .= '/';
|
||||
}
|
||||
$dir_name .= getAttribute($temp_dir, 'name');
|
||||
$this->site_dirs[ $dir_name ] = array();
|
||||
$this->build_structure($temp_dir, $dir_name, $level+1);
|
||||
}
|
||||
|
||||
if ($basedir != '')
|
||||
{
|
||||
$xml_elements = getChildren(
|
||||
getChild($xml_content, 'root'),
|
||||
'element'
|
||||
);
|
||||
foreach ($xml_elements as $xml_element)
|
||||
{
|
||||
$path = getAttribute($xml_element, 'path');
|
||||
$this->site_files[$path] = $xml_element;
|
||||
array_push($this->site_dirs[$basedir], $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -58,22 +58,10 @@ $error_labels = array(
|
||||
l10n('wrong filename'),
|
||||
l10n('The name of directories and files must be composed of letters, numbers, "-", "_" or "."')
|
||||
),
|
||||
'PWG-UPDATE-2' => array(
|
||||
l10n('missing thumbnail'),
|
||||
l10n('a picture filetype requires a thumbnail. The thumbnail must be present in the sub-directory "thumbnail" of the album directory. The thumbnail filename must start with the configured thumbnail prefix and the extension must be among the following list :').implode(',', $conf['picture_ext'])
|
||||
),
|
||||
'PWG-ERROR-NO-FS' => array(
|
||||
l10n('File/directory read error'),
|
||||
l10n('The file or directory cannot be accessed (either it does not exist or the access is denied)')
|
||||
),
|
||||
'PWG-ERROR-VERSION' => array(
|
||||
l10n('Piwigo version differs on the remote site'),
|
||||
l10n('Version of create_listing_file.php on the remote site and Piwigo must be the same')
|
||||
),
|
||||
'PWG-ERROR-NOLISTING' => array(
|
||||
l10n('listing.xml file was not found'),
|
||||
l10n('listing.xml file was not found on the remote site. This file is generated by choosing the "generate listing" command in the Site manager')
|
||||
)
|
||||
);
|
||||
$errors = array();
|
||||
$infos = array();
|
||||
@@ -81,14 +69,6 @@ $infos = array();
|
||||
if ($site_is_remote)
|
||||
{
|
||||
fatal_error('remote sites not supported');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/site_reader_remote.php');
|
||||
$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
|
||||
{
|
||||
|
||||
@@ -12,25 +12,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if isset($local_listing)}
|
||||
{'A local listing.xml file has been found for'|@translate} {$local_listing.URL}
|
||||
{if isset($local_listing.CREATE)}
|
||||
<form action="{$F_ACTION}" method="post">
|
||||
<p>
|
||||
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
|
||||
{'Create this site'|@translate}:
|
||||
<input type="hidden" name="no_check" value="1">
|
||||
<input type="hidden" name="galleries_url" value="{$local_listing.URL}">
|
||||
<input type="submit" name="submit" value="{'Submit'|@translate}">
|
||||
</p>
|
||||
</form>
|
||||
{/if}
|
||||
{if isset($local_listing.U_SYNCHRONIZE)}
|
||||
<a href="{$local_listing.U_SYNCHRONIZE}" title="{'read local listing.xml and update'|@translate}">{'Synchronize'|@translate}</a>
|
||||
<br><br>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if not empty($sites)}
|
||||
<table class="table2">
|
||||
<tr class="throw">
|
||||
@@ -46,12 +27,6 @@
|
||||
[<a href="{$site.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|escape:'javascript'}');"
|
||||
title="{'delete this site and all its attached elements'|@translate}">{'delete'|@translate}</a>]
|
||||
{/if}
|
||||
{if isset($site.remote)}
|
||||
<br>
|
||||
[<a href="{$site.remote.U_TEST}" title="{'test this remote site'|@translate}">{'test'|@translate}</a>]
|
||||
[<a href="{$site.remote.U_GENERATE}" title="{'generate file listing.xml on remote site'|@translate}">{'generate listing'|@translate}</a>]
|
||||
[<a href="{$site.remote.U_CLEAN}" title="{'remove remote listing.xml file'|@translate}">{'clean'|@translate}</a>]
|
||||
{/if}
|
||||
{if not empty($site.plugin_links)}
|
||||
<br>
|
||||
{foreach from=$site.plugin_links item=plugin_link}
|
||||
|
||||
@@ -25,7 +25,6 @@ include_once( PHPWG_ROOT_PATH .'include/functions_user.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_cookie.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_session.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_category.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_xml.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_html.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_tag.inc.php' );
|
||||
include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' );
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based photo gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | 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 |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
define( 'ATT_REG', '\w+' );
|
||||
define( 'VAL_REG', '[^"]*' );
|
||||
|
||||
//------------------------------------------------------------------- functions
|
||||
// getContent returns the content of a tag
|
||||
//
|
||||
// example : getContent( "<name>Joe</name>" ) returns "Joe"
|
||||
//
|
||||
// It also works with strings containing themself sub-tags :
|
||||
// <perso><name>Jean</name><firstname>Billie</fisrtname></perso> ->
|
||||
// <name>Jean</name><firstname>Billie</firstname>
|
||||
function getContent( $element )
|
||||
{
|
||||
// deleting start of the tag
|
||||
$content = preg_replace( '/^<[^>]+>/', '', $element );
|
||||
// deleting end of the tag
|
||||
$content = preg_replace( '/<\/[^>]+>$/', '', $content );
|
||||
// replacing multiple instance of space character
|
||||
$content = preg_replace( '/\s+/', ' ', $content );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
// The function get Attribute returns the value corresponding to the
|
||||
// attribute $attribute for the tag $element.
|
||||
function getAttribute( $element, $attribute )
|
||||
{
|
||||
// echo htmlentities($element).'<br /><br />';
|
||||
$regex = '/^<\w+[^>]*\b'.$attribute.'\s*=\s*"('.VAL_REG.')"/i';
|
||||
if ( preg_match( $regex, $element, $out ) )
|
||||
{
|
||||
return html_entity_decode($out[1], ENT_QUOTES);
|
||||
}
|
||||
else return '';
|
||||
}
|
||||
|
||||
// The function encode Attribute returns the xml attribute $attribute="$value"
|
||||
function encodeAttribute( $attribute, $value )
|
||||
{
|
||||
return $attribute.'="'.htmlspecialchars($value, ENT_QUOTES).'" ';
|
||||
}
|
||||
|
||||
// The function getChild returns the first child
|
||||
// exemple : getChild( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" )
|
||||
// returns "<tr>XXX</tr>"
|
||||
function getChild( $document, $node )
|
||||
{
|
||||
$regex = '/<'.$node.'(\s+'.ATT_REG.'="'.VAL_REG.'")*';
|
||||
$regex.= '(\s*\/>|>.*<\/'.$node.'>)/U';
|
||||
|
||||
if
|
||||
(
|
||||
preg_match( $regex, $document, $out )
|
||||
or
|
||||
preg_last_error() == PREG_NO_ERROR
|
||||
)
|
||||
{
|
||||
return $out[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
die('getChild: error ['.preg_last_error().'] with preg_match function');
|
||||
}
|
||||
}
|
||||
|
||||
// getChildren returns a list of the children identified by the $node
|
||||
// example :
|
||||
// getChild( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" )
|
||||
// returns an array with :
|
||||
// $array[0] equals "<tr>XXX</tr>"
|
||||
// $array[1] equals "<tr>YYY</tr>"
|
||||
function getChildren( $document, $node )
|
||||
{
|
||||
$regex = '/<'.$node.'(\s+'.ATT_REG.'="'.VAL_REG.'")*';
|
||||
$regex.= '(\s*\/>|>.*<\/'.$node.'>)/U';
|
||||
|
||||
if
|
||||
(
|
||||
preg_match_all( $regex, $document, $out )
|
||||
or
|
||||
preg_last_error() == PREG_NO_ERROR
|
||||
)
|
||||
{
|
||||
return $out[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
die('getChild: error ['.preg_last_error().'] with preg_match_all function');
|
||||
}
|
||||
}
|
||||
|
||||
// get_CodeXML places the content of a text file in a PHP variable and
|
||||
// return it. If the file can't be opened, returns false.
|
||||
function getXmlCode( $filename )
|
||||
{
|
||||
if (function_exists('ini_set'))
|
||||
{
|
||||
// limit must be growed with php5 and "big" listing file
|
||||
ini_set("pcre.backtrack_limit", pow(2, 31));
|
||||
}
|
||||
|
||||
if (!fetchRemote($filename, $xml_content))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$xml_content = str_replace( "\n", '', $xml_content );
|
||||
$xml_content = str_replace( "\t", '', $xml_content );
|
||||
|
||||
return $xml_content;
|
||||
}
|
||||
?>
|
||||
@@ -85,9 +85,7 @@ $lang['(this tag will be deleted)'] = '(this tag will be deleted)';
|
||||
$lang['+ Add an upload box'] = '+ Add an upload box';
|
||||
$lang[', click on'] = ", click on";
|
||||
$lang['... or '] = '... or ';
|
||||
$lang['A local listing.xml file has been found for'] = "A local listing.xml file has been found for";
|
||||
$lang['A new version of Piwigo is available.'] = "A new version of Piwigo is available.";
|
||||
$lang['a picture filetype requires a thumbnail. The thumbnail must be present in the sub-directory "thumbnail" of the album directory. The thumbnail filename must start with the configured thumbnail prefix and the extension must be among the following list :'] = "a picture filetype requires a thumbnail. The thumbnail must be present in the sub-directory \"thumbnail\" of the album directory. The thumbnail filename must start with the configured thumbnail prefix and the extension must be among the following list :";
|
||||
$lang['Access type'] = "Access type";
|
||||
$lang['ACCESS_0'] = "Free access";
|
||||
$lang['ACCESS_1'] = "Access to all";
|
||||
@@ -298,7 +296,6 @@ $lang['existing album'] = 'existing album';
|
||||
$lang['Extend for templates'] = "Extend templates";
|
||||
$lang['Extensions Update'] = 'Extensions Update';
|
||||
$lang['Failed to write file to disk'] = 'Failed to write file to disk';
|
||||
$lang['file create_listing_file.php on remote site was not found'] = "file create_listing_file.php not found on the remote site";
|
||||
$lang['File upload stopped by extension'] = 'File upload stopped by extension';
|
||||
$lang['File'] = "File";
|
||||
$lang['File/directory read error'] = "File/directory read error";
|
||||
@@ -318,8 +315,6 @@ $lang['Gallery title'] = "Gallery title";
|
||||
$lang['GD library is missing'] = "GD library is missing";
|
||||
$lang['GD version'] = "GD version";
|
||||
$lang['General statistics'] = "General statistics";
|
||||
$lang['generate file listing.xml on remote site'] = "generate file listing.xml on the remote site";
|
||||
$lang['generate listing'] = "generate listing";
|
||||
$lang['Get Support on Piwigo Forum'] = 'Get support on Piwigo forum';
|
||||
$lang['Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'] = 'Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation';
|
||||
$lang['global mode'] = "global mode";
|
||||
@@ -404,8 +399,6 @@ $lang['Level 8'] = "Admins";
|
||||
$lang['Link all album photos to a new album'] = "Link all album photos to a new album";
|
||||
$lang['Link all album photos to some existing albums'] = "Link all album photos to some existing albums";
|
||||
$lang['Linked albums'] = "Linked albums";
|
||||
$lang['listing.xml file was not found on the remote site. This file is generated by choosing the "generate listing" command in the Site manager'] = "listing.xml file not found on the remote site. This file is generated with the \"generate listing\" command in the Site manager";
|
||||
$lang['listing.xml file was not found'] = "listing.xml file not found";
|
||||
$lang['Local'] = "Local";
|
||||
$lang['Lock albums'] = "Lock albums";
|
||||
$lang['Lock gallery'] = "Lock gallery";
|
||||
@@ -448,7 +441,6 @@ $lang['Minimum privacy level'] = "Minimum privacy level";
|
||||
$lang['Miscellaneous'] = 'Miscellaneous';
|
||||
$lang['Missing a temporary folder'] = 'Missing a temporary folder';
|
||||
$lang['Missing Plugins'] = 'Missing Plugins';
|
||||
$lang['missing thumbnail'] = "missing thumbnail";
|
||||
$lang['Modify information'] = "Modify information";
|
||||
$lang['Month'] = "Month";
|
||||
$lang['Move albums'] = "Move albums";
|
||||
@@ -541,7 +533,6 @@ $lang['Piwigo cannot retrieve upgrade file from server'] = 'Piwigo cannot retrie
|
||||
$lang['Piwigo configuration'] = "Piwigo configuration";
|
||||
$lang['Piwigo Update'] = 'Piwigo Update';
|
||||
$lang['Piwigo Uploader'] = 'Piwigo Uploader';
|
||||
$lang['Piwigo version differs on the remote site'] = "Piwigo version differs on the remote site";
|
||||
$lang['Piwigo version'] = "Piwigo version";
|
||||
$lang['pixels'] = 'pixels';
|
||||
$lang['Please check "plugins" folder and sub-folders permissions (CHMOD).'] = "Please check \"plugins\" folder and sub-folders permissions (CHMOD).";
|
||||
@@ -577,7 +568,6 @@ $lang['Rate date'] = "Rate date";
|
||||
$lang['Rate'] = "Rate";
|
||||
$lang['Rating by guests'] = "Rating by guests";
|
||||
$lang['Rating'] = "Rating";
|
||||
$lang['read local listing.xml and update'] = "read local listing.xml and update";
|
||||
$lang['Read Piwigo Documentation'] = 'Read Piwigo Documentation';
|
||||
$lang['reduce to single existing albums'] = "reduce to single existing albums";
|
||||
$lang['Refresh photo set'] = 'Refresh photo set';
|
||||
@@ -593,7 +583,6 @@ $lang['Remove all filters'] = 'Remove all filters';
|
||||
$lang['remove author'] = 'remove author';
|
||||
$lang['remove creation date'] = 'remove creation date';
|
||||
$lang['Remove from caddie'] = 'Remove from caddie';
|
||||
$lang['remove remote listing.xml file'] = "remove remote listing.xml file";
|
||||
$lang['remove tags'] = "remove tags";
|
||||
$lang['remove this filter'] = 'remove this filter';
|
||||
$lang['remove title'] = 'remove title';
|
||||
@@ -778,7 +767,6 @@ $lang['user_status_normal'] = "User";
|
||||
$lang['user_status_webmaster'] = "Webmaster";
|
||||
$lang['Validate'] = "Validate";
|
||||
$lang['Validation'] = "Validation";
|
||||
$lang['Version of create_listing_file.php on the remote site and Piwigo must be the same'] = "Versions of create_listing_file.php on the remote site and Piwigo must be the same";
|
||||
$lang['Version'] = "Version";
|
||||
$lang['Virtual album added'] = "Virtual album added";
|
||||
$lang['Virtual album deleted'] = "Virtual album deleted";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
// this file is provided as an example.
|
||||
// Move it to "create_listing_file.php"
|
||||
// directory if you want to modify default configuration.
|
||||
|
||||
// URL of main gallery
|
||||
// Example : http://www.my.domain/my/directory
|
||||
$conf['gallery'] = 'http://demo.piwigo.net/';
|
||||
|
||||
$conf['file_ext'] = array_merge($conf['file_ext'], array('flv', 'FLV'));
|
||||
|
||||
$conf['force_refresh_method'] = true;
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user