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

Commit 1d215c3

Browse files
authored
Merge pull request #1396 from evolution-cms/master
1.3.5
2 parents fa17b05 + 81763f3 commit 1d215c3

File tree

286 files changed

+16200
-17186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+16200
-17186
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@
77
# and the config file
88
/manager/includes/config.inc.php
99

10+
# Windows and Mac
11+
Thumbs.db
12+
Desktop.ini
13+
.DS_Store
14+
1015
# except do not ignore .gitignore
1116
!.gitignore

README.md

+29-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,36 @@
11
# Evolution CMS
22

3-
**What is EVO**
3+
![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/)
44

5-
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.
5+
Evolution CMS requires **PHP >= 5.4**, but snippet FormLister need **PHP >=5.6**
66

7-
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.
87

9-
Evolution CMS requires **PHP version 5.4 and higher**.
8+
## What is EVO
9+
10+
**EVO** is an open source Content Management System and Application Framework.
11+
12+
## History
13+
14+
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**.
15+
16+
## License
17+
18+
**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.
19+
20+
## Features
21+
22+
**EVO** provides a fast, lightweight and powerful framework on which to deploy and secure your website and web applications.
23+
24+
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.
25+
26+
For content management, you can easily duplicate documents, folders (and all their children!), chunks and snippets.
27+
28+
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.
29+
30+
31+
## Install
32+
Just use [Evo Installer](https://github.com/evolution-cms/installer)
33+
1034

1135
### Screenshots
1236

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

3357
Documentation:
34-
https://evolution-docs.com
58+
https://evolution-docs.com

assets/docs/changelog.txt

+325-3
Large diffs are not rendered by default.

assets/images/noimage.jpg

-42.1 KB
Binary file not shown.

assets/js/.htaccess

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
IndexIgnore */*
2+
<Files *.php>
3+
Order Deny,Allow
4+
Deny from all
5+
</Files>

assets/js/easy-ui/editors/imageBrowser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@
5151
}
5252
}
5353
});
54-
})(jQuery);
54+
})(jQuery);

assets/lib/APIHelpers.class.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public static function genPass($len, $data = '')
158158
* @param $data
159159
* @return bool|false|string
160160
*/
161-
private static function _getEnv($data)
161+
public static function getEnv($data)
162162
{
163163
switch (true) {
164164
case (isset($_SERVER[$data])):
@@ -197,25 +197,25 @@ public static function getUserIP($default = '127.0.0.1')
197197
{
198198
//Порядок условий зависит от приоритетов
199199
switch (true) {
200-
case ($tmp = self::_getEnv('HTTP_COMING_FROM')):
200+
case ($tmp = self::getEnv('HTTP_COMING_FROM')):
201201
$out = $tmp;
202202
break;
203-
case ($tmp = self::_getEnv('HTTP_X_COMING_FROM')):
203+
case ($tmp = self::getEnv('HTTP_X_COMING_FROM')):
204204
$out = $tmp;
205205
break;
206-
case ($tmp = self::_getEnv('HTTP_VIA')):
206+
case ($tmp = self::getEnv('HTTP_VIA')):
207207
$out = $tmp;
208208
break;
209-
case ($tmp = self::_getEnv('HTTP_FORWARDED')):
209+
case ($tmp = self::getEnv('HTTP_FORWARDED')):
210210
$out = $tmp;
211211
break;
212-
case ($tmp = self::_getEnv('HTTP_FORWARDED_FOR')):
212+
case ($tmp = self::getEnv('HTTP_FORWARDED_FOR')):
213213
$out = $tmp;
214214
break;
215-
case ($tmp = self::_getEnv('HTTP_X_FORWARDED')):
215+
case ($tmp = self::getEnv('HTTP_X_FORWARDED')):
216216
$out = $tmp;
217217
break;
218-
case ($tmp = self::_getEnv('HTTP_X_FORWARDED_FOR')):
218+
case ($tmp = self::getEnv('HTTP_X_FORWARDED_FOR')):
219219
$out = $tmp;
220220
break;
221221
case (!empty($_SERVER['REMOTE_ADDR'])):

assets/lib/Helpers/Config.php

100755100644
+7-2
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ public function getConfig()
8686
* @param array $cfg массив настроек
8787
* @return int результат сохранения настроек
8888
*/
89-
public function setConfig($cfg)
89+
public function setConfig($cfg, $overwrite = false)
9090
{
9191
if (is_array($cfg)) {
92-
$this->_cfg = array_merge($this->_cfg, $cfg);
92+
$this->_cfg = $overwrite ? $cfg : array_merge($this->_cfg, $cfg);
9393
$ret = count($this->_cfg);
9494
} else {
9595
$ret = false;
@@ -98,6 +98,11 @@ public function setConfig($cfg)
9898
return $ret;
9999
}
100100

101+
/**
102+
* @param $name
103+
* @param null $def
104+
* @return mixed
105+
*/
101106
public function getCFGDef($name, $def = null)
102107
{
103108
return \APIhelpers::getkey($this->_cfg, $name, $def);

assets/lib/Helpers/FS.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,9 @@ public function relativePath($path, $owner = null)
290290
if (is_null($owner)) {
291291
$owner = MODX_BASE_PATH;
292292
}
293+
$path = str_replace('\\', '/', $path);
293294
if (!(empty($path) || !is_scalar($path)) && !preg_match("/^http(s)?:\/\/\w+/", $path)) {
294-
$path = trim(preg_replace("#^" . $owner . "#", '', $path), '/');
295+
$path = trim(preg_replace("#^" . preg_quote($owner) . "#", '', $path), DIRECTORY_SEPARATOR);
295296
} else {
296297
$path = '';
297298
}

assets/lib/Helpers/Mailer.php

100755100644
+123-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php namespace Helpers;
22

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

56
/**
67
* Class Mailer
@@ -15,7 +16,7 @@ class Mailer
1516
protected $modx = null;
1617
public $config = array();
1718
protected $debug = false;
18-
19+
protected $queuePath = 'assets/cache/mail/';
1920

2021
/**
2122
* Mailer constructor.
@@ -26,10 +27,11 @@ class Mailer
2627
public function __construct(\DocumentParser $modx, $cfg, $debug = false)
2728
{
2829
$this->modx = $modx;
29-
$modx->loadExtension('MODxMailer');
30-
$this->mail = $modx->mail;
30+
$this->mail = new \MODxMailer();
31+
$this->mail->init($modx);
3132
$this->config = $cfg;
3233
$this->debug = $debug;
34+
$this->applyMailConfig();
3335
}
3436

3537
/**
@@ -88,15 +90,7 @@ public function send($report)
8890
return false;
8991
}
9092

91-
$this->mail->IsHTML($this->getCFGDef('isHtml', 1));
92-
$this->mail->From = $this->getCFGDef('from', $this->modx->config['site_name']);
93-
$this->mail->FromName = $this->getCFGDef('fromName', $this->modx->config['emailsender']);
94-
$this->mail->Subject = $this->getCFGDef('subject');
9593
$this->mail->Body = $report;
96-
$this->addAddressToMailer("replyTo", $this->getCFGDef('replyTo'));
97-
$this->addAddressToMailer("to", $this->getCFGDef('to'));
98-
$this->addAddressToMailer("cc", $this->getCFGDef('cc'));
99-
$this->addAddressToMailer("bcc", $this->getCFGDef('bcc'));
10094

10195
$result = $this->mail->send();
10296
if ($result) {
@@ -107,6 +101,124 @@ public function send($report)
107101
return $result;
108102
}
109103

104+
/**
105+
* @param $report
106+
* @return bool
107+
*/
108+
public function toQueue($report)
109+
{
110+
//если отправлять некуда или незачем, то делаем вид, что отправили
111+
if (!$this->getCFGDef('to') || $this->getCFGDef('noemail')) {
112+
return true;
113+
} elseif (empty($report)) {
114+
return false;
115+
}
116+
117+
$this->mail->Body = $report;
118+
119+
$this->Body = $this->modx->removeSanitizeSeed($this->mail->Body);
120+
$this->Subject = $this->modx->removeSanitizeSeed($this->mail->Subject);
121+
try {
122+
$result = $this->mail->preSend() && $this->saveMessage();
123+
} catch (\phpmailerException $e) {
124+
$this->mail->SetError($e->getMessage());
125+
126+
$result = false;
127+
}
128+
129+
if ($result) {
130+
$this->mail->ClearAllRecipients();
131+
$this->mail->ClearAttachments();
132+
$result = $this->getFileName();
133+
}
134+
135+
return $result;
136+
}
137+
138+
/**
139+
* @param string $path
140+
* @return bool
141+
*/
142+
public function setQueuePath($path = '') {
143+
if (!empty($path)) {
144+
$this->queuePath = $path;
145+
return true;
146+
} else {
147+
return false;
148+
}
149+
}
150+
151+
/**
152+
* @return mixed
153+
*/
154+
protected function saveMessage()
155+
{
156+
$data = serialize(array(
157+
"header" => $this->mail->getMIMEHeader(),
158+
"body" => $this->mail->getMIMEBody(),
159+
"config" => $this->config
160+
));
161+
$file = $this->getFileName();
162+
$dir = MODX_BASE_PATH . $this->queuePath;
163+
if (!is_dir($dir)) {
164+
@mkdir($dir);
165+
}
166+
$result = @file_put_contents($dir . $file, $data) !== false;
167+
if ($result) {
168+
$result = $file;
169+
}
170+
171+
return $result;
172+
}
173+
174+
/**
175+
* @return string
176+
*/
177+
protected function getFileName() {
178+
return $this->mail->getMessageID() . '.eml';
179+
}
180+
181+
/**
182+
* @param $file
183+
* @return bool
184+
*/
185+
public function fromQueue($file)
186+
{
187+
$result = false;
188+
$dir = MODX_BASE_PATH . $this->queuePath;
189+
if (file_exists($dir . $file) && is_readable($dir . $file)) {
190+
$message = unserialize(file_get_contents($dir . $file));
191+
$this->config = $message['config'];
192+
$this->applyMailConfig();
193+
$this->mail->setMIMEHeader($message['header'])->setMIMEBody($message['body']);
194+
unset($message);
195+
$result = $this->mail->postSend();
196+
if ($result) {
197+
$this->mail->setMIMEBody()->setMIMEHeader();
198+
@unlink($dir . $file);
199+
}
200+
}
201+
202+
return $result;
203+
}
204+
205+
/**
206+
* @return $this
207+
*/
208+
protected function applyMailConfig()
209+
{
210+
$this->mail->IsHTML($this->getCFGDef('isHtml', 1));
211+
$this->mail->From = $this->getCFGDef('from', $this->modx->config['emailsender']);
212+
$this->mail->FromName = $this->getCFGDef('fromName', $this->modx->config['site_name']);
213+
$this->mail->Subject = $this->getCFGDef('subject');
214+
$this->addAddressToMailer("replyTo", $this->getCFGDef('replyTo'));
215+
$this->addAddressToMailer("to", $this->getCFGDef('to'));
216+
$this->addAddressToMailer("cc", $this->getCFGDef('cc'));
217+
$this->addAddressToMailer("bcc", $this->getCFGDef('bcc'));
218+
219+
return $this;
220+
}
221+
110222
/**
111223
* @param string $param
112224
* @param mixed $default

assets/lib/MODxAPI/MODx.php

+19
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,25 @@ public function getDefaultFields()
186186
return $this->default_field;
187187
}
188188

189+
/**
190+
* @param $value
191+
* @return int|mixed|string
192+
*/
193+
protected function getTime($value)
194+
{
195+
$value = trim($value);
196+
if (!empty($value)) {
197+
if (!is_numeric($value)) {
198+
$value = (int)strtotime($value);
199+
}
200+
if (!empty($value)) {
201+
$value += $this->modxConfig('server_offset_time');
202+
}
203+
}
204+
205+
return $value;
206+
}
207+
189208
/**
190209
* @param string $name
191210
* @param null $default

assets/lib/MODxAPI/autoTable.abstract.php

+8
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ public function edit($id)
7777
*/
7878
public function save($fire_events = null, $clearCache = false)
7979
{
80+
foreach ($this->jsonFields as $field) {
81+
if ($this->get($field) === null
82+
&& isset($this->default_field[$field])
83+
&& is_array($this->default_field[$field]))
84+
{
85+
$this->set($field, $this->default_field[$field]);
86+
}
87+
}
8088
$fld = $this->encodeFields()->toArray();
8189
foreach ($this->default_field as $key => $value) {
8290
if ($this->newDoc && $this->get($key) === null && $this->get($key) !== $value) {

0 commit comments

Comments
 (0)