Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x

This commit is contained in:
Sarven Capadisli 2009-03-25 18:29:09 +00:00
commit ce325a06b1
3 changed files with 30 additions and 24 deletions

View File

@ -125,6 +125,7 @@ class NoticesearchAction extends SearchAction
$this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'noticesearch', array('q' => $q));
}
function isReadOnly()
{
return true;

View File

@ -241,12 +241,7 @@ class Net_URL_Mapper_Path
}
$path = '/'.trim(Net_URL::resolvePath($path), '/');
if (!empty($qstring)) {
if (!strpos($path, '?')) {
$path .= '?';
} else {
$path .= '&';
}
$path .= http_build_query($qstring);
$path .= '?'.http_build_query($qstring);
}
if (!empty($anchor)) {
$path .= '#'.ltrim($anchor, '#');

View File

@ -68,8 +68,8 @@ class Router
}
}
function initialize() {
function initialize()
{
$m = Net_URL_Mapper::getInstance();
// In the "root"
@ -136,14 +136,17 @@ class Router
foreach (array('group', 'people', 'notice') as $s) {
$m->connect('search/'.$s, array('action' => $s.'search'));
$m->connect('search/'.$s.'?q=:q', array('action' => $s.'search'),array('q' => '.+'));
$m->connect('search/'.$s.'?q=:q',
array('action' => $s.'search'),
array('q' => '.+'));
}
// The second of these is needed to make the link work correctly
// when inserted into the page. The first is needed to match the
// route on the way in. Seems to be another Net_URL_Mapper bug to me.
$m->connect('search/notice/rss', array('action' => 'noticesearchrss'));
$m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),array('q' => '.+'));
$m->connect('search/notice/rss?q=:q', array('action' => 'noticesearchrss'),
array('q' => '.+'));
// notice
@ -425,8 +428,6 @@ class Router
function build($action, $args=null, $params=null, $fragment=null)
{
if($params!=null)
common_log(LOG_DEBUG,"build: ".$action." ".print_r($args,true)." ".print_r($params,true));
$action_arg = array('action' => $action);
if ($args) {
@ -435,8 +436,17 @@ class Router
$args = $action_arg;
}
if($params!=null)
common_log(LOG_DEBUG,"generate args:".print_r($args,true));
return $this->m->generate($args, $params, $fragment);
$url = $this->m->generate($args, $params, $fragment);
// Due to a bug in the Net_URL_Mapper code, the returned URL may
// contain a malformed query of the form ?p1=v1?p2=v2?p3=v3. We
// repair that here rather than modifying the upstream code...
$qpos = strpos($url, '?');
if ($qpos !== false) {
$url = substr($url, 0, $qpos+1) .
str_replace('?', '&', substr($url, $qpos+1));
}
return $url;
}
}