Merged 5ffe826d76
into eef7d57b80
This commit is contained in:
commit
61462bf6f3
|
@ -44,7 +44,10 @@ class BlogTree extends Page {
|
|||
|
||||
if (!$page) {
|
||||
$controller = Controller::curr();
|
||||
if($controller) $page = $controller->data();
|
||||
if($controller) {
|
||||
if (!isset($controller->data)) return false;
|
||||
$page = $controller->data();
|
||||
}
|
||||
}
|
||||
|
||||
// If we _are_ a BlogTree, use us
|
||||
|
@ -61,13 +64,14 @@ class BlogTree extends Page {
|
|||
if($top) return $top;
|
||||
|
||||
// Try to find any BlogTree that is not inside another BlogTree
|
||||
foreach(DataObject::get('BlogTree') as $tree) {
|
||||
if($blogTrees=DataObject::get('BlogTree')) foreach($blogTrees as $tree) {
|
||||
if(!($tree->getParent() instanceof BlogTree)) return $tree;
|
||||
}
|
||||
|
||||
// This shouldn't be possible, but assuming the above fails, just return anything you can get
|
||||
return DataObject::get_one('BlogTree');
|
||||
return $blogTrees;
|
||||
}
|
||||
|
||||
|
||||
/* ----------- ACCESSOR OVERRIDES -------------- */
|
||||
|
||||
|
@ -122,16 +126,14 @@ class BlogTree extends Page {
|
|||
/* ----------- New accessors -------------- */
|
||||
|
||||
public function loadDescendantBlogHolderIDListInto(&$idList) {
|
||||
if ($children = $this->AllChildren()) {
|
||||
foreach($children as $child) {
|
||||
if(in_array($child->ID, $idList)) continue;
|
||||
|
||||
if($child instanceof BlogHolder) {
|
||||
$idList[] = $child->ID;
|
||||
} elseif($child instanceof BlogTree) {
|
||||
$child->loadDescendantBlogHolderIDListInto($idList);
|
||||
}
|
||||
}
|
||||
if ($children = $this->AllChildren()) foreach($children as $child) {
|
||||
if(in_array($child->ID, $idList)) continue;
|
||||
|
||||
if($child instanceof BlogHolder) {
|
||||
$idList[] = $child->ID;
|
||||
} elseif($child instanceof BlogTree) {
|
||||
$child->loadDescendantBlogHolderIDListInto($idList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,14 +231,11 @@ class BlogTree_Controller extends Page_Controller {
|
|||
|
||||
// only use freshness if no action is present (might be displaying tags or rss)
|
||||
if ($this->LandingPageFreshness && !$this->request->param('Action')) {
|
||||
$d = new Zend_Date(SS_Datetime::now()->getValue());
|
||||
$d->sub($this->LandingPageFreshness);
|
||||
$date = $d->toString('YYYY-MM-dd');
|
||||
|
||||
$filter = "\"BlogEntry\".\"Date\" > '$date'";
|
||||
$filter = "\"BlogEntry\".\"Date\" > '".date('Y-m-d', strtotime("-{$this->LandingPageFreshness}"))."'";
|
||||
} else {
|
||||
$filter = '';
|
||||
}
|
||||
|
||||
// allow filtering by author field and some blogs have an authorID field which
|
||||
// may allow filtering by id
|
||||
if(isset($_GET['author']) && isset($_GET['authorID'])) {
|
||||
|
@ -317,8 +316,7 @@ class BlogTree_Controller extends Page_Controller {
|
|||
return $date;
|
||||
|
||||
} else {
|
||||
|
||||
if(is_numeric($year)) return $year;
|
||||
if(is_numeric($year)) return $year;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ require_once(BASE_PATH . '/blog/thirdparty/xmlrpc/xmlrpc_wrappers.php');
|
|||
*/
|
||||
class MetaWeblogController extends Controller {
|
||||
function index($request) {
|
||||
Debug::log(Debug::text($request));
|
||||
//Debug::log(Debug::text($request));
|
||||
|
||||
// Create an xmlrpc server, and set up the method calls
|
||||
$service = new xmlrpc_server(array(
|
||||
|
|
Loading…
Reference in New Issue