function getContent() { if ($staticpages = \Idno\Core\Idno::site()->plugins()->get('StaticPages')) { if (!empty($staticpages->getCurrentHomepageId())) { $object = \Idno\Common\Entity::getByID($staticpages->getCurrentHomepageId()); if (empty($object)) { $object = \Idno\Common\Entity::getBySlug($staticpages->getCurrentHomepageId()); } if (empty($object)) { $this->goneContent(); } // From here, we know the object is set // Ensure we're talking about pages ... if (!$object instanceof \IdnoPlugins\StaticPages\StaticPage) { $this->goneContent(); } // Check that we can see it if (!$object->canRead()) { $this->deniedContent(); } // Forward if necessary if (!empty($object->forward_url) && !\Idno\Core\Idno::site()->session()->isAdmin()) { $this->forward($object->forward_url); } $this->setOwner($object->getOwner()); $this->setPermalink(); // This is a permalink $this->setLastModifiedHeader($object->updated); // Say when this was last modified $t = \Idno\Core\Idno::site()->template(); $t->__(array('title' => $object->getTitle(), 'body' => $t->__(array('object' => $object))->draw('staticpages/page'), 'description' => $object->getShortDescription()))->drawPage(); } } parent::getContent(); }
/** * Sets a static page as the homepage, overwriting the current setting if one is set. * @param $pageId * @return bool */ function setAsHomepage($pageId) { if (\Idno\Core\Idno::site()->session()->isLoggedIn()) { if (\Idno\Core\Idno::site()->session()->currentUser()->isAdmin()) { if (!empty(\Idno\Common\Entity::getByID($pageId))) { \Idno\Core\Idno::site()->config->staticPages['homepage'] = $pageId; return \Idno\Core\Idno::site()->config->save(); } } } return false; }
function deleteContent() { if (!empty($this->arguments[0])) { $object = \Idno\Common\Entity::getByID($this->arguments[0]); } if (empty($object)) { $this->forward(); } // TODO: 404 if ($object->delete()) { \Idno\Core\Idno::site()->session()->addMessage($object->getTitle() . ' was deleted.'); } $this->forward($_SERVER['HTTP_REFERER']); }
function getContent() { if (!empty($this->arguments[0])) { $object = \Idno\Common\Entity::getByID($this->arguments[0]); } if (empty($object)) { $this->forward(); } // TODO: 404 if (!$object->canEdit()) { $this->forward($object->getURL()); } $t = \Idno\Core\site()->template(); $t->__(array('title' => $object->getTitle(), 'body' => $object->drawEdit()))->drawPage(); }
function postContent() { if (!empty($this->arguments[0])) { $object = \Idno\Common\Entity::getByID($this->arguments[0]); } if (empty($object)) { $this->setResponse(404); echo \Idno\Core\Idno::site()->template()->__(array('body' => \Idno\Core\Idno::site()->template()->draw('404'), 'title' => 'Not found'))->drawPage(); exit; } if (!$object->canEdit()) { $this->setResponse(403); echo \Idno\Core\Idno::site()->template()->__(array('body' => \Idno\Core\Idno::site()->template()->draw('403'), 'title' => 'Permission denied'))->drawPage(); exit; } $object->unsyndicate(); \Idno\Core\Idno::site()->session()->addMessage("We removed copies on all the syndicated sites."); $this->forward($object->getDisplayURL()); }
function getContent() { if (!empty($this->arguments[0])) { $object = \Idno\Common\Entity::getByID($this->arguments[0]); if (empty($object)) { $object = \Idno\Common\Entity::getBySlug($this->arguments[0]); } } if (empty($object)) { $this->goneContent(); } $permalink = $object->getUrl() . '/annotations/' . $this->arguments[1]; $annotation = $object->getAnnotation($permalink); $subtype = $object->getAnnotationSubtype($permalink); $this->setPermalink(); // This is a permalink $t = \Idno\Core\site()->template(); $t->__(array('title' => $object->getTitle(), 'body' => $t->__(array('annotation' => $annotation, 'subtype' => $subtype, 'permalink' => $permalink, 'object' => $object))->draw('entity/annotations/shell'), 'description' => $object->getShortDescription()))->drawPage(); }
function getContent() { if (!empty($this->arguments[0])) { $object = \Idno\Common\Entity::getByID($this->arguments[0]); } if (empty($object)) { $this->forward(); } // TODO: 404 if (!$object->canEdit()) { $this->forward($object->getDisplayURL()); } if ($owner = $object->getOwner()) { $this->setOwner($owner); } session_write_close(); $t = \Idno\Core\Idno::site()->template(); $t->__(array('title' => $object->getTitle(), 'body' => $t->__(['object' => $object])->draw('entity/editwrapper')))->drawPage(); }
function postContent() { $this->createGatekeeper(); if (!empty($this->arguments)) { $object = Entity::getByID($this->arguments[0]); } if ($object) { if (!$object->canEdit()) { $this->setResponse(403); Idno::site()->session()->addErrorMessage("You don't have permission to delete this object."); } else { if ($object->delete()) { Idno::site()->session()->addMessage($object->getTitle() . ' was deleted.'); } else { Idno::site()->session()->addErrorMessage("We couldn't delete " . $object->getTitle() . "."); } } } $this->forward($_SERVER['HTTP_REFERER']); }
function postContent() { $this->gatekeeper(); if (!empty($this->arguments[0])) { $object = \Idno\Common\Entity::getByID($this->arguments[0]); if (empty($object)) { $object = \Idno\Common\Entity::getBySlug($this->arguments[0]); } } if (empty($object)) { $this->goneContent(); } $permalink = $object->getURL() . '/annotations/' . $this->arguments[1]; if ($object->canEditAnnotation($permalink)) { if ($object->removeAnnotation($permalink) && $object->save()) { //\Idno\Core\site()->session()->addMessage('The annotation was deleted.'); } } $this->forward($object->getURL() . '#comments'); }
function postContent() { $this->gatekeeper(); if (!empty($this->arguments[0])) { $object = \Idno\Common\Entity::getByID($this->arguments[0]); if (empty($object)) { $object = \Idno\Common\Entity::getBySlug($this->arguments[0]); } } if (empty($object)) { $this->goneContent(); } $permalink = $object->getUrl() . '/annotations/' . $this->arguments[1]; if ($object->canEdit()) { if ($object->removeAnnotation($permalink) && $object->save()) { \Idno\Core\site()->session()->addMessage('Annotation ' . $permalink . ' was deleted.'); } } $this->forward($_SERVER['HTTP_REFERER']); }
function post() { \Idno\Core\Idno::site()->logging->debug("Pubsub: Ping received"); // Since we've overloaded post, we need to parse the arguments $arguments = func_get_args(); if (!empty($arguments)) { $this->arguments = $arguments; } // Find users if (!empty($this->arguments[0])) { $subscriber = \Idno\Common\Entity::getByID($this->arguments[0]); } if (empty($subscriber) || !$subscriber instanceof \Idno\Entities\User) { $this->goneContent(); } if (!empty($this->arguments[1])) { $subscription = \Idno\Common\Entity::getByID($this->arguments[1]); } if (empty($subscription) || !$subscription instanceof \Idno\Entities\User) { $this->goneContent(); } \Idno\Core\Idno::site()->logging->debug("Pubsub: Ping received, pinging out..."); \Idno\Core\Idno::site()->triggerEvent('pubsubhubbub/ping', array('subscriber' => $subscriber, 'subscription' => $subscription, 'data' => trim(file_get_contents("php://input")))); }