**/ /** * Define some constants needed by the wiki **/ define('CWIKI_STDCONFIG', 'settings/stdconfig.php'); define('CWIKI_DBCONFIG', 'settings/dbconfig.php'); define('CWIKI_VERSION', '1.0 Beta 2'); define('PERM_VIEW', 1); // Permission to view pages. define('PERM_EDIT', 2); // Permission to edit pages. define('PERM_HISTORY', 4); // Permission to view the history. define('PERM_RESTORE', 8); // Permission to restore old versions. define('PERM_RENAME', 128); // Permission to rename a page. define('PERM_DELETE', 256); // Permission to delete a page. define('PERM_IGNORELOCAL', 512); // Permission to ignore local access masks. define('PERM_SETLOCAL', 1024); // Permission to modify local access masks. define('PERM_USEACP', 2048); // Permission to use the acp. include CWIKI_STDCONFIG; include CWIKI_DBCONFIG; include $cfg['lib_dir'].'/class_database.php'; include $cfg['lib_dir'].'/class_template.php'; include $cfg['lib_dir'].'/class_parser.php'; include $cfg['lib_dir'].'/class_core.php'; include $cfg['lib_dir'].'/lib_instances.php'; include $cfg['lib_dir'].'/class_diff.php'; $page = isset($_GET['page']) && $_GET['page'] != '' ? $_GET['page'] : $cfg['default_page']; $action = isset($_GET['action']) ? strtolower($_GET['action']) : $cfg['default_action']; // Extract the namespace:WikiPage components from the page parameter. // If the page parameter doesnt match, page name and namespace are set to false. if(preg_match('/^'.$cfg['title_format'].'$/', $page, $match)) { if(strlen($match[1]) > 30 || strlen($match[2]) > 50) { $pageName = false; $namespace = false; } else { $pageName = $match[2]; $namespace = substr($match[1], 0, strlen($match[1]) - 1); } } else { $pageName = false; $namespace = false; } // If there is a prefix and if it is the specialpage prefix we check // wether the requested specialpage exists. if($namespace == $cfg['special_namespace']) { $file = $cfg['special_dir'].'/special_'.strtolower($pageName).'.php'; $class = 'special_'.strtolower($pageName); if(!file_exists($file)) { $pageName = false; $namespace = false; } } else { if($namespace != '' && !in_array($namespace, $cfg['namespaces'])) { $pageName = false; $namespace = false; } if(!isset($cfg['actions'][$action])) { $action = $cfg['default_action']; } $file = $cfg['actions_dir'].'/action_'.$cfg['actions'][$action].'.php'; $class = 'action_'.$cfg['actions'][$action]; $page['action'] = $action; } if($pageName === false) { $class = 'core'; } else { include $file; } // Now, create a instance of the specialpage/action and start // processing of the page. $wiki = new $class(array('page' => $pageName, 'namespace' => $namespace, 'action' => $action), $cfg); $wiki->start(); $wiki->assignTplVars(); $template = $wiki->getTemplate(); $tpl = &singleton('template'); $tpl->display($template); $wiki->end(); /** * Count the scripts execution time and make a small debug output **/ $endtime = explode(' ', microtime()); $endtime = $endtime[1] + $endtime[0]; $creationtime = round($endtime - $starttime, 3); $db = &singleton('database'); $steps = $creationtime / 100; $php_percent = round(($creationtime - $db->runtimes) / $steps, 2); $mysql_percent = round($db->runtimes / $steps, 2); //echo "