瀏覽代碼

Merge pull request #576 from causefx/cero-dev

Added Admin email
causefx 8 年之前
父節點
當前提交
ee2d24c379
共有 4 個文件被更改,包括 33 次插入82 次删除
  1. 8 1
      functions.php
  2. 2 17
      homepage.php
  3. 15 64
      index.php
  4. 8 0
      user.php

+ 8 - 1
functions.php

@@ -1488,7 +1488,7 @@ function getError($os, $error){
 		),
 		'curl' => array(
 			'win' => '<b>cURL</b> not enabled, uncomment ;extension=php_curl.dll in the file php.ini | '.$ext,
-			'nix' => '<b>cURL</b> not enabled, PHP7 -> sudo apt-get install php-curl | PHP5 -> run sudo apt-get install php5.6-curl',
+			'nix' => '<b>cURL</b> not enabled, PHP7 -> sudo apt-get install php-curl or sudo apt-get install php7.0-curl | PHP5 -> run sudo apt-get install php5.6-curl',
 		),
 		'zip' => array(
 			'win' => '<b>PHP Zip</b> not enabled, uncomment ;extension=php_zip.dll in the file php.ini, if that doesn\'t work remove that line',
@@ -3630,6 +3630,13 @@ function inviteCodes($action, $code = null, $usedBy = null) {
 		case "use":
 			$currentIP = get_client_ip();
 			$invites = $GLOBALS['file_db']->query('UPDATE invites SET valid = "No", usedby = "'.$usedBy.'", dateused = "'.$now.'", ip = "'.$currentIP.'" WHERE code = "'.$code.'"');
+			if(ENABLEMAIL){
+				if (!isset($GLOBALS['USER'])) {
+					require_once("user.php");
+					$GLOBALS['USER'] = new User('registration_callback');
+				}
+				sendEmail($GLOBALS['USER']->adminEmail, "Admin", "Plex Invite Used", orgEmail("PLEX Invite Used", "Look who joined the cool club", "Admin", "Hey, The User: $usedBy has redeemd their invite code: [$code], their IP Address was: $currentIP", null, null, "What Next?", "Well, That is up to you.  You can go check on them if you like."));
+			}
 			return (!empty($invites) ? true : false );
 			break;
 	}

+ 2 - 17
homepage.php

@@ -424,25 +424,11 @@ foreach(loadAppearance() as $key => $value) {
                         echo getPlexRecent($plexArray);
                     } 
                     ?>
-                    <!--<script>
-                        setInterval(function() {
-                            $('<div></div>').load('ajax.php?a=plex-recent',function() {
-                                var element = $(this).find('[id]');
-                                var loadedID = 	element.attr('id');
-                                $('#'+loadedID).replaceWith(element);
-                                console.log('Recent updated: '+loadedID);
-                            });
-                        }, 15000);
-                    </script>-->
                     </div>
                 </div>
                 <div id="plexPlaylists" class="row">
                     <div class="col-lg-12">
-                    <?php
-                    if(PLEXPLAYLISTS == "true"){  
-                        echo getPlexPlaylists($plexArray);
-                    } 
-                    ?>
+                    <?php if(PLEXPLAYLISTS == "true"){ echo getPlexPlaylists($plexArray); } ?>
                     </div>
                 </div>
                 <?php } ?>
@@ -457,8 +443,7 @@ foreach(loadAppearance() as $key => $value) {
                     if(EMBYRECENTMOVIE == "true" || EMBYRECENTTV == "true" || EMBYRECENTMUSIC == "true"){  
                         $embyArray = array("Movie" => EMBYRECENTMOVIE, "Episode" => EMBYRECENTTV, "MusicAlbum" => EMBYRECENTMUSIC, "Series" => EMBYRECENTTV);
                         echo getEmbyRecent($embyArray);
-                    } 
-    
+                    }
                     ?>
                     </div>
 

+ 15 - 64
index.php

@@ -24,19 +24,6 @@ $hasOptions = "No";
 $settingsicon = "No";
 $settingsActive = "";
 $action = "";
-/*$title = "Organizr";
-$topbar = "#333333"; 
-$topbartext = "#66D9EF";
-$bottombar = "#333333";
-$sidebar = "#393939";
-$hoverbg = "#AD80FD";
-$activetabBG = "#F92671";
-$activetabicon = "#FFFFFF";
-$activetabtext = "#FFFFFF";
-$inactiveicon = "#66D9EF";
-$inactivetext = "#66D9EF";
-$loading = "#66D9EF";
-$hovertext = "#000000";*/
 $loadingIcon = "images/organizr-load-w-thick.gif";
 $baseURL = "";
 
@@ -155,30 +142,6 @@ if (file_exists('config/config.php')) {
 
 	endif;
 
-	/*if($hasOptions == "Yes") :
-
-		$resulto = $file_db->query('SELECT * FROM options');
-
-		foreach($resulto as $row) : 
-
-			$title = isset($row['title']) ? $row['title'] : "Organizr";
-			$topbartext = isset($row['topbartext']) ? $row['topbartext'] : "#66D9EF";
-			$topbar = isset($row['topbar']) ? $row['topbar'] : "#333333";
-			$bottombar = isset($row['bottombar']) ? $row['bottombar'] : "#333333";
-			$sidebar = isset($row['sidebar']) ? $row['sidebar'] : "#393939";
-			$hoverbg = isset($row['hoverbg']) ? $row['hoverbg'] : "#AD80FD";
-			$activetabBG = isset($row['activetabBG']) ? $row['activetabBG'] : "#F92671";
-			$activetabicon = isset($row['activetabicon']) ? $row['activetabicon'] : "#FFFFFF";
-			$activetabtext = isset($row['activetabtext']) ? $row['activetabtext'] : "#FFFFFF";
-			$inactiveicon = isset($row['inactiveicon']) ? $row['inactiveicon'] : "#66D9EF";
-			$inactivetext = isset($row['inactivetext']) ? $row['inactivetext'] : "#66D9EF";
-			$loading = isset($row['loading']) ? $row['loading'] : "#66D9EF";
-			$hovertext = isset($row['hovertext']) ? $row['hovertext'] : "#000000";
-
-		endforeach;
-
-	endif;*/
-
 	$userpic = md5( strtolower( trim( $USER->email ) ) );
 	if(LOADINGICON !== "") : $loadingIcon = LOADINGICON; endif;
 
@@ -864,7 +827,7 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 
 		</div>
 		<?php if($configReady == "Yes") : if(!$USER->authenticated && $configReady == "Yes") : ?>
-		<div class="login-modal modal fade">
+		<div id="loginModal" class="login-modal modal fade">
 			<div style="background:<?=$sidebar;?>;" class="table-wrapper">
 				<div class="table-row">
 					<div class="table-cell text-center">
@@ -1230,17 +1193,10 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 			}, 500);
 
 		}
-		$('#loginSubmit').click(function() {
-			/*if ($('#login').smkValidate()) {
-				console.log("validated");
-			}
-			console.log("didnt validate");*/
-		});
 		$('#registerSubmit').click(function() {
 			if ($('#registration').smkValidate()) {
 				console.log("validated");
 			}
-			console.log("didnt validate");
 			User.processRegistration();
 		});
 		$("#editInfo").click(function(){
@@ -1282,7 +1238,6 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 			$("#switchCreateUser").toggle();
 		});
 		$("#switchForgot").click(function(){
-
 			$( "form[id^='login']" ).toggle();
 			$( "form[id^='forgotPassword']" ).toggle();
 			$("#switchForgot").toggle();
@@ -1290,7 +1245,6 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 			$("#welcomeGoBack").toggle();
 		});
 		$("#switchCreateUser").click(function(){
-
 			$( "form[id^='login']" ).toggle();
 			$("#userPassForm").toggle();
 			$("#switchForgot").toggle();
@@ -1313,29 +1267,26 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 
 		//Logout
 		$(".logout").click(function(e){
-		var el1 = document.querySelector(".logout"),
-		el2 = document.querySelector(".logout-modal");
-		cta(el1, el2, {relativeToWindow: true}, function () {
-		$('.logout-modal').modal("show");
-		});
-
-		e.preventDefault();
+			var el1 = document.querySelector(".logout"),
+			el2 = document.querySelector(".logout-modal");
+			cta(el1, el2, {relativeToWindow: true}, function () {
+				$('.logout-modal').modal("show");
+			});
+			e.preventDefault();
 		});
 
 		//Members Sidebar
 		$(".show-members").click(function(e){
-		var e_s1 = document.querySelector(".show-members"),
-		e_s2 = document.querySelector("#members-sidebar");
-
-		cta(e_s1, e_s2, {relativeToWindow: true}, function () {
-		$('#members-sidebar').addClass('members-sidebar-open');
-		});
-
-		e.preventDefault();
+			var e_s1 = document.querySelector(".show-members"),
+			e_s2 = document.querySelector("#members-sidebar");
+			cta(e_s1, e_s2, {relativeToWindow: true}, function () {
+		$		('#members-sidebar').addClass('members-sidebar-open');
+			});
+			e.preventDefault();
 		});
 
 		$('.close-members-sidebar').click(function(){
-		$('#members-sidebar').removeClass('members-sidebar-open');
+			$('#members-sidebar').removeClass('members-sidebar-open');
 		});
 
 		$(document).ready(function(){
@@ -1448,7 +1399,7 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 			if (defaultTab == null){
 				$("div[id^='tabEmpty']").show();
 				<?php if($needSetup == "No" && $configReady == "Yes") : if(!$USER->authenticated) : ?>
-				$('.login-modal').modal("show");
+				$('#loginModal').modal("show");
 				<?php endif; endif; ?>
 			}
 			if ($(location).attr('hash')){

+ 8 - 0
user.php

@@ -118,6 +118,7 @@
 		var $userdir = false;
 		// the user's email address, if logged in.
 		var $email = "";
+		var $adminEmail = "";
 		// the user's role in the system
 		var $role = "";
 		var $group = "";
@@ -212,6 +213,7 @@
 			$this->username = $_SESSION["username"];
 			$this->userdir = ($this->username !=User::GUEST_USER? USER_HOME . $this->username : false);
 			$this->email = $this->get_user_email($this->username);
+			$this->adminEmail = $this->get_admin_email();
 			$this->role = $this->get_user_role($this->username);
 			//$this->group = $this->get_user_group($this->username);
 			// clear database
@@ -825,6 +827,12 @@
 				foreach($this->database->query($query) as $data) { return $data["email"]; }}
 			return "";
 		}
+		function get_admin_email()
+		{
+			$query = "SELECT email FROM users WHERE role = 'admin' COLLATE NOCASE LIMIT 1";
+			foreach($this->database->query($query) as $data) { return $data["email"]; }
+			return "";
+		}
 		/**
 		 * Get a user's role
 		 */