diff --git a/.gitignore b/.gitignore index 343307afe..3c9b9bb3b 100644 --- a/.gitignore +++ b/.gitignore @@ -57,8 +57,10 @@ _config.yml test.php users.db config/config.php +config/config.bak.php config/users/ config/users config/users.db +config/users.bak.db diff --git a/ajax.php b/ajax.php index d7da4da20..3a0d249ed 100755 --- a/ajax.php +++ b/ajax.php @@ -1,84 +1,145 @@ window.top.location = window.top.location.href.split(\'#\')[0];'; + case 'upgradeInstall': + upgradeInstall(); + $response['notify'] = sendNotification(true, 'Performing Checks', false); + $response['tab']['goto'] = 'updatedb.php'; + break; + case 'forceBranchInstall': + upgradeInstall(GIT_BRANCH); + $response['notify'] = sendNotification(true, 'Performing Checks', false); + $response['tab']['goto'] = 'updatedb.php'; + break; + case 'deleteLog': + sendNotification(unlink(FAIL_LOG)); + break; + case 'submit-tabs': + $response['notify'] = sendNotification(updateTabs($_POST) , false, false); + $response['show_apply'] = true; break; default: - debug_out('Unsupported Action!',1); + sendNotification(false, 'Unsupported Action!'); } break; case 'PUT': - + sendNotification(false, 'Unsupported Action!'); break; case 'DELETE': - + sendNotification(false, 'Unsupported Action!'); break; default: - debug_out('Unknown Request Type!',1); + sendNotification(false, 'Unknown Request Type!'); } - +if ($response) { + header('Content-Type: application/json'); + echo json_encode($response); + die(); +} else { + sendNotification(false, 'Error: No Output Specified!'); +} diff --git a/config/.htaccess b/config/.htaccess new file mode 100644 index 000000000..f239fe831 --- /dev/null +++ b/config/.htaccess @@ -0,0 +1,2 @@ +order deny,allow +deny from all \ No newline at end of file diff --git a/config/configDefaults.php b/config/configDefaults.php index c906f71cf..97dd9e753 100644 --- a/config/configDefaults.php +++ b/config/configDefaults.php @@ -9,25 +9,33 @@ "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", @@ -36,7 +44,6 @@ "authBackend" => "", "authBackendCreate" => "true", "authBackendHost" => "", - "authBackendPort" => "", "authBackendDomain" => "", "plexUsername" => "", "plexPassword" => "", @@ -57,5 +64,11 @@ "loadingScreen" => "true", "enableMail" => "false", "slimBar" => "true", - "gravatar" => "true" + "gravatar" => "true", + "calTimeFormat" => "h(:mm)t", + "homePageAuthNeeded" => false, + "homepageCustomHTML1" => "", + "homepageCustomHTML1Auth" => false, + "git_branch" => "master", + "git_check" => true, ); diff --git a/css/settings.css b/css/settings.css new file mode 100644 index 000000000..5c816a8bd --- /dev/null +++ b/css/settings.css @@ -0,0 +1,57 @@ +div.colour-field { + border: 1px solid #cbd3d5; + border-radius: 5px; + padding-top: 10px; + padding-bottom: 10px; + margin-bottom: 15px; +} + +div.colour-field input { + color: #000; +} + +input.invalid { + background-color: #ffb5b5 !important; +} + +input.invalid + p.help-text::after { + content: " - Does not match pattern!"; +} + + +div.form-content input:not([type=radio]) { + width: 100% !important; +} + +tab > div.row { + padding: 0px 10px 0px 10px; +} + +tab > div.row > div { + padding: 1px 5px !important; +} + +tab > div.row > div:first-child { + max-width: 42px; +} + +tab > div.row > div:first-child .tabIconView { + width: 100% !important; + margin: 7px 0px !important; +} + +tab > div.row button { + margin: 9px 0px !important; +} + +tab > div.row div.custom-field { + margin: 8px 0px !important; +} + +tab p.help-text { + margin: 0px !important; +} + +#submitTabs ul > li { + padding: 0px 10px !important; +} diff --git a/downloader.php b/downloader.php deleted file mode 100755 index eb451187d..000000000 --- a/downloader.php +++ /dev/null @@ -1,185 +0,0 @@ - - - '.$downloadName.' - '.$downloadStatus.' - '.$downloadCategory.' - - - -
- -
- -

'.round($downloadPercent).'%

- '.$downloadPercent.'% Complete - -
- -
- - - - '; - - - } - - if($i > 0){ echo $gotNZB; } - if($i == 0){ echo '

No Results

'; } - -} - -if($downloader == "sabnzbd"){ - - $url = SABNZBDURL; - $key = SABNZBDKEY; - - $urlCheck = stripos($url, "http"); - - if ($urlCheck === false) { - - $url = "http://" . $url; - - } - - $address = $url; - - $api = file_get_contents("$url/api?mode=$list&output=json&apikey=$key&limit=40"); - - $api = json_decode($api, true); - - $i = 0; - - $gotNZB = ""; - - foreach ($api[$list]['slots'] AS $child) { - - $i++; - - if($list == "queue"){ - - $downloadName = $child['filename']; - $downloadCategory = $child['cat']; - $downloadPercent = (($child['mb'] - $child['mbleft']) / $child['mb']) * 100; - $progressBar = "progress-bar-striped active"; - - if($child['missing'] > "400"){ - - $downloadHealth = "danger"; - - }elseif($child['missing'] <= "200"){ - - $downloadHealth = "success"; - - }elseif($child['missing'] <= "400"){ - - $downloadHealth = "warning"; - - } - - } - - if($list == "history"){ - - $downloadName = $child['name']; - $downloadCategory = $child['category']; - $downloadPercent = "100"; - $progressBar = ""; - $downloadHealth = "success"; - - } - - $downloadStatus = $child['status']; - - $gotNZB .= ' - - '.$downloadName.' - '.$downloadStatus.' - '.$downloadCategory.' - - - -
- -
- -

'.round($downloadPercent).'%

- '.$downloadPercent.'% Complete - -
- -
- - - - '; - - - } - - if($i > 0){ echo $gotNZB; } - if($i == 0){ echo '

No Results

'; } - -} - -?> \ No newline at end of file diff --git a/error.php b/error.php index a872ed1e8..92cf32002 100755 --- a/error.php +++ b/error.php @@ -1,19 +1,39 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -if (isset($_GET['error'])) { - - $status = $_GET['error']; - -}else{ - - $status = ""; - +// Some PHP config stuff +ini_set("display_errors", 1); +ini_set("error_reporting", E_ALL | E_STRICT); + +// Load User List +$gotUsers = $file_db->query('SELECT * FROM users'); + +// Load Colours/Appearance +foreach(loadAppearance() as $key => $value) { + $$key = $value; } + +$requested = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + +$status = (isset($_GET['error'])?$_GET['error']:404); + $codes = array( - 400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'), 401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'), 403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'), @@ -25,99 +45,18 @@ 503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'), 504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'), 999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused'), - ); -@$errorTitle = $codes[$status][0]; -@$message = $codes[$status][1]; -@$errorImage = $codes[$status][2]; - -if ($errorTitle == false || strlen($status) != 3) { - - $message = 'Please supply a valid status code.'; - $errorTitle = "Error"; - $errorImage = "confused"; - -} - -$data = false; - -ini_set("display_errors", 1); -ini_set("error_reporting", E_ALL | E_STRICT); - -require_once("user.php"); -require_once("functions.php"); -$USER = new User("registration_callback"); - -$dbfile = DATABASE_LOCATION.'users.db'; - -$file_db = new PDO("sqlite:" . $dbfile); -$file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - -$dbOptions = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"'); - -$hasOptions = "No"; - -foreach($dbOptions as $row) : - - if (in_array("options", $row)) : - - $hasOptions = "Yes"; - - endif; - -endforeach; - -if($hasOptions == "No") : - - $title = "Organizr"; - $topbar = "#333333"; - $topbartext = "#66D9EF"; - $bottombar = "#333333"; - $sidebar = "#393939"; - $hoverbg = "#AD80FD"; - $activetabBG = "#F92671"; - $activetabicon = "#FFFFFF"; - $activetabtext = "#FFFFFF"; - $inactiveicon = "#66D9EF"; - $inactivetext = "#66D9EF"; - $loading = "#66D9EF"; - $hovertext = "#000000"; - -endif; - -if($hasOptions == "Yes") : - - $resulto = $file_db->query('SELECT * FROM options'); - - foreach($resulto as $row) : - - $title = isset($row['title']) ? $row['title'] : "Organizr"; - $topbartext = isset($row['topbartext']) ? $row['topbartext'] : "#66D9EF"; - $topbar = isset($row['topbar']) ? $row['topbar'] : "#333333"; - $bottombar = isset($row['bottombar']) ? $row['bottombar'] : "#333333"; - $sidebar = isset($row['sidebar']) ? $row['sidebar'] : "#393939"; - $hoverbg = isset($row['hoverbg']) ? $row['hoverbg'] : "#AD80FD"; - $activetabBG = isset($row['activetabBG']) ? $row['activetabBG'] : "#F92671"; - $activetabicon = isset($row['activetabicon']) ? $row['activetabicon'] : "#FFFFFF"; - $activetabtext = isset($row['activetabtext']) ? $row['activetabtext'] : "#FFFFFF"; - $inactiveicon = isset($row['inactiveicon']) ? $row['inactiveicon'] : "#66D9EF"; - $inactivetext = isset($row['inactivetext']) ? $row['inactivetext'] : "#66D9EF"; - $loading = isset($row['loading']) ? $row['loading'] : "#66D9EF"; - $hovertext = isset($row['hovertext']) ? $row['hovertext'] : "#000000"; - - endforeach; - -endif; +$errorTitle = $codes[$status][0]; +$message = $codes[$status][1]; +$errorImage = $codes[$status][2]; ?> - - @@ -125,64 +64,32 @@ <?=$errorTitle;?> - - - - + + + - -
-
-
-
-
- -
-
-
-
-
- - - - diff --git a/functions.php b/functions.php index a9bee93e7..ef2f1e810 100755 --- a/functions.php +++ b/functions.php @@ -1,5 +1,10 @@ $value) { + // Calculate parts + $digest = parse_url(trim($value)); + $scheme = strtolower((isset($digest['scheme'])?$digest['scheme']:'ldap')); + $host = (isset($digest['host'])?$digest['host']:(isset($digest['path'])?$digest['path']:'')); + $port = (isset($digest['port'])?$digest['port']:(strtolower($scheme)=='ldap'?389:636)); + + // Reassign + $ldapServers[$key] = $scheme.'://'.$host.':'.$port; + } + // returns true or false - $ldap = ldap_connect(AUTHBACKENDHOST.(AUTHBACKENDPORT?':'.AUTHBACKENDPORT:'389')); + $ldap = ldap_connect(implode(' ',$ldapServers)); if ($bind = ldap_bind($ldap, AUTHBACKENDDOMAIN.'\\'.$username, $password)) { return true; } else { @@ -21,19 +37,36 @@ function plugin_auth_ldap($username, $password) { } return false; } +else : + // Ldap Auth Missing Dependancy + function plugin_auth_ldap_disabled() { + return 'LDAP - Disabled (Dependancy: php-ldap missing!)'; + } endif; // Pass credentials to FTP backend function plugin_auth_ftp($username, $password) { - // returns true or false + // Calculate parts + $digest = parse_url(AUTHBACKENDHOST); + $scheme = strtolower((isset($digest['scheme'])?$digest['scheme']:(function_exists('ftp_ssl_connect')?'ftps':'ftp'))); + $host = (isset($digest['host'])?$digest['host']:(isset($digest['path'])?$digest['path']:'')); + $port = (isset($digest['port'])?$digest['port']:21); - // Connect to FTP - $conn_id = ftp_ssl_connect(AUTHBACKENDHOST, (AUTHBACKENDPORT?AUTHBACKENDPORT:21), 20); // 20 Second Timeout + // Determine Connection Type + if ($scheme == 'ftps') { + $conn_id = ftp_ssl_connect($host, $port, 20); + } elseif ($scheme == 'ftp') { + $conn_id = ftp_connect($host, $port, 20); + } else { + debug_out('Invalid FTP scheme. Use ftp or ftps'); + return false; + } // Check if valid FTP connection if ($conn_id) { // Attempt login @$login_result = ftp_login($conn_id, $username, $password); + ftp_close($conn_id); // Return Result if ($login_result) { @@ -49,13 +82,7 @@ function plugin_auth_ftp($username, $password) { // Pass credentials to Emby Backend function plugin_auth_emby_local($username, $password) { - $urlCheck = stripos(AUTHBACKENDHOST, "http"); - if ($urlCheck === false) { - $embyAddress = "http://" . AUTHBACKENDHOST; - } else { - $embyAddress = AUTHBACKENDHOST; - } - if(AUTHBACKENDPORT !== ""){ $embyAddress .= ":" . AUTHBACKENDPORT; } + $embyAddress = qualifyURL(EMBYURL); $headers = array( 'Authorization'=> 'MediaBrowser UserId="e8837bc1-ad67-520e-8cd2-f629e3155721", Client="None", Device="Organizr", DeviceId="xxx", Version="1.0.0.0"', @@ -86,18 +113,17 @@ function plugin_auth_emby_local($username, $password) { if (function_exists('curl_version')) : // Authenticate Against Emby Local (first) and Emby Connect function plugin_auth_emby_all($username, $password) { - return plugin_auth_emby_local($username, $password) || plugin_auth_emby_connect($username, $password); + $localResult = plugin_auth_emby_local($username, $password); + if ($localResult) { + return $localResult; + } else { + return plugin_auth_emby_connect($username, $password); + } } // Authenicate against emby connect function plugin_auth_emby_connect($username, $password) { - $urlCheck = stripos(AUTHBACKENDHOST, "http"); - if ($urlCheck === false) { - $embyAddress = "http://" . AUTHBACKENDHOST; - } else { - $embyAddress = AUTHBACKENDHOST; - } - if(AUTHBACKENDPORT !== "") { $embyAddress .= ":" . AUTHBACKENDPORT; } + $embyAddress = qualifyURL(EMBYURL); // Get A User $connectId = ''; @@ -129,7 +155,10 @@ function plugin_auth_emby_connect($username, $password) { if (isset($result['content'])) { $json = json_decode($result['content'], true); if (is_array($json) && isset($json['AccessToken']) && isset($json['User']) && $json['User']['Id'] == $connectId) { - return true; + return array( + 'email' => $json['User']['Email'], + 'image' => $json['User']['ImageUrl'], + ); } } } @@ -146,7 +175,6 @@ function plugin_auth_plex($username, $password) { } //Get User List - $approvedUsers = array(); $userURL = 'https://plex.tv/pms/friends/all'; $userHeaders = array( 'Authorization' => 'Basic '.base64_encode(PLEXUSERNAME.':'.PLEXPASSWORD), @@ -154,7 +182,6 @@ function plugin_auth_plex($username, $password) { $userXML = simplexml_load_string(curl_get($userURL, $userHeaders)); if (is_array($userXML) || is_object($userXML)) { - //Build User List array $isUser = false; $usernameLower = strtolower($username); foreach($userXML AS $child) { @@ -181,14 +208,32 @@ function plugin_auth_plex($username, $password) { $result = curl_post($connectURL, $body, $headers); if (isset($result['content'])) { $json = json_decode($result['content'], true); - if (is_array($json) && isset($json['user']) && isset($json['user']['username']) && $json['user']['username'] == $username) { - return true; + if (is_array($json) && isset($json['user']) && isset($json['user']['username']) && strtolower($json['user']['username']) == $usernameLower) { + return array( + 'email' => $json['user']['email'], + 'image' => $json['user']['thumb'] + ); } } } } return false; } +else : + // Plex Auth Missing Dependancy + function plugin_auth_plex_disabled() { + return 'Plex - Disabled (Dependancy: php-curl missing!)'; + } + + // Emby Connect Auth Missing Dependancy + function plugin_auth_emby_connect_disabled() { + return 'Emby Connect - Disabled (Dependancy: php-curl missing!)'; + } + + // Emby Both Auth Missing Dependancy + function plugin_auth_emby_both_disabled() { + return 'Emby Both - Disabled (Dependancy: php-curl missing!)'; + } endif; // ==== Auth Plugins END ==== // ==== General Class Definitions START ==== @@ -334,7 +379,7 @@ function post_request($url, $data, $headers = array(), $referer='') { $urlDigest = parse_url($url); // extract host and path: - $host = $urlDigest['host'].(isset($urlDigest['port'])?':'.$urlDigest['port']:''); + $host = $urlDigest['host']; $path = $urlDigest['path']; if ($urlDigest['scheme'] != 'http') { @@ -342,7 +387,7 @@ function post_request($url, $data, $headers = array(), $referer='') { } // open a socket connection on port 80 - timeout: 30 sec - $fp = fsockopen($host, 80, $errno, $errstr, 30); + $fp = fsockopen($host, (isset($urlDigest['port'])?':'.$urlDigest['port']:80), $errno, $errstr, 30); if ($fp){ @@ -398,24 +443,24 @@ function resolveEmbyItem($address, $token, $item) { // Get Item Details $itemDetails = json_decode(file_get_contents($address.'/Items?Ids='.$item['Id'].'&Fields=Overview&api_key='.$token),true)['Items'][0]; - switch ($item['Type']) { + switch ($itemDetails['Type']) { case 'Episode': - $title = $item['SeriesName'].': '.$item['Name'].' (Season '.$item['ParentIndexNumber'].': Episode '.$item['IndexNumber'].')'; - $imageId = $itemDetails['SeriesId']; + $title = (isset($itemDetails['SeriesName'])?$itemDetails['SeriesName'].': ':'').$itemDetails['Name'].(isset($itemDetails['ParentIndexNumber']) && isset($itemDetails['IndexNumber'])?' (Season '.$itemDetails['ParentIndexNumber'].': Episode '.$itemDetails['IndexNumber'].')':''); + $imageId = (isset($itemDetails['SeriesId'])?$itemDetails['SeriesId']:$itemDetails['Id']); $width = 100; $image = 'carousel-image season'; $style = ''; break; case 'MusicAlbum': - $title = $item['Name']; + $title = $itemDetails['Name']; $imageId = $itemDetails['Id']; $width = 150; $image = 'music'; $style = 'left: 160px !important;'; break; default: - $title = $item['Name']; - $imageId = $item['Id']; + $title = $itemDetails['Name']; + $imageId = $itemDetails['Id']; $width = 100; $image = 'carousel-image movie'; $style = ''; @@ -427,7 +472,7 @@ function resolveEmbyItem($address, $token, $item) { } // Assemble Item And Cache Into Array - return '
'.$item['Name'].'
'; + return '
'.$itemDetails['Name'].'
'; } // Format item from Plex for Carousel @@ -444,13 +489,24 @@ function resolvePlexItem($server, $token, $item) { $width = 100; $image = 'carousel-image season'; $style = ''; + $thumb = $item['thumb']; + break; + case 'episode': + $title = $item['grandparentTitle']; + $summary = $item['title']; + $width = 100; + $image = 'carousel-image season'; + $style = ''; + $thumb = $item['parentThumb']; break; case 'album': + case 'track': $title = $item['parentTitle']; $summary = $item['title']; $width = 150; $image = 'album'; $style = 'left: 160px !important;'; + $thumb = $item['thumb']; break; default: $title = $item['title']; @@ -458,6 +514,7 @@ function resolvePlexItem($server, $token, $item) { $width = 100; $image = 'carousel-image movie'; $style = ''; + $thumb = $item['thumb']; } // If No Overview @@ -466,7 +523,7 @@ function resolvePlexItem($server, $token, $item) { } // Assemble Item And Cache Into Array - return '
'.$item['Name'].'
'; + return '
'.$item['Name'].'
'; } // Create Carousel @@ -554,6 +611,12 @@ function getPlexStreams($size){ function getEmbyRecent($type, $size) { $address = qualifyURL(EMBYURL); + // Currently Logged In User + $username = false; + if (isset($GLOBALS['USER'])) { + $username = strtolower($GLOBALS['USER']->username); + } + // Resolve Types switch ($type) { case 'movie': @@ -575,15 +638,20 @@ function getEmbyRecent($type, $size) { // Get A User $userIds = json_decode(file_get_contents($address.'/Users?api_key='.EMBYTOKEN),true); + $showPlayed = true; foreach ($userIds as $value) { // Scan for admin user - $userId = $value['Id']; if (isset($value['Policy']) && isset($value['Policy']['IsAdministrator']) && $value['Policy']['IsAdministrator']) { + $userId = $value['Id']; + } + if ($username && strtolower($value['Name']) == $username) { + $userId = $value['Id']; + $showPlayed = false; break; } } // Get the latest Items - $latest = json_decode(file_get_contents($address.'/Users/'.$userId.'/Items/Latest?'.$embyTypeQuery.'EnableImages=false&api_key='.EMBYTOKEN),true); + $latest = json_decode(file_get_contents($address.'/Users/'.$userId.'/Items/Latest?'.$embyTypeQuery.'EnableImages=false&api_key='.EMBYTOKEN.($showPlayed?'':'&IsPlayed=false')),true); // For Each Item In Category $items = array(); @@ -644,6 +712,7 @@ function getEmbyImage() { $image_src = $embyAddress . '/Items/'.$itemId.'/Images/Primary?'.implode('&', $imgParams); header('Content-type: image/jpeg'); readfile($image_src); + die(); } else { debug_out('Invalid Request',1); } @@ -661,6 +730,7 @@ function getPlexImage() { $image_src = $plexAddress . '/photo/:/transcode?height='.$image_height.'&width='.$image_width.'&upscale=1&url=' . $image_url . '&X-Plex-Token=' . PLEXTOKEN; header('Content-type: image/jpeg'); readfile($image_src); + die(); } else { echo "Invalid Plex Request"; } @@ -676,9 +746,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); } @@ -687,7 +756,16 @@ function randString($length = 10) { // Create config file in the return syntax function createConfig($array, $path = 'config/config.php', $nest = 0) { + // Define Initial Value $output = array(); + + // Sort Items + ksort($array); + + // Unset the current version + unset($array['CONFIG_VERSION']); + + // Process Settings foreach ($array as $k => $v) { $allowCommit = true; switch (gettype($v)) { @@ -701,7 +779,7 @@ function createConfig($array, $path = 'config/config.php', $nest = 0) { $item = $v; break; case 'string': - $item = '"'.addslashes($v).'"'; + $item = "'".str_replace(array('\\',"'"),array('\\\\',"\'"),$v)."'"; break; case 'array': $item = createConfig($v, false, $nest+1); @@ -711,10 +789,16 @@ function createConfig($array, $path = 'config/config.php', $nest = 0) { } if($allowCommit) { - $output[] = str_repeat("\t",$nest+1).'"'.$k.'" => '.$item; + $output[] = str_repeat("\t",$nest+1)."'$k' => $item"; } } + if (!$nest && !isset($array['CONFIG_VERSION'])) { + // Inject Current Version + $output[] = "\t'CONFIG_VERSION' => '".INSTALLEDVERSION."'"; + } + + // Build output $output = (!$nest?" $value) { + if (is_array($value)) { + if (isset($value['optgroup'])) { + $output[] = ''; + foreach($value['optgroup'] as $k => $v) { + $output[] = ''; + } + } else { + $output[] = ''; + } + } else { + $output[] = ''; + } + + } + return implode('',$output); +} + +// Check if user is allowed to continue +function qualifyUser($type, $errOnFail = false) { + if (!isset($GLOBALS['USER'])) { + require_once("user.php"); + $GLOBALS['USER'] = new User('registration_callback'); + } + + if (is_bool($type)) { + if ($type === true) { + $authorized = ($GLOBALS['USER']->authenticated == true); + } else { + $authorized = true; + } + } elseif (is_string($type) || is_array($type)) { + if ($type !== 'false') { + if (!is_array($type)) { + $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) { + if ($GLOBALS['USER']->authenticated) { + header('Location: error.php?error=401'); + echo ''; + } else { + header('Location: error.php?error=999'); + echo ''; + } + + debug_out('Not Authorized' ,1); + } else { + return $authorized; + } +} + +// 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 = '
'; + foreach($fieldArr as $key => $value) { + $isSingle = isset($value['type']); + if ($isSingle) { $value = array($value); } + $tmpField = ''; + $sizeLg = max(floor(12/count($value)),2); + $sizeMd = max(floor(($isSingle?12:6)/count($value)),3); + foreach($value as $k => $v) { + $tmpField .= buildField($v, 12, $sizeMd, $sizeLg); + } + $fields .= ($isSingle?$tmpField:'
'.$tmpField.'
'); + } + $fields .= '
'; + 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] = '
  • '; + $tabContent[$key] = '
    '.$fieldFunc($value['fields']).'
    '; + } + } + + $pageID = (isset($array['id'])?$array['id']:str_replace(array(' ','"',"'"),array('_'),strtolower($array['id']))); + + return ' +
    + + +
    + + '; +} + +// Build Settings Fields +function buildField($params, $sizeSm = 12, $sizeMd = 12, $sizeLg = 12) { + /* + 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','href','onclick') as $value) { + if (isset($params[$value])) { + if (is_string($params[$value])) { $tags[] = $value.'="'.$params[$value].'"'; + } else if ($params[$value] === true) { $tags[] = $value; } + } + } + + $format = (isset($params['format']) && in_array($params['format'],array(false,'colour','color'))?$params['format']:false); + $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']:''); + $wrapClass = (isset($params['wrapClass'])?$params['wrapClass']:'form-content'); + $assist = (isset($params['assist'])?' - i.e. '.$params['assist']:''); + $label = (isset($params['labelTranslate'])?translate($params['labelTranslate']):(isset($params['label'])?$params['label']:'')); + $labelOut = '

    '.$label.$assist.'

    '; + + // Field Design + switch ($params['type']) { + case 'text': + case 'number': + case 'password': + $field = ''; + break; + case 'select': + case 'dropdown': + $field = ''; + break; + case 'select-multi': + case 'dropdown-multi': + $field = ''; + break; + case 'check': + case 'checkbox': + case 'toggle': + $checked = ((is_bool($val) && $val) || trim($val) === 'true'?' checked':''); + $colour = (isset($params['colour'])?$params['colour']:'success'); + $labelOut = ''.$label; + $field = ''; + break; + case 'radio': + $labelOut = ''; + $checked = ((is_bool($val) && $val) || ($val && trim($val) !== 'false')?' checked':''); + $bType = (isset($params['buttonType'])?$params['buttonType']:'success'); + $field = '
    '; + break; + case 'date': + $field = 'Unsupported, planned.'; + break; + case 'hidden': + return ''; + break; + case 'header': + $labelOut = ''; + $headType = (isset($params['value'])?$params['value']:3); + $field = ''.$label.''; + break; + case 'button': + $labelOut = ''; + $icon = (isset($params['icon'])?$params['icon']:'flask'); + $bType = (isset($params['buttonType'])?$params['buttonType']:'success'); + $bDropdown = (isset($params['buttonDrop'])?$params['buttonDrop']:''); + $field = ($bDropdown?'
    ':'').''.($bDropdown?$bDropdown.'
    ':''); + break; + case 'textarea': + $rows = (isset($params['rows'])?$params['rows']:5); + $field = ''; + break; + case 'custom': + // Settings + $settings = array( + '$id' => $id, + '$name' => $name, + '$val' => $val, + '$label' => $label, + '$labelOut' => $labelOut, + ); + // Get HTML + $html = (isset($params['html'])?$params['html']:'Nothing Specified!'); + // If LabelOut is in html dont print it twice + $labelOut = (strpos($html,'$label')!==false?'':$labelOut); + // Replace variables in settings + $html = preg_replace_callback('/\$\w+\b/', function ($match) use ($settings) { return (isset($settings[$match[0]])?$settings[$match[0]]:'{'.$match[0].' is undefined}'); }, $html); + // Build Field + $field = '
    '.$html.'
    '; + break; + case 'space': + $labelOut = ''; + $field = str_repeat('
    ', (isset($params['value'])?$params['value']:1)); + break; + default: + $field = 'Unsupported field type'; + break; + } + + // Field Formats + switch ($format) { + case 'colour': // Fuckin Eh, Canada! + case 'color': + $labelBef = '
    '.$label.'
    '; + $wrapClass = 'gray-bg colour-field'; + $labelAft = ''; + $field = str_replace(' material input-sm','',$field); + break; + default: + $labelBef = ''; + $labelAft = $labelOut; + } + + return '
    '.$labelBef.$field.$labelAft.'
    '; +} + +// Tab Settings Generation +function printTabRow($data) { + $hidden = false; + if ($data===false) { + $hidden = true; + $data = array( // New Tab Defaults + 'id' => 'new', + 'name' => '', + 'url' => '', + 'icon' => 'fa-diamond', + 'iconurl' => '', + 'active' => 'true', + 'user' => 'true', + 'guest' => 'true', + 'window' => 'false', + 'defaultz' => '', + ); + } + $image = ''; + + $output = ' +
  • + +
    + '.buildField(array( + 'type' => 'custom', + 'html' => '', + ),12,1,1).' + '.buildField(array( + 'type' => 'hidden', + 'id' => 'tab-'.$data['id'].'-id', + 'name' => 'id['.$data['id'].']', + 'value' => $data['id'], + ),12,2,1).' + '.buildField(array( + 'type' => 'text', + 'id' => 'tab-'.$data['id'].'-name', + 'name' => 'name['.$data['id'].']', + 'required' => true, + 'placeholder' => 'Organizr Homepage', + 'labelTranslate' => 'TAB_NAME', + 'value' => $data['name'], + ),12,2,1).' + '.buildField(array( + 'type' => 'text', + 'id' => 'tab-'.$data['id'].'-url', + 'name' => 'url['.$data['id'].']', + 'required' => true, + 'placeholder' => 'homepage.php', + 'labelTranslate' => 'TAB_URL', + 'value' => $data['url'], + ),12,2,1).' + '.buildField(array( + 'type' => 'text', + 'id' => 'tab-'.$data['id'].'-iconurl', + 'name' => 'iconurl['.$data['id'].']', + 'placeholder' => 'images/organizr.png', + 'labelTranslate' => 'ICON_URL', + 'value' => $data['iconurl'], + ),12,2,1).' + '.buildField(array( + 'type' => 'custom', + 'id' => 'tab-'.$data['id'].'-icon', + 'name' => 'icon['.$data['id'].']', + 'html' => '- '.translate('OR').' -
    ', + 'value' => $data['icon'], + ),12,1,1).' + '.buildField(array( + 'type' => 'checkbox', + 'labelTranslate' => 'ACTIVE', + 'name' => 'active['.$data['id'].']', + 'value' => $data['active'], + ),12,1,1).' + '.buildField(array( + 'type' => 'checkbox', + 'labelTranslate' => 'USER', + 'colour' => 'primary', + 'name' => 'user['.$data['id'].']', + 'value' => $data['user'], + ),12,1,1).' + '.buildField(array( + 'type' => 'checkbox', + 'labelTranslate' => 'GUEST', + 'colour' => 'warning', + 'name' => 'guest['.$data['id'].']', + 'value' => $data['guest'], + ),12,1,1).' + '.buildField(array( + 'type' => 'checkbox', + 'labelTranslate' => 'NO_IFRAME', + 'colour' => 'danger', + 'name' => 'window['.$data['id'].']', + 'value' => $data['window'], + ),12,1,1).' + '.buildField(array( + 'type' => 'radio', + 'labelTranslate' => 'DEFAULT', + 'name' => 'defaultz['.$data['id'].']', + 'value' => $data['defaultz'], + 'onclick' => "$('[type=radio][id!=\''+this.id+'\']').each(function() { this.checked=false; });", + ),12,1,1).' + '.buildField(array( + 'type' => 'button', + 'icon' => 'trash', + 'labelTranslate' => 'REMOVE', + 'onclick' => "$(this).parents('li').remove();", + ),12,1,1).' +
    +
    +
  • + '; + return $output; +} + +// Timezone array +function timezoneOptions() { + $output = array(); + $timezones = array(); + $regions = array( + 'Africa' => DateTimeZone::AFRICA, + 'America' => DateTimeZone::AMERICA, + 'Antarctica' => DateTimeZone::ANTARCTICA, + 'Arctic' => DateTimeZone::ARCTIC, + 'Asia' => DateTimeZone::ASIA, + 'Atlantic' => DateTimeZone::ATLANTIC, + 'Australia' => DateTimeZone::AUSTRALIA, + 'Europe' => DateTimeZone::EUROPE, + 'Indian' => DateTimeZone::INDIAN, + 'Pacific' => DateTimeZone::PACIFIC + ); + + foreach ($regions as $name => $mask) { + $zones = DateTimeZone::listIdentifiers($mask); + foreach($zones as $timezone) { + $time = new DateTime(NULL, new DateTimeZone($timezone)); + $ampm = $time->format('H') > 12 ? ' ('. $time->format('g:i a'). ')' : ''; + + $output[$name]['optgroup'][substr($timezone, strlen($name) + 1) . ' - ' . $time->format('H:i') . $ampm]['value'] = $timezone; + } + } + + return $output; +} + +// Build Database +function createSQLiteDB($path = false) { + if ($path === false) { + if (defined('DATABASE_LOCATION')) { + $path = DATABASE_LOCATION; + } else { + debug_out('No Path Specified!'); + } + } + + if (!is_file($path.'users.db') || filesize($path.'users.db') <= 0) { + if (!isset($GLOBALS['file_db'])) { + $GLOBALS['file_db'] = new PDO('sqlite:'.$path.'users.db'); + $GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + + // Create Users + $users = $GLOBALS['file_db']->query('CREATE TABLE `users` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, + `username` TEXT UNIQUE, + `password` TEXT, + `email` TEXT, + `token` TEXT, + `role` TEXT, + `active` TEXT, + `last` TEXT, + `auth_service` TEXT DEFAULT \'internal\' + );'); + + // Create Tabs + $tabs = $GLOBALS['file_db']->query('CREATE TABLE `tabs` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, + `order` INTEGER, + `users_id` INTEGER, + `name` TEXT, + `url` TEXT, + `defaultz` TEXT, + `active` TEXT, + `user` TEXT, + `guest` TEXT, + `icon` TEXT, + `iconurl` TEXT, + `window` TEXT + );'); + + // Create Options + $options = $GLOBALS['file_db']->query('CREATE TABLE `options` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, + `users_id` INTEGER UNIQUE, + `title` TEXT UNIQUE, + `topbar` TEXT, + `bottombar` TEXT, + `sidebar` TEXT, + `hoverbg` TEXT, + `topbartext` TEXT, + `activetabBG` TEXT, + `activetabicon` TEXT, + `activetabtext` TEXT, + `inactiveicon` TEXT, + `inactivetext` TEXT, + `loading` TEXT, + `hovertext` TEXT + );'); + + return $users && $tabs && $options; + } else { + return false; + } +} + +// Upgrade Database +function updateSQLiteDB($db_path = false) { + if (!$db_path) { + if (defined('DATABASE_LOCATION')) { + $db_path = DATABASE_LOCATION; + } else { + debug_out('No Path Specified',1); + } + } + if (!isset($GLOBALS['file_db'])) { + $GLOBALS['file_db'] = new PDO('sqlite:'.$db_path.'users.db'); + $GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + + // Cache current DB + $cache = array(); + foreach($GLOBALS['file_db']->query('SELECT name FROM sqlite_master WHERE type="table";') as $table) { + foreach($GLOBALS['file_db']->query('SELECT * FROM '.$table['name'].';') as $key => $row) { + foreach($row as $k => $v) { + if (is_string($k)) { + $cache[$table['name']][$key][$k] = $v; + } + } + } + } + + // Remove Current Database + $GLOBALS['file_db'] = null; + $pathDigest = pathinfo($db_path.'users.db'); + if (file_exists($db_path.'users.db')) { + rename($db_path.'users.db', $pathDigest['dirname'].'/'.$pathDigest['filename'].'.bak.db'); + } + + // Create New Database + $success = createSQLiteDB($db_path); + + // Restore Items + if ($success) { + foreach($cache as $table => $tableData) { + if ($tableData) { + $queryBase = 'INSERT INTO '.$table.' (`'.implode('`,`',array_keys(current($tableData))).'`) values '; + $insertValues = array(); + reset($tableData); + foreach($tableData as $key => $value) { + $insertValues[] = '('.implode(',',array_map(function($d) { + return (isset($d)?"'".addslashes($d)."'":'null'); + }, $value)).')'; + } + $GLOBALS['file_db']->query($queryBase.implode(',',$insertValues).';'); + } + } + return true; + } else { + return false; + } +} + +// Commit colours to database +function updateDBOptions($values) { + if (!isset($GLOBALS['file_db'])) { + $GLOBALS['file_db'] = new PDO('sqlite:'.DATABASE_LOCATION.'users.db'); + $GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + + // Commit new values to database + if ($GLOBALS['file_db']->query('UPDATE options SET '.implode(',',array_map(function($d, $k) { + return '`'.$k.'` = '.(isset($d)?"'".addslashes($d)."'":'null'); + }, $values, array_keys($values))).';')->rowCount()) { + return true; + } else if ($GLOBALS['file_db']->query('INSERT OR IGNORE INTO options (`'.implode('`,`',array_keys($values)).'`) VALUES (\''.implode("','",$values).'\');')->rowCount()) { + return true; + } else { + return false; + } +} + +// Send AJAX notification +function sendNotification($success, $message = false, $send = true) { + $notifyExplode = explode("-", NOTIFYEFFECT); + if ($success) { + $msg = array( + 'html' => ($message?'
    '.$message:''.translate("SETTINGS_SAVED").''), + 'icon' => 'floppy-o', + 'type' => 'success', + 'length' => '5000', + 'layout' => $notifyExplode[0], + 'effect' => $notifyExplode[1], + ); + } else { + $msg = array( + 'html' => ($message?'
    '.$message:''.translate("SETTINGS_NOT_SAVED").''), + 'icon' => 'floppy-o', + 'type' => 'failed', + 'length' => '5000', + 'layout' => $notifyExplode[0], + 'effect' => $notifyExplode[1], + ); + } + + // Send and kill script? + if ($send) { + header('Content-Type: application/json'); + echo json_encode(array('notify'=>$msg)); + die(); + } + return $msg; +} + +// Load colours from the database +function loadAppearance() { + if (!isset($GLOBALS['file_db'])) { + $GLOBALS['file_db'] = new PDO('sqlite:'.DATABASE_LOCATION.'users.db'); + $GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + + // Defaults + $defaults = array( + 'title' => 'Organizr', + 'topbartext' => '#66D9EF', + 'topbar' => '#333333', + 'bottombar' => '#333333', + 'sidebar' => '#393939', + 'hoverbg' => '#AD80FD', + 'activetabBG' => '#F92671', + 'activetabicon' => '#FFFFFF', + 'activetabtext' => '#FFFFFF', + 'inactiveicon' => '#66D9EF', + 'inactivetext' => '#66D9EF', + 'loading' => '#66D9EF', + 'hovertext' => '#000000', + ); + + // Database Lookup + $options = $GLOBALS['file_db']->query('SELECT * FROM options'); + + // Replace defaults with filled options + foreach($options as $row) { + foreach($defaults as $key => $value) { + if (isset($row[$key]) && $row[$key]) { + $defaults[$key] = $row[$key]; + } + } + } + + // Return the Results + return $defaults; +} + +// Delete Database +function deleteDatabase() { + unset($_COOKIE['Organizr']); + setcookie('Organizr', '', time() - 3600, '/'); + unset($_COOKIE['OrganizrU']); + setcookie('OrganizrU', '', time() - 3600, '/'); + + $GLOBALS['file_db'] = null; + + unlink(DATABASE_LOCATION.'users.db'); + + foreach(glob(substr_replace($userdirpath, "", -1).'/*') as $file) { + if(is_dir($file)) { + rmdir($file); + } elseif (!is_dir($file)) { + unlink($file); + } + } + + rmdir($userdirpath); + + return true; +} + +// Upgrade the installation +function upgradeInstall($branch = 'master') { + function downloadFile($url, $path){ + $folderPath = "upgrade/"; + if(!mkdir($folderPath)) : echo "can't make dir"; endif; + $newfname = $folderPath . $path; + $file = fopen ($url, 'rb'); + if ($file) { + $newf = fopen ($newfname, 'wb'); + if ($newf) { + while(!feof($file)) { + fwrite($newf, fread($file, 1024 * 8), 1024 * 8); + } + } + } + + if ($file) { + fclose($file); + } + + if ($newf) { + fclose($newf); + } + } + + function unzipFile($zipFile){ + $zip = new ZipArchive; + $extractPath = "upgrade/"; + if($zip->open($extractPath . $zipFile) != "true"){ + echo "Error :- Unable to open the Zip File"; + } + + /* Extract Zip File */ + $zip->extractTo($extractPath); + $zip->close(); + } + + // Function to remove folders and files + function rrmdir($dir) { + if (is_dir($dir)) { + $files = scandir($dir); + foreach ($files as $file) + if ($file != "." && $file != "..") rrmdir("$dir/$file"); + rmdir($dir); + } + else if (file_exists($dir)) unlink($dir); + } + + // Function to Copy folders and files + function rcopy($src, $dst) { + if (is_dir ( $src )) { + if (!file_exists($dst)) : mkdir ( $dst ); endif; + $files = scandir ( $src ); + foreach ( $files as $file ) + if ($file != "." && $file != "..") + rcopy ( "$src/$file", "$dst/$file" ); + } else if (file_exists ( $src )) + copy ( $src, $dst ); + } + + $url = 'https://github.com/causefx/Organizr/archive/'.$branch.'.zip'; + $file = "upgrade.zip"; + $source = __DIR__ . '/upgrade/Organizr-'.$branch.'/'; + $cleanup = __DIR__ . "/upgrade/"; + $destination = __DIR__ . "/"; + downloadFile($url, $file); + unzipFile($file); + rcopy($source, $destination); + rrmdir($cleanup); + + return true; +} + +// NzbGET Items +function nzbgetConnect($list = 'listgroups') { + $url = qualifyURL(NZBGETURL); + + $api = file_get_contents($url.'/'.NZBGETUSERNAME.':'.NZBGETPASSWORD.'/jsonrpc/'.$list); + $api = json_decode($api, true); + + $gotNZB = array(); + + foreach ($api['result'] AS $child) { + $downloadName = htmlentities($child['NZBName'], ENT_QUOTES); + $downloadStatus = $child['Status']; + $downloadCategory = $child['Category']; + if($list == "history"){ $downloadPercent = "100"; $progressBar = ""; } + if($list == "listgroups"){ $downloadPercent = (($child['FileSizeMB'] - $child['RemainingSizeMB']) / $child['FileSizeMB']) * 100; $progressBar = "progress-bar-striped active"; } + if($child['Health'] <= "750"){ + $downloadHealth = "danger"; + }elseif($child['Health'] <= "900"){ + $downloadHealth = "warning"; + }elseif($child['Health'] <= "1000"){ + $downloadHealth = "success"; + } + + $gotNZB[] = ' + '.$downloadName.' + '.$downloadStatus.' + '.$downloadCategory.' + +
    +
    +

    '.round($downloadPercent).'%

    + '.$downloadPercent.'% Complete +
    +
    + + '; + } + + if ($gotNZB) { + return implode('',$gotNZB); + } else { + return '

    No Results

    '; + } +} + +// Sabnzbd Items +function sabnzbdConnect($list = 'queue') { + $url = qualifyURL(SABNZBDURL); + + $api = file_get_contents($url.'/api?mode='.$list.'&output=json&apikey='.SABNZBDKEY); + $api = json_decode($api, true); + + $gotNZB = array(); + + foreach ($api[$list]['slots'] AS $child) { + if($list == "queue"){ $downloadName = $child['filename']; $downloadCategory = $child['cat']; $downloadPercent = (($child['mb'] - $child['mbleft']) / $child['mb']) * 100; $progressBar = "progress-bar-striped active"; } + if($list == "history"){ $downloadName = $child['name']; $downloadCategory = $child['category']; $downloadPercent = "100"; $progressBar = ""; } + $downloadStatus = $child['status']; + + $gotNZB[] = ' + '.$downloadName.' + '.$downloadStatus.' + '.$downloadCategory.' + +
    +
    +

    '.round($downloadPercent).'%

    + '.$downloadPercent.'% Complete +
    +
    + + '; + } + + if ($gotNZB) { + return implode('',$gotNZB); + } else { + return '

    No Results

    '; + } +} + +// Apply new tab settings +function updateTabs($tabs) { + if (!isset($GLOBALS['file_db'])) { + $GLOBALS['file_db'] = new PDO('sqlite:'.DATABASE_LOCATION.'users.db'); + $GLOBALS['file_db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + // Validate + if (!isset($tabs['defaultz'])) { $tabs['defaultz'][current(array_keys($tabs['name']))] = 'true'; } + if (isset($tabs['name']) && isset($tabs['url']) && is_array($tabs['name'])) { + // Clear Existing Tabs + $GLOBALS['file_db']->query("DELETE FROM tabs"); + // Process New Tabs + $totalValid = 0; + foreach ($tabs['name'] as $key => $value) { + // Qualify + if (!$value || !isset($tabs['url']) || !$tabs['url'][$key]) { continue; } + $totalValid++; + $fields = array(); + foreach(array('id','name','url','icon','iconurl','order') as $v) { + if (isset($tabs[$v]) && isset($tabs[$v][$key])) { $fields[$v] = $tabs[$v][$key]; } + } + foreach(array('active','user','guest','defaultz','window') as $v) { + if (isset($tabs[$v]) && isset($tabs[$v][$key])) { $fields[$v] = ($tabs[$v][$key]!=='false'?'true':'false'); } + } + $GLOBALS['file_db']->query('INSERT INTO tabs (`'.implode('`,`',array_keys($fields)).'`) VALUES (\''.implode("','",$fields).'\');'); + } + return $totalValid; + } else { + return false; + } + return false; +} // ============== @@ -1346,114 +2366,6 @@ function getRadarrCalendar($array){ } -function nzbgetConnect($url, $username, $password, $list){ - $url = qualifyURL(NZBGETURL); - - $api = file_get_contents("$url/$username:$password/jsonrpc/$list"); - - $api = json_decode($api, true); - - $i = 0; - - $gotNZB = ""; - - foreach ($api['result'] AS $child) { - - $i++; - //echo '
    ' . var_export($child, true) . '
    '; - $downloadName = htmlentities($child['NZBName'], ENT_QUOTES); - $downloadStatus = $child['Status']; - $downloadCategory = $child['Category']; - if($list == "history"){ $downloadPercent = "100"; $progressBar = ""; } - if($list == "listgroups"){ $downloadPercent = (($child['FileSizeMB'] - $child['RemainingSizeMB']) / $child['FileSizeMB']) * 100; $progressBar = "progress-bar-striped active"; } - if($child['Health'] <= "750"){ - $downloadHealth = "danger"; - }elseif($child['Health'] <= "900"){ - $downloadHealth = "warning"; - }elseif($child['Health'] <= "1000"){ - $downloadHealth = "success"; - } - - $gotNZB .= ' - - '.$downloadName.' - '.$downloadStatus.' - '.$downloadCategory.' - - - -
    - -
    - -

    '.round($downloadPercent).'%

    - '.$downloadPercent.'% Complete - -
    - -
    - - - - '; - - - } - - if($i > 0){ return $gotNZB; } - if($i == 0){ echo '

    No Results

    '; } - -} - -function sabnzbdConnect($url, $key, $list){ - $url = qualifyURL(SABNZBDURL); - - $api = file_get_contents("$url/api?mode=$list&output=json&apikey=$key"); - - $api = json_decode($api, true); - - $i = 0; - - $gotNZB = ""; - - foreach ($api[$list]['slots'] AS $child) { - - $i++; - if($list == "queue"){ $downloadName = $child['filename']; $downloadCategory = $child['cat']; $downloadPercent = (($child['mb'] - $child['mbleft']) / $child['mb']) * 100; $progressBar = "progress-bar-striped active"; } - if($list == "history"){ $downloadName = $child['name']; $downloadCategory = $child['category']; $downloadPercent = "100"; $progressBar = ""; } - $downloadStatus = $child['status']; - - $gotNZB .= ' - - '.$downloadName.' - '.$downloadStatus.' - '.$downloadCategory.' - - - -
    - -
    - -

    '.round($downloadPercent).'%

    - '.$downloadPercent.'% Complete - -
    - -
    - - - - '; - - - } - - if($i > 0){ return $gotNZB; } - if($i == 0){ echo '

    No Results

    '; } - -} - function getHeadphonesCalendar($url, $key, $list){ $url = qualifyURL(HEADPHONESURL); diff --git a/homepage.php b/homepage.php index 8a802fed1..fc413cff1 100755 --- a/homepage.php +++ b/homepage.php @@ -14,6 +14,9 @@ $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); @@ -26,9 +29,7 @@ foreach($dbOptions as $row) : if (in_array("options", $row)) : - $hasOptions = "Yes"; - endif; endforeach; @@ -54,7 +55,6 @@ if($hasOptions == "Yes") : $resulto = $file_db->query('SELECT * FROM options'); - foreach($resulto as $row) : $title = isset($row['title']) ? $row['title'] : "Organizr"; @@ -85,7 +85,6 @@ - @@ -96,7 +95,6 @@ - @@ -105,11 +103,27 @@ + + + + + + + + + + + + + + + + + - - -
    -

    - authenticated && $USER->role == "admin") && (NZBGETURL != "" || SABNZBDURL != "" )) : ?> +
    2 -
    -
    -
    - -
    -
    -
    -
    - - - - - - - - - - - + +
    translate("FILE");?> translate("STATUS");?> translate("CATEGORY");?> translate("PROGRESS");?>
    -
    -
    -
    -
    - - - - - - - - - + + + + - - - - - - + +
    FileStatusCategoryProgresstranslate("FILE");?>translate("STATUS");?>translate("CATEGORY");?>translate("PROGRESS");?>
    -
    -
    -
    -
    -
    -
    -
    -
    - - + +
    - 3 = 4){ $plexSize = 3; }elseif($plexSize == 3){ $plexSize = 4; }elseif($plexSize == 2){ $plexSize = 6; }elseif($plexSize == 1){ $plexSize = 12; } - - if(PLEXRECENTMOVIE == "true"){ echo getPlexRecent("movie", $plexSize); } - if(PLEXRECENTTV == "true"){ echo getPlexRecent("season", $plexSize); } - if(PLEXRECENTMUSIC == "true"){ echo getPlexRecent("album", $plexSize); } - if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams($plexSize); } + $plexSize = (PLEXRECENTMOVIE == "true") + (PLEXRECENTTV == "true") + (PLEXRECENTMUSIC == "true") + (PLEXPLAYINGNOW == "true"); + if(PLEXRECENTMOVIE == "true"){ echo getPlexRecent("movie", 12/$plexSize); } + if(PLEXRECENTTV == "true"){ echo getPlexRecent("season", 12/$plexSize); } + if(PLEXRECENTMUSIC == "true"){ echo getPlexRecent("album", 12/$plexSize); } + if(PLEXPLAYINGNOW == "true"){ echo getPlexStreams(12/$plexSize); } ?>
    - + +
    - 3 = 4){ $embySize = 3; }elseif($embySize == 3){ $embySize = 4; }elseif($embySize == 2){ $embySize = 6; }elseif($embySize == 1){ $embySize = 12; } - - if(EMBYRECENTMOVIE == "true"){ echo getEmbyRecent("movie", $embySize); } - if(EMBYRECENTTV == "true"){ echo getEmbyRecent("season", $embySize); } - if(EMBYRECENTMUSIC == "true"){ echo getEmbyRecent("album", $embySize); } - if(EMBYPLAYINGNOW == "true"){ echo getEmbyStreams($embySize); } + $embySize = (EMBYRECENTMOVIE == "true") + (EMBYRECENTTV == "true") + (EMBYRECENTMUSIC == "true") + (EMBYPLAYINGNOW == "true"); + if(EMBYRECENTMOVIE == "true"){ echo getEmbyRecent("movie", 12/$embySize); } + if(EMBYRECENTTV == "true"){ echo getEmbyRecent("season", 12/$embySize); } + if(EMBYRECENTMUSIC == "true"){ echo getEmbyRecent("album", 12/$embySize); } + if(EMBYPLAYINGNOW == "true"){ echo getEmbyStreams(12/$embySize); } ?>
    - - + +
    - 1 -
    -
    - Available Unavailable Unreleased Premier -
    -
    -
    -
    - 1 -
    -
    -
    -
    - - + + + +
    + +
    +
    -
    - - - - - - - - - - - - - - - - - + - + diff --git a/images/ajenti.png b/images/ajenti.png index 2042e61b9..f3b9a4f51 100644 Binary files a/images/ajenti.png and b/images/ajenti.png differ diff --git a/images/alert.png b/images/alert.png index 0854e5afb..3511ed84b 100644 Binary files a/images/alert.png and b/images/alert.png differ diff --git a/images/arduino.png b/images/arduino.png index 81eea62ef..13191906f 100644 Binary files a/images/arduino.png and b/images/arduino.png differ diff --git a/images/asusrouter.png b/images/asusrouter.png new file mode 100644 index 000000000..0c355e9e3 Binary files /dev/null and b/images/asusrouter.png differ diff --git a/images/booksonic.png b/images/booksonic.png index c14cd8205..9bd78e2ba 100644 Binary files a/images/booksonic.png and b/images/booksonic.png differ diff --git a/images/calendar.png b/images/calendar.png index 1f3d210fd..17dcd053c 100644 Binary files a/images/calendar.png and b/images/calendar.png differ diff --git a/images/confused.png b/images/confused.png index f36b41389..64780e0b5 100644 Binary files a/images/confused.png and b/images/confused.png differ diff --git a/images/couchpotato.png b/images/couchpotato.png index e918c0493..ba94ec002 100644 Binary files a/images/couchpotato.png and b/images/couchpotato.png differ diff --git a/images/deluge.png b/images/deluge.png index 039d81719..bb3ae7cc3 100644 Binary files a/images/deluge.png and b/images/deluge.png differ diff --git a/images/emby.png b/images/emby.png index 7e5cac3d8..6e86da4c1 100644 Binary files a/images/emby.png and b/images/emby.png differ diff --git a/images/favicon/android-chrome-192x192.png b/images/favicon/android-chrome-192x192.png index bc2eb04c5..64b26b080 100644 Binary files a/images/favicon/android-chrome-192x192.png and b/images/favicon/android-chrome-192x192.png differ diff --git a/images/favicon/android-chrome-512x512.png b/images/favicon/android-chrome-512x512.png index 975be673f..83ad1316e 100644 Binary files a/images/favicon/android-chrome-512x512.png and b/images/favicon/android-chrome-512x512.png differ diff --git a/images/favicon/apple-touch-icon.png b/images/favicon/apple-touch-icon.png index 511596d35..9b88cfe08 100644 Binary files a/images/favicon/apple-touch-icon.png and b/images/favicon/apple-touch-icon.png differ diff --git a/images/favicon/favicon-16x16.png b/images/favicon/favicon-16x16.png index 37338732b..40d778c18 100644 Binary files a/images/favicon/favicon-16x16.png and b/images/favicon/favicon-16x16.png differ diff --git a/images/favicon/favicon-32x32.png b/images/favicon/favicon-32x32.png index f0ff38412..806f12345 100644 Binary files a/images/favicon/favicon-32x32.png and b/images/favicon/favicon-32x32.png differ diff --git a/images/favicon/favicon.ico b/images/favicon/favicon.ico index 0bb552769..49557db00 100644 Binary files a/images/favicon/favicon.ico and b/images/favicon/favicon.ico differ diff --git a/images/favicon/mstile-150x150.png b/images/favicon/mstile-150x150.png index 4e6364d67..6e6e45b6f 100644 Binary files a/images/favicon/mstile-150x150.png and b/images/favicon/mstile-150x150.png differ diff --git a/images/favicon/safari-pinned-tab.svg b/images/favicon/safari-pinned-tab.svg index 7ea032a90..66d627f3a 100644 --- a/images/favicon/safari-pinned-tab.svg +++ b/images/favicon/safari-pinned-tab.svg @@ -2,32 +2,30 @@ Created by potrace 1.11, written by Peter Selinger 2001-2013 - - + diff --git a/images/freenas-logo.png b/images/freenas-logo.png new file mode 100644 index 000000000..f4e5f2f22 Binary files /dev/null and b/images/freenas-logo.png differ diff --git a/images/gear.png b/images/gear.png index e3d158015..a49dc8088 100644 Binary files a/images/gear.png and b/images/gear.png differ diff --git a/images/gitlab.png b/images/gitlab.png new file mode 100644 index 000000000..c52fc1f81 Binary files /dev/null and b/images/gitlab.png differ diff --git a/images/gitter.png b/images/gitter.png index e2503006e..2c435b7dd 100644 Binary files a/images/gitter.png and b/images/gitter.png differ diff --git a/images/grafana.png b/images/grafana.png index 1c03205e7..7b1331fd5 100644 Binary files a/images/grafana.png and b/images/grafana.png differ diff --git a/images/haproxy.png b/images/haproxy.png new file mode 100644 index 000000000..9de1652de Binary files /dev/null and b/images/haproxy.png differ diff --git a/images/headphones.png b/images/headphones.png index 2b77ac93d..0c06cdcdb 100644 Binary files a/images/headphones.png and b/images/headphones.png differ diff --git a/images/home.png b/images/home.png index e0c4e7c6c..0e507dd81 100644 Binary files a/images/home.png and b/images/home.png differ diff --git a/images/homeassitant.png b/images/homeassitant.png index 2959efdf8..08a3cb891 100644 Binary files a/images/homeassitant.png and b/images/homeassitant.png differ diff --git a/images/hydra.png b/images/hydra.png index b05f50109..a26e57524 100644 Binary files a/images/hydra.png and b/images/hydra.png differ diff --git a/images/hydra2.png b/images/hydra2.png new file mode 100644 index 000000000..4c265d22c Binary files /dev/null and b/images/hydra2.png differ diff --git a/images/jackett.png b/images/jackett.png index 8c1c88b21..6d7cfaf36 100644 Binary files a/images/jackett.png and b/images/jackett.png differ diff --git a/images/lazylibrarian.png b/images/lazylibrarian.png index 5c205adaa..8483752ad 100644 Binary files a/images/lazylibrarian.png and b/images/lazylibrarian.png differ diff --git a/images/login.png b/images/login.png index 6d2b65a63..5ae8108e7 100644 Binary files a/images/login.png and b/images/login.png differ diff --git a/images/madsonic.png b/images/madsonic.png index 7da1e6219..c767bc903 100644 Binary files a/images/madsonic.png and b/images/madsonic.png differ diff --git a/images/mail.png b/images/mail.png index 6052c9d77..b7756f5dc 100644 Binary files a/images/mail.png and b/images/mail.png differ diff --git a/images/mcmap.png b/images/mcmap.png new file mode 100644 index 000000000..3f553a314 Binary files /dev/null and b/images/mcmap.png differ diff --git a/images/meraki.png b/images/meraki.png index 26582986a..461470905 100644 Binary files a/images/meraki.png and b/images/meraki.png differ diff --git a/images/minecraft.png b/images/minecraft.png new file mode 100644 index 000000000..56807b527 Binary files /dev/null and b/images/minecraft.png differ diff --git a/images/motherboard.png b/images/motherboard.png new file mode 100644 index 000000000..ad0405ad6 Binary files /dev/null and b/images/motherboard.png differ diff --git a/images/mumble.png b/images/mumble.png index fd63d34f2..ed00f8e3c 100644 Binary files a/images/mumble.png and b/images/mumble.png differ diff --git a/images/mylar.png b/images/mylar.png index f3c489867..a7e6c36bf 100644 Binary files a/images/mylar.png and b/images/mylar.png differ diff --git a/images/nadaplaying.jpg b/images/nadaplaying.jpg index 6241b267f..2d7170810 100644 Binary files a/images/nadaplaying.jpg and b/images/nadaplaying.jpg differ diff --git a/images/netdata.png b/images/netdata.png index 821f7c402..aae978751 100644 Binary files a/images/netdata.png and b/images/netdata.png differ diff --git a/images/nzbget.png b/images/nzbget.png index 377834249..1be491054 100644 Binary files a/images/nzbget.png and b/images/nzbget.png differ diff --git a/images/nzbhydra.png b/images/nzbhydra.png index ff1943d1e..055d6524c 100644 Binary files a/images/nzbhydra.png and b/images/nzbhydra.png differ diff --git a/images/ombi.png b/images/ombi.png index 038c30e72..d77b77d02 100644 Binary files a/images/ombi.png and b/images/ombi.png differ diff --git a/images/openvpn.png b/images/openvpn.png index f7ce17703..f1d33ddad 100644 Binary files a/images/openvpn.png and b/images/openvpn.png differ diff --git a/images/organizr-load-w-thick.gif b/images/organizr-load-w-thick.gif new file mode 100644 index 000000000..fc50998d5 Binary files /dev/null and b/images/organizr-load-w-thick.gif differ diff --git a/images/organizr-logo-h-d.png b/images/organizr-logo-h-d.png index 910623b21..da01abf9d 100644 Binary files a/images/organizr-logo-h-d.png and b/images/organizr-logo-h-d.png differ diff --git a/images/organizr-logo-h.png b/images/organizr-logo-h.png index c4336d9df..3142befc9 100644 Binary files a/images/organizr-logo-h.png and b/images/organizr-logo-h.png differ diff --git a/images/organizr.png b/images/organizr.png index 8ef941800..09e9ef45e 100644 Binary files a/images/organizr.png and b/images/organizr.png differ diff --git a/images/organizr_logo.png b/images/organizr_logo.png index 5d4e887b0..6a71ee9e1 100644 Binary files a/images/organizr_logo.png and b/images/organizr_logo.png differ diff --git a/images/organizr_logo_d.png b/images/organizr_logo_d.png index 9101bfa19..dc7ca49d7 100644 Binary files a/images/organizr_logo_d.png and b/images/organizr_logo_d.png differ diff --git a/images/owncloud.png b/images/owncloud.png index 6f95a40f6..aba52784b 100644 Binary files a/images/owncloud.png and b/images/owncloud.png differ diff --git a/images/paint.png b/images/paint.png index 53a5170a8..83433e49b 100644 Binary files a/images/paint.png and b/images/paint.png differ diff --git a/images/phpsysinfo.png b/images/phpsysinfo.png index 8a812b3ea..d341d1bd9 100644 Binary files a/images/phpsysinfo.png and b/images/phpsysinfo.png differ diff --git a/images/pimpmylog.png b/images/pimpmylog.png index f6a008e05..592bdfbfd 100644 Binary files a/images/pimpmylog.png and b/images/pimpmylog.png differ diff --git a/images/plex.png b/images/plex.png index 3ea2e45e0..7ff123235 100644 Binary files a/images/plex.png and b/images/plex.png differ diff --git a/images/plexpy.png b/images/plexpy.png index 7a6a03617..4df73b655 100644 Binary files a/images/plexpy.png and b/images/plexpy.png differ diff --git a/images/power.png b/images/power.png new file mode 100644 index 000000000..867b41978 Binary files /dev/null and b/images/power.png differ diff --git a/images/proxmox.png b/images/proxmox.png new file mode 100644 index 000000000..8bbe6b171 Binary files /dev/null and b/images/proxmox.png differ diff --git a/images/pvr.png b/images/pvr.png index c3a8e4924..598a1dab7 100644 Binary files a/images/pvr.png and b/images/pvr.png differ diff --git a/images/pydio.png b/images/pydio.png index a12f6cc44..da8fe7df2 100644 Binary files a/images/pydio.png and b/images/pydio.png differ diff --git a/images/pydio2.png b/images/pydio2.png index a12f6cc44..da8fe7df2 100644 Binary files a/images/pydio2.png and b/images/pydio2.png differ diff --git a/images/pyload.png b/images/pyload.png index 2891f2147..c3301ecd2 100644 Binary files a/images/pyload.png and b/images/pyload.png differ diff --git a/images/qnap.png b/images/qnap.png index a698077ca..914457b53 100644 Binary files a/images/qnap.png and b/images/qnap.png differ diff --git a/images/radarr.png b/images/radarr.png index 5e143b52e..0002b8842 100644 Binary files a/images/radarr.png and b/images/radarr.png differ diff --git a/images/resilio.png b/images/resilio.png index aed8a1a45..8b5740fa3 100644 Binary files a/images/resilio.png and b/images/resilio.png differ diff --git a/images/rsscrawler.png b/images/rsscrawler.png index 7b33d2c3b..2505e65e6 100644 Binary files a/images/rsscrawler.png and b/images/rsscrawler.png differ diff --git a/images/rutorrent.png b/images/rutorrent.png index d08995b71..437f9d6f4 100644 Binary files a/images/rutorrent.png and b/images/rutorrent.png differ diff --git a/images/sabnzbd.png b/images/sabnzbd.png index aa3428d65..c22ab0fb3 100644 Binary files a/images/sabnzbd.png and b/images/sabnzbd.png differ diff --git a/images/security.png b/images/security.png index e7803b4b8..009b7591b 100644 Binary files a/images/security.png and b/images/security.png differ diff --git a/images/settings.png b/images/settings.png index 628b5a230..c95012a51 100644 Binary files a/images/settings.png and b/images/settings.png differ diff --git a/images/shellinabox.png b/images/shellinabox.png index 0059a068d..3eb53376b 100644 Binary files a/images/shellinabox.png and b/images/shellinabox.png differ diff --git a/images/sickbeard.png b/images/sickbeard.png index bf89b10b9..3203c2eb1 100644 Binary files a/images/sickbeard.png and b/images/sickbeard.png differ diff --git a/images/sickrage.png b/images/sickrage.png index 80b76dd2c..2dbb6a81b 100644 Binary files a/images/sickrage.png and b/images/sickrage.png differ diff --git a/images/sonarr.png b/images/sonarr.png index 6faa5c109..ee6b7303b 100644 Binary files a/images/sonarr.png and b/images/sonarr.png differ diff --git a/images/sort-btns/sort_asc.png b/images/sort-btns/sort_asc.png index e1ba61a80..47586a22a 100644 Binary files a/images/sort-btns/sort_asc.png and b/images/sort-btns/sort_asc.png differ diff --git a/images/sort-btns/sort_both.png b/images/sort-btns/sort_both.png index af5bc7c5a..02efff2a8 100644 Binary files a/images/sort-btns/sort_both.png and b/images/sort-btns/sort_both.png differ diff --git a/images/sort-btns/sort_desc.png b/images/sort-btns/sort_desc.png index 0e156deb5..7fac2b639 100644 Binary files a/images/sort-btns/sort_desc.png and b/images/sort-btns/sort_desc.png differ diff --git a/images/sowwy.png b/images/sowwy.png index 9d5a1c27d..0ea45d4d1 100644 Binary files a/images/sowwy.png and b/images/sowwy.png differ diff --git a/images/subsonic.png b/images/subsonic.png index c1373e14f..96ab48ce2 100644 Binary files a/images/subsonic.png and b/images/subsonic.png differ diff --git a/images/sugarcrm.png b/images/sugarcrm.png new file mode 100644 index 000000000..adaeff5e3 Binary files /dev/null and b/images/sugarcrm.png differ diff --git a/images/syncthing.png b/images/syncthing.png index d9fb60ca4..d06381a5d 100644 Binary files a/images/syncthing.png and b/images/syncthing.png differ diff --git a/images/synology.png b/images/synology.png index 45f008819..12b65f63c 100644 Binary files a/images/synology.png and b/images/synology.png differ diff --git a/images/teamspeak.png b/images/teamspeak.png index 29b318985..ea0ac73cb 100644 Binary files a/images/teamspeak.png and b/images/teamspeak.png differ diff --git a/images/themes/darkly.png b/images/themes/darkly.png index c5cd79ced..5cc08b28f 100644 Binary files a/images/themes/darkly.png and b/images/themes/darkly.png differ diff --git a/images/themes/emby.png b/images/themes/emby.png index 4cc3ea149..e420a7f84 100644 Binary files a/images/themes/emby.png and b/images/themes/emby.png differ diff --git a/images/themes/facebook.png b/images/themes/facebook.png index 49bef1d04..b179578d7 100644 Binary files a/images/themes/facebook.png and b/images/themes/facebook.png differ diff --git a/images/themes/joker.png b/images/themes/joker.png index 26c2949b1..86baa49a6 100644 Binary files a/images/themes/joker.png and b/images/themes/joker.png differ diff --git a/images/themes/monokai.png b/images/themes/monokai.png index f0821e983..07ee4d06b 100644 Binary files a/images/themes/monokai.png and b/images/themes/monokai.png differ diff --git a/images/themes/newplex.png b/images/themes/newplex.png index 74596d48d..5e389d519 100644 Binary files a/images/themes/newplex.png and b/images/themes/newplex.png differ diff --git a/images/themes/original.png b/images/themes/original.png index 09adbbf46..d3c3eef4d 100644 Binary files a/images/themes/original.png and b/images/themes/original.png differ diff --git a/images/themes/plex.png b/images/themes/plex.png index 4b7613a71..6231e0d7e 100644 Binary files a/images/themes/plex.png and b/images/themes/plex.png differ diff --git a/images/themes/slate.png b/images/themes/slate.png index 4a1a35e2f..bde618192 100644 Binary files a/images/themes/slate.png and b/images/themes/slate.png differ diff --git a/images/themes/spa.png b/images/themes/spa.png index 8381cd6b5..1dcfa7b66 100644 Binary files a/images/themes/spa.png and b/images/themes/spa.png differ diff --git a/images/transmission.png b/images/transmission.png index 9b13f93e5..2aef25a77 100644 Binary files a/images/transmission.png and b/images/transmission.png differ diff --git a/images/ubnt.png b/images/ubnt.png index bbe99d78f..cdaba8924 100644 Binary files a/images/ubnt.png and b/images/ubnt.png differ diff --git a/images/ubooquity.png b/images/ubooquity.png index a0e2393e7..ccfed6cdf 100644 Binary files a/images/ubooquity.png and b/images/ubooquity.png differ diff --git a/images/upgrade.png b/images/upgrade.png index 84101cd3a..9e475fdf8 100644 Binary files a/images/upgrade.png and b/images/upgrade.png differ diff --git a/images/utorrent.png b/images/utorrent.png index 3b7cf2035..240317573 100644 Binary files a/images/utorrent.png and b/images/utorrent.png differ diff --git a/images/vmware.png b/images/vmware.png index febfe9899..64d34bff8 100644 Binary files a/images/vmware.png and b/images/vmware.png differ diff --git a/images/watcher.png b/images/watcher.png index 608500986..fc0f4ee70 100644 Binary files a/images/watcher.png and b/images/watcher.png differ diff --git a/images/webmin.png b/images/webmin.png index 23594a8a1..cc2387ede 100644 Binary files a/images/webmin.png and b/images/webmin.png differ diff --git a/images/znc.png b/images/znc.png index 86d3225d3..d35872358 100644 Binary files a/images/znc.png and b/images/znc.png differ diff --git a/index.php b/index.php index 9ac1faa6d..06bcb7e93 100755 --- a/index.php +++ b/index.php @@ -1,4 +1,14 @@ authenticated && $USER->role == "admin") : - $result = $file_db->query('SELECT * FROM tabs WHERE active = "true"'); - $getsettings = $file_db->query('SELECT * FROM tabs WHERE active = "true"'); + $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" ORDER BY `order` asc'); + $getsettings = $file_db->query('SELECT * FROM tabs WHERE active = "true" ORDER BY `order` asc'); foreach($getsettings as $row) : @@ -129,11 +132,11 @@ elseif($USER->authenticated && $USER->role == "user") : - $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND user = "true"'); + $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND user = "true" ORDER BY `order` asc'); else : - $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND guest = "true"'); + $result = $file_db->query('SELECT * FROM tabs WHERE active = "true" AND guest = "true" ORDER BY `order` asc'); endif; @@ -164,11 +167,9 @@ endif; $userpic = md5( strtolower( trim( $USER->email ) ) ); - if(LOADINGICON !== "") : $loadingIcon = LOADINGICON; endif; if(SLIMBAR == "true") : $slimBar = "30"; $userSize = "25"; else : $slimBar = "56"; $userSize = "40"; endif; - if($USER->authenticated) : if(GRAVATAR == "true") : @@ -176,7 +177,6 @@ $showPic = ""; else: - $showPic = ""; endif; @@ -194,7 +194,6 @@ if(!defined('ENABLEMAIL')) : define('ENABLEMAIL', 'false'); endif; if(!defined('CUSTOMCSS')) : define('CUSTOMCSS', 'false'); endif; if(!defined('LOADINGSCREEN')) : define('LOADINGSCREEN', 'true'); endif; -if(!defined('INSTALLEDVERSION')) : define('INSTALLEDVERSION', 'Awaiting-Install...'); endif; if(!isset($notifyExplode)) : $notifyExplode = array("bar","slidetop"); @@ -224,7 +223,6 @@ - @@ -244,7 +242,6 @@ - @@ -269,14 +266,13 @@ - + + - - - -
    - - -
    - -
    - -
    - -
    - -
    - - - - - - - -
    - - - - - -
    - -
    - -
    - - - -
    - -
    - - - - - -