aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/dir_fns.php20
-rw-r--r--include/poller.php3
-rw-r--r--mod/achievements.php23
-rw-r--r--mod/chanview.php14
-rw-r--r--view/tpl/achievements.tpl9
5 files changed, 54 insertions, 15 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 815b6a197..5fad6567e 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -30,6 +30,26 @@ function find_upstream_directory($dirmode) {
return array('url' => $preferred);
}
+function check_upstream_directory() {
+ /**
+ * Directories may come and go over time. We will need to check that our
+ * directory server is still valid occasionally, and reset to something that
+ * is if our directory has gone offline for any reason
+ */
+ $directory = get_config('system','directory_server');
+ if ($directory) {
+ $r = q("select * from site where site_url = '%s' and (site_flags & %d) ",
+ dbesc($directory),
+ intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY|DIRECTORY_MODE_STANDALONE)
+ );
+ }
+ // If we've got something, it's still a directory. If we haven't, we need to reset and let find_upstream_directory() fix it
+ if (! $r) {
+ set_config('system','directory_server','');
+ }
+ return;
+}
+
function dir_sort_links() {
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
diff --git a/include/poller.php b/include/poller.php
index 52ca98c97..2ba86dc0b 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -111,6 +111,9 @@ function poller_run($argv, $argc){
if(($d2 != $d1) && ($h1 == $h2)) {
+ require_once('include/dir_fns.php');
+ check_upstream_directory();
+
call_hooks('cron_daily',datetime_convert());
diff --git a/mod/achievements.php b/mod/achievements.php
index 1910def73..1d0018b08 100644
--- a/mod/achievements.php
+++ b/mod/achievements.php
@@ -1,6 +1,9 @@
<?php
function achievements_content(&$a) {
+ // This doesn't work, so
+ if (! is_developer())
+ return;
if(argc() > 1)
$which = argv(1);
@@ -28,6 +31,9 @@ function achievements_content(&$a) {
return;
}
+ $newmembertext = t('Some blurb about what to do when you\'re new here');
+
+
// By default, all badges are false
$contactbadge = false;
$profilebadge = false;
@@ -70,15 +76,12 @@ function achievements_content(&$a) {
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;
+ return replace_macros(get_markup_template("achievements.tpl"), array(
+ '$newmembertext' => $newmembertext,
+ '$profilebadge' => $profilebadge,
+ '$contactbadge' => $contactbadge,
+ '$keywordsbadge' => $keywordsbadge,
+ '$channelsbadge' => $channelsbadge
+));
}
diff --git a/mod/chanview.php b/mod/chanview.php
index 449a98bb1..3bf0f3268 100644
--- a/mod/chanview.php
+++ b/mod/chanview.php
@@ -74,15 +74,19 @@ function chanview_content(&$a) {
}
if(! $a->poi) {
- notice( t('Channel not found.') . EOL);
- return;
+// We don't know who this is, and we can't figure it out from the URL
+// On the plus side, there's a good chance we know somebody else at that
+// hub so sending them there with a Zid will probably work anyway.
+ $url = ($_REQUEST['url']);
+ if($observer)
+ $url = zid($url);
}
-
+ if ($a->poi) {
$url = $a->poi['xchan_url'];
if($observer)
$url = zid($url);
-
+ }
// let somebody over-ride the iframed viewport presentation
// or let's just declare this a failed experiment.
@@ -97,4 +101,4 @@ function chanview_content(&$a) {
// return $o;
-} \ No newline at end of file
+}
diff --git a/view/tpl/achievements.tpl b/view/tpl/achievements.tpl
new file mode 100644
index 000000000..2b80b9e80
--- /dev/null
+++ b/view/tpl/achievements.tpl
@@ -0,0 +1,9 @@
+<div class="generic-content-wrapper">
+<p>{{$newmembertext}}</p>
+
+{{if $profilebadge}}<div id="profile-badge" class="badges"><img src="images/smiley-thumbsup.gif"></div>{{/if}}
+{{if $contactbadge}}<div id="contact-badge" class="badges"><img src="images/smiley-thumbsup.gif"></div>{{/if}}
+{{if $keywordsbadge}}<div id="keywords-badge" class="badges"><img src="images/smiley-thumbsup.gif"></div>{{/if}}
+{{if $channelsbadge}}<div id="channels-badge" class="badges"><img src="images/smiley-thumbsup.gif"></div>{{/if}}
+
+</div>