浏览代码

New Features and Some Fixes

Fixed #157 - Added Home-Assistant Logo
Fixed #156 - Added Click on uploaded icon to copy path
Fixed #151 - Added Australian Timezones and Arctic Timezones
Fixed Check.php file that had errors
Added AUTH.PHP file for server side authentication - check Github wiki
for instructions
Added custom Error page for webserver - check Github wiki for
instructions
Added custom scrollbar for settings page
Added New Plex Theme
Added Reddit Link to Organizr Subreddit
Added new animation to editing order of tabs on icon
causefx 9 年之前
父节点
当前提交
349815d413
共有 10 个文件被更改,包括 311 次插入18 次删除
  1. 62 0
      auth.php
  2. 1 1
      bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css
  3. 2 2
      check.php
  4. 191 0
      error.php
  5. 二进制
      images/confused.png
  6. 二进制
      images/homeassitant.png
  7. 二进制
      images/themes/newplex.png
  8. 6 2
      index.php
  9. 5 5
      js/custom.js
  10. 44 8
      settings.php

+ 62 - 0
auth.php

@@ -0,0 +1,62 @@
+<?php
+
+$data = false;
+
+function registration_callback($username, $email, $userdir)
+{
+    global $data;
+    $data = array($username, $email, $userdir);
+}
+
+function getBannedUsers($string){
+    
+    if (strpos($string, ',') !== false) {
+    
+        $banned = explode(",", $string);
+        
+    }elseif (strpos($string, ',') == false) {
+    
+        $banned = array($string);
+        
+    }
+    
+    return $banned;
+    
+}
+
+if (isset($_GET['ban'])) : $ban = strtoupper($_GET['ban']); else : $ban = ""; endif;
+
+require_once("user.php");
+$USER = new User("registration_callback");
+
+if (isset($_GET['admin'])) :
+
+    if($USER->authenticated && $USER->role == "admin" && !in_array(strtoupper($USER->username), getBannedUsers($ban))) :
+
+        exit(http_response_code(200));
+
+    else :
+
+        exit(http_response_code(401));
+
+    endif;
+
+elseif (isset($_GET['user'])) :
+
+    if($USER->authenticated && !in_array(strtoupper($USER->username), getBannedUsers($ban))) :
+
+        exit(http_response_code(200));
+
+    else :
+
+        exit(http_response_code(401));
+
+    endif;
+
+elseif (!isset($_GET['user'])  && !isset($_GET['admin'])) :
+
+    exit(http_response_code(401));
+
+endif;
+
+?>

+ 1 - 1
bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css

@@ -51,7 +51,7 @@ y-axis
 ------------------------------------------------------------------------------------------------------------------------
 */
 
-	.mCSB_inside > .mCSB_container{ margin-right: 30px; }
+	.mCSB_inside > .mCSB_container{ /*margin-right: 30px;*/ }
 
 	.mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden{ margin-right: 0; } /* non-visible scrollbar */
 	

+ 2 - 2
check.php

@@ -168,8 +168,8 @@ $folder = USER_HOME;
                 checkFunction("MAIL");
                 checkFunction("fopen");
 
-                getFilePermission($db);
-                getFilePermission($folder);
+                @getFilePermission($db);
+                @getFilePermission($folder);
                 getFilePermission((__DIR__));
                 getFilePermission(dirname(__DIR__));
                 

+ 191 - 0
error.php

@@ -0,0 +1,191 @@
+<?php
+
+$requested = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
+
+if (isset($_GET['error'])) {
+    
+    $status = $_GET['error'];
+    
+}else{
+    
+    $status = "";
+    
+}
+
+$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'),
+       404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
+       405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
+       408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
+       500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
+       502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
+       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'),
+    
+);
+
+@$errorTitle = $codes[$status][0];
+@$message = $codes[$status][1];
+
+if ($errorTitle == false || strlen($status) != 3) {
+    
+    $message = 'Please supply a valid status code.';
+    $errorTitle = "Error";
+
+}
+
+$data = false;
+
+ini_set("display_errors", 1);
+ini_set("error_reporting", E_ALL | E_STRICT);
+
+function registration_callback($username, $email, $userdir)
+{
+    global $data;
+    $data = array($username, $email, $userdir);
+}
+
+require_once("user.php");
+require_once("translate.php");
+$USER = new User("registration_callback");
+
+$dbfile = DATABASE_LOCATION  . constant('User::DATABASE_NAME') . ".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;
+
+?>
+
+<!DOCTYPE html>
+
+<html lang="en" class="no-js">
+
+    <head>
+        
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <meta name="msapplication-tap-highlight" content="no" />
+
+        <title><?=$errorTitle;?></title>
+
+        <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
+        <link rel="stylesheet" href="bower_components/Waves/dist/waves.min.css"> 
+        <link rel="stylesheet" href="css/style.css">
+        
+    </head>
+
+    <body class="gray-bg" style="padding: 0;">
+
+        <div class="main-wrapper" style="position: initial;">
+
+            <div style="margin:0 20px; overflow:hidden">
+                
+                <div class="table-wrapper" style="background:<?=$sidebar;?>;">
+                
+                    <div class="table-row">
+                
+                        <div class="table-cell text-center">
+                        
+                            <div class="login i-block">
+                                
+                                <div class="content-box">
+                                    
+                                    <div class="biggest-box" style="background:<?=$topbar;?>;">
+                
+                                        <h1 class="zero-m text-uppercase" style="color:<?=$topbartext;?>; font-size: 40px;"><?=$errorTitle;?></h1>
+                
+                                    </div>
+                
+                                    <div class="big-box text-left">
+                
+                                        <center><img src="images/<?=$codes[$status][2];?>.png" style="height: 200px;"></center>
+                                        <h4 style="color: <?=$topbar;?>;" class="text-center"><?php echo $message;?></h4>
+
+                                        <button style="background:<?=$topbar;?>;" onclick="goBack()" type="button" class="btn log-in btn-block btn-primary text-uppercase waves waves-effect waves-float"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("GO_BACK");?></text></button>					                                    
+                                    </div>
+                                
+                                </div>
+                            
+                            </div>
+                        
+                        </div>
+                    
+                    </div>
+                
+                </div>
+
+            </div>
+
+        </div>
+        
+        <script>
+            
+            function goBack() {
+                window.history.back();
+            }
+            
+        </script>
+
+    </body>
+
+</html>

二进制
images/confused.png


二进制
images/homeassitant.png


二进制
images/themes/newplex.png


+ 6 - 2
index.php

@@ -81,8 +81,10 @@ function getTimezone(){
         '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
@@ -490,7 +492,9 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 
             -webkit-overflow-scrolling: touch;
 
-        }.iframe iframe{
+        }.main-wrapper{
+            
+            /*position: absolute !important;*/
 
         }#menu-toggle span {
             background: <?=$topbartext;?>;
@@ -2031,4 +2035,4 @@ endif; ?>
 
     </body>
 
-</html>
+</html>

+ 5 - 5
js/custom.js

@@ -5,7 +5,7 @@ $(document).ready(function(){
 		limit: null,
 		maxSize: null,
 		extensions: null,
-		changeInput: '<div class="jFiler-input-dragDrop"><div class="jFiler-input-inner"><div class="jFiler-input-icon"><i class="fa fa-cloud-upload"></i></div><div class="jFiler-input-text"><h3>Drag & Drop files here</h3> <span style="display:inline-block; margin: 15px 0">or</span></div><button type="button" class="btn waves btn-labeled btn-primary btn-sm text-uppercase waves-effect waves-float"><span class="btn-label"><i class="fa fa-folder-open"></i></span>Browse </button></div></div>',
+		changeInput: '<div class="jFiler-input-dragDrop"><textarea id="copyTarget2" class="hideCopy" style="left: -9999px; top: 0; position: absolute;"></textarea><div class="jFiler-input-inner"><div class="jFiler-input-icon"><i class="fa fa-cloud-upload"></i></div><div class="jFiler-input-text"><h3>Drag & Drop files here</h3> <span style="display:inline-block; margin: 15px 0">or</span></div><button type="button" class="btn waves btn-labeled btn-primary btn-sm text-uppercase waves-effect waves-float"><span class="btn-label"><i class="fa fa-folder-open"></i></span>Browse </button></div></div>',
 		showThumbs: true,
 		theme: "dragdropbox",
 		templates: {
@@ -17,8 +17,8 @@ $(document).ready(function(){
 									<div class="jFiler-item-status"></div>\
 									<div class="jFiler-item-thumb-overlay">\
 										<div class="jFiler-item-info">\
-											<div style="display:table-cell;vertical-align: middle;">\
-												<span class="jFiler-item-title"><b title="{{fi-name}}">images/{{fi-name}}</b></span>\
+											<div class="allIcons" style="display:table-cell;vertical-align: middle;">\
+												<span class="jFiler-item-title"><b class="allIcons" title="images/{{fi-name}}">Click HERE To Copy</b></span>\
 												<span class="jFiler-item-others">{{fi-size2}}</span>\
 											</div>\
 										</div>\
@@ -43,8 +43,8 @@ $(document).ready(function(){
 										<div class="jFiler-item-status"></div>\
 										<div class="jFiler-item-thumb-overlay">\
 											<div class="jFiler-item-info">\
-												<div style="display:table-cell;vertical-align: middle;">\
-													<span class="jFiler-item-title"><b title="{{fi-name}}">images/{{fi-name}}</b></span>\
+												<div class="allIcons" style="display:table-cell;vertical-align: middle;">\
+													<span class="jFiler-item-title"><b class="allIcons" title="images/{{fi-name}}">Click HERE To Copy</b></span>\
 													<span class="jFiler-item-others">{{fi-size2}}</span>\
 												</div>\
 											</div>\

+ 44 - 8
settings.php

@@ -109,8 +109,10 @@ function getTimezone(){
         '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
@@ -694,7 +696,7 @@ endif;
         
     </head>
 
-    <body class="scroller-body" style="padding: 0; background: #273238;">
+    <body class="scroller-body" style="padding: 0; background: #273238; overflow: hidden">
         
         <style>
 
@@ -853,11 +855,11 @@ endif; ?>
                                         
                                         <div class="row">
                                             
-                                            <textarea id="copyTarget" class="hideCopy" style="left: -9999px; top: 0; position: absolute;"></textarea>
+                                            <textarea id="copyTarget" class="hideCopy" style="left: -9999px; top: 0; position: absolute;"></textarea>                                           
                                             <?php
                                             $dirname = "images/";
                                             $images = scandir($dirname);
-                                            $ignore = Array(".", "..", "favicon/", "favicon", "._.DS_Store", ".DS_Store", "sowwy.png", "sort-btns", "loading.png", "titlelogo.png", "default.svg", "login.png", "themes");
+                                            $ignore = Array(".", "..", "favicon/", "favicon", "._.DS_Store", ".DS_Store", "confused.png", "sowwy.png", "sort-btns", "loading.png", "titlelogo.png", "default.svg", "login.png", "themes");
                                             foreach($images as $curimg){
                                                 if(!in_array($curimg, $ignore)) { ?>
 
@@ -926,7 +928,7 @@ endif; ?>
 
                                                             <div class="form-group">
 
-                                                                <div class="action-btns" style="width:calc(100%)">
+                                                                <div class="action-btns tabIconView" style="width:calc(100%)">
                                                                     
                                                                     <?php if($backgroundListImage == "") : ?>
                                                                     <a class="" style="margin-left: 0px"><span style="font: normal normal normal 30px/1 FontAwesome;" class="fa fa-hand-paper-o"></span></a>
@@ -1520,6 +1522,7 @@ endif; ?>
                                     
                                     <p id="submitFeedback">
                                     
+                                        <a href='https://reddit.com/r/organizr' target='_blank' type='button' style="background: #AD80FD" class='btn waves btn-labeled btn-success btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-reddit'></i></span>SUBREDDIT</a> 
                                         <a href='https://github.com/causefx/Organizr/issues/new' target='_blank' type='button' class='btn waves btn-labeled btn-success btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-github-alt'></i></span><?php echo $language->translate("SUBMIT_ISSUE");?></a> 
                                         <a href='https://github.com/causefx/Organizr' target='_blank' type='button' class='btn waves btn-labeled btn-primary btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-github'></i></span><?php echo $language->translate("VIEW_ON_GITHUB");?></a>
                                         <a href='https://gitter.im/Organizrr/Lobby' target='_blank' type='button' class='btn waves btn-labeled btn-dark btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-comments-o'></i></span><?php echo $language->translate("CHAT_WITH_US");?></a>
@@ -1853,6 +1856,8 @@ endif; ?>
                                             <ul class="dropdown-menu gray-bg">
                                             
                                                 <li class="chooseTheme" id="plexTheme" style="border: 1px #FFFFFF; border-style: groove; background: #000000; border-radius: 5px; margin: 5px;"><a style="color: #E49F0C !important;" href="#">Plex<span><img class="themeImage" src="images/themes/plex.png"></span></a></li>
+                                                
+                                                <li class="chooseTheme" id="newPlexTheme" style="border: 1px #E5A00D; border-style: groove; background: #282A2D; border-radius: 5px; margin: 5px;"><a style="color: #E5A00D !important;" href="#">New Plex<span><img class="themeImage" src="images/themes/newplex.png"></span></a></li>
                                             
                                                 <li class="chooseTheme" id="embyTheme" style="border: 1px #FFFFFF; border-style: groove; background: #212121; border-radius: 5px; margin: 5px;"><a style="color: #52B54B !important;" href="#">Emby<span><img class="themeImage" src="images/themes/emby.png"></span></a></li>
                                                 
@@ -2123,10 +2128,10 @@ endif;?></textarea>
                 $('#datatable').DataTable({
                     displayLength: 10,
                     dom: 'T<"clear">lfrtip',
-                responsive: true,
+                    responsive: true,
                     "order": [[ 0, 'desc' ]],
                     "language": {
-			           "info": "<?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 0);?> _START_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 1);?> _END_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 2);?> _TOTAL_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 3);?>",
+                        "info": "<?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 0);?> _START_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 1);?> _END_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 2);?> _TOTAL_ <?php echo explosion($language->translate('SHOW_ENTRY_CURRENT'), 3);?>",
                         "infoEmpty": "<?php echo $language->translate('NO_ENTRIES');?>",
                         "infoFiltered": "<?php echo explosion($language->translate('FILTERED'), 0);?> _MAX_ <?php echo explosion($language->translate('FILTERED'), 1);?>",
                         "lengthMenu": "<?php echo $language->translate('SHOW');?> _MENU_ <?php echo $language->translate('ENTRIES');?>",
@@ -2135,7 +2140,7 @@ endif;?></textarea>
                         "searchClass": "<?php echo $language->translate('SEARCH');?>",
                         "zeroRecords": "<?php echo $language->translate('NO_MATCHING');?>",
                         "paginate": {
-				             "next": "<?php echo $language->translate('NEXT');?>",
+				            "next": "<?php echo $language->translate('NEXT');?>",
                             "previous": "<?php echo $language->translate('PREVIOUS');?>",
 				           }
 			         }
@@ -2471,9 +2476,11 @@ endif;?></textarea>
 
                 $(this).find("span[class^='fa fa-hand-paper-o']").attr("class", "fa fa-hand-grab-o");
                 $(this).addClass("dragging");
+                $(this).find("div[class^='action-btns tabIconView']").addClass("animated swing");
                 $(this).mouseup(function() {
                     $(this).find("span[class^='fa fa-hand-grab-o']").attr("class", "fa fa-hand-paper-o");
                     $(this).removeClass("dragging");
+                    $(this).find("div[class^='action-btns tabIconView']").removeClass("animated swing");
                 });
             });
             
@@ -2538,6 +2545,18 @@ endif;?></textarea>
                 $( "div[id^='viewAllIcons']" ).toggle();
                 
             });
+            
+            $('body').on('click', 'b.allIcons', function() {
+
+                $("textarea[id^='copyTarget2']").val($(this).attr("title"));
+
+                copyToClipboard(document.getElementById("copyTarget2"));
+                
+                parent.notify("<?php echo $language->translate('ICON_COPY');?>","clipboard","success","5000", "<?=$notifyExplode[0];?>", "<?=$notifyExplode[1];?>");
+                
+                $( "div[class^='jFiler jFiler-theme-dragdropbox']" ).hide();
+                
+            });
          
         </script>
         
@@ -2724,6 +2743,23 @@ endif;?></textarea>
 
             });
             
+            $('#newPlexTheme').on('click touchstart', function(){
+
+                changeColor("topbartext", "#E5A00D");
+                changeColor("topbar", "#282A2D");
+                changeColor("bottombar", "#282A2D");
+                changeColor("sidebar", "#3F4245");
+                changeColor("hoverbg", "#E5A00D");
+                changeColor("activetabBG", "#282A2D");
+                changeColor("activetabicon", "#E5A00D");
+                changeColor("activetabtext", "#E5A00D");
+                changeColor("inactiveicon", "#F9F9F9");
+                changeColor("inactivetext", "#F9F9F9");
+                changeColor("loading", "#E5A00D");
+                changeColor("hovertext", "#E0E3E6");
+
+            });
+            
             $('textarea').numberedtextarea({
 
               // font color for line numbers
@@ -2770,7 +2806,7 @@ endif;?></textarea>
                 dataType: "json",
                 success: function(github) {
                     
-                    var currentVersion = "1.01";
+                    var currentVersion = "1.05";
                    
                     infoTabVersion = $('#about').find('#version');
                     infoTabVersionHistory = $('#about').find('#versionHistory');