diff --git a/README.md b/README.md index 2e684ee4b3..88d1036b7d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# MODX Evolution +# Evolution CMS -**What is MODX** +**What is EVO** -MODX is an open source Content Management System and Application Framework. Initially inspired by Etomite 0.6, MODX is an ongoing project written by Raymond Irving and a core team of contributors at the MODX Project. MODX 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. +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. -MODX 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 MODX's ability to empower you to quickly and easily create and maintain a rich and dynamic website like never before. +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. -MODX Evolution requires **PHP version 5.3 and higher**. +Evolution CMS requires **PHP version 5.4 and higher**. ### Screenshots @@ -19,16 +19,16 @@ MODX Evolution requires **PHP version 5.3 and higher**. ### References Official Website: -https://modx.com/community/modx-evolution +https://evo.im/ Download: -https://modx.com/download/evolution/ +https://github.com/evolution-cms/evolution/releases Previous Releases: https://modx.com/download/evolution/previous-releases.html Extras: -https://modx.com/extras/?product=evolution +https://extras.evolution-cms.com Documentation: -https://docs.modx.com/evolution/1.0 \ No newline at end of file +https://evolution-docs.com \ No newline at end of file diff --git a/assets/cache/updater/.htaccess b/assets/cache/updater/.htaccess new file mode 100644 index 0000000000..83c6d382fb --- /dev/null +++ b/assets/cache/updater/.htaccess @@ -0,0 +1,2 @@ +order deny,allow +allow from all diff --git a/assets/cache/updater/ht.access b/assets/cache/updater/ht.access new file mode 100644 index 0000000000..8f91d28b69 --- /dev/null +++ b/assets/cache/updater/ht.access @@ -0,0 +1,2 @@ +order deny,allow +allow from all \ No newline at end of file diff --git a/manager/media/style/MODxRE2_DropdownMenu/frames/index.html b/assets/cache/updater/index.html similarity index 100% rename from manager/media/style/MODxRE2_DropdownMenu/frames/index.html rename to assets/cache/updater/index.html diff --git a/assets/docs/changelog.txt b/assets/docs/changelog.txt index 5d2c85d33e..68242bcf83 100644 --- a/assets/docs/changelog.txt +++ b/assets/docs/changelog.txt @@ -1,6 +1,44 @@ This file shows the changes in recent releases of MODX. The most current release is usually the development release, and is only shown to give an idea of what's currently in the pipeline. +Evolution CMS 1.3.0(Jul 10, 2017) +* [GitHub:#3dda520a] - [R] update sortables list delete mootools sortables (64j) +* [GitHub:#9cafe6db] - [F] fix toggle menu (64j) +* [GitHub:#6c316c18] - [I] Update DocLister add DLmenu (dmi3yy) +* [GitHub:#fd23c498] - [I] Update FormLister to 1.7.3 (dmi3yy) +* [GitHub:#30a552fd] - [F] fix autoloader paths (Pathologic) +* [GitHub:#21ec58cf] - [F] fix show icon dragndrop (Serg) +* [GitHub:#56f57ec1] - [F] fix for OnManagerNodePrerender (dmi3yy) +* [GitHub:#aa04955b] - [F] fix issues #60 (Serg) +* [GitHub:#14503447] - [F] fix issues #62 (Serg) +* [GitHub:#c316e0d7] - [F] update tv rank (64j) +* [GitHub:#534deada] - [F] fix width logo in IE (64j) +* [GitHub:#0c3f8780] - [R] update plugins priority (64j) +* [GitHub:#aee4c3ed] - [R] format code style logs (64j) +* [GitHub:#8777bbf3] - [F] fix file managment (64j) +* [GitHub:#eaaaf777] - [R] upd actions buttons managment files (64j) +* [GitHub:#16cbb4f1] - [F] fix showChildren in tree (64j) +* [GitHub:#9258c4be] - [R] update actionbuttons (64j) +* [GitHub:#92f954fa] - [F] fixed issues #15 (64j) +* [GitHub:#328ad309] - [F] fix #12 (dmi3yy) +* [GitHub:#2bcc9874] - [F] change home ico from modx to home ) (dmi3yy) +* [GitHub:#626b416f] - [F] fix bkmanager header error (dmi3yy) +* [GitHub:#c43f140e] - [F] fix #9 (dmi3yy) +* [GitHub:#9da575f7] - [F] add favicon (64j) +* [GitHub:#2ff3f724] - [R] update loader (64j) +* [GitHub:#8df7c747] - [F] for update from older version (from security-fix) (dmi3yy) +* [GitHub:#f17a35ab] - [R] ajaxSearch 1.11.0 no use index-ajax.php for ajax (dmi3yy) +* [GitHub:#78e656e6] - [I] add updater plugin in core (dmi3yy) +* [GitHub:#8bbe38ae] - [F] Error : Undefined property (Serg) +* [GitHub:#ca775306] - [R] min php version set to 5.4 (dmi3yy) +* [GitHub:#95ea0349] - [F] update lang (dmi3yy) +* [GitHub:#e6224f43] - [С] rename modx to EVO (dmi3yy) +* [GitHub:#9e319a67] - [F] fix file path (dmi3yy) +* [GitHub:#524052e3] - [С] move new file from theme to core (dmi3yy) +* [GitHub:#1af46a1c] - [С] change logos, delete old theme, rename new theme to default (dmi3yy) +* [GitHub:#14d2a8f2] - [F] fix mysql_info (dmi3yy) + + MODX Evolution 1.2.2(Jul 10, 2017) * [GitHub:#99d1b62cd] - [F] fix properties for instal snippet,modules,plugins (dmi3yy) * [GitHub:#e18d5d373] - [F] mm multiplefields for php 7 (dmi3yy) diff --git a/assets/images/modx-logo.png b/assets/images/modx-logo.png index 5f91dced7a..fede6fc5aa 100644 Binary files a/assets/images/modx-logo.png and b/assets/images/modx-logo.png differ diff --git a/assets/modules/docmanager/templates/main.tpl b/assets/modules/docmanager/templates/main.tpl index 637fc0b3b9..5354c52dfe 100644 --- a/assets/modules/docmanager/templates/main.tpl +++ b/assets/modules/docmanager/templates/main.tpl @@ -3,7 +3,6 @@ [+lang.DM_module_title+] - @@ -60,9 +59,11 @@
- +
+ + [+lang.DM_close+] + +
@@ -90,7 +91,7 @@
-

[+lang.DM_other+]

+

[+lang.DM_other+]

[+view.misc+] [+view.changeauthors+] diff --git a/assets/modules/evogallery/js/uploadify/uploadify.php b/assets/modules/evogallery/js/uploadify/uploadify.php new file mode 100644 index 0000000000..7b18f35210 --- /dev/null +++ b/assets/modules/evogallery/js/uploadify/uploadify.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/assets/plugins/updater/lang/english.php b/assets/plugins/updater/lang/english.php new file mode 100644 index 0000000000..11f7b3cc25 --- /dev/null +++ b/assets/plugins/updater/lang/english.php @@ -0,0 +1,25 @@ +config['base_path'] . "assets/plugins/updater/"; +include($plugin_path.'lang/english.php'); +if (file_exists($plugin_path.'lang/' . $modx->config['manager_language'] . '.php')) { + include($plugin_path.'lang/' . $modx->config['manager_language'] . '.php'); +} + +$e = &$modx->Event; +if($e->name == 'OnSiteRefresh'){ + array_map("unlink", glob(MODX_BASE_PATH . 'assets/cache/updater/*.json')); +} + + +if($e->name == 'OnManagerWelcomeHome'){ + $errorsMessage = ''; + $errors = 0; + if (!extension_loaded('curl')){ + $errorsMessage .= '-'.$_lang['error_curl'].'
'; + $errors += 1; + } + if (!extension_loaded('zip')){ + $errorsMessage .= '-'.$_lang['error_zip'].'
'; + $errors += 1; + } + if (!extension_loaded('openssl')){ + $errorsMessage .= '-'.$_lang['error_openssl'].'
'; + $errors += 1; + } + if (!is_writable(MODX_BASE_PATH.'assets/')){ + $errorsMessage .= '-'.$_lang['error_overwrite'].'
'; + $errors += 1; + } + + $output = ''; + if(!file_exists(MODX_BASE_PATH . 'assets/cache/updater/check_'.date("d").'.json')){ + $ch = curl_init(); + $url = 'https://api.github.com/repos/'.$version.'/'.$type; + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($ch, CURLOPT_HEADER, false); + //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_REFERER, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: updateNotify widget')); + $info = curl_exec($ch); + curl_close($ch); + if (substr($info,0,1) != '[') return; + $info = json_decode($info,true); + $git['version'] = $info[0]['name']; + //$git['date'] = strtotime($info[0]['commit']['author']['date']); + file_put_contents(MODX_BASE_PATH . 'assets/cache/updater/check_'.date("d").'.json', json_encode($git)); + }else{ + $git = file_get_contents( MODX_BASE_PATH . 'assets/cache/updater/check_'.date("d").'.json'); + $git = json_decode($git, true); + } + + $currentVersion = $modx->getVersionData(); + + $_SESSION['updatelink'] = md5(time()); + $_SESSION['updateversion'] = $git['version']; + if ($git['version'] != $currentVersion['version'] && $git['version'] != '') { + // get manager role + $role = $_SESSION['mgrRole']; + if(($role!=1) AND ($showButton == 'AdminOnly') OR ($showButton == 'hide') OR ($errors > 0)) { + $updateButton = ''; + } else { + $updateButton = ''.$_lang['updateButton_txt'].' '.$git['version'].'

'; + } + + + $output = '
'.$_lang['cms_outdated_msg'].' '.$git['version'].'

+ '.$updateButton.' + '.$_lang['bkp_before_msg'].' + '.$errorsMessage.'
'; + + $widgets['updater'] = array( + 'menuindex' =>'1', + 'id' => 'updater', + 'cols' => 'col-sm-12', + 'icon' => 'fa-exclamation-triangle', + 'title' => $_lang['system_update'], + 'body' => $output + ); + $e->output(serialize($widgets)); + + } +} +if($e->name == 'OnPageNotFound'){ + + switch($_GET['q']){ + case $_SESSION['updatelink']: + $currentVersion = $modx->getVersionData(); + if ($_SESSION['updateversion'] != $currentVersion['version']) { + + file_put_contents(MODX_BASE_PATH.'update.php', 'errors[] = array("ERROR:Download", $e->getMessage()); + return false; + } + if ($file) { + fclose($file); + } + + if ($newf) { + fclose($newf); + } + + return true; +} + +function removeFolder($path) +{ + $dir = realpath($path); + if (!is_dir($dir)) { + return; + } + + $it = new RecursiveDirectoryIterator($dir); + $files = new RecursiveIteratorIterator($it, + RecursiveIteratorIterator::CHILD_FIRST); + foreach ($files as $file) { + if ($file->getFilename() === "." || $file->getFilename() === "..") { + continue; + } + if ($file->isDir()) { + rmdir($file->getRealPath()); + } else { + unlink($file->getRealPath()); + } + } + rmdir($dir); +} + +function copyFolder($src, $dest) +{ + $path = realpath($src); + $dest = realpath($dest); + $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); + foreach ($objects as $name => $object) { + + $startsAt = substr(dirname($name), strlen($path)); + mmkDir($dest . $startsAt); + if ($object->isDir()) { + mmkDir($dest . substr($name, strlen($path))); + } + + if (is_writable($dest . $startsAt) and $object->isFile()) { + copy((string) $name, $dest . $startsAt . DIRECTORY_SEPARATOR . basename($name)); + } + } +} + +function mmkDir($folder, $perm = 0777) +{ + if (!is_dir($folder)) { + mkdir($folder, $perm); + } +} + +$version = "evolution-cms/evolution"; + +downloadFile("https://github.com/".$version."/archive/" . $_GET["version"] . ".zip", "evo.zip"); +$zip = new ZipArchive; +$res = $zip->open(dirname(__FILE__) . "/evo.zip"); +$zip->extractTo(dirname(__FILE__) . "/temp"); +$zip->close(); + +if ($handle = opendir(dirname(__FILE__) . "/temp")) { + while (false !== ($name = readdir($handle))) { + if ($name != "." && $name != "..") { + $dir = $name; + } + } + closedir($handle); +} +removeFolder(dirname(__FILE__) . "/temp/" . $dir . "/install/assets/chunks"); +removeFolder(dirname(__FILE__) . "/temp/" . $dir . "/install/assets/tvs"); +removeFolder(dirname(__FILE__) . "/temp/" . $dir . "/install/assets/templates"); +unlink(dirname(__FILE__) . "/temp/" . $dir . "/.htaccess"); +unlink(dirname(__FILE__) . "/temp/" . $dir . "/ht.access"); +unlink(dirname(__FILE__) . "/temp/" . $dir . "/robots.txt"); + +if(is_file(dirname(__FILE__) . "/assets/cache/siteManager.php")){ + + unlink(dirname(__FILE__) . "/temp/" . $dir . "/assets/cache/siteManager.php"); + include_once(dirname(__FILE__) . "/assets/cache/siteManager.php"); + if(!defined("MGR_DIR")){ define("MGR_DIR","manager"); } + if(MGR_DIR != "manager"){ + mmkDir(dirname(__FILE__)."/temp/".$dir."/".MGR_DIR); + copyFolder(dirname(__FILE__)."/temp/".$dir."/manager", dirname(__FILE__)."/temp/".$dir."/".MGR_DIR); + removeFolder(dirname(__FILE__)."/temp/".$dir."/manager"); + } + echo dirname(__FILE__)."/temp/".$dir."/".MGR_DIR; +} +copyFolder(dirname(__FILE__)."/temp/".$dir, dirname(__FILE__)."/"); +removeFolder(dirname(__FILE__)."/temp"); +unlink(dirname(__FILE__)."/evo.zip"); +unlink(dirname(__FILE__)."/update.php"); +header("Location: /install/index.php?action=mode");'); + + + echo ' + Evo Updater + + '; + } + die(); + break; + } + +} diff --git a/assets/snippets/DocLister/core/controller/onetable.php b/assets/snippets/DocLister/core/controller/onetable.php index 987820a8a7..e25e0b1900 100644 --- a/assets/snippets/DocLister/core/controller/onetable.php +++ b/assets/snippets/DocLister/core/controller/onetable.php @@ -98,10 +98,15 @@ public function _render($tpl = '') "dl") . '.iteration'] = $i; //[+iteration+] - Number element. Starting from zero $date = $this->getCFGDef('dateSource', 'pub_date'); - $date = isset($item[$date]) ? $item[$date] + $this->modx->config['server_offset_time'] : ''; - if ($date != '' && $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M') != '') { - $item[$this->getCFGDef("sysKey", "dl") . '.date'] = strftime($this->getCFGDef('dateFormat', - '%d.%b.%y %H:%M'), $date); + if (isset($item[$date])) { + $_date = is_numeric($item[$date]) && $item[$date] == (int)$item[$date] ? $item[$date] : strtotime($item[$date]); + if ($_date !== false) { + $_date = $_date + $this->modx->config['server_offset_time']; + $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); + if ($dateFormat) { + $item['date'] = strftime($dateFormat, $_date); + } + } } $findTpl = $this->renderTPL; @@ -163,18 +168,24 @@ public function getJSON($data, $fields, $array = array()) */ $extE = $this->getExtender('e', true, true); - foreach ($data as $num => $item) { - $row = $item; + foreach ($data as $num => $row) { switch (true) { case ((array('1') == $fields || in_array('summary', $fields)) && $extSummary): - $row['summary'] = $this->getSummary($this->_docs[$num], $extSummary, 'introtext'); + $row['summary'] = $this->getSummary($row, $extSummary, 'introtext'); //without break case ((array('1') == $fields || in_array('date', $fields)) && $date != 'date'): - $tmp = (isset($this->_docs[$num][$date]) && $date != 'createdon' && $this->_docs[$num][$date] != 0 && $this->_docs[$num][$date] == (int)$this->_docs[$num][$date]) ? $this->_docs[$num][$date] : $this->_docs[$num]['createdon']; - $row['date'] = strftime($this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'), - $tmp + $this->modx->config['server_offset_time']); - // no break + if (isset($row[$date])) { + $_date = is_numeric($row[$date]) && $row[$date] == (int)$row[$date] ? $row[$date] : strtotime($row[$date]); + if ($_date !== false) { + $_date = $_date + $this->modx->config['server_offset_time']; + $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); + if ($dateFormat) { + $row['date'] = strftime($dateFormat, $_date); + } + } + } + //nobreak } if ($extE && $tmp = $extE->init($this, array('data' => $row))) { diff --git a/assets/snippets/DocLister/core/controller/shopkeeper.php b/assets/snippets/DocLister/core/controller/shopkeeper.php index db87d95b78..5b1d984426 100644 --- a/assets/snippets/DocLister/core/controller/shopkeeper.php +++ b/assets/snippets/DocLister/core/controller/shopkeeper.php @@ -203,7 +203,7 @@ public function getChildrenCount() if (trim($where) == 'WHERE') { $where = ''; } - $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); + $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); $sort = $this->SortOrderSQL("c.createdon"); list($from) = $this->injectSortByTV($from, $sort); @@ -251,7 +251,7 @@ protected function getDocList() $fields = $this->getCFGDef('selectFields', 'c.*'); - $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); + $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); $sort = $this->SortOrderSQL("c.createdon"); list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], $sort); @@ -363,7 +363,7 @@ protected function getChildrenList() $where = ''; } $fields = $this->getCFGDef('selectFields', 'c.*'); - $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); + $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { $sql = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . $group . " " . diff --git a/assets/snippets/DocLister/core/controller/site_content.php b/assets/snippets/DocLister/core/controller/site_content.php index e628c242b9..e90a288a22 100644 --- a/assets/snippets/DocLister/core/controller/site_content.php +++ b/assets/snippets/DocLister/core/controller/site_content.php @@ -149,11 +149,15 @@ public function _render($tpl = '') } if (isset($item[$date])) { + if (!$item[$date] && $date == 'pub_date' && isset($item['createdon'])) { + $date = 'createdon'; + } $_date = is_numeric($item[$date]) && $item[$date] == (int)$item[$date] ? $item[$date] : strtotime($item[$date]); if ($_date !== false) { $_date = $_date + $this->modx->config['server_offset_time']; - if ($this->getCFGDef('dateFormat', '%d.%b.%y %H:%M') != '') { - $item['date'] = strftime($this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'), $_date); + $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); + if ($dateFormat) { + $item['date'] = strftime($dateFormat, $_date); } } } @@ -205,7 +209,6 @@ public function getJSON($data, $fields, $array = array()) $out = array(); $fields = is_array($fields) ? $fields : explode(",", $fields); $date = $this->getCFGDef('dateSource', 'pub_date'); - /** * @var $extSummary summary_DL_Extender */ @@ -221,22 +224,27 @@ public function getJSON($data, $fields, $array = array()) */ $extE = $this->getExtender('e', true, true); - foreach ($data as $num => $item) { - $row = $item; + foreach ($data as $num => $row) { if ((array('1') == $fields || in_array('summary', $fields)) && $extSummary) { - $row['summary'] = $this->getSummary($this->_docs[$num], $extSummary, 'introtext', 'content'); + $row['summary'] = $this->getSummary($row, $extSummary, 'introtext', 'content'); } + if (array('1') == $fields || in_array('date', $fields)) { - if (isset($this->_docs[$num][$date])) { - $_date = is_numeric($this->_docs[$num][$date]) && $this->_docs[$num][$date] == (int)$this->_docs[$num][$date] ? $this->_docs[$num][$date] : strtotime($this->_docs[$num][$date]); + if (isset($row[$date])) { + if (!$row[$date] && $date == 'pub_date' && isset($row['createdon'])) { + $date = 'createdon'; + } + $_date = is_numeric($row[$date]) && $row[$date] == (int)$row[$date] ? $row[$date] : strtotime($row[$date]); if ($_date !== false) { $_date = $_date + $this->modx->config['server_offset_time']; - if ($this->getCFGDef('dateFormat', '%d.%b.%y %H:%M') != '') { - $row['date'] = strftime($this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'), $_date); + $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); + if ($dateFormat) { + $row['date'] = strftime($dateFormat, $_date); } } } } + if (array('1') == $fields || in_array(array('menutitle', 'pagetitle'), $fields)) { $row['title'] = ($row['menutitle'] == '' ? $row['pagetitle'] : $row['menutitle']); } @@ -340,11 +348,11 @@ public function getChildrenCount() if (trim($where) == 'WHERE') { $where = ''; } - $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); + $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); $sort = $this->SortOrderSQL("if(c.pub_date=0,c.createdon,c.pub_date)"); list($from) = $this->injectSortByTV($from, $sort); - $q_true = $q_true ? $q_true : $group != 'GROUP BY c.id'; + $q_true = $q_true ? $q_true : $group != ''; if ( $q_true ){ $rs = $this->dbQuery("SELECT count(*) FROM (SELECT count(*) FROM {$from} {$where} {$group}) as `tmp`"); @@ -395,7 +403,7 @@ protected function getDocList() $fields = $this->getCFGDef('selectFields', 'c.*'); - $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); + $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); $sort = $this->SortOrderSQL("if(c.pub_date=0,c.createdon,c.pub_date)"); list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], $sort); @@ -520,7 +528,7 @@ protected function getChildrenList() $where = ''; } $fields = $this->getCFGDef('selectFields', 'c.*'); - $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id')); + $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { $sql = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . diff --git a/assets/snippets/DocLister/core/controller/site_content_menu.php b/assets/snippets/DocLister/core/controller/site_content_menu.php new file mode 100644 index 0000000000..507d4c5ef2 --- /dev/null +++ b/assets/snippets/DocLister/core/controller/site_content_menu.php @@ -0,0 +1,549 @@ +, kabachello + */ +class site_content_menuDocLister extends site_contentDocLister +{ + public $levels = array(); + protected $currentLevel = 1; + protected $docTvs = array(); + protected $IDs = array(); + protected $activeBranch = array(); + protected $countChildren = array(); + + /** + * Очистка массива $IDs по которому потом будет производиться выборка документов + * + * @param mixed $IDs список id документов по которым необходима выборка + * @return array очищенный массив + */ + public function setIDs($IDs) + { + $this->debug->debug('set ID list ' . $this->debug->dumpData($IDs), 'setIDs', 2); + $IDs = $this->cleanIDs($IDs); + $this->debug->debugEnd("setIDs"); + + return ($this->IDs = $IDs); + } + + /** + * @param string $tvlist + * @return array + */ + public function getDocs($tvlist = '') + { + $maxDepth = $this->getCFGDef('maxDepth', 10); + //TODO кэширование + if ($this->getCFGDef('hideSubMenus', 0) && empty($this->getCFGDef('openIds'))) { + $maxDepth = $this->setActiveBranch($this->getHereId()); + } else { + $this->setActiveBranch($this->getHereId()); + } + if ($oIds = $this->getCFGDef('openIds')) { + $maxDepth = 1; + $oIds = $this->cleanIDs($oIds); + $oIds[] = $this->getHereId(); + foreach ($oIds as $id) { + if (($c = $this->setActiveBranch($id)) > $maxDepth) { + $maxDepth = $c; + } + } + $this->config->setConfig(array('hideSubMenus' => 1)); + } + $currentLevel = &$this->currentLevel; + $currentLevel = 1; + if ($this->getCFGDef('showParent', 0) && in_array(0, $this->IDs)) { + $this->config->setConfig(array('showParent' => 0)); + } + if ($this->getCFGDef('showParent', 0)) { + $orderBy = $this->getCFGDef('orderBy'); + $docs = $this->getDocList(); + $this->config->setConfig(array('orderBy' => $orderBy)); + $this->levels[$currentLevel++] = $docs; + $this->IDs = $ids = array_keys($docs); + $this->config->setConfig(array('showParent' => 0)); + } + while ($currentLevel <= $maxDepth) { + $orderBy = $this->getCFGDef('orderBy'); + $docs = $this->getChildrenList(); + $this->config->setConfig(array('orderBy' => $orderBy)); + if (empty($docs)) { + break; + } + $this->levels[$currentLevel++] = $docs; + $this->IDs = array_keys($docs); + } + + if ($tvlist == '') { + $tvlist = $this->getCFGDef('tvList', ''); + } + + if ($tvlist != '') { + $this->extTV->getAllTV_Name(); + $ids = array(); + foreach ($this->levels as $level => $docs) { + $ids = array_merge($ids, array_keys($docs)); + } + if ($ids) { + $tv = $this->extTV->getTVList($ids, $tvlist); + if (!is_array($tv)) { + $tv = array(); + } + $this->docTvs = $tv; + } + + } + if ($this->getCFGDef('countChildren', 0)) { + $this->countChildren(); + } + + return $this->levels; + } + + /** + * Список активных документов + * @param $id + * @param int $maxDepth + */ + public function setActiveBranch($id, $maxDepth = 10) + { + $ids = array_values($this->modx->getParentIds($id, $maxDepth)); + $ids[] = $id; + $ids[] = 0; + $this->activeBranch = array_merge($this->activeBranch, $ids); + $this->activeBranch = array_keys(array_flip($this->activeBranch)); + + return count($ids); + } + + /** + * Подсчет количества непосредственных дочерних документов + */ + public function countChildren() + { + $ids = array(); + $out = &$this->countChildren; + foreach ($this->levels as $level => $docs) { + $ids = array_merge($ids, array_keys($docs)); + } + $maxDepth = count($this->levels); + $currentDepth = 1; + while ($currentDepth <= $maxDepth) { + $_ids = implode(',', $ids); + if (empty($_ids)) { + break; + } + $q = $this->dbQuery("SELECT `parent`,COUNT(*) as `count` FROM {$this->getTable('site_content')} WHERE `parent` IN ({$_ids}) AND `published`=1 AND `deleted`=0 GROUP BY `parent`"); + $_ids = array(); + while ($row = $this->modx->db->getRow($q)) { + $_ids[] = $row['parent']; + $out[$row['parent']] = $row['count']; + } + if ($_ids) { + $ids = $this->diff($ids, $_ids); + } else { + break; + } + $currentDepth++; + } + } + + /** + * Возвращает элементы массива $a, которых нет в массиве $b + * @param $b + * @param $a + * @return array + */ + private function diff($b, $a) + { + $at = array_flip($a); + $d = array(); + foreach ($b as $i) { + if (!isset($at[$i])) { + $d[] = $i; + } + } + + return $d; + } + + + /** + * Подготовка результатов к отображению в соответствии с настройками + * + * @param string $tpl шаблон + * @return string + */ + public function render($tpl = '') + { + $this->debug->debug(array('Render data with template ' => $tpl), 'render', 2, array('html')); + $out = $this->_render($tpl); + + if ($out) { + $this->outData = DLTemplate::getInstance($this->modx)->parseDocumentSource($out); + } + $this->debug->debugEnd('render'); + + return $this->outData; + } + + /** + * @param string $tpl + * @return string + */ + public function _render($tpl = '') + { + $currentLevel = &$this->currentLevel; + $currentLevel = count($this->levels); + $docs = $this->levels; + /** @var prepare_DL_Extender_ $extPrepare */ + $extPrepare = $this->getExtender('prepare'); + + while ($currentLevel > 0) { + foreach ($docs[$currentLevel] as $id => &$data) { + if ($out = $this->prepareData($data)) { + if (is_array($out)) { + $data = $out; + } + }; + + if (!isset($data['maxLevel'])) { + $data['maxLevel'] = 1; + $docs[$currentLevel - 1][$data[$this->parentField]]['maxLevel'] = 0; + } + + if (isset($data['here']) || isset($data['active'])) { + $docs[$currentLevel - 1][$data[$this->parentField]]['active'] = 1; + } + + if ($extPrepare) { + $data = $extPrepare->init($this, array( + 'data' => $data, + 'nameParam' => 'prepare' + )); + if (is_bool($data) && $data === false) { + continue; + } + } + + if (isset($data['wrap'])) { + $data['wrap'] = is_array($data['wrap']) ? $this->parseRow($data['wrap']) : $data['wrap']; + $data['wrap'] = $this->parseOuter($data); + } + $hideSubMenus = $this->getCFGDef('hideSubMenus', 0); + $hideSubMenus = !$hideSubMenus || ($hideSubMenus && in_array((int)$data[$this->parentField], + $this->activeBranch)); + if ($hideSubMenus) { + $docs[$currentLevel - 1][$data[$this->parentField]]['wrap'][] = $data; + } + } + unset($docs[$currentLevel]); + $currentLevel--; + } + unset($data); + $out = ''; + $joinMenus = $this->getCFGDef('joinMenus',0) && !$this->getCFGDef('showParents',0); + foreach ($docs[0] as $id => $data) { + if (isset($data['wrap'])) { + if ($joinMenus) { + $out .= $this->parseRow($data['wrap']); + } else { + $data['wrap'] = $this->parseRow($data['wrap']); + $out .= $this->parseOuter($data); + } + } + } + if ($joinMenus) $out = $this->parseOuter(array('wrap'=>$out)); + + return $out; + } + + /** + * Добавление виртуальных плейсхолдеров + * @param $data + * @return array + */ + public function prepareData($data) + { + /** + * @var e_DL_Extender $extE + */ + $extE = $this->getExtender('e', true, true); + $id = $data['id']; + if (isset($this->docTvs[$id])) { + $data = array_merge($data, $this->docTvs[$id]); + } + if ($id == $this->getHereId()) { + $data['here'] = 1; + } + if (in_array($id,$this->activeBranch)) { + $data['active'] = 1; + } + if ($this->getCFGDef('hideSubMenus') && isset($data['isfolder']) && $data['isfolder']) { + $data['state'] = in_array($data['id'], $this->activeBranch) ? 'open' : 'closed'; + } + + $titleField = $this->getCFGDef('titleField', 'title'); + $data[$titleField] = isset($data['menutitle']) && !empty($data['menutitle']) ? $data['menutitle'] : $data['pagetitle']; + $data['level'] = $this->currentLevel; + $data['url'] = $this->makeUrl($data); + if ($this->getCFGDef('countChildren', 1)) { + $data['count'] = isset($this->countChildren[$data['id']]) ? $this->countChildren[$data['id']] : 0; + } + + if ($out = $extE->init($this, compact('data'))) { + if (is_array($out)) { + $data = $out; + } + } + + return $data; + } + + /** + * Вывод обертки блока меню + * @param array $data + * @return string + */ + public function parseOuter($data = array()) + { + $tpl = $this->getCFGDef('outerTpl', '@CODE:[+wrap+]'); + $classes = ''; + $classNames = $this->getCFGDef('outerClass'); + if ($this->currentLevel >= 1) { + $tpl = $this->getCFGDef('innerTpl', $tpl); + $classNames = $this->getCFGDef('innerClass'); + } + if ($classNames) { + $classes = " class=\"{$classNames}\""; + } + $tpl = isset($data['_renderOuterTpl']) ? $data['_renderOuterTpl'] : $tpl; + $out = $this->parseChunk($tpl, + array_merge($data, + array('classes' => $classes, 'classNames' => $classNames))); + + return $out; + } + + /** + * Вывод пункта меню + * @param array $data + * @return string + */ + public function parseRow($data = array()) + { + $out = ''; + $maxIteration = count($data) - 1; + foreach ($data as $iteration => $item) { + $item['iteration'] = $iteration + 1; + if ($iteration == 0) { + $item['first'] = 1; + } + if ($iteration == $maxIteration) { + $item['last'] = 1; + } + $tpl = isset($item['_renderRowTpl']) ? $item['_renderRowTpl'] : $this->getRowTemplate($item); + $item = array_merge($item, $this->getClasses($item)); + $out .= $this->parseChunk($tpl, $item); + } + + return $out; + } + + /** + * Формирование ссылки на документ + * @param array $data + * @return string + */ + protected function makeUrl($data = array()) + { + $out = ''; + if ($this->getCFGDef('makeUrl', 1)) { + if (isset($data['type']) && $data['type'] == 'reference' && isset($data['content'])) { + $out = is_numeric($data['content']) ? $this->modx->makeUrl($data['content'], '', '', + $this->getCFGDef('urlScheme', '')) : $data['content']; + } else { + $out = isset($data['id']) && is_numeric($data['id']) ? $this->modx->makeUrl($data['id'], '', '', + $this->getCFGDef('urlScheme', '')) : ''; + } + } + + return $out; + } + + /** + * Вовзращает id текущего документа + * @return int + */ + public function getHereId() + { + if (!$hereId = (int)$this->getCFGDef('hereId')) { + $hereId = isset($this->modx->documentIdentifier) ? (int)$this->modx->documentIdentifier : 0; + } + + return $hereId; + } + + /** + * Задание классов пункту меню + * @param array $data + * @return array + */ + protected function getClasses($data = array()) + { + $classes = isset($data['classes']) ? $data['classes'] : array( + 'rowClass' => '', + 'firstClass' => '', + 'lastClass' => '', + 'levelClass' => '', + 'webLinkClass' => '', + 'parentClass' => '', + 'hereClass' => '', + 'activeClass' => '', + 'oddClass' => '', + 'evenClass' => '' + ); + if (isset($data['state'])) { + $classes['stateClass'] = $this->getCFGDef($data['state'] . 'Class', $data['state']); + } + if (isset($data['here'])) { + $classes['hereClass'] = $this->getCFGDef('hereClass', 'current'); + } + if (isset($data['active'])) { + $classes['activeClass'] = $this->getCFGDef('activeClass', 'active'); + } + $classes['rowClass'] = $this->getCFGDef('rowClass'); + if ($data['iteration'] % 2 == 1) { + $classes['oddClass'] = $this->getCFGDef('oddClass', 'odd'); + } else { + $classes['evenClass'] = $this->getCFGDef('evenClass', 'even'); + } + if (isset($data['first'])) { + $classes['firstClass'] = $this->getCFGDef('firstClass', 'first'); + } + if (isset($data['last'])) { + $classes['lastClass'] = $this->getCFGDef('lastClass', 'last'); + } + if ($levelClass = $this->getCFGDef('levelClass', 'level')) { + $classes['levelClass'] = $levelClass . $data['level']; + } + if (isset($data['type']) && $data['type'] == 'reference') { + $classes['webLinkClass'] = $this->getCFGDef('webLinkClass'); + } + if (!empty($data['wrap'])) { + $classes['parentClass'] = $this->getCFGDef('parentClass'); + } + $classNames = implode(' ', array_filter(array_values($classes))); + $classes['classNames'] = $classNames; + $classes['classes'] = " class=\"{$classNames}\""; + + return $classes; + } + + /** + * Вывод пункта меню + * @param array $data + * @return string + */ + protected function getRowTemplate($data = array()) + { + $tpl = $this->getCFGDef('rowTpl', '@CODE:[+title+]'); + if ($data['wrap']) { + $tpl = $this->getCFGDef('parentRowTpl', + '@CODE:[+title+][+wrap+]'); + if ((isset($data['template']) && !$data['template']) || (isset($data['link_attributes']) && strpos($data['link_attributes'], + 'category') !== false) + ) { + $tpl = $this->getCFGDef('categoryFolderTpl', $tpl); + } elseif ($data['here']) { + $tpl = $this->getCFGDef('parentRowHereTpl', $tpl); + } elseif ($data['active']) { + $tpl = $this->getCFGDef('parentRowActiveTpl', $tpl); + } + } elseif ($data['level'] > 1) { + $tpl = $this->getCFGDef('innerRowTpl', $tpl); + if ($data['here']) { + $tpl = $this->getCFGDef('innerRowHereTpl', $tpl); + } + } else { + if ($data['here']) { + $tpl = $this->getCFGDef('rowHereTpl', $tpl); + } + } + + return $tpl; + } + + /** + * @param array $data + * @param mixed $fields + * @param array $array + * @return string + */ + public function getJSON($data, $fields, $array = array()) + { + $currentLevel = &$this->currentLevel; + $currentLevel = count($this->levels); + $docs = $this->levels; + /** @var prepare_DL_Extender_ $extPrepare */ + $extPrepare = $this->getExtender('prepare'); + + while ($currentLevel > 0) { + foreach ($docs[$currentLevel] as $id => &$data) { + if ($out = $this->prepareData($data)) { + if (is_array($out)) { + $data = $out; + } + }; + + if (isset($data['here']) || isset($data['active'])) { + $docs[$currentLevel - 1][$data[$this->parentField]]['active'] = 1; + } + + if ($extPrepare) { + $data = $extPrepare->init($this, array( + 'data' => $data, + 'nameParam' => 'prepare' + )); + if (is_bool($data) && $data === false) { + continue; + } + } + + $hideSubMenus = $this->getCFGDef('hideSubMenus', 0); + $hideSubMenus = !$hideSubMenus || ($hideSubMenus && in_array((int)$data[$this->parentField], + $this->activeBranch)); + if ($hideSubMenus) { + $docs[$currentLevel - 1][$data[$this->parentField]]['children'][] = $data; + } + } + unset($docs[$currentLevel]); + $currentLevel--; + } + unset($data); + + $out = $docs[0][0]['children']; + unset($docs); + + return json_encode($out, JSON_UNESCAPED_UNICODE); + } + + /** + * Получение информации из конфига с учетом уровня меню + * + * @param string $name имя параметра в конфиге + * @param mixed $def значение по умолчанию, если в конфиге нет искомого параметра + * @return mixed значение из конфига + */ + public function getCFGDef($name, $def = null) + { + return parent::getCFGDef($name . $this->currentLevel, parent::getCFGDef($name, $def)); + } +} diff --git a/assets/snippets/DocLister/snippet.DLMenu.php b/assets/snippets/DocLister/snippet.DLMenu.php new file mode 100644 index 0000000000..44ce0417a1 --- /dev/null +++ b/assets/snippets/DocLister/snippet.DLMenu.php @@ -0,0 +1,8 @@ +runSnippet('DocLister',$params); + diff --git a/assets/snippets/FormLister/core/FormLister.abstract.php b/assets/snippets/FormLister/core/FormLister.abstract.php index 01ef022b74..96d7c872ff 100644 --- a/assets/snippets/FormLister/core/FormLister.abstract.php +++ b/assets/snippets/FormLister/core/FormLister.abstract.php @@ -993,7 +993,10 @@ public function redirect($param = 'redirectTo', $_query = array()) if ($redirect = $this->getCFGDef($param, 0)) { $redirect = $this->config->loadArray($redirect); $query = $header = ''; - if (isset($redirect[0])) { + if (is_numeric($redirect)) { + $page = $redirect; + $query = http_build_query($_query); + } elseif (isset($redirect[0])) { $page = $redirect[0]; $query = http_build_query($_query); } else { @@ -1003,7 +1006,7 @@ public function redirect($param = 'redirectTo', $_query = array()) if (isset($redirect['header'])) { $header = $redirect['header']; } - $page = isset($redirect['page']) ? $redirect['page'] : 0; + $page = isset($redirect['page']) ? $redirect['page'] : $this->modx->config['site_start']; } if (is_numeric($page)) { $redirect = $this->modx->makeUrl($page, '', $query, 'full'); diff --git a/assets/snippets/FormLister/docs/history.md b/assets/snippets/FormLister/docs/history.md index 76eb972dfc..c2b10f7a60 100644 --- a/assets/snippets/FormLister/docs/history.md +++ b/assets/snippets/FormLister/docs/history.md @@ -1,4 +1,8 @@ ## History +### 1.7.3 +* [Refactor] Подключать __autoload.php, если не задан другой загрузчик. +* [Fix] Ошибка в обработке параметра редиректа (Core). + ### 1.7.2 * [Enhancement] Параметр &context в контроллере Login для поддержки модели modManagers (Login). * [Fix] Ошибка в обработке параметра редиректа (Core). diff --git "a/assets/snippets/FormLister/docs/ru/040_\320\222\321\213\320\262\320\276\320\264 \320\264\320\260\320\275\320\275\321\213\321\205.md" "b/assets/snippets/FormLister/docs/ru/040_\320\222\321\213\320\262\320\276\320\264 \320\264\320\260\320\275\320\275\321\213\321\205.md" index f34644afbf..8dc1af8cf9 100644 --- "a/assets/snippets/FormLister/docs/ru/040_\320\222\321\213\320\262\320\276\320\264 \320\264\320\260\320\275\320\275\321\213\321\205.md" +++ "b/assets/snippets/FormLister/docs/ru/040_\320\222\321\213\320\262\320\276\320\264 \320\264\320\260\320\275\320\275\321\213\321\205.md" @@ -32,6 +32,8 @@ Вывод сообщений обработчика: [+form.messages+] +В плейсхолдер [+form.messages+] могут выводиться три типа сообщений: нарушения правила required, нарушения остальных правил, произвольные сообщения, которые задаются методом addMessage. По умолчанию выводятся только последние, см. описание параметра messagesTpl. + Вывод значений из лексиконов: [%ключ лексикона%] diff --git "a/assets/snippets/FormLister/docs/ru/060_\320\220\320\262\321\202\320\276\321\200\320\270\320\267\320\260\321\206\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\320\265\320\271.md" "b/assets/snippets/FormLister/docs/ru/060_\320\220\320\262\321\202\320\276\321\200\320\270\320\267\320\260\321\206\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\320\265\320\271.md" new file mode 100644 index 0000000000..841e652207 --- /dev/null +++ "b/assets/snippets/FormLister/docs/ru/060_\320\220\320\262\321\202\320\276\321\200\320\270\320\267\320\260\321\206\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\320\265\320\271.md" @@ -0,0 +1,117 @@ +## Авторизация пользователей + +Контроллер Login позволяет авторизировать пользователей как по имени, так и по email. Кроме этого, можно дополнительно использовать плагин userHelper, который ведет учет количества логинов и времени последнего логина, а также реализует автологин и выход из учетной записи. + +## Параметры контроллера + +### model +Класс для работы с пользователями. + +Возможные значения - имя класса. + +Значение по умолчанию - \modUsers + +### modelPath +Путь к файлу класса для работы с пользователями. + +Возможные значения - относительный путь к файлу. + +Значение по умолчанию - assets/lib/MODxAPI/modUsers.php + +### loginField +Поле, содержащее имя пользователя. + +Возможные значения - имя поля. + +Значение по умолчанию - username. + +### passwordField +Поле, содержащее пароль пользователя. + +Возможные значения - имя поля. + +Значение по умолчанию - password. + +### rememberField +Поле для запоминания пользователя. Если значение поля приводится к true, то при успешной авторизации будет установлена кука с параметрами автологина. Имя куки и ее время жизни задаются параметрами cookieName и cookieLifetime. + +Можно также задать поле rememberme в параметре defaults, чтобы запоминание происходило без участия пользователя: +``` +&defaults=`{"rememberme":1}` +``` + +Возможные значения - имя поля. + +Значение по умолчанию - rememberme. + +### checkActivation +Включает проверку активации учетной записи пользователя (см. "Активация учетных записей"). + +Возможные значения - 0 или 1. + +Значение по умолчанию - 1. + +### context +Контекст авторизации. + +Возможные значения - mgr или web. + +Значение по умолчанию - web. + +### cookieName +Имя куки для хранения параметров автологина. + +Значение по умолчанию - WebLoginPE. + +### cookieLifetime +Время жизни вышеуказанной куки. + +Возможные значения - число секунд с момента последнего логина. + +Значение по умолчанию - 157680000 (5 лет). + +### redirectTo +Перенаправляет пользователя на страницу c указанным id после авторизации. + +Возможные значения - id целевой страницы или массив. + +Значение по умолчанию - пусто. + +### exitTo +Перенаправляет уже авторизованного пользователя на указанную страницу. + +Возможные значения - id целевой страницы или массив. + +Значение по умолчанию - пусто. + +### successTpl +Шаблон сообщения об успешной авторизации. В шаблоне можно использовать данные пользователя. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Login с ключом [+login.default_successTpl+] + +### skipTpl +Шаблон сообщения о том, что пользователь уже авторизован. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Login с ключом [+login.default_skipTpl+] + +## Параметры плагина userHelper +### logoutKey +Имя GET-параметра для запуска выхода из учетной записи. Если в ссылке на страницу сайта указан параметр с соответствующим именем (например, http://sitename.ru/page.html?logout), будет произведен выход из учетной записи. + +Значение по умолчанию - logout. + +### cookieName +Имя куки для хранения параметров автологина. + +Значение по умолчанию - WebLoginPE. + +### cookieLifetime +Время жизни вышеуказанной куки. + +Возможные значения - число секунд с момента последнего логина. + +Значение по умолчанию - 157680000 (5 лет). diff --git "a/assets/snippets/FormLister/docs/ru/070_\320\240\320\265\320\263\320\270\321\201\321\202\321\200\320\260\321\206\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\320\265\320\271.md" "b/assets/snippets/FormLister/docs/ru/070_\320\240\320\265\320\263\320\270\321\201\321\202\321\200\320\260\321\206\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\320\265\320\271.md" new file mode 100644 index 0000000000..58843c8e7a --- /dev/null +++ "b/assets/snippets/FormLister/docs/ru/070_\320\240\320\265\320\263\320\270\321\201\321\202\321\200\320\260\321\206\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\320\265\320\271.md" @@ -0,0 +1,137 @@ +## Регистрация пользователей + +Контроллер Register позволяет регистрировать пользователей в заданные группы и отправлять уведомления о регистрации. Контроллер является расширением контроллера Form, соответственно можно использовать соответствующие параметры для отправки писем при регистрации. + +Имена полей в форме должны соответствовать полям модели [modUsers](http://docs.evolution-cms.com/Extras/Snippets/DocLister/MODxAPI). + +Если в форме не задано поле username, то ему присваивается значение поля email. Таким образом можно регистрировать пользователей только по email. + +Если в форме не задано поле password, то значение поля генерируется автоматически. То есть регистрацию пользователя можно свести к указанию email. + +При регистрации с паролем, в форме может присутствовать поле repeatPassword. Если заданы правила валидации для полей password и repeatPassword, то при наличии для поля repeatPassword правила equals, оно будет автоматически скорректировано для проверки равенства значений полей password и repeatPassword: +``` +"repeatPassword":{ + "required":"Введите пароль еще раз", + "equals":{ + "params" : "Этот ключ в описании правила можно не задавать, он будет сформирован контроллером автоматически", + "message":"Пароли не совпадают" + } +} +``` + +При регистрации следует проверять уникальность имени пользователя и email. В контроллере предусмотрены соответствующие правила: +``` +&rules=`{ + "username":{ + "required":"Введите имя пользователя", + "alphaNumeric":"Только буквы и цифры", + "custom":{ + "function":"\\FormLister\\Register::uniqueUsername", + "message":"Имя уже занято" + } + }, + "email":{ + "required":"Введите email", + "email":"Неверный email", + "custom":{ + "function":"\\FormLister\\Register::uniqueEmail", + "message":"Этот email уже использует другой пользователь" + } + } +}` +``` +В шаблонах доступны все поля модели для созданной записи. Дополнительно задается поле user.password с незашифрованным паролем. + +## Параметры +### model +Класс для работы с пользователями. + +Возможные значения - имя класса. + +Значение по умолчанию - \modUsers + +### modelPath +Путь к файлу класса для работы с пользователями. + +Возможные значения - относительный путь к файлу. + +Значение по умолчанию - assets/lib/MODxAPI/modUsers.php + +### allowedFields +Разрешенные для обработки поля. Поля, не указанные в списке, игнорируются. Поля username, email и password всегда разрешены. + +Если не задано, то разрешены все поля. + +Возможные значения - имена полей формы, разделенные запятой. + +Значение по умолчанию - пусто. + +### forbiddenFields +Запрещенные для обработки поля. Поля, указанные в списке, игнорируются. Поля username, email и password удаляются из списка запрещенных. + +Возможные значения - имена полей формы, разделенные запятой. + +Значение по умолчанию - пусто. + +### userGroups +Добавляет зарегистрированного пользователя в указанные группы. + +Возможные значения - имена групп, разделенные запятой (если имена содержат запятую в названии, то можно задать значение параметра массивом). + +Значение по умолчанию - пусто. + +### checkActivation +Включает проверку активации учетной записи пользователя (см. "Активация учетных записей"). При этом после сохранения записи будет установлено поле activate.url, содержащее ссылку на страницу с вызовом сниппета для активации учетной записи. + +Возможные значения - 1 или 0. + +Значение по умолчанию - 0. + +### activateTo +Если включена проверка активации, то в этом параметре необходимо указать id страницы, на которой вызывается сниппет для активации. + +Возможные значения - id страницы. + +Значение по умолчанию - значение $modx->config['site_start']. + +### preparePostProcess +Позволяет выполнить обработку данных после сохранения. + +Возможные значения - имена сниппетов, анонимные функции, статические методы загруженных классов. + +Значение по умолчанию - пусто. + +### redirectTo +Перенаправляет пользователя на указанную страницу после регистрации. + +Возможные значения - id целевой страницы или массив. + +Значение по умолчанию - пусто. + +### exitTo +Перенаправляет уже авторизованного пользователя на указанную страницу. + +Возможные значения - id целевой страницы. + +Значение по умолчанию - пусто. + +### skipTpl +Шаблон сообщения для уже авторизованного пользователя. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Register с ключом [+register.default_skipTpl+] + +### successTpl +Шаблон сообщения об успешной регистрации. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Register с ключом [+register.default_successTpl+] + +### passwordLength +Длина пароля (если создается автоматически). + +Возможные значения - число символов больше 6. + +Значение по умолчанию - 6. diff --git "a/assets/snippets/FormLister/docs/ru/075_\320\220\320\272\321\202\320\270\320\262\320\260\321\206\320\270\321\217 \321\203\321\207\320\265\321\202\320\275\321\213\321\205 \320\267\320\260\320\277\320\270\321\201\320\265\320\271.md" "b/assets/snippets/FormLister/docs/ru/075_\320\220\320\272\321\202\320\270\320\262\320\260\321\206\320\270\321\217 \321\203\321\207\320\265\321\202\320\275\321\213\321\205 \320\267\320\260\320\277\320\270\321\201\320\265\320\271.md" new file mode 100644 index 0000000000..ce0f37925c --- /dev/null +++ "b/assets/snippets/FormLister/docs/ru/075_\320\220\320\272\321\202\320\270\320\262\320\260\321\206\320\270\321\217 \321\203\321\207\320\265\321\202\320\275\321\213\321\205 \320\267\320\260\320\277\320\270\321\201\320\265\320\271.md" @@ -0,0 +1,84 @@ +## Активация учетных записей + +Контроллер Activate реализует активацию учетных записей. Таким образом появляется возможность требовать у пользователя подтверждение учетной записи путем перехода по специальной ссылке из письма, отправленного при регистрации. + +Если по какой-то причине пользователь не получил письмо, то c помощью контроллера Activate он может запросить его повторную отправку. + +Учетная запись пользователя считается неактивированной если в поле logincount записано -1. + +В вызовах сниппета для регистрации и авторизации пользователей должен присутствовать параметр &checkActivation=`1`. + +Поэтому если при регистрации пользователь указывал пароль самостоятельно, то нужно запрашивать пароль для отправки письма со ссылкой для активации. Иначе будет генерироваться новый пароль, потому что раз пользователь запрашивает письмо для активации вручную, значит письмо после регистрации он не получил и не знает созданный при регистрации пароль. + +В шаблонах доступны все поля модели для обрабатываемой записи. В шаблоне reportTpl задается поле user.password с незашифрованным паролем и поле activate.url со ссылкой для активации. + +## Параметры +### model +Класс для работы с пользователями. + +Возможные значения - имя класса. + +Значение по умолчанию - \modUsers + +### modelPath +Путь к файлу класса для работы с пользователями. + +Возможные значения - относительный путь к файлу. + +Значение по умолчанию - assets/lib/MODxAPI/modUsers.php + +### redirectTo +Перенаправляет пользователя на указанную страницу после активации. + +Возможные значения - id целевой страницы или массив. + +Значение по умолчанию - пусто. + +### exitTo +Перенаправляет авторизованного пользователя на указанную страницу. + +Возможные значения - id целевой страницы или массив. + +Значение по умолчанию - пусто. + +### skipTpl +Шаблон сообщения для авторизованного пользователя. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Register с ключом [+register.default_skipTpl+] + +### reportTpl +Шаблон письма с информацией для активации учетной записи. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - пусто. + +### reportTpl +Шаблон письма с информацией для активации учетной записи. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - пусто. + +### successTpl +Шаблон сообщения об успешной отправке письма с данными для активации. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Activate с ключом [+activate.default_successTpl+] + +### activateSuccessTpl +Шаблон сообщения об успешной активации. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Activate с ключом [+activate.default_activateSuccessTpl+] + +### passwordLength +Длина создаваемого пароля. + +Возможные значения - число символов больше 6. + +Значение по умолчанию - 6. diff --git "a/assets/snippets/FormLister/docs/ru/090_\320\222\320\276\321\201\321\201\321\202\320\260\320\275\320\276\320\262\320\273\320\265\320\275\320\270\320\265 \320\277\320\260\321\200\320\276\320\273\320\265\320\271 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\321\217\320\274\320\270.md" "b/assets/snippets/FormLister/docs/ru/090_\320\222\320\276\321\201\321\201\321\202\320\260\320\275\320\276\320\262\320\273\320\265\320\275\320\270\320\265 \320\277\320\260\321\200\320\276\320\273\320\265\320\271 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\321\217\320\274\320\270.md" new file mode 100644 index 0000000000..e9b507dd4f --- /dev/null +++ "b/assets/snippets/FormLister/docs/ru/090_\320\222\320\276\321\201\321\201\321\202\320\260\320\275\320\276\320\262\320\273\320\265\320\275\320\270\320\265 \320\277\320\260\321\200\320\276\320\273\320\265\320\271 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\321\217\320\274\320\270.md" @@ -0,0 +1,143 @@ +## Восстановление паролей пользователями + +Контроллер Reminder позволяет web-пользователям восстанавливать забытые пароли. Расширяет контроллер Form. + +Восстановление паролей происходит по следующей схеме: + +- пользователь вводит в форме свой идентификатор (им может быть имя пользователя или email); +- пользователь получает письмо, в котором содержится ссылка для восстановления; +- при переходе по ссылке пользователь получает возможность ввести новый пароль либо пароль будет сгенерирован автоматически; +- пользователю отправляется письмо с новым паролем и показыается сообщение (в сообщении можно также вывести новый пароль). + +Параметр to перезаписывается значением email пользователя. Обязательно должен быть задан параметр resetTo. + +## Параметры +### model +Класс для работы с пользователями. + +Возможные значения - имя класса. + +Значение по умолчанию - \modUsers + +### modelPath +Путь к файлу класса для работы с пользователями. + +Возможные значения - относительный путь к файлу. + +Значение по умолчанию - assets/lib/MODxAPI/modUsers.php + +### hashField +Имя поля для хранения хэша данных пользователя. + +Значение по умолчанию - hash. + +### userField +Имя поля для хранения идентификатора пользователя (имя пользователя или email). + +Значение по умолчанию - email. + +### uidField +Имя поля, которое используется для идентификации пользователя при переходе по ссылке. + +Значение по умолчанию - id. + +### exitTo +Перенаправляет авторизованного пользователя на указанную страницу. + +Возможные значения - id целевой страницы. + +Значение по умолчанию - пусто. + +### resetTo +Страница, на которую будет указывать ссылка для восстановления паролей. Обязательный параметр. + +Возможные значения - id целевой страницы. + +Значение по умолчанию - id документа, в котором вызван контроллер. + +### redirectTo +Перенаправляет на указанную страницу после успешного восстановления пароля. + +Возможные значения - id целевой страницы. + +Значение по умолчанию - пусто. + +### skipTpl +Шаблон сообщения для авторизованного пользователя. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Reminder с ключом [+reminder.default_skipTpl+]. + +### formTpl +Шаблон формы для ввода идентификатора пользователя. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - пусто. + +### resetTpl +Шаблон формы для ввода нового пароля. Если параметр не задан, то пароль будет сгенерирован автоматически. + +Поля для ввода паролей должны называться password и repeatPassword. В форме должны также присутствовать скрытые поля с именами из параметров uidField и hashField. Значение для поля hashField задается через плейсхолдер [+user.hash+]. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - пусто. + +### successTpl +Шаблон сообщения об успешной отправке письма со ссылкой для восстановления пароля. В шаблоне можно выводить плейсхолдеры с данными пользователя (username, email и т.д.). + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Reminder с ключом [+reminder.default_successTpl+]. + +### resetSuccessTpl +Шаблон сообщения об успешном восстановлении пароля. В шаблоне можно выводить плейсхолдеры с данными пользователя (username, email и т.д.), а также новый пароль (newpassword). + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Reminder с ключом [+reminder.default_resetSuccessTpl+]. + +### reportTpl +Шаблон письма со ссылкой для восстановления пароля. В шаблоне можно выводить плейсхолдеры с данными пользователя (username, email и т.д.), а также новый пароль (newpassword). Ссылка для восстановлени пароля в письме задается через плейсхолдер [+reset.url+] + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - запись из лексикона Reminder с ключом [+reminder.default_reportTpl+].. + +### resetReportTpl +Шаблон письма об успешном восстановлении пароля. В шаблоне можно выводить плейсхолдеры с данными пользователя (username, email и т.д.), а также новый пароль (newpassword). Если не задан, то письмо пользователю отправляться не будет. + +Возможные значения - имя шаблона, указанное по правилам задания шаблонов в DocLister. + +Значение по умолчанию - пусто. + +### rules +Правила валидации для формы идентификации пользователя. + +Возможные значения - см. раздел "Валидация данных". + +Значение по умолчанию - пусто. + +### resetRules +Правила валидации для формы установки нового пароля. Если заданы правила валидации для полей password и repeatPassword, то при наличии для поля repeatPassword правила equals, оно будет автоматически скорректировано для проверки равенства значений полей password и repeatPassword: +``` +"repeatPassword":{ + "required":"Введите пароль еще раз", + "equals":{ + "params" : "Этот ключ в описании правила можно не задавать, он будет сформирован контроллером автоматически", + "message":"Пароли не совпадают" + } +} +``` +Возможные значения - см. раздел "Валидация данных". + +Значение по умолчанию - пусто. + +### passwordLength +Длина пароля (если создается автоматически). + +Возможные значения - число символов больше 6. + +Значение по умолчанию - 6. diff --git a/assets/snippets/FormLister/snippet.FormLister.php b/assets/snippets/FormLister/snippet.FormLister.php index 8bddf6a5f0..622d2b0b5d 100644 --- a/assets/snippets/FormLister/snippet.FormLister.php +++ b/assets/snippets/FormLister/snippet.FormLister.php @@ -12,7 +12,9 @@ $this->modx->logEvent(0, 1, "Parameter &formid is not set", 'FormLister'); return; } -include_once ('__autoload.php'); +if (!class_exists('\FormLister\Core')) { + include_once('__autoload.php'); +} $out = ''; $FLDir = MODX_BASE_PATH . 'assets/snippets/FormLister/'; if (isset($controller)) { diff --git a/assets/snippets/ajaxSearch/HISTORY.md b/assets/snippets/ajaxSearch/HISTORY.md index 45454ec0e8..45a8b1def7 100644 --- a/assets/snippets/ajaxSearch/HISTORY.md +++ b/assets/snippets/ajaxSearch/HISTORY.md @@ -1,4 +1,6 @@ #Changelog: +11-jul-17 (1.11.0) +- Refactor, no more use index-ajax.php 12-apr-16 (1.10.2) diff --git a/assets/snippets/ajaxSearch/README.md b/assets/snippets/ajaxSearch/README.md index d6005c0a70..e0fb1c38a1 100644 --- a/assets/snippets/ajaxSearch/README.md +++ b/assets/snippets/ajaxSearch/README.md @@ -1,4 +1,4 @@ -#AjaxSearch 1.10.2 +#AjaxSearch 1.11.0 Ajax and non-Ajax search that supports results highlighting diff --git a/assets/snippets/ajaxSearch/ajaxSearchPopup.php b/assets/snippets/ajaxSearch/ajaxSearchPopup.php index f5905a075f..5593513be3 100644 --- a/assets/snippets/ajaxSearch/ajaxSearchPopup.php +++ b/assets/snippets/ajaxSearch/ajaxSearchPopup.php @@ -5,7 +5,7 @@ * ajaxSearchPopup.php * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * */ @@ -13,31 +13,34 @@ /*! * getUserConfigName : parse the non default configuration file name from ucfg string */ + + function getUserConfigName($ucfg) { preg_match('/&config=`([^`]*)`/', $ucfg, $matches); return $matches[1]; } +define('MODX_API_MODE', true); +include_once(__DIR__."/../../../index.php"); +$modx->db->connect(); +if (empty ($modx->config)) { + $modx->getSettings(); +} +if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || strpos($_SERVER['HTTP_REFERER'],$modx->config['site_url']) !== 0){ + $modx->sendErrorPage(); +} + if (isset($_POST['search'])) { - define('AS_VERSION', '1.10.2'); + define('AS_VERSION', '1.11.0'); define('AS_SPATH', 'assets/snippets/ajaxSearch/'); define('AS_PATH', MODX_BASE_PATH . AS_SPATH); - require_once (MODX_MANAGER_PATH . 'includes/protect.inc.php'); if (!isset($_POST['as_version']) || (strip_tags($_POST['as_version']) != AS_VERSION)) { $output = "AjaxSearch version obsolete.
Please check the snippet code in MODX manager."; } else { include_once AS_PATH . "classes/ajaxSearch.class.inc.php"; - - define('MODX_API_MODE', true); - include_once (MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php'); - $modx = new DocumentParser; - $modx->db->connect(); - $modx->getSettings(); - startCMSSession(); - $tstart = $modx->getMicroTime(); $default = AS_PATH . 'configs/default.config.php'; if (file_exists($default)) include $default; diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearch.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearch.class.inc.php index fee270cc06..d48255bd5b 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearch.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearch.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearch * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchConfig.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchConfig.class.inc.php index 37a26ecfaa..b96cc95979 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchConfig.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchConfig.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchConfig * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchCtrl.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchCtrl.class.inc.php index c52bc4eda9..1ef778450c 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchCtrl.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchCtrl.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchCtrl * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchInput.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchInput.class.inc.php index 69251e359d..1c2d7480bf 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchInput.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchInput.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchInput * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchLog.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchLog.class.inc.php index 9a49dfe193..7c098ce66b 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchLog.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchLog.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchLog * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: @@ -154,11 +154,15 @@ function updateComment($logid, $ascmt) { if (($ascmt != '') && ($logid > 0) && $safeCmt) { define('MODX_API_MODE', true); - - include_once (MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php'); - $modx = new DocumentParser; + include_once(__DIR__."/../../../../index.php"); $modx->db->connect(); - $modx->getSettings(); + if (empty ($modx->config)) { + $modx->getSettings(); + } + if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || strpos($_SERVER['HTTP_REFERER'],$modx->config['site_url']) !== 0){ + $modx->sendErrorPage(); + } + $asLog = new AjaxSearchLog(); $asLog->updateComment($logid, $ascmt); echo "comment about record " . $logid . " registered"; diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchOutput.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchOutput.class.inc.php index 943d229416..61e7406de9 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchOutput.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchOutput.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchOutput * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchRequest.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchRequest.class.inc.php index 2eb0a613fa..e20bea2b95 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchRequest.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchRequest.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchRequest * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php index 352749f2c5..57466bbd49 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchResults * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchUtil.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchUtil.class.inc.php index 178f1a41c0..2b27c47e6e 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchUtil.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchUtil.class.inc.php @@ -5,7 +5,7 @@ * @package AjaxSearchUtil * * @author Coroico - www.evo.wangba.fr -* @version 1.10.2 +* @version 1.11.0 * @date 12/04/2016 * * Purpose: diff --git a/assets/snippets/ajaxSearch/configs/default.config.php b/assets/snippets/ajaxSearch/configs/default.config.php index dcbf52da0d..1a280a0fde 100644 --- a/assets/snippets/ajaxSearch/configs/default.config.php +++ b/assets/snippets/ajaxSearch/configs/default.config.php @@ -1,9 +1,9 @@ ').appendTo(sf).hide();as['sl']=$(''+_loadAlt+'').appendTo(sf).hide();as['sr']=$('#'+p+'ajaxSearch_output').hide().removeClass('init');as['si']=$('#'+p+'ajaxSearch_input');as['se']=$('#'+p+'ajaxSearch_select');if(!as['lvs'])as['ss']=$('#'+p+'ajaxSearch_form input:submit');as['sc'].click(function(){closeSearch(as);return false;});if(!as['lvs'])as['ss'].click(function(){doSearch(as);return false;});else as['si'].keyup(function(){doLiveSearch(as);});if(as['si'].length)as['si'].keypress(function(e){var keyCode=e.keyCode||e.which;if(keyCode==13){doSearch(as);return false;}});doSearch(as);} function doLiveSearch(as){if(as['lt']){window.clearTimeout(as['lt']);} as['lt']=setTimeout(function(){doSearch(as)},400);} function doSearch(as){if(!as['lvs']&&as['is'])return false;if(as['si'].length)s=as['si'].val();else if(as['se'].length){sl=new Array();as['se'].find('option:selected').each(function(i){sl.push($(this).attr('value'));});s=sl.join(" ");} else s='';if(s==as['bxt'])s='';as['s']=s;if(as['si'].length&&(s.length!=0)&&as['lvs']&&(s.length
').append(html);copy.find('.AS_ajax_result').each(function(){nbrd+=1;});updateNbResDisplayed(nbrd,asr);} function initMoreButtons(grnm,as){if(grnm){var p=as['px'];for(i=0,m=grnm.length;i * @date 12/04/2016 * ----------------------------------------------------------------------------- diff --git a/index.php b/index.php index 7f87015f0a..bbdc63e953 100644 --- a/index.php +++ b/index.php @@ -45,7 +45,7 @@ * ----------------------------- */ -$autoloader = 'vendor/autoload.php'; +$autoloader = __DIR__.'/vendor/autoload.php'; if (file_exists($autoloader) && is_readable($autoloader)) { include_once($autoloader); } diff --git a/install/actions/action_connection.php b/install/actions/action_connection.php index e62dffc05e..ec7d0228c4 100644 --- a/install/actions/action_connection.php +++ b/install/actions/action_connection.php @@ -6,7 +6,7 @@ if ($installMode == 0) { $database_name= ''; $database_server= 'localhost'; - $table_prefix= 'modx_'; + $table_prefix= 'evo_'; } else { $database_name = ''; if (!is_file($base_path.MGR_DIR.'/includes/config.inc.php')) $upgradeable = 0; diff --git a/install/actions/action_summary.php b/install/actions/action_summary.php index 6e59832b54..6d3de9a77b 100644 --- a/install/actions/action_summary.php +++ b/install/actions/action_summary.php @@ -6,7 +6,7 @@ // check PHP version echo "

" . $_lang['checking_php_version']; -$phpMinVersion = "5.3.0"; +$phpMinVersion = "5.4.0"; // -1 if left is less, 0 if equal, +1 if left is higher if (version_compare(phpversion(), $phpMinVersion) < 0) { echo "" . $_lang['failed'] . "" . $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', $phpMinVersion, $_lang["modx_requires_php"]) . "

"; @@ -62,7 +62,7 @@ if (!file_exists("../assets/cache/siteCache.idx.php")) { // make an attempt to create the file @ $hnd = fopen("../assets/cache/siteCache.idx.php", 'w'); - @ fwrite($hnd, ""); + @ fwrite($hnd, ""); @ fclose($hnd); } if (!is_writable("../assets/cache/siteCache.idx.php")) { @@ -115,7 +115,7 @@ if (!is_file("../".MGR_DIR."/includes/config.inc.php")) { // make an attempt to create the file @ $hnd = fopen("../".MGR_DIR."/includes/config.inc.php", 'w'); - @ fwrite($hnd, ""); + @ fwrite($hnd, ""); @ fclose($hnd); } else @chmod("../".MGR_DIR."/includes/config.inc.php", 0666); diff --git a/install/actions/tpl_mode.html b/install/actions/tpl_mode.html index d16fee50ba..dcac5ba2c3 100644 --- a/install/actions/tpl_mode.html +++ b/install/actions/tpl_mode.html @@ -24,7 +24,7 @@

-
advanced MODX upgrade
+
advanced EVO upgrade

diff --git a/install/assets/chunks/mm_rules.tpl b/install/assets/chunks/mm_rules.tpl index a65e438fb7..9c24090097 100644 --- a/install/assets/chunks/mm_rules.tpl +++ b/install/assets/chunks/mm_rules.tpl @@ -24,7 +24,7 @@ mm_moveFieldsToTab('titl,keyw,desc,seoOverride,noIndex,sitemap_changefreq,sitema mm_widget_tags('keyw',','); // Give blog tag editing capabilities to the 'documentTags (3)' TV -//mm_createTab('Изображения', 'photos', '', '', '', '850'); +//mm_createTab('Images', 'photos', '', '', '', '850'); //mm_moveFieldsToTab('images,photos', 'photos', '', ''); //mm_hideFields('longtitle,description,link_attributes,menutitle,content', '', '6,7'); diff --git a/install/assets/modules/store.tpl b/install/assets/modules/store.tpl index 46138d9476..3b2bb5b2e9 100644 --- a/install/assets/modules/store.tpl +++ b/install/assets/modules/store.tpl @@ -2,7 +2,7 @@ /** * Extras * - * first repository for MODX EVO + * first repository for Evolution CMS * * @category module * @version 0.1.3 diff --git a/install/assets/plugins/CodeMirror.tpl b/install/assets/plugins/CodeMirror.tpl index d65b940a52..75e61f48fd 100644 --- a/install/assets/plugins/CodeMirror.tpl +++ b/install/assets/plugins/CodeMirror.tpl @@ -12,7 +12,7 @@ * @internal @modx_category Manager and Admin * @internal @properties &theme=Theme;list;default,ambiance,blackboard,cobalt,eclipse,elegant,erlang-dark,lesser-dark,midnight,monokai,neat,night,one-dark,rubyblue,solarized,twilight,vibrant-ink,xq-dark,xq-light;default &darktheme=Dark Theme;list;default,ambiance,blackboard,cobalt,eclipse,elegant,erlang-dark,lesser-dark,midnight,monokai,neat,night,one-dark,rubyblue,solarized,twilight,vibrant-ink,xq-dark,xq-light;one-dark &fontSize=Font-size;list;10,11,12,13,14,15,16,17,18;14 &lineHeight=Line-height;list;1,1.1,1.2,1.3,1.4,1.5;1.3 &indentUnit=Indent unit;int;4 &tabSize=The width of a tab character;int;4 &lineWrapping=lineWrapping;list;true,false;true &matchBrackets=matchBrackets;list;true,false;true &activeLine=activeLine;list;true,false;false &emmet=emmet;list;true,false;true &search=search;list;true,false;false &indentWithTabs=indentWithTabs;list;true,false;true &undoDepth=undoDepth;int;200 &historyEventDelay=historyEventDelay;int;1250 * @internal @installset base - * @reportissues https://github.com/modxcms/evolution + * @reportissues https://github.com/evolution-cms/evolution * @documentation Official docs https://codemirror.net/doc/manual.html * @author hansek from http://www.modxcms.cz * @author update Mihanik71 diff --git a/install/assets/plugins/ElementsInTree.tpl b/install/assets/plugins/ElementsInTree.tpl index 7b3f59ed22..1f3f3ca223 100644 --- a/install/assets/plugins/ElementsInTree.tpl +++ b/install/assets/plugins/ElementsInTree.tpl @@ -7,14 +7,14 @@ * @category plugin * @version 1.5.7 * @license http://creativecommons.org/licenses/GPL/2.0/ GNU Public License (GPL v2) - * @internal @properties &tabTreeTitle=Tree Tab Title;text;Docs;;Custom title of Site Tree tab. &useIcons=Use icons in tabs;list;yes,no;yes;;Icons available in MODX version 1.2 or newer. &treeButtonsInTab=Tree Buttons in tab;list;yes,no;yes;;Move Tree Buttons into Site Tree tab. &unifyFrames=Unify Frames;list;yes,no;yes;;Unify Tree and Main frame style. Right now supports MODxRE2 theme only. + * @internal @properties &tabTreeTitle=Tree Tab Title;text;Docs;;Custom title of Site Tree tab. &useIcons=Use icons in tabs;list;yes,no;yes;;Icons available in EVO version 1.2 or newer. &treeButtonsInTab=Tree Buttons in tab;list;yes,no;yes;;Move Tree Buttons into Site Tree tab. &unifyFrames=Unify Frames;list;yes,no;yes;;Unify Tree and Main frame style. * @internal @events OnManagerTreePrerender,OnManagerTreeRender,OnManagerMainFrameHeaderHTMLBlock,OnTempFormSave,OnTVFormSave,OnChunkFormSave,OnSnipFormSave,OnPluginFormSave,OnModFormSave,OnTempFormDelete,OnTVFormDelete,OnChunkFormDelete,OnSnipFormDelete,OnPluginFormDelete,OnModFormDelete * @internal @modx_category Manager and Admin * @internal @installset base - * @documentation Requirements: This plugin requires MODX Evolution 1.2 or later + * @documentation Requirements: This plugin requires EVO Evolution 1.2 or later * @internal @disabled 1 - * @reportissues https://github.com/modxcms/evolution/issues - * @link Original Github thread https://github.com/modxcms/evolution/issues/783 + * @reportissues https://github.com/evolution-cms/evolution/issues + * @link Original Github thread https://github.com/evolution-cms/evolution/issues * @author Dmi3yy https://github.com/dmi3yy * @author pmfx https://github.com/pmfx * @author Nicola1971 https://github.com/Nicola1971 diff --git a/install/assets/plugins/mgrmgr.tpl b/install/assets/plugins/mgrmgr.tpl index a6dd357271..3cf6fd37f7 100644 --- a/install/assets/plugins/mgrmgr.tpl +++ b/install/assets/plugins/mgrmgr.tpl @@ -2,7 +2,7 @@ /** * ManagerManager * - * Customize the MODX Manager to offer bespoke admin functions for end users or manipulate the display of document fields in the manager. + * Customize the EVO Manager to offer bespoke admin functions for end users or manipulate the display of document fields in the manager. * * @category plugin * @version 0.6.2 diff --git a/install/assets/plugins/updater.tpl b/install/assets/plugins/updater.tpl new file mode 100644 index 0000000000..935c9dd0ea --- /dev/null +++ b/install/assets/plugins/updater.tpl @@ -0,0 +1,22 @@ +//
- MODX Starter-Template ©2006-[[$_SERVER['REQUEST_TIME']:dateFormat=`Y` ]] + EVO Starter-Template ©2006-[[$_SERVER['REQUEST_TIME']:dateFormat=`Y` ]]
Built with Bootstrap framework. diff --git a/install/assets/tvs/blogContent.tpl b/install/assets/tvs/blogContent.tpl index b616fba66a..270d88a5de 100644 --- a/install/assets/tvs/blogContent.tpl +++ b/install/assets/tvs/blogContent.tpl @@ -12,7 +12,7 @@ * @internal @output_widget RichText * @internal @output_widget_params &w=383px&h=450px&edt=TinyMCE * @internal @lock_tv 0 - * @internal @template_assignments MODX startup - Bootstrap + * @internal @template_assignments EVO startup - Bootstrap * @internal @modx_category Demo Content * @internal @installset sample */ \ No newline at end of file diff --git a/install/assets/tvs/documentTags.tpl b/install/assets/tvs/documentTags.tpl index 23471314a5..35e9015465 100644 --- a/install/assets/tvs/documentTags.tpl +++ b/install/assets/tvs/documentTags.tpl @@ -12,7 +12,7 @@ * @internal @output_widget * @internal @output_widget_params * @internal @lock_tv 0 - * @internal @template_assignments MODX startup - Bootstrap + * @internal @template_assignments EVO startup - Bootstrap * @internal @modx_category Demo Content * @internal @installset sample */ \ No newline at end of file diff --git a/install/assets/tvs/loginName.tpl b/install/assets/tvs/loginName.tpl index 00cf7e6b00..540dddcd80 100644 --- a/install/assets/tvs/loginName.tpl +++ b/install/assets/tvs/loginName.tpl @@ -12,7 +12,7 @@ * @internal @output_widget * @internal @output_widget_params * @internal @lock_tv 0 - * @internal @template_assignments MODX startup - Bootstrap + * @internal @template_assignments EVO startup - Bootstrap * @internal @modx_category Demo Content * @internal @installset sample */ \ No newline at end of file diff --git a/install/config.inc.tpl b/install/config.inc.tpl index a2549ec2de..a70d528ef4 100644 --- a/install/config.inc.tpl +++ b/install/config.inc.tpl @@ -100,7 +100,19 @@ if(!function_exists('startCMSSession')) { removeInvalidCmsSessionFromStorage($_GET, $session_name); removeInvalidCmsSessionFromStorage($_POST, $session_name); } + function is_session_started(){ + if (php_sapi_name() !== 'cli') { + if (version_compare(phpversion(), '5.4.0', '>=')) { + return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE; + } else { + return session_id() === '' ? FALSE : TRUE; + } + } + return FALSE; + } function startCMSSession(){ + + if ( is_session_started() !== FALSE ) return; global $site_sessionname, $https_port; diff --git a/install/img/install_new.png b/install/img/install_new.png index ef8a150148..34e783c48c 100644 Binary files a/install/img/install_new.png and b/install/img/install_new.png differ diff --git a/install/img/install_upg.png b/install/img/install_upg.png index c8689452e5..dd36554446 100644 Binary files a/install/img/install_upg.png and b/install/img/install_upg.png differ diff --git a/install/img/logo.png b/install/img/logo.png index 24930c5194..6c0e3cba7e 100644 Binary files a/install/img/logo.png and b/install/img/logo.png differ diff --git a/install/index.php b/install/index.php index 71ef4b2de7..4f4f4cdf18 100644 --- a/install/index.php +++ b/install/index.php @@ -8,7 +8,7 @@ @ ini_set('magic_quotes_sybase', 0); } -$autoloader = '../vendor/autoload.php'; +$autoloader = realpath(__DIR__.'/../vendor/autoload.php'); if (file_exists($autoloader) && is_readable($autoloader)) { include_once($autoloader); } diff --git a/install/instprocessor.php b/install/instprocessor.php index e8f643d1fc..9ea49941e7 100644 --- a/install/instprocessor.php +++ b/install/instprocessor.php @@ -261,10 +261,10 @@ function parseProperties($propertyString) { echo "" . $_lang['ok'] . "

"; } -// generate new site_id and set manager theme to MODxRE +// generate new site_id and set manager theme to default if ($installMode == 0) { $siteid = uniqid(''); - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','MODxRE2')"); + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); } else { // update site_id if missing $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); @@ -674,7 +674,7 @@ function parseProperties($propertyString) { echo "

" . $_lang['some_tables_not_updated'] . "

"; return; } else { - $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='MODX startup - Bootstrap'", $sqlParser->prefix); + $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); $rs = mysqli_query($sqlParser->conn, $sql); if(mysqli_num_rows($rs)) { $row = mysqli_fetch_assoc($rs); diff --git a/install/lang.php b/install/lang.php index e09f20ed34..5234a4c582 100644 --- a/install/lang.php +++ b/install/lang.php @@ -1,10 +1,10 @@ /assets/cache and /assets/cache/rss directories exist: '; $_lang["checking_iconv"] = 'Checking if extension iconv is available: '; @@ -49,7 +49,7 @@ $_lang["checking_mysql_version"] = 'Checking MySQL version: '; $_lang["checking_php_version"] = 'Checking PHP version: '; $_lang["checking_registerglobals"] = 'Checking if Register_Globals is off: '; -$_lang["checking_registerglobals_note"] = 'This configuration makes your site much more susceptible to Cross Site Scripting (XSS) attacks. You should speak to your host about disabling this setting, usually by one of three ways: modifying the global php.ini file, adding rules to a .htaccess file in the root of your MODX install, or adding custom php.ini override files in every directory on your install (and there\'s a lot of them). You will still be able to install MODX, but consider yourself warned.'; +$_lang["checking_registerglobals_note"] = 'This configuration makes your site much more susceptible to Cross Site Scripting (XSS) attacks. You should speak to your host about disabling this setting, usually by one of three ways: modifying the global php.ini file, adding rules to a .htaccess file in the root of your EVO install, or adding custom php.ini override files in every directory on your install (and there\'s a lot of them). You will still be able to install EVO, but consider yourself warned.'; $_lang["checking_sessions"] = 'Checking if sessions are properly configured: '; $_lang["checking_table_prefix"] = 'Checking table prefix `'; $_lang["choose_language"] = 'Choose language'; @@ -58,7 +58,7 @@ $_lang["connection_screen_collation"] = 'Collation:'; $_lang["connection_screen_connection_method"] = 'Connection method:'; $_lang["connection_screen_database_connection_information"] = 'Database information'; -$_lang["connection_screen_database_connection_note"] = 'Enter the database name to use or which you wish to create for this MODX install. If no database exists, the installer will attempt to create one. This may fail depending on the MySQL user permissions.'; +$_lang["connection_screen_database_connection_note"] = 'Enter the database name to use or which you wish to create for this EVO install. If no database exists, the installer will attempt to create one. This may fail depending on the MySQL user permissions.'; $_lang["connection_screen_database_host"] = 'Database host:'; $_lang["connection_screen_database_info"] = 'Database Information'; $_lang["connection_screen_database_login"] = 'Database login name:'; @@ -83,7 +83,7 @@ $_lang["database_use_failed"] = 'Database could not be selected!'; $_lang["database_use_failed_note"] = 'Please check the database permissions for the specified user and try again.'; $_lang["default_language"] = 'Default Manager Language'; -$_lang["default_language_description"] = 'This is the default language that will be used in the MODX Manager back end control panel.'; +$_lang["default_language_description"] = 'This is the default language that will be used in the EVO Manager back end control panel.'; $_lang["depedency_create"] = 'Depedency created'; $_lang["depedency_update"] = 'Depedency updated'; $_lang["during_execution_of_sql"] = ' during the execution of SQL statement '; @@ -94,8 +94,8 @@ $_lang["guid_set"] = 'GUID set'; $_lang["help"] = 'Help!'; $_lang["help_link"] = 'http://forums.modx.com/'; -$_lang["help_title"] = 'Installation assistance in the MODX forums'; -$_lang["iagree_box"] = 'I agree to the terms of the MODX license. For translations of the GPL version 2 license, please visit the GNU Operating System website.'; +$_lang["help_title"] = 'Installation assistance in the EVO forums'; +$_lang["iagree_box"] = 'I agree to the terms of the EVO license. For translations of the GPL version 2 license, please visit the GNU Operating System website.'; $_lang["install"] = 'Install'; $_lang["install_overwrite"] = 'Install/Overwrite'; $_lang["install_results"] = 'Install results'; @@ -105,7 +105,7 @@ $_lang["installation_install_new_note"] = 'Please note this option may overwrite any data inside your database.'; $_lang["installation_mode"] = 'Installation Mode'; $_lang["installation_new_installation"] = 'New Installation'; -$_lang["installation_note"] = 'Note: After logging into the manager you should edit and save your System Configuration settings before browsing the site by choosing Tools -> System Configuration in the MODX Manager.'; +$_lang["installation_note"] = 'Note: After logging into the manager you should edit and save your System Configuration settings before browsing the site by choosing Tools -> System Configuration in the EVO Manager.'; $_lang["installation_successful"] = 'Installation was successful!'; $_lang["installation_upgrade_advanced"] = 'Advanced Upgrade'; $_lang["installation_upgrade_advanced_note"] = 'For advanced database admins or moving to servers with a different database connection character set.
You will need to know your full database name, user, password and connection/collation details.'; @@ -116,10 +116,10 @@ $_lang["language_code"] = 'en'; $_lang["loading"] = 'Loading...'; $_lang["modules"] = 'Modules'; -$_lang["modx_footer1"] = '© 2005-[+current_year+] the MODX Content Management Framework (CMF) project. All rights reserved. MODX is licensed under the GNU GPL.'; -$_lang["modx_footer2"] = 'MODX is free software. We encourage you to be creative and make use of MODX in any way you see fit. Just make sure that if you do make changes and decide to redistribute your modified MODX, that you keep the source code free!'; -$_lang["modx_install"] = 'MODX » Install'; -$_lang["modx_requires_php"] = ', and MODX requires PHP [+min_version+] or later'; +$_lang["modx_footer1"] = '© 2005-[+current_year+] the EVO Content Management Framework (CMF) project. All rights reserved. EVO is licensed under the GNU GPL.'; +$_lang["modx_footer2"] = 'EVO is free software. We encourage you to be creative and make use of EVO in any way you see fit. Just make sure that if you do make changes and decide to redistribute your modified EVO, that you keep the source code free!'; +$_lang["modx_install"] = 'EVO » Install'; +$_lang["modx_requires_php"] = ', and EVO requires PHP [+min_version+] or later'; $_lang["mysql_5051"] = ' MySQL server version is 5.0.51!'; $_lang["mysql_5051_warning"] = 'There are known issues with MySQL 5.0.51. It is recommended that you upgrade before continuing.'; $_lang["mysql_version_is"] = ' Your MySQL version is: '; @@ -129,7 +129,7 @@ $_lang["ok"] = 'OK!'; $_lang["optional_items"] = 'Optional Items'; $_lang["optional_items_note"] = 'Please choose your installation options and click Install:'; -$_lang["php_security_notice"] = 'Security notice

While MODX will work on your PHP version, usage of MODX on this version is not recommended. Your version of PHP is vulnerable to numerous security holes. Please upgrade to PHP version is 4.3.8 or higher, which patches these holes. It is recommended you upgrade to this version for the security of your own website.

'; +$_lang["php_security_notice"] = 'Security notice

While EVO will work on your PHP version, usage of EVO on this version is not recommended. Your version of PHP is vulnerable to numerous security holes. Please upgrade to PHP version is 5.6 or higher, which patches these holes. It is recommended you upgrade to this version for the security of your own website.

'; $_lang["please_correct_error"] = '. Please correct the error'; $_lang["please_correct_errors"] = '. Please correct the errors'; $_lang["plugins"] = 'Plugins'; @@ -149,7 +149,7 @@ $_lang["session_problem"] = 'A problem was detected with your server sessions. Please consult your server admin to correct this problem.'; $_lang["session_problem_try_again"] = 'Try again?'; $_lang["setup_cannot_continue"] = 'Unfortunately, Setup cannot continue at the moment, due to the above '; -$_lang["setup_couldnt_install"] = 'MODX setup couldn\'t install/alter some tables inside the selected database.'; +$_lang["setup_couldnt_install"] = 'EVO setup couldn\'t install/alter some tables inside the selected database.'; $_lang["setup_database"] = 'Setup will now attempt to setup the database:
'; $_lang["setup_database_create_connection"] = 'Creating connection to the database: '; $_lang["setup_database_create_connection_failed"] = 'Database connection failed!'; @@ -174,7 +174,7 @@ $_lang["status_passed_database_created"] = 'passed - database created'; $_lang["status_passed_server"] = 'passed - collations now available'; $_lang["strict_mode"] = ' MySQL server strict sql_mode is enabled!'; -$_lang["strict_mode_error"] = 'Certain features of MODX may not work properly unless the STRICT_TRANS_TABLES sql_mode is disabled. You can set the MySQL mode by editing the my.cnf file or contact your server administrator.'; +$_lang["strict_mode_error"] = 'Certain features of EVO may not work properly unless the STRICT_TRANS_TABLES sql_mode is disabled. You can set the MySQL mode by editing the my.cnf file or contact your server administrator.'; $_lang["summary_setup_check"] = 'Setup has carried out a number of checks to see if everything\'s ready to start the setup.'; $_lang["system_configuration"] = 'System Configuration'; $_lang["system_configuration_validate_referer_description"] = 'The Validate HTTP_REFERER headers setting is recommended and can protect your site from CSRF attacks, but in some server configurations, can make your manager inaccessible.'; @@ -194,11 +194,11 @@ $_lang["upgrade_note"] = 'Note: Before browsing your site you should log into the manager with an administrative account, then review and save your System Configuration settings.'; $_lang["upgraded"] = 'Upgraded'; $_lang["validate_referer_title"] = 'Validate HTTP_REFERER headers?'; -$_lang["visit_forum"] = ', visit the MODX Forums.'; +$_lang["visit_forum"] = ', visit the EVO Forums.'; $_lang["warning"] = 'WARNING!'; $_lang["welcome_message_start"] = 'First, choose the type of installation to perform:'; $_lang["welcome_message_text"] = 'This program will guide you through the rest of the installation.'; -$_lang["welcome_message_welcome"] = 'Welcome to the MODX installation program.'; +$_lang["welcome_message_welcome"] = 'Welcome to the EVO installation program.'; $_lang["writing_config_file"] = 'Writing configuration file: '; $_lang["yes"] = 'Yes'; $_lang["you_running_php"] = ' - You are running on PHP '; diff --git a/install/lang/russian-UTF8.inc.php b/install/lang/russian-UTF8.inc.php index 59a1cb2c01..4ea9bd3423 100644 --- a/install/lang/russian-UTF8.inc.php +++ b/install/lang/russian-UTF8.inc.php @@ -1,10 +1,10 @@ лицензии. С русским переводом текста лицензии можно познакомиться на странице GNU General Public License.'; $_lang["install"] = 'Установить'; $_lang["install_overwrite"] = 'Установить/Переписать'; @@ -106,7 +106,7 @@ $_lang["installation_install_new_note"] = 'Внимание, выбор этого варианта может перезаписать данные в вашей базе данных.'; $_lang["installation_mode"] = 'Режим установки'; $_lang["installation_new_installation"] = 'Новая установка'; -$_lang["installation_note"] = 'Внимание: После входа в панель управления вы должны отредактировать и сохранить системную конфигурацию MODX, прежде чем смотреть сайт, выбрав Инструменты -> Конфигурация в панели управления.'; +$_lang["installation_note"] = 'Внимание: После входа в панель управления вы должны отредактировать и сохранить системную конфигурацию EVO, прежде чем смотреть сайт, выбрав Инструменты -> Конфигурация в панели управления.'; $_lang["installation_successful"] = 'Установка успешно завершена!'; $_lang["installation_upgrade_advanced"] = 'Расширенное обновление установки'; $_lang["installation_upgrade_advanced_note"] = 'Для расширенного управления базой данных с различным набором символов.
Вы должны знать полное название вашей базы данных, имя пользователя, пароль, детали подключения и таблицу сопоставления.'; @@ -117,10 +117,10 @@ $_lang["language_code"] = 'ru'; $_lang["loading"] = 'Загружается...'; $_lang["modules"] = 'Модули'; -$_lang["modx_footer1"] = '© 2005-[+current_year+] MODX Content Mangement Framework (CMF) project. Все права защищены. MODX лицензирован GNU GPL.'; -$_lang["modx_footer2"] = 'MODX — свободное программное обеспечение. Мы поощряем вас быть творческими и использовать MODX как вы считаете целесообразным. Если вы внесете изменения и решите распространять ваш измененный вариант MODX, то должны сохранять и распространять исходный код бесплатно.'; -$_lang["modx_install"] = 'MODX » Установка'; -$_lang["modx_requires_php"] = ', а MODX необходим PHP [+min_version+] или более поздний'; +$_lang["modx_footer1"] = '© 2005-[+current_year+] EVO Content Mangement Framework (CMF) project. Все права защищены. EVO лицензирован GNU GPL.'; +$_lang["modx_footer2"] = 'EVO — свободное программное обеспечение. Мы поощряем вас быть творческими и использовать EVO как вы считаете целесообразным. Если вы внесете изменения и решите распространять ваш измененный вариант EVO, то должны сохранять и распространять исходный код бесплатно.'; +$_lang["modx_install"] = 'EVO » Установка'; +$_lang["modx_requires_php"] = ', а EVO необходим PHP [+min_version+] или более поздний'; $_lang["mysql_5051"] = ' версия MySQL - 5.0.51!'; $_lang["mysql_5051_warning"] = 'Известны проблемы с MySQL 5.0.51. Настоятельно рекомендуем обновить базу данных перед продолжением установки.'; $_lang["mysql_version_is"] = ' Ваша версия MySQL: '; @@ -130,7 +130,7 @@ $_lang["ok"] = 'OK!'; $_lang["optional_items"] = 'Дополнительные элементы'; $_lang["optional_items_note"] = 'Пожалуйста, выберите параметры установки и нажмите кнопку `Установить`:'; -$_lang["php_security_notice"] = 'Уведомление безопасности

Несмотря на то, что MODX будет работать на вашей версии PHP, использовать его c этой версией PHP крайне не рекомендуется. Ваша версия PHP уязвима из-за многочисленных брешей в защите. Обновите PHP до версии 4.3.8 или более поздней для безопасности вашего сайта.

'; +$_lang["php_security_notice"] = 'Уведомление безопасности

Несмотря на то, что EVO будет работать на вашей версии PHP, использовать его c этой версией PHP крайне не рекомендуется. Ваша версия PHP уязвима из-за многочисленных брешей в защите. Обновите PHP до версии 5.6 или более поздней для безопасности вашего сайта.

'; $_lang["please_correct_error"] = '. Исправьте эту ошибку'; $_lang["please_correct_errors"] = '. Исправьте эти ошибки'; $_lang["plugins"] = 'Плагины'; @@ -147,7 +147,7 @@ $_lang["session_problem"] = 'Была обнаружена проблема в сессии сервера. Свяжитесь, пожалуйста, с администратором сервера для ее устранения.'; $_lang["session_problem_try_again"] = 'Повторить?'; $_lang["setup_cannot_continue"] = 'К сожалению, установка не может быть продолжена из-за '; -$_lang["setup_couldnt_install"] = 'Программа установки MODX не смогла установить/изменить некоторые таблицы базы данных.'; +$_lang["setup_couldnt_install"] = 'Программа установки EVO не смогла установить/изменить некоторые таблицы базы данных.'; $_lang["setup_database"] = 'Программа установки сейчас попробует установить базу данных:
'; $_lang["setup_database_create_connection"] = 'Создание подключения к базе данных: '; $_lang["setup_database_create_connection_failed"] = 'Не удалось соединиться с базой данных!'; @@ -172,7 +172,7 @@ $_lang["status_passed_database_created"] = 'успех - база данных создана'; $_lang["status_passed_server"] = 'успех - сопоставление базы данных доступно'; $_lang["strict_mode"] = ' сервер MySQL работает в строгом режиме strict sql_mode!'; -$_lang["strict_mode_error"] = 'Некоторые возможности MODX не могут работать должным образом, если режим sql_mode STRICT_TRANS_TABLES не отключен. Вы можете задать режим через внесения изменений в my.cnf файл или связаться с администратором базы данных.'; +$_lang["strict_mode_error"] = 'Некоторые возможности EVO не могут работать должным образом, если режим sql_mode STRICT_TRANS_TABLES не отключен. Вы можете задать режим через внесения изменений в my.cnf файл или связаться с администратором базы данных.'; $_lang["summary_setup_check"] = 'Программа установки выполнит несколько тестов, чтобы удостовериться, что все готово к установке.'; $_lang["system_configuration"] = 'Конфигурация системы'; $_lang["system_configuration_validate_referer_description"] = 'Рекомендуется установка Проверять заголовки HTTP_REFERER, которая может защитить ваш сайт от атак CSRF, но при некоторых конфигурациях сервера система управления может быть недоступна.'; @@ -192,11 +192,11 @@ $_lang["upgrade_note"] = 'Внимание: Прежде чем открыть ваш сайт, вам необходимо войти в панель управления, затем просмотреть и сохранить системную конфигурацию.'; $_lang["upgraded"] = 'Обновлен'; $_lang["validate_referer_title"] = 'Проверять серверные заголовки HTTP_REFERER?'; -$_lang["visit_forum"] = ', посетите форум MODX.'; +$_lang["visit_forum"] = ', посетите форум EVO.'; $_lang["warning"] = 'Предупреждение!'; $_lang["welcome_message_start"] = 'Выберите тип установки:'; $_lang["welcome_message_text"] = 'Эта программа проведет вас через весь процесс установки.'; -$_lang["welcome_message_welcome"] = 'Добро пожаловать в программу установки MODX.'; +$_lang["welcome_message_welcome"] = 'Добро пожаловать в программу установки EVO.'; $_lang["writing_config_file"] = 'Запись конфигурационного файла: '; $_lang["yes"] = 'Да'; $_lang["you_running_php"] = ' - вы используете PHP '; diff --git a/install/not_installed.tpl b/install/not_installed.tpl index 8359ea8803..eda3690c55 100644 --- a/install/not_installed.tpl +++ b/install/not_installed.tpl @@ -2,7 +2,7 @@ -MODX is not installed! +EVO is not installed! -
+
@@ -390,8 +394,8 @@ function checked($cond) { 'Description' ); if(is_array($files) && 0 < $total) { - echo ''; - echo "\n"; + echo '
{$_lang["files_filename"]}{$_lang["files_filesize"]}{$_lang["description"]}{$_lang["modx_version"]}{$_lang["database_name"]}{$_lang["onlineusers_action"]}
'; + echo "\n"; arsort($files); $tpl = '' . "\n"; while($file = array_shift($files)) { diff --git a/manager/actions/document_data.static.php b/manager/actions/document_data.static.php index c8eef22d17..7173f44f66 100644 --- a/manager/actions/document_data.static.php +++ b/manager/actions/document_data.static.php @@ -27,6 +27,15 @@ } $access = "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0" . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); +// +if($_SESSION['tree_show_only_folders']) { + $parent = $id ? ($modx->db->getValue("SELECT parent FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1")) : 0; + $isfolder = $modx->db->getValue("SELECT isfolder FROM " . $tbl_site_content . " WHERE id=$id LIMIT 1"); + if(!$isfolder && $parent != 0) { + $id = $_REQUEST['id'] = $parent; + } +} + // Get the document content $rs = $modx->db->select('DISTINCT sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.id ='{$id}' AND ({$access})"); @@ -76,22 +85,33 @@ $filter_sort = ''; $filter_dir = ''; if($numRecords > 0) { - $filter_sort = '

' . '' . '' . '' . '' . //******** resource_opt_is_published - // '' . //********// ''; - $filter_dir = '

'; + $filter_dir = ''; $resource = $modx->db->makeArray($rs); // CSS style for table - $tableClass = 'grid'; - $rowHeaderClass = 'gridHeader'; - $rowRegularClass = 'gridItem'; - $rowAlternateClass = 'gridAltItem'; + // $tableClass = 'grid'; + // $rowHeaderClass = 'gridHeader'; + // $rowRegularClass = 'gridItem'; + // $rowAlternateClass = 'gridAltItem'; + $tableClass = 'table data'; + $columnHeaderClass = array( + 'text-center', + 'text-left', + 'text-center', + 'text-center', + 'text-center', + 'text-center' + ); + $modx->table->setTableClass($tableClass); - $modx->table->setRowHeaderClass($rowHeaderClass); - $modx->table->setRowRegularClass($rowRegularClass); - $modx->table->setRowAlternateClass($rowAlternateClass); + $modx->table->setColumnHeaderClass($columnHeaderClass); + // $modx->table->setRowHeaderClass($rowHeaderClass); + // $modx->table->setRowRegularClass($rowRegularClass); + // $modx->table->setRowAlternateClass($rowAlternateClass); // Table header $listTableHeader = array( @@ -103,12 +123,12 @@ 'edit' => $_lang['mgrlog_action'], ); $tbWidth = array( - '2%', + '1%', '', - '10%', - '10%', - '90', - '150' + '1%', + '1%', + '1%', + '1%' ); $modx->table->setColumnWidths($tbWidth); @@ -149,7 +169,7 @@ $icon = $_style['tree_page_info']; break; default: - if($children[isfolder]) { + if($children['isfolder']) { $isPrivate = ($children['privateweb'] || $children['privatemgr']) ? '1' : '0'; $icon = $isPrivate ? $_style['tree_folder_secure'] : $_style['tree_folder_new']; } else { @@ -167,35 +187,29 @@ } } - /* - $listDocs[] = array( - 'docid' => $children['id'], - 'title' => (($children['deleted'] ? (''.$children['pagetitle'].'') : ( ($modx->hasPermission('edit_document')) ? ('' . $children['pagetitle'] . '') : $children['pagetitle'] ))), - 'createdon' => ($modx->toDateFormat($children['createdon']+$server_offset_time,'dateOnly')), - 'pub_date' => ($children['pub_date']? ($modx->toDateFormat($children['pub_date']+$server_offset_time,'dateOnly')) : ''), - 'status' => ($children['published'] == 0) ? ''.$_lang['page_data_unpublished'].'' : ''.$_lang['page_data_published'].'', - 'edit' => (($modx->hasPermission('edit_document')) ? '    ' : '') . - (($modx->hasPermission('delete_document')) ? '  ' : ''), - ); - */ - // дописываем в заголовок класс для неопубликованных плюс по всем ссылкам обратный путь // для сохранения сортировки - $icon_pub_unpub = (!$children['published']) ? '' : ''; + $class = ($children['deleted'] ? 'text-danger text-decoration-through' : (!$children['published'] ? ' font-italic text-muted' : ' publish')); + //$class .= ($children['hidemenu'] ? ' text-muted' : ' text-primary'); + //$class .= ($children['isfolder'] ? ' font-weight-bold' : ''); + if($modx->hasPermission('edit_document')) { + $title = '' . $icon . '' . $children['pagetitle'] . ''; + } else { + $title = '' . $icon . '' . $children['pagetitle'] . ''; + } + + $icon_pub_unpub = (!$children['published']) ? '' : ''; - $icon_del_undel = (!$children['deleted']) ? '' : ''; + $icon_del_undel = (!$children['deleted']) ? '' : ''; $listDocs[] = array( - 'docid' => $children['id'], - 'title' => (($children['deleted'] ? ('' . $icon . ' ' . $children['pagetitle'] . '') : (($modx->hasPermission('edit_document')) ? ('' . ($children['published'] ? $icon . ' ' . $children['pagetitle'] : '' . $icon . ' ' . $children['pagetitle'] . '') . '') : $icon . ' ' . $children['pagetitle']))), - 'createdon' => ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')), - 'pub_date' => ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : ''), - 'status' => ($children['published'] == 0) ? '' . $_lang['page_data_unpublished'] . '' : '' . $_lang['page_data_published'] . '', - 'edit' => (($modx->hasPermission('edit_document')) ? '   ' . $icon_pub_unpub . ' ' : '') . (($modx->hasPermission('delete_document')) ? $icon_del_undel : ''), + 'docid' => '
' . $children['id'] . '
', + 'title' => $title, + 'createdon' => '
' . ($modx->toDateFormat($children['createdon'] + $server_offset_time, 'dateOnly')) . '
', + 'pub_date' => '
' . ($children['pub_date'] ? ($modx->toDateFormat($children['pub_date'] + $server_offset_time, 'dateOnly')) : '') . '
', + 'status' => '
' . ($children['published'] == 0 ? '' . $_lang['page_data_unpublished'] . '' : '' . $_lang['page_data_published'] . '') . '
', + 'edit' => '
' . ($modx->hasPermission('edit_document') ? '' . $icon_pub_unpub : '') . ($modx->hasPermission('delete_document') ? $icon_del_undel : '') . '
' ); } @@ -203,110 +217,96 @@ class="' . $_style["icons_move_document"] . '"> ' . $icon_pub_unpub $children_output = $modx->table->create($listDocs, $listTableHeader, 'index.php?a=3&id=' . $content['id']); } else { // No Child documents - $children_output = "

" . $_lang['resources_in_container_no'] . "

"; + $children_output = '

' . $_lang['resources_in_container_no'] . '

'; } ?>

- config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . ' (' . $_REQUEST['id'] . ')' ?> + config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . ' (' . $_REQUEST['id'] . ')' ?>

- - -
+ -
- - -
-

- +
+ + +
+

+ +
{$_lang["files_filename"]}{$_lang["files_filesize"]}{$_lang["description"]}{$_lang["modx_version"]}{$_lang["database_name"]}{$_lang["onlineusers_action"]}
[+filename+][+filesize+][+filedesc+][+modx_version+][+database_name+]' . $_lang["bkmgr_restore_submit"] . '
- + - - + + - + - - + + - - + + - - + + - - + + config['show_meta'] === '1'): @@ -327,7 +327,7 @@ function movedocument() { } ?> - + - + - + - - + - - + @@ -371,114 +371,122 @@ function movedocument() { - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + +
::
:: - " . $_lang['not_set'] . ")" ?> + " . $_lang['not_set'] . ")" ?>
:" . $_lang['not_set'] . ")" ?>:" . $_lang['not_set'] . ")" ?>
:" . $_lang['not_set'] . ")" ?>:" . $_lang['not_set'] . ")" ?>
::
:" . $_lang['not_set'] . ")" ?>:" . $_lang['not_set'] . ")" ?>
::
:: ', $metatags_selected); @@ -353,17 +353,17 @@ function movedocument() {  
:toDateFormat($content['createdon'] + $server_offset_time) ?> () + :toDateFormat($content['createdon'] + $server_offset_time) ?> ()
:toDateFormat($content['editedon'] + $server_offset_time) ?> () + :toDateFormat($content['editedon'] + $server_offset_time) ?> ()
 
:' . $_lang['page_data_unpublished'] . '' : '' . $_lang['page_data_published'] . '' ?>:' . $_lang['page_data_unpublished'] . '' : '' . $_lang['page_data_published'] . '' ?>
:" . $_lang['not_set'] . ")" : $modx->toDateFormat($content['pub_date']) ?>:" . $_lang['not_set'] . ")" : $modx->toDateFormat($content['pub_date']) ?>
:" . $_lang['not_set'] . ")" : $modx->toDateFormat($content['unpub_date']) ?>:" . $_lang['not_set'] . ")" : $modx->toDateFormat($content['unpub_date']) ?>
::
::
::
::
:' . $_lang['private'] . ' ' . $_style["icons_secured"] ?>:' . $_lang['private'] . ' ' . $_style["icons_secured"] ?>
:' . $_lang['private'] . ' ' . $_style["icons_secured"] ?>:' . $_lang['private'] . ' ' . $_style["icons_secured"] ?>
 
::
::
::
-
- - -
-

- +
+
+ + +
+

+ +
+
+ 0) : ?> +
+ () +
+ +
+ +
+ +
+
+
+
+
+
+ + config['cache_type'] != 2) { ?> + +
+

+ 0) { - echo '

' . $numRecords . ' ' . $_lang['resources_in_container'] . ' (' . $content['pagetitle'] . ')

' . "\n"; + $buffer = ""; + $filename = $modx->config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php"; + $handle = @fopen($filename, "r"); + if(!$handle) { + $buffer = '
' . $_lang['page_data_notcached'] . '
'; + } else { + while(!feof($handle)) { + $buffer .= fgets($handle, 4096); + } + fclose($handle); + $buffer = '
\n"; } - echo $filter_sort . $filter_dir; - echo $children_output . "\n"; + echo $buffer; ?>
+ - config['cache_type'] != 2) { ?> - -
-

- - - config['base_path'] . "assets/cache/docid_" . $id . ".pageCache.php"; - $handle = @fopen($filename, "r"); - if(!$handle) { - $buffer = $_lang['page_data_notcached']; - } else { - while(!feof($handle)) { - $buffer .= fgets($handle, 4096); - } - fclose($handle); - $buffer = $_lang['page_data_cached'] . '

\n"; - } - echo $buffer; - ?> -

- - -
+
-
docSettings.setSelectedIndex( ' . $_GET['tab'] . ' );'; } ?> -
+
- +
getClientScriptObject()?>; + var contextm = getClientScriptObject()?>; + function showContentMenu(id, e) { selectedItem = id; contextm.style.left = (e.pageX || (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft))) + "px"; @@ -84,71 +85,69 @@ function menuAction(a) { document.addEvent('click', function() { contextm.style.visibility = "hidden"; }); + + document.addEventListener('DOMContentLoaded', function() { + var h1help = document.querySelector('h1 > .help'); + h1help.onclick = function() { + document.querySelector('.element-edit-message').classList.toggle('show') + } + }); - - + +

- +

-
-
- -

-