commit 608f411a4ca93f747c5179e9a74bb3daf25b58fa
parent f8dd50d5720213b5e1b9b50d68fadb5eddd5ca84
Author: markseu <mark2011@mayberg.se>
Date: Fri, 8 Apr 2016 15:16:07 +0200
System update (brave new world)
Diffstat:
2 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -29,6 +29,7 @@ class YellowCore
$this->toolbox = new YellowToolbox();
$this->config->setDefault("sitename", "Yellow");
$this->config->setDefault("author", "Yellow");
+ $this->config->setDefault("email", "postmaster");
$this->config->setDefault("language", "en");
$this->config->setDefault("theme", "default");
$this->config->setDefault("serverScheme", $this->toolbox->getServerScheme());
@@ -68,6 +69,7 @@ class YellowCore
$this->config->setDefault("parser", "markdown");
$this->config->setDefault("parserSafeMode", "0");
$this->config->setDefault("multiLanguageMode", "0");
+ $this->config->setDefault("installationMode", "0");
$this->load();
}
@@ -126,8 +128,12 @@ class YellowCore
if($this->page->isError()) $statusCode = $this->processRequestError();
$this->toolbox->timerStop($time);
ob_end_flush();
- if(defined("DEBUG") && DEBUG>=1) echo "YellowCore::request status:$statusCode location:$location<br/>\n";
- if(defined("DEBUG") && DEBUG>=1) echo "YellowCore::request time:$time ms<br/>\n";
+ if(defined("DEBUG") && DEBUG>=1)
+ {
+ $handler = $this->getRequestHandler();
+ echo "YellowCore::request status:$statusCode location:$location handler:$handler<br/>\n";
+ echo "YellowCore::request time:$time ms<br/>\n";
+ }
return $statusCode;
}
@@ -165,11 +171,7 @@ class YellowCore
$statusCode = $this->sendPage();
}
}
- if(defined("DEBUG") && DEBUG>=1)
- {
- $handler = $this->getRequestHandler();
- echo "YellowCore::processRequest file:$fileName handler:$handler<br/>\n";
- }
+ if(defined("DEBUG") && DEBUG>=1) echo "YellowCore::processRequest file:$fileName<br/>\n";
return $statusCode;
}
@@ -181,11 +183,7 @@ class YellowCore
$this->page->location, $this->page->fileName, $this->page->cacheable, $this->page->statusCode,
$this->page->get("pageError"));
$statusCode = $this->sendPage();
- if(defined("DEBUG") && DEBUG>=1)
- {
- $handler = $this->getRequestHandler();
- echo "YellowCore::processRequestError file:$fileName handler:$handler<br/>\n";
- }
+ if(defined("DEBUG") && DEBUG>=1) echo "YellowCore::processRequestError file:$fileName<br/>\n";
return $statusCode;
}
@@ -1698,6 +1696,36 @@ class YellowConfig
}
}
+ // Update configuration in file
+ function update($fileName, $config)
+ {
+ foreach($config as $key=>$value)
+ {
+ if(empty($key) || strempty($value)) { unset($config[$key]); continue; }
+ $this->set(lcfirst($key), $value);
+ }
+ $this->modified = time();
+ $fileData = $this->yellow->toolbox->readFile($fileName);
+ foreach($this->yellow->toolbox->getTextLines($fileData) as $line)
+ {
+ preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches);
+ $keyOriginal = $matches[1]; $keySearch = strtoloweru($matches[1]); $keyFound = "";
+ foreach($config as $key=>$value) if(strtoloweru($key) == $keySearch) { $keyFound = $key; break; }
+ if(!empty($keyFound))
+ {
+ $fileDataNew .= "$keyOriginal: $config[$keyFound]\n";
+ unset($config[$keyFound]);
+ } else {
+ $fileDataNew .= $line;
+ }
+ }
+ foreach($config as $key=>$value)
+ {
+ $fileDataNew .= "$key: $value\n";
+ }
+ return $this->yellow->toolbox->createFile($fileName, $fileDataNew);
+ }
+
// Set default configuration
function setDefault($key, $value)
{
diff --git a/system/themes/flatsite.css b/system/themes/flatsite.css
@@ -104,7 +104,7 @@ a, img { border:none; text-decoration:none; }
.form-control {
margin:0; padding:2px 4px;
- display:inline-block;
+ display:inline-block; min-width:7em;
background-color:#fff; color:#555;
background-image:linear-gradient(to bottom, #fff, #fff);
border:1px solid #bbb;