diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/RedDAV/RedBrowser.php | 2 | ||||
-rw-r--r-- | include/bb2diaspora.php | 4 | ||||
-rwxr-xr-x | include/diaspora.php | 8 | ||||
-rw-r--r-- | include/identity.php | 32 | ||||
-rwxr-xr-x | include/oembed.php | 22 | ||||
-rw-r--r-- | include/photo/photo_driver.php | 2 | ||||
-rw-r--r-- | include/text.php | 36 |
7 files changed, 74 insertions, 32 deletions
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php index dcd54ef82..6639250ae 100644 --- a/include/RedDAV/RedBrowser.php +++ b/include/RedDAV/RedBrowser.php @@ -41,7 +41,7 @@ class RedBrowser extends DAV\Browser\Plugin { */ public function __construct(&$auth) { $this->auth = $auth; - parent::__construct(false, false); + parent::__construct(true, false); } /** diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 089838e97..65f4311a0 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -263,6 +263,10 @@ function bb2dmention_callback($match) { function bb2diaspora_itemwallwall(&$item) { + if(! array_key_exists('author',$item)) { + logger('bb2diaspora_itemwallwall: no author'); + } + if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author']))) { logger('bb2diaspora_itemwallwall: author: ' . print_r($item['author'],true), LOGGER_DEBUG); } diff --git a/include/diaspora.php b/include/diaspora.php index f0687e51e..d288e1435 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -821,7 +821,7 @@ function diaspora_post($importer,$xml,$msg) { foreach($tags as $tag) { if(strpos($tag,'#') === 0) { - if(strpos($tag,'[url=')) + if((strpos($tag,'[url=')) || (strpos($tag,'[zrl'))) continue; // don't link tags that are already embedded in links @@ -1050,7 +1050,7 @@ function diaspora_reshare($importer,$xml,$msg) { foreach($tags as $tag) { if(strpos($tag,'#') === 0) { - if(strpos($tag,'[url=')) + if((strpos($tag,'[url=')) || (strpos($tag,'[zrl'))) continue; // don't link tags that are already embedded in links @@ -1087,7 +1087,7 @@ function diaspora_reshare($importer,$xml,$msg) { } } - // This won't work + // This won't work on redmatrix $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid; $datarray['uid'] = $importer['channel_id']; @@ -1337,7 +1337,7 @@ function diaspora_comment($importer,$xml,$msg) { foreach($tags as $tag) { if(strpos($tag,'#') === 0) { - if(strpos($tag,'[url=')) + if((strpos($tag,'[url=')) || (strpos($tag,'[zrl'))) continue; // don't link tags that are already embedded in links diff --git a/include/identity.php b/include/identity.php index fafb97bbb..4417f4028 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1525,4 +1525,36 @@ function get_profile_fields_advanced($filter = 0) { return $x; } +/** + * @function notifications_off($channel_id) + * Clear notifyflags for a channel - most likely during bulk import of content or other activity that is likely + * to generate huge amounts of undesired notifications. + * @param int $channel_id + * The channel to disable notifications for + * @returns int + * Current notification flag value. Send this to notifications_on() to restore the channel settings when finished + * with the activity requiring notifications_off(); + */ + + +function notifications_off($channel_id) { + $r = q("select channel_notifyflags from channel where channel_id = %d limit 1", + intval($channel_id) + ); + $x = q("update channel set channel_notifyflags = 0 where channel_id = %d limit 1", + intval($channel_id) + ); + + return intval($r[0]['channel_notifyflags']); + +} + + +function notifications_on($channel_id,$value) { + $x = q("update channel set channel_notifyflags = %d where channel_id = %d limit 1", + intval($value), + intval($channel_id) + ); + return $x; +}
\ No newline at end of file diff --git a/include/oembed.php b/include/oembed.php index de3a6edc8..e08b287d1 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -56,6 +56,15 @@ function oembed_fetch_url($embedurl){ $txt = $x['body']; break; } + // soundcloud is now using text/json+oembed instead of application/json+oembed, + // others may be also + $entries = $xpath->query("//link[@type='text/json+oembed']"); + foreach($entries as $e){ + $href = $e->getAttributeNode("href")->nodeValue; + $x = z_fetch_url($href . '&maxwidth=' . $a->videowidth); + $txt = $x['body']; + break; + } } } } @@ -83,7 +92,8 @@ function oembed_fetch_url($embedurl){ function oembed_format_object($j){ $a = get_app(); $embedurl = $j->embedurl; - $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null) ); + + $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null)); $ret="<span class='oembed ".$j->type."'>"; switch ($j->type) { @@ -118,7 +128,6 @@ function oembed_format_object($j){ }; break; case "photo": { $ret.= "<img width='".$j->width."' src='".$j->url."'>"; - //$ret.= "<img width='".$j->width."' height='".$j->height."' src='".$j->url."'>"; $ret.="<br>"; }; break; case "link": { @@ -154,13 +163,12 @@ function oembed_iframe($src,$width,$height) { $height = intval($height) + 80; $width = intval($width) + 40; - $a = get_app(); - - $sandbox = ((strpos($src,get_app()->get_hostname())) ? ' sandbox="allow-scripts" ' : ''); + $s = z_root() . '/oembed/' . base64url_encode($src); - $s = $a->get_baseurl()."/oembed/".base64url_encode($src); + // Make sure any children are sandboxed within their own iframe. - return '<iframe ' . $sandbox . ' height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' . t('Embedded content') . '</iframe>'; + return '<iframe height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' + . t('Embedded content') . '</iframe>'; } diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index c416c0df3..508d82957 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -515,7 +515,7 @@ function guess_image_type($filename, $headers = '') { $ignore_imagick = get_config('system', 'ignore_imagick'); // Guessing from extension? Isn't that... dangerous? - if(class_exists('Imagick') && !$ignore_imagick) { + if(class_exists('Imagick') && file_exists($filename) && is_readable($filename) && !$ignore_imagick) { $v = Imagick::getVersion(); preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $m); if(version_compare($m[1],'6.6.7') >= 0) { diff --git a/include/text.php b/include/text.php index 22cf17866..0e38de2d2 100644 --- a/include/text.php +++ b/include/text.php @@ -815,28 +815,26 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { function search($s,$id='search-box',$url='/search',$save = false) { $a = get_app(); - $o = '<div id="' . $id . '">'; - $o .= '<form action="' . $a->get_baseurl((stristr($url,'network')) ? true : false) . $url . '" method="get" >'; - $o .= '<input type="text" class="icon-search" name="search" id="search-text" placeholder="" value="' . $s .'" onclick="this.submit();" />'; - $o .= '<input class="search-submit btn btn-default" type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; - if(feature_enabled(local_user(),'savedsearch')) - $o .= '<input class="search-save btn btn-default" type="submit" name="save" id="search-save" value="' . t('Save') . '" />'; - $o .= '</form></div>'; - return $o; + return replace_macros(get_markup_template('searchbox.tpl'),array( + '$s' => $s, + '$id' => $id, + '$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url, + '$search_label' => t('Search'), + '$save_label' => t('Save'), + '$savedsearch' => feature_enabled(local_user(),'savedsearch') + )); } function searchbox($s,$id='search-box',$url='/search',$save = false) { - $a = get_app(); - $o = '<div id="' . $id . '">'; - $o .= '<form action="' . z_root() . '/' . $url . '" method="get" >'; - $o .= '<input type="hidden" name="f" value="" />'; - $o .= '<input type="text" class="icon-search" name="search" id="search-text" placeholder="" value="' . $s .'" onclick="this.submit();" />'; - $o .= '<input type="submit" name="submit" class="btn btn-default" id="search-submit" value="' . t('Search') . '" />'; - if(feature_enabled(local_user(),'savedsearch')) - $o .= '<input type="submit" name="searchsave" class="btn btn-default" id="search-save" value="' . t('Save') . '" />'; - $o .= '</form></div>'; - return $o; + return replace_macros(get_markup_template('searchbox.tpl'),array( + '$s' => $s, + '$id' => $id, + '$action_url' => z_root() . '/' . $url, + '$search_label' => t('Search'), + '$save_label' => t('Save'), + '$savedsearch' => feature_enabled(local_user(),'savedsearch') + )); } @@ -2061,4 +2059,4 @@ function extra_query_args() { } } return $s; -}
\ No newline at end of file +} |