Rob Gökemeijer 8 роки тому
батько
коміт
a946f9c707

+ 2 - 2
api/config/default.php

@@ -146,6 +146,6 @@ return array(
 	'mediaSearch' => false,
 	'mediaSearchType' => '',
 	'mediaSearchAuth' => '1',
-	'registrationPassword' => '',
-	'hideRegistration' => false
+    'registrationPassword' => '',
+    'hideRegistration' => false
 );

+ 3 - 3
api/functions/auth-functions.php

@@ -1,9 +1,9 @@
 <?php
 function authRegister($username, $password, $defaults, $email)
 {
-	if ($GLOBALS['authBackend'] !== '') {
-		ombiImport($GLOBALS['authBackend']);
-	}
+    if ($GLOBALS['authBackend'] !== '') {
+        ombiImport($GLOBALS['authBackend']);
+    }
 	if (createUser($username, $password, $defaults, $email)) {
 		writeLog('success', 'Registration Function - A User has registered', $username);
 		if ($GLOBALS['PHPMAILER-enabled']) {

+ 54 - 51
api/functions/homepage-connect-functions.php

@@ -924,40 +924,43 @@ function getCalendar()
         }
     }
     // iCal URL
-    $icalEvents = array();
     if ($GLOBALS['homepageCalendarEnabled'] && qualifyRequest($GLOBALS['homepageCalendarAuth']) && !empty($GLOBALS['calendariCal'])) {
         $calendars = array();
         $calendarURLList = explode(',', $GLOBALS['calendariCal']);
+        $icalEvents = array();
         foreach ($calendarURLList as $key => $value) {
             $icsEvents = getIcsEventsAsArray($value);
-            $timeZone = trim($icsEvents [1] ['X-WR-TIMEZONE']);
-            unset($icsEvents [1]);
-            foreach ($icsEvents as $icsEvent) {
-                if (isset($icsEvent['DTSTART']) && isset($icsEvent['DTEND']) && isset($icsEvent['SUMMARY'])) {
-                    /* Getting start date and time */
-                    $start = isset($icsEvent ['DTSTART;VALUE=DATE']) ? $icsEvent ['DTSTART;VALUE=DATE'] : $icsEvent ['DTSTART'];
-                    /* Converting to datetime and apply the timezone to get proper date time */
-                    $startDt = new DateTime ($start);
-                    $startDt->setTimeZone(new DateTimezone ($timeZone));
-                    $startDate = $startDt->format(DateTime::ATOM);
-                    /* Getting end date with time */
-                    $end = isset($icsEvent ['DTEND;VALUE=DATE']) ? $icsEvent ['DTEND;VALUE=DATE'] : $icsEvent ['DTEND'];
-                    $endDt = new DateTime ($end);
-                    $endDate = $endDt->format(DateTime::ATOM);
-                    /* Getting the name of event */
-                    $eventName = $icsEvent['SUMMARY'];
-                    $icalEvents[] = array(
-                        'title' => $eventName,
-                        'start' => $startDate,
-                        'end' => $endDate
-                    );
+
+            if (isset($icsEvents) && !empty($icsEvents)) {
+                $timeZone = trim($icsEvents [1] ['X-WR-TIMEZONE']);
+                unset($icsEvents [1]);
+                foreach ($icsEvents as $icsEvent) {
+                    if (isset($icsEvent['DTSTART']) && isset($icsEvent['DTEND']) && isset($icsEvent['SUMMARY'])) {
+                        /* Getting start date and time */
+                        $start = isset($icsEvent ['DTSTART;VALUE=DATE']) ? $icsEvent ['DTSTART;VALUE=DATE'] : $icsEvent ['DTSTART'];
+                        /* Converting to datetime and apply the timezone to get proper date time */
+                        $startDt = new DateTime ($start);
+                        $startDt->setTimeZone(new DateTimezone ($timeZone));
+                        $startDate = $startDt->format(DateTime::ATOM);
+                        /* Getting end date with time */
+                        $end = isset($icsEvent ['DTEND;VALUE=DATE']) ? $icsEvent ['DTEND;VALUE=DATE'] : $icsEvent ['DTEND'];
+                        $endDt = new DateTime ($end);
+                        $endDate = $endDt->format(DateTime::ATOM);
+                        /* Getting the name of event */
+                        $eventName = $icsEvent['SUMMARY'];
+                        $icalEvents[] = array(
+                            'title' => $eventName,
+                            'start' => $startDate,
+                            'end' => $endDate
+                        );
+                    }
                 }
             }
         }
+        $calendarSources['ical'] = $icalEvents;
     }
 
     $calendarSources['events'] = $calendarItems;
-    $calendarSources['ical'] = $icalEvents;
     return ($calendarSources) ? $calendarSources : false;
 }
 
@@ -1503,34 +1506,34 @@ function ombiAPI($array)
 
 function ombiImport($type = null)
 {
-	if (!empty($GLOBALS['ombiURL']) && !empty($GLOBALS['ombiToken']) && !empty($type)) {
-		try {
-			$url = qualifyURL($GLOBALS['ombiURL']);
-			$headers = array(
-				"Accept" => "application/json",
-				"Content-Type" => "application/json",
-				"Apikey" => $GLOBALS['ombiToken']
-			);
-			$options = (localURL($url)) ? array('verify' => false) : array();
-			switch ($type) {
-				case 'emby':
-					$response = Requests::get($url . "/api/v1/Job/embyuserimporter", $headers, $options);
-					break;
-				case 'plex':
-					$response = Requests::get($url . "/api/v1/Job/plexuserimporter", $headers, $options);
-					break;
-				default:
-					break;
-			}
-			if ($response->success) {
-				writeLog('success', 'OMBI Connect Function - Ran User Import', 'SYSTEM');
-				return true;
-			}
-		} catch (Requests_Exception $e) {
-			writeLog('error', 'OMBI Connect Function - Error: ' . $e->getMessage(), 'SYSTEM');
-		};
-	}
-	return false;
+    if (!empty($GLOBALS['ombiURL']) && !empty($GLOBALS['ombiToken']) && !empty($type)) {
+        try {
+            $url = qualifyURL($GLOBALS['ombiURL']);
+            $headers = array(
+                "Accept" => "application/json",
+                "Content-Type" => "application/json",
+                "Apikey" => $GLOBALS['ombiToken']
+            );
+            $options = (localURL($url)) ? array('verify' => false) : array();
+            switch ($type) {
+                case 'emby':
+                    $response = Requests::get($url . "/api/v1/Job/embyuserimporter", $headers, $options);
+                    break;
+                case 'plex':
+                    $response = Requests::get($url . "/api/v1/Job/plexuserimporter", $headers, $options);
+                    break;
+                default:
+                    break;
+            }
+            if ($response->success) {
+                writeLog('success', 'OMBI Connect Function - Ran User Import', 'SYSTEM');
+                return true;
+            }
+        } catch (Requests_Exception $e) {
+            writeLog('error', 'OMBI Connect Function - Error: ' . $e->getMessage(), 'SYSTEM');
+        };
+    }
+    return false;
 }
 
 function ombiAction($id, $action, $type)

Різницю між файлами не показано, бо вона завелика
+ 648 - 568
api/functions/homepage-functions.php


+ 34 - 18
api/functions/normal-functions.php

@@ -428,29 +428,25 @@ function getServer($over = false)
 	}
 	return isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $_SERVER["SERVER_NAME"];
 }
-
 /* Function is to get all the contents from ics and explode all the datas according to the events and its sections */
 function getIcsEventsAsArray($file)
 {
-    if ($icalString = @file_get_contents($file)) {
-        $icsDates = array();
-        /* Explode the ICs Data to get datas as array according to string ‘BEGIN:’ */
-        $icsData = explode("BEGIN:", $icalString);
-        /* Iterating the icsData value to make all the start end dates as sub array */
-        foreach ($icsData as $key => $value) {
-            $icsDatesMeta [$key] = explode("\n", $value);
-        }
-        /* Itearting the Ics Meta Value */
-        foreach ($icsDatesMeta as $key => $value) {
-            foreach ($value as $subKey => $subValue) {
-                /* to get ics events in proper order */
-                $icsDates = getICSDates($key, $subKey, $subValue, $icsDates);
-            }
+    $icalString = file_get_contents_curl($file);
+    $icsDates = array();
+    /* Explode the ICs Data to get datas as array according to string ‘BEGIN:’ */
+    $icsData = explode("BEGIN:", $icalString);
+    /* Iterating the icsData value to make all the start end dates as sub array */
+    foreach ($icsData as $key => $value) {
+        $icsDatesMeta [$key] = explode("\n", $value);
+    }
+    /* Itearting the Ics Meta Value */
+    foreach ($icsDatesMeta as $key => $value) {
+        foreach ($value as $subKey => $subValue) {
+            /* to get ics events in proper order */
+            $icsDates = getICSDates($key, $subKey, $subValue, $icsDates);
         }
-        return $icsDates;
-    } else {
-        return false;
     }
+    return $icsDates;
 }
 
 /* funcion is to avaid the elements wich is not having the proper start, end  and summary informations */
@@ -465,4 +461,24 @@ function getICSDates($key, $subKey, $subValue, $icsDates)
         }
     }
     return $icsDates;
+}
+
+function file_get_contents_curl($url)
+{
+
+    $ch = curl_init();
+
+    curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
+    curl_setopt($ch, CURLOPT_HEADER, 0);
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+    curl_setopt($ch, CURLOPT_URL, $url);
+    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+
+    $data = curl_exec($ch);
+    curl_close($ch);
+
+    return $data;
+
 }

+ 9 - 9
api/functions/organizr-functions.php

@@ -414,12 +414,12 @@ function getSettingsMain()
 				'label' => 'Registration Password',
 				'value' => $GLOBALS['registrationPassword'],
 			),
-			array(
-				'type' => 'switch',
-				'name' => 'hideRegistration',
-				'label' => 'Hide Registration',
-				'value' => $GLOBALS['hideRegistration']
-			)
+            array(
+                'type' => 'switch',
+                'name' => 'hideRegistration',
+                'label' => 'Hide Registration',
+                'value' => $GLOBALS['hideRegistration']
+            )
 		)
 	);
 }
@@ -893,9 +893,9 @@ function logoOrText()
 
 function showLogin()
 {
-	if ($GLOBALS['hideRegistration'] == false) {
-		return '<p><span lang="en">Don\'t have an account?</span><a href="#" class="text-primary m-l-5 to-register"><b lang="en">Sign Up</b></a></p>';
-	}
+    if ($GLOBALS['hideRegistration'] == false) {
+        return '<p><span lang="en">Don\'t have an account?</span><a href="#" class="text-primary m-l-5 to-register"><b lang="en">Sign Up</b></a></p>';
+    }
 }
 
 function getImages()

+ 1 - 1
api/plugins/php-mailer.php

@@ -170,7 +170,7 @@ function phpmSendEmail($emailInfo)
 		if ($GLOBALS['PHPMAILER-smtpHostType'] !== 'n/a') {
 			$mail->SMTPSecure = $GLOBALS['PHPMAILER-smtpHostType'];
 		}
-		$mail->SMTPAuth = $GLOBALS['PHPMAILER-smtpHostAuth'];
+        $mail->SMTPAuth = $GLOBALS['PHPMAILER-smtpHostAuth'];
 		$mail->Username = $GLOBALS['PHPMAILER-smtpHostUsername'];
 		$mail->Password = decrypt($GLOBALS['PHPMAILER-smtpHostPassword']);
 		$mail->SMTPOptions = array(

+ 9 - 9
js/custom.js

@@ -210,11 +210,11 @@ function pageLoad(){
                 }
                 this.st.mainClass = this.st.el.attr('data-effect');
             },
-            beforeClose: function() {
+            beforeClose: function () {
                 // Callback available since v0.9.0
-                if(!$.magnificPopup.instance.currItem.inlineElement.find('.rubberBand').hasClass('hidden')){
+                if (!$.magnificPopup.instance.currItem.inlineElement.find('.rubberBand').hasClass('hidden')) {
                     var magIndex = $.magnificPopup.instance.currItem.index;
-                    message('You forgot to save','<a class="mouse" onclick="$(\'.popup-with-form\').magnificPopup(\'open\','+magIndex+')">Would you like to go back?</a>','bottom-right','#FFF','warning','5000');
+                    message('You forgot to save', '<a class="mouse" onclick="$(\'.popup-with-form\').magnificPopup(\'open\',' + magIndex + ')">Would you like to go back?</a>', 'bottom-right', '#FFF', 'warning', '5000');
                 }
             },
         }
@@ -231,7 +231,7 @@ function pageLoad(){
        },
        close: function() {
           if(typeof player !== 'undefined'){
-              console.log('STOP STOP STOP')
+              console.log('STOP STOP STOP');
               player.destroy();
           }
         }
@@ -374,7 +374,7 @@ $(document).on("click", ".reset-button", function(e) {
     if(email !== ''){
 		var post = {
 	        email:email
-		}
+        };
         organizrAPI('POST','api/?v1/recover',post).success(function(data) {
             var html = JSON.parse(data);
             if(html.data == true){
@@ -934,7 +934,7 @@ $(document).on("click", ".editCategory", function () {
         messageBody:'Edited Category '+$('#edit-category-form [name=name]').val(),
         error:'Organizr Function: API Connection Failed'
     };
-    console.log(post)
+    console.log(post);
     if (typeof post.id == 'undefined' || post.id == '') {
         message('Edit Tab Error',' Could not get Tab ID','bottom-right','#FFF','error','5000');
     }
@@ -1277,7 +1277,7 @@ $(document).on("click", ".getPlexMachineSSO", function () {
                             var machine = $(this).attr('machineIdentifier');
                             machines += '<option value="'+machine+'">'+name+'</option>';
                         }
-                    })
+                    });
                     var listing = `<select class="form-control" id="ssoPlexMachineSelector" data-type="select">`+machines+`</select>`;
                     $('.ssoPlexMachineListing').html(listing);
                 } else {
@@ -1362,7 +1362,7 @@ $(document).on("click", ".getPlexMachineAuth", function () {
                             var machine = $(this).attr('machineIdentifier');
                             machines += '<option value="'+machine+'">'+name+'</option>';
                         }
-                    })
+                    });
                     var listing = `<select class="form-control" id="authPlexMachineSelector" data-type="select">`+machines+`</select>`;
                     $('.authPlexMachineListing').html(listing);
                 } else {
@@ -1392,7 +1392,7 @@ $(document).on("click", ".testPath", function () {
     }else{
         organizrAPI('POST','api/?v1/wizard_path',{path:path}).success(function(data) {
             var html = JSON.parse(data);
-            console.log(html)
+            console.log(html);
             if(html.data == true){
                 message('Path',' Path is good to go','bottom-right','#FFF','success','10000');
             }else{

Деякі файли не було показано, через те що забагато файлів було змінено