Browse Source

more fixes

causefx 8 years ago
parent
commit
bc57c64149
4 changed files with 33 additions and 7 deletions
  1. 26 0
      chatjs.php
  2. 1 0
      functions.php
  3. 3 4
      homepage.php
  4. 3 3
      index.php

+ 26 - 0
chatjs.php

@@ -4,6 +4,23 @@ $USER = new User("registration_callback");
 $userpic = md5( strtolower( trim( $USER->email ) ) );
 header("Content-type: application/javascript");
 ?>
+function dblDigit(d) {
+    if (d < 10) { d = "0" + d;}
+    return d;
+}
+function formatAMPM(date) {
+  var hours = date.getHours();
+  var minutes = date.getMinutes();
+  var month = dblDigit(date.getMonth() + 1);
+  var day = dblDigit(date.getDate());
+  var ampm = hours >= 12 ? 'P' : 'A';
+  hours = hours % 12;
+  hours = hours ? hours : 12; // the hour '0' should be '12'
+  hours = dblDigit(hours);
+  minutes = minutes < 10 ? '0'+minutes : minutes;
+  var strTime = month + '-' + day + ' ' + hours + ':' + minutes + '' + ampm;
+  return strTime;
+}
 var isMobile = false; //initiate as false
 var d = new Date();
 var timezone = d.getTimezoneOffset();
@@ -602,6 +619,15 @@ $(document).ready(function()
                                         toscroll.scrollTop = toscroll.scrollHeight;
                                         $(".box").animate({ scrollTop: $('.box').prop("scrollHeight")}, 0);
                                         newcontent = content.html();
+                                        $(function(){
+                                            $('.chat-timestamp').each(function(){
+                                                var $this = $(this).attr('time');
+                                                var dateVal = new Date($this+' UTC');
+                                                var dateString = dateVal.toLocaleString();
+                                                $(this).text(formatAMPM(dateVal)); 
+                                                //console.log(formatAMPM(dateVal));
+                                            });
+                                        });
                                     }
                                     
                                     // new message tab alert

+ 1 - 0
functions.php

@@ -255,6 +255,7 @@ else :
 endif;
 // ==== Auth Plugins END ====
 // ==== General Class Definitions START ====
+$userLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : "en";
 class setLanguage { 
     private $language = null;
 	   private $langCode = null;

+ 3 - 4
homepage.php

@@ -7,7 +7,6 @@ ini_set("error_reporting", E_ALL | E_STRICT);
 
 require_once("user.php");
 require_once("functions.php");
-
 $USER = new User("registration_callback");
 
 // Check if connection to homepage is allowed
@@ -527,7 +526,7 @@ foreach(loadAppearance() as $key => $value) {
                     if( data.trakt ) {               
                         $.ajax({
                             type: 'GET',
-                            url: 'https://api.themoviedb.org/3/'+Type+'/'+data.trakt.tmdb+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits',
+                            url: 'https://api.themoviedb.org/3/'+Type+'/'+data.trakt.tmdb+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits&language=<?php echo $userLanguage; ?>',
                             cache: true,
                             async: true,
                             complete: function(xhr, status) {
@@ -993,7 +992,7 @@ foreach(loadAppearance() as $key => $value) {
                         if( data.trakt ) {                        
                             $.ajax({
                                 type: 'GET',
-                                url: 'https://api.themoviedb.org/3/tv/'+data.trakt.tmdb+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits',
+                                url: 'https://api.themoviedb.org/3/tv/'+data.trakt.tmdb+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits&language=<?php echo $userLanguage; ?>',
                                 cache: true,
                                 async: true,
                                 complete: function(xhr, status) {
@@ -1034,7 +1033,7 @@ foreach(loadAppearance() as $key => $value) {
                     var type = "MOVIE";
                     $.ajax({
                         type: 'GET',
-                        url: 'https://api.themoviedb.org/3/movie/'+ID+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits',
+                        url: 'https://api.themoviedb.org/3/movie/'+ID+'?api_key=83cf4ee97bb728eeaf9d4a54e64356a1&append_to_response=videos,credits&language=<?php echo $userLanguage; ?>',
                         cache: true,
                         async: true,
                         complete: function(xhr, status) {

+ 3 - 3
index.php

@@ -1134,7 +1134,7 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 									</div>
 
 									<div id="chat-users-div" class="col-lg-12 gray-bg" style="display: none;">
-										<div class="gray-bg"  style="overflow: hidden; width: auto; height: calc(100vh - 62px) !important;">
+										<div class="gray-bg"  style="overflow: hidden; width: auto; height: calc(100vh - 62px);">
 											<br>
 											<div class="content-box">
 												<div class="content-title big-box i-block gray-bg">
@@ -1258,7 +1258,7 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 									<!-- END EDIT USER -->
 									<!--EDIT USER -->
 									<div id="user-users-div" class="col-lg-12 gray-bg" style="display: none;">
-										<div class="gray-bg"  style="overflow: hidden; width: auto; height: calc(100vh - 62px) !important;">
+										<div class="gray-bg"  style="overflow: hidden; width: auto; height: calc(100vh - 62px);">
 											<br>
 											<div class="content-box">
 												<div class="content-title big-box i-block gray-bg">
@@ -1504,7 +1504,7 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 					// Interval Loads
 					setInterval(function() {
 						pingTab<?php echo $pingCount;?>();
-						console.log("ping check for tab[<?php echo $pingCount;?>] complete");
+						//console.log("ping check for tab[<?php echo $pingCount;?>] complete");
 					}, <?php echo $pingTimer; ?>);
 
 				<?php $pingCount++; }