Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. error_reporting( E_ALL );
  3. require_once('settings.php');
  4. require_once( __DIR__ . '/php/host_timezone.php'); // PHP must use the host's local time zone
  5. require_once('defines.php');
  6. // SET DATA CONNECTION AND GLOBAL USER VARIABLES
  7. /*
  8. $TT_123 = explode( '.', PHP_VERSION );
  9. if( $TT_123[0] == '4' ){
  10. require_once( 'php/db/MySQL_class.php' );
  11. $DATABASE = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword);
  12. } elseif( $TT_123[0] > '4' ){
  13. require_once( 'php/db/MySQLi_class.php' );
  14. $DATABASE = new MySQLi_DB($DBHost, $DBName, $DBUser, $DBPassword);
  15. } else {
  16. exit();
  17. };
  18. */
  19. require_once( 'php/db/SQLite_Class.php');
  20. $DATABASE = new SQLite_DB( $SYSPath . '/lib/controller/data/mysqlitedb.db');
  21. $str = @file_get_contents('/proc/uptime');
  22. $num = floatval($str);
  23. $secs = fmod($num, 60); $num = (int)($num / 60);
  24. $mins = $num % 60; $num = (int)($num / 60);
  25. $hours = $num % 24; $num = (int)($num / 24);
  26. $days = $num;
  27. if( !$DATABASE->isConnected && $secs > 120 ) {
  28. header( 'location: /setup/');
  29. exit();
  30. };
  31. //$DATABASE->SetCacheDir( $DBCacheDir );
  32. session_start();
  33. require_once('php/db/logio_class.php');
  34. $LOG = new Logio( LOG_LVL_ALL );
  35. require_once('php/db/user_class.php');
  36. require_once('php/auth/web.php');
  37. //require_once('php/db/language_class.php');
  38. require_once('php/db/language_json_class.php');
  39. //require_once('php/sys/SYSTEM_functions.php');
  40. require_once('php/ui/UI_functions.php');
  41. //require_once('php/web/WEB_functions.php');
  42. if( isset($_GET['Lang']) ){
  43. $UCL=intval( $_GET['Lang'] );
  44. if( $UCL == 0 ) $UCL = 1;
  45. if( ( $UserLang != $UCL ) && ( $UserID > 1 ) ){
  46. $QS = "UPDATE `users` SET `language`={$UCL} WHERE `id`={$UserID}";
  47. $DATABASE->Query( $QS );
  48. };
  49. header( 'location: /' );
  50. exit();
  51. };
  52. $Labels=new Language_json( $SYSPath . '/lib/'.$UserLang.'.json');
  53. if( $UserLang == 3 || $UserLang == 255 ){
  54. $RTL_SITE = true;
  55. } else {
  56. $RTL_SITE = false;
  57. };
  58. ?>