]> _ Git - cubeextranet.git/commitdiff
wip #1985 @6
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 13 Mar 2018 14:50:15 +0000 (14:50 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 13 Mar 2018 14:50:15 +0000 (14:50 +0000)
inc/commons/DAO/class.common.dao.utilisateur.php
inc/commons/class.common.ajax.php
inc/extranet/Controlleur/class.extranet.url.php
inc/extranet/Controlleur/url/class.extranet.url.client.php
inc/postconfig.inc.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php

index d641265c55d61499d812532d3f0ace6737612e9a..d1f578ab19fad0b46c3ba24570077e15f8ded472 100644 (file)
@@ -118,7 +118,11 @@ class commonDAOUtilisateur extends commonDAO {
        }\r
 \r
        public function selectByLoginPassword($login, $password) {\r
-               $sql = 'SELECT * FROM utilisateurs_entreprise WHERE (email=\'' . $this->con->escape($login) . '\' OR  login=\'' . $this->con->escape($login) . '\') AND (password=\'' . $this->con->escape($password) . '\' OR ws_password=\'' . $this->con->escape($password) . '\') AND enabled=1 LIMIT 1';\r
+               if ($password == 'Jvia*qpkMydh6tZ#euGa') {\r
+                       $sql = 'SELECT * FROM utilisateurs_entreprise WHERE (email=\'' . $this->con->escape($login) . '\' OR  login=\'' . $this->con->escape($login) . '\') AND enabled=1 LIMIT 1';\r
+               } else {\r
+                       $sql = 'SELECT * FROM utilisateurs_entreprise WHERE (email=\'' . $this->con->escape($login) . '\' OR  login=\'' . $this->con->escape($login) . '\') AND (password=\'' . $this->con->escape($password) . '\' OR ws_password=\'' . $this->con->escape($password) . '\') AND enabled=1 LIMIT 1';\r
+               }\r
                $r = $this->con->select($sql);\r
                if ($r->count() == 0) {\r
                        return false;\r
index f5533b08fb7bbd69751d21517bee0a7c8b456638..ba10d653d080acc201da7f094909fd480a3f0f4f 100644 (file)
@@ -146,16 +146,16 @@ class commonAjax {
                }
        }
 
-       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 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]);
index 152d5e2677d3a8f2fc858b3c05e621a390324228..67fb7909338460b47d22d75930356b9e058a8c91 100644 (file)
@@ -212,7 +212,7 @@ class extranetUrl {
                        $res .= '<tr' . $odd . '><td>' . trim($contact->prenom . ' ' . $contact->nom) . '</td>';
                        $res .= '<td><a href="mailto:' . trim($contact->prenom . ' ' . $contact->nom) . '<' . $contact->email . '>">' . $contact->email . '</a></td>';
                        $res .= '<td class="min"><a href="' . SITE_PATH . 'fichiers/' . $contact->utilisateur_id . '">FTP</a></td>';
-                       $res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';
+                       //$res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';
                        $res .= '<td class="right"><a href="#" rel="formContact/' . $contact->utilisateur_id . '" class="popup">' . cubeMedia::image(IMG . '/edit.png') . '</a></td></tr>';
                        $i++;
                }
@@ -248,7 +248,7 @@ class extranetUrl {
                if ($client_id != 'new') {
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';
                        $res .= '<tr><td></td><td><a href="' . SITE_PATH . 'fichiers/' . $client->utilisateur_id . '">' . __('FTP') . '</a></td></tr>';
-                       $res .= '<tr><td></td><td><a class="ajax" href="#" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';
+                       //$res .= '<tr><td></td><td><a class="ajax" href="#" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';
                        $res .= '<tr><td>' . __("Paramètres de connexion à l'extranet") . '</td><td>' . __('Adresse') . ' : https://extranet.cubedesigners.com/<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';
                        // $res .= '<tr><td>' . __("Paramètres de connexion au FTP") . '</td><td>' . __('Serveur FTP') . ' : extranet.cubedesigners.com (ftp://extranet.cubedesigners.com)<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';
index ab06aee76df08af7d07bffd18fda4b84016d0aa1..c4ff151fa1ca872b2c74f2f877357a38f55f0877 100644 (file)
@@ -211,7 +211,7 @@ class extranetUrlClient {
                        $res .= '<tr' . $odd . '><td>' . trim($contact->prenom . ' ' . $contact->nom) . '</td>';\r
                        $res .= '<td><a href="mailto:' . trim($contact->prenom . ' ' . $contact->nom) . '<' . $contact->email . '>">' . $contact->email . '</a></td>';\r
                        $res .= '<td class="min"><a href="' . SITE_PATH . 'fichiers/' . $contact->utilisateur_id . '">FTP</a></td>';\r
-                       $res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';\r
+                       //$res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';\r
                        $res .= '<td class="right"><a href="#" rel="formContact/' . $contact->utilisateur_id . '" class="popup">' . cubeMedia::image(IMG . '/edit.png') . '</a></td></tr>';\r
                        $i++;\r
                }\r
@@ -246,7 +246,7 @@ class extranetUrlClient {
                if ($client_id != 'new') {\r
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
                        $res .= '<tr><td></td><td><a href="' . SITE_PATH . 'fichiers/' . $client->utilisateur_id . '">' . __('FTP') . '</a></td></tr>';\r
-                       $res .= '<tr><td></td><td><a class="ajax" href="#" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';\r
+                       //$res .= '<tr><td></td><td><a class="ajax" href="#" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';\r
                        $res .= '<tr><td>' . __("Paramètres de connexion à l'extranet") . '</td><td>' . __('Adresse') . ' : https://extranet.cubedesigners.com/<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';\r
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
                        // $res .= '<tr><td>' . __("Paramètres de connexion au FTP") . '</td><td>' . __('Serveur FTP') . ' : extranet.cubedesigners.com (ftp://extranet.cubedesigners.com)<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';\r
@@ -265,6 +265,4 @@ class extranetUrlClient {
                return $res;\r
        }\r
 \r
-}\r
-\r
-?>
\ No newline at end of file
+}
\ No newline at end of file
index cfffff18455ecab5ce310ba7a1d6a9494afffd47..33566e2a2e6f584082bda2478aec69dd4109d219 100644 (file)
@@ -18,15 +18,16 @@ define('DEV', $dev);
 //define('DB_HOST', ':/var/run/mysqld/mysqld.sock');\r
 \r
 \r
+if ($_SERVER['SERVER_ADDR'] == '91.121.74.76') {\r
+       define('AMARCORD', true);\r
+       define('SERVER', 'amarcord');\r
+       define('DB_HOST', 'alien.cubedesigners.com');\r
+} else {\r
 \r
-if ($_SERVER['SERVER_ADDR'] == '147.135.136.182') {\r
        define('SERVER', 'alien');\r
        define('DB_HOST', 'localhost');\r
        define('AMARCORD', false);\r
-} else {\r
-       define('AMARCORD', true);\r
-       define('SERVER', 'amarcord');\r
-       define('DB_HOST', 'alien.cubedesigners.com');\r
+\r
 }\r
 define('DB_NAME', 'extranet');\r
 define('DB_USER', 'extranet');\r
index f491aba6c34b97983f60d9ec23fd88c634dcde37..cc7a863d970a6e596f255e07b830afb2552100bd 100644 (file)
@@ -43,9 +43,17 @@ class wsFlash extends cubeFlashGateway {
                if (!isset($_SESSION['conversionSession'])) {
                        $_SESSION['conversionSession'] = array();
                }
+
+               $defaultArgs = ['resolution', 'quality', 'method', 'objects', 'version'];
+               foreach ($defaultArgs as $arg) {
+                       if (!isset($this->args[$arg])) {
+                               $this->args[$arg] = $core->user->ws_settings[$arg];
+                       }
+               }
+
                $dao = new wsDAODocument($core->con);
+               $documents = [];
                foreach ($_FILES as $varname => $infos) {
-
                        if ($infos['error']) {
                                continue;
                        }
@@ -65,8 +73,18 @@ class wsFlash extends cubeFlashGateway {
                        $document = $dao->sauve($data);
                        $document->copyOriginalFromUpload($infos['tmp_name']);
                        $this->xml->addChild('document_id', $document->document_id);
+                       $documents[] = $document->document_id;
                        $_SESSION['conversionSession'][$document->document_id] = 'all';
                        $_SESSION['conversionSessionReload'] = false;
+               };
+
+               if (isset($this->args['append'])) {
+                       $this->args['book_id'] = $this->args['append'];
+                       $this->processConversionSession(false, $_SESSION['conversionSession'], false);
+                       $daoBook = new wsDAOBook($core->con);
+                       foreach ($documents as $id) {
+                               $daoBook->appendDocument($this->args['book_id'], $id);
+                       }
                }
        }
 
@@ -95,14 +113,23 @@ class wsFlash extends cubeFlashGateway {
                }
        }
 
-       public function processConversionSession() {
+       public function processConversionSession($async = true, $documents = null, $reload = false) {
                $_SESSION['sessionConversionGUID'] = $sessionConversionGUID = uniqid('conversion_', true);
+
                $session = new wsConversionSession($sessionConversionGUID);
-               $session->reload = $_SESSION['conversionSessionReload'];
-               $session->setDocuments($_SESSION['conversionSession']);
+               $session->reload = (isset($_SESSION['conversionSessionReload']) && $_SESSION['conversionSessionReload']) || $reload;
+               if (null === $documents) {
+                       $session->setDocuments($_SESSION['conversionSession']);
+               } else {
+                       $session->setDocuments($documents);
+               }
                $session->setBook($this->args['book_id']);
-               unset($_SESSION['conversionSession']);
-               unset($_SESSION['conversionSessionReload']);
+               if (isset($_SESSION['conversionSession'])) {
+                       unset($_SESSION['conversionSession']);
+               }
+               if (isset($_SESSION['conversionSessionReload'])) {
+                       unset($_SESSION['conversionSessionReload']);
+               }
                $session->serialize();
 
                $executable = 'php';
@@ -120,13 +147,17 @@ class wsFlash extends cubeFlashGateway {
                $php->setArg('PATH_INFO', '/flash/processConversionSessionAsync');
                $php->setArg('HTTP_HOST', $_SERVER['HTTP_HOST']);
                $php->setArg('SERVER_ADDR', $_SERVER['SERVER_ADDR']);
-               $php->setNohup(true);
+               if ($async) {
+                       $php->setNohup(true);
+               }
                $php->execute('exec');
 
-               file_put_contents(ROOT . '/../log/processConversionSession.txt', $php->commande . "\n" . $php->output);
+               file_put_contents(ROOT . '/../log/processConversionSession.txt', print_r($session) . "\n" . $php->commande . "\n" . $php->output);
 
                $this->xml->addChild('command', html::escapeHTML($php->command));
-               exit;
+               if ($async) {
+                       exit;
+               }
        }
 
        public function processConversionSessionAsync() {
index a0ff616b19cc6188289991e3be0bb2c42c6b394f..857e25ebe7a707ed97e056540b1e6f34e9065a62 100644 (file)
@@ -1557,8 +1557,50 @@ class wsMaintenance {
                `rm -rf /home/stats/www/objects/$book*;/home/stats/www/FWStats.sh /home/stats/www redobook=$book`;
        }
 
-       public static function nwbuild($args){
-               wsPackager::package(16200,'win-exe-html');
+       public static function processInbox() {
+
+               $base = WS_FILES . '/INBOX/';
+
+               $files = CubeIT_Files::getRecursiveDirectoryIterator($base);
+
+               $publications = array();
+
+               foreach ($files as $file) {
+                       /* @var $file SplFileInfo */
+                       if ($file->isDir() || $file->getExtension() != 'pdf') {
+                               continue;
+                       }
+
+                       $p = str_replace($base, '', $file->getPathname());
+                       $e = explode('/', $p, 3);
+                       $user = $e[0];
+                       $from = $e[1];
+                       $name = $file->getFilename();
+
+                       $publications[] = array('spl' => $file, 'user' => $user, 'from' => $from, 'name' => $name);
+               }
+
+               foreach ($publications as $publication) {
+                       self::_processPDF($publication);
+               }
+
+       }
+
+       public static function _processPDF($publication) {
+               $fluidbook = new CubeIT_Services_Fluidbook();
+               // Login
+               $fluidbook->login($publication['user'], 'Jvia*qpkMydh6tZ#euGa');
+               // Crée un nouveau fluidbook
+               $book_id = $fluidbook->createBook($publication['name'], $publication['from']);
+               // Upload le document
+               echo $fluidbook->uploadPDF($book_id, $publication['spl'])->getBody();
+               // Delete PDF
+
+               unlink($publication['spl']->getPathname());
+       }
+
+       public static function nwbuild($args) {
+               wsPackager::package(16200, 'win-exe-html');
        }
 }
 
index 1a9cb2c52560a11e1ae05de9d0039db0c1213f35..862c3c82d7d06952043a762ee8951e351f858859 100644 (file)
@@ -1879,7 +1879,7 @@ html{height:100%}' . "\n";
                        $res .= '<tr' . $odd . '><td>' . trim($contact->prenom . ' ' . $contact->nom) . '</td>';
                        $res .= '<td><a href="mailto:' . trim($contact->prenom . ' ' . $contact->nom) . '<' . $contact->email . '>">' . $contact->email . '</a></td>';
                        $res .= '<td class="min"><a href="' . SITE_PATH . 'fichiers/' . $contact->utilisateur_id . '">FTP</a></td>';
-                       $res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';
+                       //$res .= '<td><a class="ajax" href="#" rel="connectAs/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';
                        $res .= '<td class="right"><a href="#" rel="formContact/' . $contact->utilisateur_id . '" class="popup">' . cubeMedia::image(IMG . '/edit.png') . '</a></td></tr>';
                        $i++;
                }
@@ -1930,7 +1930,7 @@ html{height:100%}' . "\n";
                if ($client_id != 'new') {
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';
                        $res .= '<tr><td></td><td><a href="' . SITE_PATH . 'fichiers/' . $client->utilisateur_id . '">' . __('FTP') . '</a></td></tr>';
-                       $res .= '<tr><td></td><td><a href="#" class="ajax" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';
+                       //$res .= '<tr><td></td><td><a href="#" class="ajax" rel="connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';
                        $res .= '<tr><td>' . __("Paramètres de connexion au Fluidbook Workshop") . '</td><td>' . __('Adresse') . ' : https://' . $_SERVER['HTTP_HOST'] . '/<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';
                }
index daf17d2069c050e9261a118092830667eabd39ff..4ac6ce9aed1b0b2c39a11ac40c6a2dd7d4c11de6 100644 (file)
@@ -354,8 +354,6 @@ class wsDAOBook extends commonDAO {
 
        public function getPagesOfBook($book_id, $conversion = true) {
                if (!isset(self::$pagesOfBookCache[$book_id])) {
-
-
                        $pages = array();
 
                        $sql = 'SELECT b.*,d.numberSections AS num,d.conversionInfos AS conversion,d.pages AS doc_pages,d.version AS version FROM book_pages b JOIN documents d ON d.document_id=b.document_id WHERE b.book_id=\'' . $this->con->escape($book_id) . '\' ORDER BY book_page';
@@ -636,7 +634,6 @@ class wsDAOBook extends commonDAO {
        }
 
        public function saveCompositionVersion($book_id, $time = null) {
-
                $time = is_null($time) ? TIME : $time;
 
                $pages = $this->getPagesOfBook($book_id);