Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56298631
index.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
index.php
View Options
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Main web application entry point
*
* @package ObsidianWorkspaces
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*
*/
////////////////////////////////////////////////////////////////////////////////
///
/// Initialization
///
//Keruald and Obsidian Workspaces libraries
include
(
'includes/core.php'
);
$session
=
Session
::
load
();
////////////////////////////////////////////////////////////////////////////////
///
/// Session and context
///
//Prepares the site context
$context
=
new
ApplicationContext
();
$context
->
session
=
$session
;;
$context
->
url
=
get_current_url_fragments
();
$context
->
config
=
$Config
;
$context
->
initializeTemplateEngine
(
$context
->
config
[
'Theme'
]);
//Loads language files
Language
::
initialize
();
Language
::
load
(
$context
)->
configLoad
(
'core.conf'
);
if
(
Workspace
::
is_workspace
(
$context
->
url
[
0
]))
{
$context
->
workspace
=
Workspace
::
fromCode
(
array_shift
(
$context
->
url
));
$context
->
workspace
->
loadConfiguration
(
$context
);
}
//Handles login or logout
include
(
"includes/login.php"
);
//Gets current user information
$context
->
user
=
$context
->
session
->
get_logged_user
();
////////////////////////////////////////////////////////////////////////////////
///
/// Serves the requested page
///
//If the user isn't logged in (is anonymous), prints login/invite page & dies.
if
(
$context
->
user
->
id
==
ANONYMOUS_USER
)
{
//Anonymous user
include
(
'controllers/anonymous.php'
);
exit
;
}
$controller
=
count
(
$context
->
url
)
>
0
?
$context
->
url
[
0
]
:
''
;
switch
(
$controller
)
{
case
''
:
//Calls homepage controller
HomepageController
::
run
(
$context
);
break
;
case
'help'
:
case
'reports'
:
//Calls requested controller
include
(
"controllers/$controller.php"
);
break
;
default
:
//Current workspace application controller?
$workspaceConfig
=
$context
->
workspace
->
configuration
;
$applicationConfiguration
=
NULL
;
if
(
$workspaceConfig
!=
NULL
&&
$workspaceConfig
->
hasControllerBind
(
$controller
,
$applicationConfiguration
))
{
//Runs controller
$controllerClass
=
$applicationConfiguration
->
name
;
$appContext
=
ApplicationContext
::
loadFromContext
(
$context
,
$applicationConfiguration
);
$controllerClass
::
run
(
$appContext
);
break
;
}
//Not a workspace, nor a controller toponomy
ErrorPageController
::
show
(
$context
,
404
);
exit
;
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 6, 18:57 (2 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4209909
Default Alt Text
index.php (2 KB)
Attached To
Mode
rOBSIDIAN Obsidian Workspaces
Attached
Detach File
Event Timeline
Log In to Comment