1
0
Fork 0

Merge pull request #2099 from rabuzarus/2611_new_user_addr

generate addr for new registered users
This commit is contained in:
Michael Vogel 2015-11-27 21:35:46 +01:00
commit 3b6d3d1ade
15 changed files with 89 additions and 68 deletions

View file

@ -62,7 +62,7 @@ if(! function_exists('profile_load')) {
if($profile) { if($profile) {
$profile_int = intval($profile); $profile_int = intval($profile);
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `contact`.`addr` AS faddr, `user`.* FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d AND `contact`.`self` = 1 LIMIT 1", WHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d AND `contact`.`self` = 1 LIMIT 1",
dbesc($nickname), dbesc($nickname),
@ -70,7 +70,7 @@ if(! function_exists('profile_load')) {
); );
} }
if((!$r) && (!count($r))) { if((!$r) && (!count($r))) {
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `contact`.`addr` AS faddr, `user`.* FROM `profile`
INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 AND `contact`.`self` = 1 LIMIT 1", WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 AND `contact`.`self` = 1 LIMIT 1",
dbesc($nickname) dbesc($nickname)

View file

@ -48,7 +48,7 @@ function create_user($arr) {
$result['message'] .= t('An invitation is required.') . EOL; $result['message'] .= t('An invitation is required.') . EOL;
return $result; return $result;
} }
$r = q("select * from register where `hash` = '%s' limit 1", dbesc($invite_id)); $r = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1", dbesc($invite_id));
if(! results($r)) { if(! results($r)) {
$result['message'] .= t('Invitation could not be verified.') . EOL; $result['message'] .= t('Invitation could not be verified.') . EOL;
return $result; return $result;
@ -66,7 +66,7 @@ function create_user($arr) {
require_once('library/openid.php'); require_once('library/openid.php');
$openid = new LightOpenID; $openid = new LightOpenID;
$openid->identity = $openid_url; $openid->identity = $openid_url;
$openid->returnUrl = $a->get_baseurl() . '/openid'; $openid->returnUrl = z_root() . '/openid';
$openid->required = array('namePerson/friendly', 'contact/email', 'namePerson'); $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson');
$openid->optional = array('namePerson/first','media/image/aspect11','media/image/default'); $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default');
try { try {
@ -138,6 +138,7 @@ function create_user($arr) {
if(! preg_match("/^[a-z0-9][a-z0-9\_]*$/",$nickname)) if(! preg_match("/^[a-z0-9][a-z0-9\_]*$/",$nickname))
$result['message'] .= t('Your "nickname" can only contain "a-z", "0-9" and "_".') . EOL; $result['message'] .= t('Your "nickname" can only contain "a-z", "0-9" and "_".') . EOL;
$r = q("SELECT `uid` FROM `user` $r = q("SELECT `uid` FROM `user`
WHERE `nickname` = '%s' LIMIT 1", WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
@ -255,8 +256,8 @@ function create_user($arr) {
t('default'), t('default'),
1, 1,
dbesc($username), dbesc($username),
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}.jpg"), dbesc(z_root() . "/photo/profile/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"), dbesc(z_root() . "/photo/avatar/{$newuid}.jpg"),
intval($publish), intval($publish),
intval($netpublish) intval($netpublish)
@ -269,22 +270,23 @@ function create_user($arr) {
return $result; return $result;
} }
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`, $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`,
`request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` ) `addr`, `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` )
VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ", VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ",
intval($newuid), intval($newuid),
datetime_convert(), datetime_convert(),
dbesc($username), dbesc($username),
dbesc($nickname), dbesc($nickname),
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}.jpg"), dbesc(z_root() . "/photo/profile/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}.jpg"), dbesc(z_root() . "/photo/avatar/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/photo/micro/{$newuid}.jpg"), dbesc(z_root() . "/photo/micro/{$newuid}.jpg"),
dbesc($a->get_baseurl() . "/profile/$nickname"), dbesc(z_root() . "/profile/$nickname"),
dbesc(normalise_link($a->get_baseurl() . "/profile/$nickname")), dbesc(normalise_link(z_root() . "/profile/$nickname")),
dbesc($a->get_baseurl() . "/dfrn_request/$nickname"), dbesc($nickname . '@' . substr(z_root(), strpos(z_root(),'://') + 3 )),
dbesc($a->get_baseurl() . "/dfrn_notify/$nickname"), dbesc(z_root() . "/dfrn_request/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_poll/$nickname"), dbesc(z_root() . "/dfrn_notify/$nickname"),
dbesc($a->get_baseurl() . "/dfrn_confirm/$nickname"), dbesc(z_root() . "/dfrn_poll/$nickname"),
dbesc($a->get_baseurl() . "/poco/$nickname"), dbesc(z_root() . "/dfrn_confirm/$nickname"),
dbesc(z_root() . "/poco/$nickname"),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()) dbesc(datetime_convert())
@ -296,21 +298,21 @@ function create_user($arr) {
require_once('include/group.php'); require_once('include/group.php');
group_add($newuid, t('Friends')); group_add($newuid, t('Friends'));
$r = q("SELECT id FROM `group` WHERE uid = %d AND name = '%s'", $r = q("SELECT `id` FROM `group` WHERE `uid` = %d AND `name` = '%s'",
intval($newuid), intval($newuid),
dbesc(t('Friends')) dbesc(t('Friends'))
); );
if($r && count($r)) { if($r && count($r)) {
$def_gid = $r[0]['id']; $def_gid = $r[0]['id'];
q("UPDATE user SET def_gid = %d WHERE uid = %d", q("UPDATE `user` SET `def_gid` = %d WHERE `uid` = %d",
intval($r[0]['id']), intval($r[0]['id']),
intval($newuid) intval($newuid)
); );
} }
if(get_config('system', 'newuser_private') && $def_gid) { if(get_config('system', 'newuser_private') && $def_gid) {
q("UPDATE user SET allow_gid = '%s' WHERE uid = %d", q("UPDATE `user` SET `allow_gid` = '%s' WHERE `uid` = %d",
dbesc("<" . $def_gid . ">"), dbesc("<" . $def_gid . ">"),
intval($newuid) intval($newuid)
); );

View file

@ -3,7 +3,7 @@
<div class="fn label p-name">{{$profile.name}}</div> <div class="fn label p-name">{{$profile.name}}</div>
{{if $profile.faddr}}<div class="p-faddr">{{$profile.faddr}}</div>{{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}

View file

@ -2511,7 +2511,8 @@ aside input[type='text'] {
font-weight: bold; font-weight: bold;
} }
.vcard .title { .vcard .title,
.vcard .p-faddr {
margin-bottom: 5px; margin-bottom: 5px;
margin-left: 12px; margin-left: 12px;
} }

View file

@ -3,7 +3,7 @@
<div class="fn label">{{$profile.name}}</div> <div class="fn label">{{$profile.name}}</div>
{{if $profile.faddr}}<div class="p-faddr">{{$profile.faddr}}</div>{{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div>

View file

@ -3105,7 +3105,8 @@ aside input[type='text'] {
font-weight: bold; font-weight: bold;
} }
.vcard .title { .vcard .title,
.vcard .p-faddr {
margin-bottom: 5px; margin-bottom: 5px;
margin-left: 12px; margin-left: 12px;
} }

View file

@ -3,7 +3,7 @@
<div class="fn label">{{$profile.name}}</div> <div class="fn label">{{$profile.name}}</div>
{{if $profile.faddr}}<div class="p-faddr">{{$profile.faddr}}</div>{{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div>

View file

@ -2890,7 +2890,8 @@ aside input[type='text'] {
font-weight: bold; font-weight: bold;
} }
.vcard .title { .vcard .title,
.vcard .p-faddr {
margin-bottom: 5px; margin-bottom: 5px;
margin-left: 12px; margin-left: 12px;
} }

View file

@ -3,7 +3,7 @@
<div class="fn label">{{$profile.name}}</div> <div class="fn label">{{$profile.name}}</div>
{{if $profile.faddr}}<div class="p-faddr">{{$profile.faddr}}</div>{{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}"></div>

View file

@ -463,7 +463,7 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
blockquote { blockquote {
background: #FFFFFF; background: #ffffff;
padding: 1em; padding: 1em;
margin-left: 1em; margin-left: 1em;
border-left: 1em solid #e6e6e6; border-left: 1em solid #e6e6e6;
@ -810,6 +810,9 @@ aside .vcard .fn {
aside .vcard .title { aside .vcard .title {
margin-bottom: 5px; margin-bottom: 5px;
} }
aside .vcard .p-faddr {
margin-bottom: 5px;
}
aside .vcard dl { aside .vcard dl {
height: auto; height: auto;
overflow: auto; overflow: auto;

View file

@ -463,7 +463,7 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
blockquote { blockquote {
background: #FFFFFF; background: #ffffff;
padding: 1em; padding: 1em;
margin-left: 1em; margin-left: 1em;
border-left: 1em solid #e6e6e6; border-left: 1em solid #e6e6e6;
@ -810,6 +810,9 @@ aside .vcard .fn {
aside .vcard .title { aside .vcard .title {
margin-bottom: 5px; margin-bottom: 5px;
} }
aside .vcard .p-faddr {
margin-bottom: 5px;
}
aside .vcard dl { aside .vcard dl {
height: auto; height: auto;
overflow: auto; overflow: auto;

View file

@ -420,7 +420,7 @@
body { body {
font-family: Liberation Sans, helvetica, arial, clean, sans-serif; font-family: Liberation Sans, helvetica, arial, clean, sans-serif;
font-size: 11px; font-size: 11px;
background-color: #F6ECF9; background-color: #f6ecf9;
color: #2d2d2d; color: #2d2d2d;
margin: 50px 0px 0px 0px; margin: 50px 0px 0px 0px;
display: table; display: table;
@ -463,7 +463,7 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
blockquote { blockquote {
background: #FFFFFF; background: #ffffff;
padding: 1em; padding: 1em;
margin-left: 1em; margin-left: 1em;
border-left: 1em solid #e6e6e6; border-left: 1em solid #e6e6e6;
@ -810,6 +810,9 @@ aside .vcard .fn {
aside .vcard .title { aside .vcard .title {
margin-bottom: 5px; margin-bottom: 5px;
} }
aside .vcard .p-faddr {
margin-bottom: 5px;
}
aside .vcard dl { aside .vcard dl {
height: auto; height: auto;
overflow: auto; overflow: auto;
@ -1704,7 +1707,7 @@ span[id^="showmore-wrap"] {
height: 20px; height: 20px;
width: 500px; width: 500px;
font-weight: bold; font-weight: bold;
border: 1px solid #F6ECF9; border: 1px solid #f6ecf9;
} }
#jot #jot-title:-webkit-input-placeholder { #jot #jot-title:-webkit-input-placeholder {
font-weight: normal; font-weight: normal;
@ -1731,7 +1734,7 @@ span[id^="showmore-wrap"] {
margin: 0px; margin: 0px;
height: 20px; height: 20px;
width: 200px; width: 200px;
border: 1px solid #F6ECF9; border: 1px solid #f6ecf9;
} }
#jot #jot-category:hover { #jot #jot-category:hover {
border: 1px solid #999999; border: 1px solid #999999;

View file

@ -317,6 +317,7 @@ aside {
.vcard { .vcard {
.fn { font-size: 16px; font-weight: bold; margin-bottom: 5px; } .fn { font-size: 16px; font-weight: bold; margin-bottom: 5px; }
.title { margin-bottom: 5px; } .title { margin-bottom: 5px; }
.p-faddr{ margin-bottom: 5px; }
dl { height: auto; overflow: auto; } dl { height: auto; overflow: auto; }
dt {float: left; margin-left: 0px; width: 35%; text-align: right; color: @VCardLabelColor; } dt {float: left; margin-left: 0px; width: 35%; text-align: right; color: @VCardLabelColor; }
dd {float: left; margin-left: 4px; width: 60%;} dd {float: left; margin-left: 4px; width: 60%;}

View file

@ -26,6 +26,7 @@
{{/if}} {{/if}}
</div> </div>
{{if $profile.faddr}}<div class="p-faddr">{{$profile.faddr}}</div>{{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}" /></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="{{$profile.photo}}?rev={{$profile.picdate}}" alt="{{$profile.name}}" /></div>
@ -52,9 +53,11 @@
{{if $marital}}<dl class="marital"><dt class="marital-label"><span class="heart">&hearts;</span>{{$marital}}</dt><dd class="marital-text">{{$profile.marital}}</dd></dl>{{/if}} {{if $marital}}<dl class="marital"><dt class="marital-label"><span class="heart">&hearts;</span>{{$marital}}</dt><dd class="marital-text">{{$profile.marital}}</dd></dl>{{/if}}
{{if $homepage}}<dl class="homepage"><dt {{if $homepage}}
class="homepage-label">{{$homepage}}</dt><dd class="homepage-url"><a <dl class="homepage"><dt class="homepage-label">{{$homepage}}</dt>
href="{{$profile.homepage}}" target="external-link">{{$profile.homepage}}</a></dd></dl>{{/if}} <dd class="homepage-url"><a href="{{$profile.homepage}}" target="external-link">{{$profile.homepage}}</a></dd>
</dl>
{{/if}}
{{include file="diaspora_vcard.tpl"}} {{include file="diaspora_vcard.tpl"}}

View file

@ -13,6 +13,8 @@
{{/if}} {{/if}}
</div> </div>
{{if $profile.faddr}}<div class="p-faddr">{{$profile.faddr}}</div>{{/if}}
{{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}} {{if $pdesc}}<div class="title">{{$profile.pdesc}}</div>{{/if}}
{{if $profile.picdate}} {{if $profile.picdate}}
@ -20,6 +22,7 @@
{{else}} {{else}}
<div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" src="{{$profile.photo}}" alt="{{$profile.name}}"></a></div> <div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" src="{{$profile.photo}}" alt="{{$profile.name}}"></a></div>
{{/if}} {{/if}}
{{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name}}</dd></dl>{{/if}} {{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name}}</dd></dl>{{/if}}
{{if $location}} {{if $location}}
<dl class="location"><dt class="location-label">{{$location}}</dt> <dl class="location"><dt class="location-label">{{$location}}</dt>