فهرست منبع

Lots of changes

causefx 8 سال پیش
والد
کامیت
acf2a7adf4
7فایلهای تغییر یافته به همراه873 افزوده شده و 327 حذف شده
  1. 8 2
      ajax.php
  2. 0 1
      chat.php
  3. 407 96
      functions.php
  4. 197 11
      homepage.php
  5. 1 1
      index.php
  6. 250 213
      settings.php
  7. 10 3
      user.php

+ 8 - 2
ajax.php

@@ -44,7 +44,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
 				break;
 			case 'plex-streams':
 				qualifyUser(PLEXHOMEAUTH, true);
-				echo getPlexStreams(12);
+				echo getPlexStreams(12, "true");
 				die();
 				break;
 			case 'emby-recent':
@@ -54,7 +54,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
 				break;
 			case 'plex-recent':
 				qualifyUser(PLEXHOMEAUTH, true);
-				echo getPlexRecent($_GET['type'], 12);
+				echo getPlexRecent(array("movie" => PLEXRECENTMOVIE, "season" => PLEXRECENTTV, "album" => PLEXRECENTMUSIC));
 				die();
 				break;
 			case 'sabnzbd-update':
@@ -75,6 +75,9 @@ switch ($_SERVER['REQUEST_METHOD']) {
 		// Check if the user is an admin and is allowed to commit values
 		qualifyUser('admin', true);
 		switch ($action) {
+   case 'check-url':
+				sendResult(frameTest($_POST['checkurl']), "flask", $_POST['checkurl'], "IFRAME_CAN_BE_FRAMED", "IFRAME_CANNOT_BE_FRAMED");
+				break;
 			case 'upload-images':
 				uploadFiles('images/', array('jpg', 'png', 'svg', 'jpeg', 'bmp'));
 				sendNotification(true);
@@ -117,6 +120,9 @@ switch ($_SERVER['REQUEST_METHOD']) {
 			case 'deleteLog':
 				sendNotification(unlink(FAIL_LOG));
 				break;
+   case 'deleteOrgLog':
+				sendNotification(unlink("org.log"));
+				break;
 			case 'submit-tabs':
 				$response['notify'] = sendNotification(updateTabs($_POST) , false, false);
 				$response['show_apply'] = true;

+ 0 - 1
chat.php

@@ -1,6 +1,5 @@
 <?php
 
-
 $data = false;
 
 ini_set("display_errors", 1);

+ 407 - 96
functions.php

@@ -31,10 +31,13 @@ if (function_exists('ldap_connect')) :
 		// returns true or false
 		$ldap = ldap_connect(implode(' ',$ldapServers));
 		if ($bind = ldap_bind($ldap, AUTHBACKENDDOMAIN.'\\'.$username, $password)) {
+   writeLog("success", "LDAP authentication success"); 
 			return true;
 		} else {
+   writeLog("error", "LDPA could not authenticate"); 
 			return false;
 		}
+  writeLog("error", "LDPA could not authenticate");      
 		return false;
 	}
 else :
@@ -59,6 +62,7 @@ function plugin_auth_ftp($username, $password) {
 		$conn_id = ftp_connect($host, $port, 20);
 	} else {
 		debug_out('Invalid FTP scheme. Use ftp or ftps');
+  writeLog("error", "invalid FTP scheme"); 
 		return false;
 	}
 	
@@ -70,8 +74,10 @@ function plugin_auth_ftp($username, $password) {
 		
 		// Return Result
 		if ($login_result) {
+   writeLog("success", "$username authenticated");       
 			return true;
 		} else {
+   writeLog("error", "$username could not authenticate");      
 			return false;
 		}
 	} else {
@@ -171,6 +177,7 @@ if (function_exists('curl_version')) :
 	function plugin_auth_plex($username, $password) {
 		// Quick out
 		if ((strtolower(PLEXUSERNAME) == strtolower($username)) && $password == PLEXPASSWORD) {
+   writeLog("success", $username." authenticated by plex");
 			return true;
 		}
 		
@@ -187,6 +194,7 @@ if (function_exists('curl_version')) :
 			foreach($userXML AS $child) {
 				if(isset($child['username']) && strtolower($child['username']) == $usernameLower) {
 					$isUser = true;
+     writeLog("success", $usernameLower." was found in plex friends list");
 					break;
 				}
 			}
@@ -209,6 +217,7 @@ if (function_exists('curl_version')) :
 				if (isset($result['content'])) {
 					$json = json_decode($result['content'], true);
 					if (is_array($json) && isset($json['user']) && isset($json['user']['username']) && strtolower($json['user']['username']) == $usernameLower) {
+         writeLog("success", $json['user']['username']." was logged into plex and pulled credentials");
                         return array(
 							'email' => $json['user']['email'],
 							'image' => $json['user']['thumb']
@@ -217,6 +226,7 @@ if (function_exists('curl_version')) :
 				}
 			}
 		}
+  writeLog("error", "error occured logging into plex might want to check curl.cainfo=/path/to/downloaded/cacert.pem in php.ini");   
 		return false;
 	}
 else :
@@ -271,7 +281,7 @@ class setLanguage {
 
         $translatedWord = isset($this->language[$originalWord]) ? $this->language[$originalWord] : null;
         if (!$translatedWord) {
-            echo ("Translation not found for: $originalWord");
+            return ucwords(str_replace("_", " ", strtolower($originalWord)));
         }
 
         $translatedWord = htmlspecialchars($translatedWord, ENT_QUOTES);
@@ -476,71 +486,195 @@ function resolveEmbyItem($address, $token, $item) {
 }
 
 // Format item from Plex for Carousel
-function resolvePlexItem($server, $token, $item) {
-	// Static Height
-	$height = 150;
-	
-	$address = "https://app.plex.tv/web/app#!/server/$server/details?key=/library/metadata/".$item['ratingKey'];
-	
-	switch ($item['type']) {
-		case 'season':
-			$title = $item['parentTitle'];
-			$summary = $item['parentSummary'];
-			$width = 100;
-			$image = 'carousel-image season';
-			$style = '';
-            $thumb = $item['thumb'];
-            $key = $item['ratingKey'];
-			break;
+function resolvePlexItem($server, $token, $item, $nowPlaying = false, $showNames = false) {
+    // Static Height
+    $height = 444;
+
+    $address = "https://app.plex.tv/web/app#!/server/$server/details?key=/library/metadata/".$item['ratingKey'];
+
+    switch ($item['type']) {
+        case 'season':
+            $title = $item['parentTitle'];
+            $summary = $item['parentSummary'];
+            $width = 300;
+            $image = 'slick-image-tall';
+            $style = '';
+            if(!$nowPlaying){ 
+                $thumb = $item['thumb'];
+                $key = $item['ratingKey'] . "-list";
+            }else { 
+                $height = 281;
+                $width = 500;
+                $thumb = $item['art'];
+                $key = $item['ratingKey'] . "-np";
+                $elapsed = $item['viewOffset'];
+                $duration = $item['duration'];
+                $watched = floor(($elapsed / $duration) * 100);
+                $transcoded = floor($item->TranscodeSession['progress']- $watched);
+                $stream = $item->Media->Part->Stream['decision'];
+                $user = $item->User['title'];
+                $id = $item->Session['id'];
+                $streamInfo = buildStream(array(
+                    'platform' => (string) $item->Player['platform'],
+                    'device' => (string) $item->Player['device'],
+                    'stream' => "&nbsp;".streamType($item->Media->Part['decision']),
+                    'video' => streamType($item->Media->Part->Stream[0]['decision'])." (".$item->Media->Part->Stream[0]['codec'].") (".$item->Media->Part->Stream[0]['width']."x".$item->Media->Part->Stream[0]['height'].")",
+                    'audio' => "&nbsp;".streamType($item->Media->Part->Stream[1]['decision'])." (".$item->Media->Part->Stream[1]['codec'].") (".$item->Media->Part->Stream[1]['channels']."ch)",
+                ));
+                $state = (($item->Player['state'] == "paused") ? "pause" : "play");
+            }
+            break;
         case 'episode':
-			$title = $item['grandparentTitle'];
-			$summary = $item['title'];
-			$width = 100;
-			$image = 'carousel-image season';
-			$style = '';
-            $thumb = $item['parentThumb'];
-            $key = $item['ratingKey'];
-			break;
+            $title = $item['grandparentTitle'];
+            $summary = $item['title'];
+            $width = 300;
+            $image = 'slick-image-tall';
+            $style = '';
+            if(!$nowPlaying){ 
+                $thumb = $item['parentThumb'];
+                $key = $item['ratingKey'] . "-list";
+            }else { 
+                $height = 281;
+                $width = 500;
+                $thumb = $item['art'];
+                $key = $item['ratingKey'] . "-np";
+                $elapsed = $item['viewOffset'];
+                $duration = $item['duration'];
+                $watched = floor(($elapsed / $duration) * 100);
+                $transcoded = floor($item->TranscodeSession['progress']- $watched);
+                $stream = $item->Media->Part->Stream['decision'];
+                $user = $item->User['title'];
+                $id = $item->Session['id'];
+                $streamInfo = buildStream(array(
+                    'platform' => (string) $item->Player['platform'],
+                    'device' => (string) $item->Player['device'],
+                    'stream' => "&nbsp;".streamType($item->Media->Part['decision']),
+                    'video' => streamType($item->Media->Part->Stream[0]['decision'])." (".$item->Media->Part->Stream[0]['codec'].") (".$item->Media->Part->Stream[0]['width']."x".$item->Media->Part->Stream[0]['height'].")",
+                    'audio' => "&nbsp;".streamType($item->Media->Part->Stream[1]['decision'])." (".$item->Media->Part->Stream[1]['codec'].") (".$item->Media->Part->Stream[1]['channels']."ch)",
+                ));
+                $state = (($item->Player['state'] == "paused") ? "pause" : "play");
+                $topTitle = '<h5 class="text-center zero-m elip">'.$title.' - '.$item['title'].'</h5>';
+                $bottomTitle = '<small class="zero-m">S'.$item['parentIndex'].' · E'.$item['index'].'</small>';
+                if($showNames){ $bottomTitle .= '</small><small class="zero-m pull-right">'.$user.'</small>'; }
+            }
+            break;
         case 'clip':
-			$title = $item['title'];
-			$summary = $item['summary'];
-			$width = 100;
-			$image = 'carousel-image movie';
-			$style = '';
-            $thumb = $item['thumb'];
-            $key = "clip";
-			break;
-		case 'album':
-		case 'track':
-			$title = $item['parentTitle'];
-			$summary = $item['title'];
-			$width = 150;
-			$image = 'album';
-			$style = 'left: 160px !important;';
-            $thumb = $item['thumb'];
-            $key = $item['ratingKey'];
-			break;
-		default:
-			$title = $item['title'];
-			$summary = $item['summary'];
-			$width = 100;
-			$image = 'carousel-image movie';
-			$style = '';
-            $thumb = $item['thumb'];
-            $key = $item['ratingKey'];
-	}
-	
-	// If No Overview
-	if (!isset($itemDetails['Overview'])) {
-		$itemDetails['Overview'] = '';
-	}
-    $image_url = 'ajax.php?a=plex-image&img='.$thumb.'&height='.$height.'&width='.$width.'&key='.$key.'';
-    if (file_exists('images/cache/'.$key.'.jpg')){
-        $image_url = 'images/cache/'.$key.'.jpg';
+            $title = $item['title'];
+            $summary = $item['summary'];
+            $width = 300;
+            $image = 'slick-image-tall';
+            $style = '';
+            if(!$nowPlaying){ 
+                $thumb = $item['thumb'];
+                $key = $item['ratingKey'] . "-list";
+            }else { 
+                $height = 281;
+                $width = 500;
+                $thumb = $item['art'];
+                $key = $item['ratingKey'] . "-np";
+                $elapsed = $item['viewOffset'];
+                $duration = $item['duration'];
+                $watched = floor(($elapsed / $duration) * 100);
+                $transcoded = floor($item->TranscodeSession['progress']- $watched);
+                $stream = $item->Media->Part->Stream['decision'];
+                $user = $item->User['title'];
+                $id = $item->Session['id'];
+                $streamInfo = buildStream(array(
+                    'platform' => (string) $item->Player['platform'],
+                    'device' => (string) $item->Player['device'],
+                    'stream' => "&nbsp;".streamType($item->Media->Part['decision']),
+                    'video' => streamType($item->Media->Part->Stream[0]['decision'])." (".$item->Media->Part->Stream[0]['codec'].") (".$item->Media->Part->Stream[0]['width']."x".$item->Media->Part->Stream[0]['height'].")",
+                    'audio' => "&nbsp;".streamType($item->Media->Part->Stream[1]['decision'])." (".$item->Media->Part->Stream[1]['codec'].") (".$item->Media->Part->Stream[1]['channels']."ch)",
+                ));
+                $state = (($item->Player['state'] == "paused") ? "pause" : "play");
+                $topTitle = '<h5 class="text-center zero-m elip">'.$title.' [Trailer/Clip]</h5>';
+                $bottomTitle = '<small class="zero-m">'.$item['year'].'</small>';
+                if($showNames){ $bottomTitle .= '<small class="zero-m pull-right">'.$user.'</small>'; }
+            }
+            break;
+        case 'album':
+        case 'track':
+            $title = $item['parentTitle'];
+            $summary = $item['title'];
+            $image = 'slick-image-short';
+            $style = 'left: 160px !important;';
+            if(!$nowPlaying){ 
+                $width = 444;
+                $thumb = $item['thumb'];
+                $key = $item['ratingKey'] . "-list";
+            }else { 
+                $height = 281;
+                $width = 500;
+                $thumb = $item['art'];
+                $key = $item['ratingKey'] . "-np";
+                $elapsed = $item['viewOffset'];
+                $duration = $item['duration'];
+                $watched = floor(($elapsed / $duration) * 100);
+                $transcoded = floor($item->TranscodeSession['progress']- $watched);
+                $stream = $item->Media->Part->Stream['decision'];
+                $user = $item->User['title'];
+                $id = $item->Session['id'];
+                $streamInfo = buildStream(array(
+                    'platform' => (string) $item->Player['platform'],
+                    'device' => (string) $item->Player['device'],
+                    'stream' => "&nbsp;".streamType($item->Media->Part['decision']),
+                    'audio' => "&nbsp;".streamType($item->Media->Part->Stream[1]['decision'])." (".$item->Media->Part->Stream[0]['codec'].") (".$item->Media->Part->Stream[0]['channels']."ch)",
+                ));
+                $state = (($item->Player['state'] == "paused") ? "pause" : "play");
+                $topTitle = '<h5 class="text-center zero-m elip">'.$item['grandparentTitle'].' - '.$item['title'].'</h5>';
+                $bottomTitle = '<small class="zero-m">'.$title.'</small>';
+                if($showNames){ $bottomTitle .= '<small class="zero-m pull-right">'.$user.'</small>'; }
+            }
+            break;
+        default:
+            $title = $item['title'];
+            $summary = $item['summary'];
+            $image = 'slick-image-tall';
+            $style = '';
+            if(!$nowPlaying){ 
+                $width = 300;
+                $thumb = $item['thumb'];
+                $key = $item['ratingKey'] . "-list";
+            }else { 
+                $height = 281;
+                $width = 500;
+                $thumb = $item['art'];
+                $key = $item['ratingKey'] . "-np";
+                $elapsed = $item['viewOffset'];
+                $duration = $item['duration'];
+                $watched = floor(($elapsed / $duration) * 100);
+                $transcoded = floor($item->TranscodeSession['progress']- $watched);
+                $stream = $item->Media->Part->Stream['decision'];
+                $user = $item->User['title'];
+                $id = $item->Session['id'];
+                $streamInfo = buildStream(array(
+                    'platform' => (string) $item->Player['platform'],
+                    'device' => (string) $item->Player['device'],
+                    'stream' => "&nbsp;".streamType($item->Media->Part['decision']),
+                    'video' => streamType($item->Media->Part->Stream[0]['decision'])." (".$item->Media->Part->Stream[0]['codec'].") (".$item->Media->Part->Stream[0]['width']."x".$item->Media->Part->Stream[0]['height'].")",
+                    'audio' => "&nbsp;".streamType($item->Media->Part->Stream[1]['decision'])." (".$item->Media->Part->Stream[1]['codec'].") (".$item->Media->Part->Stream[1]['channels']."ch)",
+                ));
+                $state = (($item->Player['state'] == "paused") ? "pause" : "play");
+                $topTitle = '<h5 class="text-center zero-m elip">'.$title.'</h5>';
+                $bottomTitle = '<small class="zero-m">'.$item['year'].'</small>';
+                if($showNames){ $bottomTitle .= '<small class="zero-m pull-right">'.$user.'</small>'; }
+            }
+	   }
+
+    // If No Overview
+    if (!isset($itemDetails['Overview'])) { $itemDetails['Overview'] = ''; }
+
+    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=plex-image&img='.$thumb.'&height='.$height.'&width='.$width.'&key='.$key.'';        
+    }
+    if(!$thumb){ $image_url = "images/no-np.png"; $key = "no-np"; }
+    // Assemble Item And Cache Into Array 
+    if($nowPlaying){
+        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="'.$address.'" target="_blank"><img style="width: 500px; display:inherit;" src="'.$image_url.'" alt="'.$item['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: '.$transcoded.'%"></div></div><div class="caption"><i style="float:left" class="fa fa-'.$state.'"></i>'.$topTitle.''.$bottomTitle.'</div></div></div>';
+    }else{
+        return '<div class="item-'.$item['type'].'"><a href="'.$address.'" target="_blank"><img alt="'.$item['Name'].'" class="'.$image.'" data-lazy="'.$image_url.'"></a><small style="margin-right: 13px" class="elip">'.$title.'</small></div>';
     }
-	
-	// Assemble Item And Cache Into Array 
-	return '<div class="item"><a href="'.$address.'" target="_blank"><img alt="'.$item['Name'].'" class="'.$image.'" src="'.$image_url.'"></a><div class="carousel-caption" style="'.$style.'"><h4>'.$title.'</h4><small><em>'.$summary.'</em></small></div></div>';
 }
 
 // Create Carousel
@@ -570,6 +704,39 @@ function outputCarousel($header, $size, $type, $items, $script = false) {
 	</div></div>'.($script?'<script>'.$script.'</script>':''); 
 }
 
+//Recent Added
+function outputRecentAdded($header, $items, $script = false, $array) {
+    $hideMenu = '<div class="pull-right"><div class="btn-group" role="group"><button type="button" class="btn waves btn-default btn-sm dropdown-toggle waves-effect waves-float" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Filter<span class="caret"></span></button><ul style="right:0; left: auto" class="dropdown-menu">';
+    if($array["movie"] == "true"){
+        $hideMenu .= '<li><a class="js-filter-movie" href="javascript:void(0)">Hide Movies</a></li>';
+    }
+    if($array["season"] == "true"){
+        $hideMenu .= '<li><a class="js-filter-season" href="javascript:void(0)">Hide Show</a></li>';
+    }
+    if($array["album"] == "true"){
+        $hideMenu .= '<li><a class="js-filter-album" href="javascript:void(0)">Hide Music</a></li>';
+    }
+    $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>';
+    }else{
+        return '<div id=recentMedia><h5 style="margin-bottom: -25px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination">'.$hideMenu.'</div><br/><div class="recentItems">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
+    }
+    
+}
+
+// Create Carousel
+function outputPlexNowPlaying($header, $size, $type, $items, $script = false) {
+	// If None Populate Empty Item
+	if (!count($items)) {
+		return '<div id=streamz></div>'.($script?'<script>'.$script.'</script>':'');
+	}else{
+	   return '<div id=streamz><h5 class="text-center">'.$header.'</h5>'.implode('',$items).'</div>'.($script?'<script>'.$script.'</script>':'');
+ }
+    
+}
+
 // Get Now Playing Streams From Emby
 function getEmbyStreams($size) {
 	$address = qualifyURL(EMBYURL);
@@ -597,7 +764,7 @@ function getEmbyStreams($size) {
 }
 
 // Get Now Playing Streams From Plex
-function getPlexStreams($size){
+function getPlexStreams($size, $showNames){
     $address = qualifyURL(PLEXURL);
     
 	// Perform API requests
@@ -611,10 +778,10 @@ function getPlexStreams($size){
 	
 	$items = array();
 	foreach($api AS $child) {
-		$items[] = resolvePlexItem($gotServer, PLEXTOKEN, $child);
+		$items[] = resolvePlexItem($gotServer, PLEXTOKEN, $child, true, $showNames);
 	}
 	
-	return outputCarousel(translate('PLAYING_NOW_ON_PLEX'), $size, 'streams-plex', $items, "
+	return outputPlexNowPlaying(translate('PLAYING_NOW_ON_PLEX'), $size, 'streams-plex', $items, "
 		setInterval(function() {
 			$('<div></div>').load('ajax.php?a=plex-streams',function() {
 				var element = $(this).find('[id]');
@@ -622,7 +789,7 @@ function getPlexStreams($size){
 				$('#'+loadedID).replaceWith(element);
 				console.log('Loaded updated: '+loadedID);
 			});
-		}, 10000);
+		}, 15000);
 	");
 }
 
@@ -684,26 +851,12 @@ function getEmbyRecent($type, $size) {
 }
 
 // Get Recent Content From Plex
-function getPlexRecent($type, $size){
+function getPlexRecent($array){
     $address = qualifyURL(PLEXURL);
-    
-	// Resolve Types
-	switch ($type) {
-		case 'movie':
-			$header = translate('MOVIES');
-			break;
-		case 'season':
-			$header = translate('TV_SHOWS');
-			break;
-		case 'album':
-			$header = translate('MUSIC');
-			break;
-		default:
-			$header = translate('RECENT_CONTENT');
-	}
+			 $header = translate('RECENT_CONTENT');
 	
 	// Perform Requests
-    $api = @file_get_contents($address."/library/recentlyAdded?X-Plex-Token=".PLEXTOKEN);
+    $api = @file_get_contents($address."/library/recentlyAdded?limit=100&X-Plex-Token=".PLEXTOKEN);
     $api = simplexml_load_string($api);
     $getServer = simplexml_load_string(@file_get_contents($address."/?X-Plex-Token=".PLEXTOKEN));
 	if (!$getServer) { return 'Could not load!'; }
@@ -713,12 +866,13 @@ function getPlexRecent($type, $size){
 	
 	$items = array();
 	foreach($api AS $child) {
-		if($child['type'] == $type){
-			$items[] = resolvePlexItem($gotServer, PLEXTOKEN, $child);
+     $type = (string) $child['type'];
+		if($array[$type] == "true"){
+			$items[] = resolvePlexItem($gotServer, PLEXTOKEN, $child, false, false);
 		}
 	}
 	
-	return outputCarousel($header, $size, $type.'-plex', $items);
+	return outputRecentAdded($header, $items, "", $array);
 }
 
 // Get Image From Emby
@@ -757,7 +911,7 @@ function getPlexImage() {
         $cachefile = 'images/cache/'.$key.'.jpg';
         $cachetime = 604800;
         // Serve from the cache if it is younger than $cachetime
-        if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
+        if (file_exists($cachefile) && time() - $cachetime > filemtime($cachefile)) {
             header("Content-type: image/jpeg");
             @readfile($cachefile);
             exit;
@@ -856,9 +1010,10 @@ function createConfig($array, $path = 'config/config.php', $nest = 0) {
 		if (file_exists($path)) {
 			return true;
 		}
-		
+		writeLog("error", "config was unable to write");
 		return false;
 	} else {
+  writeLog("success", "config was updated with new values");
 		return $output;
 	}
 }
@@ -944,6 +1099,15 @@ function configLazy($path = 'config/config.php') {
 
 // Qualify URL
 function qualifyURL($url) {
+ //local address?
+ if(substr($url, 0,1) == "/"){
+     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { 
+        $protocol = "https://"; 
+    } else {  
+        $protocol = "http://"; 
+    }
+     $url = $protocol.getServer().$url;
+ }
 	// Get Digest
 	$digest = parse_url($url);
 	
@@ -1108,15 +1272,17 @@ function uploadFiles($path, $ext_mask = null) {
 
 		if($data['isComplete']){
 			$files = $data['data'];
-
+   writeLog("success", $files['metas'][0]['name']." was uploaded");
 			echo json_encode($files['metas'][0]['name']);
 		}
 
 		if($data['hasErrors']){
 			$errors = $data['errors'];
+   writeLog("error", $files['metas'][0]['name']." was not able to upload");
 			echo json_encode($errors);
 		}
-	} else {
+	} else { 
+  writeLog("error", "image was not uploaded");
 		echo json_encode('No files submitted!');
 	}
 }
@@ -1124,8 +1290,10 @@ function uploadFiles($path, $ext_mask = null) {
 // Remove file
 function removeFiles($path) {
     if(is_file($path)) {
+        writeLog("success", "image was removed");
         unlink($path);
     } else {
+  writeLog("error", "image was not removed");
 		echo json_encode('No file specified for removal!');
 	}
 }
@@ -1659,9 +1827,10 @@ function createSQLiteDB($path = false) {
 			`loading`	TEXT,
 			`hovertext`	TEXT
 		);');
-		
+		writeLog("success", "database created/saved");
 		return $users && $tabs && $options;
 	} else {
+  writeLog("error", "database was unable to be created/saved");
 		return false;
 	}
 }
@@ -1717,8 +1886,10 @@ function updateSQLiteDB($db_path = false, $oldVerNum = false) {
 				$GLOBALS['file_db']->query($queryBase.implode(',',$insertValues).';');
 			}
 		}
+  writeLog("success", "database values have been updated");
 		return true;
 	} else {
+  writeLog("error", "database values unable to be updated");
 		return false;
 	}
 }
@@ -1736,8 +1907,10 @@ function updateDBOptions($values) {
 	}, $values, array_keys($values))).';')->rowCount()) {
 		return true;
 	} else if ($GLOBALS['file_db']->query('INSERT OR IGNORE INTO options (`'.implode('`,`',array_keys($values)).'`) VALUES (\''.implode("','",$values).'\');')->rowCount()) {
+  writeLog("success", "database values for options table have been updated");
 		return true;
 	} else {
+  writeLog("error", "database values for options table unable to be updated");
 		return false;
 	}
 }
@@ -1747,7 +1920,7 @@ function sendNotification($success, $message = false, $send = true) {
 	$notifyExplode = explode("-", NOTIFYEFFECT);
 	if ($success) {
 		$msg = array(
-			'html' => ($message?'<br>'.$message:'<strong>'.translate("SETTINGS_SAVED").'</strong>'),
+			'html' => ($message?''.$message:'<strong>'.translate("SETTINGS_SAVED").'</strong>'),
 			'icon' => 'floppy-o',
 			'type' => 'success',
 			'length' => '5000',
@@ -1756,7 +1929,7 @@ function sendNotification($success, $message = false, $send = true) {
 		);
 	} else {
 		$msg = array(
-			'html' => ($message?'<br>'.$message:'<strong>'.translate("SETTINGS_NOT_SAVED").'</strong>'),
+			'html' => ($message?''.$message:'<strong>'.translate("SETTINGS_NOT_SAVED").'</strong>'),
 			'icon' => 'floppy-o',
 			'type' => 'failed',
 			'length' => '5000',
@@ -1834,7 +2007,7 @@ function deleteDatabase() {
 	}
 
     rmdir($userdirpath);
-	
+	writeLog("success", "database has been deleted");
 	return true;
 }
 
@@ -1907,7 +2080,7 @@ function upgradeInstall($branch = 'master') {
     unzipFile($file);
     rcopy($source, $destination);
     rrmdir($cleanup);
-	
+	writeLog("success", "organizr has been updated");
 	return true;
 }
 
@@ -2018,10 +2191,13 @@ function updateTabs($tabs) {
 			}
 			$GLOBALS['file_db']->query('INSERT INTO tabs (`'.implode('`,`',array_keys($fields)).'`) VALUES (\''.implode("','",$fields).'\');');
 		}
+  writeLog("success", "tabs successfully saved");     
 		return $totalValid;
 	} else {
+  writeLog("error", "tabs could not save");     
 		return false;
 	}
+ writeLog("error", "tabs could not save");     
 	return false;
 }
 
@@ -2470,7 +2646,142 @@ function checkRootPath($string){
     }
 }
 
+function writeLog($type, $message){
+    $message = date("Y-m-d H:i:s")."|".$type."|".$message."\n";
+    file_put_contents("org.log", $message, FILE_APPEND | LOCK_EX);
+}
 
+function readLog(){
+    $log = file("org.log");
+    $log = array_reverse($log);
+    foreach($log as $line){
+        $line = explode("|", $line);
+        $line[1] = ($line[1] == "error") ? '<span class="label label-danger">Error</span>' : '<span class="label label-primary">Success</span>';
+        echo "<tr><td>".$line[0]."</td><td>".$line[2]."</td><td>".$line[1]."</td></tr>";
+    }
+}
+
+function buildStream($array){
+    $result = "";
+    if (array_key_exists('platform', $array)) {
+        $result .= '<div class="reg-info" style="margin-top:0; padding-left:0; position: absolute; bottom: 10px; left: 10px;"><div style="margin-right: 0;" class="item pull-left text-center"><img class="img-circle" height="55px" src="images/platforms/'.getPlatform($array['platform']).'"></div></div><div class="clearfix"></div>';
+    }
+    if (array_key_exists('device', $array)) {
+        $result .= '<div class="reg-info" style="margin-top:0; padding-left:5%;"><div style="margin-right: 0;" class="item pull-left text-center"><span style="font-size: 15px;" class="block text-center"><i class="fa fa-laptop"></i>'.$array['device'].'</span></div></div><div class="clearfix"></div>';
+    }
+    if (array_key_exists('stream', $array)) {
+        $result .= '<div class="reg-info" style="margin-top:0; padding-left:5%;"><div style="margin-right: 0;" class="item pull-left text-center"><span style="font-size: 15px;" class="block text-center"><i class="fa fa-play"></i>'.$array['stream'].'</span></div></div><div class="clearfix"></div>';
+    }
+    if (array_key_exists('video', $array)) {
+        $result .= '<div class="reg-info" style="margin-top:0; padding-left:5%;"><div style="margin-right: 0;" class="item pull-left text-center"><span style="font-size: 15px;" class="block text-center"><i class="fa fa-film"></i>'.$array['video'].'</span></div></div><div class="clearfix"></div>';
+    }
+    if (array_key_exists('audio', $array)) {
+        $result .= '<div class="reg-info" style="margin-top:0; padding-left:5%;"><div style="margin-right: 0;" class="item pull-left text-center"><span style="font-size: 15px;" class="block text-center"><i class="fa fa-volume-up"></i>'.$array['audio'].'</span></div></div><div class="clearfix"></div>';
+    }
+    return $result;
+}
+
+function streamType($value){
+    if($value == "transcode"){
+        return "Transcode";
+    }elseif($value == "copy"){
+        return "Direct Stream";
+    }elseif($value == "directplay"){
+        return "Direct Play";
+    }else{
+        return "Direct Play";
+    }
+}
+
+function getPlatform($platform){
+    $allPlatforms = array(
+        "Chrome" => "chrome.png",
+        "tvOS" => "atv.png",
+        "iOS" => "ios.png",
+        "Xbox One" => "xbox.png",
+        "Mystery 4" => "playstation.png",
+        "Samsung" => "samsung.png",
+    );
+    if (array_key_exists($platform, $allPlatforms)) {
+        return $allPlatforms[$platform];
+    }else{
+        return "pmp.png";
+    }
+}
+
+function getServer(){
+    $server = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $_SERVER["SERVER_NAME"];
+    return $server;    
+}
+
+function prettyPrint($a) {
+    echo "HEADERS: <pre>";
+    print_r($a);
+    echo "</pre>";
+    echo "<br/>";
+}
+
+function checkFrame($array, $url){
+    if(array_key_exists("x-frame-options", $array)){
+        if($array['x-frame-options'] == "deny"){
+            return false;
+        }elseif($array['x-frame-options'] == "sameorgin"){
+            $digest = parse_url($url);
+            $host = (isset($digest['host'])?$digest['host']:'');
+            if(getServer() == $host){
+                return true;
+            }else{
+                return false;
+            }
+        }
+    }else{
+        if(!$array){
+            return false;
+        }
+        return true;
+    }    
+}
+
+function frameTest($url){
+    $array = array_change_key_case(get_headers(qualifyURL($url), 1));
+    $url = qualifyURL($url);
+    if(checkFrame($array, $url)){
+        return true;
+    }else{
+        return false;
+    }
+}
+
+function sendResult($result, $icon = "floppy-o", $message = false, $success = "WAS_SUCCESSFUL", $fail = "HAS_FAILED", $send = true) {
+	$notifyExplode = explode("-", NOTIFYEFFECT);
+	if ($result) {
+		$msg = array(
+			'html' => ($message?''.$message.' <strong>'.translate($success).'</strong>':'<strong>'.translate($success).'</strong>'),
+			'icon' => $icon,
+			'type' => 'success',
+			'length' => '5000',
+			'layout' => $notifyExplode[0],
+			'effect' => $notifyExplode[1],
+		);
+	} else {
+		$msg = array(
+			'html' => ($message?''.$message.' <strong>'.translate($fail).'</strong>':'<strong>'.translate($fail).'</strong>'),
+			'icon' => $icon,
+			'type' => 'error',
+			'length' => '5000',
+			'layout' => $notifyExplode[0],
+			'effect' => $notifyExplode[1],
+		);
+	}
+	
+	// Send and kill script?
+	if ($send) {
+		header('Content-Type: application/json');
+		echo json_encode(array('notify'=>$msg));
+		die();
+	}
+	return $msg;
+}
 
 // Always run this
 dependCheck();

+ 197 - 11
homepage.php

@@ -101,8 +101,12 @@ $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
 
         <link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css">
 
-        <link rel="stylesheet" href="css/style.css">
+        <link rel="stylesheet" href="css/style.css?v=<?php echo INSTALLEDVERSION; ?>">
         <link rel="stylesheet" href="bower_components/mdi/css/materialdesignicons.min.css?v=<?php echo INSTALLEDVERSION; ?>">
+        <link rel="stylesheet" href="bower_components/google-material-color/dist/palette.css?v=<?php echo INSTALLEDVERSION; ?>">
+        <link rel="stylesheet" type="text/css" href="bower_components/slick/slick.css?v=<?php echo INSTALLEDVERSION; ?>">
+        <!-- Add the slick-theme.css if you want default styling -->
+       
 
         <!--Scripts-->
         <script src="bower_components/jquery/dist/jquery.min.js"></script>
@@ -113,10 +117,11 @@ $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
         <script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
         <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
         <script src="bower_components/cta/dist/cta.min.js"></script>
-        <script src="bower_components/fullcalendar/dist/fullcalendar.js"></script>
+        <script src="bower_components/fullcalendar/dist/fullcalendar.js?v=<?php echo INSTALLEDVERSION; ?>">
+        <script src="bower_components/slick/slick.js?v=<?php echo INSTALLEDVERSION; ?>">
 
         <script src="js/jqueri_ui_custom/jquery-ui.min.js"></script>
-	    <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
+	       <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
 		
 		<!--Other-->
 		<script src="js/ajax.js?v=<?php echo INSTALLEDVERSION; ?>"></script>
@@ -126,6 +131,29 @@ $endDate = date('Y-m-d',strtotime("+".CALENDARENDDAY." days"));
         <script src="bower_components/respondJs/dest/respond.min.js"></script>
         <![endif]-->
         <style>
+            .recentItems {
+                padding-top: 10px;
+                margin: 5px 0;
+            }
+            .slick-image-tall{
+                width: 125px;
+                height: 180px;
+            }
+            .slick-image-short{
+                width: 125px;
+                height: 130px;
+                margin-top: 50px;
+            }
+            .overlay{
+                position: absolute;
+                top: 0;
+                left: 0;
+                width: 100%;
+                height: 100%;
+                display: none;
+                z-index: 0;
+                opacity: .98;
+            }
             sort {
                 display: none;
             }
@@ -457,17 +485,20 @@ endif; ?>
                 </div>
                 <?php } ?>
 				<?php if (qualifyUser(PLEXHOMEAUTH) && PLEXTOKEN) { ?>
+                <div id="plexRowNowPlaying" class="row">
+                    <?php if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12, PLEXSHOWNAMES); } ?>
+                </div>
                 <div id="plexRow" class="row">
-                    <sort>3</sort>
+                    <div class="col-lg-12">
+                        <sort>3</sort>
 
                     <?php
-                    $plexSize = (PLEXRECENTMOVIE == "true") + (PLEXRECENTTV == "true") + (PLEXRECENTMUSIC == "true") + (PLEXPLAYINGNOW == "true");
-                    if(PLEXRECENTMOVIE == "true"){ echo getPlexRecent("movie", 12/$plexSize); }
-                    if(PLEXRECENTTV == "true"){ echo getPlexRecent("season", 12/$plexSize); }
-                    if(PLEXRECENTMUSIC == "true"){ echo getPlexRecent("album", 12/$plexSize); }
-                    if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12/$plexSize); }
+                    if(PLEXRECENTMOVIE || PLEXRECENTTV || PLEXRECENTMUSIC){  
+                        $plexArray = array("movie" => PLEXRECENTMOVIE, "season" => PLEXRECENTTV, "album" => PLEXRECENTMUSIC);
+                        echo getPlexRecent($plexArray);
+                    } 
                     ?>
-
+                    </div>
                 </div>
 				<?php } ?>
 				<?php if (qualifyUser(EMBYHOMEAUTH) && EMBYTOKEN) { ?>
@@ -517,7 +548,9 @@ endif; ?>
             var closedBox = $(this).closest('div.content-box').remove();
             e.preventDefault();
         });
-
+            
+        
+            
         function localStorageSupport() {
             return (('localStorage' in window) && window['localStorage'] !== null)
         }
@@ -533,6 +566,159 @@ endif; ?>
                     });
                 },1500);
             });
+            $(document).on('click', '.w-refresh', function(){
+                //Your code
+                var id = $(this).attr("link");
+                $("div[np^='"+id+"']").toggle();
+                    console.log(id);
+                    //console.log(moreInfo);
+            });
+            var windowSize = window.innerWidth;
+            var nowPlaying = "";
+            if(windowSize >= 1000){
+                nowPlaying = 8;
+            }else if(windowSize <= 400){
+                nowPlaying = 2;
+            }else if(windowSize <= 600){
+                nowPlaying = 3;
+            }else if(windowSize <= 849){
+                nowPlaying = 6;
+            }else if(windowSize <= 999){
+                nowPlaying = 7;
+            }
+            console.log(windowSize+" - " +nowPlaying);
+            $('.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
+              ]
+            });
+            
+            var movieFiltered = false;
+            var seasonFiltered = false;
+            var albumFiltered = false;
+
+            $('.js-filter-movie').on('click', function(){
+              if (movieFiltered === false) {
+                $('.recentItems').slick('slickFilter','.item-season, .item-album');
+                $(this).text('Show Movies');
+                movieFiltered = true;
+              } else {
+                $('.recentItems').slick('slickUnfilter');
+                $(this).text('Hide Movies');
+                movieFiltered = false;
+              }
+            });
+            
+            $('.js-filter-season').on('click', function(){
+              if (seasonFiltered === false) {
+                $('.recentItems').slick('slickFilter','.item-movie, .item-album');
+                $(this).text('Show TV');
+                seasonFiltered = true;
+              } else {
+                $('.recentItems').slick('slickUnfilter');
+                $(this).text('Hide TV');
+                seasonFiltered = false;
+              }
+            });
+            
+            $('.js-filter-album').on('click', function(){
+              if (albumFiltered === false) {
+                $('.recentItems').slick('slickFilter','.item-season, .item-movie');
+                $(this).text('Show Music');
+                albumFiltered = true;
+              } else {
+                $('.recentItems').slick('slickUnfilter');
+                $(this).text('Hide Music');
+                albumFiltered = false;
+              }
+            });
+            
+            /*$('.w-refresh').click(function(e){
+                var moreInfo = $(this).closest('div.overlay').addClass("show");
+                console.log(moreInfo);
+                moreInfo.show();
+                e.preventDefault();
+            });*/
 
             $("body").niceScroll({
                 railpadding: {top:0,right:0,left:0,bottom:0},

+ 1 - 1
index.php

@@ -1452,7 +1452,7 @@ endif; ?>
 
                     $("#content div[class^='iframe active']").attr("class", "iframe hidden");
 
-                    $( '<div class="iframe active" data-content-url="'+thisid+'"><iframe scrolling="auto" sandbox="allow-forms allow-same-origin allow-pointer-lock allow-scripts allow-popups allow-modals allow-top-navigation" allowfullscreen="true" webkitallowfullscreen="true" frameborder="0" style="width:100%; height:100%; position: absolute;" src="'+thisid+'"></iframe></div>' ).appendTo( "#content" );
+                    $( '<div class="iframe active" data-content-url="'+thisid+'"><iframe scrolling="auto" sandbox="allow-forms allow-same-origin allow-pointer-lock allow-scripts allow-popups allow-top-navigation" allowfullscreen="true" webkitallowfullscreen="true" frameborder="0" style="width:100%; height:100%; position: absolute;" src="'+thisid+'"></iframe></div>' ).appendTo( "#content" );
                     document.title = thistitle;
                    // window.location.href = '#' + thisname;
 

+ 250 - 213
settings.php

@@ -291,6 +291,26 @@ endif; ?>
 
             <!--Content-->
             <div id="content"  style="margin:0 10px; overflow:hidden">
+                <div class="modal fade checkFrame" tabindex="-1" role="dialog">
+                    <div class="modal-dialog modal-lg" role="document">
+                        <div class="modal-content">
+                            <div class="modal-header">
+                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                                <h4 class="modal-title">Check iFrame Compatability</h4>
+                            </div>
+                            <form id="urlTestForm" onsubmit="return false;">
+                                <div class="modal-body">
+                                    Let's Check this URL
+                                    <input type="text" class="form-control material" name="url-test" placeholder="<?php echo translate("URL"); ?>" autocorrect="off" autocapitalize="off" value="">
+                                </div>
+                                <div class="modal-footer">
+                                    <button type="button" class="btn btn-default waves" data-dismiss="modal">Close</button>
+                                    <button id="urlTestForm_submit" class="btn btn-primary waves" data-dismiss="modal">Check Frame URL</button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+                </div>
                 <br/>
                 <div id="versionCheck"></div>
                 <div class="row">
@@ -302,14 +322,14 @@ endif; ?>
                             <img src="images/organizr-logo-h-d.png" width="100%" style="margin-top: -10px;">
                             <div class="profile-usermenu">
                                 <ul class="nav" id="settings-list">
-                                    <li class=""><a id="open-tabs"><i class="fa fa-list red-orange"></i>Edit Tabs</a></li>
-                                    <li class=""><a id="open-colors"><i class="fa fa-paint-brush green"></i>Edit Colors</a></li>
-                                    <li><a id="open-users"><i class="fa fa-user red"></i>Manage Users</a></li>
-                                    <li><a id="open-logs"><i class="fa fa-file-text-o blue"></i>View Logs</a></li>
-                                    <li><a id="open-homepage"><i class=" fa fa-home yellow"></i>Edit Homepage</a></li>
-                                    <li><a id="open-advanced"><i class=" fa fa-cog light-blue"></i>Advanced</a></li>
-                                    <li><a id="open-info"><i class=" fa fa-info orange"></i>&nbsp; About</a></li>
-                                    <li><a href="https://paypal.me/causefx" target="_blank"><i class=" fa fa-money red"></i>Donate</a></li>
+                                    <li><a id="open-tabs" box="tab-box"><i class="fa fa-list red-orange pull-right"></i>Edit Tabs</a></li>
+                                    <li><a id="open-colors" box="color-box"><i class="fa fa-paint-brush green pull-right"></i>Edit Colors</a></li>
+                                    <li><a id="open-users" box="users-box"><i class="fa fa-user red pull-right"></i>Manage Users</a></li>
+                                    <li><a id="open-logs" box="logs-box"><i class="fa fa-file-text-o blue pull-right"></i>View Logs</a></li>
+                                    <li><a id="open-homepage" box="homepage-box"><i class=" fa fa-home yellow pull-right"></i>Edit Homepage</a></li>
+                                    <li><a id="open-advanced" box="advanced-box"><i class=" fa fa-cog light-blue pull-right"></i>Advanced</a></li>
+                                    <li><a id="open-info" box="info-box"><i class=" fa fa-info-circle orange pull-right"></i>About</a></li>
+                                    <li><a id="open-donate" box="donate-box"><i class=" fa fa-money red pull-right"></i>Donate</a></li>
                                 </ul>
                             </div>
                         </div>
@@ -338,6 +358,9 @@ endif; ?>
 											<button id="iconAll" type="button" class="btn waves btn-labeled btn-info btn-sm text-uppercase waves-effect waves-float">
 												<span class="btn-label"><i class="fa fa-picture-o"></i></span><?php echo $language->translate("VIEW_ICONS");?>
 											</button>
+           <button id="checkFrame" data-toggle="modal" data-target=".checkFrame" type="button" class="btn waves btn-labeled btn-gray btn-sm text-uppercase waves-effect waves-float">
+												<span class="btn-label"><i class="fa fa-check"></i></span><?php echo $language->translate("CHECK_FRAME");?>
+											</button>
 											<button type="submit" class="btn waves btn-labeled btn-success btn btn-sm pull-right text-uppercase waves-effect waves-float">
 												<span class="btn-label"><i class="fa fa-floppy-o"></i></span><?php echo translate('SAVE_TABS'); ?>
 											</button>
@@ -350,7 +373,7 @@ endif; ?>
 <?php
 $dirname = "images/";
 $images = scandir($dirname);
-$ignore = Array(".", "..", "favicon", "cache", "._.DS_Store", ".DS_Store", "confused.png", "sowwy.png", "sort-btns", "loading.png", "titlelogo.png", "default.svg", "login.png", "themes", "nadaplaying.jpg", "organizr-logo-h-d.png", "organizr-logo-h.png");
+$ignore = Array(".", "..", "favicon", "cache", "platforms", "._.DS_Store", ".DS_Store", "confused.png", "sowwy.png", "sort-btns", "loading.png", "titlelogo.png", "default.svg", "login.png", "themes", "nadaplaying.jpg", "organizr-logo-h-d.png", "organizr-logo-h.png");
 foreach($images as $curimg){
 	if(!in_array($curimg, $ignore)) { ?>
 												<div class="col-xs-2" style="width: 75px; height: 75px; padding-right: 0px;">    
@@ -694,6 +717,12 @@ echo buildSettings(
 							'name' => 'plexPlayingNow',
 							'value' => PLEXPLAYINGNOW,
 						),
+      array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'SHOW_NAMES',
+							'name' => 'plexShowNames',
+							'value' => PLEXSHOWNAMES,
+						),
 					),
 				),
 			),
@@ -1041,7 +1070,7 @@ echo buildSettings(
 						'name' => 'homepageNoticeMessage',
 						'value' => HOMEPAGENOTICEMESSAGE,
       'rows' => 5,
-						'style' => 'background: #000; color: #FFF;',
+						'class' => 'material no-code',
 					),
 				),
 			),
@@ -1385,6 +1414,69 @@ echo buildSettings(
 );
 ?>
                 </div>
+                <div class="email-content donate-box white-bg">
+                    <div class="email-body">
+                        <div class="email-header gray-bg">
+                            <button type="button" class="btn btn-danger btn-sm waves close-button"><i class="fa fa-close"></i></button>
+                            <h1>Donate To Organizr</h1>
+                        </div>
+                        <div class="email-inner small-box">
+                            <div class="email-inner-section">
+                                <div class="small-box fade in" id="donate-org">
+                                    <div class="row">
+                                        <div class="col-lg-12">
+                                            <div class="content-box big-box">
+                                                <div class="jumbotron">
+                                                    <div class="container">
+                                                        <h3>Hey There <?php echo ucwords($USER->username);?>,</h3>
+                                                        <p>Organizr if fed by the people :)</p>
+                                                        <p>By no means does anyone need to donate but if you choose to help out and show appreciation I would surely appreciate that very much.</p>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-sm-6 col-lg-6">
+                                            <div class="content-box ultra-widget blue-bg" style="cursor: pointer;" onclick="window.open('https://paypal.me/causefx', '_blank')">
+                                                <div class="w-content big-box">
+                                                    <div class="w-progress">
+                                                        <span class="w-amount">PayPal</span>
+                                                        <br>
+                                                        <span class="text-uppercase w-name">Donate with PayPal</span>
+                                                    </div>
+                                                    <span class="w-refresh w-p-icon">
+                                                        <span class="fa-stack fa-lg">
+                                                            <i class="fa fa-square fa-stack-2x"></i>
+                                                            <i class="fa fa-paypal blue fa-stack-1x fa-inverse"></i>
+                                                        </span>
+                                                    </span>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-sm-6 col-lg-6">
+                                            <div class="content-box ultra-widget green-bg" style="cursor: pointer;" onclick="window.open('https://cash.me/$causefx', '_blank')">
+                                                <div class="w-content big-box">
+                                                    <div class="w-progress">
+                                                        <span class="w-amount">Square</span>
+                                                        <br>
+                                                        <span class="text-uppercase w-name">Donate with Square Cash</span>
+                                                    </div>
+                                                    <span class="w-refresh w-p-icon">
+                                                        <span class="fa-stack fa-lg">
+                                                            <i class="fa fa-square fa-stack-2x"></i>
+                                                            <i class="fa fa-dollar green fa-stack-1x fa-inverse"></i>
+                                                        </span>
+                                                    </span>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
                 <div class="email-content info-box white-bg">
                     <div class="email-body">
                         <div class="email-header gray-bg">
@@ -1854,10 +1946,34 @@ echo buildSettings(
                         <div class="email-inner small-box">
                             <div class="email-inner-section">
                                 <div class="small-box" id="loginlog">
+                                    <div>
+                                        <?php if(file_exists("org.log")){ ?>
+                                        <button id="viewOrgLogs" class="btn waves btn-labeled gray-bg text-uppercase waves-effect waves-float" type="button"><span class="btn-label"><i class="fa fa-terminal"></i></span>Organizr Log </button>
+                                        <?php } if(file_exists(FAIL_LOG)){ ?>
+                                        <button id="viewLoginLogs" class="btn waves btn-labeled grayish-blue-bg text-uppercase waves-effect waves-float" type="button" style="display: none"><span class="btn-label"><i class="fa fa-user"></i></span>Login Log </button>
+                                        <?php } ?>
+                                    </div>
+                                    
+                                    <?php if(file_exists("org.log")){ ?>
+                                    <div id="orgLogTable" class="table-responsive" style="display: none">
+                                        <table id="orgLogs" class="display">
+                                            <thead>
+                                                <tr>
+                                                    <th><?php echo $language->translate("DATE");?></th>
+                                                    <th><?php echo $language->translate("STATUS");?></th>
+                                                    <th><?php echo $language->translate("TYPE");?></th>
+                                                </tr>
+                                            </thead>
+                                            <tbody>
+                                                 <?php readLog(); ?>
+                                            </tbody>
+                                        </table>
+                                    </div>
+                                    <?php } ?>
 
-                                    <div class="table-responsive">
+                                    <div id="loginTable" class="table-responsive">
 
-                                        <?php if(file_exists(FAIL_LOG)) : ?>
+                                        <?php if(file_exists(FAIL_LOG)){ ?>
 
                                         <div id="loginStats">
 
@@ -1966,13 +2082,13 @@ echo buildSettings(
                                         $goodPercent = round(($goodLogin / $totalLogin) * 100);
                                         $badPercent = round(($badLogin / $totalLogin) * 100);
 
-                                        endif;
+                                        };
 
-                                        if(!file_exists(FAIL_LOG)) :
+                                        if(!file_exists(FAIL_LOG)){
 
                                             echo $language->translate("NOTHING_LOG");
 
-                                        endif;
+                                        }
 
                                         ?>
 
@@ -2012,6 +2128,30 @@ echo buildSettings(
 			         }
                 });
             });
+              
+          $(function () {
+            //Data Tables
+            $('#orgLogs').DataTable({
+                displayLength: 10,
+                dom: 'T<"clear">lfrtip',
+                responsive: true,
+                "order": [[ 0, 'desc' ]],
+                "language": {
+                    "info": "<?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 0);?> _START_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 1);?> _END_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 2);?> _TOTAL_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 3);?>",
+                    "infoEmpty": "<?php echo $language->translate('NO_ENTRIES');?>",
+                    "infoFiltered": "<?php echo explosion($language->translate('FILTERED'), 0);?> _MAX_ <?php echo explosion($language->translate('FILTERED'), 1);?>",
+                    "lengthMenu": "<?php echo $language->translate('SHOW');?> _MENU_ <?php echo $language->translate('ENTRIES');?>",
+                    "search": "",
+                    "searchPlaceholder": "<?php echo $language->translate('SEARCH');?>",
+                    "searchClass": "<?php echo $language->translate('SEARCH');?>",
+                    "zeroRecords": "<?php echo $language->translate('NO_MATCHING');?>",
+                    "paginate": {
+            "next": "<?php echo $language->translate('NEXT');?>",
+                        "previous": "<?php echo $language->translate('PREVIOUS');?>",
+           }
+        }
+            });
+        });
         </script>
         <script>
             (function($) {
@@ -2214,6 +2354,12 @@ echo buildSettings(
                 editUsername = $('#unregister').find('#inputUsername');
                 $(editUsername).html('<input type="hidden" name="op" value="update"/><input type="hidden" name="role" value="user"/><input type="hidden" name="username"value="' + parent_idz + '" />');
             });
+            $("#viewOrgLogs, #viewLoginLogs").click(function(){
+                $('#orgLogTable').toggle();
+                $('#loginTable').toggle();
+                $('#viewOrgLogs').toggle();
+                $('#viewLoginLogs').toggle();
+            });
             $('#showLess').hide();
             $('#loadMore').click(function () {
                 x= (x+5 <= size_li) ? x+5 : size_li;
@@ -2487,8 +2633,8 @@ echo buildSettings(
                 changeColor("loading", "#E5A00D");
                 changeColor("hovertext", "#E0E3E6");
 
-            });
-            $('textarea').numberedtextarea({
+            });//$( "div" ).not( ".green, #blueone" )
+            $('textarea').not( ".no-code" ).numberedtextarea({
 
               // font color for line numbers
               color: null,
@@ -2510,7 +2656,7 @@ echo buildSettings(
             });
              $(document).mouseup(function (e)
 {
-                var container = $(".email-content");
+                var container = $(".email-content, .checkFrame, #content");
 
                 if (!container.is(e.target) && container.has(e.target).length === 0) {
                     $(".email-content").removeClass("email-active");
@@ -2530,141 +2676,19 @@ echo buildSettings(
                 }
             });
 
-            $("#open-tabs").on("click",function (e) {
-                $(".email-content").removeClass("email-active");
-                $('html').removeClass("overhid");
-                if($(window).width() < 768){
-                    $('html').addClass("overhid");
-                }
-
-                var settingsBox = $('.tab-box');
-                settingsBox.addClass("email-active");
-                $(this).parent().addClass("active");
-
-                $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(settingsBox).show();
-
-                setTimeout(function(){
-                    var refreshMailPreloader = settingsBox.find('.refresh-preloader'),
-                    deletedMailBox = refreshMailPreloader.fadeOut(300, function(){
-                    refreshMailPreloader.remove();
-                });
-                },600);
-                e.preventDefault();
-            });
-            $("#open-colors").on("click",function (e) {
-                $(".email-content").removeClass("email-active");
-                $('html').removeClass("overhid");
-                if($(window).width() < 768){
-                    $('html').addClass("overhid");
-                }
-
-                var settingsBox = $('.color-box');
-                settingsBox.addClass("email-active");
-                $(this).parent().addClass("active");
-
-                $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(settingsBox).show();
-
-                setTimeout(function(){
-                    var refreshMailPreloader = settingsBox.find('.refresh-preloader'),
-                    deletedMailBox = refreshMailPreloader.fadeOut(300, function(){
-                    refreshMailPreloader.remove();
-                });
-                },600);
-                e.preventDefault();
-            });
-            $("#open-homepage").on("click",function (e) {
-                $(".email-content").removeClass("email-active");
-                $('html').removeClass("overhid");
-                if($(window).width() < 768){
-                    $('html').addClass("overhid");
-                }
-
-                var settingsBox = $('.homepage-box');
-                settingsBox.addClass("email-active");
-                $(this).parent().addClass("active");
-
-                $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(settingsBox).show();
-
-                setTimeout(function(){
-                    var refreshMailPreloader = settingsBox.find('.refresh-preloader'),
-                    deletedMailBox = refreshMailPreloader.fadeOut(300, function(){
-                    refreshMailPreloader.remove();
-                });
-                },600);
-                e.preventDefault();
-            });
-            $("#open-advanced").on("click",function (e) {
-                $(".email-content").removeClass("email-active");
-                $('html').removeClass("overhid");
-                if($(window).width() < 768){
-                    $('html').addClass("overhid");
-                }
-
-                var settingsBox = $('.advanced-box');
-                settingsBox.addClass("email-active");
-                $(this).parent().addClass("active");
-
-                $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(settingsBox).show();
-
-                setTimeout(function(){
-                    var refreshMailPreloader = settingsBox.find('.refresh-preloader'),
-                    deletedMailBox = refreshMailPreloader.fadeOut(300, function(){
-                    refreshMailPreloader.remove();
-                });
-                },600);
-                e.preventDefault();
-            });
-            $("#open-info").on("click",function (e) {
+        
+     
+            $("#open-info, #open-users, #open-logs, #open-advanced, #open-homepage, #open-colors, #open-tabs, #open-donate ").on("click",function (e) {
                 $(".email-content").removeClass("email-active");
                 $('html').removeClass("overhid");
                 if($(window).width() < 768){
                     $('html').addClass("overhid");
                 }
 
-                var settingsBox = $('.info-box');
-                settingsBox.addClass("email-active");
-                $(this).parent().addClass("active");
-
-                $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(settingsBox).show();
-
-                setTimeout(function(){
-                    var refreshMailPreloader = settingsBox.find('.refresh-preloader'),
-                    deletedMailBox = refreshMailPreloader.fadeOut(300, function(){
-                    refreshMailPreloader.remove();
-                });
-                },600);
-                e.preventDefault();
-            });
-            $("#open-users").on("click",function (e) {
-                $(".email-content").removeClass("email-active");
-                $('html').removeClass("overhid");
-                if($(window).width() < 768){
-                    $('html').addClass("overhid");
-                }
-
-                var settingsBox = $('.users-box');
-                settingsBox.addClass("email-active");
-                $(this).parent().addClass("active");
-
-                $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(settingsBox).show();
-
-                setTimeout(function(){
-                    var refreshMailPreloader = settingsBox.find('.refresh-preloader'),
-                    deletedMailBox = refreshMailPreloader.fadeOut(300, function(){
-                    refreshMailPreloader.remove();
-                });
-                },600);
-                e.preventDefault();
-            });
-            $("#open-logs").on("click",function (e) {
-                $(".email-content").removeClass("email-active");
-                $('html').removeClass("overhid");
-                if($(window).width() < 768){
-                    $('html').addClass("overhid");
-                }
-
-                var settingsBox = $('.logs-box');
+                var settingsBox = $('.'+$(this).attr("box"));
+                console.log($(this).attr("box"))
                 settingsBox.addClass("email-active");
+                $("#settings-list").find("li").removeClass("active");
                 $(this).parent().addClass("active");
 
                 $("<div class='refresh-preloader'><div class='la-timer la-dark'><div></div></div></div>").appendTo(settingsBox).show();
@@ -2677,50 +2701,62 @@ echo buildSettings(
                 },600);
                 e.preventDefault();
             });
+          
+         
 			
-	function checkGithub() {
-		$.ajax({
-			type: "GET",
-			url: "https://api.github.com/repos/causefx/Organizr/releases",
-			dataType: "json",
-			success: function(github) {
-				var currentVersion = "<?php echo INSTALLEDVERSION;?>";
-				infoTabVersion = $('#about').find('#version');
-				infoTabVersionHistory = $('#about').find('#versionHistory');
-				infoTabNew = $('#about').find('#whatsnew');
-				infoTabDownload = $('#about').find('#downloadnow');
-				$.each(github, function(i,v) {
-					if(i === 0){ 
-						console.log(v.tag_name);
-						githubVersion = v.tag_name;
-						githubDescription = v.body;
-						githubName = v.name;
-					}
-					$(infoTabVersionHistory).append('<li style="display: none"><time class="cbp_tmtime" datetime="' + v.published_at + '"><span>' + v.published_at.substring(0,10) + '</span> <span>' + v.tag_name + '</span></time><div class="cbp_tmicon animated jello"><i class="fa fa-github-alt"></i></div><div class="cbp_tmlabel"><h2 class="text-uppercase">' + v.name + '</h2><p>' + v.body + '</p></div></li>');
-					size_li = $("#versionHistory li").size();
-					x=2;
-					$('#versionHistory li:lt('+x+')').show();
-				});
-				if(currentVersion < githubVersion){
-					console.log("You Need To Upgrade");
-					parent.notify("<strong><?php echo $language->translate("NEW_VERSION");?></strong> <?php echo $language->translate("CLICK_INFO");?>","arrow-circle-o-down","warning","50000", "<?=$notifyExplode[0];?>", "<?=$notifyExplode[1];?>");
-
-					$(infoTabNew).html("<br/><h4><strong><?php echo $language->translate("WHATS_NEW");?> " + githubVersion + "</strong></h4><strong><?php echo $language->translate("TITLE");?>: </strong>" + githubName + " <br/><strong><?php echo $language->translate("CHANGES");?>: </strong>" + githubDescription);
-					$(infoTabDownload).html("<br/><form style=\"display:initial;\" id=\"deletedb\" method=\"post\" onsubmit=\"ajax_request(\'POST\', \'upgradeInstall\'); return false;\"><input type=\"hidden\" name=\"action\" value=\"upgrade\" /><button class=\"btn waves btn-labeled btn-success text-uppercase waves-effect waves-float\" type=\"submit\"><span class=\"btn-label\"><i class=\"fa fa-refresh\"></i></span><?php echo $language->translate("AUTO_UPGRADE");?></button></form> <a href='https://github.com/causefx/Organizr/archive/master.zip' target='_blank' type='button' class='btn waves btn-labeled btn-success text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-download'></i></span>Organizr v." + githubVersion + "</a>");
-					$( "p[id^='upgrade']" ).toggle();
-				}else if(currentVersion === githubVersion){
-					console.log("You Are on Current Version");
-				}else{
-					console.log("something went wrong");
-				}
-
-				$(infoTabVersion).html("<strong><?php echo $language->translate("INSTALLED_VERSION");?>: </strong>" + currentVersion + " <strong><?php echo $language->translate("CURRENT_VERSION");?>: </strong>" + githubVersion + " <strong><?php echo $language->translate("DATABASE_PATH");?>:  </strong> <?php echo htmlentities(DATABASE_LOCATION);?>");
-			}
-		});
-	}
+            function checkGithub() {
+                $.ajax({
+                    type: "GET",
+                    url: "https://api.github.com/repos/causefx/Organizr/releases",
+                    dataType: "json",
+                    success: function(github) {
+                        var currentVersion = "<?php echo INSTALLEDVERSION;?>";
+                        infoTabVersion = $('#about').find('#version');
+                        infoTabVersionHistory = $('#about').find('#versionHistory');
+                        infoTabNew = $('#about').find('#whatsnew');
+                        infoTabDownload = $('#about').find('#downloadnow');
+                        $.each(github, function(i,v) {
+                            if(i === 0){ 
+                                console.log(v.tag_name);
+                                githubVersion = v.tag_name;
+                                githubDescription = v.body;
+                                githubName = v.name;
+                            }
+                            $(infoTabVersionHistory).append('<li style="display: none"><time class="cbp_tmtime" datetime="' + v.published_at + '"><span>' + v.published_at.substring(0,10) + '</span> <span>' + v.tag_name + '</span></time><div class="cbp_tmicon animated jello"><i class="fa fa-github-alt"></i></div><div class="cbp_tmlabel"><h2 class="text-uppercase">' + v.name + '</h2><p>' + v.body + '</p></div></li>');
+                            size_li = $("#versionHistory li").size();
+                            x=2;
+                            $('#versionHistory li:lt('+x+')').show();
+                        });
+                        if(currentVersion < githubVersion){
+                            console.log("You Need To Upgrade");
+                            parent.notify("<strong><?php echo $language->translate("NEW_VERSION");?></strong> <?php echo $language->translate("CLICK_INFO");?>","arrow-circle-o-down","warning","50000", "<?=$notifyExplode[0];?>", "<?=$notifyExplode[1];?>");
+
+                            $(infoTabNew).html("<br/><h4><strong><?php echo $language->translate("WHATS_NEW");?> " + githubVersion + "</strong></h4><strong><?php echo $language->translate("TITLE");?>: </strong>" + githubName + " <br/><strong><?php echo $language->translate("CHANGES");?>: </strong>" + githubDescription);
+                            <?php if (extension_loaded("ZIP")){?>
+                            $(infoTabDownload).html("<br/><form style=\"display:initial;\" id=\"upgradeOrg\" method=\"post\" onsubmit=\"ajax_request(\'POST\', \'upgradeInstall\'); return false;\"><input type=\"hidden\" name=\"action\" value=\"upgrade\" /><button class=\"btn waves btn-labeled btn-success text-uppercase waves-effect waves-float\" type=\"submit\"><span class=\"btn-label\"><i class=\"fa fa-refresh\"></i></span><?php echo $language->translate("AUTO_UPGRADE");?></button></form> <a href='https://github.com/causefx/Organizr/archive/master.zip' target='_blank' type='button' class='btn waves btn-labeled btn-success text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-download'></i></span>Organizr v." + githubVersion + "</a>");
+                            $( "p[id^='upgrade']" ).toggle();
+                            <?php }else{ ?>
+                            $(infoTabDownload).html("<br/><a href='https://github.com/causefx/Organizr/archive/master.zip' target='_blank' type='button' class='btn waves btn-labeled btn-success text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-download'></i></span>Organizr v." + githubVersion + "</a>");
+                            $( "p[id^='upgrade']" ).toggle();
+                            <?php } ?>
+                        }else if(currentVersion === githubVersion){
+                            console.log("You Are on Current Version");
+                        }else{
+                            console.log("something went wrong");
+                        }
+                        $(infoTabVersion).html("<strong><?php echo $language->translate("INSTALLED_VERSION");?>: </strong>" + currentVersion + " <strong><?php echo $language->translate("CURRENT_VERSION");?>: </strong>" + githubVersion + " <strong><?php echo $language->translate("DATABASE_PATH");?>:  </strong> <?php echo htmlentities(DATABASE_LOCATION);?>");
+                    }
+                });
+            }
         </script>
         <script>
         $( document ).ready(function() {
+            //AJAX Submit for URL Check
+            $('#urlTestForm_submit').on('click', function () {
+                ajax_request('POST', 'check-url', {
+                    checkurl: $('#urlTestForm [name=url-test]').val(),
+                });
+            });
             //Hide Icon box on load
             $( "div[class^='jFiler jFiler-theme-dragdropbox']" ).hide();
             //Set Some Scrollbars
@@ -2735,42 +2771,43 @@ echo buildSettings(
                 e.preventDefault();
             }, false);  
             //Set Hide Function
-			if (0) {
-            var authTypeFunc = function() {
-                // Hide Everything
-                $('#host-selected, #host-other, #host-plex, #host-emby, #host-ldap').hide();
-                // Qualify Auth Type
-                if($('#authType').val() !== "internal"){
-                    $( '#host-selected' ).show();
-
-                    // Qualify aithBackend
-                    if($('#authBackend').val() === "plex"){
-                        $('#host-selected, #host-plex').show();
-                    }else if($('#authBackend').val().indexOf("emby")>=0){
-                        $('#host-selected, #host-other, #host-emby').show();
-                    }else if($('#authBackend').val() === "ldap"){
-                        $('#host-selected, #host-other, #host-ldap').show();
-                    }else {
-                        $('#host-selected, #host-other').show();
+			         if (0) {
+                var authTypeFunc = function() {
+                    // Hide Everything
+                    $('#host-selected, #host-other, #host-plex, #host-emby, #host-ldap').hide();
+                    // Qualify Auth Type
+                    if($('#authType').val() !== "internal"){
+                        $( '#host-selected' ).show();
+
+                        // Qualify aithBackend
+                        if($('#authBackend').val() === "plex"){
+                            $('#host-selected, #host-plex').show();
+                        }else if($('#authBackend').val().indexOf("emby")>=0){
+                            $('#host-selected, #host-other, #host-emby').show();
+                        }else if($('#authBackend').val() === "ldap"){
+                            $('#host-selected, #host-other, #host-ldap').show();
+                        }else {
+                            $('#host-selected, #host-other').show();
+                        }
                     }
                 }
-            }
-            //Hide Settings on selection
-            $('#authType, #authBackend').on('change', authTypeFunc);
-            //Hide Settings on Load
-            authTypeFunc();
-			} else { console.log() }
+                //Hide Settings on selection
+                $('#authType, #authBackend').on('change', authTypeFunc);
+                //Hide Settings on Load
+                authTypeFunc();
+			         } else { console.log() }
             //Simulate Edit Tabs Click 
             //$("#open-tabs").trigger("click");
-            //Append Delete log to User Logs
-            $("div[class^='DTTT_container']").append('<form style="display: inline; margin-left: 3px;" id="deletelog" method="post" onsubmit="ajax_request(\'POST\', \'deleteLog\'); return false;"><input type="hidden" name="action" value="deleteLog" /><button class="btn waves btn-labeled btn-danger text-uppercase waves-effect waves-float" type="submit"><span class="btn-label"><i class="fa fa-trash"></i></span><?php echo $language->translate("PURGE_LOG");?> </button></form>')
+            //Append Delete log to User Logs and Org Logs
+            $("#datatable_wrapper > div[class^='DTTT_container']").append('<form style="display: inline; margin-left: 3px;" id="deletelog" method="post" onsubmit="ajax_request(\'POST\', \'deleteLog\'); return false;"><input type="hidden" name="action" value="deleteLog" /><button class="btn waves btn-labeled btn-danger text-uppercase waves-effect waves-float" type="submit"><span class="btn-label"><i class="fa fa-trash"></i></span><?php echo $language->translate("PURGE_LOG");?> </button></form>');
+            $("#orgLogs_wrapper > div[class^='DTTT_container']").append('<form style="display: inline; margin-left: 3px;" id="deleteOrglog" method="post" onsubmit="ajax_request(\'POST\', \'deleteOrgLog\'); return false;"><input type="hidden" name="action" value="deleteOrgLog" /><button class="btn waves btn-labeled btn-danger text-uppercase waves-effect waves-float" type="submit"><span class="btn-label"><i class="fa fa-trash"></i></span><?php echo $language->translate("PURGE_LOG");?> </button></form>')
             $("a[id^='ToolTables_datatable_0'] span").html('<?php echo $language->translate("PRINT");?>')
             //Enable Tooltips
             $('[data-toggle="tooltip"]').tooltip(); 
             //Tab save on reload - might need to delete as we changed tab layout
             //rememberTabSelection('#settingsTabs', !localStorage); 
-        	//AJAX call to github to get version info	
-			<?php if (GIT_CHECK) { echo 'checkGithub()'; } ?>
+        	   //AJAX call to github to get version info	
+			         <?php if (GIT_CHECK) { echo 'checkGithub()'; } ?>
 
             //Edit Info tab with Github info
             <?php if(file_exists(FAIL_LOG)) : ?>

+ 10 - 3
user.php

@@ -357,6 +357,7 @@ EOT;
 			// step 2b: if there was a user to reset a password for, reset it.
 			$dbpassword = $this->token_hash_password($username, $sha1, $token);
 			$update = "UPDATE users SET password = '$dbpassword' WHERE email= '$email'";
+   writeLog("success", "$username has reset their password");
 			$this->database->exec($update);
             //$this->info("Email has been sent with new password");
 			// step 3: notify the user of the new password
@@ -563,6 +564,7 @@ EOT;
 			$query = "SELECT * FROM users WHERE username = '$username'";
 			foreach($this->database->query($query) as $data) {
 				$this->info("created user account for $username");
+    writeLog("success", "$username has just registered");
 				$this->update_user_token($username, $sha1, false);
 				// make the user's data directory
 				$dir = USER_HOME . $username;
@@ -653,6 +655,7 @@ EOT;
 					file_put_contents(FAIL_LOG, $buildLog($username, "good_auth"));
 					chmod(FAIL_LOG, 0660);
 					setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN);
+     writeLog("success", "$username has logged in");
 					return true; 
 				} else if (AUTHBACKENDCREATE !== 'false' && $surface) {
 					// Create User
@@ -670,6 +673,7 @@ EOT;
 			} else if (!$authSuccess) {
 				// authentication failed
 				//$this->info("password mismatch for $username");
+    writeLog("error", "$username tried to sign-in with the wrong password");
 				file_put_contents(FAIL_LOG, $buildLog($username, "bad_auth"));
 				chmod(FAIL_LOG, 0660);
 				if(User::unsafe_reporting) { $this->error = "incorrect password for $username."; $this->error("incorrect password for $username."); }
@@ -700,6 +704,7 @@ EOT;
 				$dbpassword = $this->token_hash_password($username, $sha1, $this->get_user_token($username));
 				$update = "UPDATE users SET password = '$dbpassword' WHERE username = '$username'";
 				$this->database->exec($update); }
+   writeLog("success", "information for $username has been updated");
 			$this->info("updated the information for <strong>$username</strong>");
 		}
 		/**
@@ -720,6 +725,7 @@ EOT;
             unset($_COOKIE['cookiePassword']);
             setcookie("cookiePassword", '', time() - 3600, '/', DOMAIN);
             setcookie("cookiePassword", '', time() - 3600, '/');
+   writeLog("success", "$username has signed out");
 			return true;
 		}
 		/**
@@ -731,9 +737,10 @@ EOT;
 			$this->database->exec($delete);
 			$this->info("<strong>$username</strong> has been kicked out of Organizr");
 			//$this->resetSession();
-            $dir = USER_HOME . $username;
-            if(!rmdir($dir)) { $this->error("could not delete user directory $dir"); }
-            $this->info("and we deleted user directory $dir");
+    $dir = USER_HOME . $username;
+    if(!rmdir($dir)) { $this->error("could not delete user directory $dir"); }
+    $this->info("and we deleted user directory $dir");
+    writeLog("success", "$username has been deleted");
 			return true;
 		}
 		/**