aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php6
-rw-r--r--mod/community.php8
-rw-r--r--mod/contacts.php12
-rw-r--r--mod/dfrn_poll.php6
-rw-r--r--mod/dfrn_request.php65
-rw-r--r--mod/item.php7
-rw-r--r--mod/message.php3
-rw-r--r--mod/newmember.php4
-rw-r--r--mod/profile.php2
-rw-r--r--mod/profiles.php38
-rw-r--r--mod/randprof.php10
-rw-r--r--mod/register.php16
-rw-r--r--mod/wall_attach.php5
-rw-r--r--mod/wall_upload.php8
14 files changed, 130 insertions, 60 deletions
diff --git a/mod/admin.php b/mod/admin.php
index a395027c1..961002786 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -174,7 +174,6 @@ function admin_page_site_post(&$a){
return;
}
-
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
@@ -194,7 +193,6 @@ function admin_page_site_post(&$a){
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
$no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
$no_openid = !((x($_POST,'no_openid')) ? True : False);
- $no_gravatar = !((x($_POST,'no_gravatar')) ? True : False);
$no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
$no_utf = !((x($_POST,'no_utf')) ? True : False);
$no_community_page = !((x($_POST,'no_community_page')) ? True : False);
@@ -204,7 +202,7 @@ function admin_page_site_post(&$a){
$proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
- $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
+ $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
$ssl_policy = ((x($_POST,'ssl_policy')) ? intval($_POST['ssl_policy']) : 0);
@@ -283,7 +281,6 @@ function admin_page_site_post(&$a){
set_config('system','directory_search_url', $global_search_url);
set_config('system','block_extended_register', $no_multi_reg);
set_config('system','no_openid', $no_openid);
- set_config('system','no_gravatar', $no_gravatar);
set_config('system','no_regfullname', $no_regfullname);
set_config('system','no_community_page', $no_community_page);
set_config('system','no_utf', $no_utf);
@@ -380,7 +377,6 @@ function admin_page_site(&$a) {
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
'$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),
- '$no_gravatar' => array('no_gravatar', t("Gravatar support"), !get_config('system','no_gravatar'), t("Search new user's photo on Gravatar.")),
'$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")),
'$no_utf' => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','no_utf'), t("Use PHP UTF8 regular expressions")),
'$no_community_page' => array('no_community_page', t("Show Community Page"), !get_config('system','no_community_page'), t("Display a Community page showing all recent public postings on this site.")),
diff --git a/mod/community.php b/mod/community.php
index f8cc3305b..bfe5a3089 100644
--- a/mod/community.php
+++ b/mod/community.php
@@ -45,13 +45,13 @@ function community_content(&$a, $update = 0) {
// OR your own posts if you are a logged in member
- $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 `item`.`wall` = 1 AND `user`.`hidewall` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 "
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 group by `item`.`uri` "
);
if(count($r))
@@ -62,7 +62,7 @@ function community_content(&$a, $update = 0) {
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`,
@@ -73,7 +73,7 @@ function community_content(&$a, $update = 0) {
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 group by `item`.`uri`
ORDER BY `received` DESC LIMIT %d, %d ",
intval($a->pager['start']),
intval($a->pager['itemspage'])
diff --git a/mod/contacts.php b/mod/contacts.php
index 8aa51d00a..9d29d4bd1 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -85,7 +85,7 @@ function contacts_post(&$a) {
if($priority > 5 || $priority < 0)
$priority = 0;
- $info = escape_tags(trim($_POST['info']));
+ $info = fix_mce_lf(escape_tags(trim($_POST['info'])));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
`hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
@@ -232,8 +232,14 @@ function contacts_content(&$a) {
$contact_id = $a->data['contact']['id'];
$contact = $a->data['contact'];
- $tpl = get_markup_template('contact_head.tpl');
- $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
+ $editselect = 'exact';
+ if(intval(get_pconfig(local_user(),'system','plaintext')))
+ $editselect = 'none';
+
+ $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
+ '$baseurl' => $a->get_baseurl(true),
+ '$editselect' => $editselect,
+ ));
require_once('include/contact_selectors.php');
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index 5c2788983..436727a78 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -428,11 +428,13 @@ function dfrn_poll_content(&$a) {
break; // NOTREACHED
}
+ $nickname = $a->argv[1];
+
$r = q("SELECT `contact`.*, `user`.`username`, `user`.`nickname`
FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `user`.`nickname` = '%s' $sql_extra LIMIT 1",
- dbesc($a->argv[1])
+ dbesc($nickname)
);
if(count($r)) {
@@ -482,7 +484,7 @@ function dfrn_poll_content(&$a) {
));
}
- $profile = $r[0]['nickname'];
+ $profile = ((count($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
switch($destination_url) {
case 'profile':
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index 5881b7b51..77a3124f7 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -180,7 +180,7 @@ function dfrn_request_post(&$a) {
// (ignore reply, nothing we can do it failed)
- goaway($dfrn_url);
+ goaway(zrl($dfrn_url));
return; // NOTREACHED
}
@@ -261,7 +261,7 @@ function dfrn_request_post(&$a) {
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` != '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
- dbesc(NETWORK_MAIL)
+ dbesc(NETWORK_MAIL2)
);
if(count($r)) {
foreach($r as $rr) {
@@ -286,7 +286,7 @@ function dfrn_request_post(&$a) {
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` = '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
- dbesc(NETWORK_MAIL)
+ dbesc(NETWORK_MAIL2)
);
if(count($r)) {
foreach($r as $rr) {
@@ -301,6 +301,8 @@ function dfrn_request_post(&$a) {
}
}
+ $email_follow = (x($_POST,'email_follow') ? intval($_POST['email_follow']) : 0);
+ $real_name = (x($_POST,'realname') ? notags(trim($_POST['realname'])) : '');
$url = trim($_POST['dfrn_url']);
if(! strlen($url)) {
@@ -308,17 +310,60 @@ function dfrn_request_post(&$a) {
return;
}
- // Canonicalise email-style profile locator
-
$hcard = '';
- $url = webfinger_dfrn($url,$hcard);
- if(substr($url,0,5) === 'stat:') {
- $network = NETWORK_OSTATUS;
- $url = substr($url,5);
+ if($email_follow) {
+
+ if(! strpos($url,'@')) {
+ notice( t('Invalid email address.') . EOL);
+ return;
+ }
+
+ $addr = $url;
+ $name = ($realname) ? $realname : $addr;
+ $nick = substr($addr,0,strpos($addr,'@'));
+ $url = 'http://' . substr($addr,strpos($addr,'@') + 1);
+ $nurl = normalise_url($host);
+ $poll = 'email ' . random_string();
+ $notify = 'smtp ' . random_string();
+ $blocked = 1;
+ $pending = 1;
+ $network = NETWORK_MAIL2;
+ $rel = CONTACT_IS_FOLLOWER;
+
+ $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) {
+ $failed = false;
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+ intval($uid)
+ );
+ if(! count($r)) {
+ notice( t('This account has not been configured for email. Request failed.') . EOL);
+ return;
+ }
+ }
+
+
+
+
+
}
else {
- $network = NETWORK_DFRN;
+
+ // Canonicalise email-style profile locator
+
+ $url = webfinger_dfrn($url,$hcard);
+
+ if(substr($url,0,5) === 'stat:') {
+ $network = NETWORK_OSTATUS;
+ $url = substr($url,5);
+ }
+ else {
+ $network = NETWORK_DFRN;
+ }
}
logger('dfrn_request: url: ' . $url);
diff --git a/mod/item.php b/mod/item.php
index 72e63865b..7f0ca3fc3 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -272,8 +272,7 @@ function item_post(&$a) {
$plaintext = (local_user() ? intval(get_pconfig(local_user(),'system','plaintext')) : 0);
if((! $parent) && (! $api_source) && (! $plaintext)) {
- $body = str_replace("\r\n","\n",$body);
- $body = str_replace("\n\n","\n",$body);
+ $body = fix_mce_lf($body);
}
@@ -351,7 +350,7 @@ function item_post(&$a) {
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
if(! strlen($image_uri))
continue;
- $srch = '<' . intval($profile_uid) . '>';
+ $srch = '<' . intval($contact_record['id']) . '>';
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
AND `resource-id` = '%s' AND `uid` = %d LIMIT 1",
dbesc($srch),
@@ -447,7 +446,7 @@ function item_post(&$a) {
if(count($tags)) {
foreach($tags as $tag) {
- handle_tag($a, $body, $inform, $str_tags, $profile_uid, $tag);
+ handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag);
}
}
diff --git a/mod/message.php b/mod/message.php
index 1369fde2e..260f4bb14 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -48,8 +48,7 @@ function message_post(&$a) {
$plaintext = intval(get_pconfig(local_user(),'system','plaintext'));
if(! $plaintext) {
- $body = str_replace("\r\n","\n",$body);
- $body = str_replace("\n\n","\n",$body);
+ $body = fix_mce_lf($body);
}
$ret = send_message($recipient, $body, $subject, $replyto);
diff --git a/mod/newmember.php b/mod/newmember.php
index 683463ecb..a423d11b8 100644
--- a/mod/newmember.php
+++ b/mod/newmember.php
@@ -13,7 +13,7 @@ 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="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;
@@ -48,4 +48,4 @@ function newmember_content(&$a) {
$o .= '</div>';
return $o;
-} \ No newline at end of file
+}
diff --git a/mod/profile.php b/mod/profile.php
index 68d73fba3..51f944412 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -14,7 +14,7 @@ function profile_init(&$a) {
else {
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and verified = 1 order by rand() limit 1");
if(count($r)) {
- $which = $r[0]['nickname'];
+ goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
}
else {
notice( t('Requested profile is not available.') . EOL );
diff --git a/mod/profiles.php b/mod/profiles.php
index 7b3b6ccc1..eef58bb06 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -121,16 +121,17 @@ function profiles_post(&$a) {
$politic = notags(trim($_POST['politic']));
$religion = notags(trim($_POST['religion']));
- $about = escape_tags(trim($_POST['about']));
- $interest = escape_tags(trim($_POST['interest']));
- $contact = escape_tags(trim($_POST['contact']));
- $music = escape_tags(trim($_POST['music']));
- $book = escape_tags(trim($_POST['book']));
- $tv = escape_tags(trim($_POST['tv']));
- $film = escape_tags(trim($_POST['film']));
- $romance = escape_tags(trim($_POST['romance']));
- $work = escape_tags(trim($_POST['work']));
- $education = escape_tags(trim($_POST['education']));
+ $about = fix_mce_lf(escape_tags(trim($_POST['about'])));
+ $interest = fix_mce_lf(escape_tags(trim($_POST['interest'])));
+ $contact = fix_mce_lf(escape_tags(trim($_POST['contact'])));
+ $music = fix_mce_lf(escape_tags(trim($_POST['music'])));
+ $book = fix_mce_lf(escape_tags(trim($_POST['book'])));
+ $tv = fix_mce_lf(escape_tags(trim($_POST['tv'])));
+ $film = fix_mce_lf(escape_tags(trim($_POST['film'])));
+ $romance = fix_mce_lf(escape_tags(trim($_POST['romance'])));
+ $work = fix_mce_lf(escape_tags(trim($_POST['work'])));
+ $education = fix_mce_lf(escape_tags(trim($_POST['education'])));
+
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
$r = q("UPDATE `profile`
@@ -361,7 +362,16 @@ function profiles_content(&$a) {
require_once('include/profile_selectors.php');
- $tpl = get_markup_template('profed_head.tpl');
+
+ $editselect = 'textareas';
+ if(intval(get_pconfig(local_user(),'system','plaintext')))
+ $editselect = 'none';
+
+ $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
+ '$baseurl' => $a->get_baseurl(true),
+ '$editselect' => $editselect,
+ ));
+
$opt_tpl = get_markup_template("profile-hide-friends.tpl");
$hide_friends = replace_macros($opt_tpl,array(
@@ -372,10 +382,12 @@ function profiles_content(&$a) {
'$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "")
));
-
- $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true)));
$a->page['htmlhead'] .= "<script type=\"text/javascript\" src=\"js/country.js\" ></script>";
+
+
+
+
$f = get_config('system','birthday_input_format');
if(! $f)
$f = 'ymd';
diff --git a/mod/randprof.php b/mod/randprof.php
new file mode 100644
index 000000000..53d7425e9
--- /dev/null
+++ b/mod/randprof.php
@@ -0,0 +1,10 @@
+<?php
+
+
+function randprof_init(&$a) {
+ require_once('include/Contact.php');
+ $x = random_profile();
+ if($x)
+ goaway($x);
+ goaway($a->get_baseurl() . '/profile');
+}
diff --git a/mod/register.php b/mod/register.php
index 630c0a675..b60707d45 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -314,17 +314,13 @@ function register_post(&$a) {
}
- $use_gravatar = ((get_config('system','no_gravatar')) ? false : true);
-
- // if we have an openid photo use it.
- // otherwise unless it is disabled, use gravatar
-
- if($use_gravatar || strlen($photo)) {
+ // if we have no OpenID photo try to look up an avatar
+ if(! strlen($photo))
+ $photo = avatar_img($email);
+ // unless there is no avatar-plugin loaded
+ if(strlen($photo)) {
require_once('include/Photo.php');
-
- if(($use_gravatar) && (! strlen($photo)))
- $photo = gravatar_img($email);
$photo_failure = false;
$filename = basename($photo);
@@ -333,7 +329,7 @@ function register_post(&$a) {
if($img->is_valid()) {
$img->scaleImageSquare(175);
-
+
$hash = photo_new_resource();
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index ecf475291..bee7c29dc 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -7,7 +7,7 @@ function wall_attach_post(&$a) {
if($a->argc > 1) {
$nick = $a->argv[1];
- $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
+ $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
dbesc($nick)
);
if(! count($r))
@@ -21,6 +21,7 @@ function wall_attach_post(&$a) {
$visitor = 0;
$page_owner_uid = $r[0]['uid'];
+ $page_owner_cid = $r[0]['id'];
$page_owner_nick = $r[0]['nickname'];
$community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
@@ -73,7 +74,7 @@ function wall_attach_post(&$a) {
dbesc($filedata),
dbesc($created),
dbesc($created),
- dbesc('<' . $page_owner_uid . '>'),
+ dbesc('<' . $page_owner_cid . '>'),
dbesc(''),
dbesc(''),
dbesc('')
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index 64f174a78..f341cc9cd 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -6,7 +6,7 @@ function wall_upload_post(&$a) {
if($a->argc > 1) {
$nick = $a->argv[1];
- $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
+ $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
dbesc($nick)
);
if(! count($r))
@@ -16,10 +16,13 @@ function wall_upload_post(&$a) {
else
return;
+
+
$can_post = false;
$visitor = 0;
$page_owner_uid = $r[0]['uid'];
+ $default_cid = $r[0]['id'];
$page_owner_nick = $r[0]['nickname'];
$community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
@@ -34,6 +37,7 @@ function wall_upload_post(&$a) {
if(count($r)) {
$can_post = true;
$visitor = remote_user();
+ $default_cid = $visitor;
}
}
}
@@ -76,7 +80,7 @@ function wall_upload_post(&$a) {
$smallest = 0;
- $defperm = '<' . $page_owner_uid . '>';
+ $defperm = '<' . $default_cid . '>';
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, t('Wall Photos'), 0, 0, $defperm);