diff options
author | Alexander Kampmann <programmer@nurfuerspam.de> | 2012-04-05 13:39:15 +0200 |
---|---|---|
committer | Alexander Kampmann <programmer@nurfuerspam.de> | 2012-04-05 13:39:15 +0200 |
commit | 355c42cb309eb1313097411067ca999b699aa620 (patch) | |
tree | d00d1af9dceecdf114cadff924c5ba4a864fbf43 /mod | |
parent | cbf4544887c7f496f2b2312727fe7bcb64a6d6c8 (diff) | |
parent | 9b6e91086b29554fd04362f6c87ea148718e8b1c (diff) | |
download | volse-hubzilla-355c42cb309eb1313097411067ca999b699aa620.tar.gz volse-hubzilla-355c42cb309eb1313097411067ca999b699aa620.tar.bz2 volse-hubzilla-355c42cb309eb1313097411067ca999b699aa620.zip |
Merge branch 'master' of https://github.com/friendica/friendica
Conflicts:
include/config.php
update.php
Diffstat (limited to 'mod')
-rw-r--r--[-rwxr-xr-x] | mod/acl.php | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/admin.php | 51 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/allfriends.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/amcd.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/api.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/apps.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/attach.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/cb.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/common.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/community.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/contactgroup.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/contacts.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/crepair.php | 0 | ||||
-rw-r--r-- | mod/delegate.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/dfrn_notify.php | 76 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/dfrn_poll.php | 21 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/dfrn_request.php | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/directory.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/dirfind.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/display.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/editpost.php | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/events.php | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/filer.php | 21 | ||||
-rw-r--r-- | mod/filerm.php | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/follow.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/friendica.php | 25 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/friendika.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/fsuggest.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/group.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/hcard.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/help.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/home.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/hostxrd.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/install.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/invite.php | 21 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/item.php | 47 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/like.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/localtime.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/lockview.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/login.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/lostpass.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/manage.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/match.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/message.php | 138 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/modexp.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/msearch.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/network.php | 22 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/newmember.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/notes.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/notice.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/notifications.php | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/oembed.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/oexchange.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/openid.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/opensearch.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/parse_url.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/photo.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/photos.php | 23 | ||||
-rw-r--r-- | mod/ping.php | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/poco.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/post.php | 0 | ||||
-rw-r--r-- | mod/pretheme.php | 16 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/probe.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/profile.php | 24 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/profile_photo.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/profiles.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/profperm.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/pubsub.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/qsearch.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/receive.php | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/redir.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/register.php | 11 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/regmod.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/removeme.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/rsd_xml.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/salmon.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/search.php | 25 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/session.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/settings.php | 265 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/share.php | 16 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/smilies.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/starred.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/suggest.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/tagger.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/tagrm.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/uexport.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/update_community.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/update_network.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/update_notes.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/update_profile.php | 0 | ||||
-rw-r--r-- | mod/view.php | 17 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/viewcontacts.php | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/viewsrc.php | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/wall_attach.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/wall_upload.php | 0 | ||||
-rw-r--r-- | mod/wallmessage.php | 149 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/webfinger.php | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | mod/xrd.php | 0 |
98 files changed, 756 insertions, 291 deletions
diff --git a/mod/acl.php b/mod/acl.php index 375c618c8..fe353d1eb 100755..100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -7,10 +7,10 @@ function acl_init(&$a){ return ""; - $start = (x($_POST,'start')?$_POST['start']:0); - $count = (x($_POST,'count')?$_POST['count']:100); - $search = (x($_POST,'search')?$_POST['search']:""); - $type = (x($_POST,'type')?$_POST['type']:""); + $start = (x($_REQUEST,'start')?$_REQUEST['start']:0); + $count = (x($_REQUEST,'count')?$_REQUEST['count']:100); + $search = (x($_REQUEST,'search')?$_REQUEST['search']:""); + $type = (x($_REQUEST,'type')?$_REQUEST['type']:""); if ($search!=""){ @@ -34,7 +34,7 @@ function acl_init(&$a){ $r = q("SELECT COUNT(`id`) AS c FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 - AND `notify` != '' $sql_extra" , + AND `notify` != '' $sql_extra2" , intval(local_user()) ); $contact_count = (int)$r[0]['c']; diff --git a/mod/admin.php b/mod/admin.php index a64b26903..a395027c1 100755..100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -208,6 +208,48 @@ function admin_page_site_post(&$a){ $diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False); $ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0); + if($ssl_policy != intval(get_config('system','ssl_policy'))) { + if($ssl_policy == SSL_POLICY_FULL) { + q("update `contact` set + `url` = replace(`url` , 'http:' , 'https:'), + `photo` = replace(`photo` , 'http:' , 'https:'), + `thumb` = replace(`thumb` , 'http:' , 'https:'), + `micro` = replace(`micro` , 'http:' , 'https:'), + `request` = replace(`request`, 'http:' , 'https:'), + `notify` = replace(`notify` , 'http:' , 'https:'), + `poll` = replace(`poll` , 'http:' , 'https:'), + `confirm` = replace(`confirm`, 'http:' , 'https:'), + `poco` = replace(`poco` , 'http:' , 'https:') + where `self` = 1" + ); + q("update `profile` set + `photo` = replace(`photo` , 'http:' , 'https:'), + `thumb` = replace(`thumb` , 'http:' , 'https:') + where 1 " + ); + } + elseif($ssl_policy == SSL_POLICY_SELFSIGN) { + q("update `contact` set + `url` = replace(`url` , 'https:' , 'http:'), + `photo` = replace(`photo` , 'https:' , 'http:'), + `thumb` = replace(`thumb` , 'https:' , 'http:'), + `micro` = replace(`micro` , 'https:' , 'http:'), + `request` = replace(`request`, 'https:' , 'http:'), + `notify` = replace(`notify` , 'https:' , 'http:'), + `poll` = replace(`poll` , 'https:' , 'http:'), + `confirm` = replace(`confirm`, 'https:' , 'http:'), + `poco` = replace(`poco` , 'https:' , 'http:') + where `self` = 1" + ); + q("update `profile` set + `photo` = replace(`photo` , 'https:' , 'http:'), + `thumb` = replace(`thumb` , 'https:' , 'http:') + where 1 " + ); + } + } + set_config('system','ssl_policy',$ssl_policy); + set_config('config','sitename',$sitename); if ($banner==""){ // don't know why, but del_config doesn't work... @@ -218,7 +260,6 @@ function admin_page_site_post(&$a){ } else { set_config('system','banner', $banner); } - set_config('system','ssl_policy',$ssl_policy); set_config('system','language', $language); set_config('system','theme', $theme); set_config('system','maximagesize', $maximagesize); @@ -583,6 +624,7 @@ function admin_page_plugins(&$a){ '$admin_form' => $admin_form, '$function' => 'plugins', + '$screenshot' => '', '$readme' => $readme )); } @@ -738,7 +780,11 @@ function admin_page_themes(&$a){ } $admin_form=""; - + + $screenshot = array( get_theme_screenshot($theme), t('Screenshot')); + if(! stristr($screenshot[0],$theme)) + $screenshot = null; + $t = get_markup_template("admin_plugins_details.tpl"); return replace_macros($t, array( '$title' => t('Administration'), @@ -755,6 +801,7 @@ function admin_page_themes(&$a){ '$admin_form' => $admin_form, '$str_author' => t('Author: '), '$str_maintainer' => t('Maintainer: '), + '$screenshot' => $screenshot, '$readme' => $readme )); } diff --git a/mod/allfriends.php b/mod/allfriends.php index f675b8e29..f675b8e29 100755..100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php diff --git a/mod/amcd.php b/mod/amcd.php index a2a1327e6..a2a1327e6 100755..100644 --- a/mod/amcd.php +++ b/mod/amcd.php diff --git a/mod/api.php b/mod/api.php index ad75e6620..ad75e6620 100755..100644 --- a/mod/api.php +++ b/mod/api.php diff --git a/mod/apps.php b/mod/apps.php index 8049b45fb..8049b45fb 100755..100644 --- a/mod/apps.php +++ b/mod/apps.php diff --git a/mod/attach.php b/mod/attach.php index ae6540201..ae6540201 100755..100644 --- a/mod/attach.php +++ b/mod/attach.php diff --git a/mod/cb.php b/mod/cb.php index 6375d2398..6375d2398 100755..100644 --- a/mod/cb.php +++ b/mod/cb.php diff --git a/mod/common.php b/mod/common.php index 852388c14..852388c14 100755..100644 --- a/mod/common.php +++ b/mod/common.php diff --git a/mod/community.php b/mod/community.php index f8cc3305b..f8cc3305b 100755..100644 --- a/mod/community.php +++ b/mod/community.php diff --git a/mod/contactgroup.php b/mod/contactgroup.php index bf81afe07..bf81afe07 100755..100644 --- a/mod/contactgroup.php +++ b/mod/contactgroup.php diff --git a/mod/contacts.php b/mod/contacts.php index 8aa51d00a..8aa51d00a 100755..100644 --- a/mod/contacts.php +++ b/mod/contacts.php diff --git a/mod/crepair.php b/mod/crepair.php index ec963b105..ec963b105 100755..100644 --- a/mod/crepair.php +++ b/mod/crepair.php diff --git a/mod/delegate.php b/mod/delegate.php index c19df0681..8c5031859 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -86,7 +86,7 @@ function delegate_content(&$a) { $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s' and contact.uid = %d and contact.self = 0 and network = '%s' ", - dbesc($a->get_baseurl()), + dbesc(normalise_link($a->get_baseurl())), intval(local_user()), dbesc(NETWORK_DFRN) ); diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 71860ac3b..65d39d5fe 100755..100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -99,65 +99,11 @@ function dfrn_notify_post(&$a) { $importer['forum'] = $page; } - // if contact's ssl policy changed, update our links - $ssl_changed = false; - - if($ssl_policy == 'self' && strstr($importer['url'],'https:')) { - $ssl_changed = true; - $importer['url'] = str_replace('https:','http:',$importer['url']); - $importer['nurl'] = normalise_link($importer['url']); - $importer['photo'] = str_replace('https:','http:',$importer['photo']); - $importer['thumb'] = str_replace('https:','http:',$importer['thumb']); - $importer['micro'] = str_replace('https:','http:',$importer['micro']); - $importer['request'] = str_replace('https:','http:',$importer['request']); - $importer['notify'] = str_replace('https:','http:',$importer['notify']); - $importer['poll'] = str_replace('https:','http:',$importer['poll']); - $importer['confirm'] = str_replace('https:','http:',$importer['confirm']); - $importer['poco'] = str_replace('https:','http:',$importer['poco']); - } + // if contact's ssl policy changed, update our links - if($ssl_policy == 'full' && strstr($importer['url'],'http:')) { - $ssl_changed = true; - $importer['url'] = str_replace('http:','https:',$importer['url']); - $importer['nurl'] = normalise_link($importer['url']); - $importer['photo'] = str_replace('http:','https:',$importer['photo']); - $importer['thumb'] = str_replace('http:','https:',$importer['thumb']); - $importer['micro'] = str_replace('http:','https:',$importer['micro']); - $importer['request'] = str_replace('http:','https:',$importer['request']); - $importer['notify'] = str_replace('http:','https:',$importer['notify']); - $importer['poll'] = str_replace('http:','https:',$importer['poll']); - $importer['confirm'] = str_replace('http:','https:',$importer['confirm']); - $importer['poco'] = str_replace('http:','https:',$importer['poco']); - } + fix_contact_ssl_policy($importer,$ssl_policy); - if($ssl_changed) { - q("update contact set - url = '%s', - nurl = '%s', - photo = '%s', - thumb = '%s', - micro = '%s', - request = '%s', - notify = '%s', - poll = '%s', - confirm = '%s', - poco = '%s' - where id = %d limit 1", - dbesc($importer['url']), - dbesc($importer['nurl']), - dbesc($importer['photo']), - dbesc($importer['thumb']), - dbesc($importer['micro']), - dbesc($importer['request']), - dbesc($importer['notify']), - dbesc($importer['poll']), - dbesc($importer['confirm']), - dbesc($importer['poco']), - intval($importer['id']) - ); - } - logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']); logger('dfrn_notify: data: ' . $data, LOGGER_DATA); @@ -174,6 +120,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 +214,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 +252,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 +265,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/dfrn_poll.php b/mod/dfrn_poll.php index fe5cd4906..5c2788983 100755..100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -26,21 +26,24 @@ function dfrn_poll_init(&$a) { $dfrn_id = substr($dfrn_id,2); } - if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) { + if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) { if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { killme(); } - $r = q("SELECT `hidewall` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1", - dbesc($a->argv[1]) - ); - if(count($r) && $r[0]['hidewall']) - killme(); + $user = ''; + if($a->argc > 1) { + $r = q("SELECT `hidewall`,`nickname` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1", + dbesc($a->argv[1]) + ); + if((! count($r)) || (count($r) && $r[0]['hidewall'])) + killme(); + $user = $r[0]['nickname']; + } - logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] ); + logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user); header("Content-type: application/atom+xml"); - $o = get_feed_for($a, '', $a->argv[1],$last_update); - echo $o; + echo get_feed_for($a, '', $user,$last_update); killme(); } diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index c2d37dac7..5881b7b51 100755..100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -664,8 +664,8 @@ function dfrn_request_content(&$a) { else $tpl = get_markup_template('auto_request.tpl'); - $page_desc = sprintf( t('Diaspora members: Please do not use this form. Instead, enter "%s" into your Diaspora search bar.'), - $target_addr) . EOL . EOL; + # $page_desc = sprintf( t('Diaspora members: Please do not use this form. Instead, enter "%s" into your Diaspora search bar.'), + # $target_addr) . EOL . EOL; $page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:"); @@ -699,7 +699,7 @@ function dfrn_request_content(&$a) { '$friendica' => t('Friendica'), '$statusnet' => t('StatusNet/Federated Social Web'), '$diaspora' => t('Diaspora'), - '$diasnote' => t('- please share from your own site as noted above'), + '$diasnote' => sprintf (t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.'),$target_addr), '$your_address' => t('Your Identity Address:'), '$invite_desc' => $invite_desc, '$emailnet' => $emailnet, diff --git a/mod/directory.php b/mod/directory.php index 7f18bd026..7f18bd026 100755..100644 --- a/mod/directory.php +++ b/mod/directory.php diff --git a/mod/dirfind.php b/mod/dirfind.php index 75b1c4976..34c54dd91 100755..100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -46,7 +46,7 @@ function dirfind_content(&$a) { foreach($j->results as $jj) { $o .= replace_macros($tpl,array( - '$url' => $jj->url, + '$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$tags' => $jj->tags diff --git a/mod/display.php b/mod/display.php index 81ed174ac..81ed174ac 100755..100644 --- a/mod/display.php +++ b/mod/display.php diff --git a/mod/editpost.php b/mod/editpost.php index 778ac3dcc..4c00201ca 100755..100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -104,7 +104,7 @@ function editpost_content(&$a) { '$wait' => t('Please wait'), '$permset' => t('Permission settings'), '$ptyp' => $itm[0]['type'], - '$content' => $itm[0]['body'], + '$content' => undo_post_tagging($itm[0]['body']), '$post_id' => $post_id, '$baseurl' => $a->get_baseurl(), '$defloc' => $a->user['default-location'], @@ -115,6 +115,8 @@ function editpost_content(&$a) { '$jotnets' => $jotnets, '$title' => $itm[0]['title'], '$placeholdertitle' => t('Set title'), + '$category' => file_tag_file_to_list($itm[0]['file'], 'category'), + '$placeholdercategory' => t('Categories (comma-separated list)'), '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb), diff --git a/mod/events.php b/mod/events.php index 0906d16c2..e66a2dc44 100755..100644 --- a/mod/events.php +++ b/mod/events.php @@ -284,11 +284,11 @@ function events_content(&$a) { if (x($_GET,'id')){ $tpl = get_markup_template("event.tpl"); } else { - if (get_config('experimentals','new_calendar')==1){ +// if (get_config('experimentals','new_calendar')==1){ $tpl = get_markup_template("events-js.tpl"); - } else { - $tpl = get_markup_template("events.tpl"); - } +// } else { +// $tpl = get_markup_template("events.tpl"); +// } } $o = replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), diff --git a/mod/filer.php b/mod/filer.php index a9e213536..c0cca9e6d 100755..100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -11,13 +11,26 @@ function filer_content(&$a) { killme(); } - $term = notags(trim($_GET['term'])); - $item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0); + $term = unxmlify(trim($_GET['term'])); + $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); 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 = file_tag_file_to_list($filetags,'file'); + $filetags = explode(",", $filetags); + $tpl = get_markup_template("filer_dialog.tpl"); + $o = replace_macros($tpl, array( + '$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), + '$submit' => t('Save'), + )); + + echo $o; + } killme(); } diff --git a/mod/filerm.php b/mod/filerm.php index 66b684dc9..c520fec7a 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -6,8 +6,8 @@ function filerm_content(&$a) { killme(); } - $term = notags(trim($_GET['term'])); - $item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0); + $term = unxmlify(trim($_GET['term'])); + $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); logger('filerm: tag ' . $term . ' item ' . $item_id); diff --git a/mod/follow.php b/mod/follow.php index ae8cb200c..ae8cb200c 100755..100644 --- a/mod/follow.php +++ b/mod/follow.php diff --git a/mod/friendica.php b/mod/friendica.php index ab92e31ed..52a064224 100755..100644 --- a/mod/friendica.php +++ b/mod/friendica.php @@ -4,8 +4,12 @@ function friendica_init(&$a) { if ($a->argv[1]=="json"){ $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); + $sql_extra = ''; + if(x($a->config,'admin_nickname')) { + $sql_extra = sprintf(" AND nickname = '%s' ",dbesc($a->config['admin_nickname'])); + } if (isset($a->config['admin_email']) && $a->config['admin_email']!=''){ - $r = q("SELECT username, nickname FROM user WHERE email='%s'", $a->config['admin_email']); + $r = q("SELECT username, nickname FROM user WHERE email='%s' $sql_extra", dbesc($a->config['admin_email'])); $admin = array( 'name' => $r[0]['username'], 'profile'=> $a->get_baseurl().'/profile/'.$r[0]['nickname'], @@ -51,15 +55,20 @@ function friendica_content(&$a) { $o .= '<p></p>'; if(count($a->plugins)) { - $o .= '<p>' . t('Installed plugins/addons/apps') . '</p>'; - $o .= '<ul>'; - foreach($a->plugins as $p) - if(strlen($p)) - $o .= '<li>' . $p . '</li>'; - $o .= '</ul>'; + $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>'; + $sorted = $a->plugins; + $s = ''; + sort($sorted); + foreach($sorted as $p) { + if(strlen($p)) { + if(strlen($s)) $s .= ', '; + $s .= $p; + } + } + $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>'; } else - $o .= '<p>' . t('No installed plugins/addons/apps'); + $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>'; call_hooks('about_hook', $o); diff --git a/mod/friendika.php b/mod/friendika.php index 1f3df565d..1f3df565d 100755..100644 --- a/mod/friendika.php +++ b/mod/friendika.php diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 9ef8f4c55..9ef8f4c55 100755..100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php diff --git a/mod/group.php b/mod/group.php index a282dbccf..a282dbccf 100755..100644 --- a/mod/group.php +++ b/mod/group.php diff --git a/mod/hcard.php b/mod/hcard.php index 6d2d9e2eb..6d2d9e2eb 100755..100644 --- a/mod/hcard.php +++ b/mod/hcard.php diff --git a/mod/help.php b/mod/help.php index af05bd47c..af05bd47c 100755..100644 --- a/mod/help.php +++ b/mod/help.php diff --git a/mod/home.php b/mod/home.php index 0320c1b39..0320c1b39 100755..100644 --- a/mod/home.php +++ b/mod/home.php diff --git a/mod/hostxrd.php b/mod/hostxrd.php index fe61a874c..fe61a874c 100755..100644 --- a/mod/hostxrd.php +++ b/mod/hostxrd.php diff --git a/mod/install.php b/mod/install.php index 003d81c6a..d1142248a 100755..100644 --- a/mod/install.php +++ b/mod/install.php @@ -340,7 +340,7 @@ function check_php(&$phpath, &$checks) { $help .= t('The command line version of PHP on your system does not have "register_argc_argv" enabled.'). EOL; $help .= t('This is required for message delivery to work.'); } - check_add($checks, t('PHP "register_argc_argv"'), $passed, true, $help); + check_add($checks, t('PHP register_argc_argv'), $passed, true, $help); } diff --git a/mod/invite.php b/mod/invite.php index d4eb9c5ef..2dbf93c59 100755..100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -56,7 +56,7 @@ function invite_post(&$a) { else $nmessage = $message; - $res = mail($recip, sprintf( t('Please join my network on %s'), $a->config['sitename']), + $res = mail($recip, sprintf( t('Please join us on Friendica'), $a->config['sitename']), $nmessage, "From: " . $a->user['email'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" @@ -94,15 +94,28 @@ function invite_content(&$a) { } } + $dirloc = get_config('system','directory_submit_url'); + if(strlen($dirloc)) { + if($a->config['register_policy'] == REGISTER_CLOSED) + $linktxt = sprintf( t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), dirname($dirloc) . '/siteinfo'); + elseif($a->config['register_policy'] != REGISTER_CLOSED) + $linktxt = sprintf( t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), $a->get_baseurl()) + . "\r\n" . "\r\n" . sprintf( t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'),dirname($dirloc) . '/siteinfo'); + } + else { + $o = t('Our apologies. This system is not currently configured to connect with other public sites or invite members.'); + return $o; + } $o = replace_macros($tpl, array( '$invite' => t('Send invitations'), '$addr_text' => t('Enter email addresses, one per line:'), '$msg_text' => t('Your message:'), - '$default_message' => sprintf(t('Please join my social network on %s'), $a->config['sitename']) . "\r\n" . "\r\n" - . t('To accept this invitation, please visit:') . "\r\n" . "\r\n" . $a->get_baseurl() + '$default_message' => t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" + . $linktxt . "\r\n" . "\r\n" . (($invonly) ? t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') .t('Once you have registered, please connect with me via my profile page at:') - . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] , + . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] + . "\r\n" . "\r\n" . t('For more information about the Friendica project and why we feel it is important, please visit http://friendica.com') . "\r\n" . "\r\n" , '$submit' => t('Submit') )); diff --git a/mod/item.php b/mod/item.php index ee6c5c9a7..72e63865b 100755..100644 --- a/mod/item.php +++ b/mod/item.php @@ -171,16 +171,17 @@ 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']; + } else { @@ -213,8 +214,8 @@ function item_post(&$a) { $coord = notags(trim($_REQUEST['coord'])); $verb = notags(trim($_REQUEST['verb'])); $emailcc = notags(trim($_REQUEST['emailcc'])); - $body = escape_tags(trim($_REQUEST['body'])); + $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0); if(($parent_item) && @@ -242,8 +243,6 @@ function item_post(&$a) { } } - - if(! strlen($body)) { if($preview) killme(); @@ -254,6 +253,19 @@ function item_post(&$a) { } } + if(strlen($categories)) { + // get the "fileas" tags for this post + $filedas = file_tag_file_to_list($categories, 'file'); + } + // save old and new categories, so we can determine what needs to be deleted from pconfig + $categories_old = $categories; + $categories = file_tag_list_to_file(trim($_REQUEST['category']), 'category'); + $categories_new = $categories; + if(strlen($filedas)) { + // append the fileas stuff to the new categories list + $categories .= file_tag_list_to_file($filedas, 'file'); + } + // Work around doubled linefeeds in Tinymce 3.5b2 // First figure out if it's a status post that would've been // created using tinymce. Otherwise leave it alone. @@ -500,6 +512,7 @@ function item_post(&$a) { $datarray['location'] = $location; $datarray['coord'] = $coord; $datarray['tag'] = $str_tags; + $datarray['file'] = $categories; $datarray['inform'] = $inform; $datarray['verb'] = $verb; $datarray['allow_cid'] = $str_contact_allow; @@ -559,14 +572,20 @@ function item_post(&$a) { if($orig_post) { - $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", - dbesc($title), - dbesc($body), + $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `attach` = '%s', `file` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", + dbesc($datarray['title']), + dbesc($datarray['body']), + dbesc($datarray['tag']), + dbesc($datarray['attach']), + dbesc($datarray['file']), dbesc(datetime_convert()), intval($post_id), intval($profile_uid) ); + // update filetags in pconfig + file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + proc_run('php', "include/notifier.php", 'edit_post', "$post_id"); if((x($_REQUEST,'return')) && strlen($return_path)) { logger('return: ' . $return_path); @@ -580,8 +599,8 @@ function item_post(&$a) { $r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`, - `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated` ) - VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d )", + `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file` ) + VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )", dbesc($datarray['guid']), intval($datarray['uid']), dbesc($datarray['type']), @@ -619,8 +638,9 @@ function item_post(&$a) { dbesc($datarray['attach']), intval($datarray['bookmark']), intval($datarray['origin']), - intval($datarry['moderated']) - ); + intval($datarray['moderated']), + dbesc($datarray['file']) + ); $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($datarray['uri'])); @@ -628,6 +648,9 @@ function item_post(&$a) { $post_id = $r[0]['id']; logger('mod_item: saved item ' . $post_id); + // update filetags in pconfig + file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + if($parent) { // This item is the last leaf and gets the comment box, clear any ancestors diff --git a/mod/like.php b/mod/like.php index 6b97fafb5..6b97fafb5 100755..100644 --- a/mod/like.php +++ b/mod/like.php diff --git a/mod/localtime.php b/mod/localtime.php index c03eae1b0..c03eae1b0 100755..100644 --- a/mod/localtime.php +++ b/mod/localtime.php diff --git a/mod/lockview.php b/mod/lockview.php index 9e64e2608..9e64e2608 100755..100644 --- a/mod/lockview.php +++ b/mod/lockview.php diff --git a/mod/login.php b/mod/login.php index 10b4d3001..10b4d3001 100755..100644 --- a/mod/login.php +++ b/mod/login.php diff --git a/mod/lostpass.php b/mod/lostpass.php index 57e6d6965..57e6d6965 100755..100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php diff --git a/mod/manage.php b/mod/manage.php index 84dfa6917..84dfa6917 100755..100644 --- a/mod/manage.php +++ b/mod/manage.php diff --git a/mod/match.php b/mod/match.php index 1ae7848a6..926df1dff 100755..100644 --- a/mod/match.php +++ b/mod/match.php @@ -51,7 +51,7 @@ function match_content(&$a) { $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url; $o .= replace_macros($tpl,array( - '$url' => $jj->url, + '$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$inttxt' => ' ' . t('is interested in:'), diff --git a/mod/message.php b/mod/message.php index 0907abd77..1369fde2e 100755..100644 --- 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()) { @@ -15,6 +44,13 @@ function message_post(&$a) { $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 ); + // Work around doubled linefeeds in Tinymce 3.5b2 + + $plaintext = intval(get_pconfig(local_user(),'system','plaintext')); + if(! $plaintext) { + $body = str_replace("\r\n","\n",$body); + $body = str_replace("\n\n","\n",$body); + } $ret = send_message($recipient, $body, $subject, $replyto); $norecip = false; @@ -59,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'); @@ -174,15 +192,12 @@ function message_content(&$a) { return $o; } - if(($a->argc == 1) || ($a->argc == 2 && $a->argv[1] === 'sent')) { + if($a->argc == 1) { + + // list messages $o .= $header; - if($a->argc == 2) - $eq = '='; // I'm not going to bother escaping this. - else - $eq = '!='; // or this. - $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", intval(local_user()), @@ -192,11 +207,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 GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", intval(local_user()), - dbesc($myprofile), + // intval($a->pager['start']), intval($a->pager['itemspage']) ); @@ -207,17 +223,29 @@ function message_content(&$a) { $tpl = get_markup_template('mail_list.tpl'); foreach($r as $rr) { + if($rr['unknown']) { + $partecipants = sprintf( t("Unknown sender - %s"),$rr['from-name']); + } + elseif (link_compare($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'], + '$from_photo' => (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']), '$subject' => template_escape((($rr['mailseen']) ? $rr['title'] : '<strong>' . $rr['title'] . '</strong>')), '$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); @@ -271,8 +299,13 @@ function message_content(&$a) { )); - $tpl = get_markup_template('mail_conv.tpl'); + $mails = array(); + $seen = 0; + $unknown = false; + foreach($messages as $message) { + if($message['unknown']) + $unknown = true; if($message['from-url'] == $myprofile) { $from_url = $myprofile; $sparkle = ''; @@ -281,24 +314,36 @@ 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'), + '$canreply' => (($unknown) ? false : '1'), + '$unknown_text' => t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."), + '$mails' => $mails, + + // reply '$header' => t('Send Reply'), '$to' => t('To:'), '$subject' => t('Subject:'), @@ -311,6 +356,7 @@ function message_content(&$a) { '$upload' => t('Upload photo'), '$insert' => t('Insert web link'), '$wait' => t('Please wait') + )); return $o; diff --git a/mod/modexp.php b/mod/modexp.php index bba2c2882..bba2c2882 100755..100644 --- a/mod/modexp.php +++ b/mod/modexp.php diff --git a/mod/msearch.php b/mod/msearch.php index 94def7d89..94def7d89 100755..100644 --- a/mod/msearch.php +++ b/mod/msearch.php diff --git a/mod/network.php b/mod/network.php index 9ec8c23b5..d27945a86 100755..100644 --- a/mod/network.php +++ b/mod/network.php @@ -250,6 +250,20 @@ function network_content(&$a, $update = 0) { if($cid) $def_acl = array('allow_cid' => '<' . intval($cid) . '>'); + if($nets) { + $r = q("select id from contact where uid = %d and network = '%s' and self = 0", + intval(local_user()), + dbesc($nets) + ); + + $str = ''; + if(count($r)) + foreach($r as $rr) + $str .= '<' . $rr['id'] . '>'; + if(strlen($str)) + $def_acl = array('allow_cid' => $str); + } + if(! $update) { if($group) { if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) { @@ -269,9 +283,9 @@ function network_content(&$a, $update = 0) { 'allow_location' => $a->user['allow_location'], 'default_location' => $a->user['default-location'], 'nickname' => $a->user['nickname'], - 'lockstate' => ((($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), - 'acl' => populate_acl((($group || $cid) ? $def_acl : $a->user), $celeb), - 'bang' => (($group || $cid) ? '!' : ''), + 'lockstate' => ((($group) || ($cid) || ($nets) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'), + 'acl' => populate_acl((($group || $cid || $nets) ? $def_acl : $a->user), $celeb), + 'bang' => (($group || $cid || $nets) ? '!' : ''), 'visitor' => 'block', 'profile_uid' => local_user() ); @@ -379,7 +393,7 @@ function network_content(&$a, $update = 0) { ); } if(strlen($file)) { - $sql_extra .= file_tag_file_query('item',$file); + $sql_extra .= file_tag_file_query('item',unxmlify($file)); } if($conv) { diff --git a/mod/newmember.php b/mod/newmember.php index 2ecc89024..683463ecb 100755..100644 --- a/mod/newmember.php +++ b/mod/newmember.php @@ -13,6 +13,8 @@ function newmember_content(&$a) { $o .= '<ul>'; + $o .= '<li>' . '<a target="newmember" href="/help/guide">' . t('On your <em>Quick Start</em> page - find a brief introduction to your profile and network tabs, connect to Facebook, make some new connections, and find some groups to join.') . '</a></li>' . EOL; + $o .= '<li>' . '<a target="newmember" href="settings">' . t('On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</a></li>' . EOL; $o .= '<li>' . '<a target="newmember" href="settings">' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</a></li>' . EOL; diff --git a/mod/notes.php b/mod/notes.php index e6e2b44fb..e6e2b44fb 100755..100644 --- a/mod/notes.php +++ b/mod/notes.php diff --git a/mod/notice.php b/mod/notice.php index 19cf53189..19cf53189 100755..100644 --- a/mod/notice.php +++ b/mod/notice.php diff --git a/mod/notifications.php b/mod/notifications.php index ff131010f..690a99562 100755..100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -37,7 +37,11 @@ function notifications_post(&$a) { intval($intro_id) ); if(! $fid) { - $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1", + + // The check for blocked and pending is in case the friendship was already approved + // and we just want to get rid of the now pointless notification + + $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 AND `blocked` = 1 AND `pending` = 1 LIMIT 1", intval($contact_id), intval(local_user()) ); @@ -145,7 +149,7 @@ function notifications_content(&$a) { '$contact_id' => $rr['contact-id'], '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"), '$fullname' => $rr['fname'], - '$url' => $rr['furl'], + '$url' => zrl($rr['furl']), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')), @@ -195,7 +199,7 @@ function notifications_content(&$a) { '$fullname' => $rr['name'], '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), '$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')), - '$url' => $rr['url'], + '$url' => zrl($rr['url']), '$knowyou' => $knowyou, '$approve' => t('Approve'), '$note' => $rr['note'], diff --git a/mod/oembed.php b/mod/oembed.php index 236625f68..236625f68 100755..100644 --- a/mod/oembed.php +++ b/mod/oembed.php diff --git a/mod/oexchange.php b/mod/oexchange.php index bbb436e70..bbb436e70 100755..100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php diff --git a/mod/openid.php b/mod/openid.php index e2cea7d85..e2cea7d85 100755..100644 --- a/mod/openid.php +++ b/mod/openid.php diff --git a/mod/opensearch.php b/mod/opensearch.php index ff748d1c5..ff748d1c5 100755..100644 --- a/mod/opensearch.php +++ b/mod/opensearch.php diff --git a/mod/parse_url.php b/mod/parse_url.php index 27dac4d5d..27dac4d5d 100755..100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php diff --git a/mod/photo.php b/mod/photo.php index 3a7025120..3a7025120 100755..100644 --- a/mod/photo.php +++ b/mod/photo.php diff --git a/mod/photos.php b/mod/photos.php index b294f0a66..2a808cb41 100755..100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -38,21 +38,22 @@ function photos_init(&$a) { $o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg" alt="' . $a->data['user']['username'] . '" /></div>'; $o .= '</div>'; - $o .= '<div id="side-bar-photos-albums" class="widget">'; - $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h3>'; + if(! intval($a->data['user']['hidewall'])) { + $o .= '<div id="side-bar-photos-albums" class="widget">'; + $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h3>'; - $o .= '<ul>'; - foreach($albums as $album) { + $o .= '<ul>'; + foreach($albums as $album) { - // don't show contact photos. We once translated this name, but then you could still access it under - // a different language setting. Now we store the name in English and check in English (and translated for legacy albums). + // don't show contact photos. We once translated this name, but then you could still access it under + // a different language setting. Now we store the name in English and check in English (and translated for legacy albums). - if((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) - continue; - $o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>'; + if((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos'))) + continue; + $o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>'; + } + $o .= '</ul>'; } - $o .= '</ul>'; - if(local_user() && $a->data['user']['uid'] == local_user()) { $o .= '<div id="photo-albums-upload-link"><a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/upload" >' .t('Upload New Photos') . '</a></div>'; } 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/poco.php b/mod/poco.php index 79cf820bc..acfa3ffaa 100755..100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -45,6 +45,8 @@ function poco_init(&$a) { if($justme) $sql_extra = " and `contact`.`self` = 1 "; + else + $sql_extra = " and `contact`.`self` = 0 "; if($cid) $sql_extra = sprintf(" and `contact`.`id` = %d ",intval($cid)); diff --git a/mod/post.php b/mod/post.php index 4a7e33b23..4a7e33b23 100755..100644 --- a/mod/post.php +++ b/mod/post.php diff --git a/mod/pretheme.php b/mod/pretheme.php new file mode 100644 index 000000000..0efa587d8 --- /dev/null +++ b/mod/pretheme.php @@ -0,0 +1,16 @@ +<?php + +function pretheme_init(&$a) { + + if($_REQUEST['theme']) { + $theme = $_REQUEST['theme']; + $info = get_theme_info($theme); + if($info) { + // unfortunately there will be no translation for this string + $desc = $info['description'] . ' ' . $info['version']; + } + else $desc = ''; + echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc)); + } + killme(); +} diff --git a/mod/probe.php b/mod/probe.php index c95db291b..c95db291b 100755..100644 --- a/mod/probe.php +++ b/mod/probe.php diff --git a/mod/profile.php b/mod/profile.php index 428679ffc..68d73fba3 100755..100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -2,6 +2,11 @@ function profile_init(&$a) { + require_once('include/contact_widgets.php'); + + if(! x($a->page,'aside')) + $a->page['aside'] = ''; + $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); if($a->argc > 1) @@ -59,6 +64,13 @@ function profile_init(&$a) { function profile_content(&$a, $update = 0) { + if (x($a->category)) { + $category = $a->category; + } + else { + $category = ((x($_GET,'category')) ? $_GET['category'] : ''); + } + if(get_config('system','block_public') && (! local_user()) && (! remote_user())) { return login(); } @@ -107,13 +119,14 @@ function profile_content(&$a, $update = 0) { $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); - if($a->user['hidewall'] && (! $is_owner) && (! $remote_contact)) { + if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) { notice( t('Access to this profile has been restricted.') . EOL); return; } - if(! $update) { + + if(x($_GET,'tab')) $tab = notags(trim($_GET['tab'])); @@ -135,6 +148,8 @@ function profile_content(&$a, $update = 0) { $celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : '')); + if(can_write_wall($a,$a->profile['profile_uid'])) { $x = array( @@ -178,6 +193,10 @@ function profile_content(&$a, $update = 0) { } else { + if(x($category)) { + $sql_extra .= file_tag_file_query('item',$category,'category'); + } + $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 @@ -204,6 +223,7 @@ function profile_content(&$a, $update = 0) { intval($a->profile['profile_uid']) ); + } $parents_arr = array(); diff --git a/mod/profile_photo.php b/mod/profile_photo.php index d1fd08eba..ace8dadd4 100755..100644 --- 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/profiles.php b/mod/profiles.php index 7b3b6ccc1..7b3b6ccc1 100755..100644 --- a/mod/profiles.php +++ b/mod/profiles.php diff --git a/mod/profperm.php b/mod/profperm.php index 8d09c429c..8d09c429c 100755..100644 --- a/mod/profperm.php +++ b/mod/profperm.php diff --git a/mod/pubsub.php b/mod/pubsub.php index 93d50ef90..93d50ef90 100755..100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php diff --git a/mod/qsearch.php b/mod/qsearch.php index c35e253b6..c35e253b6 100755..100644 --- a/mod/qsearch.php +++ b/mod/qsearch.php diff --git a/mod/receive.php b/mod/receive.php index 950bf0bd3..2bd3cc65b 100755..100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -12,6 +12,13 @@ require_once('include/diaspora.php'); function receive_post(&$a) { + + $enabled = intval(get_config('system','diaspora_enabled')); + if(! $enabled) { + logger('mod-diaspora: disabled'); + http_status_exit(500); + } + $public = false; if(($a->argc == 2) && ($a->argv[1] === 'public')) { diff --git a/mod/redir.php b/mod/redir.php index 9223e5483..9223e5483 100755..100644 --- a/mod/redir.php +++ b/mod/redir.php diff --git a/mod/register.php b/mod/register.php index 6d0e2700b..630c0a675 100755..100644 --- a/mod/register.php +++ b/mod/register.php @@ -8,6 +8,8 @@ function register_post(&$a) { $verified = 0; $blocked = 1; + $arr = array('post' => $_POST); + call_hooks('register_post', $arr); $max_dailies = intval(get_config('system','max_daily_registrations')); if($max_dailes) { @@ -218,8 +220,8 @@ function register_post(&$a) { $spubkey = $spkey["key"]; $r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`, - `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked` ) - VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )", + `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone` ) + VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC' )", dbesc(generate_user_guid()), dbesc($username), dbesc($new_password_encoded), @@ -540,6 +542,11 @@ function register_content(&$a) { $license = ''; $o = get_markup_template("register.tpl"); + + $arr = array('template' => $o); + + call_hooks('register_form',$arr); + $o = replace_macros($o, array( '$oidhtml' => $oidhtml, '$invitations' => get_config('system','invitation_only'), diff --git a/mod/regmod.php b/mod/regmod.php index 21f41eb01..21f41eb01 100755..100644 --- a/mod/regmod.php +++ b/mod/regmod.php diff --git a/mod/removeme.php b/mod/removeme.php index ee88bd76a..ee88bd76a 100755..100644 --- a/mod/removeme.php +++ b/mod/removeme.php diff --git a/mod/rsd_xml.php b/mod/rsd_xml.php index 5bf4663fd..5bf4663fd 100755..100644 --- a/mod/rsd_xml.php +++ b/mod/rsd_xml.php diff --git a/mod/salmon.php b/mod/salmon.php index 6172d17a1..6172d17a1 100755..100644 --- a/mod/salmon.php +++ b/mod/salmon.php diff --git a/mod/search.php b/mod/search.php index 50e7a6abc..4ca7db9bb 100755..100644 --- a/mod/search.php +++ b/mod/search.php @@ -97,30 +97,26 @@ function search_content(&$a) { // OR your own posts if you are a logged in member // No items will be shown if the member has a blocked profile wall. - $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )", - dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\[')); - - $search_alg = $s_regx; - - $r = q("SELECT COUNT(*) AS `total` + $r = q("SELECT distinct(`item`.`uri`) as `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - $search_alg ", - intval(local_user()) + AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) group by `item`.`uri` ", + intval(local_user()), + dbesc(preg_quote($search)), + dbesc('\\]' . preg_quote($search) . '\\[') ); if(count($r)) - $a->set_pager_total($r[0]['total']); - - if(! $r[0]['total']) { + $a->set_pager_total(count($r)); + if(! count($r)) { info( t('No results.') . EOL); return $o; } - $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, + $r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`, @@ -131,9 +127,12 @@ function search_content(&$a) { AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 ) OR `item`.`uid` = %d ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - $search_alg + AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) + group by `item`.`uri` ORDER BY `received` DESC LIMIT %d , %d ", intval(local_user()), + dbesc(preg_quote($search)), + dbesc('\\]' . preg_quote($search) . '\\['), intval($a->pager['start']), intval($a->pager['itemspage']) diff --git a/mod/session.php b/mod/session.php index 22c855edb..22c855edb 100755..100644 --- a/mod/session.php +++ b/mod/session.php diff --git a/mod/settings.php b/mod/settings.php index 59ede4729..6879da285 100755..100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -1,6 +1,19 @@ <?php +function get_theme_config_file($theme){ + $a = get_app(); + $base_theme = $a->theme_info['extends']; + + if (file_exists("view/theme/$theme/config.php")){ + return "view/theme/$theme/config.php"; + } + if (file_exists("view/theme/$base_theme/config.php")){ + return "view/theme/$base_theme/config.php"; + } + return null; +} + function settings_init(&$a) { if(local_user()) { profile_load($a,$a->user['nickname']); @@ -193,6 +206,46 @@ function settings_post(&$a) { call_hooks('connector_settings_post', $_POST); return; } + + if(($a->argc > 1) && ($a->argv[1] == 'display')) { + + check_form_security_token_redirectOnErr('/settings/display', 'settings_display'); + + $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']); + $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); + $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); + $browser_update = $browser_update * 1000; + if($browser_update < 10000) + $browser_update = 40000; + + $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40); + if($itemspage_network > 100) + $itemspage_network = 40; + + + set_pconfig(local_user(),'system','update_interval', $browser_update); + set_pconfig(local_user(),'system','itemspage_network', $itemspage_network); + set_pconfig(local_user(),'system','no_smilies',$nosmile); + + + if ($theme == $a->user['theme']){ + // call theme_post only if theme has not been changed + if( ($themeconfigfile = get_theme_config_file($theme)) != null){ + require_once($themeconfigfile); + theme_post($a); + } + } + + + $r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d LIMIT 1", + dbesc($theme), + intval(local_user()) + ); + + call_hooks('display_settings_post', $_POST); + goaway($a->get_baseurl(true) . '/settings/display' ); + return; // NOTREACHED + } check_form_security_token_redirectOnErr('/settings', 'settings'); @@ -227,7 +280,7 @@ function settings_post(&$a) { } } - $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']); + $username = ((x($_POST,'username')) ? notags(trim($_POST['username'])) : ''); $email = ((x($_POST,'email')) ? notags(trim($_POST['email'])) : ''); $timezone = ((x($_POST,'timezone')) ? notags(trim($_POST['timezone'])) : ''); @@ -242,14 +295,6 @@ function settings_post(&$a) { $expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0); $expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0); - $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); - $browser_update = $browser_update * 1000; - if($browser_update < 10000) - $browser_update = 40000; - - $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40); - if($itemspage_network > 100) - $itemspage_network = 40; $allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0); @@ -259,7 +304,8 @@ function settings_post(&$a) { $page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); $blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted! $blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted! - + $unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0); + $cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0); $suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); @@ -345,10 +391,9 @@ function settings_post(&$a) { set_pconfig(local_user(),'expire','photos', $expire_photos); set_pconfig(local_user(),'system','suggestme', $suggestme); - set_pconfig(local_user(),'system','update_interval', $browser_update); - set_pconfig(local_user(),'system','itemspage_network', $itemspage_network); - $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d WHERE `uid` = %d LIMIT 1", + + $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d LIMIT 1", dbesc($username), dbesc($email), dbesc($openid), @@ -361,13 +406,14 @@ function settings_post(&$a) { intval($page_flags), dbesc($defloc), intval($allow_location), - dbesc($theme), intval($maxreq), intval($expire), dbesc($openidserver), intval($blockwall), intval($hidewall), intval($blocktags), + intval($unkmail), + intval($cntunkmail), intval(local_user()) ); if($r) @@ -440,6 +486,12 @@ function settings_content(&$a) { 'sel' => (($a->argc == 1)?'active':''), ), array( + 'label' => t('Display settings'), + 'url' => $a->get_baseurl(true).'/settings/display', + 'sel' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), + ), + + array( 'label' => t('Connector settings'), 'url' => $a->get_baseurl(true).'/settings/connectors', 'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), @@ -577,31 +629,31 @@ function settings_content(&$a) { $diasp_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('Diaspora'), ((get_config('system','diaspora_enabled')) ? t('enabled') : t('disabled'))); $ostat_enabled = sprintf( t('Built-in support for %s connectivity is %s'), t('StatusNet'), ((get_config('system','ostatus_disabled')) ? t('disabled') : t('enabled'))); - $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); - if(get_config('system','dfrn_only')) - $mail_disabled = 1; + $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); + if(get_config('system','dfrn_only')) + $mail_disabled = 1; - if(! $mail_disabled) { - $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", - local_user() - ); - } - else { - $r = null; - } + if(! $mail_disabled) { + $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", + local_user() + ); + } + else { + $r = null; + } - $mail_server = ((count($r)) ? $r[0]['server'] : ''); - $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : ''); - $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : ''); - $mail_user = ((count($r)) ? $r[0]['user'] : ''); - $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : ''); - $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0); - $mail_action = ((count($r)) ? $r[0]['action'] : 0); - $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : ''); - $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00'); + $mail_server = ((count($r)) ? $r[0]['server'] : ''); + $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : ''); + $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : ''); + $mail_user = ((count($r)) ? $r[0]['user'] : ''); + $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : ''); + $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0); + $mail_action = ((count($r)) ? $r[0]['action'] : 0); + $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : ''); + $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00'); - $tpl = get_markup_template("settings_connectors.tpl"); + $tpl = get_markup_template("settings_connectors.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_connectors"), @@ -617,7 +669,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'), @@ -628,9 +680,83 @@ function settings_content(&$a) { '$settings_connectors' => $settings_connectors )); + + call_hooks('display_settings', $o); return $o; } + /* + * DISPLAY SETTINGS + */ + if(($a->argc > 1) && ($a->argv[1] === 'display')) { + $default_theme = get_config('system','theme'); + if(! $default_theme) + $default_theme = 'default'; + + $allowed_themes_str = get_config('system','allowed_themes'); + $allowed_themes_raw = explode(',',$allowed_themes_str); + $allowed_themes = array(); + if(count($allowed_themes_raw)) + foreach($allowed_themes_raw as $x) + if(strlen(trim($x))) + $allowed_themes[] = trim($x); + + + $themes = array(); + $files = glob('view/theme/*'); + if($allowed_themes) { + foreach($allowed_themes as $th) { + $f = $th; + $is_experimental = file_exists('view/theme/' . $th . '/experimental'); + $unsupported = file_exists('view/theme/' . $th . '/unsupported'); + if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ + $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f); + $themes[$f]=$theme_name; + } + } + } + $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']); + + $browser_update = intval(get_pconfig(local_user(), 'system','update_interval')); + $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds + + $itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network')); + $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items + + $nosmile = get_pconfig(local_user(),'system','no_smilies'); + $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0 + + + $theme_config = ""; + if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){ + require_once($themeconfigfile); + $theme_config = theme_content($a); + } + + $tpl = get_markup_template("settings_display.tpl"); + $o = replace_macros($tpl, array( + '$tabs' => $tabs, + '$ptitle' => t('Display Settings'), + '$form_security_token' => get_form_security_token("settings_display"), + '$submit' => t('Submit'), + '$baseurl' => $a->get_baseurl(true), + '$uid' => local_user(), + + '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes), + '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), + '$itemspage_network' => array('itemspage_network', t("Number of items to display on the network page:"), $itemspage_network, t('Maximum of 100 items')), + '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), + + '$theme_config' => $theme_config, + )); + + return $o; + } + + + /* + * ACCOUNT SETTINGS + */ require_once('include/acl_selectors.php'); @@ -640,17 +766,19 @@ function settings_content(&$a) { if(count($p)) $profile = $p[0]; - $username = $a->user['username']; - $email = $a->user['email']; - $nickname = $a->user['nickname']; - $timezone = $a->user['timezone']; - $notify = $a->user['notify-flags']; - $defloc = $a->user['default-location']; - $openid = $a->user['openid']; - $maxreq = $a->user['maxreq']; - $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); - $blockwall = $a->user['blockwall']; - $blocktags = $a->user['blocktags']; + $username = $a->user['username']; + $email = $a->user['email']; + $nickname = $a->user['nickname']; + $timezone = $a->user['timezone']; + $notify = $a->user['notify-flags']; + $defloc = $a->user['default-location']; + $openid = $a->user['openid']; + $maxreq = $a->user['maxreq']; + $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); + $blockwall = $a->user['blockwall']; + $blocktags = $a->user['blocktags']; + $unkmail = $a->user['unkmail']; + $cntunkmail = $a->user['cntunkmail']; $expire_items = get_pconfig(local_user(), 'expire','items'); $expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1 @@ -668,11 +796,7 @@ function settings_content(&$a) { $suggestme = get_pconfig(local_user(), 'system','suggestme'); $suggestme = (($suggestme===false)? '0': $suggestme); // default if not set: 0 - $browser_update = intval(get_pconfig(local_user(), 'system','update_interval')); - $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds - $itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network')); - $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items if(! strlen($a->user['timezone'])) $timezone = date_default_timezone_get(); @@ -754,6 +878,12 @@ function settings_content(&$a) { )); + $unkmail = replace_macros($opt_tpl,array( + '$field' => array('unkmail', t('Permit unknown people to send you private mail?'), $unkmail, '', array(t('No'),t('Yes'))), + + )); + + $invisible = (((! $profile['publish']) && (! $profile['net-publish'])) ? true : false); @@ -761,33 +891,7 @@ function settings_content(&$a) { info( t('Profile is <strong>not published</strong>.') . EOL ); - $default_theme = get_config('system','theme'); - if(! $default_theme) - $default_theme = 'default'; - - $allowed_themes_str = get_config('system','allowed_themes'); - $allowed_themes_raw = explode(',',$allowed_themes_str); - $allowed_themes = array(); - if(count($allowed_themes_raw)) - foreach($allowed_themes_raw as $x) - if(strlen(trim($x))) - $allowed_themes[] = trim($x); - - $themes = array(); - $files = glob('view/theme/*'); - if($allowed_themes) { - foreach($allowed_themes as $th) { - $f = $th; - $is_experimental = file_exists('view/theme/' . $th . '/experimental'); - $unsupported = file_exists('view/theme/' . $th . '/unsupported'); - if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ - $theme_name = (($is_experimental) ? sprintf("%s - \x28Experimental\x29", $f) : $f); - $themes[$f]=$theme_name; - } - } - } - $theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']); $subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl(true) . '/profile/' . $nickname : ''); @@ -838,9 +942,7 @@ function settings_content(&$a) { '$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''), '$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''), '$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''), - '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes), - '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), - '$itemspage_network' => array('itemspage_network', t("Number of items to display on the network page:"), $itemspage_network, t('Maximum of 100 items')), + '$h_prv' => t('Security and Privacy Settings'), @@ -858,7 +960,8 @@ function settings_content(&$a) { '$profile_in_net_dir' => $profile_in_net_dir, '$hide_friends' => $hide_friends, '$hide_wall' => $hide_wall, - + '$unkmail' => $unkmail, + '$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail ,t("\x28to prevent spam abuse\x29")), '$h_not' => t('Notification Settings'), diff --git a/mod/share.php b/mod/share.php index 47bb851a4..6c6098c83 100755..100644 --- a/mod/share.php +++ b/mod/share.php @@ -16,18 +16,18 @@ function share_init(&$a) { $o = ''; - if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) { +// if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) { $o .= "\xE2\x99\xb2" . ' [url=' . $r[0]['author-link'] . ']' . $r[0]['author-name'] . '[/url]' . "\n"; if($r[0]['title']) $o .= '[b]' . $r[0]['title'] . '[/b]' . "\n"; $o .= $r[0]['body'] . "\n"; - } - else { - $o .= '♲ <a href="' . $r[0]['author-link'] . '">' . $r[0]['author-name'] . '</a><br />'; - if($r[0]['title']) - $o .= '<strong>' . $r[0]['title'] . '</strong><br />'; - $o .= bbcode($r[0]['body'], true) . '<br />'; - } +// } +// else { +// $o .= '♲ <a href="' . $r[0]['author-link'] . '">' . $r[0]['author-name'] . '</a><br />'; +// if($r[0]['title']) +// $o .= '<strong>' . $r[0]['title'] . '</strong><br />'; +// $o .= $r[0]['body'] . "\n"; +// } echo $o; killme(); } diff --git a/mod/smilies.php b/mod/smilies.php index c47f95da7..c47f95da7 100755..100644 --- a/mod/smilies.php +++ b/mod/smilies.php diff --git a/mod/starred.php b/mod/starred.php index 035b81e76..035b81e76 100755..100644 --- a/mod/starred.php +++ b/mod/starred.php diff --git a/mod/suggest.php b/mod/suggest.php index b8ca423c5..7a86d53a1 100755..100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -52,7 +52,7 @@ function suggest_content(&$a) { $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $o .= replace_macros($tpl,array( - '$url' => $rr['url'], + '$url' => zrl($rr['url']), '$name' => $rr['name'], '$photo' => $rr['photo'], '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], diff --git a/mod/tagger.php b/mod/tagger.php index 3ff5d57aa..3ff5d57aa 100755..100644 --- a/mod/tagger.php +++ b/mod/tagger.php diff --git a/mod/tagrm.php b/mod/tagrm.php index 5041145cc..5041145cc 100755..100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php diff --git a/mod/uexport.php b/mod/uexport.php index e1fb22855..e1fb22855 100755..100644 --- a/mod/uexport.php +++ b/mod/uexport.php diff --git a/mod/update_community.php b/mod/update_community.php index 3dcbce6b1..3dcbce6b1 100755..100644 --- a/mod/update_community.php +++ b/mod/update_community.php diff --git a/mod/update_network.php b/mod/update_network.php index 36de0722a..36de0722a 100755..100644 --- a/mod/update_network.php +++ b/mod/update_network.php diff --git a/mod/update_notes.php b/mod/update_notes.php index 90cc5bc69..90cc5bc69 100755..100644 --- a/mod/update_notes.php +++ b/mod/update_notes.php diff --git a/mod/update_profile.php b/mod/update_profile.php index c4884b30f..c4884b30f 100755..100644 --- a/mod/update_profile.php +++ b/mod/update_profile.php diff --git a/mod/view.php b/mod/view.php new file mode 100644 index 000000000..15b3733b3 --- /dev/null +++ b/mod/view.php @@ -0,0 +1,17 @@ +<?php +/** + * load view/theme/$current_theme/style.php with friendica contex + */ + +function view_init($a){ + header("Content-Type: text/css"); + + if ($a->argc == 4){ + $theme = $a->argv[2]; + $THEMEPATH = "view/theme/$theme"; + if(file_exists("view/theme/$theme/style.php")) + require_once("view/theme/$theme/style.php"); + } + + killme(); +} diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 6b66f60d7..e7d26b73e 100755..100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -54,6 +54,8 @@ function viewcontacts_content(&$a) { if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) $url = 'redir/' . $rr['id']; + else + $url = zrl($url); $contacts[] = array( 'id' => $rr['id'], diff --git a/mod/viewsrc.php b/mod/viewsrc.php index 94847ec7b..3fa4eaed5 100755..100644 --- 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; } diff --git a/mod/wall_attach.php b/mod/wall_attach.php index ecf475291..ecf475291 100755..100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 64f174a78..64f174a78 100755..100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php diff --git a/mod/wallmessage.php b/mod/wallmessage.php new file mode 100644 index 000000000..1a4882b64 --- /dev/null +++ b/mod/wallmessage.php @@ -0,0 +1,149 @@ +<?php + +require_once('include/message.php'); + +function wallmessage_post(&$a) { + + $replyto = get_my_url(); + if(! $replyto) { + notice( t('Permission denied.') . EOL); + return; + } + + $subject = ((x($_REQUEST,'subject')) ? notags(trim($_REQUEST['subject'])) : ''); + $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); + + $recipient = (($a->argc > 1) ? notags($a->argv[1]) : ''); + if((! $recipient) || (! $body)) { + return; + } + + $r = q("select * from user where nickname = '%s' limit 1", + dbesc($recipient) + ); + + if(! count($r)) { + logger('wallmessage: no recipient'); + return; + } + + $user = $r[0]; + + if(! intval($user['unkmail'])) { + notice( t('Permission denied.') . EOL); + return; + } + + $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1", + intval($user['uid']) + ); + + if($r[0]['total'] > $user['cntunkmail']) { + notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']))); + return; + } + + // Work around doubled linefeeds in Tinymce 3.5b2 +dbg(1); + $body = str_replace("\r\n","\n",$body); + $body = str_replace("\n\n","\n",$body); + + + $ret = send_wallmessage($user, $body, $subject, $replyto); + + switch($ret){ + case -1: + notice( t('No recipient selected.') . EOL ); + break; + case -2: + notice( t('Unable to check your home location.') . EOL ); + break; + case -3: + notice( t('Message could not be sent.') . EOL ); + break; + case -4: + notice( t('Message collection failure.') . EOL ); + break; + default: + info( t('Message sent.') . EOL ); + } +dbg(0); +// goaway($a->get_baseurl() . '/profile/' . $user['nickname']); + +} + + +function wallmessage_content(&$a) { + + if(! get_my_url()) { + notice( t('Permission denied.') . EOL); + return; + } + + $recipient = (($a->argc > 1) ? $a->argv[1] : ''); + + if(! $recipient) { + notice( t('No recipient.') . EOL); + return; + } + + $r = q("select * from user where nickname = '%s' limit 1", + dbesc($recipient) + ); + + if(! count($r)) { + notice( t('No recipient.') . EOL); + logger('wallmessage: no recipient'); + return; + } + + $user = $r[0]; + + if(! intval($user['unkmail'])) { + notice( t('Permission denied.') . EOL); + return; + } + + $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1", + intval($user['uid']) + ); + + if($r[0]['total'] > $user['cntunkmail']) { + notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']))); + return; + } + + + + $tpl = get_markup_template('wallmsg-header.tpl'); + + $a->page['htmlhead'] .= replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(true), + '$editselect' => '/(profile-jot-text|prvmail-text)/', + '$nickname' => $user['nickname'], + '$linkurl' => t('Please enter a link URL:') + )); + + + + $tpl = get_markup_template('wallmessage.tpl'); + $o .= replace_macros($tpl,array( + '$header' => t('Send Private Message'), + '$subheader' => sprintf( t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.'), $user['username']), + '$to' => t('To:'), + '$subject' => t('Subject:'), + '$recipname' => $user['username'], + '$nickname' => $user['nickname'], + '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''), + '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''), + '$readonly' => '', + '$yourmessage' => t('Your message:'), + '$select' => $select, + '$parent' => '', + '$upload' => t('Upload photo'), + '$insert' => t('Insert web link'), + '$wait' => t('Please wait') + )); + + return $o; + } diff --git a/mod/webfinger.php b/mod/webfinger.php index 74bd2c954..74bd2c954 100755..100644 --- a/mod/webfinger.php +++ b/mod/webfinger.php diff --git a/mod/xrd.php b/mod/xrd.php index 2fa6bcd99..2fa6bcd99 100755..100644 --- a/mod/xrd.php +++ b/mod/xrd.php |