aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php11
-rwxr-xr-xinclude/dba/dba_driver.php25
-rwxr-xr-xinclude/oembed.php31
3 files changed, 46 insertions, 21 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 33219c67d..70183fda3 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -87,12 +87,11 @@ function nakedoembed($match) {
$strip_url = strip_escaped_zids($url);
- $o = oembed_fetch_url($strip_url);
-
- if ($o['type'] == 'error')
- return str_replace($url,$strip_url,$match[0]);
-
- return '[embed]' . $strip_url . '[/embed]';
+ // this function no longer performs oembed on naked links
+ // because they author may have created naked links intentionally.
+ // Now it just strips zids on naked links.
+
+ return str_replace($url,$strip_url,$match[0]);
}
function tryzrlaudio($match) {
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index ee0e06a91..cfb208e2d 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -485,3 +485,28 @@ function db_columns($table) {
return [];
}
+
+
+function db_indexes($table) {
+
+ if($table) {
+ if(ACTIVE_DBTYPE === DBTYPE_POSTGRES) {
+ $r = q("SELECT indexname from pg_indexes where tablename = '%s'",
+ dbesc($table)
+ );
+ if($r) {
+ return ids_to_array($r,'indexname');
+ }
+ }
+ else {
+ $r = q("show index from %s",
+ dbesc($table)
+ );
+ if($r) {
+ return ids_to_array($r,'Key_name');
+ }
+ }
+ }
+
+ return [];
+}
diff --git a/include/oembed.php b/include/oembed.php
index 426197c5f..ee9e57c3f 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -1,6 +1,6 @@
<?php /** @file */
-use Zotlabs\Lib as Zlib;
+use Zotlabs\Lib\Cache;
function oembed_replacecb($matches){
@@ -133,7 +133,6 @@ function oembed_fetch_url($embedurl){
}
}
-
$txt = null;
// we should try to cache this and avoid a lookup on each render
@@ -143,10 +142,22 @@ function oembed_fetch_url($embedurl){
$furl = ((local_channel() && $zrl) ? zid($embedurl) : $embedurl);
- if($action !== 'block') {
- $txt = Zlib\Cache::get('[' . App::$videowidth . '] ' . $furl);
+ if($action !== 'block' && (! get_config('system','oembed_cache_disable'))) {
+ $txt = Cache::get('[' . App::$videowidth . '] ' . $furl);
}
+
+ if(strpos(strtolower($embedurl),'.pdf') !== false) {
+ $action = 'allow';
+ $j = [
+ 'html' => '<object data="' . $embedurl . '" type="application/pdf" style="width: 100%; height: 300px;"></object>',
+ 'title' => t('View PDF'),
+ 'type' => 'pdf'
+ ];
+ // set $txt to something so that we don't attempt to fetch what could be a lengthy pdf.
+ $txt = EMPTY_STR;
+ }
+
if(is_null($txt)) {
$txt = "";
@@ -215,20 +226,10 @@ function oembed_fetch_url($embedurl){
// save in cache
if(! get_config('system','oembed_cache_disable'))
- Zlib\Cache::set('[' . App::$videowidth . '] ' . $furl, $txt);
+ Cache::set('[' . App::$videowidth . '] ' . $furl, $txt);
}
- if(strpos(strtolower($embedurl),'.pdf') !== false) {
- $action = 'allow';
- $j = [
- 'html' => '<object data="' . $embedurl . '" type="application/pdf" style="width: 100%; height: 300px;"></object>',
- 'title' => t('View PDF'),
- 'type' => 'pdf'
- ];
-
- }
-
if(! $j) {
$j = json_decode($txt,true);
}