Просмотр исходного кода

Merge pull request #619 from causefx/cero-dev

Cero dev
causefx 8 лет назад
Родитель
Сommit
686cc0aa46
5 измененных файлов с 59 добавлено и 10 удалено
  1. 26 0
      chatjs.php
  2. 1 0
      functions.php
  3. 3 4
      homepage.php
  4. 3 3
      index.php
  5. 26 3
      settings.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++; }

+ 26 - 3
settings.php

@@ -42,6 +42,10 @@ if(SLIMBAR == "true") {
 	$slimBar = "56"; 
 	$userSize = "40"; 
 }
+//Theme Info
+$themeName = (!empty(INSTALLEDTHEME) ? explode("-", INSTALLEDTHEME)[0] : null);
+$themeVersion = (!empty(INSTALLEDTHEME) ? explode("-", INSTALLEDTHEME)[1] : null);
+
 ?>
 
 <!DOCTYPE html>
@@ -764,6 +768,11 @@ echo buildSettings(
 					array(
 						'type' => 'header',
 						'label' => 'Custom CSS',
+                    ),
+                    array(
+                        'type' => 'header',
+                        'class' => 'themeHeader',
+						'label' => (empty(INSTALLEDTHEME)?'Installed Theme: No Theme Installed':'Installed Theme: '.INSTALLEDTHEME),
 					),
 					array(
 						'type' => 'textarea',
@@ -3458,7 +3467,8 @@ echo buildSettings(
                         cssTab = $("a[href^='#tab-theme_css']");
                         cssTab.trigger("click");
                         $('#customCSS_id').text(github);
-                        $('#installedTheme').val(type);
+                        $('#installedTheme').val('');
+                        $("#installedTheme").attr('data-changed', 'true');
                         swal({
                             title: "Loaded Layer#Cake "+type,
                             text: '<h2>Awesome Sauce!</h2><p>Now that you have enabled Layer#Cake, edit the colors here and then hit Save at the top right.<blockquote class="blockquote-reverse"><p>Layer#Cake is powered and brought to you by:</p><footer>Hackerman - <cite title="Source Title">Leram</cite></footer></blockquote>',
@@ -3484,13 +3494,25 @@ echo buildSettings(
                                 countThemes = i;
                                 file = v.name.split("-");
 								preview = v.name.split(".");
-								preview = preview[0].substring(0, preview[0].length -2);
+								preview = preview[0].substring(4, preview[0].length -2).split("-");
 								version = file[3].split(".");
 								version = version[0]+'.'+version[1];
 								fileName = file[1];
                                 fileOrder = file[0];
                                 fileAuthor = file[2];
-                                $(themeList).append('<li><a preview="'+preview+'.png" name="'+fileName+'" version="'+version+'" file="'+v.name+'" path="'+v.path+'" order="'+fileOrder+'" author="'+fileAuthor+'" id="LC-'+fileName+'">'+fileName+' v'+version+'</a></li>');
+                                if(fileName == '<?php echo $themeName; ?>'){
+                                    if(version !== '<?php echo $themeVersion; ?>'){
+                                        //update available
+                                        info = '<p class="pull-right"><span class="label label-primary">Update Available</span></p>';
+
+                                    }else{
+                                        //no update available
+                                        info = '<p class="pull-right"><span class="label label-success">Installed</span></p>';
+                                    }
+                                }else{
+                                    info = '';
+                                }
+                                $(themeList).append('<li><a preview="'+preview[0]+'.png" name="'+fileName+'" check="'+fileName+'-'+version+'" version="'+version+'" file="'+v.name+'" path="'+v.path+'" order="'+fileOrder+'" author="'+fileAuthor+'" id="LC-'+fileName+'">'+fileName+' v'+version+' '+info+'</a></li>');
                             }
                         });
                         console.log(countThemes);
@@ -3511,6 +3533,7 @@ echo buildSettings(
                         $('#customCSS_id').text(github);
 						$("#customCSS_id").attr('data-changed', 'true');
 						$('#installedTheme').val(theme);
+						$('.themeHeader').text('Installed Theme: '+theme);
 						$("#installedTheme").attr('data-changed', 'true');
                         swal({
                             title: "Loaded Theme: "+name,