mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 19:29:58 +03:00
feature 2548 multisize
- added define_derivative template functiion for themes and plugins - code cleanup, new events ... git-svn-id: http://piwigo.org/svn/trunk@12954 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
3b3e586b0d
commit
4372d7aa11
6 changed files with 139 additions and 88 deletions
|
@ -28,6 +28,76 @@ if (!defined('PHPWG_ROOT_PATH'))
|
|||
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
|
||||
|
||||
|
||||
// get_complete_dir returns the concatenation of get_site_url and
|
||||
// get_local_dir
|
||||
// Example : "pets > rex > 1_year_old" is on the the same site as the
|
||||
// Piwigo files and this category has 22 for identifier
|
||||
// get_complete_dir(22) returns "./galleries/pets/rex/1_year_old/"
|
||||
function get_complete_dir( $category_id )
|
||||
{
|
||||
return get_site_url($category_id).get_local_dir($category_id);
|
||||
}
|
||||
|
||||
// get_local_dir returns an array with complete path without the site url
|
||||
// Example : "pets > rex > 1_year_old" is on the the same site as the
|
||||
// Piwigo files and this category has 22 for identifier
|
||||
// get_local_dir(22) returns "pets/rex/1_year_old/"
|
||||
function get_local_dir( $category_id )
|
||||
{
|
||||
global $page;
|
||||
|
||||
$uppercats = '';
|
||||
$local_dir = '';
|
||||
|
||||
if ( isset( $page['plain_structure'][$category_id]['uppercats'] ) )
|
||||
{
|
||||
$uppercats = $page['plain_structure'][$category_id]['uppercats'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = 'SELECT uppercats';
|
||||
$query.= ' FROM '.CATEGORIES_TABLE.' WHERE id = '.$category_id;
|
||||
$query.= ';';
|
||||
$row = pwg_db_fetch_assoc( pwg_query( $query ) );
|
||||
$uppercats = $row['uppercats'];
|
||||
}
|
||||
|
||||
$upper_array = explode( ',', $uppercats );
|
||||
|
||||
$database_dirs = array();
|
||||
$query = 'SELECT id,dir';
|
||||
$query.= ' FROM '.CATEGORIES_TABLE.' WHERE id IN ('.$uppercats.')';
|
||||
$query.= ';';
|
||||
$result = pwg_query( $query );
|
||||
while( $row = pwg_db_fetch_assoc( $result ) )
|
||||
{
|
||||
$database_dirs[$row['id']] = $row['dir'];
|
||||
}
|
||||
foreach ($upper_array as $id)
|
||||
{
|
||||
$local_dir.= $database_dirs[$id].'/';
|
||||
}
|
||||
|
||||
return $local_dir;
|
||||
}
|
||||
|
||||
// retrieving the site url : "http://domain.com/gallery/" or
|
||||
// simply "./galleries/"
|
||||
function get_site_url($category_id)
|
||||
{
|
||||
global $page;
|
||||
|
||||
$query = '
|
||||
SELECT galleries_url
|
||||
FROM '.SITES_TABLE.' AS s,'.CATEGORIES_TABLE.' AS c
|
||||
WHERE s.id = c.site_id
|
||||
AND c.id = '.$category_id.'
|
||||
;';
|
||||
$row = pwg_db_fetch_assoc(pwg_query($query));
|
||||
return $row['galleries_url'];
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Check Access and exit when user status is not ok |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue