From c673c70c25143f18b2ef6aef9ee6633d0eac46ae Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 5 Aug 2012 21:41:58 -0700 Subject: updates --- include/Photo.php | 2 +- include/bb2diaspora.php | 6 +++--- include/bbcode.php | 6 ++++++ include/conversation.php | 3 ++- include/items.php | 2 +- include/markdownify/markdownify.php | 7 ++++++- include/network.php | 13 ++++++++++++- include/zot.php | 7 +++++-- 8 files changed, 36 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/Photo.php b/include/Photo.php index e870a2507..d5e9ac9e6 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -247,7 +247,7 @@ class Photo { if($this->is_imagick()) { $this->image->setFirstIterator(); do { - $this->image->rotateImage(new ImagickPixel(), $degrees); + $this->image->rotateImage(new ImagickPixel(), -$degrees); // ImageMagick rotates in the opposite direction of imagerotate() } while ($this->image->nextImage()); return; } diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index b95dee8f3..9ede42f6c 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -202,9 +202,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { // the following was added on 10-January-2012 due to an inability of Diaspora's // new javascript markdown processor to handle links with images as the link "text" // It is not optimal and may be removed if this ability is restored in the future - if ($fordiaspora) - $Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism", - "[url]$1[/url]\n[img]$2[/img]", $Text); + //if ($fordiaspora) + // $Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism", + // "[url]$1[/url]\n[img]$2[/img]", $Text); // Convert it to HTML - don't try oembed $Text = bbcode($Text, $preserve_nl, false); diff --git a/include/bbcode.php b/include/bbcode.php index de848de99..2a4b4592b 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -224,6 +224,12 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // Check for list text $Text = str_replace("[*]", "
  • ", $Text); + // Check for style sheet commands + $Text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism","$2",$Text); + + // Check for CSS classes + $Text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism","$2",$Text); + // handle nested lists $endlessloop = 0; diff --git a/include/conversation.php b/include/conversation.php index 74cf787bd..a1188d0c6 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -722,6 +722,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { '$edurl' => t('Link'), '$edvideo' => t('Video'), '$preview' => t('Preview'), + '$sourceapp' => t($a->sourcename), '$ww' => (($mode === 'network') ? $commentww : '') )); } @@ -1210,7 +1211,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { '$bang' => $x['bang'], '$profile_uid' => $x['profile_uid'], '$preview' => t('Preview'), - '$mobileapp' => t('Friendica mobile web'), + '$sourceapp' => t($a->sourcename), )); diff --git a/include/items.php b/include/items.php index 2381dd2ea..7e49f4b82 100755 --- a/include/items.php +++ b/include/items.php @@ -3589,7 +3589,7 @@ function drop_item($id,$interactive = true) { // check if logged in user is either the author or owner of this item - if((local_user() == $item['uid']) || (remote_user() == $item['contact-id'])) { + if((local_user() == $item['uid']) || (remote_user() == $item['contact-id']) || (! $interactive)) { // delete the item diff --git a/include/markdownify/markdownify.php b/include/markdownify/markdownify.php index 7bbf1cbbe..0d4429a01 100644 --- a/include/markdownify/markdownify.php +++ b/include/markdownify/markdownify.php @@ -686,6 +686,10 @@ class Markdownify { # [1]: mailto:mail@example.com Title $tag['href'] = 'mailto:'.$bufferDecoded; } + + $this->out('['.$buffer.']('.$tag['href'].' "'.$tag['title'].'")', true); + +/* # [This link][id] foreach ($this->stack['a'] as $tag2) { if ($tag2['href'] == $tag['href'] && $tag2['title'] === $tag['title']) { @@ -699,6 +703,7 @@ class Markdownify { } $this->out('['.$buffer.']['.$tag['linkID'].']', true); +*/ } } /** @@ -737,7 +742,7 @@ class Markdownify { // ![Alt text](/path/to/img.jpg "Optional title") if ($this->parser->tagAttributes['title'] != "") - $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].'"'.$this->parser->tagAttributes['title'].'")', true); + $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].' "'.$this->parser->tagAttributes['title'].'")', true); else $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].')', true); diff --git a/include/network.php b/include/network.php index 8b26713b9..0e16f3c2d 100644 --- a/include/network.php +++ b/include/network.php @@ -894,7 +894,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $s = htmlspecialchars_decode($s); $matches = null; - $c = preg_match_all('/\[img\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER); + $c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER); if($c) { require_once('include/Photo.php'); foreach($matches as $mtch) { @@ -915,6 +915,12 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) $scaled = $mtch[1]; $i = fetch_url($scaled); + $cache = get_config('system','itemcache'); + if (($cache != '') and is_dir($cache)) { + $cachefile = $cache."/".hash("md5", $scaled); + file_put_contents($cachefile, $i); + } + // guess mimetype from headers or filename $type = guess_image_type($mtch[1],true); @@ -940,6 +946,11 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) } } } + + // replace the special char encoding + + $s = htmlspecialchars($s,ENT_QUOTES,'UTF-8'); + return $s; } diff --git a/include/zot.php b/include/zot.php index cb57c2d84..6fe202aa8 100644 --- a/include/zot.php +++ b/include/zot.php @@ -58,8 +58,11 @@ function zot_verify(&$item,$identity) { function zot_notify($entity,$url) { - $x = z_post_url($url, - array('zot_uid' => $entity_global_id, 'callback' => z_root() . '/zot', 'spec' => ZOT_REVISION)); + $x = z_post_url($url, array( + 'zot_uid' => $entity['entity_global_id'], + 'callback' => z_root() . '/zot', + 'spec' => ZOT_REVISION) + ); return($x); } -- cgit v1.2.3