aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorzottel <github@zottel.net>2012-03-29 10:23:45 +0200
committerzottel <github@zottel.net>2012-03-29 10:23:45 +0200
commit953840cf822718cba66a0727b576c674c6e44875 (patch)
treea924cf0031d16f6f15b7d84d5f519ca4257042b4 /mod
parentfb817a29a934a68f194a42c29d3ed11da2da558f (diff)
parent3ee529d095ac7e83ae1e71d86cbe6d443885d54e (diff)
downloadvolse-hubzilla-953840cf822718cba66a0727b576c674c6e44875.tar.gz
volse-hubzilla-953840cf822718cba66a0727b576c674c6e44875.tar.bz2
volse-hubzilla-953840cf822718cba66a0727b576c674c6e44875.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'mod')
-rwxr-xr-xmod/dfrn_notify.php19
-rwxr-xr-xmod/filer.php16
-rwxr-xr-xmod/item.php2
-rwxr-xr-xmod/message.php115
-rw-r--r--mod/ping.php5
-rwxr-xr-xmod/profile_photo.php2
-rwxr-xr-xmod/settings.php2
-rwxr-xr-xmod/viewsrc.php7
8 files changed, 117 insertions, 51 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index 71860ac3b..8e4ce0671 100755
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -158,6 +158,7 @@ function dfrn_notify_post(&$a) {
);
}
+
logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']);
logger('dfrn_notify: data: ' . $data, LOGGER_DATA);
@@ -174,6 +175,13 @@ function dfrn_notify_post(&$a) {
}
+
+ // If we are setup as a soapbox we aren't accepting input from this person
+
+ if($importer['page-flags'] == PAGE_SOAPBOX)
+ xml_status(0);
+
+
if(strlen($key)) {
$rawkey = hex2bin(trim($key));
logger('rino: md5 raw key: ' . md5($rawkey));
@@ -261,7 +269,7 @@ function dfrn_notify_content(&$a) {
break; // NOTREACHED
}
- $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
+ $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`page-flags` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `user`.`nickname` = '%s'
AND `user`.`account_expired` = 0 $sql_extra LIMIT 1",
dbesc($a->argv[1])
@@ -299,6 +307,12 @@ function dfrn_notify_content(&$a) {
if(! $rino_enable)
$rino = 0;
+ if((($r[0]['rel']) && ($r[0]['rel'] != CONTACT_IS_SHARING)) || ($r[0]['page-flags'] == PAGE_COMMUNITY)) {
+ $perm = 'rw';
+ }
+ else {
+ $perm = 'r';
+ }
header("Content-type: text/xml");
@@ -306,7 +320,8 @@ function dfrn_notify_content(&$a) {
. '<dfrn_notify>' . "\r\n"
. "\t" . '<status>' . $status . '</status>' . "\r\n"
. "\t" . '<dfrn_version>' . DFRN_PROTOCOL_VERSION . '</dfrn_version>' . "\r\n"
- . "\t" . '<rino>' . $rino . '</rino>' . "\r\n"
+ . "\t" . '<rino>' . $rino . '</rino>' . "\r\n"
+ . "\t" . '<perm>' . $perm . '</perm>' . "\r\n"
. "\t" . '<dfrn_id>' . $encrypted_id . '</dfrn_id>' . "\r\n"
. "\t" . '<challenge>' . $challenge . '</challenge>' . "\r\n"
. '</dfrn_notify>' . "\r\n" ;
diff --git a/mod/filer.php b/mod/filer.php
index a9e213536..82537848b 100755
--- a/mod/filer.php
+++ b/mod/filer.php
@@ -16,8 +16,20 @@ function filer_content(&$a) {
logger('filer: tag ' . $term . ' item ' . $item_id);
- if($item_id && strlen($term))
+ if($item_id && strlen($term)){
+ // file item
file_tag_save_file(local_user(),$item_id,$term);
-
+ } else {
+ // return filer dialog
+ $filetags = get_pconfig(local_user(),'system','filetags');
+ $filetags = explode("][", trim($filetags,"[]"));
+ $tpl = get_markup_template("filer_dialog.tpl");
+ $o = replace_macros($tpl, array(
+ '$field' => array('term', t("File as:"), '', '', $filetags, t('- select -')),
+ '$submit' => t('Save'),
+ ));
+
+ echo $o;
+ }
killme();
}
diff --git a/mod/item.php b/mod/item.php
index 5baae2bde..24730f53e 100755
--- a/mod/item.php
+++ b/mod/item.php
@@ -171,13 +171,13 @@ function item_post(&$a) {
$str_contact_allow = $orig_post['allow_cid'];
$str_group_deny = $orig_post['deny_gid'];
$str_contact_deny = $orig_post['deny_cid'];
- $title = $orig_post['title'];
$location = $orig_post['location'];
$coord = $orig_post['coord'];
$verb = $orig_post['verb'];
$emailcc = $orig_post['emailcc'];
$app = $orig_post['app'];
$categories = $orig_post['file'];
+ $title = notags(trim($_REQUEST['title']));
$body = escape_tags(trim($_REQUEST['body']));
$private = $orig_post['private'];
$pubmail_enable = $orig_post['pubmail'];
diff --git a/mod/message.php b/mod/message.php
index 8991f643d..949e5616c 100755
--- a/mod/message.php
+++ b/mod/message.php
@@ -3,6 +3,35 @@
require_once('include/acl_selectors.php');
require_once('include/message.php');
+function message_init(&$a) {
+ $tabs = array(
+ /*
+ array(
+ 'label' => t('All'),
+ 'url'=> $a->get_baseurl(true) . '/message',
+ 'sel'=> ($a->argc == 1),
+ ),
+ array(
+ 'label' => t('Sent'),
+ 'url' => $a->get_baseurl(true) . '/message/sent',
+ 'sel'=> ($a->argv[1] == 'sent'),
+ ),
+ */
+ );
+ $new = array(
+ 'label' => t('New Message'),
+ 'url' => $a->get_baseurl(true) . '/message/new',
+ 'sel'=> ($a->argv[1] == 'new'),
+ );
+
+ $tpl = get_markup_template('message_side.tpl');
+ $a->page['aside'] = replace_macros($tpl, array(
+ '$tabs'=>$tabs,
+ '$new'=>$new,
+ ));
+
+}
+
function message_post(&$a) {
if(! local_user()) {
@@ -66,25 +95,7 @@ function message_content(&$a) {
$myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname'];
- $tabs = array(
- array(
- 'label' => t('Inbox'),
- 'url'=> $a->get_baseurl(true) . '/message',
- 'sel'=> (($a->argc == 1) ? 'active' : ''),
- ),
- array(
- 'label' => t('Outbox'),
- 'url' => $a->get_baseurl(true) . '/message/sent',
- 'sel'=> (($a->argv[1] == 'sent') ? 'active' : ''),
- ),
- array(
- 'label' => t('New Message'),
- 'url' => $a->get_baseurl(true) . '/message/new',
- 'sel'=> (($a->argv[1] == 'new') ? 'active' : ''),
- ),
- );
- $tpl = get_markup_template('common_tabs.tpl');
- $tab_content = replace_macros($tpl, array('$tabs'=>$tabs));
+
$tpl = get_markup_template('mail_head.tpl');
@@ -186,9 +197,9 @@ function message_content(&$a) {
$o .= $header;
if($a->argc == 2)
- $eq = '='; // I'm not going to bother escaping this.
+ $eq = sprintf( "AND `from-url` = '%s'", dbesc($myprofile));
else
- $eq = '!='; // or this.
+ $eq = '';
$r = q("SELECT count(*) AS `total` FROM `mail`
WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `created` DESC",
@@ -199,11 +210,12 @@ function message_content(&$a) {
$a->set_pager_total($r[0]['total']);
$r = q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`,
- `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`
+ `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`,
+ count( * ) as count
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
- WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ",
+ WHERE `mail`.`uid` = %d $eq GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ",
intval(local_user()),
- dbesc($myprofile),
+ //
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
@@ -214,9 +226,15 @@ function message_content(&$a) {
$tpl = get_markup_template('mail_list.tpl');
foreach($r as $rr) {
+ if ($rr['from-url'] == $myprofile){
+ $partecipants = sprintf( t("You and %s"), $rr['name']);
+ } else {
+ $partecipants = sprintf( t("%s and You"), $rr['from-name']);
+ }
+
$o .= replace_macros($tpl, array(
'$id' => $rr['id'],
- '$from_name' =>$rr['from-name'],
+ '$from_name' => $partecipants,
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? $a->get_baseurl(true) . '/redir/' . $rr['contact-id'] : $rr['url']),
'$sparkle' => ' sparkle',
'$from_photo' => $rr['thumb'],
@@ -224,7 +242,9 @@ function message_content(&$a) {
'$delete' => t('Delete conversation'),
'$body' => template_escape($rr['body']),
'$to_name' => template_escape($rr['name']),
- '$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['mailcreated'], t('D, d M Y - g:i A'))
+ '$date' => datetime_convert('UTC',date_default_timezone_get(),$rr['mailcreated'], t('D, d M Y - g:i A')),
+ '$seen' => $rr['mailseen'],
+ '$count' => sprintf( tt('%d message', '%d messages', $rr['count']), $rr['count']),
));
}
$o .= paginate($a);
@@ -278,7 +298,8 @@ function message_content(&$a) {
));
- $tpl = get_markup_template('mail_conv.tpl');
+ $mails = array();
+ $seen = 0;
foreach($messages as $message) {
if($message['from-url'] == $myprofile) {
$from_url = $myprofile;
@@ -288,24 +309,35 @@ function message_content(&$a) {
$from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id'];
$sparkle = ' sparkle';
}
- $o .= replace_macros($tpl, array(
- '$id' => $message['id'],
- '$from_name' => template_escape($message['from-name']),
- '$from_url' => $from_url,
- '$sparkle' => $sparkle,
- '$from_photo' => $message['from-photo'],
- '$subject' => template_escape($message['title']),
- '$body' => template_escape(smilies(bbcode($message['body']))),
- '$delete' => t('Delete message'),
- '$to_name' => template_escape($message['name']),
- '$date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A')
- ));
+ $mails[] = array(
+ 'id' => $message['id'],
+ 'from_name' => template_escape($message['from-name']),
+ 'from_url' => $from_url,
+ 'sparkle' => $sparkle,
+ 'from_photo' => $message['from-photo'],
+ 'subject' => template_escape($message['title']),
+ 'body' => template_escape(smilies(bbcode($message['body']))),
+ 'delete' => t('Delete message'),
+ 'to_name' => template_escape($message['name']),
+ 'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A'),
+ );
+ $seen = $message['seen'];
}
$select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />';
$parent = '<input type="hidden" name="replyto" value="' . $message['parent-uri'] . '" />';
- $tpl = get_markup_template('prv_message.tpl');
- $o .= replace_macros($tpl,array(
+
+
+ $tpl = get_markup_template('mail_display.tpl');
+ $o = replace_macros($tpl, array(
+ '$thread_id' => $a->argv[1],
+ '$thread_subject' => $message['title'],
+ '$thread_seen' => $seen,
+ '$delete' => t('Delete conversation'),
+
+ '$mails' => $mails,
+
+ // reply
'$header' => t('Send Reply'),
'$to' => t('To:'),
'$subject' => t('Subject:'),
@@ -318,6 +350,7 @@ function message_content(&$a) {
'$upload' => t('Upload photo'),
'$insert' => t('Insert web link'),
'$wait' => t('Please wait')
+
));
return $o;
diff --git a/mod/ping.php b/mod/ping.php
index 1562254b1..e911aaf1f 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -22,6 +22,7 @@ function ping_init(&$a) {
and seen = 0 order by date desc limit 0, 50",
intval(local_user())
);
+ $sysnotify = $t[0]['total'];
}
else {
$z1 = q("select * from notify where uid = %d
@@ -35,6 +36,7 @@ function ping_init(&$a) {
intval(50 - intval($t[0]['total']))
);
$z = array_merge($z1,$z2);
+ $sysnotify = 0; // we will update this in a moment
}
@@ -147,13 +149,12 @@ function ping_init(&$a) {
$tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags);
require_once('include/bbcode.php');
- $sysnotify = 0;
if($firehose) {
echo ' <notif count="'.$tot.'">';
}
else {
- if(count($z)) {
+ if(count($z) && (! $sysnotify)) {
foreach($z as $zz) {
if($zz['seen'] == 0)
$sysnotify ++;
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index d1fd08eba..ace8dadd4 100755
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -151,7 +151,7 @@ function profile_photo_content(&$a) {
return;
};
- check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
+// check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
$resource_id = $a->argv[2];
//die(":".local_user());
diff --git a/mod/settings.php b/mod/settings.php
index 99bf8842d..db7330fb5 100755
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -618,7 +618,7 @@ function settings_content(&$a) {
'$mail_disabled' => (($mail_disabled) ? t('Email access is disabled on this site.') : ''),
'$mail_server' => array('mail_server', t('IMAP server name:'), $mail_server, ''),
'$mail_port' => array('mail_port', t('IMAP port:'), $mail_port, ''),
- '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array( ''=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')),
+ '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array( 'notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')),
'$mail_user' => array('mail_user', t('Email login name:'), $mail_user, ''),
'$mail_pass' => array('mail_pass', t('Email password:'), '', ''),
'$mail_replyto' => array('mail_replyto', t('Reply-to address:'), '', 'Optional'),
diff --git a/mod/viewsrc.php b/mod/viewsrc.php
index 94847ec7b..3fa4eaed5 100755
--- a/mod/viewsrc.php
+++ b/mod/viewsrc.php
@@ -25,7 +25,12 @@ function viewsrc_content(&$a) {
);
if(count($r))
- $o .= str_replace("\n",'<br />',$r[0]['body']);
+ if(is_ajax()) {
+ echo str_replace("\n",'<br />',$r[0]['body']);
+ killme();
+ } else {
+ $o .= str_replace("\n",'<br />',$r[0]['body']);
+ }
return $o;
}