diff --git a/boot.php b/boot.php index 1de2cb123e..1778093b4e 100644 --- a/boot.php +++ b/boot.php @@ -1104,6 +1104,9 @@ class App { } function save_timestamp($stamp, $value) { + if (!isset($a->config['system']['profiler']) || !$a->config['system']['profiler']) + return; + $duration = (float)(microtime(true)-$stamp); if (!isset($this->performance[$value])) { @@ -1190,11 +1193,6 @@ class App { return implode(", ", $callstack); } - function mark_timestamp($mark) { - //$this->performance["markstart"] -= microtime(true) - $this->performance["marktime"]; - $this->performance["markstart"] = microtime(true) - $this->performance["markstart"] - $this->performance["marktime"]; - } - function get_useragent() { return(FRIENDICA_PLATFORM." '".FRIENDICA_CODENAME."' ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION."; ".$this->get_baseurl()); } diff --git a/doc/htconfig.md b/doc/htconfig.md index 6021682757..b6f98b2ef0 100644 --- a/doc/htconfig.md +++ b/doc/htconfig.md @@ -1,20 +1,19 @@ Config values that can only be set in .htconfig.php =================================================== -There are some config values that haven't found their way into the administration page. This has several reasons. Maybe they are part of a -current development that isn't considered stable and will be added later in the administration page when it is considered safe. Or it triggers -something that isn't expected to be of public interest. Or it is for testing purposes only. +There are some config values that haven't found their way into the administration page. +This has several reasons. +Maybe they are part of a current development that isn't considered stable and will be added later in the administration page when it is considered safe. +Or it triggers something that isn't expected to be of public interest. Or it is for testing purposes only. -**Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger. Especially don't do that with -undocumented values. +**Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger. +Especially don't do that with undocumented values. -The header of the section describes the category, the value is the parameter. Example: To set the directory value please add this -line to your .htconfig.php: +The header of the section describes the category, the value is the parameter. +Example: To set the directory value please add this line to your .htconfig.php: $a->config['system']['directory'] = 'http://dir.friendi.ca'; - - ## Jabber ## * debug (Boolean) - Enable debug level for the jabber account synchronisation. * logfile - Logfile for the jabber account synchronisation. @@ -23,7 +22,7 @@ line to your .htconfig.php: * birthday_input_format - Default value is "ymd". * block_local_dir (Boolean) - Blocks the access to the directory of the local users. -* default_service_class - +* default_service_class - * delivery_batch_count - Number of deliveries per process. Default value is 1. (Disabled when using the worker) * diaspora_test (Boolean) - For development only. Disables the message transfer. * directory - The path to global directory. If not set then "http://dir.friendi.ca" is used. @@ -51,12 +50,13 @@ line to your .htconfig.php: * ostatus_poll_timeframe - Defines how old an item can be to try to complete the conversation with it. * paranoia (Boolean) - Log out users if their IP address changed. * permit_crawling (Boolean) - Restricts the search for not logged in users to one search per minute. +* profiler (Boolean) - Enable internal timings to help optimize code. Needed for "rendertime" addon. Default is false. * free_crawls - Number of "free" searches when "permit_crawling" is activated (Default value is 10) * crawl_permit_period - Period in seconds between allowed searches when the number of free searches is reached and "permit_crawling" is activated (Default value is 60) * png_quality - Default value is 8. * proc_windows (Boolean) - Should be enabled if Friendica is running under Windows. * proxy_cache_time - Time after which the cache is cleared. Default value is one day. -* pushpoll_frequency - +* pushpoll_frequency - * qsearch_limit - Default value is 100. * relay_server - Experimental Diaspora feature. Address of the relay server where public posts should be send to. For example https://podrelay.net * relay_subscribe (Boolean) - Enables the receiving of public posts from the relay. They will be included in the search and on the community page when it is set up to show all public items. @@ -75,7 +75,7 @@ line to your .htconfig.php: ## service_class ## -* upgrade_link - +* upgrade_link - ## experimentals ## @@ -87,19 +87,15 @@ line to your .htconfig.php: # Administrator Options # -Enabling the admin panel for an account, and thus making the account holder -admin of the node, is done by setting the variable +Enabling the admin panel for an account, and thus making the account holder admin of the node, is done by setting the variable $a->config['admin_email'] = "someone@example.com"; -where you have to match the email address used for the account with the one you -enter to the .htconfig file. If more then one account should be able to access -the admin panel, seperate the email addresses with a comma. +Where you have to match the email address used for the account with the one you enter to the .htconfig file. +If more then one account should be able to access the admin panel, seperate the email addresses with a comma. $a->config['admin_email'] = "someone@example.com,someonelese@example.com"; -If you want to have a more personalized closing line for the notification -emails you can set a variable for the admin_name. +If you want to have a more personalized closing line for the notification emails you can set a variable for the admin_name. $a->config['admin_name'] = "Marvin"; - diff --git a/include/Core/PConfig.php b/include/Core/PConfig.php index fc022d6282..63d204b3a2 100644 --- a/include/Core/PConfig.php +++ b/include/Core/PConfig.php @@ -118,7 +118,7 @@ class PConfig { * The value to store * @return mixed Stored $value or false */ - public static function set($uid,$family,$key,$value) { + public static function set($uid, $family, $key, $value) { global $a; diff --git a/include/nav.php b/include/nav.php index 293fa99a57..7a8230cc15 100644 --- a/include/nav.php +++ b/include/nav.php @@ -47,7 +47,11 @@ function nav(&$a) { * @brief Prepares a list of navigation links * * @param App $a - * @return array + * @return array Navigation links + * string 'sitelocation' => The webbie (username@site.com) + * array 'nav' => Array of links used in the nav menu + * string 'banner' => Formatted html link with banner image + * array 'userinfo' => Array of user information (name, icon) */ function nav_info(App $a) { @@ -91,7 +95,7 @@ function nav_info(App $a) $nav['login'] = array('login', t('Login'), ($a->module == 'login' ? 'selected' : ''), t('Sign in')); } - // "Home" should also take you home from an authenticated remote profile connection + // "Home" should also take you home from an authenticated remote profile connection $homelink = get_my_url(); if (! $homelink) { $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : ''); @@ -188,6 +192,7 @@ function nav_info(App $a) $nav['contacts'] = array('contacts', t('Contacts'), '', t('Manage/edit friends and contacts')); } + // Show the link to the admin configuration page if user is admin if (is_site_admin()) { $nav['admin'] = array('admin/', t('Admin'), '', t('Site setup and configuration')); } @@ -210,7 +215,6 @@ function nav_info(App $a) ); } - /** * Set a menu item in navbar as selected * diff --git a/include/text.php b/include/text.php index 72fce41861..4b2a4a9409 100644 --- a/include/text.php +++ b/include/text.php @@ -678,11 +678,13 @@ function attribute_contains($attr,$s) { return false; }} -if(! function_exists('logger')) { +if (! function_exists('logger')) { /* setup int->string log level map */ $LOGGER_LEVELS = array(); /** + * @brief Logs the given message at the given log level + * * log levels: * LOGGER_NORMAL (default) * LOGGER_TRACE @@ -692,51 +694,58 @@ $LOGGER_LEVELS = array(); * * @global App $a * @global dba $db + * @global array $LOGGER_LEVELS * @param string $msg * @param int $level */ -function logger($msg,$level = 0) { - // turn off logger in install mode +function logger($msg, $level = 0) { global $a; global $db; global $LOGGER_LEVELS; - if(($a->module == 'install') || (! ($db && $db->connected))) return; + $debugging = get_config('system','debugging'); + $logfile = get_config('system','logfile'); + $loglevel = intval(get_config('system','loglevel')); - if (count($LOGGER_LEVELS)==0){ - foreach (get_defined_constants() as $k=>$v){ - if (substr($k,0,7)=="LOGGER_") - $LOGGER_LEVELS[$v] = substr($k,7,7); + // turn off logger in install mode + if ( + $a->module == 'install' + || ! ($db && $db->connected) + || ! $debugging + || ! $logfile + || $level > $loglevel + ) { + return; + } + + if (count($LOGGER_LEVELS) == 0) { + foreach (get_defined_constants() as $k => $v) { + if (substr($k, 0, 7) == "LOGGER_") { + $LOGGER_LEVELS[$v] = substr($k, 7, 7); + } } } - $debugging = get_config('system','debugging'); - $loglevel = intval(get_config('system','loglevel')); - $logfile = get_config('system','logfile'); - - if((! $debugging) || (! $logfile) || ($level > $loglevel)) - return; - $process_id = session_id(); - if ($process_id == "") + if ($process_id == '') { $process_id = get_app()->process_id; + } $callers = debug_backtrace(); - $logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n", - datetime_convert(), - $process_id, - $LOGGER_LEVELS[$level], - basename($callers[0]['file']), - $callers[0]['line'], - $callers[1]['function'], - $msg - ); + $logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n", + datetime_convert(), + $process_id, + $LOGGER_LEVELS[$level], + basename($callers[0]['file']), + $callers[0]['line'], + $callers[1]['function'], + $msg + ); $stamp1 = microtime(true); @file_put_contents($logfile, $logline, FILE_APPEND); $a->save_timestamp($stamp1, "file"); - return; }} diff --git a/mod/settings.php b/mod/settings.php index 37498a0dda..314b99ba7a 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -279,7 +279,7 @@ function settings_post(&$a) { return; } - if(($a->argc > 1) && ($a->argv[1] === 'features')) { + if (($a->argc > 1) && ($a->argv[1] === 'features')) { check_form_security_token_redirectOnErr('/settings/features', 'settings_features'); foreach($_POST as $k => $v) { if(strpos($k,'feature_') === 0) { @@ -290,49 +290,50 @@ function settings_post(&$a) { return; } - if(($a->argc > 1) && ($a->argv[1] === 'display')) { - + if (($a->argc > 1) && ($a->argv[1] === 'display')) { check_form_security_token_redirectOnErr('/settings/display', 'settings_display'); - $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']); - $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : ''); - $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); - $first_day_of_week = ((x($_POST,'first_day_of_week')) ? intval($_POST['first_day_of_week']) : 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); + $theme = x($_POST, 'theme') ? notags(trim($_POST['theme'])) : $a->user['theme']; + $mobile_theme = x($_POST, 'mobile_theme') ? notags(trim($_POST['mobile_theme'])) : ''; + $nosmile = x($_POST, 'nosmile') ? intval($_POST['nosmile']) : 0; + $first_day_of_week = x($_POST, 'first_day_of_week') ? intval($_POST['first_day_of_week']) : 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; + $bandwidth_saver = x($_POST, 'bandwidth_saver') ? intval($_POST['bandwidth_saver']) : 0; + $browser_update = x($_POST, 'browser_update') ? intval($_POST['browser_update']) : 0; if ($browser_update != -1) { - $browser_update = $browser_update * 1000; + $browser_update = $browser_update * 1000; if ($browser_update < 10000) $browser_update = 10000; } - $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40); - if($itemspage_network > 100) + $itemspage_network = x($_POST,'itemspage_network') ? intval($_POST['itemspage_network']) : 40; + if ($itemspage_network > 100) { $itemspage_network = 100; - $itemspage_mobile_network = ((x($_POST,'itemspage_mobile_network')) ? intval($_POST['itemspage_mobile_network']) : 20); - if($itemspage_mobile_network > 100) + } + $itemspage_mobile_network = x($_POST,'itemspage_mobile_network') ? intval($_POST['itemspage_mobile_network']) : 20; + if ($itemspage_mobile_network > 100) { $itemspage_mobile_network = 100; - + } if($mobile_theme !== '') { set_pconfig(local_user(),'system','mobile_theme',$mobile_theme); } - set_pconfig(local_user(),'system','update_interval', $browser_update); - set_pconfig(local_user(),'system','itemspage_network', $itemspage_network); - set_pconfig(local_user(),'system','itemspage_mobile_network', $itemspage_mobile_network); - set_pconfig(local_user(),'system','no_smilies',$nosmile); - set_pconfig(local_user(),'system','first_day_of_week',$first_day_of_week); - 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); + set_pconfig(local_user(), 'system', 'update_interval' , $browser_update); + set_pconfig(local_user(), 'system', 'itemspage_network' , $itemspage_network); + set_pconfig(local_user(), 'system', 'itemspage_mobile_network', $itemspage_mobile_network); + set_pconfig(local_user(), 'system', 'no_smilies' , $nosmile); + set_pconfig(local_user(), 'system', 'first_day_of_week' , $first_day_of_week); + 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); + set_pconfig(local_user(), 'system', 'bandwidth_saver' , $bandwidth_saver); - - if ($theme == $a->user['theme']){ + if ($theme == $a->user['theme']) { // call theme_post only if theme has not been changed - if( ($themeconfigfile = get_theme_config_file($theme)) != null){ + if (($themeconfigfile = get_theme_config_file($theme)) != null) { require_once($themeconfigfile); theme_post($a); } @@ -975,8 +976,11 @@ function settings_content(&$a) { $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 + $bandwidth_saver = get_pconfig(local_user(), 'system', 'bandwidth_saver'); + $bandwidth_saver = (($bandwidth_saver === false) ? '0' : $bandwidth_saver); // default if not set: 0 + $theme_config = ""; - if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){ + if (($themeconfigfile = get_theme_config_file($theme_selected)) != null) { require_once($themeconfigfile); $theme_config = theme_content($a); } @@ -1000,6 +1004,7 @@ function settings_content(&$a) { '$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("Automatic updates only at the top of the network page"), $no_auto_update, 'When disabled, the network page is updated all the time, which could be confusing while reading.'), + '$bandwidth_saver' => array('bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, 'When enabled, embedded content is not displayed on automatic updates, they only show on page reload.'), '$d_tset' => t('General Theme Settings'), '$d_ctset' => t('Custom Theme Settings'), @@ -1347,4 +1352,3 @@ function settings_content(&$a) { return $o; } - diff --git a/mod/update_community.php b/mod/update_community.php index 512629b005..d5df7ba3bf 100644 --- a/mod/update_community.php +++ b/mod/update_community.php @@ -2,7 +2,7 @@ // See update_profile.php for documentation -require_once('mod/community.php'); +require_once("mod/community.php"); function update_community_content(&$a) { @@ -10,24 +10,25 @@ function update_community_content(&$a) { echo "\r\n"; echo "
"; - $text = community_content($a,true); - $pattern = "/]*) src=\"([^\"]*)\"/"; - $replace = "'; - $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; - $text = preg_replace($pattern, $replace, $text); + if (get_pconfig(local_user(), "system", "bandwith_saver")) { + $replace = "
".t("[Embedded content - reload page to view]")."
"; + $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; + $text = preg_replace($pattern, $replace, $text); + } - echo str_replace("\t",' ',$text); + echo str_replace("\t", " ", $text); echo "
"; echo "\r\n"; killme(); - } \ No newline at end of file diff --git a/mod/update_display.php b/mod/update_display.php index 25b0f77926..bd2a52934f 100644 --- a/mod/update_display.php +++ b/mod/update_display.php @@ -2,12 +2,12 @@ // See update_profile.php for documentation -require_once('mod/display.php'); -require_once('include/group.php'); +require_once("mod/display.php"); +require_once("include/group.php"); function update_display_content(&$a) { - $profile_uid = intval($_GET['p']); + $profile_uid = intval($_GET["p"]); header("Content-type: text/html"); echo "\r\n"; @@ -19,20 +19,20 @@ function update_display_content(&$a) { $replace = "'; - $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; - $text = preg_replace($pattern, $replace, $text); + if (get_pconfig(local_user(), "system", "bandwith_saver")) { + $replace = "
".t("[Embedded content - reload page to view]")."
"; + $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; + $text = preg_replace($pattern, $replace, $text); + } - - echo str_replace("\t",' ',$text); + echo str_replace("\t", " ", $text); echo ""; echo "\r\n"; killme(); - } diff --git a/mod/update_network.php b/mod/update_network.php index 1bf3746575..258d03e322 100644 --- a/mod/update_network.php +++ b/mod/update_network.php @@ -2,40 +2,41 @@ // See update_profile.php for documentation -require_once('mod/network.php'); -require_once('include/group.php'); +require_once("mod/network.php"); +require_once("include/group.php"); function update_network_content(&$a) { - $profile_uid = intval($_GET['p']); + $profile_uid = intval($_GET["p"]); header("Content-type: text/html"); echo "\r\n"; echo "
"; - if (!get_pconfig($profile_uid, "system", "no_auto_update") OR ($_GET['force'] == 1)) - $text = network_content($a,$profile_uid); - else + if (!get_pconfig($profile_uid, "system", "no_auto_update") OR ($_GET["force"] == 1)) { + $text = network_content($a, $profile_uid); + } else { $text = ""; + } $pattern = "/]*) src=\"([^\"]*)\"/"; $replace = "'; - $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; - $text = preg_replace($pattern, $replace, $text); + if (get_pconfig(local_user(), "system", "bandwith_saver")) { + $replace = "
".t("[Embedded content - reload page to view]")."
"; + $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; + $text = preg_replace($pattern, $replace, $text); + } - - echo str_replace("\t",' ',$text); + echo str_replace("\t", " ", $text); echo "
"; echo "\r\n"; killme(); - } diff --git a/mod/update_notes.php b/mod/update_notes.php index 6b8fff5115..ee9d1d71f5 100644 --- a/mod/update_notes.php +++ b/mod/update_notes.php @@ -1,17 +1,15 @@ \r\n"; @@ -20,37 +18,35 @@ function update_notes_content(&$a) { /** * - * Grab the page inner contents by calling the content function from the profile module directly, - * but move any image src attributes to another attribute name. This is because + * Grab the page inner contents by calling the content function from the profile module directly, + * but move any image src attributes to another attribute name. This is because * some browsers will prefetch all the images for the page even if we don't need them. * The only ones we need to fetch are those for new page additions, which we'll discover * on the client side and then swap the image back. * */ - $text = notes_content($a,$profile_uid); + $text = notes_content($a, $profile_uid); $pattern = "/]*) src=\"([^\"]*)\"/"; $replace = "'; - $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; - $text = preg_replace($pattern, $replace, $text); + if (get_pconfig(local_user(), "system", "bandwith_saver")) { + $replace = "
".t("[Embedded content - reload page to view]")."
"; + $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; + $text = preg_replace($pattern, $replace, $text); + } - /** - * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well - */ - - echo str_replace("\t",' ',$text); + // reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well + echo str_replace("\t", " ", $text); echo ""; echo "\r\n"; killme(); - } \ No newline at end of file diff --git a/mod/update_profile.php b/mod/update_profile.php index 2492a48ee4..1bc29d82ce 100644 --- a/mod/update_profile.php +++ b/mod/update_profile.php @@ -3,58 +3,49 @@ /** * Module: update_profile * Purpose: AJAX synchronisation of profile page - * */ - -require_once('mod/profile.php'); +require_once("mod/profile.php"); function update_profile_content(&$a) { - $profile_uid = intval($_GET['p']); + $profile_uid = intval($_GET["p"]); header("Content-type: text/html"); echo "\r\n"; - /** - * We can remove this hack once Internet Explorer recognises HTML5 natively - */ - + // We can remove this hack once Internet Explorer recognises HTML5 natively echo "
"; /** - * - * Grab the page inner contents by calling the content function from the profile module directly, - * but move any image src attributes to another attribute name. This is because + * Grab the page inner contents by calling the content function from the profile module directly, + * but move any image src attributes to another attribute name. This is because * some browsers will prefetch all the images for the page even if we don't need them. * The only ones we need to fetch are those for new page additions, which we'll discover * on the client side and then swap the image back. - * */ - $text = profile_content($a,$profile_uid); + $text = profile_content($a, $profile_uid); $pattern = "/]*) src=\"([^\"]*)\"/"; $replace = "'; - $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; - $text = preg_replace($pattern, $replace, $text); - $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; - $text = preg_replace($pattern, $replace, $text); + if (get_pconfig(local_user(), "system", "bandwith_saver")) { + $replace = "
".t("[Embedded content - reload page to view]")."
"; + $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i"; + $text = preg_replace($pattern, $replace, $text); + $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i"; + $text = preg_replace($pattern, $replace, $text); + } - /** - * reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well - */ - - echo str_replace("\t",' ',$text); + // reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well + echo str_replace("\t", " ", $text); echo "
"; echo "\r\n"; killme(); - } \ No newline at end of file diff --git a/object/Conversation.php b/object/Conversation.php index 94eed94d5f..36c06c6d62 100644 --- a/object/Conversation.php +++ b/object/Conversation.php @@ -145,7 +145,6 @@ class Conversation extends BaseObject { $result[] = $item_data; } - //$a->mark_timestamp(); return $result; } diff --git a/view/templates/field_checkbox.tpl b/view/templates/field_checkbox.tpl index 06796376b6..3d4a4284b6 100644 --- a/view/templates/field_checkbox.tpl +++ b/view/templates/field_checkbox.tpl @@ -1,5 +1,6 @@ -
- - - {{$field.3}} +
+ + + + {{$field.3}}
diff --git a/view/templates/settings_display.tpl b/view/templates/settings_display.tpl index 8b15563bda..d6d0a1a81b 100644 --- a/view/templates/settings_display.tpl +++ b/view/templates/settings_display.tpl @@ -13,6 +13,7 @@ {{include file="field_checkbox.tpl" field=$nosmile}} {{include file="field_checkbox.tpl" field=$noinfo}} {{include file="field_checkbox.tpl" field=$infinite_scroll}} +{{include file="field_checkbox.tpl" field=$bandwidth_saver}}

{{$calendar_title}}

{{include file="field_select.tpl" field=$first_day_of_week}} diff --git a/view/theme/decaf-mobile/templates/field_checkbox.tpl b/view/theme/decaf-mobile/templates/field_checkbox.tpl index ddcc05aa51..4f094e0893 100644 --- a/view/theme/decaf-mobile/templates/field_checkbox.tpl +++ b/view/theme/decaf-mobile/templates/field_checkbox.tpl @@ -1,7 +1,8 @@ - -
- -
- {{$field.3}} + +
+ + +
+ {{$field.3}}
diff --git a/view/theme/frio/templates/field_checkbox.tpl b/view/theme/frio/templates/field_checkbox.tpl index 112208c1da..1062269236 100644 --- a/view/theme/frio/templates/field_checkbox.tpl +++ b/view/theme/frio/templates/field_checkbox.tpl @@ -1,6 +1,7 @@ -
- +
+ +