Little Tweeks
This commit is contained in:
		@@ -7,7 +7,7 @@ class CronApi extends ApiController
 | 
			
		||||
		//Log Cleaning
 | 
			
		||||
		$logKeeper = new LogMaintainer();
 | 
			
		||||
		$logKeeper->purge(LOGTIMOUT);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		//Database Backup Cleanup 
 | 
			
		||||
		$backupWorker = new DatabaseBackup();
 | 
			
		||||
		$backupWorker->purge(5);
 | 
			
		||||
@@ -20,18 +20,20 @@ class CronApi extends ApiController
 | 
			
		||||
		//Run Plugins
 | 
			
		||||
		$result = [];
 | 
			
		||||
		$dir = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/';
 | 
			
		||||
        $pluginsFiles = array_diff(scandir($dir), ['..','.']);
 | 
			
		||||
		$pluginsFiles = array_diff(scandir($dir), ['..', '.']);
 | 
			
		||||
		foreach ($pluginsFiles as $key => $pluginFile) {
 | 
			
		||||
			$className = str_replace(".php", "", $pluginFile);
 | 
			
		||||
			echo " test  s " . $className . '\\n';
 | 
			
		||||
            if(class_exists($className)){
 | 
			
		||||
				$pluginMakeClass = new $className;
 | 
			
		||||
				if (method_exists($pluginMakeClass,'make')){
 | 
			
		||||
					$result[$className] = $pluginMakeClass->make();
 | 
			
		||||
				}
 | 
			
		||||
            }
 | 
			
		||||
			if (!class_exists($className)) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			$pluginMakeClass = new $className;
 | 
			
		||||
			if (!method_exists($pluginMakeClass, 'make')) {
 | 
			
		||||
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			$result[$className] = $pluginMakeClass->make();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		//Print Result
 | 
			
		||||
		$this->response($result);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +1,37 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
class RoomsApi extends ApiController{
 | 
			
		||||
	
 | 
			
		||||
	public function default(){
 | 
			
		||||
class RoomsApi extends ApiController
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	public function
 | 
			
		||||
	default()
 | 
			
		||||
	{
 | 
			
		||||
		//$this->requireAuth();
 | 
			
		||||
		$response = [];
 | 
			
		||||
		$roomIds = [];
 | 
			
		||||
		$roomsData = RoomManager::getRoomsDefault();
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		foreach ($roomsData as $roomKey => $room) {
 | 
			
		||||
			$roomIds[] = $room['room_id'];
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		//Translation Of Numeric Walues
 | 
			
		||||
		$subDevicesData = SubDeviceManager::getSubdevicesByRoomIds($roomIds);
 | 
			
		||||
		foreach ($subDevicesData as $subDeviceKey => $subDevice) {
 | 
			
		||||
			foreach ($subDevice as $key => $value) {
 | 
			
		||||
				if (strpos($subDevicesData[$subDeviceKey][$key]['type'], '-') !== false) {
 | 
			
		||||
					$type = "";
 | 
			
		||||
					foreach(explode('-', $subDevicesData[$subDeviceKey][$key]['type']) as $word){
 | 
			
		||||
					foreach (explode('-', $subDevicesData[$subDeviceKey][$key]['type']) as $word) {
 | 
			
		||||
						$type .= ucfirst($word);
 | 
			
		||||
					}
 | 
			
		||||
					if(class_exists($type)){
 | 
			
		||||
						$deviceClass = new $type;
 | 
			
		||||
						if (method_exists($deviceClass,'translate')){
 | 
			
		||||
							$subDevicesData[$subDeviceKey][$key]['value'] = $deviceClass->translate($subDevicesData[$subDeviceKey][$key]['value']);
 | 
			
		||||
						}
 | 
			
		||||
					} else {
 | 
			
		||||
					if (!class_exists($type)) {
 | 
			
		||||
						continue;
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					continue;
 | 
			
		||||
					$deviceClass = new $type;
 | 
			
		||||
					if (!method_exists($deviceClass, 'translate')) {
 | 
			
		||||
						continue;
 | 
			
		||||
					}
 | 
			
		||||
					$subDevicesData[$subDeviceKey][$key]['value'] = $deviceClass->translate($subDevicesData[$subDeviceKey][$key]['value']);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -45,10 +46,11 @@ class RoomsApi extends ApiController{
 | 
			
		||||
		}
 | 
			
		||||
		$this->response($response);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public function update($roomId){
 | 
			
		||||
 | 
			
		||||
	public function update($roomId)
 | 
			
		||||
	{
 | 
			
		||||
		//$this->requireAuth();
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		$subDevicesData = SubDeviceManager::getSubdevicesByRoomIds([$roomId]);
 | 
			
		||||
		$this->response($subDevicesData);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user