| // +---------------------------------------------------------------------------+ // $Id$ /** * Simple wrapper for integrating s9y. * * @package blog * @author Demian Turner */ class BlogMgr extends SGL_Manager { function BlogMgr() { /* this module needs HTTP_Request and Net_URL for request stuff */ SGL::logMessage(null, PEAR_LOG_DEBUG); parent::SGL_Manager(); $this->pageTitle = 'Blog Manager'; $this->template = 'blogMgrList.html'; $this->_aActionsMapping = array( 'list' => array('list'), ); } function validate($req, &$input) { SGL::logMessage(null, PEAR_LOG_DEBUG); $this->validated = true; $input->error = array(); $input->pageTitle = $this->pageTitle; $input->masterTemplate = $this->masterTemplate; $input->template = $this->template; $input->action = ($req->get('action')) ? $req->get('action') : 'list'; } function _cmd_list(&$input, &$output) { SGL::logMessage(null, PEAR_LOG_DEBUG); require_once 'HTTP/Request.php'; $phpSelfParts = split('\?', $_SERVER['PHP_SELF']); $s9yUri = SGL_BASE_URL . '/serendipity/index.php?'.@$phpSelfParts[1]; $req = &new HTTP_Request($s9yUri); if ($_POST) { $req->setMethod(HTTP_REQUEST_METHOD_POST); foreach ($_POST as $key => $value) { $req->addPostData($key,$value); } } $req->sendRequest(); $header = $req->getResponseHeader('Content-type'); $header = explode(';',$header); $header = current($header); if ($header == 'text/html') { $output->blogData = $req->getResponseBody(); } else { header('Location: ' . $s9yUri); } } } ?>