Merge branch 'master', remote-tracking branch 'remotes/upstream/master'

* remotes/upstream/master:
  bogus empty list element in dfrn_request page when emailnet not enabled
  zrl on random profile
  zrl hook
  bug #372 - category feeds
  pass zrl's to/through global directory

* master:
This commit is contained in:
Simon L'nu 2012-04-14 15:12:39 -04:00
commit 1dd22be4d2
7 changed files with 24 additions and 8 deletions

View file

@ -1494,11 +1494,13 @@ function get_my_url() {
return false; return false;
} }
function zrl($s) { function zrl($s,$force = false) {
if(! strlen($s)) if(! strlen($s))
return $s; return $s;
if(! strpos($s,'/profile/')) if((! strpos($s,'/profile/')) && (! $force))
return $s; return $s;
if($force && substr($s,-1,1) !== '/')
$s = $s . '/';
$achar = strpos($s,'?') ? '&' : '?'; $achar = strpos($s,'?') ? '&' : '?';
$mine = get_my_url(); $mine = get_my_url();
if($mine and ! link_compare($mine,$s)) if($mine and ! link_compare($mine,$s))

View file

@ -19,9 +19,15 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
$converse = true; $converse = true;
if($a->argv[$x] == 'starred') if($a->argv[$x] == 'starred')
$starred = true; $starred = true;
if($a->argv[$x] === 'category' && $a->argc > ($x + 1) && strlen($a->argv[$x+1]))
$category = $a->argv[$x+1];
} }
} }
// default permissions - anonymous user // default permissions - anonymous user
$sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' "; $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";
@ -101,6 +107,10 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
if(! strlen($last_update)) if(! strlen($last_update))
$last_update = 'now -30 days'; $last_update = 'now -30 days';
if(x($category)) {
$sql_extra .= file_tag_file_query('item',$category,'category');
}
if($public_feed) { if($public_feed) {
if(! $converse) if(! $converse)
$sql_extra .= " AND `contact`.`self` = 1 "; $sql_extra .= " AND `contact`.`self` = 1 ";

View file

@ -40,7 +40,7 @@ load_translation_table($lang);
require_once("dba.php"); require_once("dba.php");
if(! $install) { if(! $install) {
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install); $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
unset($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data);
/** /**
@ -95,6 +95,10 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
if(x($_GET,'zrl')) { if(x($_GET,'zrl')) {
$_SESSION['my_url'] = $_GET['zrl']; $_SESSION['my_url'] = $_GET['zrl'];
$a->query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string); $a->query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string);
if(! $install) {
$arr = array('zrl' => $_SESSION['my_url'], 'url' => $a->cmd);
call_hooks('zrl_init',$arr);
}
} }
/** /**

View file

@ -44,7 +44,7 @@ function directory_content(&$a) {
$gdirpath = dirname(get_config('system','directory_submit_url')); $gdirpath = dirname(get_config('system','directory_submit_url'));
if(strlen($gdirpath)) { if(strlen($gdirpath)) {
$globaldir = '<ul><li><div id="global-directory-link"><a href="' $globaldir = '<ul><li><div id="global-directory-link"><a href="'
. $gdirpath . '">' . t('Global Directory') . '</a></div></li></ul>'; . zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
} }
$admin = ''; $admin = '';

View file

@ -5,6 +5,6 @@ function randprof_init(&$a) {
require_once('include/Contact.php'); require_once('include/Contact.php');
$x = random_profile(); $x = random_profile();
if($x) if($x)
goaway($x); goaway(zrl($x));
goaway($a->get_baseurl() . '/profile'); goaway($a->get_baseurl() . '/profile');
} }

View file

@ -7,7 +7,7 @@ $page_desc<br />
<li><a href="http://friendica.com" title="$friendica">$friendica</a></li> <li><a href="http://friendica.com" title="$friendica">$friendica</a></li>
<li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li> <li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li>
<li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li> <li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li>
<li>$emailnet</li> {{ if $emailnet }}<li>$emailnet</li>{{ endif }}
</ul> </ul>
</p> </p>
<p> <p>

View file

@ -7,7 +7,7 @@ $page_desc<br />
<li><a href="http://friendica.com" title="$friendica">$friendica</a></li> <li><a href="http://friendica.com" title="$friendica">$friendica</a></li>
<li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li> <li><a href="http://joindiaspora.com" title="$diaspora">$diaspora</a> $diasnote</li>
<li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li> <li><a href="http://ostatus.org" title="$public_net" >$statusnet</a></li>
<li>$emailnet</li> {{ if $emailnet }}<li>$emailnet</li>{{ endif }}
</ul> </ul>
$invite_desc $invite_desc
</p> </p>