Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jappix/jappix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanaryon <Vanaryon@6385bf5c-453f-4a1d-ac06-b509b7c32dfb>2010-10-28 13:39:03 +0400
committerVanaryon <Vanaryon@6385bf5c-453f-4a1d-ac06-b509b7c32dfb>2010-10-28 13:39:03 +0400
commit9295524d666da12d4fde7684e210b2e588defc2e (patch)
treea865185b94d452d9fa8424a0ce4c91e9614d6745 /index.php
SVN tree moved to a trunk/tags/branches one.
git-svn-id: http://svn.codingteam.net/jappix/trunk@505 6385bf5c-453f-4a1d-ac06-b509b7c32dfb
Diffstat (limited to 'index.php')
-rw-r--r--index.php87
1 files changed, 87 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100644
index 00000000..66a08ce7
--- /dev/null
+++ b/index.php
@@ -0,0 +1,87 @@
+<?php
+
+/*
+
+Jappix - An open social platform
+This is the Jappix PHP application launcher
+
+~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+
+License: AGPL
+Author: Valérian Saliou
+Contact: http://project.jappix.com/contact
+Last revision: 27/10/10
+
+*/
+
+// Get the function files
+require_once('./php/functions.php');
+
+// Get the configuration
+define('PHP_BASE', '.');
+require_once('./php/read-main.php');
+require_once('./php/read-hosts.php');
+
+// Get some extra-libs
+require_once('./php/gettext.php');
+require_once('./php/mobile-detect.php');
+$mobile = new Mobile_Detect();
+
+// Optimize the page rendering
+hideErrors();
+gzipThis();
+
+// Include the good language file
+$locale = checkLanguage();
+includeTranslation($locale, 'main', '.');
+
+// Get the Jappix version & its hash
+$version = getVersion();
+$hash = genHash($version);
+
+// Include the good application file
+$include_app = 'desktop';
+
+// Not yet installed?
+if(!isInstalled())
+ $include_app = 'install';
+
+// Anonymous?
+else if(anonymousMode())
+ $include_app = 'desktop';
+
+// Not anonymous, any forced mode?
+else if(isset($_GET['m']) && !empty($_GET['m'])) {
+ $force_mode = $_GET['m'];
+
+ // Switch between two Jappix apps
+ if(($force_mode == 'desktop') || ($force_mode == 'mobile')) {
+ // Write the cookie
+ setcookie('jappix_mode', $force_mode, (time() + 31536000));
+
+ // Define the app to include
+ $include_app = $force_mode;
+ }
+
+ else if($force_mode == 'manager')
+ $include_app = $force_mode;
+}
+
+// Not forced, any cookie stored?
+else if(isset($_COOKIE['jappix_mode'])) {
+ if($_COOKIE['jappix_mode'] == 'mobile')
+ $include_app = 'mobile';
+}
+
+// No cookie, is this a mobile app?
+else if($mobile -> isMobile())
+ $include_app = 'mobile';
+
+// Include it!
+include('./php/'.$include_app.'.php');
+
+// Save this visit (for the stats)
+if(($include_app == 'desktop') || ($include_app == 'mobile'))
+ writeVisit();
+
+?>