aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/category_recent_cats.inc.php19
-rw-r--r--include/category_subcats.inc.php2
-rw-r--r--index.php3
-rw-r--r--tools/create_listing_file.php46
4 files changed, 39 insertions, 31 deletions
diff --git a/include/category_recent_cats.inc.php b/include/category_recent_cats.inc.php
index 44494c9df..ae98426bd 100644
--- a/include/category_recent_cats.inc.php
+++ b/include/category_recent_cats.inc.php
@@ -46,6 +46,7 @@ SELECT c.id AS category_id
, c.comment
, tn_ext
, nb_images
+ , c.name AS cat_name
FROM '.CATEGORIES_TABLE.' AS c
INNER JOIN '.IMAGES_TABLE.' AS i ON i.id = c.representative_picture_id
WHERE date_last > SUBDATE(
@@ -67,13 +68,19 @@ if ($conf['subcatify'])
'mainpage_categories' => 'mainpage_categories.tpl',
)
);
-
+
// template thumbnail initialization
if (mysql_num_rows($result) > 0)
{
$template->assign_block_vars('categories', array());
}
+ $comment = null;
+ if (isset($row['comment']))
+ {
+ $comment = strip_tags($row['comment'], '<a><br><p><b><i><small><strong>');
+ }
+
// for each category, we have to search a recent picture to display and
// the name to display
while ( $row = mysql_fetch_array( $result ) )
@@ -84,15 +91,16 @@ if ($conf['subcatify'])
'SRC' => get_thumbnail_src($row['path'], @$row['tn_ext']),
'ALT' => $row['file'],
'TITLE' => $lang['hint_category'],
-
+
'URL' => make_index_url(
array(
'category' => $row['category_id'],
+ 'cat_name' => $row['cat_name'],
)
),
'NAME' => get_cat_display_name_cache($row['uppercats'], null, false),
'NB_IMAGES' => $row['nb_images'],
- 'DESCRIPTION' => @$row['comment'],
+ 'DESCRIPTION' => $comment,
)
);
}
@@ -110,7 +118,7 @@ else
// current row displayed
$row_number = 0;
}
-
+
$old_level_separator = $conf['level_separator'];
$conf['level_separator'] = '<br />';
// for each category, we have to search a recent picture to display and
@@ -123,10 +131,11 @@ else
'IMAGE' => get_thumbnail_src($row['path'], @$row['tn_ext']),
'IMAGE_ALT' => $row['file'],
'IMAGE_TITLE' => $lang['hint_category'],
-
+
'U_IMG_LINK' => make_index_url(
array(
'category' => $row['category_id'],
+ 'cat_name' => $row['cat_name'],
)
),
)
diff --git a/include/category_subcats.inc.php b/include/category_subcats.inc.php
index 08c883d78..3e31ecc80 100644
--- a/include/category_subcats.inc.php
+++ b/include/category_subcats.inc.php
@@ -94,7 +94,7 @@ SELECT representative_picture_id
$comment = null;
if (isset($row['comment']))
{
- $comment = strip_tags($row['comment']);
+ $comment = strip_tags($row['comment'], '<a><br><p><b><i><small><strong>');
}
if (isset($image_id))
diff --git a/index.php b/index.php
index 1883e67b0..c48242e68 100644
--- a/index.php
+++ b/index.php
@@ -44,7 +44,8 @@ if ( isset( $_GET['act'] )
$_SESSION = array();
session_unset();
session_destroy();
- setcookie(session_name(),'',0, ini_get('session.cookie_path') );
+ setcookie(session_name(),'',0,
+ ini_get('session.cookie_path'), ini_get('session.cookie_domain') );
redirect( make_index_url() );
}
diff --git a/tools/create_listing_file.php b/tools/create_listing_file.php
index fb3786f11..112b4ff14 100644
--- a/tools/create_listing_file.php
+++ b/tools/create_listing_file.php
@@ -82,13 +82,13 @@ $conf['use_iptc_mapping'] = array(
function get_iptc_data($filename, $map)
{
$result = array();
-
+
// Read IPTC data
$iptc = array();
-
+
$imginfo = array();
getimagesize($filename, $imginfo);
-
+
if (isset($imginfo['APP13']))
{
$iptc = iptcparse($imginfo['APP13']);
@@ -135,7 +135,7 @@ function clean_iptc_value($value)
}
// remove binary nulls
$value = str_replace(chr(0x00), ' ', $value);
-
+
return htmlentities($value);
}
@@ -145,7 +145,7 @@ function get_sync_iptc_data($file)
$map = $conf['use_iptc_mapping'];
$datefields = array('date_creation', 'date_available');
-
+
$iptc = get_iptc_data($file, $map);
foreach ($iptc as $pwg_key => $value)
@@ -161,10 +161,8 @@ function get_sync_iptc_data($file)
if (isset($iptc['keywords']))
{
- // keywords separator is the comma, nothing else. Allowed characters in
- // keywords : [A-Za-z0-9], "-" and "_". All other characters will be
- // considered as separators
- $iptc['keywords'] = preg_replace('/[^\w-]+/', ',', $iptc['keywords']);
+ // official keywords separator is the comma
+ $iptc['keywords'] = preg_replace('/[.;]/', ',', $iptc['keywords']);
$iptc['keywords'] = preg_replace('/^,+|,+$/', '', $iptc['keywords']);
}
@@ -242,7 +240,7 @@ function get_thumb_files($dir)
global $conf;
$prefix_length = strlen($conf['prefix_thumbnail']);
-
+
$thumbnails = array();
if ($opendir = @opendir($dir.'/thumbnail'))
{
@@ -349,7 +347,7 @@ function get_dirs($basedir, $indent, $level)
$dirs.= get_dirs($basedir.'/'.$fs_dir, $indent.' ', $level + 1);
$dirs.= "\n".$indent.'</dir'.$level.'>';
}
- return $dirs;
+ return $dirs;
}
// get_extension returns the part of the string after the last "."
@@ -369,7 +367,7 @@ function get_filename_wo_extension($filename)
function get_pictures($dir, $indent)
{
global $conf, $page;
-
+
// fs means FileSystem : $fs_files contains files in the filesystem found
// in $dir that can be managed by PhpWebGallery (see get_pwg_files
// function), $fs_thumbnails contains thumbnails, $fs_representatives
@@ -383,14 +381,14 @@ function get_pictures($dir, $indent)
$print_dir = preg_replace('/^\.\//', '', $dir);
$print_dir = preg_replace('/\/*$/', '/', $print_dir);
-
+
foreach ($fs_files as $fs_file)
{
$element = array();
$element['file'] = $fs_file;
$element['path'] = $page['url'].$print_dir.$fs_file;
$element['filesize'] = floor(filesize($dir.'/'.$fs_file) / 1024);
-
+
$file_wo_ext = get_filename_wo_extension($fs_file);
foreach ($conf['picture_ext'] as $ext)
@@ -408,7 +406,7 @@ function get_pictures($dir, $indent)
}
// 2 cases : the element is a picture or not. Indeed, for a picture
- // thumbnail is mandatory, high is optional and for non picture element,
+ // thumbnail is mandatory, high is optional and for non picture element,
// thumbnail and representative is optionnal
if (in_array(get_extension($fs_file), $conf['picture_ext']))
{
@@ -420,7 +418,7 @@ function get_pictures($dir, $indent)
$element['width'] = $image_size[0];
$element['height'] = $image_size[1];
}
-
+
if ( in_array($fs_file, $fs_highs) )
{
$element['has_high'] = 'true';
@@ -464,7 +462,7 @@ function get_pictures($dir, $indent)
}
}
}
-
+
array_push($elements, $element);
}
else
@@ -492,7 +490,7 @@ function get_pictures($dir, $indent)
break;
}
}
-
+
array_push($elements, $element);
}
}
@@ -537,11 +535,11 @@ switch ($page['action'])
case 'generate' :
{
$start = get_moment();
-
+
$listing = '<informations';
$listing.= ' generation_date="'.date('Y-m-d').'"';
$listing.= ' phpwg_version="'.htmlentities($conf{'version'}).'"';
-
+
$attrs=array();
if ($conf['use_iptc'])
{
@@ -552,16 +550,16 @@ switch ($page['action'])
$attrs = array_merge($attrs, array_keys($conf['use_exif_mapping']) );
}
$listing.= ' metadata="'.implode(',',array_unique($attrs)).'"';
-
+
$end = strrpos($_SERVER['PHP_SELF'], '/') + 1;
$local_folder = substr($_SERVER['PHP_SELF'], 0, $end);
$page['url'] = 'http://'.$_SERVER['HTTP_HOST'].$local_folder;
-
+
$listing.= ' url="'.$page['url'].'"';
$listing.= '/>'."\n";
-
+
$listing.= get_dirs('.', '', 0);
-
+
if ($fp = @fopen("./listing.xml","w"))
{
fwrite($fp, $listing);