diff options
Diffstat (limited to '')
-rw-r--r-- | include/common.inc.php | 35 | ||||
-rw-r--r-- | include/config_default.inc.php | 3 | ||||
-rw-r--r-- | include/functions.inc.php | 18 |
3 files changed, 56 insertions, 0 deletions
diff --git a/include/common.inc.php b/include/common.inc.php index 9a5ccac90..d4ad9ad5c 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -165,6 +165,41 @@ 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 + ) +{ + $query = ' +SELECT + COUNT(*) + FROM '.IMAGES_TABLE.' +;'; + list($nb_photos) = pwg_db_fetch_row(pwg_query($query)); + if (0 == $nb_photos) + { + $template->set_filenames(array('no_photo_yet'=>'no_photo_yet.tpl')); + + $url = $conf['no_photo_yet_url']; + if (substr($url, 0, 4) != 'http') + { + $url = get_root_url().$url; + } + + $template->assign(array('next_step_url' => $url)); + $template->pparse('no_photo_yet'); + exit(); + } + else + { + conf_update_param('no_photo_yet', 'false'); + } +} + if (isset($user['internal_status']['guest_must_be_guest']) and $user['internal_status']['guest_must_be_guest'] === true) diff --git a/include/config_default.inc.php b/include/config_default.inc.php index dcf94dc84..f9be46f4b 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -765,4 +765,7 @@ $conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data'; // where should the API add photos? $conf['upload_dir'] = PHPWG_ROOT_PATH.'upload'; + +// where should the user be guided when there is no photo in his gallery yet? +$conf['no_photo_yet_url'] = 'admin.php?page=photos_add'; ?> diff --git a/include/functions.inc.php b/include/functions.inc.php index 7eee41d57..18bad9d0e 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1060,6 +1060,24 @@ SELECT param, value } } +function conf_update_param($param, $value) +{ + $query = ' +DELETE + FROM '.CONFIG_TABLE.' + WHERE param = "'.$param.'" +;'; + pwg_query($query); + + $query = ' +INSERT + INTO '.CONFIG_TABLE.' + SET param = "'.$param.'" + , value = "'.$value.'" +;'; + pwg_query($query); +} + /** * Prepends and appends a string at each value of the given array. * |