diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ItemObject.php | 4 | ||||
-rw-r--r-- | include/RedDAV/RedBrowser.php | 55 | ||||
-rw-r--r-- | include/apps.php | 11 | ||||
-rw-r--r-- | include/bb2diaspora.php | 15 | ||||
-rw-r--r-- | include/bbcode.php | 32 | ||||
-rw-r--r-- | include/dir_fns.php | 3 | ||||
-rw-r--r-- | include/features.php | 2 | ||||
-rwxr-xr-x | include/items.php | 2 | ||||
-rw-r--r-- | include/notifier.php | 2 | ||||
-rw-r--r-- | include/photos.php | 70 | ||||
-rw-r--r-- | include/text.php | 43 | ||||
-rw-r--r-- | include/zot.php | 15 |
12 files changed, 165 insertions, 89 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php index ee431dccb..c5c2cb2e6 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -278,8 +278,6 @@ class Item extends BaseObject { $children = $this->get_children(); - $is_photo = ((($item['resource_type'] == 'photo') && (feature_enabled($conv->get_profile_owner(),'large_photos'))) ? true : false); - $has_tags = (($body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders']) ? true : false); $tmp_item = array( @@ -333,7 +331,7 @@ class Item extends BaseObject { 'owner_url' => $this->get_owner_url(), 'owner_photo' => $this->get_owner_photo(), 'owner_name' => $this->get_owner_name(), - 'is_photo' => $is_photo, + 'photo' => $body['photo'], 'has_tags' => $has_tags, // Item toolbar buttons diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php index d74bba220..efea5d92f 100644 --- a/include/RedDAV/RedBrowser.php +++ b/include/RedDAV/RedBrowser.php @@ -217,31 +217,6 @@ class RedBrowser extends DAV\Browser\Plugin { $f[] = $ft; } - // Storage and quota for the account (all channels of the owner of this directory)! - $limit = service_class_fetch($owner, 'attach_upload_limit'); - $r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d", - intval($this->auth->channel_account_id) - ); - $used = $r[0]['total']; - if ($used) { - $quotaDesc = t('%1$s used'); - $quotaDesc = sprintf($quotaDesc, - userReadableSize($used)); - } - if ($limit && $used) { - $quotaDesc = t('%1$s used of %2$s (%3$s%)'); - $quotaDesc = sprintf($quotaDesc, - userReadableSize($used), - userReadableSize($limit), - round($used / $limit, 1)); - } - - // prepare quota for template - $quota = array(); - $quota['used'] = $used; - $quota['limit'] = $limit; - $quota['desc'] = $quotaDesc; - $output = ''; if ($this->enablePost) { $this->server->broadcastEvent('onHTMLActionsPanel', array($parent, &$output)); @@ -249,7 +224,6 @@ class RedBrowser extends DAV\Browser\Plugin { $html .= replace_macros(get_markup_template('cloud.tpl'), array( '$header' => t('Files') . ": " . $this->escapeHTML($path) . "/", - '$quota' => $quota, '$total' => t('Total'), '$actionspanel' => $output, '$shared' => t('Shared'), @@ -298,11 +272,38 @@ class RedBrowser extends DAV\Browser\Plugin { if (get_class($node) === 'Sabre\\DAV\\SimpleCollection') return; + // Storage and quota for the account (all channels of the owner of this directory)! + $limit = service_class_fetch($owner, 'attach_upload_limit'); + $r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d", + intval($this->auth->channel_account_id) + ); + $used = $r[0]['total']; + if ($used) { + $quotaDesc = t('You are using %1$s of your available file storage.'); + $quotaDesc = sprintf($quotaDesc, + userReadableSize($used)); + } + if ($limit && $used) { + $quotaDesc = t('You are using %1$s of %2$s available file storage. (%3$s%)'); + $quotaDesc = sprintf($quotaDesc, + userReadableSize($used), + userReadableSize($limit), + round($used / $limit, 1) * 100); + } + + // prepare quota for template + $quota = array(); + $quota['used'] = $used; + $quota['limit'] = $limit; + $quota['desc'] = $quotaDesc; + $quota['warning'] = ((($limit) && ((round($used / $limit, 1) * 100) >= 90)) ? t('WARNING:') : ''); // 10485760 bytes = 100MB + $output .= replace_macros(get_markup_template('cloud_actionspanel.tpl'), array( '$folder_header' => t('Create new folder'), '$folder_submit' => t('Create'), '$upload_header' => t('Upload file'), - '$upload_submit' => t('Upload') + '$upload_submit' => t('Upload'), + '$quota' => $quota )); } diff --git a/include/apps.php b/include/apps.php index c036867b1..0a62dc5a8 100644 --- a/include/apps.php +++ b/include/apps.php @@ -176,14 +176,19 @@ function app_render($papp,$mode = 'view') { $installed = false; - if(! $papp['photo']) - $papp['photo'] = z_root() . '/' . get_default_profile_photo(80); - if(! $papp) return; + if(! $papp['photo']) + $papp['photo'] = z_root() . '/' . get_default_profile_photo(80); + + + $papp['papp'] = papp_encode($papp); + if(! strstr($papp['url'],'://')) + $papp['url'] = z_root() . ((strpos($papp['url'],'/') === 0) ? '' : '/') . $papp['url']; + foreach($papp as $k => $v) { if(strpos($v,'http') === 0 && $k != 'papp') $papp[$k] = zid($v); diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 692128087..95de43ec3 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -305,6 +305,21 @@ function bb2diaspora_itembody($item, $force_update = false) { $matches = array(); + //if we have a photo item just prepend the photo bbcode to item['body'] + $is_photo = (($item['obj_type'] == ACTIVITY_OBJ_PHOTO) ? true : false); + if($is_photo) { + $object = json_decode($item['object'],true); + $photo = array( + 'url' => rawurldecode($object['id']), + 'link' => rawurldecode(get_rel_link($object['link'],'alternate')), + 'width' => $object['width'], + 'height' => $object['height'] + ); + + $photo_bb = '[zrl=' . $photo['link'] . ']' . '[zmg=' . $photo['width'] . 'x' . $photo['height'] . ']' . $photo['url'] . '[/zmg]' . '[/zrl]'; + $item['body'] = (($item['body']) ? $photo_bb . $item['body'] : $photo_bb); + } + if(($item['diaspora_meta']) && (! $force_update)) { $diaspora_meta = json_decode($item['diaspora_meta'],true); if($diaspora_meta) { diff --git a/include/bbcode.php b/include/bbcode.php index db5824237..1092c08a3 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -570,7 +570,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $urlchars = '[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,\@]'; if (strpos($Text,'http') !== false) { - $Text = preg_replace("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ism", '$1<a href="$2" >$2</a>', $Text); + $Text = preg_replace("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ism", '$1<a href="$2" target="_newwin" >$2</a>', $Text); } if (strpos($Text,'[/share]') !== false) { @@ -582,21 +582,21 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) } } if (strpos($Text,'[/url]') !== false) { - $Text = preg_replace("/\#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" >$1</a>', $Text); - $Text = preg_replace("/\#\^\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" >$2</a>', $Text); - $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" >$1</a>', $Text); - $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" >$2</a>', $Text); + $Text = preg_replace("/\#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" target="_newwin" >$1</a>', $Text); + $Text = preg_replace("/\#\^\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" target="_newwin" >$2</a>', $Text); + $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_newwin" >$1</a>', $Text); + $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="_newwin" >$2</a>', $Text); } if (strpos($Text,'[/zrl]') !== false) { - $Text = preg_replace("/\#\^\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" >$1</a>', $Text); - $Text = preg_replace("/\#\^\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" >$2</a>', $Text); - $Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<a class="zrl" href="$1" >$1</a>', $Text); - $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" >$2</a>', $Text); + $Text = preg_replace("/\#\^\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" target="_newwin" >$1</a>', $Text); + $Text = preg_replace("/\#\^\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" target="_newwin" >$2</a>', $Text); + $Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_newwin" >$1</a>', $Text); + $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_newwin" >$2</a>', $Text); } // Perform MAIL Search if (strpos($Text,'[/mail]') !== false) { - $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $Text); - $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1">$2</a>', $Text); + $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1" target="_newwin" >$1</a>', $Text); + $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1" target="_newwin" >$2</a>', $Text); } // leave open the posibility of [map=something] @@ -885,17 +885,17 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) // if video couldn't be embedded, link to it instead. if (strpos($Text,'[/video]') !== false) { - $Text = preg_replace("/\[video\](.*?)\[\/video\]/", '<a href="$1">$1</a>', $Text); + $Text = preg_replace("/\[video\](.*?)\[\/video\]/", '<a href="$1" target="_newwin" >$1</a>', $Text); } if (strpos($Text,'[/audio]') !== false) { - $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '<a href="$1">$1</a>', $Text); + $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '<a href="$1" target="_newwin" >$1</a>', $Text); } if (strpos($Text,'[/zvideo]') !== false) { - $Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '<a class="zid" href="$1">$1</a>', $Text); + $Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '<a class="zid" href="$1" target="_newwin" >$1</a>', $Text); } if (strpos($Text,'[/zaudio]') !== false) { - $Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '<a class="zid" href="$1">$1</a>', $Text); + $Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '<a class="zid" href="$1" target="_newwin" >$1</a>', $Text); } if ($tryoembed){ @@ -904,7 +904,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) } } else { if (strpos($Text,'[/iframe]') !== false) { - $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<a href="$1">$1</a>', $Text); + $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<a href="$1" target="_newwin" >$1</a>', $Text); } } diff --git a/include/dir_fns.php b/include/dir_fns.php index e466b7404..ecc5f6d96 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -178,9 +178,10 @@ function sync_directories($dirmode) { 'site_directory' => DIRECTORY_FALLBACK_MASTER . '/dirsearch', 'site_realm' => DIRECTORY_REALM, 'site_valid' => 1 + ); $x = q("insert into site ( site_url, site_flags, site_update, site_directory, site_realm, site_valid ) - values ( '%s', %d', '%s', '%s', '%s' ) ", + values ( '%s', %d, '%s', '%s', '%s', %d ) ", dbesc($r[0]['site_url']), intval($r[0]['site_flags']), dbesc($r[0]['site_update']), diff --git a/include/features.php b/include/features.php index a6c4757cd..993a2e33f 100644 --- a/include/features.php +++ b/include/features.php @@ -55,7 +55,7 @@ function get_features() { t('Post Composition Features'), // array('richtext', t('Richtext Editor'), t('Enable richtext editor'),false), array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts'),false), - array('large_photos', t('Large Photos'), t('Include large (640px) photo thumbnails in posts. If not enabled, use small (320px) photo thumbnails'),false), + array('large_photos', t('Large Photos'), t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'),false), array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds'),false), array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false), array('consensus_tools', t('Enable voting tools'), t('Provide a class of post which others can vote on'),false), diff --git a/include/items.php b/include/items.php index 9159f6da3..08be981e7 100755 --- a/include/items.php +++ b/include/items.php @@ -889,7 +889,6 @@ function get_item_elements($x,$allow_code = false) { $arr['mimetype'] = (($x['mimetype']) ? htmlspecialchars($x['mimetype'], ENT_COMPAT,'UTF-8',false) : ''); $arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : ''); $arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : ''); - $arr['resource_type'] = (($x['resource_type']) ? htmlspecialchars($x['resource_type'], ENT_COMPAT,'UTF-8',false) : ''); $arr['public_policy'] = (($x['public_scope']) ? htmlspecialchars($x['public_scope'], ENT_COMPAT,'UTF-8',false) : ''); if($arr['public_policy'] === 'public') @@ -1286,7 +1285,6 @@ function encode_item($item,$mirror = false) { $x['verb'] = $item['verb']; $x['object_type'] = $item['obj_type']; $x['target_type'] = $item['tgt_type']; - $x['resource_type'] = $item['resource_type']; $x['permalink'] = $item['plink']; $x['location'] = $item['location']; $x['longlat'] = $item['coord']; diff --git a/include/notifier.php b/include/notifier.php index b7cea629d..385062f07 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -127,7 +127,7 @@ function notifier_run($argv, $argc){ if($s) { $perm_update = array('sender' => $s[0], 'recipient' => $r[0], 'success' => false, 'deliveries' => ''); - if($cmd == 'permission_create']) + if($cmd == 'permission_create') call_hooks('permissions_create',$perm_update); else call_hooks('permissions_update',$perm_update); diff --git a/include/photos.php b/include/photos.php index e78b899e0..a203b9b6a 100644 --- a/include/photos.php +++ b/include/photos.php @@ -186,7 +186,8 @@ function photo_upload($channel, $observer, $args) { $p['description'] = $args['description']; $r0 = $ph->save($p); - $r0wxh = $ph->getWidth() . 'x' . $ph->getHeight(); + $r0width = $ph->getWidth(); + $r0height = $ph->getHeight(); if(! $r0) $errors = true; @@ -198,7 +199,8 @@ function photo_upload($channel, $observer, $args) { $p['scale'] = 1; $r1 = $ph->save($p); - $r1wxh = $ph->getWidth() . 'x' . $ph->getHeight(); + $r1width = $ph->getWidth(); + $r1height = $ph->getHeight(); if(! $r1) $errors = true; @@ -207,7 +209,8 @@ function photo_upload($channel, $observer, $args) { $p['scale'] = 2; $r2 = $ph->save($p); - $r2wxh = $ph->getWidth() . 'x' . $ph->getHeight(); + $r2width = $ph->getWidth(); + $r2height = $ph->getHeight(); if(! $r2) $errors = true; @@ -216,7 +219,8 @@ function photo_upload($channel, $observer, $args) { $p['scale'] = 3; $r3 = $ph->save($p); - $r3wxh = $ph->getWidth() . 'x' . $ph->getHeight(); + $r3width = $ph->getWidth(); + $r3height = $ph->getHeight(); if(! $r3) $errors = true; @@ -242,17 +246,47 @@ function photo_upload($channel, $observer, $args) { } } - $larger = feature_enabled($channel['channel_id'], 'large_photos'); + $title = (($args['filename']) ? $args['filename'] : ''); - if($larger) { - $tag = (($r1wxh) ? '[zmg=' . $r1wxh . ']' : '[zmg]'); + $large_photos = feature_enabled($channel['channel_id'], 'large_photos'); + + if($large_photos) { $scale = 1; + $width = $r1width; + $height = $r1height; + $tag = (($r1) ? '[zmg=' . $width . 'x' . $height . ']' : '[zmg]'); + + // Create item object + $href = rawurlencode(z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash); + $url = rawurlencode(z_root() . "/photo/{$photo_hash}-{$scale}.".$ph->getExt()); + + $link = array(); + $link[] = array( + 'rel' => 'alternate', + 'type' => 'text/html', + 'href' => $href + ); + + $object = array( + 'type' => ACTIVITY_OBJ_PHOTO, + 'title' => $title, + 'id' => $url, + 'link' => $link, + 'width' => $width, + 'height' => $height + ); } else { - $tag = (($r2wxh) ? '[zmg=' . $r2wxh . ']' : '[zmg]'); $scale = 2; + $width = $r2width; + $height = $r2height; + $tag = (($r2) ? '[zmg=' . $width . 'x' . $height . ']' : '[zmg]'); } + $body = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' + . $tag . z_root() . "/photo/{$photo_hash}-{$scale}.".$ph->getExt() . '[/zmg]' + . '[/zrl]'; + // Create item container if($args['item']) { @@ -263,13 +297,13 @@ function photo_upload($channel, $observer, $args) { if($item['mid'] === $item['parent_mid']) { - $item['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' - . $tag . z_root() . "/photo/{$photo_hash}-{$scale}.".$ph->getExt() . '[/zmg]' - . '[/zrl]'; + $item['body'] = (($object) ? '' : $body); + $item['obj_type'] = (($object) ? ACTIVITY_OBJ_PHOTO : ''); + $item['object'] = (($object) ? json_encode($object) : ''); if($item['author_xchan'] === $channel['channel_hash']) { - $item['sig'] = base64url_encode(rsa_sign($item['body'],$channel['channel_prvkey'])); - $item['item_verified'] = 1; + $item['sig'] = base64url_encode(rsa_sign($item['body'],$channel['channel_prvkey'])); + $item['item_verified'] = 1; } else { $item['sig'] = ''; @@ -297,7 +331,6 @@ function photo_upload($channel, $observer, $args) { } } else { - $title = $args['filename'] ? $args['filename'] : ''; $mid = item_message_id(); $arr = array(); @@ -320,15 +353,14 @@ function photo_upload($channel, $observer, $args) { $arr['deny_cid'] = $ac['deny_cid']; $arr['deny_gid'] = $ac['deny_gid']; $arr['verb'] = ACTIVITY_POST; + $arr['obj_type'] = (($object) ? ACTIVITY_OBJ_PHOTO : ''); + $arr['object'] = (($object) ? json_encode($object) : ''); $arr['item_wall'] = 1; $arr['item_origin'] = 1; $arr['item_thread_top'] = 1; $arr['item_private'] = intval($acl->is_private()); $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid']; - - $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' - . $tag . z_root() . "/photo/{$photo_hash}-{$scale}.".$ph->getExt() . '[/zmg]' - . '[/zrl]'; + $arr['body'] = (($object) ? '' : $body); $result = item_store($arr); $item_id = $result['item_id']; @@ -339,7 +371,7 @@ function photo_upload($channel, $observer, $args) { $ret['success'] = true; $ret['item'] = $arr; - $ret['body'] = $arr['body']; + $ret['body'] = $body; $ret['resource_id'] = $photo_hash; $ret['photoitem_id'] = $item_id; diff --git a/include/text.php b/include/text.php index 25743e872..11062a1b2 100644 --- a/include/text.php +++ b/include/text.php @@ -1363,6 +1363,7 @@ function generate_named_map($location) { function prepare_body(&$item,$attach = false) { + require_once('include/identity.php'); // if($item['html']) { // $s = bb_observer($item['html']); @@ -1373,9 +1374,24 @@ function prepare_body(&$item,$attach = false) { $s = prepare_text($item['body'],$item['mimetype'], false); // } - $prep_arr = array('item' => $item, 'html' => $s); + $is_photo = (($item['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false); + $photo = ''; + + if($is_photo) { + $object = json_decode($item['object'],true); + $photo = '<a href="' . zid(rawurldecode(get_rel_link($object['link'],'alternate'))) . '" target="_newwin"><img style="max-width:' . $object['width'] . 'px; width:100%; height:auto;" src="'. zid(rawurldecode($object['id'])) . '"></a>'; + } + + $prep_arr = array( + 'item' => $item, + 'html' => $s, + 'photo' => $photo + ); + call_hooks('prepare_body', $prep_arr); + $s = $prep_arr['html']; + $photo = $prep_arr['photo']; // q("update item set html = '%s' where id = %d", // dbesc($s), @@ -1391,7 +1407,7 @@ function prepare_body(&$item,$attach = false) { if($x) { $s = preg_replace('/\<div class\=\"map\"\>/','$0' . $x,$s); } - } + } $attachments = theme_attachments($item); @@ -1439,17 +1455,20 @@ function prepare_body(&$item,$attach = false) { } $prep_arr = array( - //'item' => $item, - 'html' => $s, - 'categories' => $categories, - 'folders' => $filer, - 'tags' => $tags, - 'mentions' => $mentions, - 'attachments' => $attachments - ); + 'item' => $item, + 'photo' => $photo, + 'html' => $s, + 'categories' => $categories, + 'folders' => $filer, + 'tags' => $tags, + 'mentions' => $mentions, + 'attachments' => $attachments + ); call_hooks('prepare_body_final', $prep_arr); + unset($prep_arr['item']); + return $prep_arr; } @@ -1967,13 +1986,13 @@ function xchan_query(&$items,$abook = true,$effective_uid = 0) { if(count($arr)) { if($abook) { $chans = q("select * from xchan left join hubloc on hubloc_hash = xchan_hash left join abook on abook_xchan = xchan_hash and abook_channel = %d - where xchan_hash in (" . implode(',', $arr) . ") and hubloc_primary = 1", + where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_primary = 1", intval($item['uid']) ); } else { $chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash - where xchan_hash in (" . implode(',', $arr) . ") and hubloc_primary = 1"); + where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_primary = 1"); } $xchans = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',',$arr)) . ") and xchan_network in ('rss','unknown')"); if(! $chans) diff --git a/include/zot.php b/include/zot.php index 02dab3617..793eb6b39 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2739,6 +2739,7 @@ function import_site($arr, $pubkey) { $sellpage = htmlspecialchars($arr['sellpage'],ENT_COMPAT,'UTF-8',false); $site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false); $site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false); + $site_project = htmlspecialchars($arr['project'],ENT_COMPAT,'UTF-8',false); // You can have one and only one primary directory per realm. // Downgrade any others claiming to be primary. As they have @@ -2757,13 +2758,15 @@ function import_site($arr, $pubkey) { || ($siterecord['site_sellpage'] != $sellpage) || ($siterecord['site_location'] != $site_location) || ($siterecord['site_register'] != $register_policy) + || ($siterecord['site_project'] != $site_project) || ($siterecord['site_realm'] != $site_realm)) { $update = true; // logger('import_site: input: ' . print_r($arr,true)); // logger('import_site: stored: ' . print_r($siterecord,true)); - $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d + + $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s' where site_url = '%s'", dbesc($site_location), intval($site_directory), @@ -2774,6 +2777,7 @@ function import_site($arr, $pubkey) { dbesc($sellpage), dbesc($site_realm), intval(SITE_TYPE_ZOT), + dbesc($site_project), dbesc($url) ); if(! $r) { @@ -2790,8 +2794,9 @@ function import_site($arr, $pubkey) { } else { $update = true; - $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type ) - values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d )", + + $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type, site_project ) + values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s' )", dbesc($site_location), dbesc($url), intval($access_policy), @@ -2801,7 +2806,8 @@ function import_site($arr, $pubkey) { intval($register_policy), dbesc($sellpage), dbesc($site_realm), - intval(SITE_TYPE_ZOT) + intval(SITE_TYPE_ZOT), + dbesc($site_project) ); if(! $r) { logger('import_site: record create failed. ' . print_r($arr,true)); @@ -3810,6 +3816,7 @@ function zotinfo($arr) { $ret['site']['sellpage'] = get_config('system','sellpage'); $ret['site']['location'] = get_config('system','site_location'); $ret['site']['realm'] = get_directory_realm(); + $ret['site']['project'] = PLATFORM_NAME; } |