From 06ec5424c763f3dce0029d0b5ff5c47b94abdf7b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 28 Oct 2015 16:58:13 -0700 Subject: restrict sslify to img tags by default - set config system.sslify_everything if you want to proxy media files also. --- include/text.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index c30be77b8..5df7bb4a1 100644 --- a/include/text.php +++ b/include/text.php @@ -912,8 +912,17 @@ function sslify($s) { if (strpos(z_root(),'https:') === false) return $s; + // By default we'll only sslify img tags because media files will probably choke. + // You can set sslify_everything if you want - but it will likely white-screen if it hits your php memory limit. + // The downside is that http: media files will likely be blocked by your browser + // Complain to your browser maker + + $allow = get_config('system','sslify_everything'); + + $pattern = (($allow) ? "/\<(.*?)src=\"(http\:.*?)\"(.*?)\>/" : "/\/" ); + $matches = null; - $cnt = preg_match_all("/\<(.*?)src=\"(http\:.*?)\"(.*?)\>/",$s,$matches,PREG_SET_ORDER); + $cnt = preg_match_all($pattern,$s,$matches,PREG_SET_ORDER); if ($cnt) { foreach ($matches as $match) { $filename = basename( parse_url($match[2], PHP_URL_PATH) ); -- cgit v1.2.3 From 5920a96da7f71b45b7d386d27da2c130e3ddb23f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 31 Oct 2015 00:38:01 +0100 Subject: make attachments appear in a dropdown in wall-item-tools-left --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 5df7bb4a1..c2573da0c 100644 --- a/include/text.php +++ b/include/text.php @@ -1233,7 +1233,7 @@ function theme_attachments(&$item) { if($label == ' ') $label = t('Unknown Attachment'); - $title = t('Attachment') . ' - ' . (($r['length']) ? userReadableSize($r['length']) : t('Size Unknown')); + $title = t('Size') . ' ' . (($r['length']) ? userReadableSize($r['length']) : t('unknown')); require_once('include/identity.php'); if(is_foreigner($item['author_xchan'])) -- cgit v1.2.3 From 9c240de3032212ea95474319e382aaabd25c977e Mon Sep 17 00:00:00 2001 From: ken restivo Date: Sun, 8 Nov 2015 14:37:48 -0800 Subject: Add unit tests for valid email function. --- include/text.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index c2573da0c..edaa8dcd3 100644 --- a/include/text.php +++ b/include/text.php @@ -872,15 +872,17 @@ function searchbox($s,$id='search-box',$url='/search',$save = false) { )); } +function valid_email_regex($x){ + if(preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) + return true; + return false; +} function valid_email($x){ if(get_config('system','disable_email_validation')) return true; - if(preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x)) - return true; - - return false; + return valid_email_regex($x); } /** -- cgit v1.2.3