aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/languages.class.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-07-06 14:05:05 +0000
committermistic100 <mistic@piwigo.org>2014-07-06 14:05:05 +0000
commit1633d8ffaa38edb8abb530ef4e28cdc4ee816923 (patch)
treed6768d721c437d1494a9c379c2bd667ae70ea4d3 /admin/include/languages.class.php
parentdbedfd173f087b7b7d6d1aefde09922d986c8429 (diff)
improves regexes parsing plugins metadata
git-svn-id: http://piwigo.org/svn/trunk@28969 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/languages.class.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/admin/include/languages.class.php b/admin/include/languages.class.php
index c4caa2dc9..351e36d53 100644
--- a/admin/include/languages.class.php
+++ b/admin/include/languages.class.php
@@ -158,24 +158,24 @@ UPDATE '.USER_INFOS_TABLE.'
);
$plg_data = implode( '', file($path.'/common.lang.php') );
- if ( preg_match("|Language Name: (.*)|", $plg_data, $val) )
+ if (preg_match("|Language Name:\\s*(.+)|", $plg_data, $val))
{
$language['name'] = trim( $val[1] );
$language['name'] = convert_charset($language['name'], 'utf-8', $target_charset);
}
- if (preg_match("|Version: (.*)|", $plg_data, $val))
+ if (preg_match("|Version:\\s*([\\w.-]+)|", $plg_data, $val))
{
$language['version'] = trim($val[1]);
}
- if ( preg_match("|Language URI: (.*)|", $plg_data, $val) )
+ if (preg_match("|Language URI:\\s*(https?:\\/\\/.+)|", $plg_data, $val))
{
$language['uri'] = trim($val[1]);
}
- if ( preg_match("|Author: (.*)|", $plg_data, $val) )
+ if (preg_match("|Author:\\s*(.+)|", $plg_data, $val))
{
$language['author'] = trim($val[1]);
}
- if ( preg_match("|Author URI: (.*)|", $plg_data, $val) )
+ if (preg_match("|Author URI:\\s*(https?:\\/\\/.+)|", $plg_data, $val))
{
$language['author uri'] = trim($val[1]);
}
@@ -184,6 +184,7 @@ UPDATE '.USER_INFOS_TABLE.'
list( , $extension) = explode('extension_view.php?eid=', $language['uri']);
if (is_numeric($extension)) $language['extension'] = $extension;
}
+
// IMPORTANT SECURITY !
$language = array_map('htmlspecialchars', $language);
$this->fs_languages[$file] = $language;