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 {
+ ?>
+
+
+
+
+
\ 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 {
- ?>
-
-
+ $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 {
+?>
+
+
+
+
+
\ 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;}