Forráskód Böngészése

Ajax Form, New Form Builder, Field Builder, Homepage Access Roughin, New Defaults, Revamped homepage settings form

Cerothen 9 éve
szülő
commit
5d032cf2db

+ 33 - 2
ajax.php

@@ -13,6 +13,7 @@ if (isset($_POST['submit'])) { $action = $_POST['submit']; }
 if (isset($_POST['action'])) { $action = $_POST['action']; }
 if (isset($_GET['action'])) { $action = $_GET['action']; }
 if (isset($_GET['a'])) { $action = $_GET['a']; }
+unset($_POST['action']);
 
 // No Action
 if (!isset($action)) {
@@ -41,6 +42,12 @@ switch ($_SERVER['REQUEST_METHOD']) {
 			case 'plex-recent':
 				echo getPlexRecent($_GET['type'], 12);
 				break;
+			case 'sabnzbd-update':
+				
+				break;
+			case 'nzbget-update':
+				
+				break;
 			
 			default:
 				debug_out('Unsupported Action!',1);
@@ -56,6 +63,30 @@ switch ($_SERVER['REQUEST_METHOD']) {
 			case 'remove-images':
 				removeFiles('images/'.(isset($_POST['file'])?$_POST['file']:''));
 				break;
+			case 'update-config':
+				header('Content-Type: application/json');
+				$notifyExplode = explode("-", NOTIFYEFFECT);
+				if (updateConfig($_POST)) {
+					$msg = array(
+						'html' => '<strong>'.translate("SETTINGS_SAVED").'</strong>',
+						'icon' => 'floppy-o',
+						'type' => 'success',
+						'length' => '5000',
+						'layout' => $notifyExplode[0],
+						'effect' => $notifyExplode[1],
+					);
+				} else {
+					$msg = array(
+						'html' => '<strong>'.translate("SETTINGS__NOT_SAVED").'</strong>',
+						'icon' => 'floppy-o',
+						'type' => 'failed',
+						'length' => '5000',
+						'layout' => $notifyExplode[0],
+						'effect' => $notifyExplode[1],
+					);
+				}
+				echo json_encode($msg);
+				break;
 			case 'editCSS':
 				write_ini_file($_POST["css-show"], "custom.css");
 				echo '<script>window.top.location = window.top.location.href.split(\'#\')[0];</script>';
@@ -65,10 +96,10 @@ switch ($_SERVER['REQUEST_METHOD']) {
 		}
 		break;
 	case 'PUT':
-		
+		debug_out('Unsupported Action!',1);
 		break;
 	case 'DELETE':
-		
+		debug_out('Unsupported Action!',1);
 		break;
 	default:
 		debug_out('Unknown Request Type!',1);

+ 9 - 0
config/configDefaults.php

@@ -9,25 +9,33 @@ return array(
 	"plexRecentTV" => "false",
 	"plexRecentMusic" => "false",
 	"plexPlayingNow" => "false",
+	"plexHomeAuth" => false,
 	"embyURL" => "",
 	"embyToken" => "",
 	"embyRecentMovie" => "false",
 	"embyRecentTV" => "false",
 	"embyRecentMusic" => "false",
 	"embyPlayingNow" => "false",
+	"embyHomeAuth" => false,
 	"sonarrURL" => "",
 	"sonarrKey" => "",
+	"sonarrHomeAuth" => false,
 	"sickrageURL" => "",
 	"sickrageKey" => "",
+	"sickrageHomeAuth" => false,
 	"radarrURL" => "",
 	"radarrKey" => "",
+	"radarrHomeAuth" => false,
 	"nzbgetURL" => "",
 	"nzbgetUsername" => "",
 	"nzbgetPassword" => "",
+	"nzbgetHomeAuth" => false,
 	"sabnzbdURL" => "",
 	"sabnzbdKey" => "",
+	"sabnzbdHomeAuth" => false,
 	"headphonesURL" => "",
 	"headphonesKey" => "",
+	"headphonesHomeAuth" => false,
 	"calendarStart" => "0",
 	"calendarView" => "basicWeek",
 	"calendarStartDay" => "30",
@@ -59,4 +67,5 @@ return array(
 	"slimBar" => "true",
 	"gravatar" => "true",
 	"calTimeFormat" => "h(:mm)t",
+	"HOMEPAGEAUTHNEEDED" => false,
 );

+ 194 - 4
functions.php

@@ -710,9 +710,8 @@ function translate($string) {
 }
 
 // Generate Random string
-function randString($length = 10) {
+function randString($length = 10, $chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ') {
 	$tmp = '';
-	$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
 	for ($i = 0; $i < $length; $i++) {
 		$tmp .= substr(str_shuffle($chars), 0, 1);
 	}
@@ -947,7 +946,7 @@ function upgradeCheck() {
 	
 	// Upgrade
 	$config = loadConfig();
-	if (!isset($config['CONFIG_VERSION']) || $config['CONFIG_VERSION'] < '1.33') {
+	if (isset($config['database_Location']) && (!isset($config['CONFIG_VERSION']) || $config['CONFIG_VERSION'] < '1.33')) {
 		$config['user_home'] = $config['database_Location'].'users/';
 		unset($config['USER_HOME']);
 		$createConfigSuccess = createConfig($config);
@@ -1019,7 +1018,22 @@ function qualifyUser($type, $errOnFail = false) {
 		$GLOBALS['USER'] = new User('registration_callback');
 	}
 	
-	$authorized = ($GLOBALS['USER']->authenticated && $GLOBALS['USER']->role == $type);
+	if (is_bool($type)) {
+		if ($type === true) {
+			$authorized = ($GLOBALS['USER']->authenticated == true);
+		} else {
+			$authorized = true;
+		}
+	} elseif (is_string($type)) {
+		if ($type !== 'false') {
+			$type = explode('|',$type);
+			$authorized = ($GLOBALS['USER']->authenticated && in_array($GLOBALS['USER']->role,$type));
+		} else {
+			$authorized = true;
+		}
+	} else {
+		debug_out('Invalid Syntax!',1);
+	}
 	
 	if (!$authorized && $errOnFail) {
 		debug_out('Not Authorized' ,1);
@@ -1028,6 +1042,182 @@ function qualifyUser($type, $errOnFail = false) {
 	}
 }
 
+// Build an (optionally) tabbed settings page.
+function buildSettings($array) {
+	/*
+	array(
+		'title' => '',
+		'id' => '',
+		'fields' => array( See buildField() ),
+		'tabs' => array(
+			array(
+				'title' => '',
+				'id' => '',
+				'image' => '',
+				'fields' => array( See buildField() ),
+			),
+		),
+	);
+	*/
+	
+	$fieldFunc = function($fieldArr) {
+		$fields = '<div class="row">';
+		foreach($fieldArr as $key => $value) {
+			$isSingle = isset($value['type']);
+			if ($isSingle) { $value = array($value); }
+			$tmpField = '';
+			foreach($value as $k => $v) {
+				$tmpField .= '<div class="form-group">'.buildField($v).'</div>';
+			}
+			$fields .= ($isSingle?$tmpField:'<div class="content-form form-inline">'.$tmpField.'</div>');
+		}
+		$fields .= '</div>';
+		return $fields;
+	};
+	
+	$fields = (isset($array['fields'])?$fieldFunc($array['fields']):'');
+	
+	$tabSelectors = array();
+	$tabContent = array();
+	if (isset($array['tabs'])) {
+		foreach($array['tabs'] as $key => $value) {
+			$id = (isset($value['id'])?$value['id']:randString(32));
+			$tabSelectors[$key] = '<li class="apps'.($tabSelectors?'':' active').'"><a href="#tab-'.$id.'" data-toggle="tab" aria-expanded="true"><img style="height:40px; width:40px;" src="'.(isset($value['image'])?$value['image']:'images/organizr.png').'"></a></li>';
+			$tabContent[$key] = '<div class="tab-pane big-box fade'.($tabContent?'':' active in').'" id="tab-'.$id.'">'.$fieldFunc($value['fields']).'</div>';
+		}
+	}
+	
+	$pageID = (isset($array['id'])?$array['id']:str_replace(array(' ','"',"'"),array('_'),strtolower($array['id'])));
+	
+	return '
+	<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>'.$array['title'].'</h1>
+		</div>
+		<div class="email-inner small-box">
+			<div class="email-inner-section">
+				<div class="small-box fade in" id="'.$pageID.'_frame">
+					<div class="row">
+						<div class="col-lg-12">
+							<form class="content-form" name="'.$pageID.'" id="'.$pageID.'_form" onsubmit="return false;">
+								<input type="hidden" name="action" value="'.$pageID.'" />
+								'.$fields.'
+								<div class="tabbable tabs-with-bg" id="'.$pageID.'_tabs">
+									<ul class="nav nav-tabs apps">
+										'.implode('', $tabSelectors).'
+									</ul>
+									<div class="clearfix"></div>
+									<div class="tab-content">
+										'.implode('', $tabContent).'
+									</div>
+								</div>
+								<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>Save
+								</button>
+							</form>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<script>
+		$(document).ready(function() {
+			$(\'#'.$pageID.'_form\').find(\'input, select, textarea\').on(\'change\', function() {
+				$(this).attr(\'data-changed\', \'true\');
+			});
+			$(\'#'.$pageID.'_form\').submit(function () {
+				var newVals = {};
+				$(\'#'.$pageID.'_form\').find(\'[data-changed=true]\').each(function() {
+					newVals[$(this).attr(\'name\')] = $(this).val();
+				});
+				$.post(\'ajax.php?a=update-config\', newVals, function(data) {
+					console.log(data);
+					parent.notify(data.html, data.icon, data.type, data.length, data.layout, data.effect);
+				}, \'json\');
+				return false;
+			});
+		});
+	</script>
+	';
+}
+
+// Build Settings Fields
+function buildField($params) {
+	/*
+	array(
+		'type' => '',
+		'placeholder' => '',
+		'label' => '',
+		'labelTranslate' => '',
+		'assist' => '',
+		'name' => '',
+		'pattern' => '',
+		'options' => array( // For SELECT only
+			'Display' => 'value',
+		),
+	)
+	*/
+	
+	// Tags
+	$tags = array();
+	foreach(array('placeholder','style','disabled','readonly','pattern','min','max','required','onkeypress','onchange','onfocus','onleave') as $value) {
+		$tags[] = (isset($params[$value])?$value.'="'.$params[$value].'"':'');
+	}
+	
+	$name = (isset($params['name'])?$params['name']:(isset($params['id'])?$params['id']:''));
+	$id = (isset($params['id'])?$params['id']:(isset($params['name'])?$params['name'].'_id':randString(32)));
+	$val = (isset($params['value'])?$params['value']:'');
+	$class = (isset($params['class'])?' '.$params['class']:'');
+	$assist = (isset($params['assist'])?' - i.e. '.$params['assist']:'');
+	$label = (isset($params['labelTranslate'])?translate($params['labelTranslate']):(isset($params['label'])?$params['label']:''));
+	
+	switch ($params['type']) {
+		case 'input':
+		case 'text':
+			$field = '
+			<input id="'.$id.'" name="'.$name.'" type="text" class="form-control material input-sm'.$class.'" '.implode(' ',$tags).' autocorrect="off" autocapitalize="off" value="'.$val.'">
+			';
+			break;
+		case 'select':
+		case 'dropdown':
+			$field = '<select id="'.$id.'" name="'.$name.'" class="form-control material input-sm" '.implode(' ',$tags).'>
+			'.resolveSelectOptions($params['options'], $val).'
+			</select>';
+			break;
+		case 'check':
+		case 'checkbox':
+		case 'toggle':
+			$checked = ((is_bool($val) && $val) || trim($val) === 'true'?' checked':'');
+			return '
+			<input id="'.$id.'_disabled" name="'.$name.'" type="hidden" class="switcher switcher-success" value="false">
+			<input id="'.$id.'" name="'.$name.'" type="checkbox" class="switcher switcher-success'.$class.'" '.implode(' ',$tags).' value="'.$val.'"'.$checked.'><label for="'.$id.'"></label>'.$label.'
+			';
+			break;
+		case 'date':
+			$field = '
+			
+			';
+			break;
+		case 'number':
+			$field = '
+			<input id="'.$id.'" name="'.$name.'" type="number" class="form-control material input-sm'.$class.'" '.implode(' ',$tags).' autocorrect="off" autocapitalize="off" value="'.$val.'">
+			';
+			break;
+		case 'password':
+			$field = '
+			<input id="'.$id.'" name="'.$name.'" type="password" class="form-control material input-sm'.$class.'" '.implode(' ',$tags).' autocorrect="off" autocapitalize="off" value="'.$val.'">
+			';
+			break;
+		default:
+			$field = '';
+	}
+	
+	$labelOut = '<p class="help-text">'.$label.$assist.'</p>';
+	return $field.$labelOut;
+}
+
 // ==============
 
 function clean($strin) {

+ 3 - 0
homepage.php

@@ -14,6 +14,9 @@ $radarr = new Sonarr(RADARRURL, RADARRKEY);
 $sickrage = new SickRage(SICKRAGEURL, SICKRAGEKEY);
 $USER = new User("registration_callback");
 
+// Check if connection to homepage is allowed
+qualifyUser(HOMEPAGEAUTHNEEDED, true);
+
 $dbfile = DATABASE_LOCATION.'users.db';
 
 $file_db = new PDO("sqlite:" . $dbfile);

BIN
images/asusrouter.png


BIN
images/freenas-logo.png


BIN
images/gitlab.png


BIN
images/haproxy.png


BIN
images/hydra2.png


BIN
images/mcmap.png


BIN
images/minecraft.png


BIN
images/motherboard.png


BIN
images/power.png


BIN
images/proxmox.png


BIN
images/sugarcrm.png


+ 362 - 462
settings.php

@@ -543,6 +543,45 @@ if(SLIMBAR == "true") : $slimBar = "30"; $userSize = "25"; else : $slimBar = "56
         <script src="bower_components/respondJs/dest/respond.min.js"></script>
         <![endif]-->
         
+        <!--Scripts-->
+        <script src="bower_components/jquery/dist/jquery.min.js"></script>
+        <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
+        <script src="bower_components/metisMenu/dist/metisMenu.min.js"></script>
+        <script src="bower_components/Waves/dist/waves.min.js"></script>
+        <script src="bower_components/moment/min/moment.min.js"></script>
+        <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
+        <script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script>
+        <script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
+        <script src="bower_components/cta/dist/cta.min.js"></script>
+
+        <!--Menu-->
+        <script src="js/menu/classie.js"></script>
+        <script src="bower_components/iconpick/dist/js/fontawesome-iconpicker.js"></script>
+
+
+        <!--Selects-->
+        <script src="js/selects/selectFx.js"></script>
+        <script src="js/jscolor.js"></script>
+        
+        <script src="bower_components/sweetalert/dist/sweetalert.min.js"></script>
+
+        <script src="bower_components/smoke/dist/js/smoke.min.js"></script>
+        <script src="bower_components/numbered/jquery.numberedtextarea.js"></script>
+
+
+        <!--Notification-->
+        <script src="js/notifications/notificationFx.js"></script>
+
+        <script src="js/jqueri_ui_custom/jquery-ui.min.js"></script>
+        <script src="js/jquery.filer.min.js" type="text/javascript"></script>
+	    <script src="js/custom.js?v=<?php echo INSTALLEDVERSION; ?>" type="text/javascript"></script>
+	    <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
+        
+        <!--Data Tables-->
+        <script src="bower_components/DataTables/media/js/jquery.dataTables.js"></script>
+        <script src="bower_components/datatables.net-responsive/js/dataTables.responsive.js"></script>
+        <script src="bower_components/datatables-tabletools/js/dataTables.tableTools.js"></script>
+		
     </head>
 
     <body class="scroller-body" style="padding: 0; background: #273238; overflow: hidden">
@@ -1233,434 +1272,334 @@ endif;?></textarea>
                 </div>
     
                 <div class="email-content homepage-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>Homepage Settings</h1>
-                
-                        </div>
-                
-                        <div class="email-inner small-box">
-                  
-                            <div class="email-inner-section">
-                                
-                                <div class="small-box fade in" id="homepageSettings">
-                                    
-                                    <div class="row">
-                                        
-                                        
-                                        <div class="col-lg-12">
-                                            
-                                            <form class="content-form" name="homepageSettings" id="homepageSettings" action="" method="POST">    
-                                            
-                                                <div class="tabbable tabs-with-bg" id="homepage-tabs">
-                                                                                                    
-                                                    <input type="hidden" name="action" value="homepageSettings" />
-                                                
-                                                    <ul class="nav nav-tabs apps">
-
-                                                        <li class="apps active">
-
-                                                            <a href="#tab-plex" data-toggle="tab" aria-expanded="true"><img style="height:40px; width:40px;" src="images/plex.png"></a>
-
-                                                        </li>
-							    
-                                                        <li class="apps">
-
-                                                            <a href="#tab-emby" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/emby.png"></a>
-
-                                                        </li>
-
-                                                        <li class="apps ">
-
-                                                            <a href="#tab-sonarr" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/sonarr.png"></a>
-
-                                                        </li>
-
-                                                        <li class="apps ">
-
-                                                            <a href="#tab-radarr" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/radarr.png"></a>
-
-                                                        </li>
-                                                        
-                                                        <li class="apps ">
-
-                                                            <a href="#tab-sickrage" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/sickrage.png"></a>
-
-                                                        </li>
-                                                        
-                                                        <li class="apps ">
-
-                                                            <a href="#tab-nzbget" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/nzbget.png"></a>
-
-                                                        </li>
-                                                        
-                                                        <li class="apps ">
-
-                                                            <a href="#tab-sabnzbd" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/sabnzbd.png"></a>
-
-                                                        </li>
-                                                        
-                                                        <li class="apps ">
-
-                                                            <a href="#tab-headphones" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/headphones.png"></a>
-
-                                                        </li>
-                                                        
-                                                        <li class="apps ">
-
-                                                            <a href="#tab-calendar" data-toggle="tab" aria-expanded="false"><img style="height:40px; width:40px;" src="images/calendar.png"></a>
-
-                                                        </li>
-
-                                                    </ul>
-
-                                                    <div class="clearfix"></div>
-
-                                                    <div class="tab-content">
-
-                                                        <div class="tab-pane big-box fade active in" id="tab-plex">
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="plexURL" placeholder="<?php echo $language->translate("PLEX_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo PLEXURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("PLEX_URL");?> - i.e. http://hostname:32400</p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="plexToken" placeholder="<?php echo $language->translate("PLEX_TOKEN");?>" autocorrect="off" autocapitalize="off" value="<?php echo PLEXTOKEN;?>">
-                                                                <p class="help-text"><?php echo $language->translate("PLEX_TOKEN");?></p>
-
-                                                            </div>
-
-                                                            <div class="content-form form-inline">
-
-                                                                <div class="form-group">
-                                                                    <?php  if(PLEXRECENTMOVIE == "true") : $PLEXRECENTMOVIE = "checked"; else : $PLEXRECENTMOVIE = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="plexRecentMovie" type="hidden">
-                                                                    <input id="plexRecentMovie" class="switcher switcher-success" value="true" name="plexRecentMovie" type="checkbox" <?php echo $PLEXRECENTMOVIE;?>>
-
-                                                                    <label for="plexRecentMovie"></label><?php echo $language->translate("RECENT_MOVIES");?>
-
-                                                                </div>
-
-                                                                <div class="form-group">
-                                                                    <?php  if(PLEXRECENTTV == "true") : $PLEXRECENTTV = "checked"; else : $PLEXRECENTTV = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="plexRecentTV" type="hidden">
-                                                                    <input id="plexRecentTV" class="switcher switcher-success" value="true" name="plexRecentTV" type="checkbox" <?php echo $PLEXRECENTTV;?>>
-
-                                                                    <label for="plexRecentTV"></label><?php echo $language->translate("RECENT_TV");?>
-
-                                                                </div>
-
-                                                                <div class="form-group">
-                                                                    <?php  if(PLEXRECENTMUSIC == "true") : $PLEXRECENTMUSIC = "checked"; else : $PLEXRECENTMUSIC = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="plexRecentMusic" type="hidden">
-                                                                    <input id="plexRecentMusic" class="switcher switcher-success" value="true" name="plexRecentMusic" type="checkbox" <?php echo $PLEXRECENTMUSIC;?>>
-
-                                                                    <label for="plexRecentMusic"></label><?php echo $language->translate("RECENT_MUSIC");?>
-
-                                                                </div>
-
-                                                                <div class="form-group">
-                                                                    <?php  if(PLEXPLAYINGNOW == "true") : $PLEXPLAYINGNOW = "checked"; else : $PLEXPLAYINGNOW = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="plexPlayingNow" type="hidden">
-                                                                    <input id="plexPlayingNow" class="switcher switcher-success" value="true" name="plexPlayingNow" type="checkbox" <?php echo $PLEXPLAYINGNOW;?>>
-
-                                                                    <label for="plexPlayingNow"></label><?php echo $language->translate("PLAYING_NOW");?>
-
-                                                                </div>
-
-                                                            </div>
-
-                                                        </div>
-
-                                                        <div class="tab-pane big-box fade" id="tab-emby">
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="embyURL" placeholder="<?php echo $language->translate("EMBY_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo EMBYURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("EMBY_URL");?> - i.e. http://hostname:8096 | hostname/emby | http://hostname:8096/emby</p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="embyToken" placeholder="<?php echo $language->translate("EMBY_TOKEN");?>" autocorrect="off" autocapitalize="off" value="<?php echo EMBYTOKEN;?>">
-                                                                <p class="help-text"><?php echo $language->translate("EMBY_TOKEN");?></p>
-
-                                                            </div>
-
-                                                            <div class="content-form form-inline">
-
-                                                                <div class="form-group">
-                                                                    <?php  if(EMBYRECENTMOVIE == "true") : $EMBYRECENTMOVIE = "checked"; else : $EMBYRECENTMOVIE = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="embyRecentMovie" type="hidden">
-                                                                    <input id="embyRecentMovie" class="switcher switcher-success" value="true" name="embyRecentMovie" type="checkbox" <?php echo $EMBYRECENTMOVIE;?>>
-
-                                                                    <label for="embyRecentMovie"></label><?php echo $language->translate("RECENT_MOVIES");?>
-
-                                                                </div>
-
-                                                                <div class="form-group">
-                                                                    <?php  if(EMBYRECENTTV == "true") : $EMBYRECENTTV = "checked"; else : $EMBYRECENTTV = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="embyRecentTV" type="hidden">
-                                                                    <input id="embyRecentTV" class="switcher switcher-success" value="true" name="embyRecentTV" type="checkbox" <?php echo $EMBYRECENTTV;?>>
-
-                                                                    <label for="embyRecentTV"></label><?php echo $language->translate("RECENT_TV");?>
-
-                                                                </div>
-
-                                                                <div class="form-group">
-                                                                    <?php  if(EMBYRECENTMUSIC == "true") : $EMBYRECENTMUSIC = "checked"; else : $EMBYRECENTMUSIC = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="embyRecentMusic" type="hidden">
-                                                                    <input id="embyRecentMusic" class="switcher switcher-success" value="true" name="embyRecentMusic" type="checkbox" <?php echo $EMBYRECENTMUSIC;?>>
-
-                                                                    <label for="embyRecentMusic"></label><?php echo $language->translate("RECENT_MUSIC");?>
-
-                                                                </div>
-
-                                                                <div class="form-group">
-                                                                    <?php  if(EMBYPLAYINGNOW == "true") : $EMBYPLAYINGNOW = "checked"; else : $EMBYPLAYINGNOW = ""; endif;?>
-                                                                    <input id="" class="switcher switcher-success" value="false" name="embyPlayingNow" type="hidden">
-                                                                    <input id="embyPlayingNow" class="switcher switcher-success" value="true" name="embyPlayingNow" type="checkbox" <?php echo $EMBYPLAYINGNOW;?>>
-
-                                                                    <label for="embyPlayingNow"></label><?php echo $language->translate("PLAYING_NOW");?>
-
-                                                                </div>
-
-                                                            </div>
-
-                                                        </div>
-							    
-                                                        <div class="tab-pane big-box fade" id="tab-sonarr">
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="sonarrURL" placeholder="<?php echo $language->translate("SONARR_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo SONARRURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("SONARR_URL");?> - i.e. http://hostname:8989 | hostname/sonarr | http://hostname:8989/sonarr</p>
-
-                                                            </div>
+<?php
+$urlPattern = '.*'; // https?:\/\/([-a-zA-Z0-9@:%._\+~#=]{2,256}\.)+[a-z]{2,}\b(:\d{2,5})?[^?.\s]*
+echo buildSettings(
+	array(
+		'title' => 'Homepage Settings',
+		'id' => 'homepage_settings',
+		'tabs' => array(
+			array(
+				'title' => 'Plex',
+				'id' => 'plex',
+				'image' => 'images/plex.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:32400',
+						'labelTranslate' => 'PLEX_URL',
+						'assist' => 'http://hostname:32400',
+						'name' => 'plexURL',
+						'pattern' => $urlPattern,
+						'value' => PLEXURL,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => randString(20),
+						'labelTranslate' => 'PLEX_TOKEN',
+						'name' => 'plexToken',
+						'pattern' => '[a-zA-Z0-9]{20}',
+						'value' => PLEXTOKEN,
+					),
+					array(
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'RECENT_MOVIES',
+							'name' => 'plexRecentMovie',
+							'value' => PLEXRECENTMOVIE,
+						),
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'RECENT_TV',
+							'name' => 'plexRecentTV',
+							'value' => PLEXRECENTTV,
+						),
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'RECENT_MUSIC',
+							'name' => 'plexRecentMusic',
+							'value' => PLEXRECENTMUSIC,
+						),
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'PLAYING_NOW',
+							'name' => 'plexPlayingNow',
+							'value' => PLEXPLAYINGNOW,
+						),
+					),
+				),
+			),
+			array(
+				'title' => 'Emby',
+				'id' => 'emby',
+				'image' => 'images/emby.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:8096/emby',
+						'labelTranslate' => 'EMBY_URL',
+						'assist' => 'http://hostname:8096 | https://hostname/emby | http://hostname:8096/emby',
+						'name' => 'embyURL',
+						'pattern' => $urlPattern,
+						'value' => EMBYURL,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => randString(32),
+						'labelTranslate' => 'EMBY_TOKEN',
+						'name' => 'plexToken',
+						'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => EMBYTOKEN,
+					),
+					array(
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'RECENT_MOVIES',
+							'name' => 'embyRecentMovie',
+							'value' => EMBYRECENTMOVIE,
+						),
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'RECENT_TV',
+							'name' => 'embyRecentTV',
+							'value' => EMBYRECENTTV,
+						),
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'RECENT_MUSIC',
+							'name' => 'embyRecentMusic',
+							'value' => EMBYRECENTMUSIC,
+						),
+						array(
+							'type' => 'checkbox',
+							'labelTranslate' => 'PLAYING_NOW',
+							'name' => 'embyPlayingNow',
+							'value' => EMBYPLAYINGNOW,
+						),
+					),
+				),
+			),
+			array(
+				'title' => 'Sonarr',
+				'id' => 'sonarr',
+				'image' => 'images/sonarr.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:8989',
+						'labelTranslate' => 'SONARR_URL',
+						'assist' => 'http://hostname:8989 | hostname/sonarr | http://hostname:8989/sonarr',
+						'name' => 'sonarrURL',
+						'pattern' => $urlPattern,
+						'value' => SONARRURL,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => randString(32),
+						'labelTranslate' => 'SONARR_KEY',
+						'name' => 'sonarrKey',
+						'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => SONARRKEY,
+					),
+				),
+			),
+			array(
+				'title' => 'Radarr',
+				'id' => 'radarr',
+				'image' => 'images/radarr.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:8989',
+						'labelTranslate' => 'RADARR_URL',
+						'assist' => 'http://hostname:8989 | hostname/radarr | http://hostname:8989/radarr',
+						'name' => 'radarrURL',
+						'pattern' => $urlPattern,
+						'value' => RADARRURL,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => randString(32),
+						'labelTranslate' => 'RADARR_KEY',
+						'name' => 'radarrKey',
+						'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => RADARRKEY,
+					),
+				),
+			),
+			array(
+				'title' => 'Sickbeard/Sickrage',
+				'id' => 'sick',
+				'image' => 'images/sickrage.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:8081/sick',
+						'labelTranslate' => 'SICK_URL',
+						'assist' => 'http://hostname:8081 | hostname/sick | http://hostname:8081/sick',
+						'name' => 'sickrageURL',
+						'pattern' => $urlPattern,
+						'value' => SICKRAGEURL,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => randString(32),
+						'labelTranslate' => 'SICK_KEY',
+						'name' => 'sickrageKey',
+						//'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => SICKRAGEKEY,
+					),
+				),
+			),
+			array(
+				'title' => 'Headphones',
+				'id' => 'headphones',
+				'image' => 'images/headphones.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:8181',
+						'labelTranslate' => 'HEADPHONES_URL',
+						'assist' => 'http://hostname:8181',
+						'name' => 'headphonesURL',
+						'pattern' => $urlPattern,
+						'value' => HEADPHONESURL,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => randString(32),
+						'labelTranslate' => 'HEADPHONES_KEY',
+						'name' => 'headphonesKey',
+						//'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => HEADPHONESKEY,
+					),
+				),
+			),
+			array(
+				'title' => 'Sabnzbd',
+				'id' => 'sabnzbd',
+				'image' => 'images/sabnzbd.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:8080/sabnzbd',
+						'labelTranslate' => 'SABNZBD_URL',
+						'assist' => 'http://hostname:8080 | http://hostname/sabnzbd | http://hostname:8080/sabnzbd',
+						'name' => 'sabnzbdURL',
+						'pattern' => $urlPattern,
+						'value' => SABNZBDURL,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => randString(32),
+						'labelTranslate' => 'SABNZBD_KEY',
+						'name' => 'sabnzbdKey',
+						//'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => SABNZBDKEY,
+					),
+				),
+			),
+			array(
+				'title' => 'nzbGET',
+				'id' => 'nzbget',
+				'image' => 'images/nzbget.png',
+				'fields' => array(
+					array(
+						'type' => 'text',
+						'placeholder' => 'http://hostname:6789',
+						'labelTranslate' => 'NZBGET_URL',
+						'assist' => 'http://hostname:6789',
+						'name' => 'nzbgetURL',
+						'pattern' => $urlPattern,
+						'value' => NZBGETURL,
+					),
+					array(
+						'type' => 'text',
+						'labelTranslate' => 'USERNAME',
+						'name' => 'nzbgetUsername',
+						//'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => NZBGETUSERNAME,
+					),
+					array(
+						'type' => 'password',
+						'labelTranslate' => 'PASSWORD',
+						'name' => 'nzbgetPassword',
+						//'pattern' => '[a-zA-Z0-9]{32}',
+						'value' => (empty(NZBGETPASSWORD)?'':randString(20)),
+					),
+				),
+			),
+			array(
+				'title' => 'Calendar',
+				'id' => 'calendar',
+				'image' => 'images/calendar.png',
+				'fields' => array(
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'CALENDAR_START_DAY',
+						'name' => 'calendarStart',
+						'value' => CALENDARSTART,
+						'options' => array(
+							explode('|', translate('DAYS'))[0] => '0',
+							explode('|', translate('DAYS'))[1] => '1',
+							explode('|', translate('DAYS'))[2] => '2',
+							explode('|', translate('DAYS'))[3] => '3',
+							explode('|', translate('DAYS'))[4] => '4',
+							explode('|', translate('DAYS'))[5] => '5',
+							explode('|', translate('DAYS'))[6] => '6',
+						),
+					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'DEFAULT',
+						'name' => 'calendarView',
+						'value' => CALENDARVIEW,
+						'options' => array(
+							translate('MONTH') => 'month',
+							translate('DAY') => 'basicDay',
+							translate('WEEK') => 'basicWeek',
+						),
+					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'CALTIMEFORMAT',
+						'name' => 'calTimeFormat',
+						'value' => CALTIMEFORMAT,
+						'options' => array(
+							'6p' => 'h(:mm)t',
+							'6:00p' => 'h:mmt',
+							'6:00' => 'h:mm',
+							'18' => 'H(:mm)',
+							'18:00' => 'H:mm',
+						),
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => '10',
+						'labelTranslate' => 'CALENDAR_START_DATE',
+						'name' => 'calendarStartDay',
+						'pattern' => '[1-9][0-9]+',
+						'value' => CALENDARSTARTDAY,
+					),
+					array(
+						'type' => 'text',
+						'placeholder' => '10',
+						'labelTranslate' => 'CALENDAR_END_DATE',
+						'name' => 'calendarEndDay',
+						'pattern' => '[1-9][0-9]+',
+						'value' => CALENDARENDDAY,
+					),
+				),
+			),
+		),
+	)
+);
 
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="sonarrKey" placeholder="<?php echo $language->translate("SONARR_KEY");?>" autocorrect="off" autocapitalize="off" value="<?php echo SONARRKEY;?>">
-                                                                <p class="help-text"><?php echo $language->translate("SONARR_KEY");?></p>
-
-                                                            </div>
-
-                                                        </div>
-                                                        
-                                                        <div class="tab-pane big-box fade" id="tab-sickrage">
-                                                            
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="sickrageURL" placeholder="<?php echo $language->translate("SICK_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo SICKRAGEURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("SICK_URL");?> - i.e. http://hostname:8081 | hostname/sick | http://hostname:8081/sick</p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="sickrageKey" placeholder="<?php echo $language->translate("SICK_KEY");?>" autocorrect="off" autocapitalize="off" value="<?php echo SICKRAGEKEY;?>">
-                                                                <p class="help-text"><?php echo $language->translate("SICK_KEY");?></p>
-
-                                                            </div>
-
-                                                        </div>
-
-                                                        <div class="tab-pane big-box fade" id="tab-radarr">
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="radarrURL" placeholder="<?php echo $language->translate("RADARR_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo RADARRURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("RADARR_URL");?> - i.e. http://hostname:8989 | hostname/radarr | http://hostname:8989/radarr</p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="radarrKey" placeholder="<?php echo $language->translate("RADARR_KEY");?>" autocorrect="off" autocapitalize="off" value="<?php echo RADARRKEY;?>">
-                                                                <p class="help-text"><?php echo $language->translate("RADARR_KEY");?></p>
-
-                                                            </div>
-
-                                                        </div>
-                                                        
-                                                        <div class="tab-pane big-box fade" id="tab-nzbget">
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="nzbgetURL" placeholder="<?php echo $language->translate("NZBGET_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo NZBGETURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("NZBGET_URL");?> - i.e. http://hostname:6789</p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="nzbgetUsername" placeholder="<?php echo $language->translate("USERNAME");?>" autocorrect="off" autocapitalize="off" value="<?php echo NZBGETUSERNAME;?>">
-                                                                <p class="help-text"><?php echo $language->translate("USERNAME");?></p>
-
-                                                            </div>
-                                                            
-                                                            <div class="form-group">
-
-                                                                <input type="password" class="form-control material input-sm" name="nzbgetPassword" placeholder="<?php echo $language->translate("PASSWORD");?>" autocorrect="off" autocapitalize="off" value="<?php echo NZBGETPASSWORD;?>">
-                                                                <p class="help-text"><?php echo $language->translate("PASSWORD");?></p>
-
-                                                            </div>
-
-                                                        </div>
-                                                        
-                                                        <div class="tab-pane big-box fade" id="tab-sabnzbd">
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="sabnzbdURL" placeholder="<?php echo $language->translate("SABNZBD_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo SABNZBDURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("SABNZBD_URL");?> - i.e. http://hostname:8080 | http://hostname/sabnzbd | http://hostname:8080/sabnzbd</p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="sabnzbdKey" placeholder="<?php echo $language->translate("SABNZBD_KEY");?>" autocorrect="off" autocapitalize="off" value="<?php echo SABNZBDKEY;?>">
-                                                                <p class="help-text"><?php echo $language->translate("SABNZBD_KEY");?></p>
-
-                                                            </div>
-
-                                                        </div>
-                                                        
-                                                        <div class="tab-pane big-box fade" id="tab-headphones">
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="headphonesURL" placeholder="<?php echo $language->translate("HEADPHONES_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo HEADPHONESURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("HEADPHONES_URL");?> - i.e. http://hostname:8181</p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="headphonesKey" placeholder="<?php echo $language->translate("HEADPHONES_KEY");?>" autocorrect="off" autocapitalize="off" value="<?php echo HEADPHONESKEY;?>">
-                                                                <p class="help-text"><?php echo $language->translate("HEADPHONES_KEY");?></p>
-
-                                                            </div>
-
-                                                        </div>
-                                                        
-                                                        <div class="tab-pane big-box fade" id="tab-calendar">
-
-                                                            <div class="content-form form-inline">
-                                                        
-                                                                <div class="form-group">
-
-                                                                <?php 
-
-                                                                if(CALENDARSTART == "0") : $sundayActive = "selected"; else : $sundayActive = ""; endif;
-                                                                if(CALENDARSTART == "1") : $mondayActive = "selected"; else : $mondayActive = ""; endif;
-                                                                if(CALENDARSTART == "2") : $tuesdayActive = "selected"; else : $tuesdayActive = ""; endif;
-                                                                if(CALENDARSTART == "3") : $wednesdayActive = "selected"; else : $wednesdayActive = ""; endif;
-                                                                if(CALENDARSTART == "4") : $thursdayActive = "selected"; else : $thursdayActive = ""; endif;
-                                                                if(CALENDARSTART == "5") : $fridayActive = "selected"; else : $fridayActive = ""; endif;
-                                                                if(CALENDARSTART == "6") : $saturdayActive = "selected"; else : $saturdayActive = ""; endif;
-
-                                                                ?>
-                                                                    <select name="calendarStart" id="calendarStart" class="form-control material input-sm" required>
-
-                                                                        <option value="0" <?=$sundayActive;?>><?php echo explosion($language->translate('DAYS'), 0);?></option>
-                                                                        <option value="1" <?=$mondayActive;?>><?php echo explosion($language->translate('DAYS'), 1);?></option>
-                                                                        <option value="2" <?=$tuesdayActive;?>><?php echo explosion($language->translate('DAYS'), 2);?></option>
-                                                                        <option value="3" <?=$wednesdayActive;?>><?php echo explosion($language->translate('DAYS'), 3);?></option>
-                                                                        <option value="4" <?=$thursdayActive;?>><?php echo explosion($language->translate('DAYS'), 4);?></option>
-                                                                        <option value="5" <?=$fridayActive;?>><?php echo explosion($language->translate('DAYS'), 5);?></option>
-                                                                        <option value="6" <?=$saturdayActive;?>><?php echo explosion($language->translate('DAYS'), 6);?></option>
-                                                                        
-                                                                    </select>
 
-                                                                    <p class="help-text"><?php echo $language->translate("CALENDAR_START_DAY");?></p>
 
-                                                                </div>
-                                                                
-                                                                <div class="form-group">
-
-                                                                <?php 
-
-                                                                if(CALENDARVIEW == "month") : $monthActive = "selected"; else : $monthActive = ""; endif;
-                                                                if(CALENDARVIEW == "basicDay") : $dayActive = "selected"; else : $dayActive = ""; endif;
-                                                                if(CALENDARVIEW == "basicWeek") : $weekActive = "selected"; else : $weekActive = ""; endif;
-
-                                                                ?>
-                                                                    <select name="calendarView" id="calendarView" class="form-control material input-sm" required>
-
-                                                                        <option value="month" <?=$monthActive;?>><?php echo $language->translate('MONTH');?></option>
-                                                                        <option value="basicDay" <?=$dayActive;?>><?php echo $language->translate('DAY');?></option>
-                                                                        <option value="basicWeek" <?=$weekActive;?>><?php echo $language->translate('WEEK');?></option>
-                                                                        
-                                                                    </select>
-
-                                                                    <p class="help-text"><?php echo $language->translate("DEFAULT");?></p>
-
-                                                                </div>
-                                                                
-                                                                <div class="form-group">
-
-																	<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="form-control material input-sm" name="calendarStartDay" placeholder="<?php echo $language->translate("CALENDAR_START_DATE");?>" autocorrect="off" autocapitalize="off" value="<?php echo CALENDARSTARTDAY;?>">
-																	<p class="help-text"><?php echo $language->translate("CALENDAR_START_DATE");?></p>
-
-                                                                </div>
-                                                                
-                                                                <div class="form-group">
-
-																	<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="form-control material input-sm" name="calendarEndDay" placeholder="<?php echo $language->translate("CALENDAR_END_DATE");?>" autocorrect="off" autocapitalize="off" value="<?php echo CALENDARENDDAY;?>">
-																	<p class="help-text"><?php echo $language->translate("CALENDAR_END_DATE");?></p>
-
-                                                                </div>
-																
-                                                                <div class="form-group">
-																	<select name="calTimeFormat" class="form-control material input-sm" required>
-																		<?php
-																			echo resolveSelectOptions(array(
-																				'6p' => 'h(:mm)t',
-																				'6:00p' => 'h:mmt',
-																				'6:00' => 'h:mm',
-																				'18' => 'H(:mm)',
-																				'18:00' => 'H:mm',
-																			), CALTIMEFORMAT);
-																		?>
-																	</select>
-																	<p class="help-text"><?php echo $language->translate("CALTIMEFORMAT");?></p>
-                                                                </div>
-																
-                                                            </div>
 
-                                                        </div>
 
-                                                    </div>
-   
-                                                </div>
-                                                
-                                                <button type="submit" class="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>Save</button>
-
-                                            </form> 
-                                            
-                                        </div>
-  
-                                    </div>
-
-                                </div>
-                                
-                            </div>
-                            
-                        </div>
-                        
-                    </div>
-                    
+?>
                 </div>
    
                 <div class="email-content advanced-box white-bg">
@@ -2694,45 +2633,6 @@ endif;?></textarea>
 
         </div>
 
-        <!--Scripts-->
-        <script src="bower_components/jquery/dist/jquery.min.js"></script>
-        <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
-        <script src="bower_components/metisMenu/dist/metisMenu.min.js"></script>
-        <script src="bower_components/Waves/dist/waves.min.js"></script>
-        <script src="bower_components/moment/min/moment.min.js"></script>
-        <script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
-        <script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script>
-        <script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script>
-        <script src="bower_components/cta/dist/cta.min.js"></script>
-
-        <!--Menu-->
-        <script src="js/menu/classie.js"></script>
-        <script src="bower_components/iconpick/dist/js/fontawesome-iconpicker.js"></script>
-
-
-        <!--Selects-->
-        <script src="js/selects/selectFx.js"></script>
-        <script src="js/jscolor.js"></script>
-        
-        <script src="bower_components/sweetalert/dist/sweetalert.min.js"></script>
-
-        <script src="bower_components/smoke/dist/js/smoke.min.js"></script>
-        <script src="bower_components/numbered/jquery.numberedtextarea.js"></script>
-
-
-        <!--Notification-->
-        <script src="js/notifications/notificationFx.js"></script>
-
-        <script src="js/jqueri_ui_custom/jquery-ui.min.js"></script>
-        <script src="js/jquery.filer.min.js" type="text/javascript"></script>
-	    <script src="js/custom.js?v=<?php echo INSTALLEDVERSION; ?>" type="text/javascript"></script>
-	    <script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
-        
-        <!--Data Tables-->
-        <script src="bower_components/DataTables/media/js/jquery.dataTables.js"></script>
-        <script src="bower_components/datatables.net-responsive/js/dataTables.responsive.js"></script>
-        <script src="bower_components/datatables-tabletools/js/dataTables.tableTools.js"></script>
-
           <script>
             $(function () {
                 //Data Tables