mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 15:14:34 +00:00
Fix admin dashboard album tile for single album
This commit is contained in:
45
main.inc.php
45
main.inc.php
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: Bratonien Tools
|
Plugin Name: Bratonien Tools
|
||||||
Version: 0.9.6.8.18
|
Version: 0.9.6.8.19
|
||||||
Description: Erweiterbare Administrationswerkzeuge fuer die Bratonien-Piwigo-Installation.
|
Description: Erweiterbare Administrationswerkzeuge fuer die Bratonien-Piwigo-Installation.
|
||||||
Plugin URI: https://github.com/Terranom674/Piwigo_Bratonien_Tools
|
Plugin URI: https://github.com/Terranom674/Piwigo_Bratonien_Tools
|
||||||
Author: Bratonien
|
Author: Bratonien
|
||||||
@@ -36,6 +36,7 @@ add_event_handler('init', 'bratonien_tools_prepare_private_album_permissions', E
|
|||||||
add_event_handler('init', 'bratonien_tools_preserve_private_album_access', EVENT_HANDLER_PRIORITY_NEUTRAL - 10);
|
add_event_handler('init', 'bratonien_tools_preserve_private_album_access', EVENT_HANDLER_PRIORITY_NEUTRAL - 10);
|
||||||
add_event_handler('init', 'bratonien_tools_preserve_connector_top_level_access', EVENT_HANDLER_PRIORITY_NEUTRAL - 9);
|
add_event_handler('init', 'bratonien_tools_preserve_connector_top_level_access', EVENT_HANDLER_PRIORITY_NEUTRAL - 9);
|
||||||
add_event_handler('init', 'bratonien_tools_album_shares_init');
|
add_event_handler('init', 'bratonien_tools_album_shares_init');
|
||||||
|
add_event_handler('loc_end_intro', 'bratonien_tools_fix_admin_album_stat_tile');
|
||||||
add_event_handler('delete_categories', 'bratonien_tools_album_shares_on_delete_categories');
|
add_event_handler('delete_categories', 'bratonien_tools_album_shares_on_delete_categories');
|
||||||
add_event_handler('ws_add_methods', 'bratonien_tools_register_nc_orphan_ws_methods');
|
add_event_handler('ws_add_methods', 'bratonien_tools_register_nc_orphan_ws_methods');
|
||||||
add_event_handler('ws_add_methods', 'bratonien_tools_register_nc_productive_ws_methods');
|
add_event_handler('ws_add_methods', 'bratonien_tools_register_nc_productive_ws_methods');
|
||||||
@@ -109,14 +110,7 @@ function bratonien_tools_preserve_connector_top_level_access()
|
|||||||
}
|
}
|
||||||
|
|
||||||
register_shutdown_function(function () use ($site_id, $user_id) {
|
register_shutdown_function(function () use ($site_id, $user_id) {
|
||||||
$query = '
|
$query = '\nSELECT id\n FROM '.CATEGORIES_TABLE.'\n WHERE site_id = '.$site_id.'\n AND dir IS NOT NULL\n AND id_uppercat IS NULL\n AND status = \'private\'\n;';
|
||||||
SELECT id
|
|
||||||
FROM '.CATEGORIES_TABLE.'
|
|
||||||
WHERE site_id = '.$site_id.'
|
|
||||||
AND dir IS NOT NULL
|
|
||||||
AND id_uppercat IS NULL
|
|
||||||
AND status = \'private\'
|
|
||||||
;';
|
|
||||||
$result = pwg_query($query);
|
$result = pwg_query($query);
|
||||||
$changed = false;
|
$changed = false;
|
||||||
while ($row = pwg_db_fetch_assoc($result))
|
while ($row = pwg_db_fetch_assoc($result))
|
||||||
@@ -127,13 +121,7 @@ SELECT id
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$access_query = '
|
$access_query = '\nSELECT 1\n FROM '.USER_ACCESS_TABLE.'\n WHERE user_id = '.$user_id.'\n AND cat_id = '.$category_id.'\n LIMIT 1\n;';
|
||||||
SELECT 1
|
|
||||||
FROM '.USER_ACCESS_TABLE.'
|
|
||||||
WHERE user_id = '.$user_id.'
|
|
||||||
AND cat_id = '.$category_id.'
|
|
||||||
LIMIT 1
|
|
||||||
;';
|
|
||||||
if (pwg_db_num_rows(pwg_query($access_query)) > 0)
|
if (pwg_db_num_rows(pwg_query($access_query)) > 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -159,13 +147,7 @@ function bratonien_tools_grant_private_album_access($category_id, $user_id)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = '
|
$query = '\nSELECT 1\n FROM '.USER_ACCESS_TABLE.'\n WHERE user_id = '.$user_id.'\n AND cat_id = '.$category_id.'\n LIMIT 1\n;';
|
||||||
SELECT 1
|
|
||||||
FROM '.USER_ACCESS_TABLE.'
|
|
||||||
WHERE user_id = '.$user_id.'
|
|
||||||
AND cat_id = '.$category_id.'
|
|
||||||
LIMIT 1
|
|
||||||
;';
|
|
||||||
$result = pwg_query($query);
|
$result = pwg_query($query);
|
||||||
if (pwg_db_num_rows($result) > 0)
|
if (pwg_db_num_rows($result) > 0)
|
||||||
{
|
{
|
||||||
@@ -181,6 +163,23 @@ SELECT 1
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bratonien_tools_fix_admin_album_stat_tile()
|
||||||
|
{
|
||||||
|
global $template;
|
||||||
|
|
||||||
|
if (!defined('IN_ADMIN'))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$template->set_prefilter('intro', 'bratonien_tools_prefilter_admin_album_stat_tile');
|
||||||
|
}
|
||||||
|
|
||||||
|
function bratonien_tools_prefilter_admin_album_stat_tile($source)
|
||||||
|
{
|
||||||
|
return str_replace('{if $NB_ALBUMS > 1}', '{if $NB_ALBUMS > 0}', $source);
|
||||||
|
}
|
||||||
|
|
||||||
function bratonien_tools_admin_menu($menu)
|
function bratonien_tools_admin_menu($menu)
|
||||||
{
|
{
|
||||||
$menu[] = array(
|
$menu[] = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user