From e1c758a94d76549b9b35e9e880e36fd5cd8eb3ae Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Fri, 11 Mar 2016 13:59:00 +0100 Subject: [PATCH 1/5] Inserita funzione di ricerca full text --- private/lib/PipelineHelper.php | 1 + private/lib/dao/GenericDao.php | 56 +++++++++++++++++++ .../lib/media/mediaRenderers/MediaYoutube.php | 3 +- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/private/lib/PipelineHelper.php b/private/lib/PipelineHelper.php index c3436b9..29e4172 100644 --- a/private/lib/PipelineHelper.php +++ b/private/lib/PipelineHelper.php @@ -161,6 +161,7 @@ class PipelineHelper { return $rval; } + } ?> \ No newline at end of file diff --git a/private/lib/dao/GenericDao.php b/private/lib/dao/GenericDao.php index 3578357..76ccaa6 100644 --- a/private/lib/dao/GenericDao.php +++ b/private/lib/dao/GenericDao.php @@ -246,6 +246,62 @@ class GenericDao{ // var_dump($resultArray); return $rval; } + + + /** + * Ritorna la lista dei notizia model ordinati per pertinenza + * @param string $searchStr + */ + public function search($modelClass, $searchWord, array $filter = array(), array $options = array()){ + if (!is_null($modelClass)){ + if (!is_subclass_of($modelClass, "DaoSaveable", true)){ + throw new CoreException("Invalid return class passed to GenericDao::query ($modelClass)"); + } + } + + $collectionName = $modelClass::getCollectionName(); + $collection = $this->database->$collectionName; + + $useFilter = $filter; + $useFilter['$text'] = array('$search'=>$searchWord); + + if (!array_key_exists("deleted",$useFilter)){ + $useFilter["deleted"] = false; + } + + if (array_key_exists("id",$useFilter)){ + $useFilter["_id"] = $useFilter["id"]; + unset($useFilter["id"]); + } + + if (array_key_exists("_id",$useFilter) && is_string($useFilter["_id"])){ + $useFilter["_id"] = new MongoId($useFilter["_id"]); + } + + $cursor = $collection->find($useFilter,array('score' => array('$meta' => 'textScore'))); + + $sortArray = array('score' => array('$meta' => 'textScore')); + if (array_key_exists("sort",$options)){ + $sortArray = array_merge($sortArray,$options["sort"]); + } + $cursor->sort($sortArray); + if (array_key_exists("skip",$options)){ + $cursor->skip($options["skip"]); + } + if (array_key_exists("limit",$options)){ + $cursor->limit($options["limit"]); + } + + $rval = array(); + foreach ($cursor as $element){ + unset($element->score); + $rval[] = $modelClass::buildFromSaveableObj($element); + } + + return $rval; + + + } } ?> \ No newline at end of file diff --git a/private/lib/media/mediaRenderers/MediaYoutube.php b/private/lib/media/mediaRenderers/MediaYoutube.php index c6159c9..af851c5 100644 --- a/private/lib/media/mediaRenderers/MediaYoutube.php +++ b/private/lib/media/mediaRenderers/MediaYoutube.php @@ -9,8 +9,7 @@ class MediaYoutube extends MediaRenderer{ public function asText(array $opt = array()){ // return $this->link; - return ''; + return ''; // return ''; } From 14261bb9d618c30f84fbfa7f206ad6d6be4c5929 Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Fri, 11 Mar 2016 14:21:38 +0100 Subject: [PATCH 2/5] aggiunta funzione di ricerca nelle tabelle --- oth/docs/install.memo | 3 +++ private/lib/dao/GenericDao.php | 7 ++++++- private/lib/gui/DatatablesHelper.php | 10 +++++++++- public/searchResults.php | 2 +- public/style/admin.css | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/oth/docs/install.memo b/oth/docs/install.memo index 2f0ba01..77f99b8 100644 --- a/oth/docs/install.memo +++ b/oth/docs/install.memo @@ -8,3 +8,6 @@ db.runCommand({ textSearchEnabled: 1 }); + +INDEX DA CREARE +db.notizia.ensureIndex({"about.author":"text",titolo:"text",sottotitolo:"text",testo:"text"}) diff --git a/private/lib/dao/GenericDao.php b/private/lib/dao/GenericDao.php index 76ccaa6..ee27b82 100644 --- a/private/lib/dao/GenericDao.php +++ b/private/lib/dao/GenericDao.php @@ -250,7 +250,12 @@ class GenericDao{ /** * Ritorna la lista dei notizia model ordinati per pertinenza - * @param string $searchStr + * @param string $modelClass + * @param string $searchWord + * @param array $filter + * @param array $options + * @throws CoreException + * @return DaoSaveable[] */ public function search($modelClass, $searchWord, array $filter = array(), array $options = array()){ if (!is_null($modelClass)){ diff --git a/private/lib/gui/DatatablesHelper.php b/private/lib/gui/DatatablesHelper.php index 545b026..004648a 100644 --- a/private/lib/gui/DatatablesHelper.php +++ b/private/lib/gui/DatatablesHelper.php @@ -27,8 +27,16 @@ class DatatablesHelper { $options["sort"][$key] = strcasecmp($details["dir"], "asc")==0?1:-1; } } + + $models = array(); + if (array_key_exists("search", $_POST) && array_key_exists("value", $_POST["search"]) && strcmp(trim($_POST["search"]["value"]),"")!=0 ){ + $models = $dao->query($useModel, trim($_POST["search"]["value"]),$filter, $options); + } + else { + $models = $dao->query($useModel, $filter, $options); + } - $models = $dao->query($useModel, $filter, $options); + if (sizeof($models)>0){ foreach ($models as $model){ diff --git a/public/searchResults.php b/public/searchResults.php index 5fd7b6f..4099b04 100644 --- a/public/searchResults.php +++ b/public/searchResults.php @@ -13,7 +13,7 @@ try { if(array_key_exists("search", $_POST) && strcmp($_POST["search"], "")!=0){ $searchParameters = strip_tags(PostHandler::get("search")); - $notizie = GlobalVariables::get("dao")->query("NotiziaModel", + $notizie = GlobalVariables::get("dao")->search("NotiziaModel",$searchParameters, array("status"=>NotiziaModel::STATUS_ACCEPTED), array("sort"=>array("about.data"=>-1),"limit"=>10) ); diff --git a/public/style/admin.css b/public/style/admin.css index 6210b41..48ec083 100644 --- a/public/style/admin.css +++ b/public/style/admin.css @@ -68,7 +68,7 @@ form > div{margin:5px 0;} .notiziaMenu ul {list-style:none; display:inline-block; padding:0 20px;} .notiziaMenu ul li{margin: 10px 0px;display: block; clear:both;} -div.notiziaAcceptance{text-align: center; background-color: #ffd677; padding: 20px; border: 1px solid grey; border-radius: 10px;} +div.notiziaAcceptance{text-align: center; background-color: #ffd677; padding: 20px; border: 1px solid grey; border-radius: 10px;margin-bottom:10px;} div.notiziaAcceptance > .buttons a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px; display:inline-block;} div.notiziaAcceptance > .buttons a.green:hover{background-color:#7EFF83;} div.notiziaAcceptance > .buttons a.red:hover{background-color:#FF8DA6;} From 630b9b4c9ac074bf0e6b7da739451a06861bcba4 Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Fri, 11 Mar 2016 14:23:25 +0100 Subject: [PATCH 3/5] TYPO --- private/lib/gui/DatatablesHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/private/lib/gui/DatatablesHelper.php b/private/lib/gui/DatatablesHelper.php index 004648a..d4b5104 100644 --- a/private/lib/gui/DatatablesHelper.php +++ b/private/lib/gui/DatatablesHelper.php @@ -30,7 +30,7 @@ class DatatablesHelper { $models = array(); if (array_key_exists("search", $_POST) && array_key_exists("value", $_POST["search"]) && strcmp(trim($_POST["search"]["value"]),"")!=0 ){ - $models = $dao->query($useModel, trim($_POST["search"]["value"]),$filter, $options); + $models = $dao->search($useModel, trim($_POST["search"]["value"]),$filter, $options); } else { $models = $dao->query($useModel, $filter, $options); From 6d19bf6efee5fe7a51a45556f0b71ef9ced94a60 Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Fri, 11 Mar 2016 14:59:15 +0100 Subject: [PATCH 4/5] Rimosse logNotiziaImpression messe un po a caso.... Incrementato il delay della ricerca con le datatables --- private/lib/gui/DatatablesHelper.php | 5 +++-- public/archivio.php | 1 - public/redazione.php | 1 - public/searchResults.php | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/private/lib/gui/DatatablesHelper.php b/private/lib/gui/DatatablesHelper.php index d4b5104..8bff50f 100644 --- a/private/lib/gui/DatatablesHelper.php +++ b/private/lib/gui/DatatablesHelper.php @@ -30,7 +30,7 @@ class DatatablesHelper { $models = array(); if (array_key_exists("search", $_POST) && array_key_exists("value", $_POST["search"]) && strcmp(trim($_POST["search"]["value"]),"")!=0 ){ - $models = $dao->search($useModel, trim($_POST["search"]["value"]),$filter, $options); + $models = $dao->search($useModel, trim($_POST["search"]["value"]), $filter, $options); } else { $models = $dao->query($useModel, $filter, $options); @@ -146,7 +146,8 @@ class DatatablesHelper { "columnDefs": [ {"className":"lastVisible","targets":[]}, {"className":"hidden","targets":[]} - ] + ], + "searchDelay":800, }); $('# tbody').on( 'click', 'tr', function () { if ( $(this).hasClass('selected') ) { diff --git a/public/archivio.php b/public/archivio.php index c644065..1fed61c 100644 --- a/public/archivio.php +++ b/public/archivio.php @@ -4,7 +4,6 @@ require_once(dirname(__FILE__)."/load.php"); try { - AnalyticsHelper::logNotiziaImpression($articolo->id); AnalyticsHelper::logPageImpression(); GUIHandler::generateHtmlHeaders(); diff --git a/public/redazione.php b/public/redazione.php index 982c128..ceebf67 100644 --- a/public/redazione.php +++ b/public/redazione.php @@ -4,7 +4,6 @@ require_once(dirname(__FILE__)."/load.php"); try { - AnalyticsHelper::logNotiziaImpression($articolo->id); AnalyticsHelper::logPageImpression(); GUIHandler::generateHtmlHeaders(); diff --git a/public/searchResults.php b/public/searchResults.php index 4099b04..15bf91d 100644 --- a/public/searchResults.php +++ b/public/searchResults.php @@ -4,7 +4,6 @@ require_once(dirname(__FILE__)."/load.php"); try { - AnalyticsHelper::logNotiziaImpression($articolo->id); AnalyticsHelper::logPageImpression(); GUIHandler::generateHtmlHeaders(); From 2761b9e69a39670e0474ccdcb3c902c548ff9bef Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Fri, 11 Mar 2016 20:15:14 +0100 Subject: [PATCH 5/5] Completato sistema di registrazione e di login (Senza grafica); Completato sistema di banner e rotazioni Inserito sistema per ricerca full text --- oth/docs/install.memo | 7 +- private/lib/AnalyticsHelper.php | 17 ++- private/lib/BannerHelper.php | 23 ++++ private/lib/dao/GenericDao.php | 6 +- private/lib/dao/models/UserModel.php | 8 ++ private/lib/gui/DatatablesHelper.php | 2 +- private/lib/gui/GUIHandler.php | 20 ++-- private/lib/gui/html.inclusion.php | 2 +- private/lib/lib.inclusions.php | 3 + .../lib/media/mediaRenderers/MediaHtml5.php | 3 +- public/getBanner.php | 38 +++++-- public/index.php | 6 +- public/js/functions.js | 30 +++-- public/login.php | 67 +++++++++++ public/registration.php | 106 +++++++++++++++--- public/searchResults.php | 2 +- public/style/public.css | 9 +- 17 files changed, 290 insertions(+), 59 deletions(-) create mode 100644 private/lib/BannerHelper.php create mode 100644 public/login.php diff --git a/oth/docs/install.memo b/oth/docs/install.memo index 77f99b8..e0adca4 100644 --- a/oth/docs/install.memo +++ b/oth/docs/install.memo @@ -10,4 +10,9 @@ db.runCommand({ INDEX DA CREARE -db.notizia.ensureIndex({"about.author":"text",titolo:"text",sottotitolo:"text",testo:"text"}) +db.notizia.ensureIndex({"about.author":"text",titolo:"text",sottotitolo:"text",testo:"text"},{default_language: "italian"}) +db.administrators.ensureIndex({nome:"text",cognome:"text",email:"text"},{default_language: "italian"}) +db.mail.ensureIndex({recipient:"text",subject:"text",body:"text"},{default_language: "italian"}) +db.users.ensureIndex({nome:"text",cognome:"text",email:"text"},{default_language: "italian"}) +db.banner.ensureIndex({customer:"text",link:"text"},{default_language: "italian"}) +db.commenti.ensureIndex({titolo:"text",testo:"text"},{default_language: "italian"}) diff --git a/private/lib/AnalyticsHelper.php b/private/lib/AnalyticsHelper.php index 4728eae..09e8ba9 100644 --- a/private/lib/AnalyticsHelper.php +++ b/private/lib/AnalyticsHelper.php @@ -190,9 +190,13 @@ class AnalyticsHelper { if (array_key_exists("HTTP_REFERER",$_SERVER)){ $source = $_SERVER['HTTP_REFERER']; } - + $function = '$.ajax({url: "stats/bannerImpression.php", method: "POST", data: { "ip": "'.$ip.'", "banner": "'.$id.'", "source": "'.$source.'" }, dataType: "html" });'; - GUIHandler::addOnLoadJsEvent($function); + echo ''; + + // OLD VERSION +// $function = '$.ajax({url: "stats/bannerImpression.php", method: "POST", data: { "ip": "'.$ip.'", "banner": "'.$id.'", "source": "'.$source.'" }, dataType: "html" });'; +// GUIHandler::addOnLoadJsEvent($function); } /** @@ -285,17 +289,18 @@ class AnalyticsHelper { $rval = null; if (ASDSessionHandler::sessionValueExists("bannerActive")){ $shown = ASDSessionHandler::getSessionValue("bannerActive"); - + if (!is_null($replaced) && in_array($replaced, $shown)){ - $key = array_search($needle, $shown); + $key = array_search($replaced, $shown); unset($shown[$key]); + ASDSessionHandler::setSessionValue("bannerActive",$shown); } } // idlist contiene gli id dei banner in ordine di visualizzazione crescente (esclusi quelli non visualizzati) $pipeline = PipelineHelper::getTodaysBannerVisualizationPipeline($position); $stats = GlobalVariables::get("dao")->aggregate("StatisticModel",$pipeline); - var_dump($stats); +// var_dump($stats); $idList = array(); if (sizeof($stats)>0){ foreach ($stats as $stat){ @@ -316,7 +321,7 @@ class AnalyticsHelper { } if (is_null($rval)){ - $todayLessShown = array_diff($idList, $shown); + $todayLessShown = array_values(array_diff($idList, $shown)); if (sizeof($todayLessShown)>0){ $i = 0; while (is_null($rval) && $i +
+ \ No newline at end of file diff --git a/private/lib/dao/GenericDao.php b/private/lib/dao/GenericDao.php index ee27b82..fe31bef 100644 --- a/private/lib/dao/GenericDao.php +++ b/private/lib/dao/GenericDao.php @@ -285,10 +285,12 @@ class GenericDao{ $cursor = $collection->find($useFilter,array('score' => array('$meta' => 'textScore'))); - $sortArray = array('score' => array('$meta' => 'textScore')); + $sortArray = array(); if (array_key_exists("sort",$options)){ - $sortArray = array_merge($sortArray,$options["sort"]); + $sortArray = $options["sort"]; } + $sortArray = array_merge($sortArray,array('score' => array('$meta' => 'textScore')) ); + $cursor->sort($sortArray); if (array_key_exists("skip",$options)){ $cursor->skip($options["skip"]); diff --git a/private/lib/dao/models/UserModel.php b/private/lib/dao/models/UserModel.php index d6747cc..3af6f95 100644 --- a/private/lib/dao/models/UserModel.php +++ b/private/lib/dao/models/UserModel.php @@ -24,6 +24,14 @@ class UserModel extends Model{ if(!$this->hasProperty("password")){ new CoreException("Impossible to create a user without a password"); } + + if(!$this->hasProperty("active")){ + $this->active = false; + } + + if(!$this->hasProperty("activationSent")){ + $this->activationSent = false; + } } public static function getCollectionName(){ diff --git a/private/lib/gui/DatatablesHelper.php b/private/lib/gui/DatatablesHelper.php index 8bff50f..7802ba1 100644 --- a/private/lib/gui/DatatablesHelper.php +++ b/private/lib/gui/DatatablesHelper.php @@ -147,7 +147,7 @@ class DatatablesHelper { {"className":"lastVisible","targets":[]}, {"className":"hidden","targets":[]} ], - "searchDelay":800, + "searchDelay":600, }); $('# tbody').on( 'click', 'tr', function () { if ( $(this).hasClass('selected') ) { diff --git a/private/lib/gui/GUIHandler.php b/private/lib/gui/GUIHandler.php index e414b87..d9afe98 100644 --- a/private/lib/gui/GUIHandler.php +++ b/private/lib/gui/GUIHandler.php @@ -153,12 +153,13 @@ class GUIHandler { 'Settembre', 'Ottobre', 'Novembre','Dicembre'); $day = date("d"); + ASDSessionHandler::setSessionValue("bannerActive",array()); ?>
- Aggiornato alle
- +
nome." ".UserLoginManager::getLogged()->cognome:'LOGIN';?> | REGISTRATI
@@ -168,9 +169,14 @@ class GUIHandler {
-
BANNER
+
+ + +
-
BANNER
+
+ +
@@ -314,8 +320,8 @@ class GUIHandler {
Guarda anche
-
BANNER
-
BANNER
+
+
@@ -338,8 +344,8 @@ class GUIHandler {
Guarda anche
-
BANNER
-
BANNER
+
+
\ No newline at end of file diff --git a/private/lib/media/mediaRenderers/MediaHtml5.php b/private/lib/media/mediaRenderers/MediaHtml5.php index c0f324d..d449158 100644 --- a/private/lib/media/mediaRenderers/MediaHtml5.php +++ b/private/lib/media/mediaRenderers/MediaHtml5.php @@ -17,7 +17,8 @@ class MediaHtml5 extends MediaRenderer{ $height = 'width:'.self::$SIZES[$size]["height"].'px;'; } - return '
'.$this->code.'
'; + return $this->code; +// return '
'.$this->code.'
'; } public function render(array $opt = array()){ diff --git a/public/getBanner.php b/public/getBanner.php index ccfb8cc..6884df2 100644 --- a/public/getBanner.php +++ b/public/getBanner.php @@ -5,21 +5,43 @@ Creation Date: 02/mar/2016 */ -require_once(dirname(__FILE__)."/load.php"); + require_once(dirname(__FILE__)."/load.php"); -// if (array_key_exists("id",$_GET)) { + $replaced = null; + if (array_key_exists("replaced",$_GET)) { + $replaced = $_GET["replaced"]; + } + + $position = BannerModel::POSITION_HEAD; + if (array_key_exists("pos",$_GET)) { + $intPost = intval($_GET["pos"]); + if (array_key_exists($intPost,BannerModel::$BANNER_POSITIONS)){ + $position = $intPost; + } + } + // $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$_GET['id'])); - ASDSessionHandler::setSessionValue("bannerActive",array()); - $banner = AnalyticsHelper::getBannerToShow(BannerModel::POSITION_HEAD); + +// ASDSessionHandler::setSessionValue("bannerActive",array()); + $banner = AnalyticsHelper::getBannerToShow($position,$replaced); +// var_dump($replaced); if (!is_null($banner)){ $media = DaoMediaHandler::getMainMediaFromModel($banner); - echo ''; + echo ''; $media->renderMedia(); echo ''; AnalyticsHelper::logBannerImpression($banner->id); + + ?> + + \ No newline at end of file +// GUIHandler::generateHtmlHeaders(array(),true); +?> diff --git a/public/index.php b/public/index.php index f1fbd96..4127050 100644 --- a/public/index.php +++ b/public/index.php @@ -242,7 +242,7 @@ catch (Exception $ex){ -
+
RISTORANTI
@@ -267,7 +267,7 @@ catch (Exception $ex){
-
+
Più Letti
@@ -285,7 +285,7 @@ catch (Exception $ex){
-
+
GOSSIP
diff --git a/public/js/functions.js b/public/js/functions.js index f21e087..8caf811 100644 --- a/public/js/functions.js +++ b/public/js/functions.js @@ -27,18 +27,28 @@ function openRegistrationModal(){ }); } -function sendRegistration(){ +function openLoginModal(){ $.ajax({ - method:'POST', - url:'sendRegistrationBackend.php', + method:"POST", + url:'login.php', dataType:'html', - data:$('#regForm').serialize(), success: function(data){ -// $("#regForm").remove(); - $(".modalResponse").html(data); - /* Verificare se si possa eliminare la form in caso di registrazione avvenuta con successo assegnando un parametro - * allo span di avvenuta registrazione*/ -// $(".modalError").html(""); + $("#floating").html(data); + var off = $("#regButton").offset(); + var right = $(document).width()-off.left - $("#regButton").outerWidth(); + $("#floating").css("position","absolute").css("right",right).css("top",off.top+25); + $("#floating").show(); } }); -} \ No newline at end of file +} + +function bannerRoll(prev,pos){ + $.ajax({ + method:"POST", + url:'getBanner.php?replaced='+prev+'&pos='+pos, + dataType:'html', + success: function(data){ + $('#'+prev).parent().html(data); + } + }); +} \ No newline at end of file diff --git a/public/login.php b/public/login.php new file mode 100644 index 0000000..80e0a70 --- /dev/null +++ b/public/login.php @@ -0,0 +1,67 @@ +getMessage(); + $err = true; +}catch (Exception $exec){ + $msg = LogModel::fromException($exec); + GlobalVariables::get("dao")->save($msg); +} +if ($saved){ + echo "Registrazione avvenuta con successo"; +} +else { + ?> + +
+
+
+ +
Username:
+
Password:
+ +
+
+ + \ No newline at end of file diff --git a/public/registration.php b/public/registration.php index b0c46c1..83b41e4 100644 --- a/public/registration.php +++ b/public/registration.php @@ -3,24 +3,100 @@ require_once(dirname(__FILE__)."/load.php"); try { - ?> - -
-
-
-
Email:
-
Username:
-
Password:
-
Conferma password:
-
Vuoi iscriverti alla newsletter?
- -
-
+ $msg = ""; + $saved = false; - nome = PostHandler::get("nome"); + $obj->cognome = PostHandler::get("cognome"); + + $email = trim(PostHandler::get("email")); + if (is_null($email) || !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/",$email)){ + throw new GUIException("L'email inserita non è in un formato valido ($email)"); + } + if (GlobalVariables::get("dao")->count("AdminModel",array("email",$email)) > 0 ){ + throw new GUIException("L'email inserita è già in uso ($email)"); + } + $obj->email = $email; + + $username = trim(PostHandler::get("username")); + + // Validate Username + if (is_null($username) || strcmp($username,"")==0){ + throw new GUIException("Inserire un nome utente valido"); + } + if (GlobalVariables::get("dao")->count("UserModel",array("username"=>$username ) ) > 0 ){ + throw new GUIException("Il nome utente '".$username."' è già in uso"); + } + + $obj->username = $username; + + $pass = trim(PostHandler::get("password")); + $passConf = trim(PostHandler::get("password_confirm")); + if (is_null($pass) || strcmp($pass,"")==0){ + throw new GUIException("Inserire una password"); + } + if (strcmp($pass,$passConf)!=0){ + throw new GUIException("Le password inserite non coincidono"); + } + $obj->password = sha1($pass); + + $obj->newsletter = false; + $news = PostHandler::get("newsletter"); + if (!is_null($news) && strcasecmp("true", $news)){ + $obj->newsletter = true; + } + $user = new UserModel($obj); + GlobalVariables::get("dao")->save($user); + $saved = true; + } + +}catch(GUIException $ex){ + $msg = $ex->getMessage(); + $err = true; }catch (Exception $exec){ $msg = LogModel::fromException($exec); GlobalVariables::get("dao")->save($msg); } -// echo "zzzzzzzzzzzzzzzzzzzzzz"; +if ($saved){ + echo "Registrazione avvenuta con successo"; +} +else { +?> + +
+
+
+ +
Nome:
+
Cognome:
+
Email:
+
Username:
+
Password:
+
Conferma password:
+
Vuoi iscriverti alla newsletter?
+ +
+
+ + \ No newline at end of file diff --git a/public/searchResults.php b/public/searchResults.php index 15bf91d..8543069 100644 --- a/public/searchResults.php +++ b/public/searchResults.php @@ -14,7 +14,7 @@ try { $notizie = GlobalVariables::get("dao")->search("NotiziaModel",$searchParameters, array("status"=>NotiziaModel::STATUS_ACCEPTED), - array("sort"=>array("about.data"=>-1),"limit"=>10) + array("limit"=>10) ); if (sizeof($notizie)>0){ diff --git a/public/style/public.css b/public/style/public.css index e4b4a9d..b8a8c27 100644 --- a/public/style/public.css +++ b/public/style/public.css @@ -78,6 +78,7 @@ body{font-family:lato, arial;} -moz-box-shadow: 0px 0px 10px -3px; padding: 10px 5px 5px; margin-left: 1px; + margin-bottom: 25px; } @@ -136,7 +137,9 @@ body{font-family:lato, arial;} .ansa{border:solid #d6d6d6 1px;border-left:0px;border-right:0px;border-top:0px;height:180px;} .ansa> div {display:inline-block;vertical-align:top;} -.mediaContent > *{max-height:100%;max-width:100%;} +.mediaContent{overflow:hidden;} +.mediaContent *{max-height:100%;max-width:100%;} +.mediaContent > a{height:100%; width:100%;display:inline-block;} .ansaImage{display:inline-block;margin:15px 7px;width:150px; height:113px; overflow:hidden;text-align:center;} .ansaNews{margin-top:2px;width:330px;cursor:pointer;} @@ -224,7 +227,7 @@ body{font-family:lato, arial;} .ristorantiTitle, .culturaTitle{font-weight: bold;text-align: left;font-size: 12px;} .ristorantiBlock .ristorantiLink > a, .culturaNews .culturaLink > a{color:#3498d4;font-size:13px;} -.middleBanner{max-height:165px;} +.middleBanner{height:165px;} .middleBanner > img{max-height:100px;max-width:220px;} .ristorantiTitle{margin-top:10px;} @@ -232,7 +235,7 @@ body{font-family:lato, arial;} .rightBarNews{display:inline-block;width:230px;height:1380px;vertical-align:top;margin-top:20px;} .meteo{max-height:165px;max-width:220px;} .meteo > img{max-width:220px;max-height:165px;} -.middleRightBanner{width:220px;overflow:hidden;} +.middleRightBanner{width: 220px;overflow: hidden;height: 165px;margin: 5px 0;} .middleRightBanner > img{max-width:220px; max-heigth:200px;} .reader > .lastContainer, .lastContainer{max-height:120px;margin-top:5px;margin-bottom:5px;border-bottom:dotted #C1B4B4 1px;}