From 62cf6acac1819e7ccc2c2ca5d9189c861d23df51 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 8 Oct 2018 12:49:32 +0000 Subject: [PATCH] fix #2291 @2.5 --- inc/commons/class.common.ajax.php | 106 ++++++++++++++------ inc/commons/class.common.tools.php | 24 +++++ inc/ws/Controlleur/class.ws.maintenance.php | 2 +- 3 files changed, 99 insertions(+), 33 deletions(-) diff --git a/inc/commons/class.common.ajax.php b/inc/commons/class.common.ajax.php index b829ee90f..c52cf16f6 100644 --- a/inc/commons/class.common.ajax.php +++ b/inc/commons/class.common.ajax.php @@ -1,8 +1,10 @@ user->changeSettings($liste, 'page', $page); $core->sauvePreferencesUtilisateur(); } - public static function parPage($liste, $nb) { + 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) { + public static function sort($liste, $orderby) + { global $core; $settings = $core->user->getSettings($liste); if ($orderby == 'facture_id') { @@ -60,29 +65,34 @@ class commonAjax { $core->sauvePreferencesUtilisateur(); } - public static function filtre($liste, $data = null) { + 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) { + 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) { + public static function mesParametres($args, &$x) + { self::form('sauveMesParametres', 'Mes paramètres', commonUrl::mesParametres($args), false); } - public static function sauveMesParametres($args, &$x) { + 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) { + public static function recupMotdepasse($args, &$x) + { global $core; $dao = new commonDAOUtilisateur($core->con); $utilisateur = $dao->selectByEmail($_POST['email']); @@ -112,11 +122,13 @@ class commonAjax { $x->addClosePopup(); } - public static function changeMotdepasse($args, &$x) { + 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) { + public static function sauveMotdepasse($args, &$x) + { global $core; $ok = true; @@ -157,30 +169,36 @@ class commonAjax { // $x->addRedirection(SITE_PATH); // } - public static function sortFichiers($args, &$x) { + public static function sortFichiers($args, &$x) + { commonAjax::sort('fichiers', $args[1]); $x->addContent('listeFichiers', commonUrl::listeFichiers()); } - public static function pageFichiers($args, &$x) { + public static function pageFichiers($args, &$x) + { commonAjax::page('fichiers', $args[1]); $x->addContent('listeFichiers', commonUrl::listeFichiers()); } - public static function parPageFichiers($args, &$x) { + public static function parPageFichiers($args, &$x) + { commonAjax::parPage('fichiers', $_POST['par_page']); $x->addContent('listeFichiers', commonUrl::listeFichiers()); } - public static function searchFichiers($args, &$x) { + public static function searchFichiers($args, &$x) + { $x->addContent('listeFichiers', commonUrl::listeFichiers()); } - public static function refreshFichiers($args, &$x) { + public static function refreshFichiers($args, &$x) + { $x->addContent('listeFichiers', commonUrl::listeFichiers()); } - public static function supprimeFichier($args, &$x) { + public static function supprimeFichier($args, &$x) + { global $core; array_shift($args); @@ -193,11 +211,13 @@ class commonAjax { $x->addContent('listeFichiers', commonUrl::listeFichiers()); } - public static function formDashboard($args, &$x) { + public static function formDashboard($args, &$x) + { commonAjax::form('saveDashboard', __('Ajouter un élément au dashboard'), commonUrl::formDashboard($args)); } - public static function saveDashboard($args, &$x) { + public static function saveDashboard($args, &$x) + { global $core; $c = $core->con->openCursor('dashboard'); @@ -216,14 +236,16 @@ class commonAjax { $x->addRedirection(SITE_PATH); } - public static function pageDashboard($args, &$x) { + 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) { + public static function parPageDashboard($args, &$x) + { $settings = self::getDashboardSettings($args[1]); $settings['par_page'] = $_POST['par_page']; $settings['page'] = 1; @@ -231,7 +253,8 @@ class commonAjax { $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); } - public static function sortDashboard($args, &$x) { + public static function sortDashboard($args, &$x) + { $settings = self::getDashboardSettings($args[1]); if ($settings['orderby'] == $args[2]) { $settings['sens'] = ($settings['sens'] == 'ASC') ? 'DESC' : 'ASC'; @@ -243,7 +266,8 @@ class commonAjax { $x->addContent('dashboard_' . $args[1], commonUrl::displayDashboard($r)); } - public static function saveDashboardSettings($dashboard, $settings) { + public static function saveDashboardSettings($dashboard, $settings) + { global $core; $settings['page'] = $settings['page'] ? $settings['page'] : 1; @@ -260,23 +284,27 @@ class commonAjax { return $core->con->select('SELECT * FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($dashboard) . '\''); } - public static function getDashboardSettings($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) { + 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) { + public static function reloadDashboards($args, &$x) + { $x->addContent('dash', commonUrl::listeDashboard(array())); } - public static function orderDashboards($args, &$x) { + public static function orderDashboards($args, &$x) + { global $core; $c = $core->con->openCursor('dashboard'); $i = 1; @@ -287,7 +315,8 @@ class commonAjax { } } - public static function toggleDashboard($args, &$x) { + public static function toggleDashboard($args, &$x) + { global $core; $r = $core->con->select('SELECT state FROM dashboard WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\''); @@ -298,7 +327,8 @@ class commonAjax { $c->update('WHERE dashboard_id=\'' . $core->con->escape($args[1]) . '\''); } - public static function syncftp($args, &$x) { + public static function syncftp($args, &$x) + { set_time_limit(0); commonDroits::min(5); $u = parse_url('ftp://' . ltrim($_POST['dest'], '/')); @@ -330,7 +360,18 @@ class commonAjax { $x->addValue('res', utf8_encode($lftp->output)); } - public static function createDevSpace($args, &$x) { + public static function createGitRepos($args, &$x) + { + commonDroits::min(1); + $repos = $_POST['repos'] . '.git'; + $dir = "/mnt/sshfs/batman/home/git/repositories/$repos"; + `git init --bare $dir`; + `ln -s /home/git/.gitolite/hooks/common/post-receive $dir/hooks/post-receive`; + $x->addContent('res', 'Dépot crée :
git clone git@git.cubedesigners.com:' . $repos . '
'); + } + + public static function createDevSpace($args, &$x) + { commonDroits::min(1); global $core; @@ -413,7 +454,8 @@ Mot de passe : $password"; $x->addAlert('Espace de développement crée. Vous allez recevoir un mail récapitulant les identifiants de l\'espace crée'); } - public static function postMailer($args, &$x) { + public static function postMailer($args, &$x) + { $mail = new CubeIT_Mail_Mailjet(); $mail->setFrom($_POST['from']); $to = explode(',', $_POST['to']); diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 90db7e2d8..aae3a20b6 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -944,6 +944,30 @@ class commonTools return $res; } + public static function createGitRepos() + { + commonDroits::min(1); + global $core; + + $res = commonPage::barre(); + $res .= commonPage::tMain(); + $res .= commonPage::bh(); + $res .= '
'; + $res .= '
'; + $res .= ''; + $res .= ''; + $res .= ''; + $res .= ''; + $res .= '
' . __('Création d\'un dépôt git') . '
' . __('Dépôt') . 'git@git.cubedesigners.com:' . form::field('repos', 20, 512) . '.git
' . $core->typo->BoutonOK(__('Création')) . '
'; + $res .= '
'; + $res .= '
'; + $res .= ''; + $res .= commonPage::bf(); + $res .= commonPage::bMain(); + return $res; + } + + public static function mailer() { commonDroits::min(1); diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index d0ec37ac2..ddb739c72 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -1633,7 +1633,7 @@ class wsMaintenance { $exporter = new wsExporter(); $exporter->export(16328, $x, 'install_ftp', 'online', "wescogrolj-catalogca:b9uA7U72eW@ftp.cluster023.hosting.ovh.net", ''); - header('Location: https://wesco-group.com/download/Catalogues/2018/Wesco_Rapport_ventes_0-12-ans'); + header('Location: https://agefard:TB6x9gg9@wesco-group.com/download/Catalogues/2018/Wesco_Rapport_ventes_0-12-ans'); exit; } -- 2.39.5