mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
move no_photo_yet feature to a new php file included by common.inc.php only if required (avoid parsing this code that will be rarely executed)
git-svn-id: http://piwigo.org/svn/trunk@5509 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+3
-77
@@ -111,7 +111,7 @@ try
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
my_error(l10n($e->getMessage(), true));
|
||||
my_error(l10n($e->getMessage(), true));
|
||||
}
|
||||
|
||||
pwg_db_check_charset();
|
||||
@@ -162,83 +162,9 @@ else
|
||||
$template = new Template(PHPWG_ROOT_PATH.'themes', $user['theme'] );
|
||||
}
|
||||
|
||||
// The "No Photo Yet" feature: if you have no photo yet in your gallery, the
|
||||
// gallery displays only a big box to show you the way for adding your first
|
||||
// photos
|
||||
if (
|
||||
!isset($conf['no_photo_yet']) // the message disappears at first photo
|
||||
and !(defined('IN_ADMIN') and IN_ADMIN) // no message inside administration
|
||||
and script_basename() != 'identification' // keep the ability to login
|
||||
and script_basename() != 'ws' // keep the ability to discuss with web API
|
||||
and !isset($_SESSION['no_photo_yet']) // temporary hide
|
||||
)
|
||||
if ( !isset($conf['no_photo_yet']) )
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM '.IMAGES_TABLE.'
|
||||
;';
|
||||
list($nb_photos) = pwg_db_fetch_row(pwg_query($query));
|
||||
if (0 == $nb_photos)
|
||||
{
|
||||
if (isset($_GET['no_photo_yet']))
|
||||
{
|
||||
if ('browse' == $_GET['no_photo_yet'])
|
||||
{
|
||||
$_SESSION['no_photo_yet'] = 'browse';
|
||||
redirect(make_index_url());
|
||||
exit();
|
||||
}
|
||||
|
||||
if ('deactivate' == $_GET['no_photo_yet'])
|
||||
{
|
||||
conf_update_param('no_photo_yet', 'false');
|
||||
redirect(make_index_url());
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$template->set_filenames(array('no_photo_yet'=>'no_photo_yet.tpl'));
|
||||
|
||||
if (is_admin())
|
||||
{
|
||||
$url = $conf['no_photo_yet_url'];
|
||||
if (substr($url, 0, 4) != 'http')
|
||||
{
|
||||
$url = get_root_url().$url;
|
||||
}
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
'step' => 2,
|
||||
'intro' => sprintf(
|
||||
l10n('Hello %s, your Piwigo photo gallery is empty!'),
|
||||
$user['username']
|
||||
),
|
||||
'next_step_url' => $url,
|
||||
'deactivate_url' => get_root_url().'?no_photo_yet=deactivate',
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
'step' => 1,
|
||||
'U_LOGIN' => 'identification.php',
|
||||
'deactivate_url' => get_root_url().'?no_photo_yet=browse',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$template->pparse('no_photo_yet');
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
conf_update_param('no_photo_yet', 'false');
|
||||
}
|
||||
include(PHPWG_ROOT_PATH.'include/no_photo_yet.inc.php');
|
||||
}
|
||||
|
||||
if (isset($user['internal_status']['guest_must_be_guest'])
|
||||
|
||||
Reference in New Issue
Block a user