Prechádzať zdrojové kódy

Merge pull request #713 from causefx/cero-dev

Cero dev
causefx 8 rokov pred
rodič
commit
8c88430ff3
6 zmenil súbory, kde vykonal 84 pridanie a 24 odobranie
  1. 5 0
      config/configDefaults.php
  2. 15 16
      error.php
  3. 17 3
      functions.php
  4. 1 1
      index.php
  5. 44 2
      settings.php
  6. 2 2
      user.php

+ 5 - 0
config/configDefaults.php

@@ -93,9 +93,13 @@ return array(
 	"smtpHostType" => "tls",
 	"smtpHostType" => "tls",
 	"homepageNoticeTitle" => "",
 	"homepageNoticeTitle" => "",
 	"homepageNoticeMessage" => "",
 	"homepageNoticeMessage" => "",
+	"homepageNoticeTitleGuest" => "",
+	"homepageNoticeMessageGuest" => "",
 	"homepageNoticeType" => "success",
 	"homepageNoticeType" => "success",
+	"homepageNoticeTypeGuest" => "success",
 	"homepageNoticeAuth" => "false",
 	"homepageNoticeAuth" => "false",
 	"homepageNoticeLayout" => "elegant",
 	"homepageNoticeLayout" => "elegant",
+	"homepageNoticeLayoutGuest" => "elegant",
 	"ipInfoToken" => "ddd0c072ad5021",
 	"ipInfoToken" => "ddd0c072ad5021",
 	"historyRefresh" => "120000",
 	"historyRefresh" => "120000",
 	"downloadRefresh" => "30000",
 	"downloadRefresh" => "30000",
@@ -132,5 +136,6 @@ return array(
 	"homepageOrderembyrecent" => '11',
 	"homepageOrderembyrecent" => '11',
 	"homepageOrderombi" => '12',
 	"homepageOrderombi" => '12',
 	"homepageOrdercalendar" => '13',
 	"homepageOrdercalendar" => '13',
+	"homepageOrdernoticeguest" => '14',
 	'requestedUserOnly' => 'true',
 	'requestedUserOnly' => 'true',
 );
 );

+ 15 - 16
error.php

@@ -8,9 +8,9 @@ $databaseConfig = configLazy('config/config.php');
 // Load USER
 // Load USER
 require_once("user.php");
 require_once("user.php");
 $USER = new User("registration_callback");
 $USER = new User("registration_callback");
-if(isset($_GET['error'])){
-    $status = (isset($_GET['error'])?$_GET['error']:123);
-    setcookie('lec', $status, time() + (3), "/", DOMAIN);
+if(isset($_GET['error']) && $_GET['error'] !== '404'){
+    $status = (isset($_GET['error'])?$_GET['error']:404);
+    setcookie('lec', $status, time() + (5), "/", DOMAIN);
     http_response_code($status);
     http_response_code($status);
     //get file name
     //get file name
     if(!empty($_SERVER['PHP_SELF'])){
     if(!empty($_SERVER['PHP_SELF'])){
@@ -24,7 +24,7 @@ if(isset($_GET['error'])){
     exit();
     exit();
 }
 }
 if(!isset($_COOKIE['lec'])) {
 if(!isset($_COOKIE['lec'])) {
-    $status = '123';
+    $status = '404';
 } else {
 } else {
     $status = $_COOKIE['lec'];
     $status = $_COOKIE['lec'];
 }
 }
@@ -41,18 +41,17 @@ foreach(loadAppearance() as $key => $value) {
 //error stuff
 //error stuff
 $requested = $_SERVER['REQUEST_URI'];
 $requested = $_SERVER['REQUEST_URI'];
 $codes = array(
 $codes = array(
-    123 => array('No Error Set', 'No error was set.', 'sowwy','---'),
-    400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy','400'),
-    401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy','401'),
-    403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy','403'),
-    404 => array('Not Found', $requested . ' was not found on this server.', 'confused','404'),
-    405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused','405'),
-    408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy','408'),
-    500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused','500'),
-    502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused','502'),
-    503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused','503'),
-    504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused','504'),
-    999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused', '401'),
+       400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy','400'),
+       401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy','401'),
+       403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy','403'),
+       404 => array('Not Found', $requested . ' was not found on this server.', 'confused','404'),
+       405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused','405'),
+       408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy','408'),
+       500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused','500'),
+       502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused','502'),
+       503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused','503'),
+       504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused','504'),
+       999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused', '401'),
 );
 );
 $errorTitle = ($codes[$status][0]) ? $codes[$status][0] : "Error";
 $errorTitle = ($codes[$status][0]) ? $codes[$status][0] : "Error";
 $message = ($codes[$status][1]) ? $codes[$status][1] : "An Error Occured";
 $message = ($codes[$status][1]) ? $codes[$status][1] : "An Error Occured";

+ 17 - 3
functions.php

@@ -24,6 +24,7 @@ function homepageOrder(){
 		"homepageOrderembyrecent" => homepageOrderembyrecent,
 		"homepageOrderembyrecent" => homepageOrderembyrecent,
 		"homepageOrderombi" => homepageOrderombi,
 		"homepageOrderombi" => homepageOrderombi,
 		"homepageOrdercalendar" => homepageOrdercalendar,
 		"homepageOrdercalendar" => homepageOrdercalendar,
+		"homepageOrdernoticeguest" => homepageOrdernoticeguest,
 	);
 	);
 	asort($homepageOrder);
 	asort($homepageOrder);
 	return $homepageOrder;
 	return $homepageOrder;
@@ -38,7 +39,7 @@ function debug_out($variable, $die = false) {
 }
 }
 
 
 //Cookie Function
 //Cookie Function
-function coookie($type, $name, $value = '', $days = -1){
+function coookie($type, $name, $value = '', $days = -1, $http = true){
 	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https"){
 	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https"){
 		$Secure = true;
 		$Secure = true;
  	   	$HTTPOnly = true;
  	   	$HTTPOnly = true;
@@ -49,6 +50,7 @@ function coookie($type, $name, $value = '', $days = -1){
 		$Secure = false;
 		$Secure = false;
  	   	$HTTPOnly = false;
  	   	$HTTPOnly = false;
    }
    }
+   if(!$http){ $HTTPOnly = false; }
 	$Path = '/';
 	$Path = '/';
 	$Domain = $_SERVER['HTTP_HOST'];
 	$Domain = $_SERVER['HTTP_HOST'];
 	$Port = strpos($Domain, ':');
 	$Port = strpos($Domain, ':');
@@ -5139,8 +5141,8 @@ function outputOmbiRequests($header = "Requested Content", $items, $script = fal
     $hideMenu .= '</ul></div></div>';
     $hideMenu .= '</ul></div></div>';
     // If None Populate Empty Item
     // If None Populate Empty Item
     //if (count(array_flip($items)) < 1) {
     //if (count(array_flip($items)) < 1) {
-	if (!count($items)) {
-        return '<div id="recentRequests" class="content-box box-shadow big-box"><h5 class="text-center">'.$header.'</h5><p class="text-center">No Requests Found</p></div>';
+	if(!array_filter($items)) {
+        return '<div id="recentRequests"></div>';
     }else{
     }else{
 		$className = str_replace(' ', '', $header);
 		$className = str_replace(' ', '', $header);
         return '<div id="recentRequests" class="content-box box-shadow big-box"><h5 id="requestContent-title" style="margin-bottom: -20px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination '.$className.'">'.$hideMenu.'</div><br/><br/><div class="recentItems-request" data-name="'.$className.'">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
         return '<div id="recentRequests" class="content-box box-shadow big-box"><h5 id="requestContent-title" style="margin-bottom: -20px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination '.$className.'">'.$hideMenu.'</div><br/><br/><div class="recentItems-request" data-name="'.$className.'">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
@@ -5186,6 +5188,13 @@ function buildHomepageSettings(){
 					$class .= ' faded';
 					$class .= ' faded';
 				}
 				}
 				break;
 				break;
+			case 'homepageOrdernoticeguest':
+				$class = 'palette-Cyan-A400 bg gray';
+				$image = 'images/pin.png';
+				if(empty(HOMEPAGENOTICETITLEGUEST) && empty(HOMEPAGENOTICEMESSAGEGUEST)){
+					$class .= ' faded';
+				}
+				break;
 			case 'homepageOrderspeedtest':
 			case 'homepageOrderspeedtest':
 				$class = 'red-bg';
 				$class = 'red-bg';
 				$image = 'images/settings/full-color/png/64px/speedometer.png';
 				$image = 'images/settings/full-color/png/64px/speedometer.png';
@@ -5308,6 +5317,11 @@ function buildHomepageItem($homepageItem, $group, $user){
 				$homepageItemBuilt .= buildHomepageNotice(HOMEPAGENOTICELAYOUT, HOMEPAGENOTICETYPE, HOMEPAGENOTICETITLE, HOMEPAGENOTICEMESSAGE);
 				$homepageItemBuilt .= buildHomepageNotice(HOMEPAGENOTICELAYOUT, HOMEPAGENOTICETYPE, HOMEPAGENOTICETITLE, HOMEPAGENOTICEMESSAGE);
 			}
 			}
 			break;
 			break;
+		case 'homepageOrdernoticeguest':
+			if ($group == 'guest' && HOMEPAGENOTICETITLEGUEST && HOMEPAGENOTICETYPEGUEST && HOMEPAGENOTICEMESSAGEGUEST && HOMEPAGENOTICELAYOUTGUEST) {
+				$homepageItemBuilt .= buildHomepageNotice(HOMEPAGENOTICELAYOUTGUEST, HOMEPAGENOTICETYPEGUEST, HOMEPAGENOTICETITLEGUEST, HOMEPAGENOTICEMESSAGEGUEST);
+			}
+			break;
 		case 'homepageOrderspeedtest':
 		case 'homepageOrderspeedtest':
 			if(SPEEDTEST == "true" && qualifyUser(SPEEDTESTAUTH)){
 			if(SPEEDTEST == "true" && qualifyUser(SPEEDTESTAUTH)){
 				$homepageItemBuilt .= '
 				$homepageItemBuilt .= '

+ 1 - 1
index.php

@@ -1045,7 +1045,7 @@ $group = (isset($group) ? $group : "guest");
 			</div>
 			</div>
 		</div>
 		</div>
 		<?php } ?>
 		<?php } ?>
-		<?php if (file_exists('config/config.php') && $configReady == "Yes" && $tabSetup == "No" && SPLASH == "true" && $splash) {?>
+		<?php if (file_exists('config/config.php') && $configReady == "Yes" && $tabSetup == "No" && SPLASH == "true" && $splash && count($splash) > 1) {?>
 		<div id="splashScreen" class="splash-modal modal fade">
 		<div id="splashScreen" class="splash-modal modal fade">
 			<div style="background:<?=$sidebar;?>;" class="table-wrapper big-box">
 			<div style="background:<?=$sidebar;?>;" class="table-wrapper big-box">
 
 

+ 44 - 2
settings.php

@@ -1513,6 +1513,46 @@ echo buildSettings(
 		 				'labelTranslate' => 'NOTICE_MESSAGE',
 		 				'labelTranslate' => 'NOTICE_MESSAGE',
 						'html' => '<div class="summernote" name="homepageNoticeMessage">'.HOMEPAGENOTICEMESSAGE.'</div>',
 						'html' => '<div class="summernote" name="homepageNoticeMessage">'.HOMEPAGENOTICEMESSAGE.'</div>',
 					),
 					),
+                    array(
+						'type' => 'custom',
+						'html' => '<h2>Not Logged In/Guest Notice</h2>',
+					),
+                    array(
+						'type' => $userSelectType,
+						'labelTranslate' => 'NOTICE_LAYOUT',
+						'name' => 'homepageNoticeLayoutGuest',
+						'value' => HOMEPAGENOTICELAYOUTGUEST,
+						'options' => array(
+							'Elegant' => 'elegant',
+							'Basic' => 'basic',
+							'Jumbotron' => 'jumbotron',
+						),
+					),
+     				array(
+						'type' => $userSelectType,
+						'labelTranslate' => 'NOTICE_COLOR',
+						'name' => 'homepageNoticeTypeGuest',
+						'value' => HOMEPAGENOTICETYPEGUEST,
+						'options' => array(
+							'Green' => 'success',
+							'Blue' => 'primary',
+							'Gray' => 'gray',
+							'Red' => 'danger',
+							'Yellow' => 'warning',
+							'Light Blue' => 'info',
+						),
+					),
+     				array(
+						'type' => 'text',
+						'labelTranslate' => 'NOTICE_TITLE',
+						'name' => 'homepageNoticeTitleGuest',
+						'value' => HOMEPAGENOTICETITLEGUEST,
+					),
+        			array(
+						'type' => 'custom',
+		 				'labelTranslate' => 'NOTICE_MESSAGE',
+						'html' => '<div class="summernote" name="homepageNoticeMessageGuest">'.HOMEPAGENOTICEMESSAGEGUEST.'</div>',
+					),
 				),
 				),
 			),
 			),
 			array(
 			array(
@@ -3370,8 +3410,10 @@ echo buildSettings(
                 $(editUsername).html('<input type="hidden" name="op" value="unregister"/><input type="hidden" name="username"value="' + parent_id + '" />');
                 $(editUsername).html('<input type="hidden" name="op" value="unregister"/><input type="hidden" name="username"value="' + parent_id + '" />');
             });
             });
             $(".newemail").click(function(){
             $(".newemail").click(function(){
-                $(".editUserEmail").show();
-                $(".closeEditUserEmail").show();
+                $(".editUserEmail").hide();
+                $(".closeEditUserEmail").hide();
+				$(this).parent().find('.editUserEmail').show();
+                $(this).parent().find('.closeEditUserEmail').show();
             });
             });
             $(".closeEditUserEmail").click(function(){
             $(".closeEditUserEmail").click(function(){
                 $(".editUserEmail").hide();
                 $(".editUserEmail").hide();

+ 2 - 2
user.php

@@ -136,7 +136,7 @@
             $mail = new PHPMailer;
             $mail = new PHPMailer;
             $mail->isSMTP();
             $mail->isSMTP();
             $mail->Host = SMTPHOST;
             $mail->Host = SMTPHOST;
-            $mail->SMTPAuth = SMTPHOSTAUTH;
+            $mail->SMTPAuth = (SMTPHOSTAUTH == "true" || SMTPHOSTAUTH == true) ? true : false;
             $mail->Username = SMTPHOSTUSERNAME;
             $mail->Username = SMTPHOSTUSERNAME;
             $mail->Password = SMTPHOSTPASSWORD;
             $mail->Password = SMTPHOSTPASSWORD;
             $mail->SMTPSecure = SMTPHOSTTYPE;
             $mail->SMTPSecure = SMTPHOSTTYPE;
@@ -746,7 +746,7 @@
 					if(OMBIURL){
 					if(OMBIURL){
 						$ombiToken = getOmbiToken($username, $password);
 						$ombiToken = getOmbiToken($username, $password);
 						if($ombiToken){
 						if($ombiToken){
-							coookie('set','Auth',$ombiToken,7);
+							coookie('set','Auth',$ombiToken,7, false);
 						}
 						}
 					}
 					}
 					if(PLEXURL && isset($authSuccess['token'])){
 					if(PLEXURL && isset($authSuccess['token'])){