Possibility to disable the automatic reload of the network page

This commit is contained in:
Michael Vogel 2014-07-09 21:32:32 +02:00
parent fe71272e1e
commit c980e6d20d
5 changed files with 25 additions and 2 deletions

View File

@ -907,6 +907,10 @@ function item_post(&$a) {
call_hooks('post_local_end', $datarray); 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()) { if(strlen($emailcc) && $profile_uid == local_user()) {
$erecips = explode(',', $emailcc); $erecips = explode(',', $emailcc);
if(count($erecips)) { if(count($erecips)) {

View File

@ -136,6 +136,9 @@ function like_content(&$a) {
// Save the author information for the unlike in case we need to relay to Diaspora // 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); 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! // proc_run('php',"include/notifier.php","like","$post_id"); // $post_id isn't defined here!
$like_item_id = $like_item['id']; $like_item_id = $like_item['id'];
@ -148,7 +151,7 @@ function like_content(&$a) {
$uri = item_new_uri($a->get_hostname(),$owner_uid); $uri = item_new_uri($a->get_hostname(),$owner_uid);
$post_type = (($item['resource-id']) ? t('photo') : t('status')); $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('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ; $link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
$body = $item['body']; $body = $item['body'];
@ -219,6 +222,9 @@ EOT;
// Save the author information for the like in case we need to relay to Diaspora // 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); 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; $arr['id'] = $post_id;

View File

@ -268,6 +268,7 @@ function settings_post(&$a) {
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
$noinfo = ((x($_POST,'noinfo')) ? intval($_POST['noinfo']) : 0); $noinfo = ((x($_POST,'noinfo')) ? intval($_POST['noinfo']) : 0);
$infinite_scroll = ((x($_POST,'infinite_scroll')) ? intval($_POST['infinite_scroll']) : 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 = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000; $browser_update = $browser_update * 1000;
if($browser_update < 10000) 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','no_smilies',$nosmile);
set_pconfig(local_user(),'system','ignore_info',$noinfo); set_pconfig(local_user(),'system','ignore_info',$noinfo);
set_pconfig(local_user(),'system','infinite_scroll',$infinite_scroll); 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']){ if ($theme == $a->user['theme']){
@ -859,6 +861,9 @@ function settings_content(&$a) {
$infinite_scroll = get_pconfig(local_user(),'system','infinite_scroll'); $infinite_scroll = get_pconfig(local_user(),'system','infinite_scroll');
$infinite_scroll = (($infinite_scroll===false)? '0': $infinite_scroll); // default if not set: 0 $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 = ""; $theme_config = "";
if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){ if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){
require_once($themeconfigfile); require_once($themeconfigfile);
@ -881,6 +886,7 @@ function settings_content(&$a) {
'$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
'$noinfo' => array('noinfo', t("Don't show notices"), $noinfo, ''), '$noinfo' => array('noinfo', t("Don't show notices"), $noinfo, ''),
'$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''), '$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, '$theme_config' => $theme_config,
)); ));

View File

@ -13,8 +13,14 @@ function update_network_content(&$a) {
echo "<!DOCTYPE html><html><body>\r\n"; echo "<!DOCTYPE html><html><body>\r\n";
echo (($_GET['msie'] == 1) ? '<div>' : '<section>'); echo (($_GET['msie'] == 1) ? '<div>' : '<section>');
$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 = "/<img([^>]*) src=\"([^\"]*)\"/"; $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\""; $replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);

View File

@ -16,6 +16,7 @@
{{include file="field_checkbox.tpl" field=$nosmile}} {{include file="field_checkbox.tpl" field=$nosmile}}
{{include file="field_checkbox.tpl" field=$noinfo}} {{include file="field_checkbox.tpl" field=$noinfo}}
{{include file="field_checkbox.tpl" field=$infinite_scroll}} {{include file="field_checkbox.tpl" field=$infinite_scroll}}
{{include file="field_checkbox.tpl" field=$no_auto_update}}
<div class="settings-submit-wrapper" > <div class="settings-submit-wrapper" >