]> _ Git - cubeextranet.git/commitdiff
fix #2291 @2.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 8 Oct 2018 12:49:32 +0000 (12:49 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 8 Oct 2018 12:49:32 +0000 (12:49 +0000)
inc/commons/class.common.ajax.php
inc/commons/class.common.tools.php
inc/ws/Controlleur/class.ws.maintenance.php

index b829ee90f1f7a0496b44cc648a6301db9303c5f7..c52cf16f605efa591ee58ce161ca8d887b9acbdc 100644 (file)
@@ -1,8 +1,10 @@
 <?php
 
-class commonAjax {
+class commonAjax
+{
 
-       public static function form($action, $titre, $form, $bouton = null, $cols = 2, $class = '', $extra = '', $return = false) {
+       public static function form($action, $titre, $form, $bouton = null, $cols = 2, $class = '', $extra = '', $return = false)
+       {
                global $core;
                if ($class != '') {
                        $class = ' ' . $class;
@@ -29,20 +31,23 @@ class commonAjax {
                return $res;
        }
 
-       public static function page($liste, $page) {
+       public static function page($liste, $page)
+       {
                global $core;
                $core->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 : <pre>git clone git@git.cubedesigners.com:' . $repos . '</pre>');
+       }
+
+       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']);
index 90db7e2d845885e1eaf5b172ebb6b3bc63b28485..aae3a20b640d2ecb2bde70a182c9540b2d0328d1 100644 (file)
@@ -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 .= '<form action="createGitRepos" method="post">';
+               $res .= '<div id="res">';
+               $res .= '<table class="liste">';
+               $res .= '<tr><th colspan="2"><strong>' . __('Création d\'un dépôt git') . '</strong></th></tr>';
+               $res .= '<tr><td>' . __('Dépôt') . '</td><td>git@git.cubedesigners.com:' . form::field('repos', 20, 512) . '.git</td></tr>';
+               $res .= '<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Création')) . '</a></td></td>';
+               $res .= '</table>';
+               $res .= '</div>';
+               $res .= '</form>';
+               $res .= '</div>';
+               $res .= commonPage::bf();
+               $res .= commonPage::bMain();
+               return $res;
+       }
+
+
        public static function mailer()
        {
                commonDroits::min(1);
index d0ec37ac2bf3418834b0bc2bcf673357c54711d8..ddb739c72a79145f4dfa73a0a07520691cc0a1ac 100644 (file)
@@ -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;
        }