Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1396 from evolution-cms/master
Browse files Browse the repository at this point in the history
1.3.5
  • Loading branch information
Dmi3yy authored Sep 1, 2017
2 parents fa17b05 + 81763f3 commit 1d215c3
Show file tree
Hide file tree
Showing 286 changed files with 16,200 additions and 17,186 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
# and the config file
/manager/includes/config.inc.php

# Windows and Mac
Thumbs.db
Desktop.ini
.DS_Store

# except do not ignore .gitignore
!.gitignore
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
# Evolution CMS

**What is EVO**
![PHP version](https://img.shields.io/badge/PHP->=v5.4-green.svg?php=5.4) [![GitHub release](https://img.shields.io/github/release/evolution-cms/evolution.svg)](https://github.com/evolution-cms/evolution/)

EVO is an open source Content Management System and Application Framework. Initially inspired by Etomite 0.6, then it been MODX Evolution 0.7 - 1.0.8 is an ongoing project written by Raymond Irving and a core team of contributors MODX, and now its Evolution CMS maintained by Dmytro Lukianenko and a core team of contributors at the EVO Project. EVO is distributed under the GPL license and is now run by a professional team of developers from all over the world. Visit the Forums for more information.
Evolution CMS requires **PHP >= 5.4**, but snippet FormLister need **PHP >=5.6**

EVO provides a fast, lightweight and powerful framework on which to deploy and secure your website and web applications. For example, it gives you a true system for registered web users and groups that is separate from administration users. You can grant some web users access to one page and others access to another page. For content management, you can easily duplicate documents, folders (and all their children!), chunks and snippets. Most significant, though, is EVO's ability to empower you to quickly and easily create and maintain a rich and dynamic website like never before.

Evolution CMS requires **PHP version 5.4 and higher**.
## What is EVO

**EVO** is an open source Content Management System and Application Framework.

## History

Initially inspired by **Etomite 0.6**, then it been **MODX Evolution 0.7 - 1.0.8** is an ongoing project written by *Raymond Irving* and a core team of contributors **MODX**, and now its **Evolution CMS** maintained by *Dmytro Lukianenko* and a core team of contributors at the **EVO Project**.

## License

**EVO** is distributed under the **GPL license** and is now run by a professional team of developers from all over the world. Visit the Forums for more information.

## Features

**EVO** provides a fast, lightweight and powerful framework on which to deploy and secure your website and web applications.

For example, it gives you a true system for registered web users and groups that is separate from administration users. You can grant some web users access to one page and others access to another page.

For content management, you can easily duplicate documents, folders (and all their children!), chunks and snippets.

Most significant, though, is **EVO's** ability to empower you to quickly and easily create and maintain a rich and dynamic website like never before.


## Install
Just use [Evo Installer](https://github.com/evolution-cms/installer)


### Screenshots

Expand All @@ -31,4 +55,4 @@ Extras:
https://extras.evolution-cms.com

Documentation:
https://evolution-docs.com
https://evolution-docs.com
328 changes: 325 additions & 3 deletions assets/docs/changelog.txt

Large diffs are not rendered by default.

Binary file removed assets/images/noimage.jpg
Binary file not shown.
5 changes: 5 additions & 0 deletions assets/js/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IndexIgnore */*
<Files *.php>
Order Deny,Allow
Deny from all
</Files>
2 changes: 1 addition & 1 deletion assets/js/easy-ui/editors/imageBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
}
}
});
})(jQuery);
})(jQuery);
16 changes: 8 additions & 8 deletions assets/lib/APIHelpers.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static function genPass($len, $data = '')
* @param $data
* @return bool|false|string
*/
private static function _getEnv($data)
public static function getEnv($data)
{
switch (true) {
case (isset($_SERVER[$data])):
Expand Down Expand Up @@ -197,25 +197,25 @@ public static function getUserIP($default = '127.0.0.1')
{
//Порядок условий зависит от приоритетов
switch (true) {
case ($tmp = self::_getEnv('HTTP_COMING_FROM')):
case ($tmp = self::getEnv('HTTP_COMING_FROM')):
$out = $tmp;
break;
case ($tmp = self::_getEnv('HTTP_X_COMING_FROM')):
case ($tmp = self::getEnv('HTTP_X_COMING_FROM')):
$out = $tmp;
break;
case ($tmp = self::_getEnv('HTTP_VIA')):
case ($tmp = self::getEnv('HTTP_VIA')):
$out = $tmp;
break;
case ($tmp = self::_getEnv('HTTP_FORWARDED')):
case ($tmp = self::getEnv('HTTP_FORWARDED')):
$out = $tmp;
break;
case ($tmp = self::_getEnv('HTTP_FORWARDED_FOR')):
case ($tmp = self::getEnv('HTTP_FORWARDED_FOR')):
$out = $tmp;
break;
case ($tmp = self::_getEnv('HTTP_X_FORWARDED')):
case ($tmp = self::getEnv('HTTP_X_FORWARDED')):
$out = $tmp;
break;
case ($tmp = self::_getEnv('HTTP_X_FORWARDED_FOR')):
case ($tmp = self::getEnv('HTTP_X_FORWARDED_FOR')):
$out = $tmp;
break;
case (!empty($_SERVER['REMOTE_ADDR'])):
Expand Down
9 changes: 7 additions & 2 deletions assets/lib/Helpers/Config.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public function getConfig()
* @param array $cfg массив настроек
* @return int результат сохранения настроек
*/
public function setConfig($cfg)
public function setConfig($cfg, $overwrite = false)
{
if (is_array($cfg)) {
$this->_cfg = array_merge($this->_cfg, $cfg);
$this->_cfg = $overwrite ? $cfg : array_merge($this->_cfg, $cfg);
$ret = count($this->_cfg);
} else {
$ret = false;
Expand All @@ -98,6 +98,11 @@ public function setConfig($cfg)
return $ret;
}

/**
* @param $name
* @param null $def
* @return mixed
*/
public function getCFGDef($name, $def = null)
{
return \APIhelpers::getkey($this->_cfg, $name, $def);
Expand Down
3 changes: 2 additions & 1 deletion assets/lib/Helpers/FS.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ public function relativePath($path, $owner = null)
if (is_null($owner)) {
$owner = MODX_BASE_PATH;
}
$path = str_replace('\\', '/', $path);
if (!(empty($path) || !is_scalar($path)) && !preg_match("/^http(s)?:\/\/\w+/", $path)) {
$path = trim(preg_replace("#^" . $owner . "#", '', $path), '/');
$path = trim(preg_replace("#^" . preg_quote($owner) . "#", '', $path), DIRECTORY_SEPARATOR);
} else {
$path = '';
}
Expand Down
134 changes: 123 additions & 11 deletions assets/lib/Helpers/Mailer.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Helpers;

include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php');
include_once(MODX_MANAGER_PATH . 'includes/extenders/modxmailer.class.inc.php');

/**
* Class Mailer
Expand All @@ -15,7 +16,7 @@ class Mailer
protected $modx = null;
public $config = array();
protected $debug = false;

protected $queuePath = 'assets/cache/mail/';

/**
* Mailer constructor.
Expand All @@ -26,10 +27,11 @@ class Mailer
public function __construct(\DocumentParser $modx, $cfg, $debug = false)
{
$this->modx = $modx;
$modx->loadExtension('MODxMailer');
$this->mail = $modx->mail;
$this->mail = new \MODxMailer();
$this->mail->init($modx);
$this->config = $cfg;
$this->debug = $debug;
$this->applyMailConfig();
}

/**
Expand Down Expand Up @@ -88,15 +90,7 @@ public function send($report)
return false;
}

$this->mail->IsHTML($this->getCFGDef('isHtml', 1));
$this->mail->From = $this->getCFGDef('from', $this->modx->config['site_name']);
$this->mail->FromName = $this->getCFGDef('fromName', $this->modx->config['emailsender']);
$this->mail->Subject = $this->getCFGDef('subject');
$this->mail->Body = $report;
$this->addAddressToMailer("replyTo", $this->getCFGDef('replyTo'));
$this->addAddressToMailer("to", $this->getCFGDef('to'));
$this->addAddressToMailer("cc", $this->getCFGDef('cc'));
$this->addAddressToMailer("bcc", $this->getCFGDef('bcc'));

$result = $this->mail->send();
if ($result) {
Expand All @@ -107,6 +101,124 @@ public function send($report)
return $result;
}

/**
* @param $report
* @return bool
*/
public function toQueue($report)
{
//если отправлять некуда или незачем, то делаем вид, что отправили
if (!$this->getCFGDef('to') || $this->getCFGDef('noemail')) {
return true;
} elseif (empty($report)) {
return false;
}

$this->mail->Body = $report;

$this->Body = $this->modx->removeSanitizeSeed($this->mail->Body);
$this->Subject = $this->modx->removeSanitizeSeed($this->mail->Subject);
try {
$result = $this->mail->preSend() && $this->saveMessage();
} catch (\phpmailerException $e) {
$this->mail->SetError($e->getMessage());

$result = false;
}

if ($result) {
$this->mail->ClearAllRecipients();
$this->mail->ClearAttachments();
$result = $this->getFileName();
}

return $result;
}

/**
* @param string $path
* @return bool
*/
public function setQueuePath($path = '') {
if (!empty($path)) {
$this->queuePath = $path;
return true;
} else {
return false;
}
}

/**
* @return mixed
*/
protected function saveMessage()
{
$data = serialize(array(
"header" => $this->mail->getMIMEHeader(),
"body" => $this->mail->getMIMEBody(),
"config" => $this->config
));
$file = $this->getFileName();
$dir = MODX_BASE_PATH . $this->queuePath;
if (!is_dir($dir)) {
@mkdir($dir);
}
$result = @file_put_contents($dir . $file, $data) !== false;
if ($result) {
$result = $file;
}

return $result;
}

/**
* @return string
*/
protected function getFileName() {
return $this->mail->getMessageID() . '.eml';
}

/**
* @param $file
* @return bool
*/
public function fromQueue($file)
{
$result = false;
$dir = MODX_BASE_PATH . $this->queuePath;
if (file_exists($dir . $file) && is_readable($dir . $file)) {
$message = unserialize(file_get_contents($dir . $file));
$this->config = $message['config'];
$this->applyMailConfig();
$this->mail->setMIMEHeader($message['header'])->setMIMEBody($message['body']);
unset($message);
$result = $this->mail->postSend();
if ($result) {
$this->mail->setMIMEBody()->setMIMEHeader();
@unlink($dir . $file);
}
}

return $result;
}

/**
* @return $this
*/
protected function applyMailConfig()
{
$this->mail->IsHTML($this->getCFGDef('isHtml', 1));
$this->mail->From = $this->getCFGDef('from', $this->modx->config['emailsender']);
$this->mail->FromName = $this->getCFGDef('fromName', $this->modx->config['site_name']);
$this->mail->Subject = $this->getCFGDef('subject');
$this->addAddressToMailer("replyTo", $this->getCFGDef('replyTo'));
$this->addAddressToMailer("to", $this->getCFGDef('to'));
$this->addAddressToMailer("cc", $this->getCFGDef('cc'));
$this->addAddressToMailer("bcc", $this->getCFGDef('bcc'));

return $this;
}

/**
* @param string $param
* @param mixed $default
Expand Down
19 changes: 19 additions & 0 deletions assets/lib/MODxAPI/MODx.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ public function getDefaultFields()
return $this->default_field;
}

/**
* @param $value
* @return int|mixed|string
*/
protected function getTime($value)
{
$value = trim($value);
if (!empty($value)) {
if (!is_numeric($value)) {
$value = (int)strtotime($value);
}
if (!empty($value)) {
$value += $this->modxConfig('server_offset_time');
}
}

return $value;
}

/**
* @param string $name
* @param null $default
Expand Down
8 changes: 8 additions & 0 deletions assets/lib/MODxAPI/autoTable.abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public function edit($id)
*/
public function save($fire_events = null, $clearCache = false)
{
foreach ($this->jsonFields as $field) {
if ($this->get($field) === null
&& isset($this->default_field[$field])
&& is_array($this->default_field[$field]))
{
$this->set($field, $this->default_field[$field]);
}
}
$fld = $this->encodeFields()->toArray();
foreach ($this->default_field as $key => $value) {
if ($this->newDoc && $this->get($key) === null && $this->get($key) !== $value) {
Expand Down
Loading

0 comments on commit 1d215c3

Please sign in to comment.