aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-22 13:51:08 -0800
committerfriendica <info@friendica.com>2013-12-22 13:51:08 -0800
commit42361588e9f8ad5a110406a11fd23e7a719c5bd4 (patch)
tree8b0ada0fe0b3a165547dc9efe6ae8116ecd244e8 /mod
parent77fdb4a1eee6d7e2d3b0d3d50896a0100eccf373 (diff)
parent30219b5bda724375c10006c33e5754d3f5d1d044 (diff)
downloadvolse-hubzilla-42361588e9f8ad5a110406a11fd23e7a719c5bd4.tar.gz
volse-hubzilla-42361588e9f8ad5a110406a11fd23e7a719c5bd4.tar.bz2
volse-hubzilla-42361588e9f8ad5a110406a11fd23e7a719c5bd4.zip
Merge https://github.com/friendica/red into zpull
Diffstat (limited to 'mod')
-rw-r--r--mod/achievements.php84
-rw-r--r--mod/editpost.php2
-rw-r--r--mod/xref.php20
3 files changed, 106 insertions, 0 deletions
diff --git a/mod/achievements.php b/mod/achievements.php
new file mode 100644
index 000000000..1910def73
--- /dev/null
+++ b/mod/achievements.php
@@ -0,0 +1,84 @@
+<?php
+
+function achievements_content(&$a) {
+
+ if(argc() > 1)
+ $which = argv(1);
+ else {
+ notice( t('Requested profile is not available.') . EOL );
+ return;
+}
+
+ $profile = 0;
+ $profile = argv(1);
+ profile_load($a,$which,$profile);
+
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
+ );
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
+
+ $observer = $a->get_observer();
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ $perms = get_all_perms($owner,$ob_hash);
+ if(! $perms['view_profile']) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+// By default, all badges are false
+ $contactbadge = false;
+ $profilebadge = false;
+ $keywordsbadge = false;
+
+// Check number of contacts. Award a badge if over 10
+// We'll figure these out on each page load instead of
+// writing them to the DB because that will mean one needs
+// to retain their achievements - eg, you can't add
+// a bunch of channels just to get your badge, and then
+// delete them all again. If these become popular or
+// used in profiles or something, we may need to reconsider
+// and add a table for this - because this won't scale.
+
+ $r = q("select * from abook where abook_channel = %d",
+ intval($owner)
+ );
+
+ if (count($r))
+ $contacts = count($r);
+ // We're checking for 11 to adjust for the abook record for self
+ if ($contacts >= 11)
+ $contactbadge = true;
+
+// Check if an about field in the profile has been created.
+
+ $r = q("select * from profile where uid = %d and about <> ''",
+ intval($owner)
+ );
+
+ if ($r)
+ $profilebadge = 1;
+
+// Check if keywords have been set
+
+ $r = q("select * from profile where uid = %d and keywords <> ''",
+ intval($owner)
+ );
+
+ if($r)
+ $keywordsbadge = 1;
+
+// FIXME - stick ths in a template, and make it look pretty.
+ $o .= "Template not implemented";
+ $o .= "If this is one, you get the profile badge" . $profilebadge . "<br>";
+ $o .= "If this is one, you get the contact badge" . $contactbadge . "<br>";
+ $o .= "If this is one you get the keywords badge" . $keywordsbadge . "<br>";
+ $o .= "I haven't done the top level posts badge yet" . $toplevelpostsbadge . "<br>";
+ $o .= "I haven't done the number of channels badge yet" . $channelsbadge;
+
+
+return $o;
+
+}
diff --git a/mod/editpost.php b/mod/editpost.php
index e731c04fe..f012c47cd 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -132,6 +132,8 @@ function editpost_content(&$a) {
'$expires' => t('Set expiration date'),
'$feature_encrypt' => 'none',
'$encrypt' => t('Encrypt text'),
+ '$expiryModalOK' => t('OK'),
+ '$expiryModalCANCEL' => t('Cancel'),
));
return $o;
diff --git a/mod/xref.php b/mod/xref.php
new file mode 100644
index 000000000..566de1998
--- /dev/null
+++ b/mod/xref.php
@@ -0,0 +1,20 @@
+<?php
+
+ function ref_init(&$a) {
+ // Sets a referral URL using an xchan directly
+ // Link format: example.com/xref/[xchan]/[TargetURL]
+ // Target URL is optional.
+ // Cookie lasts 24 hours to survive a browser restart. Contains no personal
+ // information at all - just somebody else's xchan.
+ $referrer = argv(1);
+ $expire=time()+60*60*24;
+ $path = 'ref';
+ setcookie(ref, $referrer, $expire, "/");
+ $url = '';
+
+ if (argc() > 2)
+ $url = argv(2);
+
+ goaway (z_root() . '/' . $url);
+
+}