From 2d640dc09a7c0a07c3e67b0c233b75cf7e15898e Mon Sep 17 00:00:00 2001 From: afornerot Date: Thu, 21 Nov 2019 10:40:15 +0100 Subject: [PATCH] svg --- src/ninegate-1.0/composer.json | 2 +- src/ninegate-1.0/composer.lock | 20 ++--- .../CoreBundle/Command/OnlyCommand.php | 73 +++++++++++++++---- .../CoreBundle/Command/data/core-init-01.sql | 2 +- .../PortalBundle/Command/InitDataCommand.php | 22 +++--- .../Controller/PagetemplateController.php | 1 + .../Resources/views/Chat/client.html.twig | 20 +++-- 7 files changed, 96 insertions(+), 44 deletions(-) diff --git a/src/ninegate-1.0/composer.json b/src/ninegate-1.0/composer.json index a04b93a2..3ec222a9 100644 --- a/src/ninegate-1.0/composer.json +++ b/src/ninegate-1.0/composer.json @@ -40,7 +40,7 @@ "symfony/symfony": "3.4.*", "tetranz/select2entity-bundle": "2.*", "thecsea/simple-caldav-client": "^0.1.10", - "mashape/unirest-php": "2.*", + "mashape/unirest-php": "3.*", "twig/twig": "^1.0||^2.0" }, "require-dev": { diff --git a/src/ninegate-1.0/composer.lock b/src/ninegate-1.0/composer.lock index f4b2e59d..b4ce5f6e 100644 --- a/src/ninegate-1.0/composer.lock +++ b/src/ninegate-1.0/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5c29a0c1698bd753d6b42df4822e5f2d", - "content-hash": "51482d6b9f9c27b385c17393182e0d82", + "hash": "e008822a96a469e24963e22d66f34c98", + "content-hash": "589f314a10ca56596cf580254885bd7c", "packages": [ { "name": "cboden/ratchet", @@ -2409,31 +2409,33 @@ }, { "name": "mashape/unirest-php", - "version": "v2.6.6", + "version": "v3.0.4", "source": { "type": "git", "url": "https://github.com/Mashape/unirest-php.git", - "reference": "73c2d903232bb5a125396e606b67314a87b8b21c" + "reference": "842c0f242dfaaf85f16b72e217bf7f7c19ab12cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Mashape/unirest-php/zipball/73c2d903232bb5a125396e606b67314a87b8b21c", - "reference": "73c2d903232bb5a125396e606b67314a87b8b21c", + "url": "https://api.github.com/repos/Mashape/unirest-php/zipball/842c0f242dfaaf85f16b72e217bf7f7c19ab12cb", + "reference": "842c0f242dfaaf85f16b72e217bf7f7c19ab12cb", "shasum": "" }, "require": { "ext-curl": "*", - "ext-json": "*", "php": ">=5.4.0" }, "require-dev": { "codeclimate/php-test-reporter": "0.1.*", "phpunit/phpunit": "~4.4" }, + "suggest": { + "ext-json": "Allows using JSON Bodies for sending and parsing requests" + }, "type": "library", "autoload": { "psr-0": { - "Unirest": "src" + "Unirest\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2449,7 +2451,7 @@ "https", "rest" ], - "time": "2016-02-16 16:45:52" + "time": "2016-08-11 17:49:21" }, { "name": "monolog/monolog", diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/OnlyCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/OnlyCommand.php index 5c65d936..23b87cf7 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/OnlyCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/OnlyCommand.php @@ -8,6 +8,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Finder\Finder; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\KernelInterface; +use Symfony\Component\HttpFoundation\Response; use Doctrine\DBAL\Connection as DBALConnection; use Doctrine\ORM\EntityManager; @@ -24,6 +25,7 @@ use Unirest\Request; global $bdd01; global $config; + class OnlyCommand extends Command { private $container; @@ -83,26 +85,21 @@ class OnlyCommand extends Command $this->only_sync = true; $this->only_url = "https://transnum.oo.pp.ac-dijon.fr"."/api/2.0/"; + $this->only_url = "https://transnum.oo.ac-dijon.fr"."/api/2.0/"; $this->only_user = "admin"; $this->only_password = "brigitte89!"; - $im = new \Imagick(); - $im->setResolution(350, 350); - $im->readImage("/var/www/html/ninegate/uploads/file/widget-308/essai.csv[0]"); - $im->setImageBackgroundColor('#ffffff'); - $im = $im->flattenImages(); - $im->setImageFormat('jpeg'); - $im->writeImage("/var/www/html/ninegate/uploads/file/widget-308/toto.jpg"); - - return 1; - if($this->only_sync) { + + //$client= new curl(); + // Only Office est-il dans le domaine if(stripos($this->only_url,"/")===0) $this->only_url="https://".$this->container->getParameter("weburl").$this->only_url; $indomaine = (stripos($this->only_url,$this->container->getParameter("weburl"))!==false); // Si hors domaine on utilise le proxy si proxy il y a + if(!$indomaine) { $PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue(); if($PROXYactivate) { @@ -111,18 +108,66 @@ class OnlyCommand extends Command \Unirest\Request::proxy($PROXYserver, $PROXYport, CURLPROXY_HTTP, true); } } + - // Récupération des informations utilisateurs issus du masteridentity - $headers = ['Accept' => 'application/json']; + // Authentification à onlyoffice + $this->writeln(''); + $this->writeln('== AUTHENTIFICATION ================================='); + \Unirest\Request::verifyPeer(false); + \Unirest\Request::verifyHost(false); + $headers = ['Host' => 'transnum.oo.ac-dijon.fr', 'Accept' => 'application/json','Content-Type'=>'application/json']; $query = array('userName' => $this->only_user, 'password' => $this->only_password); - $body = json_encode($query); - $response = \Unirest\Request::post($this->only_url.'/authentication',$headers,$body); + $body = \Unirest\Request\Body::json($query); + + $response = \Unirest\Request::post($this->only_url.'/authentication',$headers,$body); + if($this->koresponse($response)) return 0; + $token=$response->body->response->token; + $headers["Authorization"]=$token; + + // Synchronisation des utilisateur Only sur l'annuaire + $this->writeln(''); + $this->writeln('== SYNCHRONISATION ONLY=============================='); + //$response = \Unirest\Request::get($this->only_url.'/settings/ldap/sync',$headers); + //if($this->koresponse($response)) return 0; + + // Controler les utilisateur only + $this->writeln(''); + $this->writeln('== CONTROLE USER ONLY================================'); + $response = \Unirest\Request::get($this->only_url.'/people',$headers); + if($this->koresponse($response)) return 0; + + foreach($response->body->response as $onlyuser) { + $user=$this->em->getRepository("CadolesCoreBundle:User")->findBy(["username"=>$onlyuser->userName]); + if(!$user) { + $this->writelnred("ERREUR ".$onlyuser->userName." existe dans OnlyOffice mais pas dans Ninegate"); + } + } + + // Controler les utilisateurs ninegate + $this->writeln(''); + $this->writeln('== CONTROLE USER NINEGATE============================'); + $users=$this->em->getRepository("CadolesCoreBundle:User")->findAll(); + foreach($users as $user) { + $response = \Unirest\Request::get($this->only_url.'/people/'.$user->getUsername(),$headers); + if($this->koresponse($response)) { + $this->writelnred("ERREUR ".$user->getUsername()." existe dans Ninegate mais pas dans OnlyOffice"); + } + } } $this->writeln(''); return 1; } + function koresponse($response) { + if($response->code>=Response::HTTP_BAD_REQUEST) { + $this->writelnred("ERREUR ".$response->code); + if(property_exists($response,"body") && property_exists($response->body,"error")) $this->writelnred("ERREUR ".$response->body->error->message);; + return true; + } + + return false; + } private function writelnred($string) { $this->output->writeln(''.$string.''); $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql index 56707b5d..8d5e4788 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql @@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES (-100, 'DRAAF', '130007107'); INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES -(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}oIZgb8jC4L72wg4rgK+xfzdfPiy2Z8BA +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}lq8Ffm9MG+azcCnLde4qj0KU0j3XFO8/ ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php index 8a43ebfc..494e0d84 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -702,8 +702,8 @@ class InitDataCommand extends ContainerAwareCommand $entityWidget->setDescription("Conversation instantanée"); $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_chat"); $entityWidget->setHeight("1000"); - $entityWidget->setAutoajust(false); - $entityWidget->setBorder(true); + $entityWidget->setAutoajust(true); + $entityWidget->setBorder(false); $entityWidget->setOpened(true); $entityWidget->setAccess(["config","user","group"]); $parameter = json_decode('{"fields": []}'); @@ -869,37 +869,37 @@ class InitDataCommand extends ContainerAwareCommand $entityPage->setId(-110); $entityPage->setRowOrder(0); $entityPage->setName('Accueil Groupe'); - $entityPage->setParentfor('Groupe'); - $entityPage->setMaxwidth(1500); + $entityPage->setParentfor('group'); + $entityPage->setMaxwidth(0); $entityPage->setPagecategory($entityPagecategory); - $entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 4,"rows":[]},{"id":1,"size": 8,"rows":[{"id":0,"cols":[{"id":0,"size": 12}]},{"id":1,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]}]}]}'); + $entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 3,"rows":[]},{"id":1,"size": 6,"rows":[{"id":0,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]},{"id":2,"size": 3,"rows":[]}]}]}'); $em->persist($entityPage); $em->flush(); // Widget Nos Liens $fields=["fields"=>[["id"=>"modedesktop","value"=>2]]]; - $this->addWidget(-120,$entityPage,-1960,"R1C1",1,"Nos Liens",true,$fields); + $this->addWidget(-120,$entityPage,-1960,"R1C2R1C1",0,"Nos Liens",true,$fields); // Widget Nos Fichiers $fields=["fields"=>[]]; - $this->addWidget(-130,$entityPage,-1920,"R1C1",2,"Nos Fichiers",true,$fields); + $this->addWidget(-130,$entityPage,-1920,"R1C2R1C2",0,"Nos Fichiers",true,$fields); // Widget Info Page $fields=["fields"=>[]]; - $this->addWidget(-140,$entityPage,-1860,"R1C1",3,"Information Page",true,$fields); + $this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields); // Widget Notre Blog $fields=["fields"=>[["id"=>"nbarticle","value"=>5]]]; - $this->addWidget(-150,$entityPage,-1890,"R1C2R1C1",1,"Notre Blog",false,$fields); + $this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields); // Widget Notre Calendrier $fields=["fields"=>[["id"=>"nbday","value"=>30]]]; - $this->addWidget(-160,$entityPage,-1900,"R1C2R2C1",1,"Notre Calendrier",true,$fields); + $this->addWidget(-160,$entityPage,-1900,"R1C2R1C1",1,"Notre Calendrier",true,$fields); // Chat $fields=["fields"=>[]]; - $this->addWidget(-170,$entityPage,-1840,"R1C2R2C2",1,"Chat",true,$fields); + $this->addWidget(-170,$entityPage,-1840,"R1C3",0,"Chat",false,$fields); } $output->writeln(''); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php index 4377507f..f801658d 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagetemplateController.php @@ -243,6 +243,7 @@ class PagetemplateController extends Controller } // Retour + dump("retdirect to".$this->generateUrl($this->routeprimary)); return $this->redirect($this->generateUrl($this->routeprimary)); } diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig index 4b1b9d92..505fe5d8 100644 --- a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig +++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig @@ -3,18 +3,22 @@ {% block localstyle %} {% if framed %} {% if border %} - #page-wrapper:last-of-type { - //padding: 5px 25px 10px 15px; - //background: transparent; + #topchat { + margin: 5px -15px 5px -25px; } + .mychat{ + margin: 0px 0px 0px -10px; + } {% else %} - #page-wrapper { - padding: 5px 25px 0px 15px; - //background: transparent; + #topchat { + margin: 5px -30px; + } + .mychat{ + margin: 0px -15px; } {% endif %} {% else %} - #page-wrapper { padding-top:20px; padding-bottom:30px; } + #topchat { padding-top:20px; padding-bottom:30px; } {% endif %} .message { @@ -57,7 +61,7 @@ {% block pagewrapper %} {% if app.user and ingroup %} {{ form_start(form) }} -
+
{{ form_widget(form.message) }}