mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 04:09:56 +03:00
improvement: urls for tags can contain now only the tag or the id and tag
improvement: urls for category can be now id and category names (instead of only id) improvement: added 2 indexes (#image_tag.tag_id and #tags.url_name) improvement: identification, register, search pages automatically set focus on first form input improvement: focus, nofocus css class now valid for all forms fix: category comment is tag stripped in category_subcats.inc.php (otherwise issues with html/scripts inside category comment) git-svn-id: http://piwigo.org/svn/trunk@1131 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
b9a37cd6f0
commit
d700a59172
15 changed files with 246 additions and 101 deletions
|
@ -173,7 +173,7 @@ if (isset($_GET['parent_id']))
|
||||||
$navigation.= $conf['level_separator'];
|
$navigation.= $conf['level_separator'];
|
||||||
|
|
||||||
$current_category = get_cat_info($_GET['parent_id']);
|
$current_category = get_cat_info($_GET['parent_id']);
|
||||||
|
|
||||||
$navigation.= get_cat_display_name(
|
$navigation.= get_cat_display_name(
|
||||||
$current_category['name'],
|
$current_category['name'],
|
||||||
$base_url.'&parent_id=',
|
$base_url.'&parent_id=',
|
||||||
|
@ -194,7 +194,7 @@ if (isset($_GET['parent_id']))
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'CATEGORIES_NAV'=>$navigation,
|
'CATEGORIES_NAV'=>$navigation,
|
||||||
'F_ACTION'=>$form_action,
|
'F_ACTION'=>$form_action,
|
||||||
|
|
||||||
'L_ADD_VIRTUAL'=>$lang['cat_add'],
|
'L_ADD_VIRTUAL'=>$lang['cat_add'],
|
||||||
'L_SUBMIT'=>$lang['submit'],
|
'L_SUBMIT'=>$lang['submit'],
|
||||||
'L_STORAGE'=>$lang['storage'],
|
'L_STORAGE'=>$lang['storage'],
|
||||||
|
@ -203,7 +203,7 @@ $template->assign_vars(array(
|
||||||
'L_EDIT'=>$lang['edit'],
|
'L_EDIT'=>$lang['edit'],
|
||||||
'L_DELETE'=>$lang['delete'],
|
'L_DELETE'=>$lang['delete'],
|
||||||
));
|
));
|
||||||
|
|
||||||
$tpl = array('cat_first','cat_last');
|
$tpl = array('cat_first','cat_last');
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
// | Categories display |
|
// | Categories display |
|
||||||
|
@ -256,10 +256,10 @@ foreach ($categories as $category)
|
||||||
// TODO : not used anymore ?
|
// TODO : not used anymore ?
|
||||||
//$images_folder = PHPWG_ROOT_PATH.'template/';
|
//$images_folder = PHPWG_ROOT_PATH.'template/';
|
||||||
//$images_folder.= $user['template'].'/admin/images';
|
//$images_folder.= $user['template'].'/admin/images';
|
||||||
|
|
||||||
$base_url = PHPWG_ROOT_PATH.'admin.php?page=';
|
$base_url = PHPWG_ROOT_PATH.'admin.php?page=';
|
||||||
$cat_list_url = $base_url.'cat_list';
|
$cat_list_url = $base_url.'cat_list';
|
||||||
|
|
||||||
$self_url = $cat_list_url;
|
$self_url = $cat_list_url;
|
||||||
if (isset($_GET['parent_id']))
|
if (isset($_GET['parent_id']))
|
||||||
{
|
{
|
||||||
|
@ -276,14 +276,15 @@ foreach ($categories as $category)
|
||||||
'U_JUMPTO' => make_index_url(
|
'U_JUMPTO' => make_index_url(
|
||||||
array(
|
array(
|
||||||
'category' => $category['id'],
|
'category' => $category['id'],
|
||||||
|
'cat_name' => $category['name'],
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
|
'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
|
||||||
'U_EDIT' => $base_url.'cat_modify&cat_id='.$category['id'],
|
'U_EDIT' => $base_url.'cat_modify&cat_id='.$category['id'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($category['dir']))
|
if (empty($category['dir']))
|
||||||
{
|
{
|
||||||
$template->assign_block_vars(
|
$template->assign_block_vars(
|
||||||
|
@ -293,7 +294,7 @@ foreach ($categories as $category)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($category['nb_images'] > 0)
|
if ($category['nb_images'] > 0)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars(
|
$template->assign_block_vars(
|
||||||
|
|
|
@ -68,7 +68,7 @@ if (isset($_POST['submit']))
|
||||||
),
|
),
|
||||||
array($data)
|
array($data)
|
||||||
);
|
);
|
||||||
|
|
||||||
set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
|
set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
|
||||||
set_cat_status(array($_GET['cat_id']), $_POST['status']);
|
set_cat_status(array($_GET['cat_id']), $_POST['status']);
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ else if (isset($_POST['submitAdd']))
|
||||||
$_POST['virtual_name'],
|
$_POST['virtual_name'],
|
||||||
(0 == $_POST['parent'] ? null : $_POST['parent'])
|
(0 == $_POST['parent'] ? null : $_POST['parent'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($output_create['error']))
|
if (isset($output_create['error']))
|
||||||
{
|
{
|
||||||
array_push($page['errors'], $output_create['error']);
|
array_push($page['errors'], $output_create['error']);
|
||||||
|
@ -112,7 +112,7 @@ else if (isset($_POST['submitAdd']))
|
||||||
//
|
//
|
||||||
// Add the information in the information list
|
// Add the information in the information list
|
||||||
array_push($page['infos'], $output_create['info']);
|
array_push($page['infos'], $output_create['info']);
|
||||||
|
|
||||||
// Link the new category to the current category
|
// Link the new category to the current category
|
||||||
associate_categories_to_categories(
|
associate_categories_to_categories(
|
||||||
array($_GET['cat_id']),
|
array($_GET['cat_id']),
|
||||||
|
@ -184,7 +184,7 @@ $navigation = get_cat_display_name_cache(
|
||||||
);
|
);
|
||||||
|
|
||||||
$form_action = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$_GET['cat_id'];
|
$form_action = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$_GET['cat_id'];
|
||||||
$status = ($category['status']=='public')?'STATUS_PUBLIC':'STATUS_PRIVATE';
|
$status = ($category['status']=='public')?'STATUS_PUBLIC':'STATUS_PRIVATE';
|
||||||
$lock = ($category['visible']=='true')?'UNLOCKED':'LOCKED';
|
$lock = ($category['visible']=='true')?'UNLOCKED':'LOCKED';
|
||||||
|
|
||||||
if ($category['commentable'] == 'true')
|
if ($category['commentable'] == 'true')
|
||||||
|
@ -208,7 +208,7 @@ else
|
||||||
|
|
||||||
$base_url = PHPWG_ROOT_PATH.'admin.php?page=';
|
$base_url = PHPWG_ROOT_PATH.'admin.php?page=';
|
||||||
$cat_list_url = $base_url.'cat_list';
|
$cat_list_url = $base_url.'cat_list';
|
||||||
|
|
||||||
$self_url = $cat_list_url;
|
$self_url = $cat_list_url;
|
||||||
if (!empty($category['id_uppercat']))
|
if (!empty($category['id_uppercat']))
|
||||||
{
|
{
|
||||||
|
@ -216,16 +216,16 @@ if (!empty($category['id_uppercat']))
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(
|
$template->assign_vars(
|
||||||
array(
|
array(
|
||||||
'CATEGORIES_NAV' => $navigation,
|
'CATEGORIES_NAV' => $navigation,
|
||||||
'CAT_NAME' => $category['name'],
|
'CAT_NAME' => $category['name'],
|
||||||
'CAT_COMMENT' => $category['comment'],
|
'CAT_COMMENT' => $category['comment'],
|
||||||
|
|
||||||
$status => 'checked="checked"',
|
$status => 'checked="checked"',
|
||||||
$lock => 'checked="checked"',
|
$lock => 'checked="checked"',
|
||||||
$commentable => 'checked="checked"',
|
$commentable => 'checked="checked"',
|
||||||
$uploadable => 'checked="checked"',
|
$uploadable => 'checked="checked"',
|
||||||
|
|
||||||
'L_EDIT_NAME' => $lang['name'],
|
'L_EDIT_NAME' => $lang['name'],
|
||||||
'L_STORAGE' => $lang['storage'],
|
'L_STORAGE' => $lang['storage'],
|
||||||
'L_REMOTE_SITE' => $lang['remote_site'],
|
'L_REMOTE_SITE' => $lang['remote_site'],
|
||||||
|
@ -244,12 +244,13 @@ $template->assign_vars(
|
||||||
'U_JUMPTO' => make_index_url(
|
'U_JUMPTO' => make_index_url(
|
||||||
array(
|
array(
|
||||||
'category' => $category['id'],
|
'category' => $category['id'],
|
||||||
|
'cat_name' => $category['name'],
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
|
'U_CHILDREN' => $cat_list_url.'&parent_id='.$category['id'],
|
||||||
'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=cat_modify',
|
'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=cat_modify',
|
||||||
|
|
||||||
'F_ACTION' => $form_action,
|
'F_ACTION' => $form_action,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -295,7 +296,7 @@ SELECT tn_ext,path
|
||||||
$src = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
$src = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||||
$url = PHPWG_ROOT_PATH.'admin.php?page=picture_modify';
|
$url = PHPWG_ROOT_PATH.'admin.php?page=picture_modify';
|
||||||
$url.= '&image_id='.$category['representative_picture_id'];
|
$url.= '&image_id='.$category['representative_picture_id'];
|
||||||
|
|
||||||
$template->assign_block_vars(
|
$template->assign_block_vars(
|
||||||
'representant.picture',
|
'representant.picture',
|
||||||
array(
|
array(
|
||||||
|
@ -349,7 +350,7 @@ else
|
||||||
// the category can be moved in any category but in itself, in any
|
// the category can be moved in any category but in itself, in any
|
||||||
// sub-category
|
// sub-category
|
||||||
$unmovables = get_subcat_ids(array($category['id']));
|
$unmovables = get_subcat_ids(array($category['id']));
|
||||||
|
|
||||||
$blockname = 'move.parent_option';
|
$blockname = 'move.parent_option';
|
||||||
|
|
||||||
$template->assign_block_vars(
|
$template->assign_block_vars(
|
||||||
|
@ -361,13 +362,13 @@ else
|
||||||
'OPTION' => '------------'
|
'OPTION' => '------------'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$query = '
|
$query = '
|
||||||
SELECT id,name,uppercats,global_rank
|
SELECT id,name,uppercats,global_rank
|
||||||
FROM '.CATEGORIES_TABLE.'
|
FROM '.CATEGORIES_TABLE.'
|
||||||
WHERE id NOT IN ('.implode(',', $unmovables).')
|
WHERE id NOT IN ('.implode(',', $unmovables).')
|
||||||
;';
|
;';
|
||||||
|
|
||||||
display_select_cat_wrapper(
|
display_select_cat_wrapper(
|
||||||
$query,
|
$query,
|
||||||
empty($category['id_uppercat']) ? array() : array($category['id_uppercat']),
|
empty($category['id_uppercat']) ? array() : array($category['id_uppercat']),
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is included by the main page to show thumbnails for a category
|
* This file is included by the main page to show thumbnails for a category
|
||||||
* that have only subcategories
|
* that have only subcategories
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$query = '
|
$query = '
|
||||||
|
@ -90,6 +90,12 @@ SELECT representative_picture_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$comment = null;
|
||||||
|
if ( isset($row['comment']) )
|
||||||
|
{
|
||||||
|
$comment = strip_tags( $row['comment'] );
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($image_id))
|
if (isset($image_id))
|
||||||
{
|
{
|
||||||
array_push(
|
array_push(
|
||||||
|
@ -99,7 +105,7 @@ SELECT representative_picture_id
|
||||||
'picture' => $image_id,
|
'picture' => $image_id,
|
||||||
'name' => $row['name'],
|
'name' => $row['name'],
|
||||||
'date_last' => @$row['date_last'],
|
'date_last' => @$row['date_last'],
|
||||||
'comment' => @$row['comment'],
|
'comment' => $comment,
|
||||||
'nb_images' => $row['nb_images'],
|
'nb_images' => $row['nb_images'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -111,7 +117,7 @@ SELECT representative_picture_id
|
||||||
if (count($cat_thumbnails) > 0)
|
if (count($cat_thumbnails) > 0)
|
||||||
{
|
{
|
||||||
$images = array();
|
$images = array();
|
||||||
|
|
||||||
foreach ($cat_thumbnails as $item)
|
foreach ($cat_thumbnails as $item)
|
||||||
{
|
{
|
||||||
$images[$item['picture']] = '';
|
$images[$item['picture']] = '';
|
||||||
|
@ -129,7 +135,7 @@ SELECT id, path, tn_ext
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('categories', array());
|
$template->assign_block_vars('categories', array());
|
||||||
|
|
||||||
foreach ($cat_thumbnails as $item)
|
foreach ($cat_thumbnails as $item)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars(
|
$template->assign_block_vars(
|
||||||
|
@ -139,10 +145,11 @@ SELECT id, path, tn_ext
|
||||||
'ALT' => $item['name'],
|
'ALT' => $item['name'],
|
||||||
'TITLE' => $lang['hint_category'],
|
'TITLE' => $lang['hint_category'],
|
||||||
'ICON' => get_icon(@$item['date_last']),
|
'ICON' => get_icon(@$item['date_last']),
|
||||||
|
|
||||||
'URL' => make_index_url(
|
'URL' => make_index_url(
|
||||||
array(
|
array(
|
||||||
'category' => $item['category'],
|
'category' => $item['category'],
|
||||||
|
'cat_name' => $item['name'],
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'NAME' => $item['name'],
|
'NAME' => $item['name'],
|
||||||
|
@ -152,4 +159,4 @@ SELECT id, path, tn_ext
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -424,20 +424,29 @@ $conf['history_admin'] = false;
|
||||||
// (depends on the server AcceptPathInfo directive configuration)
|
// (depends on the server AcceptPathInfo directive configuration)
|
||||||
$conf['question_mark_in_urls'] = true;
|
$conf['question_mark_in_urls'] = true;
|
||||||
|
|
||||||
// picture_url_style : one of 'id' 'id-file' or 'file'. 'id-file' or 'file'
|
|
||||||
// mean that the file name (without extension will appear in the url).
|
|
||||||
// Note that one aditionnal sql query will occur if 'file' is choosen.
|
|
||||||
// Note that you might experience navigation issues if you choose 'file'
|
|
||||||
// and your file names are not unique
|
|
||||||
$conf['picture_url_style'] = 'id';
|
|
||||||
|
|
||||||
|
|
||||||
// php_extension_in_urls : if true, the urls generated for picture and
|
// php_extension_in_urls : if true, the urls generated for picture and
|
||||||
// category will not contain the .php extension. This will work only if
|
// category will not contain the .php extension. This will work only if
|
||||||
// .htaccess defines Options +MultiViews parameter or url rewriting rules
|
// .htaccess defines Options +MultiViews parameter or url rewriting rules
|
||||||
// are active.
|
// are active.
|
||||||
$conf['php_extension_in_urls'] = true;
|
$conf['php_extension_in_urls'] = true;
|
||||||
|
|
||||||
|
// category_url_style : one of 'id' (default) or 'id-name'. 'id-name'
|
||||||
|
// means that an simplified ascii represntation of the category name will
|
||||||
|
// appear in the url
|
||||||
|
$conf['category_url_style'] = 'id';
|
||||||
|
|
||||||
|
// picture_url_style : one of 'id' (default), 'id-file' or 'file'. 'id-file'
|
||||||
|
// or 'file' mean that the file name (without extension will appear in the
|
||||||
|
// url). Note that one aditionnal sql query will occur if 'file' is choosen.
|
||||||
|
// Note that you might experience navigation issues if you choose 'file'
|
||||||
|
// and your file names are not unique
|
||||||
|
$conf['picture_url_style'] = 'id';
|
||||||
|
|
||||||
|
// tag_url_style : one of 'id-tag' (default), 'id' or 'tag'.
|
||||||
|
// Note that if you choose 'tag' and the url (ascii) representation of your
|
||||||
|
// tags is not unique, all tags with the same url representation will be shown
|
||||||
|
$conf['tag_url_style'] = 'id-tag';
|
||||||
|
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
// | tags |
|
// | tags |
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
|
@ -290,10 +290,10 @@ function str2url($str)
|
||||||
$str = str_replace('¼', 'OE', $str);
|
$str = str_replace('¼', 'OE', $str);
|
||||||
$str = str_replace('½', 'oe', $str);
|
$str = str_replace('½', 'oe', $str);
|
||||||
|
|
||||||
$str = preg_replace('/[^a-z0-9_\s\'\:\/\[\]-]/','',strtolower($str));
|
$str = preg_replace('/[^a-z0-9_\s\'\:\/\[\],-]/','',strtolower($str));
|
||||||
$str = preg_replace('/[\s\'\:\/\[\]-]+/',' ',trim($str));
|
$str = preg_replace('/[\s\'\:\/\[\],-]+/',' ',trim($str));
|
||||||
$res = str_replace(' ','_',$str);
|
$res = str_replace(' ','_',$str);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,14 @@ function get_cat_display_name($cat_informations,
|
||||||
elseif ($url == '')
|
elseif ($url == '')
|
||||||
{
|
{
|
||||||
$output.= '<a class=""';
|
$output.= '<a class=""';
|
||||||
$output.= ' href="'.make_index_url( array('category'=>$id) ).'">';
|
$output.= ' href="'
|
||||||
|
.make_index_url(
|
||||||
|
array(
|
||||||
|
'category'=>$id,
|
||||||
|
'cat_name'=>$name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.'">';
|
||||||
$output.= $name.'</a>';
|
$output.= $name.'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -353,7 +360,14 @@ SELECT id,name
|
||||||
{
|
{
|
||||||
$output.= '
|
$output.= '
|
||||||
<a class=""
|
<a class=""
|
||||||
href="'.make_index_url( array('category'=>$category_id) ).'">'.$name.'</a>';
|
href="'
|
||||||
|
.make_index_url(
|
||||||
|
array(
|
||||||
|
'category'=>$category_id,
|
||||||
|
'cat_name'=>$name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.'">'.$name.'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -423,7 +437,12 @@ function get_html_menu_category($categories)
|
||||||
}
|
}
|
||||||
$menu.= '>';
|
$menu.= '>';
|
||||||
|
|
||||||
$url = make_index_url(array('category' => $category['id']));
|
$url = make_index_url(
|
||||||
|
array(
|
||||||
|
'category'=>$category['id'],
|
||||||
|
'cat_name'=>$category['name']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$menu.= "\n".'<a href="'.$url.'"';
|
$menu.= "\n".'<a href="'.$url.'"';
|
||||||
if ($page_cat != 0
|
if ($page_cat != 0
|
||||||
|
@ -509,7 +528,7 @@ function get_html_tag_selection(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$output = '<ul class="tagSelection">';
|
$output = '<ul class="tagSelection">';
|
||||||
foreach ($tags as $tag)
|
foreach ($tags as $tag)
|
||||||
{
|
{
|
||||||
|
@ -524,7 +543,7 @@ function get_html_tag_selection(
|
||||||
{
|
{
|
||||||
$output.= ' checked="checked"';
|
$output.= ' checked="checked"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output.=
|
$output.=
|
||||||
' />'
|
' />'
|
||||||
.' '.$tag['name']
|
.' '.$tag['name']
|
||||||
|
|
|
@ -256,6 +256,7 @@ function add_well_known_params_in_url($url, $params)
|
||||||
*/
|
*/
|
||||||
function make_section_in_URL($params)
|
function make_section_in_URL($params)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
$section_string = '';
|
$section_string = '';
|
||||||
|
|
||||||
$section_of = array(
|
$section_of = array(
|
||||||
|
@ -289,6 +290,19 @@ function make_section_in_URL($params)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$section_string.= '/category/'.$params['category'];
|
$section_string.= '/category/'.$params['category'];
|
||||||
|
if ($conf['category_url_style']=='id-name' and isset($params['cat_name']) )
|
||||||
|
{
|
||||||
|
if ( is_string($params['cat_name']) )
|
||||||
|
{
|
||||||
|
$section_string.= '-'.str2url($params['cat_name']);
|
||||||
|
}
|
||||||
|
elseif ( is_array( $params['cat_name'] ) and
|
||||||
|
isset( $params['cat_name'][$params['category']] ) )
|
||||||
|
{
|
||||||
|
$section_string.= '-'
|
||||||
|
.str2url($params['cat_name'][$params['category']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -304,11 +318,23 @@ function make_section_in_URL($params)
|
||||||
|
|
||||||
foreach ($params['tags'] as $tag)
|
foreach ($params['tags'] as $tag)
|
||||||
{
|
{
|
||||||
$section_string.= '/'.$tag['id'];
|
switch ( $conf['tag_url_style'] )
|
||||||
|
|
||||||
if (isset($tag['url_name']))
|
|
||||||
{
|
{
|
||||||
$section_string.= '-'.$tag['url_name'];
|
case 'id':
|
||||||
|
$section_string.= '/'.$tag['id'];
|
||||||
|
break;
|
||||||
|
case 'tag':
|
||||||
|
if (isset($tag['url_name']) and !is_numeric($tag['url_name']) )
|
||||||
|
{
|
||||||
|
$section_string.= '/'.$tag['url_name'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
$section_string.= '/'.$tag['id'];
|
||||||
|
if (isset($tag['url_name']))
|
||||||
|
{
|
||||||
|
$section_string.= '-'.$tag['url_name'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ else
|
||||||
}
|
}
|
||||||
$page['root_path'] = PHPWG_ROOT_PATH;
|
$page['root_path'] = PHPWG_ROOT_PATH;
|
||||||
}
|
}
|
||||||
//phpinfo();
|
|
||||||
// deleting first "/" if displayed
|
// deleting first "/" if displayed
|
||||||
$tokens = explode(
|
$tokens = explode(
|
||||||
'/',
|
'/',
|
||||||
|
@ -147,33 +147,58 @@ else if (0 === strpos($tokens[$next_token], 'tag'))
|
||||||
$next_token++;
|
$next_token++;
|
||||||
$i = $next_token;
|
$i = $next_token;
|
||||||
|
|
||||||
|
$requested_tag_ids = array();
|
||||||
|
$requested_tag_url_names = array();
|
||||||
|
|
||||||
while (isset($tokens[$i]))
|
while (isset($tokens[$i]))
|
||||||
{
|
{
|
||||||
preg_match('/^(\d+)(?:-(.*))?/', $tokens[$i], $matches);
|
if ( preg_match('/^(created-|posted-|start-(\d)+)/', $tokens[$i]) )
|
||||||
if (!isset($matches[1]))
|
break;
|
||||||
|
|
||||||
|
if ( preg_match('/^(\d+)(?:-(.*))?/', $tokens[$i], $matches) )
|
||||||
{
|
{
|
||||||
if (0 == count($page['tags']))
|
array_push($requested_tag_ids, $matches[1]);
|
||||||
{
|
}
|
||||||
die('Fatal: at least one tag required');
|
else
|
||||||
}
|
{
|
||||||
else
|
array_push($requested_tag_url_names, "'".$tokens[$i]."'");
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push(
|
|
||||||
$page['tags'],
|
|
||||||
array(
|
|
||||||
'id' => $matches[1],
|
|
||||||
'url_name' => isset($matches[2]) ? $matches[2] : '',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$next_token = $i;
|
$next_token = $i;
|
||||||
|
|
||||||
|
if ( empty($requested_tag_ids) && empty($requested_tag_url_names) )
|
||||||
|
{
|
||||||
|
die('Fatal: at least one tag required');
|
||||||
|
}
|
||||||
|
// tag infos
|
||||||
|
$query = '
|
||||||
|
SELECT name, url_name, id
|
||||||
|
FROM '.TAGS_TABLE.'
|
||||||
|
WHERE ';
|
||||||
|
if ( !empty($requested_tag_ids) )
|
||||||
|
{
|
||||||
|
$query.= 'id IN ('.implode(',', $requested_tag_ids ).')';
|
||||||
|
}
|
||||||
|
if ( !empty($requested_tag_url_names) )
|
||||||
|
{
|
||||||
|
if ( !empty($requested_tag_ids) )
|
||||||
|
{
|
||||||
|
$query.= ' OR ';
|
||||||
|
}
|
||||||
|
$query.= 'url_name IN ('.implode(',', $requested_tag_url_names ).')';
|
||||||
|
}
|
||||||
|
$result = pwg_query($query);
|
||||||
|
$tag_infos = array();
|
||||||
|
while ($row = mysql_fetch_array($result))
|
||||||
|
{
|
||||||
|
$tag_infos[ $row['id'] ] = $row;
|
||||||
|
array_push($page['tags'], $row );//we loose given tag order; is it important?
|
||||||
|
}
|
||||||
|
if ( empty($page['tags']) )
|
||||||
|
{
|
||||||
|
die('Fatal: no existing tag');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (0 === strpos($tokens[$next_token], 'fav'))
|
else if (0 === strpos($tokens[$next_token], 'fav'))
|
||||||
{
|
{
|
||||||
|
@ -239,7 +264,7 @@ while (isset($tokens[$i]))
|
||||||
$page['start'] = $matches[1];
|
$page['start'] = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^posted|created/', $tokens[$i] ))
|
if (preg_match('/^(posted|created)/', $tokens[$i] ))
|
||||||
{
|
{
|
||||||
$chronology_tokens = explode('-', $tokens[$i] );
|
$chronology_tokens = explode('-', $tokens[$i] );
|
||||||
|
|
||||||
|
@ -359,7 +384,7 @@ else
|
||||||
// permissions depends on category, so to only keep images that are
|
// permissions depends on category, so to only keep images that are
|
||||||
// reachable to the connected user, we need to check category
|
// reachable to the connected user, we need to check category
|
||||||
// associations
|
// associations
|
||||||
if (!empty($user['forbidden_categories']) and !empty($items) )
|
if (!empty($items) )
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT image_id
|
SELECT image_id
|
||||||
|
@ -373,21 +398,6 @@ SELECT image_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tag names
|
|
||||||
$query = '
|
|
||||||
SELECT name, url_name, id
|
|
||||||
FROM '.TAGS_TABLE.'
|
|
||||||
WHERE id IN ('.implode(',', $page['tag_ids']).')
|
|
||||||
;';
|
|
||||||
$result = pwg_query($query);
|
|
||||||
$tag_infos = array();
|
|
||||||
|
|
||||||
while ($row = mysql_fetch_array($result))
|
|
||||||
{
|
|
||||||
$tag_infos[ $row['id'] ]['name'] = $row['name'];
|
|
||||||
$tag_infos[ $row['id'] ]['url_name'] = $row['url_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = count($page['tags']) > 1 ? l10n('Tags') : l10n('Tag');
|
$title = count($page['tags']) > 1 ? l10n('Tags') : l10n('Tag');
|
||||||
$title.= ' ';
|
$title.= ' ';
|
||||||
|
|
||||||
|
|
58
install/db/22-database.php
Normal file
58
install/db/22-database.php
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | PhpWebGallery - a PHP based picture gallery |
|
||||||
|
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||||
|
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | branch : BSF (Best So Far)
|
||||||
|
// | file : $RCSfile$
|
||||||
|
// | last update : $Date: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $
|
||||||
|
// | last modifier : $Author: plg $
|
||||||
|
// | revision : $Revision: 870 $
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | 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. |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
if (!defined('PHPWG_ROOT_PATH'))
|
||||||
|
{
|
||||||
|
die('Hacking attempt!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$upgrade_description = 'add index on #tags.url_name and #image_tag.tag_id ';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$query = '
|
||||||
|
ALTER TABLE '.PREFIX_TABLE.'tags ADD INDEX `tags_i1`(`url_name`);
|
||||||
|
;';
|
||||||
|
pwg_query($query);
|
||||||
|
|
||||||
|
|
||||||
|
$query = '
|
||||||
|
ALTER TABLE '.PREFIX_TABLE.'image_tag ADD INDEX `image_tag_i1`(`tag_id`);
|
||||||
|
;';
|
||||||
|
pwg_query($query);
|
||||||
|
|
||||||
|
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | End notification |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
echo
|
||||||
|
"\n"
|
||||||
|
.'Tables '.PREFIX_TABLE.'tags and '.PREFIX_TABLE.'image_tag updated'."\n"
|
||||||
|
;
|
||||||
|
echo $upgrade_description;
|
||||||
|
?>
|
|
@ -140,7 +140,8 @@ DROP TABLE IF EXISTS `phpwebgallery_image_tag`;
|
||||||
CREATE TABLE `phpwebgallery_image_tag` (
|
CREATE TABLE `phpwebgallery_image_tag` (
|
||||||
`image_id` mediumint(8) unsigned NOT NULL default '0',
|
`image_id` mediumint(8) unsigned NOT NULL default '0',
|
||||||
`tag_id` smallint(5) unsigned NOT NULL default '0',
|
`tag_id` smallint(5) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (`image_id`,`tag_id`)
|
PRIMARY KEY (`image_id`,`tag_id`),
|
||||||
|
KEY `image_tag_i1` (`tag_id`)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -233,7 +234,8 @@ CREATE TABLE `phpwebgallery_tags` (
|
||||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
`id` smallint(5) unsigned NOT NULL auto_increment,
|
||||||
`name` varchar(255) binary NOT NULL default '',
|
`name` varchar(255) binary NOT NULL default '',
|
||||||
`url_name` varchar(255) binary NOT NULL default '',
|
`url_name` varchar(255) binary NOT NULL default '',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `tags_i1` (`url_name`)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
@ -188,11 +188,11 @@ FORM.properties SPAN.property {
|
||||||
padding: 0 0.5em 0 0;
|
padding: 0 0.5em 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORM.properties .focus {
|
FORM .focus {
|
||||||
background-color: whitesmoke;
|
background-color: whitesmoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORM.properties .nofocus {
|
FORM .nofocus {
|
||||||
background-color: lightgrey; /* must be the same as input background-color */
|
background-color: lightgrey; /* must be the same as input background-color */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,27 +20,27 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- END errors -->
|
<!-- END errors -->
|
||||||
|
|
||||||
<form action="{F_LOGIN_ACTION}" method="post" class="properties">
|
<form action="{F_LOGIN_ACTION}" method="post" name="login_form" class="properties">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{lang:Connection settings}</legend>
|
<legend>{lang:Connection settings}</legend>
|
||||||
|
|
||||||
<input type="hidden" name="redirect" value="{U_REDIRECT}">
|
<input type="hidden" name="redirect" value="{U_REDIRECT}">
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<span class="property">
|
<span class="property">
|
||||||
<label for="username">{L_USERNAME}</label>
|
<label for="username">{L_USERNAME}</label>
|
||||||
</span>
|
</span>
|
||||||
<input tabindex="1" class="login" type="text" name="username" id="username" size="25" maxlength="40" value="{USERNAME}" onfocus="this.className='focus';" onblur="this.className='nofocus';" />
|
<input tabindex="1" class="login" type="text" name="username" id="username" size="25" maxlength="40" value="{USERNAME}" onfocus="this.className='focus';" onblur="this.className='nofocus';" />
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<span class="property">
|
<span class="property">
|
||||||
<label for="password">{L_PASSWORD}</label>
|
<label for="password">{L_PASSWORD}</label>
|
||||||
</span>
|
</span>
|
||||||
<input tabindex="2" class="login" type="password" name="password" id="password" size="25" maxlength="25" onfocus="this.className='focus';" onblur="this.className='nofocus';" />
|
<input tabindex="2" class="login" type="password" name="password" id="password" size="25" maxlength="25" onfocus="this.className='focus';" onblur="this.className='nofocus';" />
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- BEGIN remember_me -->
|
<!-- BEGIN remember_me -->
|
||||||
<li>
|
<li>
|
||||||
<span class="property">
|
<span class="property">
|
||||||
|
@ -54,7 +54,11 @@
|
||||||
|
|
||||||
<p><input tabindex="4" type="submit" name="login" value="{L_LOGIN}"></p>
|
<p><input tabindex="4" type="submit" name="login" value="{L_LOGIN}"></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script><!--
|
||||||
|
document.login_form.username.focus();
|
||||||
|
//--></script>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="{U_REGISTER}"><img src="{themeconf:icon_dir}/register.png" class="button" alt=""> {L_REGISTER}</a>
|
<a href="{U_REGISTER}"><img src="{themeconf:icon_dir}/register.png" class="button" alt=""> {L_REGISTER}</a>
|
||||||
<a href="{U_LOST_PASSWORD}"><img src="{themeconf:icon_dir}/lost_password.png" class="button" alt=""> {lang:Forgot your password?}</a>
|
<a href="{U_LOST_PASSWORD}"><img src="{themeconf:icon_dir}/lost_password.png" class="button" alt=""> {lang:Forgot your password?}</a>
|
||||||
|
|
|
@ -89,12 +89,12 @@
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
{lang:Username}
|
{lang:Username}
|
||||||
<input type="text" name="username" size="15" value="">
|
<input type="text" name="username" size="15" value="" onfocus="this.className='focus';" onblur="this.className='nofocus';">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
{lang:password}
|
{lang:password}
|
||||||
<input type="password" name="password" size="15">
|
<input type="password" name="password" size="15" onfocus="this.className='focus';" onblur="this.className='nofocus';">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- BEGIN remember_me -->
|
<!-- BEGIN remember_me -->
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- END errors -->
|
<!-- END errors -->
|
||||||
|
|
||||||
<form method="post" action="{F_ACTION}" class="properties">
|
<form method="post" action="{F_ACTION}" class="properties" name="register_form">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{lang:Enter your personnal informations}</legend>
|
<legend>{lang:Enter your personnal informations}</legend>
|
||||||
|
|
||||||
|
@ -63,5 +63,9 @@
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script><!--
|
||||||
|
document.register_form.login.focus();
|
||||||
|
//--></script>
|
||||||
|
|
||||||
</div> <!-- content -->
|
</div> <!-- content -->
|
||||||
</div> <!-- registerPage -->
|
</div> <!-- registerPage -->
|
||||||
|
|
|
@ -146,4 +146,8 @@
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script><!--
|
||||||
|
document.post.search_allwords.focus();
|
||||||
|
//--></script>
|
||||||
|
|
||||||
</div> <!-- content -->
|
</div> <!-- content -->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue