Core update (blogging is good for you)
This commit is contained in:
parent
77196b4e6e
commit
915ca9ca7e
5 changed files with 67 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
|||
Yellow 0.4.26
|
||||
Yellow 0.4.27
|
||||
=============
|
||||
[](https://gitter.im/markseu/yellowcms)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ language = en
|
|||
// serverScheme = http
|
||||
// serverName = your.domain.name
|
||||
// serverBase =
|
||||
// timeZone = UTC
|
||||
|
||||
imageLocation = /media/images/
|
||||
pluginLocation = /media/plugins/
|
||||
|
|
|
@ -3,8 +3,14 @@
|
|||
language = en
|
||||
languageDescription = English
|
||||
languageAuthor = Mark Seuffert
|
||||
languageDateFormat = Y-m-d
|
||||
|
||||
dateMonths = January, February, March, April, May, June, July, August, September, October, November, December
|
||||
dateWeekdays = Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
|
||||
dateFormatShort = F Y
|
||||
dateFormatMedium = Y-m-d
|
||||
dateFormatLong = Y-m-d H:i
|
||||
paginationPrevious = ← Previous
|
||||
paginationNext = Next →
|
||||
webinterfaceLoginText = Yellow login
|
||||
webinterfaceLoginEmail = Email:
|
||||
webinterfaceLoginPassword = Password:
|
||||
|
@ -18,7 +24,3 @@ webinterfaceNew = +
|
|||
webinterfaceUserHelp = Help
|
||||
webinterfaceUserHelpUrl = https://github.com/markseu/yellowcms/wiki
|
||||
webinterfaceUserLogout = Logout
|
||||
dateMonths = January, February, March, April, May, June, July, August, September, October, November, December
|
||||
dateWeekdays = Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
|
||||
paginationPrevious = ← Previous
|
||||
paginationNext = Next →
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
// Copyright (c) 2013-2014 Datenstrom, http://datenstrom.se
|
||||
// Copyright (c) 2013-2015 Datenstrom, http://datenstrom.se
|
||||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
// Web interface core plugin
|
||||
class YellowWebinterface
|
||||
{
|
||||
const Version = "0.4.9";
|
||||
const Version = "0.4.10";
|
||||
var $yellow; //access to API
|
||||
var $active; //web interface is active? (boolean)
|
||||
var $userLoginFailed; //web interface login failed? (boolean)
|
||||
|
@ -465,6 +465,7 @@ class YellowWebinterface
|
|||
$this->yellow->config->get("configDir"), $this->yellow->config->get("newPageFile"),
|
||||
$this->yellow->config->get("contentDefaultFile"));
|
||||
$fileData = $this->yellow->toolbox->getFileData($fileName);
|
||||
$fileData = preg_replace("/@datetime/i", date("Y-m-d H:i:s"), $fileData);
|
||||
$fileData = preg_replace("/@date/i", date("Y-m-d"), $fileData);
|
||||
$fileData = preg_replace("/@username/i", $this->users->getName(), $fileData);
|
||||
$fileData = preg_replace("/@userlanguage/i", $this->users->getLanguage(), $fileData);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Yellow main class
|
||||
class Yellow
|
||||
{
|
||||
const Version = "0.4.26";
|
||||
const Version = "0.4.27";
|
||||
var $page; //current page
|
||||
var $pages; //pages from file system
|
||||
var $config; //configuration
|
||||
|
@ -29,6 +29,7 @@ class Yellow
|
|||
$this->config->setDefault("serverScheme", $this->toolbox->getServerScheme());
|
||||
$this->config->setDefault("serverName", $this->toolbox->getServerName());
|
||||
$this->config->setDefault("serverBase", $this->toolbox->getServerBase());
|
||||
$this->config->setDefault("timeZone", $this->toolbox->getTimeZone());
|
||||
$this->config->setDefault("imageLocation", "/media/images/");
|
||||
$this->config->setDefault("pluginLocation", "/media/plugins/");
|
||||
$this->config->setDefault("themeLocation", "/media/themes/");
|
||||
|
@ -329,6 +330,7 @@ class Yellow
|
|||
// Update configuration
|
||||
function updateConfig()
|
||||
{
|
||||
date_default_timezone_set($this->config->get("timeZone"));
|
||||
list($pathRoot, $pathHome) = $this->toolbox->findRootConfig($this->config->get("contentDir"),
|
||||
$this->config->get("contentRootDir"), $this->config->get("contentHomeDir"),
|
||||
$this->config->get("multiLanguageMode"));
|
||||
|
@ -473,7 +475,7 @@ class YellowPage
|
|||
$this->set("language", $this->yellow->toolbox->findLanguageFromFile($this->fileName,
|
||||
$this->yellow->config->get("contentDir"), $this->yellow->config->get("contentRootDir"),
|
||||
$this->yellow->config->get("language")));
|
||||
$this->set("modified", date("c", $this->yellow->toolbox->findModifiedFromFile($this->fileName)));
|
||||
$this->set("modified", date("Y-m-d H:i:s", $this->yellow->toolbox->findModifiedFromFile($this->fileName)));
|
||||
$this->set("parser", $this->yellow->config->get("parser"));
|
||||
|
||||
if(preg_match("/^(\xEF\xBB\xBF)?\-\-\-[\r\n]+(.+?)[\r\n]+\-\-\-[\r\n]+/s", $this->rawData, $parsed))
|
||||
|
@ -622,13 +624,18 @@ class YellowPage
|
|||
return htmlspecialchars($this->get($key));
|
||||
}
|
||||
|
||||
// Return page meta data as human readable date, HTML encoded
|
||||
function getFormatted($key)
|
||||
// Return page meta data as human readable date
|
||||
function getDate($key, $dateFormat = "")
|
||||
{
|
||||
$dateFormat = $this->yellow->text->get("languageDateFormat");
|
||||
return $this->yellow->text->getDateFormatted($dateFormat, strtotime($this->get($key)));
|
||||
if($this->yellow->text->isExisting($dateFormat))
|
||||
{
|
||||
$format = $this->yellow->text->get($dateFormat);
|
||||
} else {
|
||||
$format = $this->yellow->text->get("dateFormatMedium");
|
||||
}
|
||||
return $this->yellow->text->getDateFormatted(strtotime($this->get($key)), $format);
|
||||
}
|
||||
|
||||
|
||||
// Return page content, HTML encoded or raw format
|
||||
function getContent($rawFormat = false)
|
||||
{
|
||||
|
@ -1378,20 +1385,6 @@ class YellowText
|
|||
return htmlspecialchars($this->getText($key, $this->language));
|
||||
}
|
||||
|
||||
// Return human readable date, HTML encoded
|
||||
function getDateFormatted($dateFormat, $timestamp)
|
||||
{
|
||||
$dateMonths = preg_split("/,\s*/", $this->get("dateMonths"));
|
||||
$dateWeekdays = preg_split("/,\s*/", $this->get("dateWeekdays"));
|
||||
$month = $dateMonths[date('n', $timestamp) - 1];
|
||||
$weekday = $dateWeekdays[date('N', $timestamp) - 1];
|
||||
$dateFormat = preg_replace("/(?<!\\\)F/", addcslashes($month, 'A..Za..z'), $dateFormat);
|
||||
$dateFormat = preg_replace("/(?<!\\\)M/", addcslashes(substru($month, 0, 3), 'A..Za..z'), $dateFormat);
|
||||
$dateFormat = preg_replace("/(?<!\\\)D/", addcslashes(substru($weekday, 0, 3), 'A..Za..z'), $dateFormat);
|
||||
$dateFormat = preg_replace("/(?<!\\\)l/", addcslashes($weekday, 'A..Za..z'), $dateFormat);
|
||||
return htmlspecialchars(date($dateFormat, $timestamp));
|
||||
}
|
||||
|
||||
// Return text strings
|
||||
function getData($filterStart = "", $language = "")
|
||||
{
|
||||
|
@ -1413,12 +1406,42 @@ class YellowText
|
|||
return $text;
|
||||
}
|
||||
|
||||
// Return text string with human readable date, custom date format
|
||||
function getDateFormatted($timestamp, $format)
|
||||
{
|
||||
$dateMonths = preg_split("/,\s*/", $this->get("dateMonths"));
|
||||
$dateWeekdays = preg_split("/,\s*/", $this->get("dateWeekdays"));
|
||||
$month = $dateMonths[date('n', $timestamp) - 1];
|
||||
$weekday = $dateWeekdays[date('N', $timestamp) - 1];
|
||||
$format = preg_replace("/(?<!\\\)F/", addcslashes($month, 'A..Za..z'), $format);
|
||||
$format = preg_replace("/(?<!\\\)M/", addcslashes(substru($month, 0, 3), 'A..Za..z'), $format);
|
||||
$format = preg_replace("/(?<!\\\)D/", addcslashes(substru($weekday, 0, 3), 'A..Za..z'), $format);
|
||||
$format = preg_replace("/(?<!\\\)l/", addcslashes($weekday, 'A..Za..z'), $format);
|
||||
return date($format, $timestamp);
|
||||
}
|
||||
|
||||
// Return text modification date, Unix time or HTTP format
|
||||
function getModified($httpFormat = false)
|
||||
{
|
||||
return $httpFormat ? $this->yellow->toolbox->getHttpDateFormatted($this->modified) : $this->modified;
|
||||
}
|
||||
|
||||
// Normalise date into known format
|
||||
function normaliseDate($text)
|
||||
{
|
||||
if(preg_match("/^\d+\-\d+$/", $text))
|
||||
{
|
||||
$output = $this->getDateFormatted(strtotime($text), $this->get("dateFormatShort"));
|
||||
} else if(preg_match("/^\d+\-\d+\-\d+$/", $text)) {
|
||||
$output = $this->getDateFormatted(strtotime($text), $this->get("dateFormatMedium"));
|
||||
} else if(preg_match("/^\d+\-\d+\-\d+ \d+\:\d+$/", $text)) {
|
||||
$output = $this->getDateFormatted(strtotime($text), $this->get("dateFormatLong"));
|
||||
} else {
|
||||
$output = $text;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Check if language exists
|
||||
function isLanguage($language)
|
||||
{
|
||||
|
@ -2066,6 +2089,17 @@ class YellowToolbox
|
|||
return $text;
|
||||
}
|
||||
|
||||
// Return time zone
|
||||
function getTimeZone()
|
||||
{
|
||||
$timeZone = @date_default_timezone_get();
|
||||
if(PHP_OS=="Darwin" && $timeZone=="UTC")
|
||||
{
|
||||
if(preg_match("#zoneinfo/(.*)#", @readlink("/etc/localtime"), $matches)) $timeZone = $matches[1];
|
||||
}
|
||||
return $timeZone;
|
||||
}
|
||||
|
||||
// Return human readable HTTP server status
|
||||
function getHttpStatusFormatted($statusCode)
|
||||
{
|
||||
|
@ -2512,9 +2546,6 @@ function strrposb() { return call_user_func_array("strrpos", func_get_args()); }
|
|||
function substru() { return call_user_func_array("mb_substr", func_get_args()); }
|
||||
function substrb() { return call_user_func_array("substr", func_get_args()); }
|
||||
|
||||
// Default timezone for PHP
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
|
||||
// Error reporting for PHP
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
?>
|
Loading…
Add table
Reference in a new issue