Skip to content
Snippets Groups Projects
Verified Commit a41e539a authored by Damien's avatar Damien
Browse files

FIX #8489 Install config email

parent 7ffd11fd
No related branches found
No related tags found
No related merge requests found
...@@ -751,11 +751,6 @@ class Install extends functions ...@@ -751,11 +751,6 @@ class Install extends functions
$connect .= 'password='.$_SESSION['config']['databasepassword'].' '; $connect .= 'password='.$_SESSION['config']['databasepassword'].' ';
$connect .= 'dbname=postgres'; $connect .= 'dbname=postgres';
if (!$this->setConfig_sendmail()) {
return false;
exit;
}
if (!$this->setConfigXml()) { if (!$this->setConfigXml()) {
return false; return false;
exit; exit;
...@@ -776,11 +771,6 @@ class Install extends functions ...@@ -776,11 +771,6 @@ class Install extends functions
exit; exit;
} }
if (!$this->setScriptSendmailSendmailSh()) {
return false;
exit;
}
if (!$this->setConfig_LDAP()) { if (!$this->setConfig_LDAP()) {
return false; return false;
exit; exit;
...@@ -806,11 +796,6 @@ class Install extends functions ...@@ -806,11 +796,6 @@ class Install extends functions
exit; exit;
} }
if (!$this->setConfig_batch_XmlSendmail()) {
return false;
exit;
}
if (!$this->setLog4php()) { if (!$this->setLog4php()) {
return false; return false;
exit; exit;
...@@ -868,11 +853,6 @@ class Install extends functions ...@@ -868,11 +853,6 @@ class Install extends functions
exit; exit;
} }
if (!$this->setConfig_sendmail()) {
return false;
exit;
}
if (!$this->setConfigXml()) { if (!$this->setConfigXml()) {
return false; return false;
exit; exit;
...@@ -893,11 +873,6 @@ class Install extends functions ...@@ -893,11 +873,6 @@ class Install extends functions
exit; exit;
} }
if (!$this->setScriptSendmailSendmailSh()) {
return false;
exit;
}
if (!$this->setConfig_LDAP()) { if (!$this->setConfig_LDAP()) {
return false; return false;
exit; exit;
...@@ -923,11 +898,6 @@ class Install extends functions ...@@ -923,11 +898,6 @@ class Install extends functions
exit; exit;
} }
if (!$this->setConfig_batch_XmlSendmail()) {
return false;
exit;
}
if (!$this->setLog4php()) { if (!$this->setLog4php()) {
return false; return false;
exit; exit;
...@@ -1141,78 +1111,6 @@ class Install extends functions ...@@ -1141,78 +1111,6 @@ class Install extends functions
return true; return true;
} }
private function setConfig_batch_XmlSendmail()
{
$xmlconfig = simplexml_load_file('modules/sendmail/batch/config/config.xml.default');
$CONFIG = $xmlconfig->CONFIG;
$chemin_core = realpath('.').'/core/';
if ($_SERVER['SERVER_ADDR'] == '::1') {
$SERVER_ADDR = 'localhost';
} else {
$SERVER_ADDR = $_SERVER['SERVER_ADDR'];
}
$CONFIG->MaarchDirectory = realpath('.').'/';
$chemin = $SERVER_ADDR.dirname($_SERVER['PHP_SELF'].'cs_'.$_SESSION['config']['databasename']);
$maarchUrl = rtrim($chemin, 'install');
$maarchUrl = $maarchUrl.'cs_'.$_SESSION['config']['databasename'].'/';
$CONFIG->MaarchUrl = $maarchUrl;
$CONFIG->MaarchApps = 'maarch_entreprise';
$CONFIG->TmpDirectory = realpath('.').'/modules/sendmail/batch/tmp/';
$CONFIG_BASE = $xmlconfig->CONFIG_BASE;
$CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver'];
$CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport'];
$CONFIG_BASE->databasename = $_SESSION['config']['databasename'];
$CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser'];
$CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword'];
$LOG4PHP = $xmlconfig->LOG4PHP;
$LOG4PHP->Log4PhpConfigPath = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/log4php.xml';
$res = $xmlconfig->asXML();
$fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/sendmail/batch/config/config.xml', 'w+');
if (!$fp) {
return false;
exit;
}
$write = fwrite($fp, $res);
if (!$write) {
return false;
exit;
}
return true;
}
private function setConfig_sendmail()
{
$xmlconfig = simplexml_load_file('modules/sendmail/batch/config/config.xml.default');
//$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default';
$CONFIG_BASE = $xmlconfig->CONFIG_BASE;
$CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver'];
$CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport'];
$CONFIG_BASE->databasename = $_SESSION['config']['databasename'];
$CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser'];
$CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword'];
$res = $xmlconfig->asXML();
$fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/sendmail/batch/config/config.xml', 'w+');
if (!$fp) {
return false;
exit;
}
$write = fwrite($fp, $res);
if (!$write) {
return false;
exit;
}
return true;
}
private function setConfig_LDAP() private function setConfig_LDAP()
{ {
$xmlconfig = simplexml_load_file('modules/ldap/xml/config.xml.default'); $xmlconfig = simplexml_load_file('modules/ldap/xml/config.xml.default');
...@@ -1624,83 +1522,6 @@ class Install extends functions ...@@ -1624,83 +1522,6 @@ class Install extends functions
} }
} }
private function setScriptSendmailSendmailSh()
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$res = 'cd '.realpath('.')."\modules\\sendmail\\";
$res .= "\n";
$res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\sendmail\batch\process_emails.php -c '.realpath('.')."\custom/cs_".$_SESSION['config']['databasename'].'\modules\sendmail\batch\config\config.xml';
$fp = fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/sendmail/batch/scripts/sendmail.bat', 'w+');
if (!$fp) {
//var_dump('FALSE');
return false;
exit;
}
$write = fwrite($fp, $res);
if (!$write) {
return false;
exit;
}
return true;
} elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') {
$res = '#!/bin/bash';
$res .= "\n";
$res .= 'cd '.realpath('.').'/modules/sendmail/batch/';
$res .= "\n";
$res .= "emailStackPath='".realpath('.')."/modules/sendmail/batch/process_emails.php'";
$res .= "\n";
$res .= 'php $emailStackPath -c '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/sendmail/batch/config/config.xml';
$fp = fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/sendmail/batch/scripts/sendmail.sh', 'w+');
if (!$fp) {
//var_dump('FALSE');
//exit;
return false;
exit;
}
$write = fwrite($fp, $res);
if (!$write) {
return false;
exit;
}
return true;
}
}
private function setDatasourcesXsd()
{
$Fnm = 'apps/maarch_entreprise/xml/datasources.xsd.default';
$inF = fopen($Fnm, 'r');
while (!feof($inF)) {
$contentFile .= fgets($inF, 4096);
}
$contentFile = str_replace('##databaseserver##', $_SESSION['config']['databaseserver'], $contentFile);
$contentFile = str_replace('##databaseserverport##', $_SESSION['config']['databaseserverport'], $contentFile);
$contentFile = str_replace('##databasename##', $_SESSION['config']['databasename'], $contentFile);
$contentFile = str_replace('##databaseuser##', $_SESSION['config']['databaseuser'], $contentFile);
$contentFile = str_replace('##databasepassword##', $_SESSION['config']['databasepassword'], $contentFile);
fclose($inF);
if (file_exists('apps/maarch_entreprise/xml/datasources.xsd')) {
unlink('apps/maarch_entreprise/xml/datasources.xsd');
}
copy('apps/maarch_entreprise/xml/datasources.xsd.default', 'apps/maarch_entreprise/xml/datasources.xsd');
$fp = fopen('apps/maarch_entreprise/xml/datasources.xsd', 'w+');
if (!$fp) {
return false;
exit;
}
$write = fwrite($fp, $contentFile);
if (!$write) {
return false;
exit;
}
return true;
}
public function getDataList() public function getDataList()
{ {
$sqlList = array(); $sqlList = array();
......
...@@ -22,202 +22,6 @@ ...@@ -22,202 +22,6 @@
src: local('Arizonia'), local('Arizonia-Regular'), url('fonts/sonsieOne.woff') format('woff'); src: local('Arizonia'), local('Arizonia-Regular'), url('fonts/sonsieOne.woff') format('woff');
} }
/* header.css */
#fullWrapper #header {
height: 120px;
width: 910px;
text-align: left;
}
#fullWrapper #header .headerName {
position: relative;
top: 18px;
left: 0px;
float: left;
}
#fullWrapper #header .headerName h2 {
font-size: 70px;
font-family: 'Contrail One';
color: rgba(81, 112, 144, 1);
}
#fullWrapper #header .logo {
position: relative;
top: 17px;
right: 0px;
float: right;
}
/* footer.css */
#fullWrapper #footer {
height: 125px;
width: 910px;
text-align: left;
}
/* section.css */
#fullWrapper #section {
}
#fullWrapper #section .blockWrapper #progressWrapper{
font-family: 'Sonsie One';
color: rgba(255, 255, 255, 0.9);
font-weight: bold;
font-size: 30px;
}
#fullWrapper #section .blockWrapper {
width: 910px;
background-color: rgba(224, 224, 224, 0.5);
text-align: left;
}
#fullWrapper #section .blockWrapper .titleBlock {
}
#fullWrapper #section .blockWrapper .titleBlock h2 {
font-size: 35px;
font-family: 'Contrail One';
background-color: rgba(224, 224, 224, 0.8);
padding-top: 15px;
padding-bottom: 10px;
padding-left: 20px;
padding-right: 20px;
}
#fullWrapper #section .blockWrapper .contentBlock {
}
#fullWrapper #section .blockWrapper .contentBlock p {
padding-top: 15px;
padding-bottom: 15px;
padding-left: 15px;
padding-right: 15px;
text-align: justify;
}
#fullWrapper #section .blockWrapper .contentBlock h6 {
padding-top: 0;
padding-bottom: 0;
padding-left: 15px;
padding-right: 15px;
margin: 0;
margin-bottom: 10px;
text-align: justify;
}
#fullWrapper #section .blockWrapper .contentBlock .previousButton {
position: relative;
left: 25px;
}
#fullWrapper #section .blockWrapper .contentBlock .nextButton {
position: relative;
right: 25px;
}
#fullWrapper #section .blockWrapper .contentBlock form {
padding-left: 15px;
padding-right: 15px;
}
#fullWrapper #section .blockWrapper .contentBlock table {
padding-left: 15px;
padding-right: 15px;
}
#fullWrapper #section .blockWrapper .contentBlock table .voyantPrerequisites {
width: 30px;
}
/* tags.css */
body {
margin: 0;
background-color: rgba(224, 224, 224, 1);
font-family: "Trebuchet MS";
}
h2 {
margin: 0;
padding: 0;
font-weight: normal;
}
p {
margin: 0;
padding: 0;
font-weight: normal;
}
form {
margin: 0;
padding: 0;
}
table {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: rgba(255, 255, 255, 0.7);
font-weight: bold;
font-family: 'Sonsie One';
}
a:hover {
color: rgba(255, 255, 255, 1);
}
/* image-picker.css */
ul.thumbnails.image_picker_selector {
overflow: auto;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
padding: 0px;
margin: 0px;
}
ul.thumbnails.image_picker_selector ul {
overflow: auto;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
padding: 0px;
margin: 0px;
}
ul.thumbnails.image_picker_selector li.group {
width:100%;
}
ul.thumbnails.image_picker_selector li.group_title {
float: none;
}
ul.thumbnails.image_picker_selector li {
margin: 0px 12px 12px 0px;
float: left;
}
ul.thumbnails.image_picker_selector li .thumbnail {
padding: 6px;
border: 1px solid #dddddd;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
ul.thumbnails.image_picker_selector li .thumbnail img {
-webkit-user-drag: none;
}
ul.thumbnails.image_picker_selector li .thumbnail.selected {
background: #0088cc;
}
.image_picker_image {
width: 200px;
}
/* buttons.css */ /* buttons.css */
#buttons #next a { #buttons #next a {
/* background-color: #64b651; */ /* background-color: #64b651; */
...@@ -442,6 +246,126 @@ ul.thumbnails.image_picker_selector li .thumbnail.selected { ...@@ -442,6 +246,126 @@ ul.thumbnails.image_picker_selector li .thumbnail.selected {
} }
/* section.css */
#fullWrapper #section {
}
#fullWrapper #section .blockWrapper #progressWrapper{
font-family: 'Sonsie One';
color: rgba(255, 255, 255, 0.9);
font-weight: bold;
font-size: 30px;
}
#fullWrapper #section .blockWrapper {
width: 910px;
background-color: rgba(224, 224, 224, 0.5);
text-align: left;
}
#fullWrapper #section .blockWrapper .titleBlock {
}
#fullWrapper #section .blockWrapper .titleBlock h2 {
font-size: 35px;
font-family: 'Contrail One';
background-color: rgba(224, 224, 224, 0.8);
padding-top: 15px;
padding-bottom: 10px;
padding-left: 20px;
padding-right: 20px;
}
#fullWrapper #section .blockWrapper .contentBlock {
}
#fullWrapper #section .blockWrapper .contentBlock p {
padding-top: 15px;
padding-bottom: 15px;
padding-left: 15px;
padding-right: 15px;
text-align: justify;
}
#fullWrapper #section .blockWrapper .contentBlock h6 {
padding-top: 0;
padding-bottom: 0;
padding-left: 15px;
padding-right: 15px;
margin: 0;
margin-bottom: 10px;
text-align: justify;
}
#fullWrapper #section .blockWrapper .contentBlock .previousButton {
position: relative;
left: 25px;
}
#fullWrapper #section .blockWrapper .contentBlock .nextButton {
position: relative;
right: 25px;
}
#fullWrapper #section .blockWrapper .contentBlock form {
padding-left: 15px;
padding-right: 15px;
}
#fullWrapper #section .blockWrapper .contentBlock table {
padding-left: 15px;
padding-right: 15px;
}
#fullWrapper #section .blockWrapper .contentBlock table .voyantPrerequisites {
width: 30px;
}
/* image-picker.css */
ul.thumbnails.image_picker_selector {
overflow: auto;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
padding: 0px;
margin: 0px;
}
ul.thumbnails.image_picker_selector ul {
overflow: auto;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
padding: 0px;
margin: 0px;
}
ul.thumbnails.image_picker_selector li.group {
width:100%;
}
ul.thumbnails.image_picker_selector li.group_title {
float: none;
}
ul.thumbnails.image_picker_selector li {
margin: 0px 12px 12px 0px;
float: left;
}
ul.thumbnails.image_picker_selector li .thumbnail {
padding: 6px;
border: 1px solid #dddddd;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
ul.thumbnails.image_picker_selector li .thumbnail img {
-webkit-user-drag: none;
}
ul.thumbnails.image_picker_selector li .thumbnail.selected {
background: #0088cc;
}
.image_picker_image {
width: 200px;
}
/* general.css */ /* general.css */
#fullWrapper { #fullWrapper {
width: 960px; width: 960px;
...@@ -472,3 +396,79 @@ h6 { ...@@ -472,3 +396,79 @@ h6 {
/* tags.css */
body {
margin: 0;
background-color: rgba(224, 224, 224, 1);
font-family: "Trebuchet MS";
}
h2 {
margin: 0;
padding: 0;
font-weight: normal;
}
p {
margin: 0;
padding: 0;
font-weight: normal;
}
form {
margin: 0;
padding: 0;
}
table {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: rgba(255, 255, 255, 0.7);
font-weight: bold;
font-family: 'Sonsie One';
}
a:hover {
color: rgba(255, 255, 255, 1);
}
/* header.css */
#fullWrapper #header {
height: 120px;
width: 910px;
text-align: left;
}
#fullWrapper #header .headerName {
position: relative;
top: 18px;
left: 0px;
float: left;
}
#fullWrapper #header .headerName h2 {
font-size: 70px;
font-family: 'Contrail One';
color: rgba(81, 112, 144, 1);
}
#fullWrapper #header .logo {
position: relative;
top: 17px;
right: 0px;
float: right;
}
/* footer.css */
#fullWrapper #footer {
height: 125px;
width: 910px;
text-align: left;
}
This diff is collapsed.
...@@ -2,54 +2,25 @@ ...@@ -2,54 +2,25 @@
function setConfigSendmail_batch_config_Xml($from, $to, $host, $user, $pass, $type, $port, $auth, $charset, $smtpSecure, $mailfrom, $smtpDomains) function setConfigSendmail_batch_config_Xml($from, $to, $host, $user, $pass, $type, $port, $auth, $charset, $smtpSecure, $mailfrom, $smtpDomains)
{ {
$xmlconfig = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/sendmail/batch/config/config.xml'); \SrcCore\models\DatabasePDO::reset();
new \SrcCore\models\DatabasePDO(['customId' => 'cs_'.$_SESSION['config']['databasename']]);
$CONFIG = $xmlconfig->CONFIG; if (!empty($pass)) {
$pass = \SrcCore\models\PasswordModel::encrypt(['password' => $pass]);
$CONFIG->MaarchDirectory = realpath('.')."/";
if ($_SERVER['REMOTE_ADDR'] == '::1') {
$REMOTE_ADDR = 'localhost';
} else {
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
} }
$chemin = $REMOTE_ADDR . dirname($_SERVER['PHP_SELF']);
$maarchUrl = rtrim($chemin, "install");
$maarchUrl = $maarchUrl . 'cs_'.$_SESSION['config']['databasename'].'/';
$CONFIG->MaarchUrl = $maarchUrl;
$CONFIG->MaarchApps = 'maarch_entreprise';
$CONFIG->TmpDirectory = realpath('.').'/modules/sendmail/batch/tmp/';
$MAILER = $xmlconfig->MAILER; $data = [
$MAILER->type = $type; 'type' => $type,
$MAILER->smtp_port = $port; 'host' => $host,
$MAILER->smtp_host = $host; 'port' => $port,
$MAILER->smtp_user = $user; 'user' => $user,
$MAILER->smtp_password = $pass; 'password' => $pass,
//$MAILER->mailfrom = $mailfrom; 'auth' => $auth == 1,
$MAILER->domains = $smtpDomains; 'secure' => 'ssl',
if ($auth == 1) { 'charset' => 'utf-8'
$MAILER->smtp_auth = "true"; ];
} else { $data = json_encode($data);
$MAILER->smtp_auth = "false"; \Configuration\models\ConfigurationModel::update(['set' => ['value' => $data], 'where' => ['service = ?'], 'data' => ['admin_email_server']]);
}
$LOG4PHP = $xmlconfig->LOG4PHP;
$LOG4PHP->Log4PhpConfigPath = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/log4php.xml';
$res = $xmlconfig->asXML();
$fp = @fopen(realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/modules/sendmail/batch/config/config.xml", "w+");
if (!$fp) {
return false;
exit;
}
$write = fwrite($fp, $res);
if (!$write) {
return false;
exit;
}
} }
......
...@@ -421,6 +421,7 @@ class UserController ...@@ -421,6 +421,7 @@ class UserController
return $response->withStatus(400)->withJson(['errors' => 'Bad Request : redirectedBasketIds is empty or not an array']); return $response->withStatus(400)->withJson(['errors' => 'Bad Request : redirectedBasketIds is empty or not an array']);
} }
$user = UserModel::getById(['id' => $aArgs['id'], 'select' => ['user_id']]);
foreach($data['redirectedBasketIds'] as $redirectedBasketId) { foreach($data['redirectedBasketIds'] as $redirectedBasketId) {
$redirectedBasket = RedirectBasketModel::get(['select' => ['actual_user_id', 'owner_user_id', 'basket_id'], 'where' => ['id = ?'], 'data' => [$redirectedBasketId]]); $redirectedBasket = RedirectBasketModel::get(['select' => ['actual_user_id', 'owner_user_id', 'basket_id'], 'where' => ['id = ?'], 'data' => [$redirectedBasketId]]);
if (empty($redirectedBasket[0]) || ($redirectedBasket[0]['actual_user_id'] != $aArgs['id'] && $redirectedBasket[0]['owner_user_id'] != $aArgs['id'])) { if (empty($redirectedBasket[0]) || ($redirectedBasket[0]['actual_user_id'] != $aArgs['id'] && $redirectedBasket[0]['owner_user_id'] != $aArgs['id'])) {
...@@ -429,7 +430,6 @@ class UserController ...@@ -429,7 +430,6 @@ class UserController
RedirectBasketModel::delete(['where' => ['id = ?'], 'data' => [$redirectedBasketId]]); RedirectBasketModel::delete(['where' => ['id = ?'], 'data' => [$redirectedBasketId]]);
$user = UserModel::getById(['id' => $aArgs['id'], 'select' => ['user_id']]);
HistoryController::add([ HistoryController::add([
'tableName' => 'redirected_baskets', 'tableName' => 'redirected_baskets',
'recordId' => $GLOBALS['userId'], 'recordId' => $GLOBALS['userId'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment