mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 11:49:56 +03:00
- multisize thumb longest side can be smaller than the square size
- remove unused css, shorten/optimize php called very often (at least theoretically should be faster) git-svn-id: http://piwigo.org/svn/trunk@13240 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
3ef9e856c3
commit
a893882789
12 changed files with 107 additions and 133 deletions
|
@ -245,10 +245,8 @@ if (
|
||||||
'site_manager', // delete site
|
'site_manager', // delete site
|
||||||
'site_update', // ?only POST
|
'site_update', // ?only POST
|
||||||
'cat_list', // delete cat
|
'cat_list', // delete cat
|
||||||
'album', // delete cat; public/private; lock/unlock, permissions
|
|
||||||
'cat_move', // ?only POST
|
'cat_move', // ?only POST
|
||||||
'cat_options', // ?only POST; public/private; lock/unlock
|
'cat_options', // ?only POST; public/private; lock/unlock
|
||||||
'photo',
|
|
||||||
'picture_modify', // ?only POST; associate/dissociate
|
'picture_modify', // ?only POST; associate/dissociate
|
||||||
'user_perm',
|
'user_perm',
|
||||||
'group_perm',
|
'group_perm',
|
||||||
|
@ -257,6 +255,8 @@ if (
|
||||||
)
|
)
|
||||||
or ( !empty($_POST) and in_array($page['page'],
|
or ( !empty($_POST) and in_array($page['page'],
|
||||||
array(
|
array(
|
||||||
|
'photo',
|
||||||
|
'album', // public/private; lock/unlock, permissions
|
||||||
'batch_manager', // associate/dissociate; delete; set level
|
'batch_manager', // associate/dissociate; delete; set level
|
||||||
'user_list', // group assoc; user level
|
'user_list', // group assoc; user level
|
||||||
)
|
)
|
||||||
|
|
|
@ -126,7 +126,6 @@ while ($row = pwg_db_fetch_assoc($result))
|
||||||
array(
|
array(
|
||||||
'id'=>$row['image_id'],
|
'id'=>$row['image_id'],
|
||||||
'path'=>$row['path'],
|
'path'=>$row['path'],
|
||||||
'tn_ext'=>@$row['tn_ext']
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (empty($row['author_id']))
|
if (empty($row['author_id']))
|
||||||
|
|
|
@ -52,6 +52,25 @@ if ( isset($_POST['d']) )
|
||||||
if (!$pderivative['enabled'])
|
if (!$pderivative['enabled'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ($type==IMG_THUMB)
|
||||||
|
{
|
||||||
|
$w = intval($pderivative['w']);
|
||||||
|
if ($w<=0)
|
||||||
|
{
|
||||||
|
$errors[$type]['w'] = '>0';
|
||||||
|
}
|
||||||
|
$h = intval($pderivative['h']);
|
||||||
|
if ($h<=0)
|
||||||
|
{
|
||||||
|
$errors[$type]['h'] = '>0';
|
||||||
|
}
|
||||||
|
if (max($w,$h) <= $prev_w)
|
||||||
|
{
|
||||||
|
$errors[$type]['w'] = $errors[$type]['h'] = '>'.$prev_w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$v = intval($pderivative['w']);
|
$v = intval($pderivative['w']);
|
||||||
if ($v<=0 || $v<=$prev_w)
|
if ($v<=0 || $v<=$prev_w)
|
||||||
{
|
{
|
||||||
|
@ -62,6 +81,7 @@ if ( isset($_POST['d']) )
|
||||||
{
|
{
|
||||||
$errors[$type]['h'] = '>'.$prev_h;
|
$errors[$type]['h'] = '>'.$prev_h;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$v = intval($pderivative['crop']);
|
$v = intval($pderivative['crop']);
|
||||||
if ($v<0 || $v>100)
|
if ($v<0 || $v>100)
|
||||||
{
|
{
|
||||||
|
|
|
@ -816,22 +816,6 @@ function get_element_path($element_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns the PATH to the thumbnail to be displayed. If the element does not
|
|
||||||
* have a thumbnail, the default mime image path is returned. The PATH can be
|
|
||||||
* used in the php script, but not sent to the browser.
|
|
||||||
* @param array element_info assoc array containing element info from db
|
|
||||||
* at least 'path', 'tn_ext' and 'id' should be present
|
|
||||||
*/
|
|
||||||
function get_thumbnail_path($element_info)
|
|
||||||
{
|
|
||||||
$path = get_thumbnail_location($element_info);
|
|
||||||
if ( !url_is_remote($path) )
|
|
||||||
{
|
|
||||||
$path = PHPWG_ROOT_PATH.$path;
|
|
||||||
}
|
|
||||||
return $path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns the URL of the thumbnail to be displayed. If the element does not
|
/* Returns the URL of the thumbnail to be displayed. If the element does not
|
||||||
* have a thumbnail, the default mime image url is returned. The URL can be
|
* have a thumbnail, the default mime image url is returned. The URL can be
|
||||||
* sent to the browser, but not used in the php script.
|
* sent to the browser, but not used in the php script.
|
||||||
|
@ -843,32 +827,6 @@ function get_thumbnail_url($element_info)
|
||||||
return DerivativeImage::thumb_url($element_info);
|
return DerivativeImage::thumb_url($element_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns the relative path of the thumnail with regards to to the root
|
|
||||||
of piwigo (not the current page!).This function is not intended to be
|
|
||||||
called directly from code.*/
|
|
||||||
function get_thumbnail_location($element_info)
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
if ( !empty( $element_info['tn_ext'] ) )
|
|
||||||
{
|
|
||||||
$path = substr_replace(
|
|
||||||
get_filename_wo_extension($element_info['path']),
|
|
||||||
'/'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'],
|
|
||||||
strrpos($element_info['path'],'/'),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
$path.= '.'.$element_info['tn_ext'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$path = get_themeconf('mime_icon_dir')
|
|
||||||
.strtolower(get_extension($element_info['path'])).'.png';
|
|
||||||
// plugins want another location ?
|
|
||||||
$path = trigger_event( 'get_thumbnail_location', $path, $element_info);
|
|
||||||
}
|
|
||||||
return $path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fill the current user caddie with given elements, if not already in
|
* fill the current user caddie with given elements, if not already in
|
||||||
* caddie
|
* caddie
|
||||||
|
@ -920,16 +878,19 @@ function get_name_from_file($filename)
|
||||||
* @param string key
|
* @param string key
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function l10n($key, $textdomain='messages')
|
function l10n($key)
|
||||||
{
|
{
|
||||||
global $lang, $conf;
|
global $lang, $conf;
|
||||||
|
|
||||||
|
if ( ($val=@$lang[$key]) == null)
|
||||||
|
{
|
||||||
if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key))
|
if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key))
|
||||||
{
|
{
|
||||||
trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING);
|
trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
$val = $key;
|
||||||
return isset($lang[$key]) ? $lang[$key] : $key;
|
}
|
||||||
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -388,12 +388,7 @@ function global_rank_compare($a, $b)
|
||||||
|
|
||||||
function rank_compare($a, $b)
|
function rank_compare($a, $b)
|
||||||
{
|
{
|
||||||
if ($a['rank'] == $b['rank'])
|
return $a['rank'] - $b['rank'];
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($a['rank'] < $b['rank']) ? -1 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -294,17 +294,17 @@ function name_compare($a, $b)
|
||||||
|
|
||||||
function tag_alpha_compare($a, $b)
|
function tag_alpha_compare($a, $b)
|
||||||
{
|
{
|
||||||
global $page;
|
global $cache;
|
||||||
|
|
||||||
foreach (array($a, $b) as $tag)
|
foreach (array($a, $b) as $tag)
|
||||||
{
|
{
|
||||||
if (!isset($page[__FUNCTION__.'_cache'][ $tag['name'] ]))
|
if (!isset($cache[__FUNCTION__][ $tag['name'] ]))
|
||||||
{
|
{
|
||||||
$page[__FUNCTION__.'_cache'][ $tag['name'] ] = strtolower(str2url($tag['name']));
|
$cache[__FUNCTION__][ $tag['name'] ] = strtolower(str2url($tag['name']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return strcmp($page[__FUNCTION__.'_cache'][ $a['name'] ], $page[__FUNCTION__.'_cache'][ $b['name'] ]);
|
return strcmp($cache[__FUNCTION__][ $a['name'] ], $cache[__FUNCTION__][ $b['name'] ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,23 +30,16 @@
|
||||||
function get_root_url()
|
function get_root_url()
|
||||||
{
|
{
|
||||||
global $page;
|
global $page;
|
||||||
if ( isset($page['root_path']) )
|
if ( ($root_url = @$page['root_path']) == null )
|
||||||
{
|
|
||||||
$root_url = $page['root_path'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{// TODO - add HERE the possibility to call PWG functions from external scripts
|
{// TODO - add HERE the possibility to call PWG functions from external scripts
|
||||||
$root_url = PHPWG_ROOT_PATH;
|
$root_url = PHPWG_ROOT_PATH;
|
||||||
}
|
if ( strncmp($root_url, './', 2) == 0 )
|
||||||
if ( strncmp($root_url, './', 2) != 0 )
|
|
||||||
{
|
{
|
||||||
|
return substr($root_url, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $root_url;
|
return $root_url;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return (string)substr($root_url, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the absolute url to the root of PWG
|
* returns the absolute url to the root of PWG
|
||||||
|
@ -307,7 +300,9 @@ function make_section_in_url($params)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
$section_string = '';
|
$section_string = '';
|
||||||
|
$section = @$params['section'];
|
||||||
|
if (!isset($section))
|
||||||
|
{
|
||||||
$section_of = array(
|
$section_of = array(
|
||||||
'category' => 'categories',
|
'category' => 'categories',
|
||||||
'tags' => 'tags',
|
'tags' => 'tags',
|
||||||
|
@ -315,20 +310,21 @@ function make_section_in_url($params)
|
||||||
'search' => 'search',
|
'search' => 'search',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($section_of as $param => $section)
|
foreach ($section_of as $param => $s)
|
||||||
{
|
{
|
||||||
if (isset($params[$param]))
|
if (isset($params[$param]))
|
||||||
{
|
{
|
||||||
$params['section'] = $section;
|
$section = $s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($params['section']))
|
if (!isset($section))
|
||||||
{
|
{
|
||||||
$params['section'] = 'none';
|
$section = 'none';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($params['section'])
|
switch($section)
|
||||||
{
|
{
|
||||||
case 'categories' :
|
case 'categories' :
|
||||||
{
|
{
|
||||||
|
@ -420,7 +416,7 @@ function make_section_in_url($params)
|
||||||
}
|
}
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
$section_string.= '/'.$params['section'];
|
$section_string.= '/'.$section;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -806,29 +806,6 @@ SELECT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* search an available feed_id
|
|
||||||
*
|
|
||||||
* @return string feed identifier
|
|
||||||
*/
|
|
||||||
function find_available_feed_id()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
$key = generate_key(50);
|
|
||||||
$query = '
|
|
||||||
SELECT COUNT(*)
|
|
||||||
FROM '.USER_FEED_TABLE.'
|
|
||||||
WHERE id = \''.$key.'\'
|
|
||||||
;';
|
|
||||||
list($count) = pwg_db_fetch_row(pwg_query($query));
|
|
||||||
if (0 == $count)
|
|
||||||
{
|
|
||||||
return $key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a array with default user value
|
* Returns a array with default user value
|
||||||
*
|
*
|
||||||
|
|
|
@ -64,10 +64,14 @@ else
|
||||||
|
|
||||||
// the $_GET keys are not protected in include/common.inc.php, only the values
|
// the $_GET keys are not protected in include/common.inc.php, only the values
|
||||||
$rewritten = pwg_db_real_escape_string($rewritten);
|
$rewritten = pwg_db_real_escape_string($rewritten);
|
||||||
|
|
||||||
$page['root_path'] = PHPWG_ROOT_PATH;
|
$page['root_path'] = PHPWG_ROOT_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( strncmp($page['root_path'], './', 2) == 0 )
|
||||||
|
{
|
||||||
|
$page['root_path'] = substr($page['root_path'], 2);
|
||||||
|
}
|
||||||
|
|
||||||
// deleting first "/" if displayed
|
// deleting first "/" if displayed
|
||||||
$tokens = explode('/', ltrim($rewritten, '/') );
|
$tokens = explode('/', ltrim($rewritten, '/') );
|
||||||
// $tokens = array(
|
// $tokens = array(
|
||||||
|
|
|
@ -683,7 +683,7 @@ var s,after = document.getElementsByTagName(\'script\')[document.getElementsByTa
|
||||||
$ret = $script->path;
|
$ret = $script->path;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret = embellish_url(get_root_url().$script->path);
|
$ret = get_root_url().$script->path;
|
||||||
if ($script->version!==false)
|
if ($script->version!==false)
|
||||||
{
|
{
|
||||||
$ret.= '?v'. ($script->version ? $script->version : PHPWG_VERSION);
|
$ret.= '?v'. ($script->version ? $script->version : PHPWG_VERSION);
|
||||||
|
@ -691,7 +691,7 @@ var s,after = document.getElementsByTagName(\'script\')[document.getElementsByTa
|
||||||
}
|
}
|
||||||
// trigger the event for eventual use of a cdn
|
// trigger the event for eventual use of a cdn
|
||||||
$ret = trigger_event('combined_script', $ret, $script);
|
$ret = trigger_event('combined_script', $ret, $script);
|
||||||
return $ret;
|
return embellish_url($ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
function block_footer_script($params, $content, &$smarty, &$repeat)
|
function block_footer_script($params, $content, &$smarty, &$repeat)
|
||||||
|
|
|
@ -28,6 +28,29 @@
|
||||||
define('PHPWG_ROOT_PATH','./');
|
define('PHPWG_ROOT_PATH','./');
|
||||||
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* search an available feed_id
|
||||||
|
*
|
||||||
|
* @return string feed identifier
|
||||||
|
*/
|
||||||
|
function find_available_feed_id()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
$key = generate_key(50);
|
||||||
|
$query = '
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM '.USER_FEED_TABLE.'
|
||||||
|
WHERE id = \''.$key.'\'
|
||||||
|
;';
|
||||||
|
list($count) = pwg_db_fetch_row(pwg_query($query));
|
||||||
|
if (0 == $count)
|
||||||
|
{
|
||||||
|
return $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
// | Check Access and exit when user status is not ok |
|
// | Check Access and exit when user status is not ok |
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
|
@ -294,8 +294,7 @@ TD.calDayHead {
|
||||||
-moz-border-radius: 4px; /* round corners with Geko */
|
-moz-border-radius: 4px; /* round corners with Geko */
|
||||||
-webkit-border-radius: 4px; /* Safari webkit project */
|
-webkit-border-radius: 4px; /* Safari webkit project */
|
||||||
}
|
}
|
||||||
.thumbnails .wrap2 A,
|
.thumbnails .wrap2 A {
|
||||||
.thumbnails LABEL {
|
|
||||||
display: block;
|
display: block;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue