Explorar el Código

Merge pull request #500 from causefx/cero-dev

Cero dev
causefx hace 8 años
padre
commit
6fff8df6d8
Se han modificado 12 ficheros con 184 adiciones y 107 borrados
  1. 0 0
      bower_components/bootstrap/dist/css/bootstrap.min.css
  2. 1 0
      config/configDefaults.php
  3. 58 17
      functions.php
  4. 102 87
      homepage.php
  5. 1 0
      lang/de.ini
  6. 1 0
      lang/en.ini
  7. 1 0
      lang/es.ini
  8. 1 0
      lang/fr.ini
  9. 1 0
      lang/it.ini
  10. 1 0
      lang/nl.ini
  11. 1 0
      lang/pl.ini
  12. 16 3
      settings.php

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
bower_components/bootstrap/dist/css/bootstrap.min.css


+ 1 - 0
config/configDefaults.php

@@ -13,6 +13,7 @@ return array(
 	"plexHomeAuth" => false,
 	"plexSearch" => false,
 	"plexRecentItems" => "20",
+	"plexPlaylists" => "false",
 	"plexTabName" => "",
 	"embyURL" => "",
 	"embyToken" => "",

+ 58 - 17
functions.php

@@ -642,7 +642,7 @@ function resolveEmbyItem($address, $token, $item, $nowPlaying = false, $showName
 		$itemDetails['Overview'] = '';
 	}
     
-if (file_exists('images/cache/'.$key.'.jpg')){ $image_url = 'images/cache/'.$key.'.jpg'; }
+	if (file_exists('images/cache/'.$key.'.jpg')){ $image_url = 'images/cache/'.$key.'.jpg'; }
     if (file_exists('images/cache/'.$key.'.jpg') && (time() - 604800) > filemtime('images/cache/'.$key.'.jpg') || !file_exists('images/cache/'.$key.'.jpg')) {
         $image_url = 'ajax.php?a=emby-image&type='.$imageType.'&img='.$imageId.'&height='.$height.'&width='.$width.'&key='.$key.'';        
     }
@@ -657,12 +657,12 @@ if (file_exists('images/cache/'.$key.'.jpg')){ $image_url = 'images/cache/'.$key
     if(isset($useImage)){ $image_url = $useImage; }
 	
 	// Assemble Item And Cache Into Array     
-if($nowPlaying){
-    //prettyPrint($itemDetails);
-    return '<div class="col-sm-6 col-md-3"><div class="thumbnail ultra-widget"><div style="display: none;" np="'.$id.'" class="overlay content-box small-box gray-bg">'.$streamInfo.'</div><span class="w-refresh w-p-icon gray" link="'.$id.'"><span class="fa-stack fa-lg" style="font-size: .5em"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-info-circle fa-stack-1x fa-inverse"></i></span></span><a href="'.$URL.'" target="_blank"><img style="width: 500px; display:inherit;" src="'.$image_url.'" alt="'.$itemDetails['Name'].'"></a><div class="progress progress-bar-sm zero-m"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$watched.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$watched.'%"></div><div class="progress-bar palette-Grey-500 bg" style="width: 0%"></div></div><div class="caption"><i style="float:left" class="fa fa-'.$state.'"></i>'.$topTitle.''.$bottomTitle.'</div></div></div>';
+	if($nowPlaying){
+    	//prettyPrint($itemDetails);
+    	return '<div class="col-sm-6 col-md-3"><div class="thumbnail ultra-widget"><div style="display: none;" np="'.$id.'" class="overlay content-box small-box gray-bg">'.$streamInfo.'</div><span class="w-refresh w-p-icon gray" link="'.$id.'"><span class="fa-stack fa-lg" style="font-size: .5em"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-info-circle fa-stack-1x fa-inverse"></i></span></span><a href="'.$URL.'" target="_blank"><img style="width: 500px; display:inherit;" src="'.$image_url.'" alt="'.$itemDetails['Name'].'"></a><div class="progress progress-bar-sm zero-m"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="'.$watched.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$watched.'%"></div><div class="progress-bar palette-Grey-500 bg" style="width: 0%"></div></div><div class="caption"><i style="float:left" class="fa fa-'.$state.'"></i>'.$topTitle.''.$bottomTitle.'</div></div></div>';
     }else{
- return '<div class="item-'.$itemDetails['Type'].'"><a href="'.$URL.'" target="_blank"><img alt="'.$itemDetails['Name'].'" class="'.$image.'" data-lazy="'.$image_url.'"></a><small style="margin-right: 13px" class="elip">'.$title.'</small></div>';
-}
+		 return '<div class="item-'.$itemDetails['Type'].'"><a href="'.$URL.'" target="_blank"><img alt="'.$itemDetails['Name'].'" class="'.$image.'" data-lazy="'.$image_url.'"></a><small style="margin-right: 13px" class="elip">'.$title.'</small></div>';
+	}
 }
 
 // Format item from Plex for Carousel
@@ -881,9 +881,10 @@ function outputRecentAdded($header, $items, $script = false, $array) {
     $hideMenu .= '</ul></div></div>';
     // If None Populate Empty Item
     if (!count($items)) {
-        return '<div id=recentMedia><h5 class="text-center">'.$header.'</h5><p class="text-center">No Media Found</p></div>';
+        return '<div id="recentMedia" class="content-box box-shadow big-box"><h5 class="text-center">'.$header.'</h5><p class="text-center">No Media Found</p></div>';
     }else{
-        return '<div id=recentMedia><h5 style="margin-bottom: -20px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination">'.$hideMenu.'</div><br/><div class="recentItems">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
+		$className = str_replace(' ', '', $header);
+        return '<div id="recentMedia" class="content-box box-shadow big-box"><h5 style="margin-bottom: -20px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination '.$className.'">'.$hideMenu.'</div><br/><div class="recentItems" data-name="'.$className.'">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
     }
     
 }
@@ -2230,18 +2231,17 @@ function loadAppearance() {
 		if (!isset($GLOBALS['file_db'])) {
 			$GLOBALS['file_db'] = new PDO('sqlite:'.DATABASE_LOCATION.'users.db');
 			$GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-			// Database Lookup
-			$options = $GLOBALS['file_db']->query('SELECT * FROM options');
-			// Replace defaults with filled options
-			foreach($options as $row) {
-				foreach($defaults as $key => $value) {
-					if (isset($row[$key]) && $row[$key]) {
-						$defaults[$key] = $row[$key];
-					}
+		}
+		// Database Lookup
+		$options = $GLOBALS['file_db']->query('SELECT * FROM options');
+		// Replace defaults with filled options
+		foreach($options as $row) {
+			foreach($defaults as $key => $value) {
+				if (isset($row[$key]) && $row[$key]) {
+					$defaults[$key] = $row[$key];
 				}
 			}
 		}
-	
 	}
 
 	// Return the Results
@@ -2995,6 +2995,7 @@ function getPlatform($platform){
         "Emby Classic" => "emby.png",
         "Safari" => "safari.png",
         "Android" => "android.png",
+        "AndroidTv" => "android.png",
         "Chromecast" => "chromecast.png",
         "Dashboard" => "emby.png",
         "Dlna" => "dlna.png",
@@ -3600,6 +3601,46 @@ function tvdbGet($id){
 	return $api;
 }
 
+function getPlexPlaylists(){
+    $address = qualifyURL(PLEXURL);
+    
+	// Perform API requests
+    $api = @curl_get($address."/playlists?X-Plex-Token=".PLEXTOKEN);
+    $api = simplexml_load_string($api);
+	if (is_array($api) || is_object($api)){
+		if (!$api->head->title){
+			$getServer = simplexml_load_string(@curl_get($address."/?X-Plex-Token=".PLEXTOKEN));
+			if (!$getServer) { return 'Could not load!'; }
+			// Identify the local machine
+			$gotServer = $getServer['machineIdentifier'];
+			$output = "";
+			foreach($api AS $child) {
+				$items = "";
+				if($child['playlistType'] == "video"){
+					$api = @curl_get($address.$child['key']."?X-Plex-Token=".PLEXTOKEN);
+					$api = simplexml_load_string($api);
+					if (is_array($api) || is_object($api)){
+						if (!$api->head->title){
+							foreach($api->Video AS $child){
+								$items[] = resolvePlexItem($gotServer, PLEXTOKEN, $child, false, false,false);
+							}
+							if (count($items)) {
+								$className = str_replace(' ', '', $api['title']);
+								$output .= '<div id="playlist-'.$className.'" class="content-box box-shadow big-box"><h5 style="margin-bottom: -20px" class="text-center">'.$api['title'].'</h5><div class="recentHeader inbox-pagination '.$className.'"></div><br/><div class="recentItems" data-name="'.$className.'">'.implode('',$items).'</div></div>';
+							}							
+						}
+					}
+				}
+			}
+			return $output;
+		}else{
+			writeLog("error", "PLEX PLAYLIST ERROR: could not connect - check token - if HTTPS, is cert valid");
+		}
+	}else{
+		writeLog("error", "PLEX PLAYLIST ERROR: could not connect - check URL - if HTTPS, is cert valid");
+	}
+}
+
 function orgEmail($header = "Message From Admin", $title = "Important Message", $user = "Organizr User", $mainMessage = "", $button = null, $buttonURL = null, $subTitle = "", $subMessage = ""){
 	$path = getServerPath();
 	return '

+ 102 - 87
homepage.php

@@ -19,7 +19,7 @@ qualifyUser(HOMEPAGEAUTHNEEDED, true);
 
 // Load Colours/Appearance
 foreach(loadAppearance() as $key => $value) {
-	$$key = $value;
+	${$key} = $value;
 }
 
 $startDate = date('Y-m-d',strtotime("-".CALENDARSTARTDAY." days"));
@@ -444,7 +444,17 @@ $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
                     ?>
                     </div>
                 </div>
-				<?php } ?>
+                <div id="plexPlaylists" class="row">
+                    <div class="col-lg-12">
+                    <?php
+                    if(PLEXPLAYLISTS == "true"){  
+                        echo getPlexPlaylists($plexArray);
+                    } 
+                    ?>
+                    </div>
+                </div>
+                <?php } ?>
+    
 				<?php if (qualifyUser(EMBYHOMEAUTH) && EMBYTOKEN) { ?>
                 <div id="embyRowNowPlaying" class="row">
                     <?php if(EMBYPLAYINGNOW == "true"){ echo getEmbyStreams(12, EMBYSHOWNAMES, $USER->role); } ?>
@@ -564,91 +574,96 @@ $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
                 var id = $(this).attr("link");
                 $("div[np^='"+id+"']").toggle();
             });
-     
-            $('.recentItems').slick({
-              
-                slidesToShow: 13,
-                slidesToScroll: 13,
-                infinite: true,
-                lazyLoad: 'ondemand',
-                prevArrow: '<a class="zero-m pull-left prev-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-left"></i></a>',
-                nextArrow: '<a class="pull-left next-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-right"></i></a>',
-                appendArrows: '.recentHeader',
-                responsive: [
-                {
-                  breakpoint: 1750,
-                  settings: {
-                    slidesToShow: 12,
-                    slidesToScroll: 12,
-                  }
-                },
-                {
-                  breakpoint: 1600,
-                  settings: {
-                    slidesToShow: 11,
-                    slidesToScroll: 11,
-                  }
-                },
-                {
-                  breakpoint: 1450,
-                  settings: {
-                    slidesToShow: 10,
-                    slidesToScroll: 10,
-                  }
-                },
-                {
-                  breakpoint: 1300,
-                  settings: {
-                    slidesToShow: 9,
-                    slidesToScroll: 9,
-                  }
-                },
-                {
-                  breakpoint: 1150,
-                  settings: {
-                    slidesToShow: 8,
-                    slidesToScroll: 8,
-                  }
-                },
-                {
-                  breakpoint: 1000,
-                  settings: {
-                    slidesToShow: 7,
-                    slidesToScroll: 7,
-                  }
-                },
-                {
-                  breakpoint: 850,
-                  settings: {
-                    slidesToShow: 6,
-                    slidesToScroll: 6,
-                  }
-                },
-                {
-                  breakpoint: 700,
-                  settings: {
-                    slidesToShow: 5,
-                    slidesToScroll: 5,
-                  }
-                },
-                {
-                  breakpoint: 675,
-                  settings: {
-                    slidesToShow: 4,
-                    slidesToScroll: 4
-                  }
-                },
-                {
-                  breakpoint: 480,
-                  settings: {
-                    slidesToShow: 3,
-                    slidesToScroll: 3
-                  }
-                }
-                // You can unslick at a given breakpoint now by adding:
-                // settings: "unslick"
-                // instead of a settings object
-              ]
+
+            $('.recentItems').each(function() {
+                var name = $(this).attr("data-name");
+                console.log(name);
+                $(this).slick({
+                
+                    slidesToShow: 13,
+                    slidesToScroll: 13,
+                    infinite: true,
+                    lazyLoad: 'ondemand',
+                    prevArrow: '<a class="zero-m pull-left prev-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-left"></i></a>',
+                    nextArrow: '<a class="pull-left next-mail btn btn-default waves waves-button btn-sm waves-effect waves-float"><i class="fa fa-angle-right"></i></a>',
+                    appendArrows: $('.'+name),
+                    arrows: true,
+                    responsive: [
+                    {
+                    breakpoint: 1750,
+                    settings: {
+                        slidesToShow: 12,
+                        slidesToScroll: 12,
+                    }
+                    },
+                    {
+                    breakpoint: 1600,
+                    settings: {
+                        slidesToShow: 11,
+                        slidesToScroll: 11,
+                    }
+                    },
+                    {
+                    breakpoint: 1450,
+                    settings: {
+                        slidesToShow: 10,
+                        slidesToScroll: 10,
+                    }
+                    },
+                    {
+                    breakpoint: 1300,
+                    settings: {
+                        slidesToShow: 9,
+                        slidesToScroll: 9,
+                    }
+                    },
+                    {
+                    breakpoint: 1150,
+                    settings: {
+                        slidesToShow: 8,
+                        slidesToScroll: 8,
+                    }
+                    },
+                    {
+                    breakpoint: 1000,
+                    settings: {
+                        slidesToShow: 7,
+                        slidesToScroll: 7,
+                    }
+                    },
+                    {
+                    breakpoint: 850,
+                    settings: {
+                        slidesToShow: 6,
+                        slidesToScroll: 6,
+                    }
+                    },
+                    {
+                    breakpoint: 700,
+                    settings: {
+                        slidesToShow: 5,
+                        slidesToScroll: 5,
+                    }
+                    },
+                    {
+                    breakpoint: 675,
+                    settings: {
+                        slidesToShow: 4,
+                        slidesToScroll: 4
+                    }
+                    },
+                    {
+                    breakpoint: 480,
+                    settings: {
+                        slidesToShow: 3,
+                        slidesToScroll: 3
+                    }
+                    }
+                    // You can unslick at a given breakpoint now by adding:
+                    // settings: "unslick"
+                    // instead of a settings object
+                ]
+                });
             });
             
             var movieFiltered = false;

+ 1 - 0
lang/de.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/en.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/es.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/fr.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/it.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/nl.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 1 - 0
lang/pl.ini

@@ -305,3 +305,4 @@ EMAIL_NEWUSER_MESSAGE = "Welcome, to my website.  I have many things here... man
 EMAIL_NEWUSER_BUTTON = "Login"
 EMAIL_NEWUSER_SUBTITLE = "What do I do?"
 EMAIL_NEWUSER_SUBMESSAGE = "Now that you have signed up, you can basically do whatever you like.  Enjoy"
+PLAYLISTS = "Playlists"

+ 16 - 3
settings.php

@@ -55,7 +55,7 @@ if(SLIMBAR == "true") {
 
         <title>Settings</title>
 
-        <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
+        <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css?v=<?php echo INSTALLEDVERSION; ?>">
         <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
         <link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css">
         <link rel="stylesheet" href="bower_components/metisMenu/dist/metisMenu.min.css">
@@ -146,7 +146,7 @@ if(SLIMBAR == "true") {
 				});
 				$element.appendTo('#submitTabs ul');
 				$element.find('.icp-auto-pend').iconpicker({placement: 'left', hideOnSelect: false, collision: true}).hide();
-    $('.tab-box').scrollTop($('.tab-box')[0].scrollHeight);
+                $('.tab-box').scrollTop($('.tab-box')[0].scrollHeight);
 			}
 			function submitTabs(form) {
 				var formData = {};
@@ -653,6 +653,11 @@ $userTypes = array(
 	'User' => 'user|admin',
 	'Admin' => 'admin',
 );
+$branchTypes = array(
+	'Master' => 'master',
+	'Develop' => 'develop',
+	'Pre-Develop' => 'cero-dev',
+);
 
 // Build Homepage Settings
 echo buildSettings(
@@ -763,6 +768,12 @@ echo buildSettings(
 							'name' => 'plexRecentMusic',
 							'value' => PLEXRECENTMUSIC,
 						),
+                        array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'PLAYLISTS',
+							'name' => 'plexPlaylists',
+							'value' => PLEXPLAYLISTS,
+						),
 						array(
 							'type' => 'checkbox',
 							'labelTranslate' => 'PLAYING_NOW',
@@ -1337,12 +1348,13 @@ echo buildSettings(
 						'value' => IPINFOTOKEN,
 					),
 					array(
-						'type' => 'text',
+						'type' => 'select',
 						'labelTranslate' => 'GIT_BRANCH',
 						'placeholder' => 'Default: \'master\' - Development: \'develop\' OR \'cero-dev\'',
 						'id' => 'git_branch_id',
 						'name' => 'git_branch',
 						'value' => GIT_BRANCH,
+                        'options' => $branchTypes,
 					),
 					array(
 						array(
@@ -1354,6 +1366,7 @@ echo buildSettings(
 						array(
 							'type' => 'button',
 							'id' => 'gitForceInstall',
+                            'style' => (extension_loaded("ZIP")) ? "" : "display : none",
 							'labelTranslate' => 'GIT_FORCE',
 							'icon' => 'gear',
 							'onclick' => 'if ($(\'#git_branch_id[data-changed]\').length) { alert(\'Branch was altered, save settings first!\') } else { if (confirm(\''.translate('GIT_FORCE_CONFIRM').'\')) { performUpdate(); ajax_request(\'POST\', \'forceBranchInstall\'); } }',

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio