mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-23 20:49:21 +00:00
Upgraded initialization system
This commit is contained in:
parent
2bfb6fd7d1
commit
dced14cf52
@ -18,7 +18,7 @@ ComunicWeb.debug = {
|
||||
*/
|
||||
logMessage: function(message){
|
||||
//We check we are not in production mode
|
||||
if(ComunicWeb.__config.productionMode != 1){
|
||||
if(ComunicWeb.__config.productionMode != true){
|
||||
console.log("ComunicWebApp debug message", message);
|
||||
}
|
||||
|
||||
|
@ -1,218 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP dev config for the website
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
//Path to assets
|
||||
$config['pathAssets'] = $config['siteURL']."assets/";
|
||||
|
||||
//3rdparty CSS files to include
|
||||
$config['3rdPartyCSSfiles'] = array(
|
||||
//CSS files - adminLTE distribution / bootstrap / plugins
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/bootstrap/css/bootstrap.min.css",
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/font-awesome/css/font-awesome.min.css",
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/ionicons/css/ionicons.min.css",
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/iCheck/square/blue.css",
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/iCheck/flat/blue.css",
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/select2/select2.min.css",
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/dist/css/AdminLTE.min.css",
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/dist/css/skins/_all-skins.min.css",
|
||||
|
||||
//Light box
|
||||
"%PATH_ASSETS%3rdparty/lightbox/ekko-lightbox.min.css",
|
||||
);
|
||||
|
||||
//App CSS files
|
||||
$config['CSSfiles'] = array(
|
||||
//App stylesheets - common stylesheets
|
||||
"%PATH_ASSETS%css/common/global.css",
|
||||
"%PATH_ASSETS%css/common/page/waitSplashScreen.css",
|
||||
"%PATH_ASSETS%css/common/network/networkError.css",
|
||||
|
||||
//Components stylesheets
|
||||
//Menubar stylesheet
|
||||
"%PATH_ASSETS%css/components/menuBar.css",
|
||||
|
||||
//Searchform stylesheet
|
||||
"%PATH_ASSETS%css/components/searchForm.css",
|
||||
|
||||
//Friendbar stylesheet
|
||||
"%PATH_ASSETS%css/components/friends/friendsBar.css",
|
||||
|
||||
//Conversations stylesheet
|
||||
"%PATH_ASSETS%css/components/conversations/manager.css",
|
||||
"%PATH_ASSETS%css/components/conversations/windows.css",
|
||||
"%PATH_ASSETS%css/components/conversations/list.css",
|
||||
|
||||
//User selector stylesheet
|
||||
"%PATH_ASSETS%css/components/userSelect/userSelect.css",
|
||||
|
||||
//Emojies
|
||||
"%PATH_ASSETS%css/components/emoji/parser.css",
|
||||
|
||||
//Posts component
|
||||
"%PATH_ASSETS%css/components/posts/ui.css",
|
||||
|
||||
//Pages stylesheets
|
||||
//User Page
|
||||
"%PATH_ASSETS%css/pages/userPage/main.css",
|
||||
"%PATH_ASSETS%css/pages/userPage/accessForbidden.css",
|
||||
);
|
||||
|
||||
//3rd party JS files to include (at the end of the page)
|
||||
$config['3rdPartyJSfiles'] = array(
|
||||
//Jquery
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/jQuery/jquery-2.2.3.min.js",
|
||||
|
||||
//Bootstrap
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/bootstrap/js/bootstrap.min.js",
|
||||
|
||||
//JQuery UI
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/jquery-ui/jquery-ui.min.js",
|
||||
|
||||
//iCheck
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/iCheck/icheck.min.js",
|
||||
|
||||
//Slimscroll
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/slimScroll/jquery.slimscroll.min.js",
|
||||
|
||||
//Select2
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/plugins/select2/select2.min.js",
|
||||
|
||||
//adminLTE script
|
||||
"%PATH_ASSETS%3rdparty/adminLTE/dist/js/app.min.js",
|
||||
|
||||
//Bootstrap notify
|
||||
"%PATH_ASSETS%3rdparty/bootstrap-notify-3.1.3.min.js",
|
||||
|
||||
//Twitter emojies
|
||||
"%PATH_ASSETS%3rdparty/twemoji/2/twemoji.min.js",
|
||||
|
||||
//Textarea auto-size
|
||||
"%PATH_ASSETS%3rdparty/jquery.textarea_autosize/jquery.textarea_autosize.min.js",
|
||||
|
||||
//Light box
|
||||
"%PATH_ASSETS%3rdparty/lightbox/ekko-lightbox.min.js",
|
||||
);
|
||||
|
||||
//Application JS files
|
||||
$config['JSfiles'] = array(
|
||||
|
||||
//Utilities
|
||||
"%PATH_ASSETS%js/common/utils.js",
|
||||
|
||||
//Functions schema
|
||||
"%PATH_ASSETS%js/common/functionsSchema.js",
|
||||
|
||||
//Pages list
|
||||
"%PATH_ASSETS%js/pagesList.js",
|
||||
|
||||
|
||||
//App scripts -- common scripts
|
||||
"%PATH_ASSETS%js/common/cacheManager.js",
|
||||
"%PATH_ASSETS%js/common/network.js",
|
||||
"%PATH_ASSETS%js/common/api.js",
|
||||
"%PATH_ASSETS%js/common/errors.js",
|
||||
"%PATH_ASSETS%js/common/messages.js",
|
||||
"%PATH_ASSETS%js/common/langs.js",
|
||||
"%PATH_ASSETS%js/common/url.js",
|
||||
"%PATH_ASSETS%js/common/jsFiles.js",
|
||||
"%PATH_ASSETS%js/common/debug.js",
|
||||
"%PATH_ASSETS%js/common/page.js",
|
||||
"%PATH_ASSETS%js/common/notifications.js",
|
||||
"%PATH_ASSETS%js/common/formChecker.js",
|
||||
"%PATH_ASSETS%js/common/date.js",
|
||||
"%PATH_ASSETS%js/common/system.js",
|
||||
|
||||
//Default langage
|
||||
"%PATH_ASSETS%js/langs/en.inc.js",
|
||||
|
||||
//Components
|
||||
//Mail caching
|
||||
"%PATH_ASSETS%js/components/mailCaching.js",
|
||||
|
||||
//Search form
|
||||
"%PATH_ASSETS%js/components/searchForm/searchForm.js",
|
||||
|
||||
//Main menubar
|
||||
"%PATH_ASSETS%js/components/menuBar/common.js",
|
||||
"%PATH_ASSETS%js/components/menuBar/notAuthenticated.js",
|
||||
"%PATH_ASSETS%js/components/menuBar/authenticated.js",
|
||||
|
||||
//Friends components
|
||||
"%PATH_ASSETS%js/components/friends/friendsList.js",
|
||||
"%PATH_ASSETS%js/components/friends/friendsBar.js",
|
||||
|
||||
//Private conversations
|
||||
"%PATH_ASSETS%js/components/conversations/manager.js",
|
||||
"%PATH_ASSETS%js/components/conversations/list.js",
|
||||
"%PATH_ASSETS%js/components/conversations/windows.js",
|
||||
"%PATH_ASSETS%js/components/conversations/chatWindows.js",
|
||||
"%PATH_ASSETS%js/components/conversations/interface.js",
|
||||
"%PATH_ASSETS%js/components/conversations/service.js",
|
||||
"%PATH_ASSETS%js/components/conversations/cachingOpened.js",
|
||||
"%PATH_ASSETS%js/components/conversations/utils.js",
|
||||
|
||||
//User selector
|
||||
"%PATH_ASSETS%js/components/userSelect/userSelect.js",
|
||||
|
||||
//Emojies
|
||||
"%PATH_ASSETS%js/components/emoji/parser.js",
|
||||
"%PATH_ASSETS%js/components/emoji/list.js",
|
||||
|
||||
//Like button
|
||||
"%PATH_ASSETS%js/components/like/button.js",
|
||||
"%PATH_ASSETS%js/components/like/interface.js",
|
||||
|
||||
//Posts component
|
||||
"%PATH_ASSETS%js/components/posts/interface.js",
|
||||
"%PATH_ASSETS%js/components/posts/ui.js",
|
||||
|
||||
//Modern textarea handler
|
||||
"%PATH_ASSETS%js/components/textarea.js",
|
||||
|
||||
//User scripts
|
||||
"%PATH_ASSETS%js/user/loginTokens.js",
|
||||
"%PATH_ASSETS%js/user/userLogin.js",
|
||||
"%PATH_ASSETS%js/user/userInfos.js",
|
||||
|
||||
|
||||
//Pages scripts
|
||||
//Home page
|
||||
"%PATH_ASSETS%js/pages/home/home.js",
|
||||
"%PATH_ASSETS%js/pages/home/landingPage.js",
|
||||
|
||||
//User page
|
||||
"%PATH_ASSETS%js/pages/userPage/main.js",
|
||||
"%PATH_ASSETS%js/pages/userPage/accessForbidden.js",
|
||||
"%PATH_ASSETS%js/pages/userPage/friendshipStatus.js",
|
||||
"%PATH_ASSETS%js/pages/userPage/profileInfos.js",
|
||||
"%PATH_ASSETS%js/pages/userPage/posts.js",
|
||||
|
||||
//Login page
|
||||
"%PATH_ASSETS%js/pages/login.js",
|
||||
|
||||
//Logout page
|
||||
"%PATH_ASSETS%js/pages/logout.js",
|
||||
|
||||
//Create shortcuts for common functions
|
||||
"%PATH_ASSETS%js/common/shorcuts.js",
|
||||
"%PATH_ASSETS%js/common/helpers.js",
|
||||
|
||||
//Init script
|
||||
"%PATH_ASSETS%js/init.js",
|
||||
);
|
||||
|
||||
//JS language path
|
||||
$config['languagesPath'] = "%PATH_ASSETS%js/langs/";
|
||||
|
||||
//Production mode
|
||||
$config['productionMode'] = 0;
|
||||
|
||||
//Application version
|
||||
$config['appVersion'] = "0.1";
|
||||
|
||||
//Templates URL
|
||||
$config['templatesURL'] = $config['pathAssets']."templates/";
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Project main config page
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
//Site mode (could be dev or prod)
|
||||
$config['siteMode'] = "dev";
|
||||
|
||||
//Site URL
|
||||
$config['siteURL'] = "http://devweb.local/comunic/v2/";
|
||||
|
||||
//API config
|
||||
$config['API_URL'] = "http://devweb.local/comunic/api/";
|
||||
$config['API_SERVICE_NAME'] = "ComunicWeb";
|
||||
$config['API_SERVICE_TOKEN'] = "12XU67pJUlnNQ";
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Assets helper inclusion
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the source code for including a javascript file
|
||||
*
|
||||
* @param String $file The path to the file
|
||||
* @return String Source code for including a javascript file
|
||||
*/
|
||||
function javascriptFileInclusionCode($file){
|
||||
return "<script type='text/javascript' src='".$file."'></script>".(config['siteMode'] == 0 ? "\n\t\t" : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source code for including a CSS file
|
||||
*
|
||||
* @param String $file Path to the CSS file
|
||||
* @return String HTML Source code to include the CSS file
|
||||
*/
|
||||
function CSSFileInclusionCode($file){
|
||||
return "<link rel='stylesheet' href='".$file."'>".(config['siteMode'] == 0 ? "\n\t\t" : "");
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Page initiator
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define system path
|
||||
*/
|
||||
define("SYSTEM_PATH", __DIR__."/");
|
||||
|
||||
/**
|
||||
* Include main config
|
||||
*/
|
||||
require(SYSTEM_PATH."config/global.config.php");
|
||||
|
||||
/**
|
||||
* Include site mode config
|
||||
*/
|
||||
require(SYSTEM_PATH."config/".$config['siteMode'].".config.php");
|
||||
|
||||
/**
|
||||
* Include helpers
|
||||
*/
|
||||
foreach (glob(SYSTEM_PATH . "helpers/*.php") as $file) {
|
||||
//Including helpers file
|
||||
include($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make config constant
|
||||
*/
|
||||
define("config", $config);
|
120
index.php
120
index.php
@ -1,8 +1,11 @@
|
||||
<?php
|
||||
//Include page initiator
|
||||
include("corePage/initPage.php");
|
||||
/**
|
||||
* Comunic Web APP launcher
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
//We check if it is a redirection
|
||||
//We check if it is a redirection to handle 404 errors
|
||||
if(isset($_SERVER["REDIRECT_URL"])){
|
||||
//We check if it is an asset request
|
||||
if(preg_match("<assets>", $_SERVER["REDIRECT_URL"])){
|
||||
@ -12,112 +15,9 @@
|
||||
exit();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!--
|
||||
Comunic web app client
|
||||
Main HTML file
|
||||
|
||||
(c) Pierre HUBERT 2017
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Page title, should be automaticaly modified next -->
|
||||
<title>Comunic</title>
|
||||
//Include system
|
||||
require __DIR__."/system/system.php";
|
||||
|
||||
<!-- Make the website responsive -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
|
||||
<!-- UTF-8 support -->
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- Favicons -->
|
||||
<link rel="icon" type="image/vnd.microsoft.icon" href="<?php echo config['pathAssets']; ?>img/favicon.png" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="<?php echo config['pathAssets']; ?>img/favicon.png" />
|
||||
|
||||
<!--3rdPary Stylesheet requirements -->
|
||||
<?php
|
||||
foreach($config['3rdPartyCSSfiles'] as $file){
|
||||
//Include CSS file
|
||||
$file = str_replace("%PATH_ASSETS%", $config['pathAssets'], $file);
|
||||
echo CSSFileInclusionCode($file);
|
||||
}
|
||||
?>
|
||||
|
||||
<!--App Stylesheet requirements -->
|
||||
<?php
|
||||
foreach($config['CSSfiles'] as $file){
|
||||
//Include CSS file
|
||||
$file = str_replace("%PATH_ASSETS%", $config['pathAssets'], $file);
|
||||
echo CSSFileInclusionCode($file);
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Javascript config -->
|
||||
<script>
|
||||
//Configuration definition
|
||||
var ComunicConfig = {
|
||||
//Production mode
|
||||
productionMode: <?php echo config['productionMode']; ?>,
|
||||
|
||||
//AppVersion
|
||||
appVersion: "<?php echo config['appVersion']; ?>",
|
||||
|
||||
//Assets URL
|
||||
assetsURL: "<?php echo config['pathAssets']; ?>",
|
||||
|
||||
//Templates URL
|
||||
templatesURL : "<?php echo config['templatesURL']; ?>",
|
||||
|
||||
//Site URL
|
||||
siteURL: "<?php echo config['siteURL']; ?>",
|
||||
|
||||
//apiURL and credentials
|
||||
apiURL: "<?php echo config['API_URL']; ?>",
|
||||
apiServiceName: "<?php echo config['API_SERVICE_NAME']; ?>",
|
||||
apiServiceToken: "<?php echo config['API_SERVICE_TOKEN']; ?>",
|
||||
|
||||
//Default language
|
||||
defaultLanguage: "en",
|
||||
|
||||
//LanguagesPath
|
||||
languagesPath: "<?php echo str_replace("%PATH_ASSETS%", config['pathAssets'], config['languagesPath']); ?>",
|
||||
};
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- Welcome message -->
|
||||
<div style="text-align: center; font-size: 150%; padding-top: 10%;">
|
||||
Welcome !<br />
|
||||
Bienvenue !<br /><br />
|
||||
|
||||
<img src="<?php echo config['pathAssets']; ?>img/roundProgress.gif" /><br /><br />
|
||||
|
||||
Please wait while Comunic is starting...<br />
|
||||
Veuillez patienter pendant le démarrage de Comunic...<br /><br />
|
||||
|
||||
|
||||
<p><small>If this screen doesn't disappear after a while, please check javascript is enabled in your browser...</small></p>
|
||||
</div>
|
||||
|
||||
<!-- 3rdparty Javascript files inclusion -->
|
||||
<?php
|
||||
foreach($config['3rdPartyJSfiles'] as $file){
|
||||
//Include JS file
|
||||
$file = str_replace("%PATH_ASSETS%", $config['pathAssets'], $file);
|
||||
echo javascriptFileInclusionCode($file);
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Application Javascript files inclusion -->
|
||||
<?php
|
||||
foreach($config['JSfiles'] as $file){
|
||||
//Include JS file
|
||||
$file = str_replace("%PATH_ASSETS%", $config['pathAssets'], $file);
|
||||
echo javascriptFileInclusionCode($file);
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
//Load the page
|
||||
echo load_page("dev");
|
||||
|
240
system/config/dev.config.php
Normal file
240
system/config/dev.config.php
Normal file
@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP dev config for the website
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
class Dev {
|
||||
|
||||
/**
|
||||
* Site URL
|
||||
*/
|
||||
const SITE_URL = "http://devweb.local/comunic/v2/";
|
||||
|
||||
/**
|
||||
* Site production mode
|
||||
*/
|
||||
const PROD_MODE = false;
|
||||
|
||||
/**
|
||||
* Path to assets
|
||||
*/
|
||||
const ASSETS_URL = "http://devweb.local/comunic/v2/assets/";
|
||||
|
||||
/**
|
||||
* Third party CSS files
|
||||
*/
|
||||
const THIRD_PARTY_CSS = array(
|
||||
//CSS files - adminLTE distribution / bootstrap / plugins
|
||||
"3rdparty/adminLTE/bootstrap/css/bootstrap.min.css",
|
||||
"3rdparty/adminLTE/plugins/font-awesome/css/font-awesome.min.css",
|
||||
"3rdparty/adminLTE/plugins/ionicons/css/ionicons.min.css",
|
||||
"3rdparty/adminLTE/plugins/iCheck/square/blue.css",
|
||||
"3rdparty/adminLTE/plugins/iCheck/flat/blue.css",
|
||||
"3rdparty/adminLTE/plugins/select2/select2.min.css",
|
||||
"3rdparty/adminLTE/dist/css/AdminLTE.min.css",
|
||||
"3rdparty/adminLTE/dist/css/skins/_all-skins.min.css",
|
||||
|
||||
//Light box
|
||||
"3rdparty/lightbox/ekko-lightbox.min.css"
|
||||
);
|
||||
|
||||
/**
|
||||
* Third party Javascript files
|
||||
*/
|
||||
const THIRD_PARTY_JS = array(
|
||||
//Jquery
|
||||
"3rdparty/adminLTE/plugins/jQuery/jquery-2.2.3.min.js",
|
||||
|
||||
//Bootstrap
|
||||
"3rdparty/adminLTE/bootstrap/js/bootstrap.min.js",
|
||||
|
||||
//JQuery UI
|
||||
"3rdparty/adminLTE/plugins/jquery-ui/jquery-ui.min.js",
|
||||
|
||||
//iCheck
|
||||
"3rdparty/adminLTE/plugins/iCheck/icheck.min.js",
|
||||
|
||||
//Slimscroll
|
||||
"3rdparty/adminLTE/plugins/slimScroll/jquery.slimscroll.min.js",
|
||||
|
||||
//Select2
|
||||
"3rdparty/adminLTE/plugins/select2/select2.min.js",
|
||||
|
||||
//adminLTE script
|
||||
"3rdparty/adminLTE/dist/js/app.min.js",
|
||||
|
||||
//Bootstrap notify
|
||||
"3rdparty/bootstrap-notify-3.1.3.min.js",
|
||||
|
||||
//Twitter emojies
|
||||
"3rdparty/twemoji/2/twemoji.min.js",
|
||||
|
||||
//Textarea auto-size
|
||||
"3rdparty/jquery.textarea_autosize/jquery.textarea_autosize.min.js",
|
||||
|
||||
//Light box
|
||||
"3rdparty/lightbox/ekko-lightbox.min.js",
|
||||
);
|
||||
|
||||
/**
|
||||
* Application CSS files
|
||||
*/
|
||||
const APP_CSS = array(
|
||||
//App stylesheets - common stylesheets
|
||||
"css/common/global.css",
|
||||
"css/common/page/waitSplashScreen.css",
|
||||
"css/common/network/networkError.css",
|
||||
|
||||
//Components stylesheets
|
||||
//Menubar stylesheet
|
||||
"css/components/menuBar.css",
|
||||
|
||||
//Searchform stylesheet
|
||||
"css/components/searchForm.css",
|
||||
|
||||
//Friendbar stylesheet
|
||||
"css/components/friends/friendsBar.css",
|
||||
|
||||
//Conversations stylesheet
|
||||
"css/components/conversations/manager.css",
|
||||
"css/components/conversations/windows.css",
|
||||
"css/components/conversations/list.css",
|
||||
|
||||
//User selector stylesheet
|
||||
"css/components/userSelect/userSelect.css",
|
||||
|
||||
//Emojies
|
||||
"css/components/emoji/parser.css",
|
||||
|
||||
//Posts component
|
||||
"css/components/posts/ui.css",
|
||||
|
||||
//Pages stylesheets
|
||||
//User Page
|
||||
"css/pages/userPage/main.css",
|
||||
"css/pages/userPage/accessForbidden.css",
|
||||
);
|
||||
|
||||
/**
|
||||
* Application JS files
|
||||
*/
|
||||
const APP_JS = array(
|
||||
|
||||
//Utilities
|
||||
"js/common/utils.js",
|
||||
|
||||
//Functions schema
|
||||
"js/common/functionsSchema.js",
|
||||
|
||||
//Pages list
|
||||
"js/pagesList.js",
|
||||
|
||||
|
||||
//App scripts -- common scripts
|
||||
"js/common/cacheManager.js",
|
||||
"js/common/network.js",
|
||||
"js/common/api.js",
|
||||
"js/common/errors.js",
|
||||
"js/common/messages.js",
|
||||
"js/common/langs.js",
|
||||
"js/common/url.js",
|
||||
"js/common/jsFiles.js",
|
||||
"js/common/debug.js",
|
||||
"js/common/page.js",
|
||||
"js/common/notifications.js",
|
||||
"js/common/formChecker.js",
|
||||
"js/common/date.js",
|
||||
"js/common/system.js",
|
||||
|
||||
//Default langage
|
||||
"js/langs/en.inc.js",
|
||||
|
||||
//Components
|
||||
//Mail caching
|
||||
"js/components/mailCaching.js",
|
||||
|
||||
//Search form
|
||||
"js/components/searchForm/searchForm.js",
|
||||
|
||||
//Main menubar
|
||||
"js/components/menuBar/common.js",
|
||||
"js/components/menuBar/notAuthenticated.js",
|
||||
"js/components/menuBar/authenticated.js",
|
||||
|
||||
//Friends components
|
||||
"js/components/friends/friendsList.js",
|
||||
"js/components/friends/friendsBar.js",
|
||||
|
||||
//Private conversations
|
||||
"js/components/conversations/manager.js",
|
||||
"js/components/conversations/list.js",
|
||||
"js/components/conversations/windows.js",
|
||||
"js/components/conversations/chatWindows.js",
|
||||
"js/components/conversations/interface.js",
|
||||
"js/components/conversations/service.js",
|
||||
"js/components/conversations/cachingOpened.js",
|
||||
"js/components/conversations/utils.js",
|
||||
|
||||
//User selector
|
||||
"js/components/userSelect/userSelect.js",
|
||||
|
||||
//Emojies
|
||||
"js/components/emoji/parser.js",
|
||||
"js/components/emoji/list.js",
|
||||
|
||||
//Like button
|
||||
"js/components/like/button.js",
|
||||
"js/components/like/interface.js",
|
||||
|
||||
//Posts component
|
||||
"js/components/posts/interface.js",
|
||||
"js/components/posts/ui.js",
|
||||
|
||||
//Modern textarea handler
|
||||
"js/components/textarea.js",
|
||||
|
||||
//User scripts
|
||||
"js/user/loginTokens.js",
|
||||
"js/user/userLogin.js",
|
||||
"js/user/userInfos.js",
|
||||
|
||||
|
||||
//Pages scripts
|
||||
//Home page
|
||||
"js/pages/home/home.js",
|
||||
"js/pages/home/landingPage.js",
|
||||
|
||||
//User page
|
||||
"js/pages/userPage/main.js",
|
||||
"js/pages/userPage/accessForbidden.js",
|
||||
"js/pages/userPage/friendshipStatus.js",
|
||||
"js/pages/userPage/profileInfos.js",
|
||||
"js/pages/userPage/posts.js",
|
||||
|
||||
//Login page
|
||||
"js/pages/login.js",
|
||||
|
||||
//Logout page
|
||||
"js/pages/logout.js",
|
||||
|
||||
//Create shortcuts for common functions
|
||||
"js/common/shorcuts.js",
|
||||
"js/common/helpers.js",
|
||||
|
||||
//Init script
|
||||
"js/init.js",
|
||||
);
|
||||
|
||||
/**
|
||||
* Language settings
|
||||
*/
|
||||
const LANGUAGE_PATH = "js/langs/";
|
||||
const DEFAULT_LANGUAGE = "en";
|
||||
|
||||
/**
|
||||
* Templates settings
|
||||
*/
|
||||
const TEMPLATES_PATH = "templates/";
|
||||
}
|
22
system/config/global.config.php
Normal file
22
system/config/global.config.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Project main config page (common properties)
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
class Config {
|
||||
|
||||
/**
|
||||
* Application version
|
||||
*/
|
||||
const VERSION = "0.1";
|
||||
|
||||
/**
|
||||
* API access and credentials
|
||||
*/
|
||||
const API_URL = "http://devweb.local/comunic/api/";
|
||||
const API_SERVICE_NAME = "ComunicWeb";
|
||||
const API_SERVICE_TOKEN = "12XU67pJUlnNQ";
|
||||
|
||||
}
|
141
system/system.php
Normal file
141
system/system.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* Page initiator
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include main config
|
||||
*/
|
||||
require_once __DIR__."/config/global.config.php";
|
||||
|
||||
/**
|
||||
* Load a page
|
||||
*
|
||||
* @param string $config The configuration to use to load a page
|
||||
* @return string Generated source page
|
||||
*/
|
||||
function load_page(string $config) : string{
|
||||
|
||||
//Load configuration
|
||||
require __DIR__."/config/".$config.".config.php";
|
||||
$conf = new $config();
|
||||
|
||||
//Load page template
|
||||
$source = file_get_contents(__DIR__."/tpl/page.tpl");
|
||||
|
||||
//Replace path to assets when required
|
||||
$source = str_replace("{ASSETS_URL}", $config::ASSETS_URL, $source);
|
||||
|
||||
//Update javascript config
|
||||
$source = str_replace("{js_config}", get_javascript_config($conf), $source);
|
||||
|
||||
//Update assets inclusion
|
||||
$source = str_replace("{THIRD_PARTY_CSS}", src_inc_list_css($conf::ASSETS_URL, $conf::THIRD_PARTY_CSS), $source);
|
||||
$source = str_replace("{APP_CSS}", src_inc_list_css($conf::ASSETS_URL, $conf::APP_CSS), $source);
|
||||
$source = str_replace("{THIRD_PARTY_JS}", src_inc_list_js($conf::ASSETS_URL, $conf::THIRD_PARTY_JS), $source);
|
||||
$source = str_replace("{APP_JS}", src_inc_list_js($conf::ASSETS_URL, $conf::APP_JS), $source);
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get javascript configuration
|
||||
*
|
||||
* @param object $config The configuration object
|
||||
* @return string The javascript configuration
|
||||
*/
|
||||
function get_javascript_config($config) : string {
|
||||
$js_config = "<script>
|
||||
|
||||
var ComunicConfig = {
|
||||
|
||||
//Production mode
|
||||
productionMode: ".($config::PROD_MODE ? "true" : "false").",
|
||||
|
||||
//AppVersion
|
||||
appVersion: '".Config::VERSION."',
|
||||
|
||||
//Assets URL
|
||||
assetsURL: '".$config::ASSETS_URL."',
|
||||
|
||||
//Templates URL
|
||||
templatesURL : '".$config::ASSETS_URL.$config::TEMPLATES_PATH."',
|
||||
|
||||
//Site URL
|
||||
siteURL: '".$config::SITE_URL."',
|
||||
|
||||
//API configuration
|
||||
apiURL: '".Config::API_URL."',
|
||||
apiServiceName: '".Config::API_SERVICE_NAME."',
|
||||
apiServiceToken: '".Config::API_SERVICE_TOKEN."',
|
||||
|
||||
//Default language
|
||||
defaultLanguage: '".$config::DEFAULT_LANGUAGE."',
|
||||
|
||||
//LanguagesPath
|
||||
languagesPath: '".$config::ASSETS_URL.$config::LANGUAGE_PATH."',
|
||||
|
||||
};
|
||||
|
||||
</script>";
|
||||
|
||||
return $js_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the source code to include an array of css assets
|
||||
*
|
||||
* @param string $asset_url URL path to assets
|
||||
* @param array $files The list of files to include
|
||||
* @return string Generated source code
|
||||
*/
|
||||
function src_inc_list_css(string $assets_url, array $files) : string {
|
||||
$source = "";
|
||||
|
||||
//Process the list of files
|
||||
foreach($files as $file){
|
||||
$source .= src_inc_css($assets_url.$file)."\n\t\t";
|
||||
}
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the source code to include an array of javascript assets
|
||||
*
|
||||
* @param string $asset_url URL path to assets
|
||||
* @param array $files The list of files to include
|
||||
* @return string Generated source code
|
||||
*/
|
||||
function src_inc_list_js(string $assets_url, array $files) : string {
|
||||
$source = "";
|
||||
|
||||
//Process the list of files
|
||||
foreach($files as $file){
|
||||
$source .= src_inc_js($assets_url.$file)."\n\t\t";
|
||||
}
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source code to include a javascript file
|
||||
*
|
||||
* @param string $file The path to the file
|
||||
* @return string Source code for including a javascript file
|
||||
*/
|
||||
function src_inc_js(string $file) : string{
|
||||
return "<script type='text/javascript' src='".$file."'></script>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source code to include a CSS file
|
||||
*
|
||||
* @param string $file Path to the CSS file
|
||||
* @return string HTML Source code to include the CSS file
|
||||
*/
|
||||
function src_inc_css(string $file) : string {
|
||||
return "<link rel='stylesheet' href='".$file."'>";
|
||||
}
|
55
system/tpl/page.tpl
Normal file
55
system/tpl/page.tpl
Normal file
@ -0,0 +1,55 @@
|
||||
<!--
|
||||
Comunic web app client
|
||||
Main HTML file
|
||||
|
||||
(c) Pierre HUBERT 2017
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Page title, should be automaticaly modified next -->
|
||||
<title>Comunic</title>
|
||||
|
||||
<!-- Make the website responsive -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
|
||||
<!-- UTF-8 support -->
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- Favicons -->
|
||||
<link rel="icon" type="image/vnd.microsoft.icon" href="{ASSETS_URL}img/favicon.png" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{ASSETS_URL}img/favicon.png" />
|
||||
|
||||
<!--3rdPary Stylesheet requirements -->
|
||||
{THIRD_PARTY_CSS}
|
||||
|
||||
<!--App Stylesheet requirements -->
|
||||
{APP_CSS}
|
||||
|
||||
<!-- Javascript config -->
|
||||
{js_config}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- Welcome message -->
|
||||
<div style="text-align: center; font-size: 150%; padding-top: 10%;">
|
||||
Welcome !<br />
|
||||
Bienvenue !<br /><br />
|
||||
|
||||
<img src="{ASSETS_URL}img/roundProgress.gif" /><br /><br />
|
||||
|
||||
Please wait while Comunic is starting...<br />
|
||||
Veuillez patienter pendant le démarrage de Comunic...<br /><br />
|
||||
|
||||
|
||||
<p><small>If this screen doesn't disappear after a while, please check javascript is enabled in your browser...</small></p>
|
||||
</div>
|
||||
|
||||
<!-- 3rdparty Javascript files inclusion -->
|
||||
{THIRD_PARTY_JS}
|
||||
|
||||
<!-- Application Javascript files inclusion -->
|
||||
{APP_JS}
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user