CVS update: /cowiki/htdocs/
[email protected] 2 Aug 2005 22:10:41 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dgorski Date: 2005/08/02 15:10:41 Modified: cowiki/htdocs/admin.php cowiki/htdocs/index.php Log: Introduction of proxy scripts File Changes: Directory: /cowiki/htdocs/ ========================== File [changed]: admin.php Url: http://cowiki.tigris.org/source/browse/cowiki/htdocs/admin.php?r1=1.19&r2=1.20 Delta lines: +18 -362 ---------------------- --- admin.php 9 Jun 2005 01:41:34 -0000 1.19 +++ admin.php 2 Aug 2005 22:10:38 -0000 1.20 @@ -2,7 +2,7 @@ /** * - * $Id: admin.php,v 1.19 2005/06/09 01:41:34 dgorski Exp $ + * $Id: admin.php,v 1.20 2005/08/02 22:10:38 dgorski Exp $ * * This file is part of coWiki. coWiki is free software under the terms of * the GNU General Public License (GPL). Read the LICENSE file. If you did @@ -11,382 +11,38 @@ * you a copy immediately. * * @package htdocs - * @subpackage admin * @access public * * @author Daniel T. Gorski, <[email protected]> * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ * */ -/** - * Basic imports, checks and inits - * - * @package htdocs - * @subpackage admin - * @access public - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - * - * @todo [D11N] Complete documentation - */ - - // If error reporting level is not set to E_ALL, suppress all notices, - // warnings and/or errors - or vice versa: the error reporting level - // needs to be set to E_ALL for coWiki to display notices, warnings or - // errors in browser output. - if ((ini_get('error_reporting') & E_ALL) == 0) { - error_reporting(0); - } +// ------------------------------------------------------------------------ +// ATTENTION: THIS SCRIPT HAVE TO WORK WITHOUT DEPENDENCIES WITH PHP4! +// ------------------------------------------------------------------------ + + header('Expires: Sat, 05 Aug 2000 22:27:00 GMT'); + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Cache-Control: no-cache, must-revalidate'); + header('Pragma: no-cache'); + header('Cache-Control: post-check=0, pre-check=0'); + header('Vary: Accept-Encoding, User-Agent'); // -------------------------------------------------------------------- - // If the file 'install.pending' exists in this directory, the - // setup wizard (installer) has to be invoked to check structural - // changes that has been possibly made to the current coWiki version. - // The existance of this file indicates that coWiki either has not - // been set up yet or was updated recently. - // - // The wizard itself is located in the 'setup/' folder. - - if (file_exists(realpath(dirname(__FILE__)) . '/install.pending')) { - // FIX: scheme (https) and port (other than 80) - $sScheme = 'http'; - $sBasePath = substr( - $_SERVER['REQUEST_URI'], - 0, - strrpos($_SERVER['REQUEST_URI'], '/') - ) . '/'; + $sPath = dirname($_SERVER['SCRIPT_FILENAME']); - header('Location: ' - . $sScheme . '://' - . $_SERVER['HTTP_HOST'] - . $sBasePath - . 'setup/installer.php' - ); - exit; - } + // Include and init required files + include_once $sPath . '/version.php'; - // -------------------------------------------------------------------- - - // Load and set include path definition - ini_set('include_path', @file_get_contents('./include.path')); + // Compares the version and emmit an error in browser if neccessary. + include_once $sPath . '/version.compare.php'; // -------------------------------------------------------------------- - // Start the main controller - try { - - // Include 'core.base.php'. This file resolves basic dependances - // and takes care of initializations. - include_once 'core.base.php'; - - // {{{ DEBUG }}} - Logger::info('Started processing.'); - - // Start the main controller - main(); - - // {{{ DEBUG }}} - Logger::info('Stopped processing - a clean run.'); - - } catch (GenericException $e) { - $e->printStackTrace(); - - // {{{ DEBUG }}} - Logger::info( - 'Crashed with '.$e->getName().' "'.$e->getExceptionMessage().'" - in line '.$e->getLine() - ); - - exit; - - } catch (Exception $e) { - - // This should never should happen - do not throw only Exception, - // but a GenericException instead. - echo 'Build-in exception in '.$e->getFile().' in line '.$e->getLine(); - echo '<br />'; - echo '<pre>'; - echo $e->getTraceAsString(); - echo '</pre>'; - echo 'This should never happen. Report it to the coWiki developers.'; - - // {{{ DEBUG }}} - Logger::info('Crashed with build-in exception in line '.$e->getLine()); - Logger::info('THIS IS SERIOUS - Report it to the coWiki developers.'); - - exit; - } - - // -------------------------------------------------------------------- - - /** - * Main - * - * @access public - * @return void - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - * - * @todo [D11N] Check description - */ - function main() { - - // === CONTROLLER FLOW ============================================ - - // Get context, registry, request, document DAO and template - // processor - $Context = RuntimeContext::getInstance(); - $Registry = $Context->getRegistry(); - $Request = $Context->getRequest(); - $DocDAO = $Context->getDocumentDAO(); - $Tpl = TemplateProcessor::getInstance(); - - // Set basic controller constants - $Registry->set('COWIKI_CONTROLLER_NAME', basename(__FILE__)); - $Registry->set('COWIKI_CONTROLLER_REWRITABLE', false); - $Registry->set('COWIKI_BASE_HREF', $Request->getBaseUri()); - - // Other usefull constants - $Registry->set('META_ROBOT_INDEX', 'noindex, nofollow'); - $Registry->set('META_KEYWORDS', ''); - $Registry->set( - 'PAGE_TITLE', - $Registry->get('COWIKI_FULL_NAME').' '.__('I18N_ADMINISTRATION') - ); - - // ---------------------------------------------------------------- - - // Get user object, check permissions - $CurrUser = $Context->getCurrentUser(); - if (!$CurrUser->isRoot()) { - $Context->addError(403); - $Context->terminate(); - } - - // ---------------------------------------------------------------- - - $sModule = $Request->get('module'); - $sCmd = $Request->get('cmd'); - $bDispatched = false; - - // ---------------------------------------------------------------- - - // Include HTML-<HEAD> (stylesheets/JavaScipt) - echo $Tpl->parse('front.page.head.tpl'); - - // Include page header (BODY-Tag and further topmost HTML) - echo $Tpl->parse('admin.page.header.tpl'); - - // ---------------------------------------------------------------- - - // Dispatch controller actions - - // Call setup installer, script will terminate after this redirect - if ($sModule == 'setup') { - HttpResponse::getInstance()->redirectTo( - 'setup/installer.php?ref=admin.php' - ); - } - - // ---------------------------------------------------------------- - - // Webstructure - if ($sModule == 'struct') { - - // First create an empty dummy node and register it - $Node = new DocumentContainer(); - $Context->setCurrentNode($Node); - - if ($Request->has('web')) { - // Build a web node - $Node = $DocDAO->getNodeById($Request->get('web')); - $Context->setCurrentNode($Node); - - // Check if we got an object returned, if not we'll display - // a 404 - if (!is_object($Node)) { - $Context->addError(404); - $bDispatched = true; - } - } - - // ------------------------------------------------------------ - - if (!$bDispatched) { - if ($sCmd == CMD_EDITWEB || $sCmd == CMD_NEWWEB) { - echo $Tpl->parse('admin.web.edit.tpl'); - $bDispatched = true; - } - } - - if (!$bDispatched) { - echo $Tpl->parse('admin.web.list.edit.tpl'); - $bDispatched = true; - } - } - - // ---------------------------------------------------------------- - - // User management - if ($sModule == 'user') { - - if (!$bDispatched) { - if ($sCmd == CMD_EDITUSR || $sCmd == CMD_NEWUSR) { - echo $Tpl->parse('admin.user.edit.tpl'); - $bDispatched = true; - } - } - - if (!$bDispatched) { - echo $Tpl->parse('admin.user.list.edit.tpl'); - $bDispatched = true; - } - } - - // ---------------------------------------------------------------- - - // Group management - if ($sModule == 'group') { - - if (!$bDispatched) { - if ($sCmd == CMD_EDITGRP || $sCmd == CMD_NEWGRP) { - echo $Tpl->parse('admin.group.edit.tpl'); - $bDispatched = true; - } - } - - if (!$bDispatched) { - echo $Tpl->parse('admin.group.list.edit.tpl'); - $bDispatched = true; - } - } - - // ---------------------------------------------------------------- - - // Cache management - if ($sModule == 'cache') { - - if (!$bDispatched) { - echo $Tpl->parse('admin.cache.edit.tpl'); - $bDispatched = true; - } - } - - // ---------------------------------------------------------------- - - // node restoration management - if ($sModule == 'trash') { - - if (!$bDispatched) { - if ($sCmd == CMD_SHOWHIST) { - echo $Tpl->parse('admin.trash.history.display.tpl'); - $bDispatched = true; - } - } - - if (!$bDispatched) { - if ($sCmd == CMD_COMPHIST) { - echo $Tpl->parse('admin.trash.history.compare.tpl'); - $bDispatched = true; - } - } - - if (!$bDispatched) { - if ($sCmd == CMD_DIFFHIST) { - echo $Tpl->parse('admin.trash.history.diff.tpl'); - $bDispatched = true; - } - } - - if (!$bDispatched) { - if ($sCmd == CMD_RECOVHIST) { - echo $Tpl->parse('admin.trash.history.recover.tpl'); - $bDispatched = true; - } - } - - if (!$bDispatched) { - echo $Tpl->parse('admin.trash.display.tpl'); - $bDispatched = true; - } - } - - // ---------------------------------------------------------------- - - if (!$bDispatched || $Context->hasErrors()) { - $Registry->set( - 'TPL_ITEM_MESSAGE', - $Context->getErrorQueueFormatted() - ); - - echo $Tpl->parse('admin.menu.display.tpl'); - $bDispatched = true; - } - - // ---------------------------------------------------------------- - - // Include page footer - echo $Tpl->parse('admin.page.footer.tpl'); - - // ---------------------------------------------------------------- - - @include_once 'core.finish.php'; - - } // of main() controller - -/* - We caught the tread of dancing feet, - We loitered down the moonlit street, - And stopped beneath the harlot's house. - Inside, above the din and fray, - We heard the loud musicians play - The "Treues Liebes Herz" of Strauss. - - Like strange mechanical grotesques, - Making fantastic arabesques, - The shadows raced across the blind. - - We watched the ghostly dancers spin - To sound of horn and violin, - Like black leaves wheeling in the wind. - - Like wire-pulled automatons, - Slim silhouetted skeletons - Went sidling through the slow quadrille. - - They took each other by the hand, - And danced a stately saraband; - Their laughter echoed thin and shrill. - - Sometimes a clockwork puppet pressed - A phantom lover to her breast, - Sometimes they seemed to try to sing. - - Sometimes a horrible marionette - Came out, and smoked its cigarette - Upon the steps like a living thing. - - Then turning to my love, I said, - "The dead are dancing with the dead, - The dust is whirling with the dust." - - But she - she heard the violin, - And left my side, and entered in: - Love passed into the house of lust. - - Then suddenly the tune went false, - The dancers wearied of the waltz, - The shadows ceased to wheel and whirl. - - And down the long and silent street, - The dawn, with silver-sandalled feet, - Crept like a frightened girl. -*/ + include_once 'admin.proxy.php'; ?> File [changed]: index.php Url: http://cowiki.tigris.org/source/browse/cowiki/htdocs/index.php?r1=1.40&r2=1.41 Delta lines: +23 -592 ---------------------- --- index.php 9 Jun 2005 01:41:33 -0000 1.40 +++ index.php 2 Aug 2005 22:10:38 -0000 1.41 @@ -2,7 +2,7 @@ /** * - * $Id: index.php,v 1.40 2005/06/09 01:41:33 dgorski Exp $ + * $Id: index.php,v 1.41 2005/08/02 22:10:38 dgorski Exp $ * * This file is part of coWiki. coWiki is free software under the terms of * the GNU General Public License (GPL). Read the LICENSE file. If you did @@ -16,602 +16,33 @@ * @author Daniel T. Gorski, <[email protected]> * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.40 $ + * @version $Revision: 1.41 $ * */ -/** - * Basic imports, checks and inits - * - * @package htdocs - * @access public - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - */ - - // If error reporting level is not set to E_ALL, suppress all notices, - // warnings and/or errors - or vice versa: the error reporting level - // needs to be set to E_ALL for coWiki to display notices, warnings or - // errors in browser output. - if ((ini_get('error_reporting') & E_ALL) == 0) { - error_reporting(0); - } - - // -------------------------------------------------------------------- - - // If the file 'install.pending' exists in this directory, the - // setup wizard (installer) has to be invoked to check structural - // changes that has been possibly made to the current coWiki version. - // The existance of this file indicates that coWiki either has not - // been set up yet or was updated recently. - // - // The wizard itself is located in the 'setup/' folder. +// ------------------------------------------------------------------------ +// ATTENTION: THIS SCRIPT HAVE TO WORK WITHOUT DEPENDENCIES WITH PHP4! +// ------------------------------------------------------------------------ - if (file_exists(realpath(dirname(__FILE__)) . '/install.pending')) { - // FIX: scheme (https) and port (other than 80) - $sScheme = 'http'; - $sBasePath = substr( - $_SERVER['REQUEST_URI'], - 0, - strrpos($_SERVER['REQUEST_URI'], '/') - ) . '/'; - - header('Location: ' - . $sScheme . '://' - . $_SERVER['HTTP_HOST'] - . $sBasePath - . 'setup/installer.php' - ); - exit; - } + header('Expires: Sat, 05 Aug 2000 22:27:00 GMT'); + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Cache-Control: no-cache, must-revalidate'); + header('Pragma: no-cache'); + header('Cache-Control: post-check=0, pre-check=0'); + header('Vary: Accept-Encoding, User-Agent'); // -------------------------------------------------------------------- - // Load and set include path definition - ini_set('include_path', @file_get_contents('./include.path')); - - // -------------------------------------------------------------------- - - // Start the main controller - try { - - // Include 'core.base.php'. This file resolves basic dependances - // and takes care of initializations. - include_once 'core.base.php'; - - // {{{ DEBUG }}} - Logger::info('Started processing.'); - - // Start the main controller - main(); - - // {{{ DEBUG }}} - Logger::info('Stopped processing - a clean run.'); - - } catch (GenericException $e) { - $e->printStackTrace(); - - // {{{ DEBUG }}} - Logger::info( - 'Crashed with '.$e->getName().' "'.$e->getExceptionMessage().'" - in line '.$e->getLine() - ); + define('SETUP_PATH', dirname($_SERVER['SCRIPT_FILENAME'])); - exit; + // Include and init required files + include_once SETUP_PATH.'/version.php'; - } catch (Exception $e) { - - // This should never should happen - do not throw only Exception, - // but a GenericException instead. - echo 'Build-in exception in '.$e->getFile().' in line '.$e->getLine(); - echo '<br />'; - echo '<pre>'; - echo $e->getTraceAsString(); - echo '</pre>'; - echo 'This should never happen. Report it to the coWiki developers.'; - - // {{{ DEBUG }}} - Logger::info('Crashed with build-in exception in line '.$e->getLine()); - Logger::info('THIS IS SERIOUS - Report it to the coWiki developers.'); - - exit; - } + // Compares the version and emmit an error in browser if neccessary. + include_once SETUP_PATH.'/version.compare.php'; // -------------------------------------------------------------------- - /** - * Main - * - * @access public - * @return void - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - * - * @throws GenericException - */ - function main() { - - /** - * Bind requested node - * - * @access public - * @return void - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - */ - function bindRequestedNode() { - $Request = RuntimeContext::getInstance()->getRequest(); - $Node = RuntimeContext::getInstance() - ->getDocumentDAO()->getNodeById($Request->get('node')); - - if (is_object($Node)) { - // Register the node object to the RuntimeContext - RuntimeContext::getInstance()->setCurrentNode($Node); - } - } - - // ---------------------------------------------------------------- - - /** - * Bind default node - * - * @access public - * @return void - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - */ - function bindDefaultNode() { - $Context = RuntimeContext::getInstance(); - $User = $Context->getCurrentUser(); - $Node = $Context->getDocumentDAO()->getDefaultNode($User); - - if (is_object($Node)) { - // Register the node object to the RuntimeContext - RuntimeContext::getInstance()->setCurrentNode($Node); - } - } - - // ---------------------------------------------------------------- - - /** - * Bind node by wiki name - * - * @access public - * @return mixed - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - */ - function bindNodeByWikiName() { - - $Context = RuntimeContext::getInstance(); - $Request = $Context->getRequest(); - $DocDAO = $Context->getDocumentDAO(); - - $sWebName = $Request->get('webname'); - $sDocName = $Request->get('docname'); - - if (!$sWebName && !$sDocName) { - return; - } - - $Criteria = new SearchCriteria; - - $Criteria->addExpression(new EqExpression('parent_id', '0')); - $Criteria->addExpression(new EqExpression('is_dir', 'Y')); - $Criteria->addExpression(new EqExpression('wikiname', $sWebName)); - - // Get one or more (web) results - $Result = $DocDAO->getUnguardedNodesByCriteria( - $Criteria, - $Context->getCurrentUser() - ); - - // If document name is given, get all documents within the web - // with the same wiki name - if ($sDocName && !$Result->isEmpty()) { - - $nTreeId = $Result->elementAt(0)->get('treeId'); - - $Criteria = new SearchCriteria; - $Criteria->addOrder('is_dir'); - - $Criteria->addExpression( - new EqExpression('tree_id', $nTreeId) - ); - $Criteria->addExpression( - new EqExpression('wikiname', $sDocName) - ); - - // Get one or more (document) results - $Result = $DocDAO->getUnguardedNodesByCriteria( - $Criteria, - $Context->getCurrentUser(), - array('*') - ); - } - - // ---------------------------------------------------------------- - - if ($Result->isEmpty()) { - return; - } - - // Non-ambiguous result, fine. - if ($Result->size() == 1) { - // Get first node element - $Node = $Result->elementAt(0); - - // Register the node object to the RuntimeContext - $Context->setCurrentNode($Node); - return; - } - - // Fake request command if we have ambiguous results. - $Request->set('cmd', CMD_AMBIDOC); - } - - // ---------------------------------------------------------------- - - /** - * Prepare node - * - * @access public - * @return void - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - */ - function prepareNode() { - - // Get context, registry, request and document access object - $Context = RuntimeContext::getInstance(); - $Registry = $Context->getRegistry(); - $Request = $Context->getRequest(); - $DocDAO = $Context->getDocumentDAO(); - - // If one of these commands has to be performed, do not get - // a possible "index"-document if the node is a container. - $aNoIndexFor = array( - CMD_NEWDIR, CMD_EDITDIR, CMD_SHOWDIR, CMD_NEWDOC, - CMD_EDITDOC, CMD_MOVEDOC, CMD_XMLDOC, CMD_AMBIDOC, - CMD_SIMDOC, CMD_SHOWHIST, CMD_COMPHIST, CMD_DIFFHIST, - CMD_RECOVHIST, CMD_SRCHDOC - ); - - $Node = $Context->getCurrentNode(); - - if (is_object($Node)) { - - // Check if this node is a directory and if none of the - // commands set in "$aNoIndexFor" has to be performed. - // If so, overwrite the last node with the content of the - // new (possible) index document. From now on, we are not - // working on the requested node(-id), but on its child, - // its "index" - if there is one of course. - - if ($Node->get('isContainer')) { - if (!in_array($Request->get('cmd'), $aNoIndexFor)) { - - // Get "index" node - $IndexNode = $DocDAO->getIndexNodeOf($Node); - - if (is_object($IndexNode)) { - $Node = $IndexNode; - } - } - } - - // Get nodes along path to root node - $Node = $DocDAO->getNodePath($Node); - - // -------------------------------------------------------- - - // Default value parent title - $Registry->set('PARENT_TITLE', ''); - - // Get parent if any - $Parent = $Node->get('parent'); - - if (is_object($Parent)) { - // Transfer parent title property to Registry - $Registry->set( - 'PARENT_TITLE', - escape($Parent->get('name')) - ); - - // Special treatment for 'showdir' command - if ($Request->get('cmd') == CMD_SHOWDIR) { - $Node = $Parent; - } - } - - // -------------------------------------------------------- - - // Get current web name - $Web = $DocDAO->getWebById($Node->get('treeId')); - if (is_object($Web)) { - $Registry->set('WEB_TITLE', escape($Web->get('name'))); - } - - // Set node info in registry - $Registry->set('TITLE', escape($Node->get('name'))); - - $Registry->set( - 'META_KEYWORDS', - escape($Node->get('keywords')) - ); - - $Registry->set( - 'CREATED', - $Context->makeDate($Node->get('created')) - .', ' - .$Context->makeTime($Node->get('created')) - ); - - $Registry->set( - 'MODIFIED', - $Context->makeDate($Node->get('modified')) - .', ' - .$Context->makeTime($Node->get('modified')) - ); - - $Registry->set('REVISION', $Node->get('revision')); - $Registry->set('VIEWS', $Node->get('views')); - - // -------------------------------------------------------- - - $Context->setCurrentNode($Node); - } - } - - // ---------------------------------------------------------------- - - /** - * Process node command - * - * @access public - * @return void - * - * @author Daniel T. Gorski, <[email protected]> - * @since coWiki 0.3.0 - */ - function processNodeCommand() { - - // Get context, request, registry and template processor - $Context = RuntimeContext::getInstance(); - $Request = $Context->getRequest(); - $Registry = $Context->getRegistry(); - $Tpl = $Context->getTemplateProcessor(); - - // Comment data access - $ComDAO = $Context->getCommentDAO(); - - // Current node - $Node = $Context->getCurrentNode(); - - // Flags - $bDone = false; - $bIndexFollow = true; - - // ------------------------------------------------------------ - - // Output printable version? - if (!$bDone && $Request->get('cmd') == CMD_PRNTDOC) { - echo $Tpl->parse('print.page.head.tpl'); - echo $Tpl->parse('print.page.header.tpl'); - echo $Tpl->parse('print.display.tpl'); - echo $Tpl->parse('print.page.footer.tpl'); - - $Registry->set('META_ROBOT_INDEX', 'noindex, nofollow'); - $bDone = true; - } - - // ------------------------------------------------------------ - - if (!$bDone) { - // Normal page header - echo $Tpl->parse('front.page.head.tpl'); - echo $Tpl->parse('front.page.header.tpl'); - } - - // ------------------------------------------------------------ - - // Display or edit comment? - if (!$bDone && $Request->has('comid')) { - - // Add new "comments" node for breadcrumb - $NodeCom = $Node->clonePrimitives(); - $NodeCom->set('name', __('I18N_COM_COMMENTS')); - $NodeCom->set('isComment', true); - $Node->addItem($NodeCom); - - // Add new "subject" node for breadcrumb - $Com = $ComDAO->getCommentById($Request->get('comid')); - if (is_object($Com)) { - $NodeSubject = $Node->clonePrimitives(); - $NodeSubject->set('name', $Com->get('subject')); - $NodeCom->addItem($NodeSubject); - } - - // Dispatch commands - switch ($Request->get('cmd')) { - - case CMD_NEWCOM: - case CMD_REPLYCOM: - echo $Tpl->parse('front.comment.edit.tpl'); - break; - - default: - echo $Tpl->parse('front.comment.display.tpl'); - break; - } - - // Include page footer - echo $Tpl->parse('front.page.footer.tpl'); - $bDone = true; - } - - // ------------------------------------------------------------ - - if (!$bDone) { - $bIndexFollow = false; - - // Dispatch commands - switch ($Request->get('cmd')) { - case CMD_EDITDOC: - case CMD_NEWDOC: - echo $Tpl->parse('front.doc.edit.tpl'); - break; - - case CMD_EDITDIR: - case CMD_NEWDIR: - echo $Tpl->parse('front.dir.edit.tpl'); - break; - - case CMD_CHUSR: - echo $Tpl->parse('front.user.change.tpl'); - break; - - case CMD_PREFUSR: - echo $Tpl->parse('front.user.preferences.tpl'); - break; - - case CMD_DETAILUSR: - echo $Tpl->parse('front.user.details.tpl'); - break; - - case CMD_XMLDOC: - echo $Tpl->parse('front.doc.xmlpretty.tpl'); - break; - - case CMD_AMBIDOC: - echo $Tpl->parse('front.wikiword.ambiguous.list.tpl'); - break; - - case CMD_SIMDOC: - echo $Tpl->parse('front.wikiword.similar.list.tpl'); - break; - - case CMD_SRCHDOC: - echo $Tpl->parse('front.search.list.tpl'); - break; - - case CMD_SHOWHIST: - echo $Tpl->parse('front.doc.history.display.tpl'); - break; - - case CMD_COMPHIST: - echo $Tpl->parse('front.doc.history.compare.tpl'); - break; - - case CMD_DIFFHIST: - echo $Tpl->parse('front.doc.history.diff.tpl'); - break; - - case CMD_RECOVHIST: - echo $Tpl->parse('front.doc.history.recover.tpl'); - break; - - case CMD_LISTCOM: - // Add new "comments" node for breakcrumb - $NodeCom = $Node->clonePrimitives(); - $NodeCom->set('name', __('I18N_COM_COMMENTS')); - $Node->addItem($NodeCom); - - echo $Tpl->parse('front.comment.list.tpl'); - break; - - default: - if ($Node->get('isContainer')) { - echo $Tpl->parse('front.dir.display.tpl'); - } else { - echo $Tpl->parse('front.doc.display.tpl'); - $bIndexFollow = true; - } - break; - } - - if ($bIndexFollow) { - $Registry->set('META_ROBOT_INDEX', 'index, follow'); - } else { - $Registry->set('META_ROBOT_INDEX', 'noindex, nofollow'); - } - - // Include page footer - echo $Tpl->parse('front.page.footer.tpl'); - $bDone = true; - } - } - - // === CONTROLLER FLOW ============================================ - - // Get context, registry and request - $Context = RuntimeContext::getInstance(); - $Registry = $Context->getRegistry(); - $Request = $Context->getRequest(); - - // Set basic controller constants - $Registry->set('COWIKI_CONTROLLER_NAME', basename(__FILE__)); - $Registry->set('COWIKI_CONTROLLER_REWRITABLE', true); - $Registry->set('COWIKI_BASE_HREF', $Request->getBaseUri()); - - // Bind dummy node for error cases - $Context->setCurrentNode(new DocumentContainer()); - - // ---------------------------------------------------------------- - - $bDispatched = false; - - // Dispatch controller actions - - if (!$bDispatched) { - if ($Request->has('webname') || $Request->has('docname')) { - bindNodeByWikiName(); - prepareNode(); - processNodeCommand(); - $bDispatched = true; - } - } - - // ---------------------------------------------------------------- - - if (!$bDispatched) { - // ... more actions here - - //$bDispatched = true; - } - - // ---------------------------------------------------------------- - - // Default behaviour - if (!$bDispatched) { - // "node" parameter is set? Get the node, otherwise get default - if ($Request->has('node')) { - bindRequestedNode(); - } else { - bindDefaultNode(); - } - - prepareNode(); - processNodeCommand(); - $bDispatched = true; - } - - // ---------------------------------------------------------------- - - include_once 'core.finish.php'; - - } // of main() controller - -/* - Time passes slow - fields stretch out across open acres - Time passes slow - the giant steps of mankind touch us so little - in the great lands -*/ + include_once 'index.proxy.php'; ?>