aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-03-22 01:01:47 +0000
committerrvelices <rv-github@modusoptimus.com>2006-03-22 01:01:47 +0000
commit0971ce48d217b7cc8081ae70c4b041ab23fdf29c (patch)
tree841bd14e9c2a19c207fb8479b1a086112795d04a
parent3609c224c74f50a9049524ebedc996ddd1187108 (diff)
URL rewriting: capable of fully working with urls without ?
URL rewriting: works with image file instead of image id (change make_picture_url to generate urls with file name instead of image id) URL rewriting: completely works with category/best_rated and picture/best_rated/534 (change 'category.php?' to 'category' in make_index_url and 'picture.php?' to 'picture' in make_picture_url to see it) fix: picture category display in upper bar fix: function rate_picture variables and use of the new user type fix: caddie icon appears now on category page fix: admin element_set sql query was using storage_category_id column (column has moved to #image_categories) fix: replaced some old $_GET[xxx] with $page[xxx] fix: pictures have metadata url (use ? parameter - might change later) git-svn-id: http://piwigo.org/svn/trunk@1092 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/element_set_global.php36
-rw-r--r--admin/picture_modify.php37
-rw-r--r--admin/user_perm.php12
-rw-r--r--category.php26
-rw-r--r--comments.php7
-rw-r--r--include/calendar_base.class.php8
-rw-r--r--include/calendar_monthly.class.php13
-rw-r--r--include/category_default.inc.php2
-rw-r--r--include/category_recent_cats.inc.php8
-rw-r--r--include/common.inc.php2
-rw-r--r--include/functions.inc.php10
-rw-r--r--include/functions_category.inc.php6
-rw-r--r--include/functions_html.inc.php25
-rw-r--r--include/functions_rate.inc.php140
-rw-r--r--include/functions_session.inc.php19
-rw-r--r--include/page_tail.php27
-rw-r--r--include/picture_metadata.inc.php12
-rw-r--r--include/picture_rate.inc.php10
-rw-r--r--include/section_init.inc.php63
-rw-r--r--include/template.php119
-rw-r--r--picture.php23
-rw-r--r--search_rules.php2
-rw-r--r--template/yoga/category.tpl16
-rw-r--r--template/yoga/footer.tpl6
-rw-r--r--template/yoga/header.tpl16
-rw-r--r--template/yoga/picture.tpl24
-rw-r--r--template/yoga/theme/clear/themeconf.inc.php6
-rw-r--r--template/yoga/theme/dark/themeconf.inc.php6
28 files changed, 372 insertions, 309 deletions
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
index 40b5ac6cb..61ef2d6ee 100644
--- a/admin/element_set_global.php
+++ b/admin/element_set_global.php
@@ -28,9 +28,9 @@
/**
* Management of elements set. Elements can belong to a category or to the
* user caddie.
- *
+ *
*/
-
+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
@@ -58,9 +58,9 @@ function get_elements_keywords($element_ids)
{
return array();
}
-
+
$keywords = array();
-
+
$query = '
SELECT keywords
FROM '.IMAGES_TABLE.'
@@ -84,7 +84,7 @@ SELECT keywords
if (isset($_POST['submit']))
{
$collection = array();
-
+
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
@@ -136,7 +136,7 @@ SELECT image_id
)
);
}
-
+
mass_inserts(
IMAGE_CATEGORY_TABLE,
array('image_id', 'category_id'),
@@ -170,7 +170,7 @@ SELECT image_id
array($_POST['dissociate']),
$destinations_of[ $_POST['dissociate'] ]
);
-
+
// Eventually, deletion of associations
$query = '
DELETE
@@ -185,7 +185,7 @@ DELETE
// have deleted the link between C and 1, while it should be kept due to
// B. Who said "complicated"?
check_links();
-
+
update_category($associated_categories);
}
@@ -205,7 +205,7 @@ DELETE
array_push($dbfields['update'], $formfield);
}
}
-
+
// updating elements is useful only if needed...
if (count($dbfields['update']) > 0 and count($collection) > 0)
{
@@ -220,7 +220,7 @@ SELECT id, keywords
{
$data = array();
$data['id'] = $row['id'];
-
+
if (!empty($_POST['add_keywords']))
{
$data['keywords'] =
@@ -241,7 +241,7 @@ SELECT id, keywords
{
$data['keywords'] = empty($row['keywords']) ? '' : $row['keywords'];
}
-
+
$data['keywords'] =
implode(
',',
@@ -287,7 +287,7 @@ SELECT id, keywords
.'-'.$_POST['date_creation_day']
;
}
-
+
array_push($datas, $data);
}
// echo '<pre>'; print_r($datas); echo '</pre>';
@@ -308,18 +308,18 @@ $base_url = PHPWG_ROOT_PATH.'admin.php';
$template->assign_vars(
array(
'CATEGORIES_NAV'=>$page['title'],
-
+
'L_SUBMIT'=>$lang['submit'],
'U_COLS'=>$base_url.get_query_string_diff(array('cols')),
'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
-
+
'U_UNIT_MODE'
=>
$base_url
.get_query_string_diff(array('mode','display'))
.'&amp;mode=unit',
-
+
'F_ACTION'=>$base_url.get_query_string_diff(array()),
)
);
@@ -379,7 +379,7 @@ SELECT DISTINCT(category_id) AS id, c.name, uppercats, global_rank
WHERE ic.image_id IN ('.implode(',', $page['cat_elements_id']).')
AND ic.category_id = c.id
AND ic.image_id = i.id
- AND ic.category_id != i.storage_category_id
+ AND ic.is_storage = \'false\'
;';
display_select_cat_wrapper($query, array(), $blockname, true);
}
@@ -484,7 +484,7 @@ SELECT id,path,tn_ext
while ($row = mysql_fetch_array($result))
{
$src = get_thumbnail_src($row['path'], @$row['tn_ext']);
-
+
$template->assign_block_vars(
'thumbnails.line.thumbnail',
array(
@@ -494,7 +494,7 @@ SELECT id,path,tn_ext
'TITLE' => 'TODO'
)
);
-
+
// create a new line ?
if (++$row_number == $page['cols'])
{
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 05412492c..be7497a07 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -127,7 +127,7 @@ if (isset($_POST['associate'])
and count($_POST['cat_dissociated']) > 0)
{
$datas = array();
-
+
foreach ($_POST['cat_dissociated'] as $category_id)
{
array_push(
@@ -138,7 +138,7 @@ if (isset($_POST['associate'])
)
);
}
-
+
mass_inserts(
IMAGE_CATEGORY_TABLE,
array('image_id', 'category_id'),
@@ -166,7 +166,7 @@ if (isset($_POST['dissociate'])
$destinations
);
}
-
+
$query = '
DELETE FROM '.IMAGE_CATEGORY_TABLE.'
WHERE image_id = '.$_GET['image_id'].'
@@ -213,6 +213,7 @@ SELECT *
$row = mysql_fetch_array(pwg_query($query));
$storage_category_id = $row['category_id'];
+$image_file = $row['file'];
// Navigation path
@@ -236,34 +237,34 @@ $template->assign_vars(
'&amp;image_id='.$_GET['image_id'].
(isset($_GET['cat_id']) ? '&amp;cat_id='.$_GET['cat_id'] : '').
'&amp;sync_metadata=1',
-
+
'PATH'=>$row['path'],
-
+
'TN_SRC' => get_thumbnail_src($row['path'], @$row['tn_ext']),
-
+
'NAME' =>
isset($_POST['name']) ?
stripslashes($_POST['name']) : @$row['name'],
-
+
'DIMENSIONS' => @$row['width'].' * '.@$row['height'],
-
+
'FILESIZE' => @$row['filesize'].' KB',
-
+
'REGISTRATION_DATE' =>
format_date($row['date_available'], 'mysql_datetime', false),
-
+
'AUTHOR' => isset($_POST['author']) ? $_POST['author'] : @$row['author'],
-
+
'CREATION_DATE' => $date,
-
+
'KEYWORDS' =>
isset($_POST['keywords']) ?
stripslashes($_POST['keywords']) : @$row['keywords'],
-
+
'DESCRIPTION' =>
isset($_POST['description']) ?
stripslashes($_POST['description']) : @$row['comment'],
-
+
'F_ACTION' =>
PHPWG_ROOT_PATH.'admin.php'
.get_query_string_diff(array('sync_metadata'))
@@ -292,7 +293,7 @@ else
get_day_list('date_creation_day', $day);
get_month_list('date_creation_month', $month);
$template->assign_vars(array('DATE_CREATION_YEAR_VALUE' => $year));
-
+
$query = '
SELECT category_id, uppercats
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
@@ -315,7 +316,7 @@ while ($row = mysql_fetch_array($result))
PHPWG_ROOT_PATH.'admin.php?page=cat_modify&amp;cat_id=',
false
);
-
+
if ($row['category_id'] == $storage_category_id)
{
$template->assign_vars(array('STORAGE_CATEGORY' => $name));
@@ -354,6 +355,7 @@ if (isset($_GET['cat_id'])
$url_img = make_picture_URL(
array(
'image_id' => $_GET['image_id'],
+ 'image_file' => $image_file,
'category' => $_GET['cat_id'],
)
);
@@ -365,6 +367,7 @@ else
$url_img = make_picture_URL(
array(
'image_id' => $_GET['image_id'],
+ 'image_file' => $image_file,
'category' => $category,
)
);
@@ -381,7 +384,7 @@ if (isset($url_img))
)
);
}
-
+
// associate to another category ?
$query = '
SELECT id,name,uppercats,global_rank
diff --git a/admin/user_perm.php b/admin/user_perm.php
index fdd4be7eb..78409965e 100644
--- a/admin/user_perm.php
+++ b/admin/user_perm.php
@@ -92,19 +92,19 @@ SELECT id
// an error (in SQL statement), so we need to know which categories are
// accesible
$authorized_ids = array();
-
+
$query = '
SELECT cat_id
FROM '.USER_ACCESS_TABLE.'
WHERE user_id = '.$page['user'].'
;';
$result = pwg_query($query);
-
+
while ($row = mysql_fetch_array($result))
{
array_push($authorized_ids, $row['cat_id']);
}
-
+
$inserts = array();
$to_autorize_ids = array_diff($private_uppercats, $authorized_ids);
foreach ($to_autorize_ids as $to_autorize_id)
@@ -137,7 +137,7 @@ $template->assign_vars(
),
'L_CAT_OPTIONS_TRUE'=>$lang['authorized'],
'L_CAT_OPTIONS_FALSE'=>$lang['forbidden'],
-
+
'F_ACTION' =>
PHPWG_ROOT_PATH.
'admin.php?page=user_perm'.
@@ -177,7 +177,7 @@ if (mysql_num_rows($result) > 0)
$template->assign_block_vars(
'groups.category',
array(
- 'NAME' => get_cat_display_name_cache($category['uppercats'], '', false)
+ 'NAME' => get_cat_display_name_cache($category['uppercats'], null, false)
)
);
}
@@ -197,7 +197,7 @@ if (count($group_authorized) > 0)
$query_true.= '
;';
display_select_cat_wrapper($query_true,array(),'category_option_true');
-
+
$result = pwg_query($query_true);
$authorized_ids = array();
while ($row = mysql_fetch_array($result))
diff --git a/category.php b/category.php
index d1c1624ac..58ae4e247 100644
--- a/category.php
+++ b/category.php
@@ -45,8 +45,7 @@ if ( isset( $_GET['act'] )
session_unset();
session_destroy();
setcookie(session_name(),'',0, cookie_path() );
- $url = 'category.php';
- redirect( $url );
+ redirect( make_index_url() );
}
//---------------------------------------------- change of image display order
@@ -113,11 +112,7 @@ $template->set_filenames( array('category'=>'category.tpl') );
//-------------------------------------------------------------- category title
if (isset($page['category']))
{
- $template_title = get_cat_display_name(
- $page['cat_name'],
- 'category.php?/category/',
- false
- );
+ $template_title = get_cat_display_name( $page['cat_name'], '', false );
}
else
{
@@ -206,7 +201,7 @@ if ('search' == $page['section'])
$template->assign_block_vars(
'search_rules',
array(
- 'URL' => PHPWG_ROOT_PATH.'/search_rules.php?search_id='.$page['search'],
+ 'URL' => get_root_url().'search_rules.php?search_id='.$page['search'],
)
);
}
@@ -264,7 +259,7 @@ if ($conf['rate'])
$template->assign_block_vars(
'special_cat',
array(
- 'URL' => PHPWG_ROOT_PATH.'random.php',
+ 'URL' => get_root_url().'random.php',
'TITLE' => $lang['random_cat_hint'],
'NAME' => $lang['random_cat']
));
@@ -395,6 +390,17 @@ if (isset($page['category']) and is_admin())
);
}
+if (is_admin() and !empty($page['items']) )
+{
+ $template->assign_block_vars(
+ 'caddie',
+ array(
+ 'URL' =>
+ add_url_param(duplicate_index_url(),'caddie=1')
+ )
+ );
+ }
+
//------------------------------------------------------ main part : thumbnails
if (isset($page['thumbnails_include']))
{
@@ -453,7 +459,7 @@ if (isset($page['category']))
// upload a picture in the category
if ($page['cat_uploadable'])
{
- $url = PHPWG_ROOT_PATH.'upload.php?cat='.$page['category'];
+ $url = get_root_url().'upload.php?cat='.$page['category'];
$template->assign_block_vars(
'upload',
array(
diff --git a/comments.php b/comments.php
index 8719a58cc..bd332b46e 100644
--- a/comments.php
+++ b/comments.php
@@ -66,7 +66,7 @@ $since_options = array(
'clause' => '1=1') // stupid but generic
);
-$page['since'] = isset($_GET['since']) ? $_GET['since'] : 1;
+$page['since'] = isset($_GET['since']) ? $_GET['since'] : 3;
// on which field sorting
//
@@ -393,7 +393,7 @@ SELECT id, uppercats
{
// name of the picture
$name = get_cat_display_name_cache(
- $categories[$comment['category_id']]['uppercats'], '', false);
+ $categories[$comment['category_id']]['uppercats'], null, false);
$name.= $conf['level_separator'];
if (!empty($elements[$comment['image_id']]['name']))
{
@@ -411,9 +411,6 @@ SELECT id, uppercats
);
// link to the full size picture
- $url = PHPWG_ROOT_PATH.'picture.php?cat='.$comment['category_id'];
- $url.= '&amp;image_id='.$comment['image_id'];
-
$url = make_picture_url(
array(
'category' => $comment['category_id'],
diff --git a/include/calendar_base.class.php b/include/calendar_base.class.php
index 5d358f4ad..ee17c1ac7 100644
--- a/include/calendar_base.class.php
+++ b/include/calendar_base.class.php
@@ -261,8 +261,14 @@ SELECT DISTINCT('.$this->calendar_levels[$level]['sql']
}
}
+ $dates = $page['chronology_date'];
+ while ($level<count($dates))
+ {
+ array_pop($dates);
+ }
+
$nav_bar = $this->get_nav_bar_from_items(
- $page['chronology_date'],
+ $dates,
$level_items,
null,
'calItem',
diff --git a/include/calendar_monthly.class.php b/include/calendar_monthly.class.php
index 0d70ea4c6..1f26e1275 100644
--- a/include/calendar_monthly.class.php
+++ b/include/calendar_monthly.class.php
@@ -224,7 +224,7 @@ function build_global_calendar()
$query.= $this->get_date_where();
$query.= '
GROUP BY period
- ORDER BY YEAR('.$this->date_field.') DESC';
+ ORDER BY YEAR('.$this->date_field.') DESC, MONTH('.$this->date_field.')';
$result = pwg_query($query);
$items=array();
@@ -350,7 +350,9 @@ SELECT file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 as do
$row = mysql_fetch_array(pwg_query($query));
$items[$day]['tn_path'] = get_thumbnail_src($row['path'], @$row['tn_ext']);
- $items[$day]['tn_file'] = $row['file'];
+ $items[$day]['file'] = $row['file'];
+ $items[$day]['path'] = $row['path'];
+ $items[$day]['tn_ext'] = @$row['tn_ext'];
$items[$day]['width'] = $row['width'];
$items[$day]['height'] = $row['height'];
$items[$day]['dow'] = $row['dow'];
@@ -445,7 +447,10 @@ SELECT file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 as do
}
else
{// item not an image (tn is either mime type or an image)
- $tn_size = @getimagesize($items[$day]['tn_path']);
+ $thumb = get_thumbnail_src(
+ $items[$day]['path'], @$items[$day]['tn_ext'], false
+ );
+ $tn_size = @getimagesize($thumb);
}
$tn_width = $tn_size[0];
$tn_height = $tn_size[1];
@@ -548,7 +553,7 @@ SELECT file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 as do
'thumbnails.line.thumbnail',
array(
'IMAGE'=>$data['tn_path'],
- 'IMAGE_ALT'=>$data['tn_file'],
+ 'IMAGE_ALT'=>$data['file'],
'IMAGE_TITLE'=>$thumbnail_title,
'U_IMG_LINK'=>$url
)
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index e7c4b8ddc..47f8fcd27 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -126,7 +126,7 @@ foreach ($pictures as $row)
}
case 'search' :
{
- $name = replace_search($name, $_GET['search']);
+ $name = replace_search($name, $page['search']);
break;
}
}
diff --git a/include/category_recent_cats.inc.php b/include/category_recent_cats.inc.php
index 2bc028ced..a0510db25 100644
--- a/include/category_recent_cats.inc.php
+++ b/include/category_recent_cats.inc.php
@@ -28,7 +28,7 @@
/**
* This file is included by the main page to show thumbnails for recent_cats
* category
- *
+ *
*/
// retrieving categories recently update, ie containing pictures added
@@ -71,7 +71,7 @@ while ( $row = mysql_fetch_array( $result ) )
'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'],
@@ -83,10 +83,10 @@ while ( $row = mysql_fetch_array( $result ) )
$template->assign_block_vars(
'thumbnails.line.thumbnail.category_name',
array(
- 'NAME' => get_cat_display_name_cache($row['uppercats'], '', false),
+ 'NAME' => get_cat_display_name_cache($row['uppercats'], null, false),
)
);
-
+
// create a new line ?
if (++$row_number == $user['nb_image_line'])
{
diff --git a/include/common.inc.php b/include/common.inc.php
index 27949fd17..2b7757819 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -61,7 +61,7 @@ if( !get_magic_quotes_gpc() )
}
@reset($_GET);
}
-
+
if( is_array($_POST) )
{
while( list($k, $v) = each($_POST) )
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 68ba765fe..eb27ce51d 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -202,7 +202,7 @@ function get_dirs($directory)
and $file != '..'
and is_dir($directory.'/'.$file)
and $file != 'CVS'
- and $file != '.svn')
+ and $file != '.svn')
{
array_push($sub_dirs, $file);
}
@@ -356,7 +356,7 @@ function pwg_log( $file, $category, $picture = '' )
if ($conf['log'])
{
if ( ($conf['history_admin'] ) or ( (! $conf['history_admin']) and (!is_admin()) ) )
- {
+ {
$login = ($user['id'] == $conf['guest_id'])
? 'guest' : addslashes($user['username']);
@@ -1141,11 +1141,13 @@ function make_picture_URL($params)
$url =
get_root_url().'picture.php?'
- .'/'.$params['image_id']
.'/'.make_section_in_URL($params)
;
-
$url = add_well_known_params_in_url($url, $params);
+ $url.= '/'.
+ $params['image_id']//.'-'.
+ //get_filename_wo_extension($params['image_file']).'.htm'
+ ;
return $url;
}
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 21560454d..601ec1b64 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -47,9 +47,9 @@ function check_restrictions($category_id)
if (in_array($category_id, explode(',', $user['forbidden_categories'])))
{
$login_url =
- './identification.php?redirect='
+ get_root_url().'identification.php?redirect='
.urlencode(urlencode($_SERVER['REQUEST_URI']));
-
+
if (!$user['is_the_guest'])
{
die('Fatal: you are trying to reach a forbidden category');
@@ -278,7 +278,7 @@ function display_select_categories($categories,
if ($fullname)
{
$option = get_cat_display_name_cache($category['uppercats'],
- '',
+ null,
false);
}
else
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index 8cd69b5ba..37f4d8a59 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -66,6 +66,7 @@ function get_icon($date)
$title .= $user['recent_period'];
$title .= '&nbsp;'.$lang['days'];
$size = getimagesize( $icon_url );
+ $icon_url = get_root_url().$icon_url;
$output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;';
$output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />';
}
@@ -244,7 +245,7 @@ function language_select($default, $select_name = "language")
*
* categories string returned contains categories as given in the input
* array $cat_informations. $cat_informations array must be an association
- * of {category_id => category_name}. If url input parameter is empty,
+ * of {category_id => category_name}. If url input parameter is null,
* returns only the categories name without links.
*
* @param array cat_informations
@@ -253,7 +254,7 @@ function language_select($default, $select_name = "language")
* @return string
*/
function get_cat_display_name($cat_informations,
- $url = 'category.php?/category/',
+ $url = '',
$replace_space = true)
{
global $conf;
@@ -271,10 +272,16 @@ function get_cat_display_name($cat_informations,
$output.= $conf['level_separator'];
}
- if ($url == '')
+ if ( !isset($url) )
{
$output.= $name;
}
+ elseif ($url == '')
+ {
+ $output.= '<a class=""';
+ $output.= ' href="'.make_index_url( array('category'=>$id) ).'">';
+ $output.= $name.'</a>';
+ }
else
{
$output.= '<a class=""';
@@ -306,7 +313,7 @@ function get_cat_display_name($cat_informations,
* @return string
*/
function get_cat_display_name_cache($uppercats,
- $url = 'category.php?/category/',
+ $url = '',
$replace_space = true)
{
global $cat_names, $conf;
@@ -339,10 +346,16 @@ SELECT id,name
$output.= $conf['level_separator'];
}
- if ($url == '')
+ if ( !isset($url) )
{
$output.= $name;
}
+ elseif ($url == '')
+ {
+ $output.= '
+<a class=""
+ href="'.make_index_url( array('category'=>$category_id) ).'">'.$name.'</a>';
+ }
else
{
$output.= '
@@ -474,7 +487,7 @@ function parse_comment_content($content)
}
function get_cat_display_name_from_id($cat_id,
- $url = 'category.php?/category/',
+ $url = '',
$replace_space = true)
{
$cat_info = get_cat_info($cat_id);
diff --git a/include/functions_rate.inc.php b/include/functions_rate.inc.php
index 6eef19af6..32722118f 100644
--- a/include/functions_rate.inc.php
+++ b/include/functions_rate.inc.php
@@ -6,10 +6,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2006-03-15 03:26:25 +0100 (mer, 15 mar 2006) $
-// | last modifier : $Author: rvelices $
-// | revision : $Revision: 1081 $
-// | revision : $Revision: 1081 $
+// | 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 |
@@ -29,137 +28,126 @@
/**
* rate a picture by a user
*
- * @param int user identifier
* @param int image identifier
* @param int rate
* @return void
*/
-function rate_picture($user_id, $image_id, $rate)
+function rate_picture($image_id, $rate)
{
- global $conf;
+ global $conf, $user;
- $query = '
-SELECT status
- FROM '.USER_INFOS_TABLE.'
- WHERE user_id = '.$user_id.'
-;';
- list($user_status) = mysql_fetch_array(pwg_query($query));
-
- if ('guest' == $user_status
- or 'generic' == $user_status)
+ if (!isset($rate)
+ or !$conf['rate']
+ or !in_array($rate, $conf['rate_items']))
{
- $user_anonymous = true;
+ return;
}
- else
+
+ $user_anonymous = is_autorize_status(ACCESS_CLASSIC) ? false : true;
+
+ if ($user_anonymous and !$conf['rate_anonymous'])
{
- $user_anonymous = false;
+ return;
}
-
- if (isset($rate)
- and $conf['rate']
- and (!$user_anonymous or $conf['rate_anonymous'])
- and in_array($rate, $conf['rate_items']))
+
+ if ($user_anonymous)
{
- if ($user_anonymous)
+ $ip_components = explode('.', $_SERVER["REMOTE_ADDR"]);
+ if (count($ip_components) > 3)
{
- $ip_components = explode('.', $_SERVER["REMOTE_ADDR"]);
- if (count($ip_components) > 3)
- {
- array_pop($ip_components);
- }
- $anonymous_id = implode ('.', $ip_components);
-
- if (isset($_COOKIE['pwg_anonymous_rater']))
- {
- if ($anonymous_id != $_COOKIE['pwg_anonymous_rater'])
- { // client has changed his IP adress or he's trying to fool us
- $query = '
+ array_pop($ip_components);
+ }
+ $anonymous_id = implode ('.', $ip_components);
+
+ if (isset($_COOKIE['pwg_anonymous_rater']))
+ {
+ if ($anonymous_id != $_COOKIE['pwg_anonymous_rater'])
+ { // client has changed his IP adress or he's trying to fool us
+ $query = '
SELECT element_id
FROM '.RATE_TABLE.'
WHERE user_id = '.$user['id'].'
AND anonymous_id = \''.$anonymous_id.'\'
;';
- $already_there = array_from_query($query, 'element_id');
-
- if (count($already_there) > 0)
- {
- $query = '
+ $already_there = array_from_query($query, 'element_id');
+
+ if (count($already_there) > 0)
+ {
+ $query = '
DELETE
FROM '.RATE_TABLE.'
WHERE user_id = '.$user['id'].'
AND anonymous_id = \''.$_COOKIE['pwg_anonymous_rater'].'\'
AND element_id NOT IN ('.implode(',', $already_there).')
;';
- pwg_query($query);
- }
+ pwg_query($query);
+ }
- $query = '
+ $query = '
UPDATE
'.RATE_TABLE.'
SET anonymous_id = \'' .$anonymous_id.'\'
WHERE user_id = '.$user['id'].'
AND anonymous_id = \'' . $_COOKIE['pwg_anonymous_rater'].'\'
;';
- pwg_query($query);
+ pwg_query($query);
- setcookie(
+ setcookie(
'pwg_anonymous_rater',
$anonymous_id,
strtotime('+10 years'),
cookie_path()
- );
- }
- }
- else
- {
- setcookie(
+ );
+ } // end client changed ip
+ } // end client has cookie
+ else
+ {
+ setcookie(
'pwg_anonymous_rater',
$anonymous_id,
strtotime('+10 years'),
cookie_path()
);
- }
}
-
- $query = '
+ } // end anonymous user
+ $query = '
DELETE
FROM '.RATE_TABLE.'
WHERE element_id = '.$image_id.'
- AND user_id = '.$user_id.'
+ AND user_id = '.$user['id'].'
';
- if (isset($anonymous_id))
- {
- $query.= ' AND anonymous_id = \''.$anonymous_id.'\'';
- }
- pwg_query($query);
- $query = '
+ if (isset($anonymous_id))
+ {
+ $query.= ' AND anonymous_id = \''.$anonymous_id.'\'';
+ }
+ pwg_query($query);
+ $query = '
INSERT
INTO '.RATE_TABLE.'
(user_id,anonymous_id,element_id,rate,date)
VALUES
('
- .$user_id.','
- .(isset($anonymous_id) ? '\''.$anonymous_id.'\'' : "''").','
- .$image_id.','
- .$rate
- .',NOW())
+ .$user['id'].','
+ .(isset($anonymous_id) ? '\''.$anonymous_id.'\'' : "''").','
+ .$image_id.','
+ .$rate
+ .',NOW())
;';
- pwg_query($query);
-
- // update of images.average_rate field
- $query = '
+ pwg_query($query);
+
+ // update of images.average_rate field
+ $query = '
SELECT ROUND(AVG(rate),2) AS average_rate
FROM '.RATE_TABLE.'
WHERE element_id = '.$image_id.'
;';
- $row = mysql_fetch_array(pwg_query($query));
- $query = '
+ $row = mysql_fetch_array(pwg_query($query));
+ $query = '
UPDATE '.IMAGES_TABLE.'
SET average_rate = '.$row['average_rate'].'
WHERE id = '.$image_id.'
;';
- pwg_query($query);
- }
+ pwg_query($query);
}
?> \ No newline at end of file
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
index 9e1e3f152..482c76376 100644
--- a/include/functions_session.inc.php
+++ b/include/functions_session.inc.php
@@ -81,11 +81,26 @@ function cookie_path()
if ( isset($_SERVER['REDIRECT_URL']) )
{ // mod_rewrite is activated for upper level directories. we must set the
// cookie to the path shown in the browser otherwise it will be discarded.
- $scr = $_SERVER['REDIRECT_URL'];
+ if ( isset($_SERVER['PATH_INFO']) )
+ {
+ $idx = strpos( $_SERVER['REDIRECT_URL'], $_SERVER['PATH_INFO'] );
+ if ($idx !== false)
+ {
+ $scr = substr($_SERVER['REDIRECT_URL'], 0, $idx);
+ }
+ else
+ {//this should never happen
+ $scr='//';
+ }
+ }
+ else
+ {
+ $scr = $_SERVER['REDIRECT_URL'];
+ }
}
else
{
- $scr = $_SERVER['PHP_SELF'];
+ $scr = $_SERVER['SCRIPT_NAME'];
}
return substr($scr,0,strrpos( $scr,'/'));
}
diff --git a/include/page_tail.php b/include/page_tail.php
index 88c813e24..50b433f9e 100644
--- a/include/page_tail.php
+++ b/include/page_tail.php
@@ -29,12 +29,8 @@ $template->set_filenames(array('tail'=>'footer.tpl'));
$template->assign_vars(
array(
'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
-
- 'L_GEN_TIME' => $lang['generation_time'],
- 'L_SQL_QUERIES_IN' => $lang['sql_queries_in'],
- 'L_SEND_MAIL' => $lang['send_mail'],
+
'L_TITLE_MAIL' => urlencode($lang['title_send_mail']),
- 'L_POWERED_BY'=>$lang['powered_by']
));
//--------------------------------------------------------------------- contact
@@ -50,6 +46,7 @@ if (!$user['is_the_guest'])
}
//------------------------------------------------------------- generation time
+$debug_vars = array();
if ($conf['show_gt'])
{
$time = get_elapsed_time($t2, get_moment());
@@ -59,20 +56,22 @@ if ($conf['show_gt'])
$page['count_queries'] = 0;
$page['queries_time'] = 0;
}
-
- $template->assign_block_vars(
- 'debug',
+
+ $debug_vars = array_merge($debug_vars,
array('TIME' => $time,
'NB_QUERIES' => $page['count_queries'],
- 'SQL_TIME' => number_format($page['queries_time'],3,'.',' ').' s'));
+ 'SQL_TIME' => number_format($page['queries_time'],3,'.',' ').' s')
+ );
}
-if ($conf['show_queries'])
+if ($conf['show_queries'])
{
- $template->assign_block_vars(
- 'debug',
- array('QUERIES_LIST' => $debug)
- );
+ $debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug) );
+}
+
+if ( !empty($debug_vars) )
+{
+ $template->assign_block_vars('debug',$debug_vars );
}
//
diff --git a/include/picture_metadata.inc.php b/include/picture_metadata.inc.php
index de910ad07..508ed3a67 100644
--- a/include/picture_metadata.inc.php
+++ b/include/picture_metadata.inc.php
@@ -6,9 +6,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2006-03-09 00:14:53 +0100 (jeu, 09 mar 2006) $
-// | last modifier : $Author: rub $
-// | revision : $Revision: 1070 $
+// | 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 |
@@ -27,10 +27,10 @@
/**
* This file is included by the picture page to manage picture metadata
- *
+ *
*/
-if ($metadata_showable and isset($_GET['show_metadata']))
+if ($metadata_showable and isset($_GET['metadata']))
{
include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
$template->assign_block_vars('metadata', array());
@@ -41,7 +41,7 @@ if ($metadata_showable and isset($_GET['show_metadata']))
die('Exif extension not available, admin should disable exif display');
}
- if ($exif = @read_exif_data($picture['current']['src']))
+ if ($exif = @read_exif_data($picture['current']['src_file_system']))
{
$template->assign_block_vars(
'metadata.headline',
diff --git a/include/picture_rate.inc.php b/include/picture_rate.inc.php
index e994b3e44..86c2486ac 100644
--- a/include/picture_rate.inc.php
+++ b/include/picture_rate.inc.php
@@ -6,9 +6,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2006-03-09 00:14:53 +0100 (jeu, 09 mar 2006) $
-// | last modifier : $Author: rub $
-// | revision : $Revision: 1070 $
+// | 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 |
@@ -54,7 +54,7 @@ SELECT COUNT(rate) AS count
);
}
- if ($conf['rate_anonymous'] or !$user['is_the_guest'])
+ if ($conf['rate_anonymous'] or is_autorize_status(ACCESS_CLASSIC) )
{
if ($row['count']>0)
{
@@ -63,7 +63,7 @@ SELECT COUNT(rate) AS count
WHERE element_id = '.$page['image_id'] . '
AND user_id = '.$user['id'] ;
- if ($user['is_the_guest'])
+ if ( !is_autorize_status(ACCESS_CLASSIC) )
{
$ip_components = explode('.', $_SERVER['REMOTE_ADDR']);
if ( count($ip_components)>3 )
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index d225e7871..80f853d17 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -6,9 +6,9 @@
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
-// | last update : $Date: 2006-01-27 02:11:43 +0100 (ven, 27 jan 2006) $
-// | last modifier : $Author: rvelices $
-// | revision : $Revision: 1014 $
+// | 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 |
@@ -84,17 +84,35 @@ $tokens = explode(
$next_token = 0;
if (basename($_SERVER['SCRIPT_NAME']) == 'picture.php')
-{
-
- // the first token must be the numeric identifier of the picture
- preg_match('/(\d+)/', $tokens[$next_token], $matches);
- if (!isset($matches[1]))
+{ // the last token must be the identifier for the picture
+ $token = array_pop($tokens);
+ if ( is_numeric($token) )
{
- die('Fatal: picture identifier is missing');
+ $page['image_id'] = $token;
+ }
+ else
+ {
+ preg_match('/^(\d+-)?((.*)[_\.]html?)?$/', $token, $matches);
+ if ( isset($matches[1]) and is_numeric($matches[1]) )
+ {
+ $page['image_id'] = $matches[1];
+ if ( !empty($matches[3]) )
+ {
+ $page['image_file'] = $matches[3];
+ }
+ }
+ else
+ {
+ if ( !empty($matches[3]) )
+ {
+ $page['image_file'] = $matches[3];
+ }
+ else
+ {
+ die('Fatal: picture identifier is missing');
+ }
+ }
}
- $page['image_id'] = $matches[1];
-
- $next_token++;
}
if (0 === strpos($tokens[$next_token], 'cat'))
@@ -273,11 +291,11 @@ if ('categories' == $page['section'])
'cat_id_uppercat' => $result['id_uppercat'],
'uppercats' => $result['uppercats'],
- 'title' => get_cat_display_name($result['name'], '', false),
+ 'title' => get_cat_display_name($result['name'], null, false),
)
);
- if (!isset($_GET['calendar']))
+ if (!isset($page['chronology_field']))
{
$query = '
SELECT image_id
@@ -321,7 +339,7 @@ else
SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
- WHERE '.get_sql_search_clause($_GET['search']).'
+ WHERE '.get_sql_search_clause($page['search']).'
AND '.$forbidden.'
'.$conf['order_by'].'
;';
@@ -489,4 +507,19 @@ if (isset($page['chronology_field']))
initialize_calendar();
}
+if (basename($_SERVER['SCRIPT_NAME']) == 'picture.php'
+ and !isset($page['image_id']) )
+{
+ $query = '
+SELECT id,file
+ FROM '.IMAGES_TABLE .'
+ WHERE id IN ('.implode(',',$page['items']).')
+ AND file LIKE "' . $page['image_file'] . '.%" ESCAPE "|"'
+;
+ $result = pwg_query($query);
+ if (mysql_num_rows($result)>0)
+ {
+ list($page['image_id'], $page['image_file']) = mysql_fetch_row($result);
+ }
+}
?> \ No newline at end of file
diff --git a/include/template.php b/include/template.php
index 674e08659..5f2cf7a2c 100644
--- a/include/template.php
+++ b/include/template.php
@@ -34,7 +34,7 @@
class Template {
var $classname = "Template";
-
+
// variable that holds all the data we'll be substituting into
// the compiled templates.
// ...
@@ -43,22 +43,22 @@ class Template {
// if it's a root-level variable, it'll be like this:
// $this->_tpldata[.][0][varname] == value
var $_tpldata = array();
-
+
// Hash of filenames for each template handle.
var $files = array();
-
+
// Root template directory.
var $root = "";
// this will hash handle names to the compiled code for that handle.
var $compiled_code = array();
-
+
// This will hold the uncompiled code for that handle.
var $uncompiled_code = array();
// output
var $output = '';
-
+
/**
* Constructor. Simply sets the root dir.
*
@@ -67,7 +67,7 @@ class Template {
{
$this->set_rootdir($root);
}
-
+
/**
* Destroys this template object. Should be called when you're done with
* it, in order to clear out the template data so you can load/parse a new
@@ -87,11 +87,11 @@ class Template {
{
return false;
}
-
+
$this->root = $dir;
return true;
}
-
+
/**
* Sets the template filenames for handles. $filename_array should be a
* hash of handle => filename pairs.
@@ -102,17 +102,17 @@ class Template {
{
return false;
}
-
+
reset($filename_array);
while(list($handle, $filename) = each($filename_array))
{
$this->files[$handle] = $this->make_filename($filename);
}
-
+
return true;
}
-
-
+
+
/**
* Load the file for the handle, compile the file, and run the compiled
* code. This will print out the results of executing the template.
@@ -123,7 +123,7 @@ class Template {
{
die("Template->pparse(): Couldn't load template file for handle $handle");
}
-
+
// actually compile the template now.
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
{
@@ -146,7 +146,7 @@ class Template {
{
die("Template->pparse(): Couldn't load template file for handle $handle");
}
-
+
// actually compile the template now.
if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
{
@@ -169,7 +169,7 @@ class Template {
{
echo $this->output;
}
-
+
/**
* Inserts the uncompiled code for $handle as the value of $varname in the
* root-level. This can be used to effectively include a template in the
@@ -184,19 +184,19 @@ class Template {
{
die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle");
}
-
+
// Compile it, with the "no echo statements" option on.
$_str = "";
$code = $this->compile($this->uncompiled_code[$handle], true, '_str');
-
+
// evaluate the variable assignment.
eval($code);
// assign the value of the generated variable to the given varname.
$this->assign_var($varname, $_str);
-
+
return true;
}
-
+
/**
* Block-level variable assignment. Adds a new block iteration with the
* given variable assignments. Note that this should only be called once
@@ -220,7 +220,7 @@ class Template {
// We're adding a new iteration to this block with the given
// variable assignments.
$str .= '[\'' . $blocks[$blockcount] . '.\'][] = $vararray;';
-
+
// Now we evaluate this assignment we've built up.
eval($str);
}
@@ -230,10 +230,10 @@ class Template {
// variable assignments we were given.
$this->_tpldata[$blockname . '.'][] = $vararray;
}
-
+
return true;
}
-
+
/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
@@ -245,10 +245,10 @@ class Template {
{
$this->_tpldata['.'][0][$key] = $val;
}
-
+
return true;
}
-
+
/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name.
@@ -256,11 +256,11 @@ class Template {
function assign_var($varname, $varval)
{
$this->_tpldata['.'][0][$varname] = $varval;
-
+
return true;
}
-
-
+
+
/**
* Generates a full path+filename for the given filename, which can either
* be an absolute name, or a name relative to the rootdir for this
@@ -274,7 +274,7 @@ class Template {
{
$filename = $this->root.'/'.$filename;
}
-
+
if (!file_exists($filename))
{
die("Template->make_filename(): Error - file $filename does not exist");
@@ -282,8 +282,8 @@ class Template {
return $filename;
}
-
-
+
+
/**
* If not already done, load the file for the given handle and populate
* the uncompiled_code[] hash with its code. Do not compile.
@@ -297,15 +297,15 @@ class Template {
{
return true;
}
-
+
// If we don't have a file assigned to this handle, die.
if (!isset($this->files[$handle]))
{
die("Template->loadfile(): No file specified for handle $handle");
}
-
+
$filename = $this->files[$handle];
-
+
$str = implode("", @file($filename));
if (empty($str))
{
@@ -328,17 +328,18 @@ class Template {
*/
function compile($code, $do_not_echo = false, $retvar = '')
{
+ $code = preg_replace('/\{pwg_root\}/e', "get_root_url()", $code);
// PWG specific : communication between template and $lang
$code = preg_replace('/\{lang:([^}]+)\}/e', "l10n('$1')", $code);
// PWG specific : expand themeconf.inc.php variables
$code = preg_replace('/\{themeconf:([^}]+)\}/e', "get_themeconf('$1')", $code);
-
+
// replace \ with \\ and then ' with \'.
$code = str_replace('\\', '\\\\', $code);
$code = str_replace('\'', '\\\'', $code);
-
+
// change template varrefs into PHP varrefs
-
+
// This one will handle varrefs WITH namespaces
$varrefs = array();
preg_match_all('#\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
@@ -348,20 +349,20 @@ class Template {
$namespace = $varrefs[1][$i];
$varname = $varrefs[3][$i];
$new = $this->generate_block_varref($namespace, $varname);
-
+
$code = str_replace($varrefs[0][$i], $new, $code);
}
-
+
// This will handle the remaining root-level varrefs
$code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'', $code);
-
+
// Break it up into lines.
$code_lines = explode("\n", $code);
-
+
$block_nesting_level = 0;
$block_names = array();
$block_names[0] = ".";
-
+
// Second: prepend echo ', append ' . "\n"; to each line.
$line_count = sizeof($code_lines);
for ($i = 0; $i < $line_count; $i++)
@@ -371,7 +372,7 @@ class Template {
{
$n[0] = $m[0];
$n[1] = $m[1];
-
+
// Added: dougk_ff7-Keeps templates from bombing if begin is on
// the same line as end.. I think. :)
if ( preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n) )
@@ -388,7 +389,7 @@ class Template {
else
{
// This block is nested.
-
+
// Generate a namespace string for this block.
$namespace = implode('.', $block_names);
// strip leading period from root level..
@@ -401,7 +402,7 @@ class Template {
$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
-
+
// We have the end of a block.
unset($block_names[$block_nesting_level]);
$block_nesting_level--;
@@ -424,7 +425,7 @@ class Template {
else
{
// This block is nested.
-
+
// Generate a namespace string for this block.
$namespace = implode('.', $block_names);
// strip leading period from root level..
@@ -455,18 +456,18 @@ class Template {
}
else
{
- $code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";';
+ $code_lines[$i] = '$' . $retvar . '.= \'' . $code_lines[$i] . '\' . "\\n";';
}
}
}
-
+
// Bring it back into a single string of lines of code.
$code = implode("\n", $code_lines);
return $code ;
-
+
}
-
-
+
+
/**
* Generates a reference to the given variable inside the given (possibly
* nested) block namespace. This is a string of the form: '
@@ -478,21 +479,21 @@ class Template {
{
// Strip the trailing period.
$namespace = substr($namespace, 0, strlen($namespace) - 1);
-
+
// Get a reference to the data block for this namespace.
$varref = $this->generate_block_data_ref($namespace, true);
// Prepend the necessary code to stick this in an echo line.
-
+
// Append the variable reference.
$varref .= '[\'' . $varname . '\']';
-
+
$varref = '\' . ( ( isset(' . $varref . ') ) ? ' . $varref . ' : \'\' ) . \'';
-
+
return $varref;
-
+
}
-
-
+
+
/**
* Generates a reference to the array of data values for the given
* (possibly nested) block namespace. This is a string of the form:
@@ -520,10 +521,10 @@ class Template {
{
$varref .= '[$_' . $blocks[$blockcount] . '_i]';
}
-
+
return $varref;
}
-
+
}
?>
diff --git a/picture.php b/picture.php
index 19ca06dd9..09353aa39 100644
--- a/picture.php
+++ b/picture.php
@@ -168,7 +168,7 @@ UPDATE '.CATEGORIES_TABLE.'
}
case 'rate' :
{
- rate_picture($user['id'], $page['image_id'], $_GET['rate']);
+ rate_picture($page['image_id'], $_GET['rate']);
redirect($url_self);
}
case 'delete_comment' :
@@ -370,14 +370,14 @@ if ( isset( $_GET['slideshow'] ) and isset($page['next_item']) )
}
$title_img = $picture['current']['name'];
-if ( isset( $page['cat'] ) )
+if ( isset( $page['category'] ) )
{
- if (is_numeric( $page['cat'] ))
+ if (is_numeric( $page['category'] ))
{
$title_img = replace_space(get_cat_display_name($page['cat_name']));
}
else if ( $page['cat'] == 'search' )
- {
+ { // ??? TODO -remove or change some remainings from old variables
$title_img = replace_search( $title_img, $_GET['search'] );
}
}
@@ -404,25 +404,20 @@ $picture_size = get_picture_size(
);
// metadata
+$url_metadata = duplicate_picture_URL();
if ($conf['show_exif'] or $conf['show_iptc'])
{
$metadata_showable = true;
+ if ( !isset($_GET['metadata']) )
+ {
+ $url_metadata = add_url_param( $url_metadata, 'metadata' );
+ }
}
else
{
$metadata_showable = false;
}
-// $url_metadata = PHPWG_ROOT_PATH.'picture.php';
-// $url_metadata .= get_query_string_diff(array('add_fav', 'slideshow', 'show_metadata'));
-// if ($metadata_showable and !isset($_GET['show_metadata']))
-// {
-// $url_metadata.= '&amp;show_metadata=1';
-// }
-
-// TODO: rewrite metadata display to toggle on/off user_infos.show_metadata
-$url_metadata = duplicate_picture_URL();
-
$page['body_id'] = 'thePicturePage';
//------------------------------------------------------- navigation management
foreach ( array('first','previous','next','last') as $which_image )
diff --git a/search_rules.php b/search_rules.php
index 3319dc17b..8c3a3df25 100644
--- a/search_rules.php
+++ b/search_rules.php
@@ -140,7 +140,7 @@ SELECT id, uppercats, global_rank
array(
'NAME' => get_cat_display_name_cache(
$category['uppercats'],
- '', // no url on category names
+ null, // no url on category names
false // no blank replacement
)
)
diff --git a/template/yoga/category.tpl b/template/yoga/category.tpl
index 35cb29c88..5705d5824 100644
--- a/template/yoga/category.tpl
+++ b/template/yoga/category.tpl
@@ -91,8 +91,8 @@
<input type="submit" name="login" value="{lang:submit}">
</p>
<ul class="actions">
- <li><a href="{U_LOST_PASSWORD}" title="{lang:Forgot your password?}"><img src="{themeconf:icon_dir}/lost_password.png" class="button" alt="{lang:Forgot your password?}"></a></li>
- <li><a href="{U_REGISTER}" title="{lang:Create a new account}"><img src="{themeconf:icon_dir}/register.png" class="button" alt="{lang:register}"/></a></li>
+ <li><a href="{U_LOST_PASSWORD}" title="{lang:Forgot your password?}"><img src="{pwg_root}{themeconf:icon_dir}/lost_password.png" class="button" alt="{lang:Forgot your password?}"></a></li>
+ <li><a href="{U_REGISTER}" title="{lang:Create a new account}"><img src="{pwg_root}{themeconf:icon_dir}/register.png" class="button" alt="{lang:register}"/></a></li>
</ul>
</fieldset>
@@ -119,25 +119,25 @@
<!-- END preferred_image_order -->
<!-- BEGIN caddie -->
- <li><a href="{caddie.URL}" title="{lang:add to caddie}"><img src="{themeconf:icon_dir}/caddie_add.png" class="button" alt="{lang:caddie}"/></a></li>
+ <li><a href="{caddie.URL}" title="{lang:add to caddie}"><img src="{pwg_root}{themeconf:icon_dir}/caddie_add.png" class="button" alt="{lang:caddie}"/></a></li>
<!-- END caddie -->
<!-- BEGIN edit -->
- <li><a href="{edit.URL}" title="{lang:edit category informations}"><img src="{themeconf:icon_dir}/category_edit.png" class="button" alt="{lang:edit}"/></a></li>
+ <li><a href="{edit.URL}" title="{lang:edit category informations}"><img src="{pwg_root}{themeconf:icon_dir}/category_edit.png" class="button" alt="{lang:edit}"/></a></li>
<!-- END edit -->
<!-- BEGIN search_rules -->
- <li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>
+ <li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{pwg_root}{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>
<!-- END search_rules -->
<!-- BEGIN mode_normal -->
- <li><a href="{mode_normal.URL}" title="{lang:mode_normal_hint}"><img src="{themeconf:icon_dir}/normal_mode.png" class="button" alt="{lang:mode_normal_hint}"></a></li>
+ <li><a href="{mode_normal.URL}" title="{lang:mode_normal_hint}"><img src="{pwg_root}{themeconf:icon_dir}/normal_mode.png" class="button" alt="{lang:mode_normal_hint}"></a></li>
<!-- END mode_normal -->
<!-- BEGIN mode_posted -->
- <li><a href="{mode_posted.URL}" title="{lang:mode_posted_hint}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:mode_posted_hint}"></a></li>
+ <li><a href="{mode_posted.URL}" title="{lang:mode_posted_hint}"><img src="{pwg_root}{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:mode_posted_hint}"></a></li>
<!-- END mode_posted -->
<!-- BEGIN mode_created -->
- <li><a href="{mode_created.URL}" title="{lang:mode_created_hint}"><img src="{themeconf:icon_dir}/calendar_created.png" class="button" alt="{lang:mode_created_hint}"></a></li>
+ <li><a href="{mode_created.URL}" title="{lang:mode_created_hint}"><img src="{pwg_root}{themeconf:icon_dir}/calendar_created.png" class="button" alt="{lang:mode_created_hint}"></a></li>
<!-- END mode_created -->
</ul>
diff --git a/template/yoga/footer.tpl b/template/yoga/footer.tpl
index 9638ba422..44d905995 100644
--- a/template/yoga/footer.tpl
+++ b/template/yoga/footer.tpl
@@ -1,16 +1,16 @@
<div id="copyright">
<!-- BEGIN debug -->
- {L_GEN_TIME} {debug.TIME} ({debug.NB_QUERIES} {L_SQL_QUERIES_IN} {debug.SQL_TIME}) -
+ {lang:generation_time} {debug.TIME} ({debug.NB_QUERIES} {lang:sql_queries_in} {debug.SQL_TIME}) -
<!-- END debug -->
<!-- Please, do not remove this copyright. If you really want to,
contact us on http://phpwebgallery.net to find a solution on how
to show the origin of the script...-->
- {L_POWERED_BY} <a href="http://www.phpwebgallery.net" class="back">PhpWebGallery</a>
+ {lang:powered_by} <a href="http://www.phpwebgallery.net" class="back">PhpWebGallery</a>
{VERSION}
<!-- BEGIN contact -->
- - {L_SEND_MAIL}
+ - {lang:send_mail}
<a href="mailto:{contact.MAIL}?subject={L_TITLE_MAIL}">{lang:Webmaster}</a>
<!-- END contact -->
diff --git a/template/yoga/header.tpl b/template/yoga/header.tpl
index ccf80d74f..94b401e5c 100644
--- a/template/yoga/header.tpl
+++ b/template/yoga/header.tpl
@@ -3,14 +3,14 @@
<html lang="{LANG}" dir="{DIR}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={CONTENT_ENCODING}">
-<link rel="shortcut icon" type="image/x-icon" href="template-common/favicon.ico" />
-<link rel="stylesheet" type="text/css" href="template/{themeconf:template}/default-layout.css">
+<link rel="shortcut icon" type="image/x-icon" href="{pwg_root}template-common/favicon.ico" />
+<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/default-layout.css">
<!-- the next css is used to fix khtml (Konqueror/Safari) issue
the "text/nonsense" prevents gecko based browsers to load it -->
-<link rel="stylesheet" type="text/nonsense" href="template/{themeconf:template}/fix-khtml.css">
-<link rel="stylesheet" type="text/css" media="print" href="template/{themeconf:template}/print.css">
-<link rel="stylesheet" type="text/css" href="template/{themeconf:template}/default-colors.css">
-<link rel="stylesheet" type="text/css" href="template/{themeconf:template}/theme/{themeconf:theme}/theme.css">
+<link rel="stylesheet" type="text/nonsense" href="{pwg_root}template/{themeconf:template}/fix-khtml.css">
+<link rel="stylesheet" type="text/css" media="print" href="{pwg_root}template/{themeconf:template}/print.css">
+<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/default-colors.css">
+<link rel="stylesheet" type="text/css" href="{pwg_root}template/{themeconf:template}/theme/{themeconf:theme}/theme.css">
<!-- BEGIN next -->
<link rel="prefetch" href="{next.U_IMG_SRC}">
<!-- END next -->
@@ -18,9 +18,9 @@ the "text/nonsense" prevents gecko based browsers to load it -->
<meta http-equiv="refresh" content="{REFRESH_TIME};url={U_REFRESH}">
<!-- END refresh -->
<title>{GALLERY_TITLE}:{PAGE_TITLE}</title>
-<script type="text/javascript" src="include/scripts.js"></script>
+<script type="text/javascript" src="{pwg_root}include/scripts.js"></script>
<!--[if gte IE 5.5000]>
-<script type="text/javascript" src="include/pngfix.js"></script>
+<script type="text/javascript" src="{pwg_root}include/pngfix.js"></script>
<![endif]-->
</head>
diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl
index f89eadf64..50fcf5f5f 100644
--- a/template/yoga/picture.tpl
+++ b/template/yoga/picture.tpl
@@ -14,38 +14,38 @@
<div id="imageToolBar">
<div class="randomButtons">
- <a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}" rel="nofollow"><img src="{themeconf:icon_dir}/slideshow.png" class="button" alt="{L_SLIDESHOW}"></a>
- <a href="{U_METADATA}" title="{L_PICTURE_METADATA}"><img src="{themeconf:icon_dir}/metadata.png" class="button" alt="{L_PICTURE_METADATA}"></a>
+ <a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/slideshow.png" class="button" alt="{L_SLIDESHOW}"></a>
+ <a href="{U_METADATA}" title="{L_PICTURE_METADATA}"><img src="{pwg_root}{themeconf:icon_dir}/metadata.png" class="button" alt="{L_PICTURE_METADATA}"></a>
<!-- BEGIN representative -->
- <a href="{representative.URL}" title="{lang:set as category representative}"><img src="{themeconf:icon_dir}/representative.png" class="button" alt="{lang:representative}"/></a>
+ <a href="{representative.URL}" title="{lang:set as category representative}"><img src="{pwg_root}{themeconf:icon_dir}/representative.png" class="button" alt="{lang:representative}"/></a>
<!-- END representative -->
<!-- BEGIN favorite -->
<a href="{favorite.U_FAVORITE}" title="{favorite.FAVORITE_HINT}"><img src="{favorite.FAVORITE_IMG}" class="button" alt="{favorite.FAVORITE_ALT}"></a>
<!-- END favorite -->
<!-- BEGIN download -->
- <a href="{download.U_DOWNLOAD}" title="{L_DOWNLOAD}"><img src="{themeconf:icon_dir}/save.png" class="button" alt="{L_DOWNLOAD}"></a>
+ <a href="{download.U_DOWNLOAD}" title="{L_DOWNLOAD}"><img src="{pwg_root}{themeconf:icon_dir}/save.png" class="button" alt="{L_DOWNLOAD}"></a>
<!-- END download -->
<!-- BEGIN admin -->
- <a href="{U_ADMIN}" title="{L_ADMIN}"><img src="{themeconf:icon_dir}/preferences.png" class="button" alt="{L_ADMIN}"></a>
+ <a href="{U_ADMIN}" title="{L_ADMIN}"><img src="{pwg_root}{themeconf:icon_dir}/preferences.png" class="button" alt="{L_ADMIN}"></a>
<!-- END admin -->
<!-- BEGIN caddie -->
- <a href="{caddie.URL}" title="{lang:add to caddie}"><img src="{themeconf:icon_dir}/caddie_add.png" class="button" alt="{lang:caddie}"/></a>
+ <a href="{caddie.URL}" title="{lang:add to caddie}"><img src="{pwg_root}{themeconf:icon_dir}/caddie_add.png" class="button" alt="{lang:caddie}"/></a>
<!-- END caddie -->
</div>
<div class="navButtons">
<!-- BEGIN last -->
- <a class="navButton prev" href="{last.U_IMG}" rel="last"><img src="{themeconf:icon_dir}/last.png" class="button" alt="{lang:last_page}"></a>
+ <a class="navButton prev" href="{last.U_IMG}" rel="last"><img src="{pwg_root}{themeconf:icon_dir}/last.png" class="button" alt="{lang:last_page}"></a>
<!-- END last -->
<!-- BEGIN next -->
- <a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next"><img src="{themeconf:icon_dir}/right.png" class="button" alt="next"></a>
+ <a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next"><img src="{pwg_root}{themeconf:icon_dir}/right.png" class="button" alt="next"></a>
<!-- END next -->
- <a class="navButton up" href="{U_UP}" title="{L_UP_HINT}" rel="up"><img src="{themeconf:icon_dir}/up.png" class="button" alt="{L_UP_ALT}"></a>
+ <a class="navButton up" href="{U_UP}" title="{L_UP_HINT}" rel="up"><img src="{pwg_root}{themeconf:icon_dir}/up.png" class="button" alt="{L_UP_ALT}"></a>
<!-- BEGIN previous -->
- <a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev"><img src="{themeconf:icon_dir}/left.png" class="button" alt="previous"></a>
+ <a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev"><img src="{pwg_root}{themeconf:icon_dir}/left.png" class="button" alt="previous"></a>
<!-- END previous -->
<!-- BEGIN first -->
- <a class="navButton prev" href="{first.U_IMG}" rel="first"><img src="{themeconf:icon_dir}/first.png" class="button" alt="{lang:first_page}"></a>
+ <a class="navButton prev" href="{first.U_IMG}" rel="first"><img src="{pwg_root}{themeconf:icon_dir}/first.png" class="button" alt="{lang:first_page}"></a>
<!-- END first -->
</div>
@@ -170,7 +170,7 @@
<!-- BEGIN delete -->
<p class="userCommentDelete">
<a href="{comments.comment.delete.U_COMMENT_DELETE}" title="{L_DELETE_COMMENT}">
- <img src="{themeconf:icon_dir}/delete.png" class="button" style="border:none;vertical-align:middle; margin-left:5px;" alt="[{L_DELETE}]"/>
+ <img src="{pwg_root}{themeconf:icon_dir}/delete.png" class="button" style="border:none;vertical-align:middle; margin-left:5px;" alt="[{L_DELETE}]"/>
</a>
</p>
<!-- END delete -->
diff --git a/template/yoga/theme/clear/themeconf.inc.php b/template/yoga/theme/clear/themeconf.inc.php
index 314e697c4..10b5d104b 100644
--- a/template/yoga/theme/clear/themeconf.inc.php
+++ b/template/yoga/theme/clear/themeconf.inc.php
@@ -2,8 +2,8 @@
$themeconf = array(
'template' => 'yoga',
'theme' => 'clear',
- 'icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon',
- 'admin_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/admin',
- 'mime_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/mimetypes/'
+ 'icon_dir' => 'template/yoga/icon',
+ 'admin_icon_dir' => 'template/yoga/icon/admin',
+ 'mime_icon_dir' => 'template/yoga/icon/mimetypes/'
);
?>
diff --git a/template/yoga/theme/dark/themeconf.inc.php b/template/yoga/theme/dark/themeconf.inc.php
index 784920150..9785a2916 100644
--- a/template/yoga/theme/dark/themeconf.inc.php
+++ b/template/yoga/theme/dark/themeconf.inc.php
@@ -2,8 +2,8 @@
$themeconf = array(
'template' => 'yoga',
'theme' => 'dark',
- 'icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon',
- 'admin_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/admin',
- 'mime_icon_dir' => PHPWG_ROOT_PATH.'template/yoga/icon/mimetypes/'
+ 'icon_dir' => 'template/yoga/icon',
+ 'admin_icon_dir' => 'template/yoga/icon/admin',
+ 'mime_icon_dir' => 'template/yoga/icon/mimetypes/'
);
?>