Просмотр исходного кода

Fixes and Features added

Fixed #25 - Added option to have logo in title bar - Image has to be
250px on width and 50px on height
Fixed #40 - Added option to change the loading icon
Fixed #57 - Timezone error on older php
causefx 9 лет назад
Родитель
Сommit
9f666e2da5
5 измененных файлов с 145 добавлено и 10 удалено
  1. 1 0
      check.php
  2. BIN
      images/rutorrent.png
  3. 47 7
      index.php
  4. 95 3
      settings.php
  5. 2 0
      user.php

+ 1 - 0
check.php

@@ -163,6 +163,7 @@ $folder = USER_HOME;
                 check("PDO_SQLITE");
                 check("PDO");
                 check("Zip");
+                check("openssl");
                 checkFunction("MAIL");
                 checkFunction("fopen");
 

BIN
images/rutorrent.png


+ 47 - 7
index.php

@@ -21,6 +21,7 @@ $activetabicon = "#FFFFFF";
 $activetabtext = "#FFFFFF";
 $inactiveicon = "#FFFFFF";
 $inactivetext = "#FFFFFF";
+$loadingIcon = "images/organizr.png";
 $baseURL = "";
 
 function registration_callback($username, $email, $userdir){
@@ -56,6 +57,24 @@ function write_ini_file($content, $path) {
     return $success; 
 
 }
+
+function getTimezone(){
+    
+    if (ini_get('date.timezone')) :
+    
+        echo ini_get('date.timezone');
+    
+    elseif (date_default_timezone_get()) :
+    
+        echo date_default_timezone_get();
+    
+    else :
+    
+        echo "America/Los_Angeles";
+    
+    endif;    
+    
+}
                 
 if(isset($_POST['action'])) :
 
@@ -194,6 +213,7 @@ else :
     endif;
 
     $userpic = md5( strtolower( trim( $USER->email ) ) );
+    if(!empty(LOADINGICON)) : $loadingIcon = LOADINGICON; endif;
 
 endif;
 
@@ -212,7 +232,7 @@ endif;
         <meta http-equiv="X-UA-Compatible" content="IE=edge">
         <meta name="msapplication-tap-highlight" content="no" />
 
-        <title><?=$title;?><?php if($title !== "Organizr") :  echo "- Organizr"; endif; ?></title>
+        <title><?=$title;?><?php if($title !== "Organizr") :  echo " - Organizr"; endif; ?></title>
 
         <link rel="stylesheet" href="<?=$baseURL;?>bower_components/bootstrap/dist/css/bootstrap.min.css">
         <link rel="stylesheet" href="<?=$baseURL;?>bower_components/font-awesome/css/font-awesome.min.css">
@@ -268,7 +288,7 @@ endif;
                         <div></div>
                         <div></div>
                         <div></div>
-                        <logo class="logo"><img height="192px" src="images/organizr.png"></logo>
+                        <logo class="logo"><img height="192px" src="<?=$loadingIcon;?>"></logo>
                     
                     </div>
                 
@@ -283,12 +303,12 @@ endif;
             <style>
                 .bottom-bnts a {
                     
-                    background: <?=$bottombar;?>;
-                    color: <?=$topbartext;?>;
+                    background: <?=$bottombar;?> !important;
+                    color: <?=$topbartext;?> !important;
                 
                 }.bottom-bnts {
                     
-                    background-color: <?=$bottombar;?>;
+                    background-color: <?=$bottombar;?> !important;
                 
                 }.gn-menu-main {
                     
@@ -506,7 +526,27 @@ endif;
 
                 <li class="top-clock">
                     
-                    <span><span style="color:<?=$topbartext;?>;"><b><?=$title;?></b></span></span>
+                    <?php 
+                    
+                    if($configReady == "Yes") : 
+                    
+                        if(empty(TITLELOGO)) : 
+                    
+                            echo "<span><span style=\"color: topbartext\"><b>$title</b></span></span>"; 
+                    
+                        else : 
+                    
+                            echo "<img height='50px' width='250px' src='" . TITLELOGO . "'>";
+                    
+                        endif;
+                    
+                    else :
+                    
+                        echo "<span><span style=\"color: topbartext\"><b>$title</b></span></span>"; 
+                    
+                    endif;
+                    
+                    ?>
                 
                 </li>
 
@@ -664,7 +704,7 @@ endif;
                                                 
                                                 <h5>Set Database Location</h5>
                                                 
-                                                <input type="text" class="form-control material" name="timezone" autofocus value="<?php echo date_default_timezone_get();?>" autocorrect="off" autocapitalize="off" required>
+                                                <input type="text" class="form-control material" name="timezone" autofocus value="<?php echo getTimezone();?>" autocorrect="off" autocapitalize="off" required>
                                                 
                                                 <h5>Set Timezone</h5>
                                                 

+ 95 - 3
settings.php

@@ -35,8 +35,24 @@ function printArray($arrayName){
     
 }
 
-$dbfile = DATABASE_LOCATION  . constant('User::DATABASE_NAME') . ".db";
+function write_ini_file($content, $path) { 
+    
+    if (!$handle = fopen($path, 'w')) {
+        
+        return false; 
+    
+    }
+    
+    $success = fwrite($handle, $content);
+    
+    fclose($handle); 
+    
+    return $success; 
+
+}
 
+$dbfile = DATABASE_LOCATION  . constant('User::DATABASE_NAME') . ".db";
+$databaseLocation = "databaseLocation.ini.php";
 $userdirpath = USER_HOME;
 $userdirpath = substr_replace($userdirpath, "", -1);
 
@@ -285,6 +301,26 @@ if($action == "upgrade") :
     echo "<script>window.parent.location.reload(true);</script>";
 
 endif;
+
+if($action == "createLocation") :
+
+    $databaseData = '; <?php die("Access denied"); ?>' . "\r\n";
+
+    foreach ($_POST as $postName => $postValue) {
+            
+        if($postName !== "action") :
+        
+            if(substr($postValue, -1) == "/") : $postValue = rtrim($postValue, "/"); endif;
+        
+            $databaseData .= $postName . " = \"" . $postValue . "\"\r\n";
+        
+        endif;
+        
+    }
+
+    write_ini_file($databaseData, $databaseLocation);
+
+endif;
                 
 if(!isset($_POST['op'])) :
 
@@ -592,12 +628,18 @@ endif;
                      
                                 </li>
                                 
-                                 <li>
+                                <li>
                         
                                     <a href="#loginlog" data-toggle="tab"><i class="fa fa-file-text-o indigo"></i></a>
                      
                                 </li>
                                 
+                                <li>
+                        
+                                    <a href="#systemSettings" data-toggle="tab"><i class="fa fa-cog gray"></i></a>
+                     
+                                </li>
+                                
                                 <li>
                         
                                     <a href="#about" data-toggle="tab"><i class="fa fa-info red-orange"></i></a>
@@ -995,6 +1037,56 @@ endif;
 
                                 </div>
                                 
+                                <div class="tab-pane big-box  fade in" id="systemSettings">
+                                    
+                                    <div class="row">
+                                        
+                                        <div class="col-lg-12">
+                                          
+                                            <div class="gray-bg content-box big-box box-shadow">
+                                            
+                                                <form class="content-form form-inline" name="systemSettings" id="systemSettings" action="" method="POST">
+                        								    
+                                                    <input type="hidden" name="action" value="createLocation" />
+
+                                                    <div class="form-group">
+
+                                                        <input type="text" class="form-control gray" name="databaseLocation" placeholder="databaseLocation" autocorrect="off" autocapitalize="off" value="<?php echo DATABASE_LOCATION;?>">
+
+                                                    </div>
+
+                                                    <div class="form-group">
+
+                                                        <input type="text" class="form-control gray" name="timezone" placeholder="timezone" value="<?php echo TIMEZONE;?>">
+
+                                                    </div>
+
+                                                    <div class="form-group">
+
+                                                        <input type="text" class="form-control gray" name="titleLogo" placeholder="Logo URL for title" value="<?php echo TITLELOGO;?>">
+
+                                                    </div>
+
+                                                    <div class="form-group">
+
+                                                        <input type="text" class="form-control gray" name="loadingIcon" placeholder="Loading Icon URL" value="<?php echo LOADINGICON;?>">
+
+                                                    </div>
+                                                    
+                                                    
+                                                    
+                                                    <button type="submit" class="btn btn-success btn-icon waves waves-circle waves-effect waves-float"><i class="fa fa-floppy-o"></i></button>
+
+                                                </form>               
+                                          
+                                            </div>
+                                        
+                                        </div>
+                                      
+                                    </div>
+
+                                </div>
+                                
                                 <div class="tab-pane big-box  fade in" id="loginlog">
 
                                     <div class="table-responsive">
@@ -1854,7 +1946,7 @@ endif;
                 dataType: "json",
                 success: function(github) {
                    
-                    var currentVersion = "0.995";
+                    var currentVersion = "0.997";
                     var githubVersion = github.tag_name;
                     var githubDescription = github.body;
                     var githubName = github.name;

+ 2 - 0
user.php

@@ -11,6 +11,8 @@
     define('USER_HOME', $databaseConfig['databaseLocation'] . '/users/');
     define('DATABASE_LOCATION', $databaseConfig['databaseLocation'] . '/');
     if(!empty($databaseConfig['timezone'])) : define('TIMEZONE', $databaseConfig['timezone']); else : define('TIMEZONE', 'America/Los_Angeles'); endif;
+    if(!empty($databaseConfig['titleLogo'])) : define('TITLELOGO', $databaseConfig['titleLogo']); else : define('TITLELOGO', ''); endif;
+    if(!empty($databaseConfig['loadingIcon'])) : define('LOADINGICON', $databaseConfig['loadingIcon']); else : define('LOADINGICON', ''); endif;
     define('FAIL_LOG', 'loginLog.json');
 
 	class User