aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_request.php32
-rw-r--r--mod/directory.php6
-rw-r--r--mod/group.php5
-rw-r--r--mod/install.php2
-rw-r--r--mod/profiles.php3
-rw-r--r--mod/register.php13
-rw-r--r--mod/settings.php32
-rw-r--r--mod/xrd.php4
8 files changed, 77 insertions, 20 deletions
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index 93ef4097b..844fbbf6d 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -544,12 +544,40 @@ function dfrn_request_content(&$a) {
return; // NOTREACHED
}
else {
- $myaddr = ((x($_GET,'address')) ? urldecode($_GET['address']) : '');
- // Normal web request. Display our user's introduction form.
+
+ /**
+ * Normal web request. Display our user's introduction form.
+ */
+
+ /**
+ * Try to auto-fill the profile address
+ */
+
+ if(local_user()) {
+ if(strlen($a->path)) {
+ $myaddr = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
+ }
+ else {
+ $myaddr = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3 );
+ }
+ }
+ else {
+ $myaddr = ((x($_GET,'address')) ? urldecode($_GET['address']) : '');
+ }
+
+ /**
+ *
+ * The auto_request form only has the profile address
+ * because nobody is going to read the comments and
+ * it doesn't matter if they know you or not.
+ *
+ */
+
if($a->profile['page-flags'] == PAGE_NORMAL)
$tpl = load_view_file('view/dfrn_request.tpl');
else
$tpl = load_view_file('view/auto_request.tpl');
+
$o .= replace_macros($tpl,array(
'$header' => t('Friend/Connection Request'),
'$pls_answer' => t('Please answer the following:'),
diff --git a/mod/directory.php b/mod/directory.php
index 062aae516..b0cee76cb 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -39,14 +39,16 @@ function directory_content(&$a) {
$search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
+ $publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
- $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ");
+
+ $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
if(count($r))
$a->set_pager_total($r[0]['total']);
- $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ORDER BY `name` ASC LIMIT %d , %d ",
+ $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ORDER BY `name` ASC LIMIT %d , %d ",
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
diff --git a/mod/group.php b/mod/group.php
index 01875d01f..fcdc6a758 100644
--- a/mod/group.php
+++ b/mod/group.php
@@ -56,13 +56,14 @@ function group_post(&$a) {
notice( t('Group name changed.') . EOL );
}
$members = $_POST['group_members_select'];
- array_walk($members,'validate_members');
+ if(is_array($members))
+ array_walk($members,'validate_members');
$r = q("DELETE FROM `group_member` WHERE `gid` = %d AND `uid` = %d",
intval($a->argv[1]),
intval(local_user())
);
$result = true;
- if(count($members)) {
+ if(is_array($members) && count($members)) {
foreach($members as $member) {
$r = q("INSERT INTO `group_member` ( `uid`, `gid`, `contact-id`)
VALUES ( %d, %d, %d )",
diff --git a/mod/install.php b/mod/install.php
index 643f9a55c..dc91f848e 100644
--- a/mod/install.php
+++ b/mod/install.php
@@ -19,7 +19,7 @@ function install_post(&$a) {
if(mysqli_connect_errno()) {
$db = new dba($dbhost, $dbuser, $dbpass, '', true);
- if(! mysql_connect_errno()) {
+ if(! mysqli_connect_errno()) {
$r = q("CREATE DATABASE '%s'",
dbesc($dbdata)
);
diff --git a/mod/profiles.php b/mod/profiles.php
index e99e0f288..1c75dc0eb 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -265,13 +265,14 @@ function profiles_content(&$a) {
dbesc($name),
dbesc($r1[0]['name']),
dbesc($r1[0]['photo']),
- dbesc($ra[0]['thumb'])
+ dbesc($r1[0]['thumb'])
);
$r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
intval(local_user()),
dbesc($name)
);
+
notice( t('New profile created.') . EOL);
if(count($r3) == 1)
goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']);
diff --git a/mod/register.php b/mod/register.php
index bd169fbbb..68c7297c9 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -123,7 +123,20 @@ function register_post(&$a) {
$pkey = openssl_pkey_get_details($res);
$pubkey = $pkey["key"];
+ /**
+ *
+ * Create another keypair for signing/verifying
+ * salmon protocol messages. We have to use a slightly
+ * less robust key because this won't be using openssl
+ * but the phpseclib. Since it is PHP interpreted code
+ * it is not nearly as efficient, and the larger keys
+ * will take several minutes each to process.
+ *
+ */
+
$sres=openssl_pkey_new(array(
+ 'digest_alg' => 'sha1',
+ 'private_key_bits' => 512,
'encrypt_key' => false ));
// Get private key
diff --git a/mod/settings.php b/mod/settings.php
index 273e8baa8..0f01807a2 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -117,11 +117,16 @@ function settings_post(&$a) {
// If openid has changed or if there's an openid but no openidserver, try and discover it.
if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
- logger('updating openidserver');
- require_once('library/openid.php');
- $open_id_obj = new LightOpenID;
- $open_id_obj->identity = $openid;
- $openidserver = $open_id_obj->discover($open_id_obj->identity);
+ $tmp_str = $openid;
+ if(strlen($tmp_str) && validate_url($tmp_str)) {
+ logger('updating openidserver');
+ require_once('library/openid.php');
+ $open_id_obj = new LightOpenID;
+ $open_id_obj->identity = $openid;
+ $openidserver = $open_id_obj->discover($open_id_obj->identity);
+ }
+ else
+ $openidserver = '';
}
$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, `openidserver` = '%s' WHERE `uid` = %d LIMIT 1",
@@ -242,13 +247,16 @@ function settings_content(&$a) {
}
-
-
- $opt_tpl = load_view_file("view/profile-in-directory.tpl");
- $profile_in_dir = replace_macros($opt_tpl,array(
- '$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""),
- '$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "")
- ));
+ if(get_config('system','publish_all')) {
+ $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
+ }
+ else {
+ $opt_tpl = load_view_file("view/profile-in-directory.tpl");
+ $profile_in_dir = replace_macros($opt_tpl,array(
+ '$yes_selected' => (($profile['publish']) ? " checked=\"checked\" " : ""),
+ '$no_selected' => (($profile['publish'] == 0) ? " checked=\"checked\" " : "")
+ ));
+ }
if(strlen(get_config('system','directory_submit_url'))) {
$opt_tpl = load_view_file("view/profile-in-netdir.tpl");
diff --git a/mod/xrd.php b/mod/xrd.php
index 0b4bd0d1e..a0ecbaea8 100644
--- a/mod/xrd.php
+++ b/mod/xrd.php
@@ -39,6 +39,10 @@ function xrd_content(&$a) {
'$modexp' => 'data:application/magic-public-key,' . $salmon_key
));
+
+ $arr = array('user' => $r[0], 'xml' => $o);
+ call_hooks('personal_xrd', $arr);
+
echo $o;
killme();