dav: throw exception if channel for requested DAV directory is deleted

This commit is contained in:
friendica 2014-01-15 03:12:47 -08:00
parent 362e4060e1
commit 47b8071ca7
7 changed files with 31 additions and 22 deletions

View File

@ -2259,7 +2259,7 @@ function tag_deliver($uid,$item_id) {
if($terms) { if($terms) {
foreach($terms as $term) { foreach($terms as $term) {
if(($term['term'] == $u[0]['channel_name']) && link_compare($term['url'],$link)) { if((strcasecmp($term['term'],$u[0]['channel_name']) == 0) && link_compare($term['url'],$link)) {
$mention = true; $mention = true;
break; break;
} }
@ -2322,8 +2322,10 @@ function tag_deliver($uid,$item_id) {
} }
if((! $mention) && (! $union)) if((! $mention) && (! $union)) {
logger('tag_deliver: no mention and no union.');
return; return;
}
// tgroup delivery - setup a second delivery chain // tgroup delivery - setup a second delivery chain

View File

@ -100,11 +100,11 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
$mimetype = z_mime_content_type($name); $mimetype = z_mime_content_type($name);
$c = q("select * from channel where channel_id = %d limit 1", $c = q("select * from channel where channel_id = %d and not (channel_pageflags & %d) limit 1",
intval(PAGE_REMOVED),
intval($this->auth->owner_id) intval($this->auth->owner_id)
); );
if(! $c) { if(! $c) {
logger('createFile: no channel'); logger('createFile: no channel');
throw new DAV\Exception\Forbidden('Permission denied.'); throw new DAV\Exception\Forbidden('Permission denied.');
@ -180,8 +180,9 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
return; return;
} }
$r = q("select * from channel where channel_id = %d limit 1", $r = q("select * from channel where channel_id = %d and not (channel_pageflags & %d) limit 1",
dbesc($this->auth->owner_id) intval(PAGE_REMOVED),
intval($this->auth->owner_id)
); );
if($r) { if($r) {
@ -233,13 +234,17 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
$channel_name = $path_arr[0]; $channel_name = $path_arr[0];
$r = q("select channel_id from channel where channel_address = '%s' limit 1",
dbesc($channel_name) $r = q("select channel_id from channel where channel_address = '%s' and not ( channel_pageflags & %d ) limit 1",
dbesc($channel_name),
intval(PAGE_REMOVED)
); );
if(! $r) if(! $r) {
return; throw new DAV\Exception\NotFound('The file with name: ' . $channel_name . ' could not be found');
return;
}
$channel_id = $r[0]['channel_id']; $channel_id = $r[0]['channel_id'];
$this->auth->owner_id = $channel_id; $this->auth->owner_id = $channel_id;
$this->auth->owner_nick = $channel_name; $this->auth->owner_nick = $channel_name;
@ -322,8 +327,8 @@ class RedFile extends DAV\Node implements DAV\IFile {
function put($data) { function put($data) {
logger('RedFile::put: ' . basename($this->name), LOGGER_DEBUG); logger('RedFile::put: ' . basename($this->name), LOGGER_DEBUG);
$c = q("select * from channel where channel_id = %d and not (channel_pageflags & %d) limit 1",
$c = q("select * from channel where channel_id = %d limit 1", intval(PAGE_REMOVED),
intval($this->auth->owner_id) intval($this->auth->owner_id)
); );
@ -440,8 +445,9 @@ function RedChannelList(&$auth) {
$ret = array(); $ret = array();
$r = q("select channel_id, channel_address from channel where not (channel_pageflags & %d)", $r = q("select channel_id, channel_address from channel where not (channel_pageflags & %d) and not (channel_pageflags & %d) ",
intval(PAGE_REMOVED) intval(PAGE_REMOVED),
intval(PAGE_HIDDEN)
); );
if($r) { if($r) {

View File

@ -356,7 +356,6 @@ function events_content(&$a) {
'$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'), '$calendar' => cal($y,$m,$links, ' eventcal'),
'$events' => $events, '$events' => $events,

View File

@ -38,7 +38,7 @@ function page_content(&$a) {
$channel_address = argv(1); $channel_address = argv(1);
$page_id = argv(2); $page_id = argv(2);
dbg(1);
$u = q("select channel_id from channel where channel_address = '%s' limit 1", $u = q("select channel_id from channel where channel_address = '%s' limit 1",
dbesc($channel_address) dbesc($channel_address)
); );
@ -63,7 +63,7 @@ function page_content(&$a) {
dbesc($page_id), dbesc($page_id),
intval(ITEM_WEBPAGE) intval(ITEM_WEBPAGE)
); );
dbg(0);
if(! $r) { if(! $r) {
// Check again with no permissions clause to see if it is a permissions issue // Check again with no permissions clause to see if it is a permissions issue

View File

@ -29,9 +29,11 @@ function pubsites_content(&$a) {
$j = json_decode($ret['body'],true); $j = json_decode($ret['body'],true);
if($j) { if($j) {
$o .= '<table border="1"><tr><td>' . t('Site URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Location') . '</td></tr>'; $o .= '<table border="1"><tr><td>' . t('Site URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Location') . '</td></tr>';
if($j['sites']) {
foreach($j['sites'] as $jj) { foreach($j['sites'] as $jj) {
$o .= '<tr><td>' . '<a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" >' . $jj['url'] . '</a>' . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . $jj['location'] . '</td></tr>'; $o .= '<tr><td>' . '<a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" >' . $jj['url'] . '</a>' . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . $jj['location'] . '</td></tr>';
} }
}
$o .= '</table>'; $o .= '</table>';
} }

View File

@ -70,7 +70,7 @@ then
sed -i "s/^\"Plural-Forms/#\"Plural-Forms/g" "$OUTFILE" sed -i "s/^\"Plural-Forms/#\"Plural-Forms/g" "$OUTFILE"
else else
sed -i "s/SOME DESCRIPTIVE TITLE./Red Communications Project/g" "$OUTFILE" sed -i "s/SOME DESCRIPTIVE TITLE./Red Communications Project/g" "$OUTFILE"
sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2013 the Red Matrix Project/g" "$OUTFILE" sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2012-2014 the Red Matrix Project/g" "$OUTFILE"
sed -i "s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR./Mike Macgirvin, 2013/g" "$OUTFILE" sed -i "s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR./Mike Macgirvin, 2013/g" "$OUTFILE"
sed -i "s/PACKAGE VERSION/$F9KVERSION/g" "$OUTFILE" sed -i "s/PACKAGE VERSION/$F9KVERSION/g" "$OUTFILE"
sed -i "s/PACKAGE/Red/g" "$OUTFILE" sed -i "s/PACKAGE/Red/g" "$OUTFILE"

View File

@ -1 +1 @@
2014-01-11.554 2014-01-15.558