diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/import.php | 25 | ||||
-rwxr-xr-x | mod/like.php | 1 | ||||
-rw-r--r-- | mod/message.php | 43 | ||||
-rw-r--r-- | mod/settings.php | 31 |
4 files changed, 79 insertions, 21 deletions
diff --git a/mod/import.php b/mod/import.php index c98f4d2eb..08311013a 100644 --- a/mod/import.php +++ b/mod/import.php @@ -206,10 +206,35 @@ function import_post(&$a) { // import xchans and contact photos + if($seize) { + + // replace our existing xchan if we're seizing control + + $r = q("delete from xchan where xchan_hash = '%s' limit 1", + dbesc($channel['channel_hash']) + ); + + $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", + dbesc($channel['channel_hash']), + dbesc($channel['channel_guid']), + dbesc($channel['channel_guid_sig']), + dbesc($channel['channel_pubkey']), + dbesc($a->get_baseurl() . "/photo/profile/l/" . $channel['channel_id']), + dbesc($a->get_baseurl() . "/photo/profile/m/" . $channel['channel_id']), + dbesc($a->get_baseurl() . "/photo/profile/s/" . $channel['channel_id']), + dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()), + dbesc(z_root() . '/channel/' . $channel['channel_address']), + dbesc($channel['channel_name']), + dbesc('zot'), + dbesc(datetime_convert()), + dbesc(datetime_convert()) + ); + } $xchans = $data['xchan']; if($xchans) { foreach($xchans as $xchan) { + $r = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", dbesc($xchan['xchan_hash']) ); diff --git a/mod/like.php b/mod/like.php index f617391a1..90005eca3 100755 --- a/mod/like.php +++ b/mod/like.php @@ -110,6 +110,7 @@ function like_content(&$a) { $obj = json_encode(array( 'type' => $objtype, 'id' => $item['mid'], + 'parent' => (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']), 'link' => $links, 'title' => $item['title'], 'content' => $item['body'], diff --git a/mod/message.php b/mod/message.php index 9c6cf75a6..f5a60b73b 100644 --- a/mod/message.php +++ b/mod/message.php @@ -249,7 +249,7 @@ function message_content(&$a) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(true), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), - '$nickname' => $channel['channel_addr'], + '$nickname' => $channel['channel_address'], '$linkurl' => t('Please enter a link URL:') )); @@ -293,6 +293,7 @@ function message_content(&$a) { '$select' => $select, '$parent' => '', '$upload' => t('Upload photo'), + '$attach' => t('Attach file'), '$insert' => t('Insert web link'), '$wait' => t('Please wait'), '$submit' => t('Submit') @@ -371,10 +372,39 @@ function message_content(&$a) { foreach($messages as $message) { -// FIXME -// $extracted = item_extract_images($message['body']); -// if($extracted['images']) -// $message['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $message['contact-id']); + $s = $arr = ''; + + if($message['attach']) + $arr = json_decode_plus($message['attach']); + if($arr) { + $s .= '<div class="body-attach">'; + foreach($arr as $r) { + $matches = false; + $icon = ''; + $icontype = substr($r['type'],0,strpos($r['type'],'/')); + + switch($icontype) { + case 'video': + case 'audio': + case 'image': + case 'text': + $icon = '<div class="attachtype icon s22 type-' . $icontype . '"></div>'; + break; + default: + $icon = '<div class="attachtype icon s22 type-unkn"></div>'; + break; + } + + $title = htmlentities($r['title'], ENT_COMPAT,'UTF-8'); + if(! $title) + $title = t('unknown.???'); + $title .= ' ' . $r['length'] . ' ' . t('bytes'); + + $url = $a->get_baseurl() . '/magic?f=&hash=' . $message['from_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision']; + $s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>'; + } + $s .= '<div class="clear"></div></div>'; + } $mails[] = array( 'id' => $message['id'], @@ -385,7 +415,7 @@ function message_content(&$a) { 'to_url' => chanlink_hash($message['to_xchan']), 'to_photo' => $message['to']['xchan_photo_m'], 'subject' => $message['title'], - 'body' => smilies(bbcode($message['body'])), + 'body' => smilies(bbcode($message['body']) . $s), 'delete' => t('Delete message'), 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'), ); @@ -425,6 +455,7 @@ function message_content(&$a) { '$select' => $select, '$parent' => $parent, '$upload' => t('Upload photo'), + '$attach' => t('Attach file'), '$insert' => t('Insert web link'), '$submit' => t('Submit'), '$wait' => t('Please wait') diff --git a/mod/settings.php b/mod/settings.php index 50bb13ea2..36befead1 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -349,22 +349,23 @@ function settings_post(&$a) { $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0); $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); + $arr = array(); - $arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0); - $arr['channel_r_profile'] = (($_POST['view_profile']) ? $_POST['view_profile'] : 0); - $arr['channel_r_photos'] = (($_POST['view_photos']) ? $_POST['view_photos'] : 0); - $arr['channel_r_abook'] = (($_POST['view_contacts']) ? $_POST['view_contacts'] : 0); - $arr['channel_w_stream'] = (($_POST['send_stream']) ? $_POST['send_stream'] : 0); - $arr['channel_w_wall'] = (($_POST['post_wall']) ? $_POST['post_wall'] : 0); - $arr['channel_w_tagwall'] = (($_POST['tag_deliver']) ? $_POST['tag_deliver'] : 0); - $arr['channel_w_comment'] = (($_POST['post_comments']) ? $_POST['post_comments'] : 0); - $arr['channel_w_mail'] = (($_POST['post_mail']) ? $_POST['post_mail'] : 0); - $arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0); - $arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0); - $arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0); - $arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0); - $arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0); - $arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0); + $arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0); + $arr['channel_r_profile'] = (($_POST['view_profile']) ? $_POST['view_profile'] : 0); + $arr['channel_r_photos'] = (($_POST['view_photos']) ? $_POST['view_photos'] : 0); + $arr['channel_r_abook'] = (($_POST['view_contacts']) ? $_POST['view_contacts'] : 0); + $arr['channel_w_stream'] = (($_POST['send_stream']) ? $_POST['send_stream'] : 0); + $arr['channel_w_wall'] = (($_POST['post_wall']) ? $_POST['post_wall'] : 0); + $arr['channel_w_tagwall'] = (($_POST['tag_deliver']) ? $_POST['tag_deliver'] : 0); + $arr['channel_w_comment'] = (($_POST['post_comments']) ? $_POST['post_comments'] : 0); + $arr['channel_w_mail'] = (($_POST['post_mail']) ? $_POST['post_mail'] : 0); + $arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0); + $arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0); + $arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0); + $arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0); + $arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0); + $arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0); $arr['channel_w_pages'] = (($_POST['write_pages']) ? $_POST['write_pages'] : 0); $defperms = 0; |