From 5fa883ebe3d38b98dbf245e97ba15835f7c9d170 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 4 Sep 2013 14:04:30 +0000 Subject: [PATCH] --- inc/commons/class.common.core.php | 8 ++++ inc/ws/Controlleur/class.ws.services.php | 54 +++++++++++++++++++++--- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index e3609d948..20b53f1b4 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -501,6 +501,14 @@ class commonCore extends cubeCore { // Table Grdf $db->grdf->datas('text', 0, false); + // Table bulle + $db->bulle->email('varchar', 128, false); + $db->bulle->date('integer', 0, false); + $db->bulle->prenom('varchar', 128, false); + $db->bulle->nom('varchar', 128, false); + $db->bulle->catalogue('varchar', 128, false); + + // Table google search api $db->google_search_api->request('varchar', 256, false); $db->google_search_api->response('text', 0, false); diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 04d9bbaef..1c09723a4 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -371,6 +371,50 @@ class wsServices extends cubeFlashGateway { } } + public function bulle() { + global $core; + $e = explode('-', $this->args['catalogue'], 2); + if (count($e) == 2) { + $catalogue = $e[1]; + } else { + $catalogue = $e[0]; + } + + $c = $core->con->openCursor('bulle'); + $c->prenom = trim($this->args['prenom']); + $c->nom = trim($this->args['nom']); + $c->catalogue = trim($catalogue); + $c->email = trim($this->args['email']); + $c->date = TIME; + $c->insert(); + } + + public function getBulleList() { + $user = 'bulle'; + $pass = '23bu1l300'; + $this->outputXML = false; + $ok = (isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] == $user && isset($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_PW'] == $pass); + if (!$ok) { + header('WWW-Authenticate: Basic realm="Protected access"'); + header('HTTP/1.0 401 Unauthorized'); + ob_end_clean(); + header('Content-type: text/html'); + echo '

Forbidden

'; + exit; + } else { + global $core; + header('Content-type: text/csv'); + header('Content-Disposition: attachment; filename="inscriptions.csv"'); + $r = $core->con->select('SELECT * FROM bulle ORDER BY date'); + ob_end_clean(); + echo utf8_decode('"Prénom";"Nom";"E-mail";"Catalogue";"Date"') . "\n"; + while ($r->fetch()) { + echo utf8_decode('"' . $r->prenom . '";"' . $r->nom . '";"' . $r->email . '";"' . $r->catalogue . '";"' . date('Y-m-d H:i', $r->date) . '"') . "\n"; + } + exit; + } + } + public function grdfValidForm() { $notempty = array('civilite', 'prenom', 'nom', 'adresse', 'codepostal', 'ville', 'telephone', 'optin', 'connu', 'energie'); $error = false; @@ -615,13 +659,13 @@ class wsServices extends cubeFlashGateway { $langs = array_unique($langs); - $w2h=new wiki2xhtml(); - $w2h->setOpt('active_pre',0); - + $w2h = new wiki2xhtml(); + $w2h->setOpt('active_pre', 0); + $contents = $collection->contents; foreach ($langs as $lang) { $langsnames[$lang] = cubeLang::getNameByCode($lang); - $contents[$lang]['apropos']=$w2h->transform($contents[$lang]['apropos']); + $contents[$lang]['apropos'] = $w2h->transform($contents[$lang]['apropos']); } @@ -724,7 +768,7 @@ class wsServices extends cubeFlashGateway { protected function _getRegExpManifest($r, $book, $theme, $resolution) { $reg = array(); - $reg['loading'] = array('^' . $r . 'style/(.*).css$', '^' . $r . 'index.html$', '^' . $r . 'data/style/(.*)$', '^' . $r . 'data/(.*).js$', '^' . $r . 'data/images/' . $theme->parametres->logoLoader . '$', '^' . $r . 'style/fonts/(.*).ttf$','^' . $r . 'data/images/interface-down.svg$'); + $reg['loading'] = array('^' . $r . 'style/(.*).css$', '^' . $r . 'index.html$', '^' . $r . 'data/style/(.*)$', '^' . $r . 'data/(.*).js$', '^' . $r . 'data/images/' . $theme->parametres->logoLoader . '$', '^' . $r . 'style/fonts/(.*).ttf$', '^' . $r . 'data/images/interface-down.svg$'); $reg['extras'] = array('^' . $r . 'data/links/(.*)$', '^' . $r . 'data/(.*).pdf$', '^' . $r . 'cover.jpg$'); $reg['thumbnails'] = array('^' . $r . 'data/thumbnails/p(\d+).jpg$'); for ($i = 1; $i <= $book->parametres->pages; $i++) { -- 2.39.5