From 6942b16ef58021cd0f74b368d2b45b07b9a06ff9 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 25 Aug 2015 19:50:23 +0200 Subject: [PATCH] See issue 1855. OOhembed is removed. --- include/oembed.php | 19 +++++++++---------- mod/admin.php | 14 +++++++++----- view/templates/admin_site.tpl | 1 + 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/include/oembed.php b/include/oembed.php index aec92bfa0..cbd856648 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -56,25 +56,24 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){ if ($txt==false || $txt==""){ $embedly = get_config("system", "embedly"); - if ($embedly == "") { - // try oohembed service - $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth; - $txt = fetch_url($ourl); - } else { + if ($embedly != "") { // try embedly service $ourl = "https://api.embed.ly/1/oembed?key=".$embedly."&url=".urlencode($embedurl); $txt = fetch_url($ourl); - } - logger("oembed_fetch_url: ".$txt, LOGGER_DEBUG); + logger("oembed_fetch_url: ".$txt, LOGGER_DEBUG); + } } $txt=trim($txt); - if ($txt[0]!="{") $txt='{"type":"error"}'; - //save in cache - Cache::set($a->videowidth . $embedurl,$txt, CACHE_DAY); + if ($txt==false || $txt=="") + return false; + if ($txt[0]!="{") + $txt='{"type":"error"}'; + else //save in cache + Cache::set($a->videowidth . $embedurl,$txt, CACHE_DAY); } $j = json_decode($txt); diff --git a/mod/admin.php b/mod/admin.php index be4ab8b52..9c3341cb9 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -413,6 +413,7 @@ function admin_page_site_post(&$a){ $old_pager = ((x($_POST,'old_pager')) ? True : False); $only_tag_search = ((x($_POST,'only_tag_search')) ? True : False); $rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0); + $embedly = ((x($_POST,'embedly')) ? notags(trim($_POST['embedly'])) : ''); if($ssl_policy != intval(get_config('system','ssl_policy'))) { @@ -558,6 +559,8 @@ function admin_page_site_post(&$a){ set_config('system','rino_encrypt', $rino); + set_config('system','embedly', $embedly); + info( t('Site settings updated.') . EOL); goaway($a->get_baseurl(true) . '/admin/site' ); @@ -750,19 +753,20 @@ function admin_page_site(&$a) { '$use_fulltext_engine' => array('use_fulltext_engine', t("Use MySQL full text engine"), get_config('system','use_fulltext_engine'), t("Activates the full text engine. Speeds up search - but can only search for four and more characters.")), '$suppress_language' => array('suppress_language', t("Suppress Language"), get_config('system','suppress_language'), t("Suppress language information in meta information about a posting.")), '$suppress_tags' => array('suppress_tags', t("Suppress Tags"), get_config('system','suppress_tags'), t("Suppress showing a list of hashtags at the end of the posting.")), - '$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), "The item caches buffers generated bbcode and external images."), + '$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), t("The item caches buffers generated bbcode and external images.")), '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")), '$max_comments' => array('max_comments', t("Maximum numbers of comments per post"), get_config('system','max_comments'), t("How much comments should be shown for each post? Default value is 100.")), - '$lockpath' => array('lockpath', t("Path for lock file"), get_config('system','lockpath'), "The lock file is used to avoid multiple pollers at one time. Only define a folder here."), - '$temppath' => array('temppath', t("Temp path"), get_config('system','temppath'), "If you have a restricted system where the webserver can't access the system temp path, enter another path here."), - '$basepath' => array('basepath', t("Base path to installation"), get_config('system','basepath'), "If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."), + '$lockpath' => array('lockpath', t("Path for lock file"), get_config('system','lockpath'), t("The lock file is used to avoid multiple pollers at one time. Only define a folder here.")), + '$temppath' => array('temppath', t("Temp path"), get_config('system','temppath'), t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")), + '$basepath' => array('basepath', t("Base path to installation"), get_config('system','basepath'), t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot.")), '$proxy_disabled' => array('proxy_disabled', t("Disable picture proxy"), get_config('system','proxy_disabled'), t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwith.")), '$old_pager' => array('old_pager', t("Enable old style pager"), get_config('system','old_pager'), t("The old style pager has page numbers but slows down massively the page speed.")), '$only_tag_search' => array('only_tag_search', t("Only search in tags"), get_config('system','only_tag_search'), t("On large systems the text search can slow down the system extremely.")), - '$relocate_url' => array('relocate_url', t("New base url"), $a->get_baseurl(), "Change base url for this server. Sends relocate message to all DFRN contacts of all users."), + '$relocate_url' => array('relocate_url', t("New base url"), $a->get_baseurl(), t("Change base url for this server. Sends relocate message to all DFRN contacts of all users.")), '$rino' => array('rino', t("RINO Encryption"), intval(get_config('system','rino_encrypt')), t("Encryption layer between nodes."), array("Disabled", "RINO1 (deprecated)", "RINO2")), + '$embedly' => array('embedly', t("Embedly API key"), get_config('system','embedly'), t("Embedly is used to fetch additional data for web pages. This is an optional parameter.")), '$form_security_token' => get_form_security_token("admin_site") diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index 1517b9f01..b749f37cb 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -114,6 +114,7 @@ {{include file="field_checkbox.tpl" field=$suppress_language}} {{include file="field_checkbox.tpl" field=$suppress_tags}} {{include file="field_checkbox.tpl" field=$nodeinfo}} + {{include file="field_input.tpl" field=$embedly}}

{{$portable_contacts}}