From c980e6d20d08b6addb2938bd2e51bd599ae71d1d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 9 Jul 2014 21:32:32 +0200 Subject: [PATCH] Possibility to disable the automatic reload of the network page --- mod/item.php | 4 ++++ mod/like.php | 8 +++++++- mod/settings.php | 6 ++++++ mod/update_network.php | 8 +++++++- view/templates/settings_display.tpl | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/mod/item.php b/mod/item.php index 20f7f2957e..cf79913eb4 100644 --- a/mod/item.php +++ b/mod/item.php @@ -907,6 +907,10 @@ function item_post(&$a) { call_hooks('post_local_end', $datarray); + // if no auto update is enabled, then disable it temporarily + if (get_pconfig($profile_uid, "system", "no_auto_update") == 1) + set_pconfig($profile_uid, "system", "no_auto_update", -1); + if(strlen($emailcc) && $profile_uid == local_user()) { $erecips = explode(',', $emailcc); if(count($erecips)) { diff --git a/mod/like.php b/mod/like.php index a2f51b074e..5ed58245ae 100755 --- a/mod/like.php +++ b/mod/like.php @@ -136,6 +136,9 @@ function like_content(&$a) { // Save the author information for the unlike in case we need to relay to Diaspora store_diaspora_like_retract_sig($activity, $item, $like_item, $contact); + // if no auto update is enabled, then disable it temporarily + if (get_pconfig($owner_uid, "system", "no_auto_update") == 1) + set_pconfig($owner_uid, "system", "no_auto_update", -1); // proc_run('php',"include/notifier.php","like","$post_id"); // $post_id isn't defined here! $like_item_id = $like_item['id']; @@ -148,7 +151,7 @@ function like_content(&$a) { $uri = item_new_uri($a->get_hostname(),$owner_uid); $post_type = (($item['resource-id']) ? t('photo') : t('status')); - $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE ); + $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE ); $link = xmlify('' . "\n") ; $body = $item['body']; @@ -219,6 +222,9 @@ EOT; // Save the author information for the like in case we need to relay to Diaspora store_diaspora_like_sig($activity, $post_type, $contact, $post_id); + // if no auto update is enabled, then disable it temporarily + if (get_pconfig($owner_uid, "system", "no_auto_update") == 1) + set_pconfig($owner_uid, "system", "no_auto_update", -1); $arr['id'] = $post_id; diff --git a/mod/settings.php b/mod/settings.php index 4edd62f679..c00ecc2e37 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -268,6 +268,7 @@ function settings_post(&$a) { $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); $noinfo = ((x($_POST,'noinfo')) ? intval($_POST['noinfo']) : 0); $infinite_scroll = ((x($_POST,'infinite_scroll')) ? intval($_POST['infinite_scroll']) : 0); + $no_auto_update = ((x($_POST,'no_auto_update')) ? intval($_POST['no_auto_update']) : 0); $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); $browser_update = $browser_update * 1000; if($browser_update < 10000) @@ -291,6 +292,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','no_smilies',$nosmile); set_pconfig(local_user(),'system','ignore_info',$noinfo); set_pconfig(local_user(),'system','infinite_scroll',$infinite_scroll); + set_pconfig(local_user(),'system','no_auto_update',$no_auto_update); if ($theme == $a->user['theme']){ @@ -859,6 +861,9 @@ function settings_content(&$a) { $infinite_scroll = get_pconfig(local_user(),'system','infinite_scroll'); $infinite_scroll = (($infinite_scroll===false)? '0': $infinite_scroll); // default if not set: 0 + $no_auto_update = get_pconfig(local_user(),'system','no_auto_update'); + $no_auto_update = (($no_auto_update===false)? '0': $no_auto_update); // default if not set: 0 + $theme_config = ""; if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){ require_once($themeconfigfile); @@ -881,6 +886,7 @@ function settings_content(&$a) { '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), '$noinfo' => array('noinfo', t("Don't show notices"), $noinfo, ''), '$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''), + '$no_auto_update' => array('no_auto_update', t("Disable automatic network update"), $no_auto_update, ''), '$theme_config' => $theme_config, )); diff --git a/mod/update_network.php b/mod/update_network.php index 0dfe0a73ff..65366d1377 100644 --- a/mod/update_network.php +++ b/mod/update_network.php @@ -13,8 +13,14 @@ function update_network_content(&$a) { echo "\r\n"; echo (($_GET['msie'] == 1) ? '
' : '
'); + $no_auto_update = get_pconfig($profile_uid, "system", "no_auto_update"); + if ($no_auto_update <= 0) { + $text = network_content($a,$profile_uid); + if ($no_auto_update < 0) + set_pconfig($profile_uid, "system", "no_auto_update", 1); + } else + $text = ""; - $text = network_content($a,$profile_uid); $pattern = "/]*) src=\"([^\"]*)\"/"; $replace = " -- 2.39.5