2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2009-07-21 03:18:40 +00:00
|
|
|
/**
|
|
|
|
* \mainpage Shimmie2 / SCore Documentation
|
2009-07-21 06:36:12 +00:00
|
|
|
*
|
|
|
|
* SCore is a framework designed for writing flexible, extendable applications.
|
2013-11-28 05:34:31 +00:00
|
|
|
* Whereas most PHP apps are built monolithically, score's event-based nature
|
2009-07-21 06:36:12 +00:00
|
|
|
* allows parts to be mixed and matched. For instance, the most famous
|
|
|
|
* collection of score extensions is the Shimmie image board, which includes
|
|
|
|
* user management, a wiki, a private messaging system, etc. But one could
|
|
|
|
* easily remove the image board bits and simply have a wiki with users and
|
|
|
|
* PMs; or one could replace it with a blog module; or one could have a blog
|
|
|
|
* which links to images on an image board, with no wiki or messaging, and so
|
|
|
|
* on and so on...
|
2014-02-22 20:36:52 +00:00
|
|
|
*
|
2009-07-21 06:36:12 +00:00
|
|
|
* Dijkstra will kill me for personifying my architecture, but I can't think
|
|
|
|
* of a better way without going into all the little details.
|
2013-11-28 05:34:31 +00:00
|
|
|
* There are a bunch of Extension subclasses, they talk to each other by sending
|
|
|
|
* and receiving Event subclasses. The primary driver for each conversation is the
|
2012-03-05 13:56:36 +00:00
|
|
|
* initial PageRequestEvent. If an Extension wants to display something to the
|
|
|
|
* user, it adds a block to the Page data store. Once the conversation is over, the Page is passed to the
|
2009-07-21 03:18:40 +00:00
|
|
|
* current theme's Layout class which will tidy up the data and present it to
|
2012-03-05 13:56:36 +00:00
|
|
|
* the user. To see this in a more practical sense, see \ref hello.
|
2009-07-21 03:18:40 +00:00
|
|
|
*
|
2009-07-21 06:36:12 +00:00
|
|
|
* To learn more about the architecture:
|
|
|
|
*
|
|
|
|
* \li \ref eande
|
|
|
|
* \li \ref themes
|
|
|
|
*
|
|
|
|
* To learn more about practical development:
|
|
|
|
*
|
|
|
|
* \li \ref scglobals
|
|
|
|
* \li \ref unittests
|
|
|
|
*
|
|
|
|
* \page scglobals SCore Globals
|
2014-02-22 20:36:52 +00:00
|
|
|
*
|
2009-07-21 03:18:40 +00:00
|
|
|
* There are four global variables which are pretty essential to most extensions:
|
2014-02-22 20:36:52 +00:00
|
|
|
*
|
2009-07-21 03:18:40 +00:00
|
|
|
* \li $config -- some variety of Config subclass
|
|
|
|
* \li $database -- a Database object used to get raw SQL access
|
|
|
|
* \li $page -- a Page to holds all the loose bits of extension output
|
|
|
|
* \li $user -- the currently logged in User
|
2009-07-21 06:36:12 +00:00
|
|
|
*
|
|
|
|
* Each of these can be imported at the start of a function with eg "global $page, $user;"
|
2009-07-21 03:18:40 +00:00
|
|
|
*/
|
|
|
|
|
2012-03-30 17:03:55 +00:00
|
|
|
if(!file_exists("data/config/shimmie.conf.php")) {
|
2011-12-24 21:56:26 +00:00
|
|
|
header("Location: install.php");
|
|
|
|
exit;
|
|
|
|
}
|
2007-10-27 19:38:13 +00:00
|
|
|
|
2016-06-18 05:42:52 +00:00
|
|
|
if(!file_exists("vendor/")) {
|
|
|
|
//CHECK: Should we just point to install.php instead? Seems unsafe though.
|
|
|
|
print <<<EOD
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Shimmie Error</title>
|
|
|
|
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAIAICAAAAEAIACoEAAAJgAAABAQAAABAAgAaAUAAM4QAAAoAAAAIAAAAEAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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P+IiIj/iIiI/4iIiP+IiIj/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/hoaG/4aGhv+Ghob/hoaG/4aGhv+Ghob/hYWF/4WFhf8AAAD/AAAA/4WFhf+FhYX/hISE/4SEhP8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/4qKiv+Kior/ioqK/4qKiv+Kior/iYmJ/4mJif+JiYn/iYmJ/4mJif+IiIj/iIiI/4iIiP+IiIj/iIiI/4iIiP+Hh4f/h4eH/wAAAP8AAAD/h4eH/4eHh/+Ghob/hoaG/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP99fX3/iYmJ/4iIiP+IiIj/AAAA/wAAAP8AAAAAAAAAAAAAAAAA
|
|
|
|
<style>
|
|
|
|
#installer { background: #EEE; font-family: "Arial", sans-serif; font-size: 14px; width: 512px; margin: auto; margin-top: 16px; border: 1px solid black; border-radius: 16px; }
|
|
|
|
#installer > .container { padding: 5px; }
|
|
|
|
#installer A { text-decoration: none; }
|
|
|
|
#installer A:hover { text-decoration: underline; }
|
|
|
|
#installer H1, #installer H3 { background: #DDD; text-align: center; margin: 0px; padding: 2px; }
|
|
|
|
#installer H1 { border-bottom: 1px solid black; border-radius: 16px 16px 0px 0px; }
|
|
|
|
#installer H3 { border-bottom: 1px solid black; }
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="installer">
|
|
|
|
<h1>Install Error</h1>
|
|
|
|
<h3>Warning: Composer vendor folder does not exist!</h3>
|
|
|
|
<div class="container">
|
|
|
|
<p>Shimmie is unable to find the composer vendor directory.<br>
|
|
|
|
Have you followed the composer setup instructions found in the <a href="https://github.com/shish/shimmie2#installation-development">README</a>?</>
|
|
|
|
|
|
|
|
<p>If you are not intending to do any development with Shimmie, it is highly recommend you use one of the pre-packaged releases found on <a href="https://github.com/shish/shimmie2/releases">Github</a> instead.</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOD;
|
|
|
|
http_response_code(500);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2009-01-04 16:24:06 +00:00
|
|
|
try {
|
2015-08-02 14:47:04 +00:00
|
|
|
require_once "core/_bootstrap.inc.php";
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_start(@$_SERVER["REQUEST_URI"], true, true);
|
2009-05-11 21:08:32 +00:00
|
|
|
|
2009-01-04 16:24:06 +00:00
|
|
|
// start the page generation waterfall
|
2012-02-02 05:25:17 +00:00
|
|
|
$user = _get_user();
|
2018-07-15 18:40:53 +00:00
|
|
|
if(PHP_SAPI === 'cli' || PHP_SAPI == 'phpdbg') {
|
2015-08-02 14:47:04 +00:00
|
|
|
send_event(new CommandEvent($argv));
|
|
|
|
}
|
|
|
|
else {
|
2015-08-01 14:24:58 +00:00
|
|
|
send_event(new PageRequestEvent(_get_query()));
|
2012-06-17 19:05:16 +00:00
|
|
|
$page->display();
|
|
|
|
}
|
2008-01-02 21:49:12 +00:00
|
|
|
|
2012-03-11 00:37:08 +00:00
|
|
|
// saving cache data and profiling data to disk can happen later
|
|
|
|
if(function_exists("fastcgi_finish_request")) fastcgi_finish_request();
|
2012-06-23 23:27:53 +00:00
|
|
|
$database->commit();
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_endok();
|
2009-01-04 16:24:06 +00:00
|
|
|
}
|
|
|
|
catch(Exception $e) {
|
2012-06-23 23:27:53 +00:00
|
|
|
if($database) $database->rollback();
|
2012-02-01 15:07:03 +00:00
|
|
|
_fatal_error($e);
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_ender();
|
2009-01-04 16:24:06 +00:00
|
|
|
}
|
2014-04-24 23:13:20 +00:00
|
|
|
|