diff options
Diffstat (limited to 'mod')
-rwxr-xr-x | mod/mood.php | 142 | ||||
-rwxr-xr-x | mod/poke.php | 2 | ||||
-rw-r--r-- | mod/zentity.php | 91 |
3 files changed, 153 insertions, 82 deletions
diff --git a/mod/mood.php b/mod/mood.php new file mode 100755 index 000000000..7a793c71e --- /dev/null +++ b/mod/mood.php @@ -0,0 +1,142 @@ +<?php + +require_once('include/security.php'); +require_once('include/bbcode.php'); +require_once('include/items.php'); + + +function mood_init(&$a) { + + if(! local_user()) + return; + + $uid = local_user(); + $verb = notags(trim($_GET['verb'])); + + if(! $verb) + return; + + $verbs = get_mood_verbs(); + + if(! in_array($verb,$verbs)) + return; + + $activity = ACTIVITY_MOOD . '#' . urlencode($verb); + + $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : 0); + + + logger('mood: verb ' . $verb, LOGGER_DEBUG); + + + if($parent) { + $r = q("select uri, private, allow_cid, allow_gid, deny_cid, deny_gid + from item where id = %d and parent = %d and uid = %d limit 1", + intval($parent), + intval($parent), + intval($uid) + ); + if(count($r)) { + $parent_uri = $r[0]['uri']; + $private = $r[0]['private']; + $allow_cid = $r[0]['allow_cid']; + $allow_gid = $r[0]['allow_gid']; + $deny_cid = $r[0]['deny_cid']; + $deny_gid = $r[0]['deny_gid']; + } + } + else { + + $private = 0; + + $allow_cid = $a->user['allow_cid']; + $allow_gid = $a->user['allow_gid']; + $deny_cid = $a->user['deny_cid']; + $deny_gid = $a->user['deny_gid']; + } + + $poster = $a->contact; + + $uri = item_new_uri($a->get_hostname(),$uid); + + $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]); + + $arr = array(); + + $arr['uid'] = $uid; + $arr['uri'] = $uri; + $arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri); + $arr['type'] = 'activity'; + $arr['wall'] = 1; + $arr['contact-id'] = $poster['id']; + $arr['owner-name'] = $poster['name']; + $arr['owner-link'] = $poster['url']; + $arr['owner-avatar'] = $poster['thumb']; + $arr['author-name'] = $poster['name']; + $arr['author-link'] = $poster['url']; + $arr['author-avatar'] = $poster['thumb']; + $arr['title'] = ''; + $arr['allow_cid'] = $allow_cid; + $arr['allow_gid'] = $allow_gid; + $arr['deny_cid'] = $deny_cid; + $arr['deny_gid'] = $deny_gid; + $arr['last-child'] = 1; + $arr['visible'] = 1; + $arr['verb'] = $activity; + $arr['private'] = $private; + + $arr['origin'] = 1; + $arr['body'] = $action; + + $item_id = item_store($arr); + if($item_id) { + q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", + dbesc($a->get_baseurl() . '/display/' . $poster['nickname'] . '/' . $item_id), + intval($uid), + intval($item_id) + ); + proc_run('php',"include/notifier.php","tag","$item_id"); + } + + + call_hooks('post_local_end', $arr); + + proc_run('php',"include/notifier.php","like","$post_id"); + + return; +} + + + +function mood_content(&$a) { + + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return; + } + + $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0'); + + + + $verbs = get_mood_verbs(); + + $shortlist = array(); + foreach($verbs as $k => $v) + if($v !== 'NOTRANSLATION') + $shortlist[] = array($k,$v); + + + $tpl = get_markup_template('mood_content.tpl'); + + $o = replace_macros($tpl,array( + '$title' => t('Mood'), + '$desc' => t('Set your current mood and tell your friends'), + '$verbs' => $shortlist, + '$parent' => $parent, + '$submit' => t('Submit'), + )); + + return $o; + +}
\ No newline at end of file diff --git a/mod/poke.php b/mod/poke.php index bb062308f..a4ccc517a 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -76,7 +76,7 @@ function poke_init(&$a) { $poster = $a->contact; - $uri = item_new_uri($a->get_hostname(),$owner_uid); + $uri = item_new_uri($a->get_hostname(),$uid); $arr = array(); diff --git a/mod/zentity.php b/mod/zentity.php index 011ae8e79..794ac0ecb 100644 --- a/mod/zentity.php +++ b/mod/zentity.php @@ -35,7 +35,7 @@ function zentity_init(&$a) { if($cmd === 'checkaddr.json') { require_once('library/urlify/URLify.php'); $result = array('error' => false, 'message' => ''); - $n = trim($_REQUEST['addr']); + $n = trim($_REQUEST['nick']); $x = strtolower(URLify::transliterate($n)); @@ -56,71 +56,6 @@ function zentity_init(&$a) { } - - -// print_r($test); - -// if(! allowed_email($email)) -// $result['message'] = t('Your email domain is not among those allowed on this site'); -// if((! valid_email($email)) || (! validate_email($email))) -// $result['message'] .= t('Not a valid email address') . EOL; -// if($result['message']) -// $result['error'] = true; - -// header('content-type: application/json'); -// echo json_encode($result); -// killme(); - - - $pw1 = t("Password too short"); - $pw2 = t("Passwords do not match"); - - $a->page['htmlhead'] .= <<< EOT -<script> - function zFormError(elm,x) { - if(x) { - $(elm).addClass("zform-error"); - $(elm).removeClass("zform-ok"); - } - else { - $(elm).addClass("zform-ok"); - $(elm).removeClass("zform-error"); - } - } - $(document).ready(function() { - $("#zregister-email").blur(function() { - var zreg_email = $("#zregister-email").val(); - $.get("zregister/email_check.json?f=&email=" + encodeURIComponent(zreg_email),function(data) { - $("#zregister-email-feedback").html(data.message); - zFormError("#zregister-email-feedback",data.error); - }); - }); - $("#zregister-password").blur(function() { - if(($("#zregister-password").val()).length < 6 ) { - $("#zregister-password-feedback").html("$pw1"); - zFormError("#zregister-password-feedback",true); - } - else { - $("#zregister-password-feedback").html(""); - zFormError("#zregister-password-feedback",false); - } - }); - $("#zregister-password2").blur(function() { - if($("#zregister-password").val() != $("#zregister-password2").val()) { - $("#zregister-password2-feedback").html("$pw2"); - zFormError("#zregister-password2-feedback",true); - } - else { - $("#zregister-password2-feedback").html(""); - zFormError("#zregister-password2-feedback",false); - } - }); - }); - -</script> - -EOT; - } @@ -309,7 +244,7 @@ function zentity_content(&$a) { if(get_config('system','no_age_restriction')) $label_tos = sprintf( t('I accept the %s for this website'), $toslink); else - $label_tos = t('Check this box to import an existing identity file from another location'); + $label_tos = $email = ((x($_REQUEST,'email')) ? $_REQUEST['email'] : "" ); @@ -322,20 +257,14 @@ function zentity_content(&$a) { $o = replace_macros(get_markup_template('zentity.tpl'), array( '$title' => t('Create Identity'), - '$registertext' => t('An identity is a profile container for a personal profile, blog, public or private group/forum, celebrity page, and more.<br />You may create as many of these as your hub provider allows.'), - '$invitations' => get_config('system','invitation_only'), - '$invite_desc' => t('Membership on this site is by invitation only.'), - '$label_invite' => t('Please enter your invitation code'), - '$invite_id' => $invite_id, - - '$label_email' => t('Full name'), - '$label_pass1' => t('Choose a short nickname'), - '$label_pass2' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your profile.'), - '$label_tos' => $label_tos, - - '$email' => $email, - '$pass1' => $password, - '$pass2' => $password2, + '$desc' => t('An identity is a profile container for a personal profile, blog, public or private group/forum, celebrity page, and more. You may create as many of these as your provider allows.'), + + '$label_name' => t('Full name'), + '$label_nick' => t('Choose a short nickname'), + '$nick_desc' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your profile.'), + '$label_import' => t('Check this box to import an existing identity file from another location'), + '$name' => $name, + '$nickname' => $nickname, '$submit' => t('Create') )); |