From 54671b7f0f306310c7d1ef45fcf91c77d814e92d Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 7 Jan 2014 17:14:46 +0000 Subject: [PATCH] --- inc/commons/class.common.ajax.php | 714 ++++++++++++++++------------- inc/commons/class.common.tools.php | 2 +- 2 files changed, 386 insertions(+), 330 deletions(-) diff --git a/inc/commons/class.common.ajax.php b/inc/commons/class.common.ajax.php index 1e5543d57..2488fcb45 100644 --- a/inc/commons/class.common.ajax.php +++ b/inc/commons/class.common.ajax.php @@ -1,330 +1,386 @@ - 2 ? ' colspan="' . ($cols - 1) . '"' : ''; - $res = commonPage::bh(); - $res .= '
'; - $res .= ''; - $res .= '

' . $titre . '

'; - $res .= $form; - if ($bouton) { - $res .= ''; - } - $res .= '
' . cubeMedia::image(IMG . '/close.png') . '
' . $core->typo->BoutonOK($bouton) . '
'; - $res .= $extra; - $res .= '
'; - $res .= commonPage::bf(); - - if (!$return) { - echo $res; - exit; - } - return $res; - } - - public static function page($liste, $page) { - global $core; - $core->user->changeSettings($liste, 'page', $page); - $core->sauvePreferencesUtilisateur(); - } - - public static function parPage($liste, $nb) { - global $core; - $core->user->changeSettings($liste, 'par_page', $nb); - $core->user->changeSettings($liste, 'page', 1); - $core->sauvePreferencesUtilisateur(); - } - - public static function sort($liste, $orderby) { - global $core; - $settings = $core->user->getSettings($liste); - if ($orderby == 'facture_id') { - $orderby = 'CAST(facture_id AS SIGNED)'; - } - - if ($settings['orderby'] == $orderby) { - $sens = ($settings['sens'] == 'ASC') ? 'DESC' : 'ASC'; - $core->user->changeSettings($liste, 'orderby', $orderby); - $core->user->changeSettings($liste, 'sens', $sens); - } else { - $core->user->changeSettings($liste, 'orderby', $orderby); - $core->user->changeSettings($liste, 'sens', 'ASC'); - } - $core->sauvePreferencesUtilisateur(); - } - - public static function filtre($liste, $data = null) { - global $core; - $core->user->changeSettings($liste, 'filtres', $data); - $core->user->changeSettings($liste, 'page', 1); - $core->sauvePreferencesUtilisateur(); - } - - public static function motdepasseOublie($args, &$x) { - self::form('recupMotdepasse', 'Mot de passe oublié ?', commonUrl::motdepasseOublie($args), __('Recevoir mon mot de passe par e-mail')); - } - - public static function mesParametres($args, &$x) { - self::form('sauveMesParametres', 'Mes paramètres', commonUrl::mesParametres($args), false); - } - - public static function sauveMesParametres($args, &$x) { - global $core; - $dao = new commonDAOUtilisateur($core->con); - $dao->changeParametres($core->user->utilisateur_id, $_POST['lang'], $_POST['login']); - $x->addRedirection(); - } - - public static function recupMotdepasse($args, &$x) { - global $core; - $dao = new commonDAOUtilisateur($core->con); - $utilisateur = $dao->selectByEmail($_POST['email']); - - if (!is_null($utilisateur) && $utilisateur->enabled) { - $mail = new cubeMail(); - $mail->charset = 'UTF-8'; - $mail->from = FROM_NAME . '<' . FROM_EMAIL . '>'; - $mail->bcc = MAIL_BCC; - $mail->subject = '[' . EMAIL_SUBJECT . '] ' . __('Récupération de vos identifiants'); - $mail->to = $utilisateur->prenom . ' ' . $utilisateur->nom . '<' . $utilisateur->email . '>'; - $body = __('Bonjour,') . "\r\n\r\n"; - $body .= ASK_IDENT . "\r\n"; - $body .= __('Voici toutes les informations vous permettant de vous y connecter à nouveau :') . "\r\n\r\n"; - $body .= __('Adresse') . ' : http://' . $_SERVER['HTTP_HOST'] . '/' . "\r\n"; - $body .= __('Identifiant') . ' : ' . $utilisateur->email . "\r\n"; - $body .= __('Mot de passe') . ' : ' . $utilisateur->password . "\r\n\r\n"; - $body .= __('Cordialement,') . "\r\n"; - $body .= TEAM_NAME; - $mail->body = $body; - $ok = $mail->send(); - $message = $ok ? __('Vos identifiants vous ont été envoyé par e-mail') : __("Une erreur s'est produite lors de l'envoi de vos identifiants"); - } else { - $message = __('Cet e-mail ne correspond à aucun utilisateur du système'); - } - $x->addAlert($message); - $x->addClosePopup(); - } - - public static function changeMotdepasse($args, &$x) { - self::form('sauveMotdepasse', 'Changer mon mot de passe', commonUrl::changeMotdepasse(), __('Enregistrer mon nouveau mot de passe')); - } - - public static function sauveMotdepasse($args, &$x) { - global $core; - - $ok = true; - if ($_POST['actuel'] != $core->user->password) { - $x->addError('actuel', ''); - $ok = false; - } else { - $x->addOk('actuel'); - } - - if (strlen($_POST['nouveau']) > 10 || strlen($_POST['nouveau']) < 6 || $_POST['nouveau'] != $_POST['confirmation']) { - $x->addError('nouveau', ''); - $x->addError('confirmation', ''); - $ok = false; - } else { - $x->addOk('nouveau'); - $x->addOk('confirmation'); - } - - if ($ok) { - $dao = new commonDAOUtilisateur($core->con); - $dao->changeMotdepasse($core->user->utilisateur_id, $_POST['nouveau']); - - $_SESSION['user_password'] = $_POST['password']; - $x->addClosePopup(); - $x->addAlert(__('Votre mot de passe a été modifié')); - } - } - - public static function connectAs($args, &$x) { - global $core; - $dao = new commonDAOUtilisateur($core->con); - $utilisateur = $dao->selectById($args[1]); - - $_SESSION['user_email'] = $utilisateur->email; - $_SESSION['user_password'] = $utilisateur->password; - - $x->addRedirection(SITE_PATH); - } - - public static function sortFichiers($args, &$x) { - commonAjax::sort('fichiers', $args[1]); - $x->addContent('listeFichiers', commonUrl::listeFichiers()); - } - - public static function pageFichiers($args, &$x) { - commonAjax::page('fichiers', $args[1]); - $x->addContent('listeFichiers', commonUrl::listeFichiers()); - } - - public static function parPageFichiers($args, &$x) { - commonAjax::parPage('fichiers', $_POST['par_page']); - $x->addContent('listeFichiers', commonUrl::listeFichiers()); - } - - public static function searchFichiers($args, &$x) { - $x->addContent('listeFichiers', commonUrl::listeFichiers()); - } - - public static function refreshFichiers($args, &$x) { - $x->addContent('listeFichiers', commonUrl::listeFichiers()); - } - - public static function supprimeFichier($args, &$x) { - global $core; - - array_shift($args); - $path = implode('/', $args); - $entreprise = array_shift($args); - commonDroits::telecharger($entreprise); - - $dao = new commonDAOFichier($core->con); - $dao->supprime($path); - $x->addContent('listeFichiers', commonUrl::listeFichiers()); - } - - public static function formDashboard($args, &$x) { - commonAjax::form('saveDashboard', __('Ajouter un élément au dashboard'), commonUrl::formDashboard($args)); - } - - public static function saveDashboard($args, &$x) { - global $core; - - $c = $core->con->openCursor('dashboard'); - $c->site = MODE; - $c->nom = $_POST['nom']; - if ($_POST['dashboard_id'] == 'new') { - $c->rubrique = $_POST['rubrique']; - $c->equipier = $core->user->utilisateur_id; - $c->settings = serialize($core->user->getSettings($_POST['rubrique'])); - $r = $core->con->select('SELECT MAX(dashboard_id) AS dashboard_id FROM dashboard'); - $c->dashboard_id = $r->dashboard_id + 1; - $c->insert(); - } else { - $c->update('WHERE dashboard_id=\'' . $_POST['dashboard_id'] . '\''); - } - $x->addRedirection(SITE_PATH); - } - - public static function pageDashboard($args, &$x) { - $settings = self::getDashboardSettings($args[1]); - $settings['page'] = $args[2]; - $r = self::saveDashboardSettings($args[1], $settings); - $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); - } - - public static function parPageDashboard($args, &$x) { - $settings = self::getDashboardSettings($args[1]); - $settings['par_page'] = $_POST['par_page']; - $settings['page'] = 1; - $r = self::saveDashboardSettings($args[1], $settings); - $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); - } - - public static function sortDashboard($args, &$x) { - $settings = self::getDashboardSettings($args[1]); - if ($settings['orderby'] == $args[2]) { - $settings['sens'] = ($settings['sens'] == 'ASC') ? 'DESC' : 'ASC'; - } else { - $settings['orderby'] = $args[2]; - $settings['sens'] = 'ASC'; - } - $r = self::saveDashboardSettings($args[1], $settings); - $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); - } - - public static function saveDashboardSettings($dashboard, $settings) { - global $core; - - $settings['page'] = $settings['page'] ? $settings['page'] : 1; - - if ($settings['par_page'] > 0) { - $settings['limit'] = array(($settings['page'] - 1) * $settings['par_page'], $settings['par_page']); - } else { - $settings['limit'] = null; - } - - $c = $core->con->openCursor('dashboard'); - $c->settings = serialize($settings); - $c->update('WHERE dashboard_id=' . $dashboard); - return $core->con->select('SELECT * FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($dashboard) . '\''); - } - - public static function getDashboardSettings($dashboard) { - global $core; - $r = $core->con->select('SELECT * FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($dashboard) . '\''); - return unserialize($r->settings); - } - - public static function delDashboard($args, &$x) { - global $core; - $r = $core->con->execute('DELETE FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\' AND equipier=\'' . $core->user->utilisateur_id . '\''); - $x->addReplace('dashboard_' . $args[1], ''); - } - - public static function reloadDashboards($args, &$x) { - $x->addContent('dash', commonUrl::listeDashboard(array())); - } - - public static function orderDashboards($args, &$x) { - global $core; - $c = $core->con->openCursor('dashboard'); - $i = 1; - foreach ($_GET['dashboard'] as $id) { - $c->sort = $i; - $c->update('WHERE dashboard_id=\'' . $core->con->escape($id) . '\''); - $i++; - } - } - - public static function toggleDashboard($args, &$x) { - global $core; - - $r = $core->con->select('SELECT state FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\''); - $new = ($r->state == '1') ? '0' : '1'; - - $c = $core->con->openCursor('dashboard'); - $c->state = $new; - $c->update('WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\''); - } - - public static function syncftp($args, &$x) { - commonDroits::min(5); - $u = parse_url('ftp://' . ltrim($_POST['dest'], '/')); - if (!isset($u['port'])) { - $u['port'] = '21'; - } - - $commandes = array( - 'set ftp:passive-mode ' . $_POST['mode'], - 'mkdir -p ' . $u['path'], - 'cd ' . $u['path'], - 'lcd ' . $_POST['source'], - 'mirror -Rve --parallel=5' - ); - - //$lftp->setManualArg( . '> mirror -Rv ' . $package); - - $lftp = new cubeCommandLine('lftp'); - $lftp->setArg('u', $u['user'] . ',' . $u['pass']); - $lftp->setArg('p', $u['port']); - $lftp->setArg('e', implode(';', $commandes)); - $lftp->setArg(null, $u['host']); - $lftp->execute(); - - $x->addValue('res', utf8_encode($lftp->output)); - } - -} - + 2 ? ' colspan="' . ($cols - 1) . '"' : ''; + $res = commonPage::bh(); + $res .= '
'; + $res .= ''; + $res .= '

' . $titre . '

'; + $res .= $form; + if ($bouton) { + $res .= ''; + } + $res .= '
' . cubeMedia::image(IMG . '/close.png') . '
' . $core->typo->BoutonOK($bouton) . '
'; + $res .= $extra; + $res .= '
'; + $res .= commonPage::bf(); + + if (!$return) { + echo $res; + exit; + } + return $res; + } + + public static function page($liste, $page) { + global $core; + $core->user->changeSettings($liste, 'page', $page); + $core->sauvePreferencesUtilisateur(); + } + + public static function parPage($liste, $nb) { + global $core; + $core->user->changeSettings($liste, 'par_page', $nb); + $core->user->changeSettings($liste, 'page', 1); + $core->sauvePreferencesUtilisateur(); + } + + public static function sort($liste, $orderby) { + global $core; + $settings = $core->user->getSettings($liste); + if ($orderby == 'facture_id') { + $orderby = 'CAST(facture_id AS SIGNED)'; + } + + if ($settings['orderby'] == $orderby) { + $sens = ($settings['sens'] == 'ASC') ? 'DESC' : 'ASC'; + $core->user->changeSettings($liste, 'orderby', $orderby); + $core->user->changeSettings($liste, 'sens', $sens); + } else { + $core->user->changeSettings($liste, 'orderby', $orderby); + $core->user->changeSettings($liste, 'sens', 'ASC'); + } + $core->sauvePreferencesUtilisateur(); + } + + public static function filtre($liste, $data = null) { + global $core; + $core->user->changeSettings($liste, 'filtres', $data); + $core->user->changeSettings($liste, 'page', 1); + $core->sauvePreferencesUtilisateur(); + } + + public static function motdepasseOublie($args, &$x) { + self::form('recupMotdepasse', 'Mot de passe oublié ?', commonUrl::motdepasseOublie($args), __('Recevoir mon mot de passe par e-mail')); + } + + public static function mesParametres($args, &$x) { + self::form('sauveMesParametres', 'Mes paramètres', commonUrl::mesParametres($args), false); + } + + public static function sauveMesParametres($args, &$x) { + global $core; + $dao = new commonDAOUtilisateur($core->con); + $dao->changeParametres($core->user->utilisateur_id, $_POST['lang'], $_POST['login']); + $x->addRedirection(); + } + + public static function recupMotdepasse($args, &$x) { + global $core; + $dao = new commonDAOUtilisateur($core->con); + $utilisateur = $dao->selectByEmail($_POST['email']); + + if (!is_null($utilisateur) && $utilisateur->enabled) { + $mail = new cubeMail(); + $mail->charset = 'UTF-8'; + $mail->from = FROM_NAME . '<' . FROM_EMAIL . '>'; + $mail->bcc = MAIL_BCC; + $mail->subject = '[' . EMAIL_SUBJECT . '] ' . __('Récupération de vos identifiants'); + $mail->to = $utilisateur->prenom . ' ' . $utilisateur->nom . '<' . $utilisateur->email . '>'; + $body = __('Bonjour,') . "\r\n\r\n"; + $body .= ASK_IDENT . "\r\n"; + $body .= __('Voici toutes les informations vous permettant de vous y connecter à nouveau :') . "\r\n\r\n"; + $body .= __('Adresse') . ' : http://' . $_SERVER['HTTP_HOST'] . '/' . "\r\n"; + $body .= __('Identifiant') . ' : ' . $utilisateur->email . "\r\n"; + $body .= __('Mot de passe') . ' : ' . $utilisateur->password . "\r\n\r\n"; + $body .= __('Cordialement,') . "\r\n"; + $body .= TEAM_NAME; + $mail->body = $body; + $ok = $mail->send(); + $message = $ok ? __('Vos identifiants vous ont été envoyé par e-mail') : __("Une erreur s'est produite lors de l'envoi de vos identifiants"); + } else { + $message = __('Cet e-mail ne correspond à aucun utilisateur du système'); + } + $x->addAlert($message); + $x->addClosePopup(); + } + + public static function changeMotdepasse($args, &$x) { + self::form('sauveMotdepasse', 'Changer mon mot de passe', commonUrl::changeMotdepasse(), __('Enregistrer mon nouveau mot de passe')); + } + + public static function sauveMotdepasse($args, &$x) { + global $core; + + $ok = true; + if ($_POST['actuel'] != $core->user->password) { + $x->addError('actuel', ''); + $ok = false; + } else { + $x->addOk('actuel'); + } + + if (strlen($_POST['nouveau']) > 10 || strlen($_POST['nouveau']) < 6 || $_POST['nouveau'] != $_POST['confirmation']) { + $x->addError('nouveau', ''); + $x->addError('confirmation', ''); + $ok = false; + } else { + $x->addOk('nouveau'); + $x->addOk('confirmation'); + } + + if ($ok) { + $dao = new commonDAOUtilisateur($core->con); + $dao->changeMotdepasse($core->user->utilisateur_id, $_POST['nouveau']); + + $_SESSION['user_password'] = $_POST['password']; + $x->addClosePopup(); + $x->addAlert(__('Votre mot de passe a été modifié')); + } + } + + public static function connectAs($args, &$x) { + global $core; + $dao = new commonDAOUtilisateur($core->con); + $utilisateur = $dao->selectById($args[1]); + + $_SESSION['user_email'] = $utilisateur->email; + $_SESSION['user_password'] = $utilisateur->password; + + $x->addRedirection(SITE_PATH); + } + + public static function sortFichiers($args, &$x) { + commonAjax::sort('fichiers', $args[1]); + $x->addContent('listeFichiers', commonUrl::listeFichiers()); + } + + public static function pageFichiers($args, &$x) { + commonAjax::page('fichiers', $args[1]); + $x->addContent('listeFichiers', commonUrl::listeFichiers()); + } + + public static function parPageFichiers($args, &$x) { + commonAjax::parPage('fichiers', $_POST['par_page']); + $x->addContent('listeFichiers', commonUrl::listeFichiers()); + } + + public static function searchFichiers($args, &$x) { + $x->addContent('listeFichiers', commonUrl::listeFichiers()); + } + + public static function refreshFichiers($args, &$x) { + $x->addContent('listeFichiers', commonUrl::listeFichiers()); + } + + public static function supprimeFichier($args, &$x) { + global $core; + + array_shift($args); + $path = implode('/', $args); + $entreprise = array_shift($args); + commonDroits::telecharger($entreprise); + + $dao = new commonDAOFichier($core->con); + $dao->supprime($path); + $x->addContent('listeFichiers', commonUrl::listeFichiers()); + } + + public static function formDashboard($args, &$x) { + commonAjax::form('saveDashboard', __('Ajouter un élément au dashboard'), commonUrl::formDashboard($args)); + } + + public static function saveDashboard($args, &$x) { + global $core; + + $c = $core->con->openCursor('dashboard'); + $c->site = MODE; + $c->nom = $_POST['nom']; + if ($_POST['dashboard_id'] == 'new') { + $c->rubrique = $_POST['rubrique']; + $c->equipier = $core->user->utilisateur_id; + $c->settings = serialize($core->user->getSettings($_POST['rubrique'])); + $r = $core->con->select('SELECT MAX(dashboard_id) AS dashboard_id FROM dashboard'); + $c->dashboard_id = $r->dashboard_id + 1; + $c->insert(); + } else { + $c->update('WHERE dashboard_id=\'' . $_POST['dashboard_id'] . '\''); + } + $x->addRedirection(SITE_PATH); + } + + public static function pageDashboard($args, &$x) { + $settings = self::getDashboardSettings($args[1]); + $settings['page'] = $args[2]; + $r = self::saveDashboardSettings($args[1], $settings); + $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); + } + + public static function parPageDashboard($args, &$x) { + $settings = self::getDashboardSettings($args[1]); + $settings['par_page'] = $_POST['par_page']; + $settings['page'] = 1; + $r = self::saveDashboardSettings($args[1], $settings); + $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); + } + + public static function sortDashboard($args, &$x) { + $settings = self::getDashboardSettings($args[1]); + if ($settings['orderby'] == $args[2]) { + $settings['sens'] = ($settings['sens'] == 'ASC') ? 'DESC' : 'ASC'; + } else { + $settings['orderby'] = $args[2]; + $settings['sens'] = 'ASC'; + } + $r = self::saveDashboardSettings($args[1], $settings); + $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); + } + + public static function saveDashboardSettings($dashboard, $settings) { + global $core; + + $settings['page'] = $settings['page'] ? $settings['page'] : 1; + + if ($settings['par_page'] > 0) { + $settings['limit'] = array(($settings['page'] - 1) * $settings['par_page'], $settings['par_page']); + } else { + $settings['limit'] = null; + } + + $c = $core->con->openCursor('dashboard'); + $c->settings = serialize($settings); + $c->update('WHERE dashboard_id=' . $dashboard); + return $core->con->select('SELECT * FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($dashboard) . '\''); + } + + public static function getDashboardSettings($dashboard) { + global $core; + $r = $core->con->select('SELECT * FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($dashboard) . '\''); + return unserialize($r->settings); + } + + public static function delDashboard($args, &$x) { + global $core; + $r = $core->con->execute('DELETE FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\' AND equipier=\'' . $core->user->utilisateur_id . '\''); + $x->addReplace('dashboard_' . $args[1], ''); + } + + public static function reloadDashboards($args, &$x) { + $x->addContent('dash', commonUrl::listeDashboard(array())); + } + + public static function orderDashboards($args, &$x) { + global $core; + $c = $core->con->openCursor('dashboard'); + $i = 1; + foreach ($_GET['dashboard'] as $id) { + $c->sort = $i; + $c->update('WHERE dashboard_id=\'' . $core->con->escape($id) . '\''); + $i++; + } + } + + public static function toggleDashboard($args, &$x) { + global $core; + + $r = $core->con->select('SELECT state FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\''); + $new = ($r->state == '1') ? '0' : '1'; + + $c = $core->con->openCursor('dashboard'); + $c->state = $new; + $c->update('WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\''); + } + + public static function syncftp($args, &$x) { + commonDroits::min(5); + $u = parse_url('ftp://' . ltrim($_POST['dest'], '/')); + if (!isset($u['port'])) { + $u['port'] = '21'; + } + + $commandes = array( + 'set ftp:passive-mode ' . $_POST['mode'], + 'mkdir -p ' . $u['path'], + 'cd ' . $u['path'], + 'lcd ' . $_POST['source'], + 'mirror -Rve --parallel=5' + ); + + //$lftp->setManualArg( . '> mirror -Rv ' . $package); + + $lftp = new cubeCommandLine('lftp'); + $lftp->setArg('u', $u['user'] . ',' . $u['pass']); + $lftp->setArg('p', $u['port']); + $lftp->setArg('e', implode(';', $commandes)); + $lftp->setArg(null, $u['host']); + $lftp->execute(); + + $x->addValue('res', utf8_encode($lftp->output)); + } + + public static function createDevSpace($args, &$x) { + + global $core; + + $domain = $_POST['domain']; + $svn = $_POST['svn']; + $user = $_POST['user']; + $zend = $_POST['zend']; + if (!$user) { + $user = $domain; + } + if (!$svn) { + $svn = $domain; + } + + $domain = cubeText::str2URL($domain); + $user = cubeText::str2URL($user); + $svn = cubeText::str2URL($svn); + $password = CubeIT_Crypt::generateRandomString(10); + $zend = cubeText::str2URL($zend); + $zend = cubeText::ucfirst($zend); + + $body = "Adresse : http://$domain.dev.cubedesigners.com + +SSH : $domain.dev.cubedesigners.com +Nom d'utilisateur : $user +Mot de passe : $password +Chemin : /home/$user/www +Port : 22 + +Base de données MySQL : https://chihiro.fluidbook.com/phpmyadmin/ +Hôte : localhost +Nom d'utilisateur : $user +Nom de la base : $user +Mot de passe : $password + +SVN : svn+ssh://svn@svn.cubedesigners.com/projects/$svn"; + + $mail = new cubeMail(); + $mail->charset = 'UTF-8'; + $mail->from = 'extranet@cubedesigners.com'; + $mail->to = $core->user->email; + $mail->subject = 'Création de l\'espace de développement "' . $domain . '"'; + $mail->body = $body; + $mail->send(); + + $args = "-l $user -d $svn -o $domain -u $user -p $password"; + if ($zend) { + $args.=" -n $zend"; + } + + `ssh root@chihiro.cubedesigners.com /usr/local/bin/tools/projectcreator/make.php $args`; + + $x->addAlert('Espace de développement crée. Vous allez recevoir un mail récapitulant les identifiants de l\'espace crée'); + } + +} + ?> \ No newline at end of file diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 16f53d88b..1fe201f52 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -903,7 +903,7 @@ class commonTools { $res.='Sous-domaine' . form::field('domain', 20, 512) . '.dev.cubedesigners.com'; $res.='SVNsvn+ssh://svn@svn.cubedesigners.com/projects/' . form::field('svn', 20, 512) . ''; $res.='Utilisateur' . form::field('user', 20, 512) . ' (' . __('Si différent du sous-domaine') . ')'; - $res.='Password' . form::field('password', 20, 512, CubeIT_Crypt::generateRandomString(10)) . ''; + $res.='Namespace Zend' . form::field('zend', 20, 512) . ' (' . __('Laisser vide pour un projet vide') . ')'; $res.='' . $core->typo->BoutonOK(__('Création')) . ''; $res.=''; $res.=''; -- 2.39.5