Quellcode durchsuchen

Picking back up on this, work to get dev env back running

Andy Baugh vor 8 Jahren
Ursprung
Commit
3b2c014c5d
5 geänderte Dateien mit 22 neuen und 19 gelöschten Zeilen
  1. 1 1
      CHANGELOG
  2. 1 1
      bin/install
  3. 4 2
      index.php
  4. BIN
      sys/admin/.bengine.inc.swp
  5. 16 15
      sys/admin/index.php

+ 1 - 1
CHANGELOG

@@ -1,5 +1,5 @@
 Version 2.0 IRONMAN SLOG development notes [ALPHA]:
-* tCMS now has an installer in bin/installer.
+* tCMS now has an installer/updater in bin/installer. Makefile rules 'make install' and 'make update' also do this.
 * Fixed a bug where "" encapsulated titles in microblog editor would get baleeted on load.
 * Changed up the directory structure somewhat, mostly due to needing privately stored items.
 * Added an SVG logo.

+ 1 - 1
bin/install

@@ -91,7 +91,7 @@ function get_string_from_stdin($noecho=0) {
 }
 
 function install( $to, $from, $files2copy ) {
-    if( empty($to), empty($from) || empty($files2copy) ) die("Bad arguments passed to 'install' function");
+    if( empty($to) || empty($from) || empty($files2copy) ) die("Bad arguments passed to 'install' function");
     if( file_exists( $to ) && !is_dir( $to ) ) {
         echo "[FATAL] $to already exists but is not a directory! Stopping here.\n";
         exit(1);

+ 4 - 2
index.php

@@ -3,14 +3,16 @@
 $protocol = ( !empty($_SERVER["HTTPS"] ) ) ? 'https'       : 'http';
 $nav      = ( !empty($_GET['nav'] ) )      ? $_GET['nav']  : '';
 $post     = ( !empty($_GET['post'] ) )     ? $_GET['post'] : '';
-$docroot  = $_SERVER['DOCUMENT_ROOT'];
+# DOCUMENT_ROOT can be misconfigured, __FILE__, __DIR__, etc. can't be
+$docroot  = realpath( __DIR__ );
 
 # Grab the main configuration file. We need to see where that lives first though.
 if( file_exists( "$docroot/basedir" ) ) {
     $fh = fopen( "$docroot/basedir" );
     $basedir = trim(fgets( $fh )); # I only want the first line
     fclose($fh);
-} else {
+}
+if( empty( $basedir ) ) {
     $basedir = posix_getpwuid(posix_geteuid())['dir'] . "/.tCMS";
 }
 

BIN
sys/admin/.bengine.inc.swp


+ 16 - 15
sys/admin/index.php

@@ -1,3 +1,18 @@
+<?php
+    include_once("lib/auth.inc");
+	auth::ensure_auth();
+    if( empty($_GET['app']) || $_GET['app'] == 'config' ) {
+        $kontent = "settings.inc";
+    } elseif ($_GET['app'] == 'blog') {
+        $kontent = "bengine.inc";
+    } elseif ($_GET['app'] == 'microblog') {
+        $kontent = "mbengine.inc";
+    } elseif ($_GET['app'] == 'users' ) {
+        $kontent = "users.inc";
+    } else {
+        $kontent = "settings.inc";
+    }
+?>
 <!doctype html>
 <html dir="ltr" lang="en-US">
  <head>
@@ -31,21 +46,7 @@
   </div>
   <div id="kontent" style="display: block;">
    <?php
-    if (!empty($_SERVER["HTTPS"])) {
-     $protocol = "https";
-    } else {
-     $protocol = "http";
-    }
-    if (empty($_GET['nav'])) {
-     $kontent = "settings.inc";
-    }
-    elseif ($_GET['nav'] == 1) {
-     $kontent = "bengine.inc";
-    }
-    elseif ($_GET['nav'] == 2) {
-     $kontent = "mbengine.inc";
-    }
-    include $kontent;
+        include $kontent;
    ?>
   </div>
  </body>