Merge pull request #576 from beardy-unixer/master

Allow directories to stop being directories without killing anyone.
This commit is contained in:
RedMatrix 2014-09-02 12:28:30 +10:00
commit 43738da24f
5 changed files with 54 additions and 15 deletions

View File

@ -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(

View File

@ -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());

View File

@ -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
));
}

View File

@ -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.

View File

@ -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>