]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #1647 from annando/1506-performance
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 2 Jun 2015 20:46:07 +0000 (22:46 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 2 Jun 2015 20:46:07 +0000 (22:46 +0200)
Performance improvements when searching for existing GUIDs

htconfig.php
include/items.php
include/oembed.php
mod/directory.php
mod/poco.php

index 4208924cfd3f2d510288e16b8ca387d8776eb6e6..4c88b6e742dbc70fa8edf38a6af0c1016f2d5432 100644 (file)
@@ -94,3 +94,7 @@ $a->config['system']['lockpath'] = "";
 
 // Use the old style "share"
 // $a->config['system']['old_share'] = false;
+
+//Deny public access to the local directory
+//$a->config['system']['block_local_dir'] = false;
+
index bd353c5bf3ab7ec15fae6ea1fff77e450c109c33..588bd353f7d27cb6c63b4c706f19ba33ecb6fda3 100644 (file)
@@ -1707,12 +1707,12 @@ function item_body_set_hashtags(&$item) {
        // mask hashtags inside of url, bookmarks and attachments to avoid urls in urls
        $item["body"] = preg_replace_callback("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
                function ($match){
-                       return("[url=".$match[1]."]".str_replace("#", "&num;", $match[2])."[/url]");
+                       return("[url=".str_replace("#", "&num;", $match[1])."]".str_replace("#", "&num;", $match[2])."[/url]");
                },$item["body"]);
 
        $item["body"] = preg_replace_callback("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism",
                function ($match){
-                       return("[bookmark=".$match[1]."]".str_replace("#", "&num;", $match[2])."[/bookmark]");
+                       return("[bookmark=".str_replace("#", "&num;", $match[1])."]".str_replace("#", "&num;", $match[2])."[/bookmark]");
                },$item["body"]);
 
        $item["body"] = preg_replace_callback("/\[attachment (.*)\](.*?)\[\/attachment\]/ism",
@@ -1724,6 +1724,7 @@ function item_body_set_hashtags(&$item) {
        $item["body"] = preg_replace("/&num;\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
                        "&num;$2", $item["body"]);
 
+
        foreach($tags as $tag) {
                if(strpos($tag,'#') !== 0)
                        continue;
@@ -4966,17 +4967,17 @@ function first_post_date($uid,$wall = false) {
 /* modified posted_dates() {below} to arrange the list in years */
 function list_post_dates($uid, $wall) {
        $dnow = datetime_convert('',date_default_timezone_get(),'now','Y-m-d');
-       
-       $dthen = first_post_date($uid, $wall);        
+
+       $dthen = first_post_date($uid, $wall);
        if(! $dthen)
                return array();
-        
+
        // Set the start and end date to the beginning of the month
         $dnow = substr($dnow,0,8).'01';
        $dthen = substr($dthen,0,8).'01';
-        
+
        $ret = array();
-        
+
        // Starting with the current month, get the first and last days of every
        // month down to and including the month of the first post
        while(substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
@@ -5031,19 +5032,19 @@ function posted_date_widget($url,$uid,$wall) {
 
 /*     if($wall && intval(get_pconfig($uid,'system','no_wall_archive_widget')))
                return $o;*/
-        
+
        $visible_years = get_pconfig($uid,'system','archive_visible_years');
        if(! $visible_years)
-               $visible_years = 5;     
-        
+               $visible_years = 5;
+
         $ret = list_post_dates($uid,$wall);
-        
+
        if(! count($ret))
                return $o;
 
         $cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
        $cutoff = ((array_key_exists($cutoff_year,$ret))? true : false);
-        
+
        $o = replace_macros(get_markup_template('posted_date_widget.tpl'),array(
                '$title' => t('Archives'),
                '$size' => $visible_years,
index 6fc981729944a29323b969bb6fcdf78ba1de1b4c..26746af51c17e13d637c4c177940abec99dc5489 100755 (executable)
@@ -193,8 +193,9 @@ function oembed_format_object($j){
        } else {
                // add <a> for html2bbcode conversion
                $ret .= "<a href='$embedurl' rel='oembed'>$embedurl</a>";
-               $ret.="<br style='clear:left'></span>";
+               $ret .= "<br style='clear:left'>";
        }
+       $ret.="</span>";
        return  mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
 }
 
index 7fab53b6807cadd363da70227b1f3c3a6679e5aa..b13e17627a8dd6fd347d6e46a23b54efc3d902ca 100644 (file)
@@ -29,7 +29,8 @@ function directory_content(&$a) {
 
        require_once("mod/proxy.php");
 
-       if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+       if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) || 
+                (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
                notice( t('Public access denied.') . EOL);
                return;
        }
index 86b43d651dc916e9ac6c19920a3b993a4e394c4e..89f2f879a05c1763b30358e62591fe0a935b614a 100644 (file)
@@ -5,7 +5,7 @@ function poco_init(&$a) {
 
        $system_mode = false;
 
-       if(intval(get_config('system','block_public')))
+       if(intval(get_config('system','block_public')) || (get_config('system','block_local_dir')))
                http_status_exit(401);