- if (isset($_GET['privateonly'])) {
- if (empty($_SESSION['privateonly'])) {
- $_SESSION['privateonly'] = 1; // See only private links
+ if (isset($_GET['visibility'])) {
+ if ($_GET['visibility'] === 'private') {
+ // Visibility not set or not already private, set private, otherwise reset it
+ if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'private') {
+ // See only private links
+ $_SESSION['visibility'] = 'private';
+ } else {
+ unset($_SESSION['visibility']);
+ }
+ } else if ($_GET['visibility'] === 'public') {
+ if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') {
+ // See only public links
+ $_SESSION['visibility'] = 'public';
+ } else {
+ unset($_SESSION['visibility']);
+ }
+ }
+
+ if (! empty($_SERVER['HTTP_REFERER'])) {
+ $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('visibility'));