diff --git a/private/lib/dao/models/UserModel.php b/private/lib/dao/models/UserModel.php
index 0ddfed3..d6747cc 100644
--- a/private/lib/dao/models/UserModel.php
+++ b/private/lib/dao/models/UserModel.php
@@ -16,6 +16,14 @@ class UserModel extends Model{
if (!$this->hasProperty("email")){
throw new CoreException("Impossible to create a user without a mail address");
}
+
+ if (!$this->hasProperty("username")){
+ throw new CoreException("Impossible to create a user without a username");
+ }
+
+ if(!$this->hasProperty("password")){
+ new CoreException("Impossible to create a user without a password");
+ }
}
public static function getCollectionName(){
diff --git a/public/index.php b/public/index.php
index 93d9845..f1fbd96 100644
--- a/public/index.php
+++ b/public/index.php
@@ -275,7 +275,7 @@ catch (Exception $ex){
0){
foreach($lastsNews as $last){
- $data = $mesi[date("n",$last->data->sec)]." ".date("Y",$last->about->data->sec);
+ $data = $mesi[date("n",$last->about->data->sec)]." ".date("Y",$last->about->data->sec);
$string = (strlen($last->titolo) > 103) ? substr($last->titolo,0,100).'...' : $last->titolo;?>
diff --git a/public/js/functions.js b/public/js/functions.js
index 2157ff7..dcda619 100644
--- a/public/js/functions.js
+++ b/public/js/functions.js
@@ -28,5 +28,16 @@ function openRegistrationModal(){
}
function sendRegistration(){
-
+ $.ajax({
+ method:'POST',
+ url:'sendRegistrationBackend.php',
+ dataType:'html',
+ data:$("#regForm").serialize(),
+ success: function(data){
+
+ },
+ error:function(data){
+ $(".modalError").html(data);
+ }
+ });
}
\ No newline at end of file
diff --git a/public/registration.php b/public/registration.php
index c633af2..090a0c8 100644
--- a/public/registration.php
+++ b/public/registration.php
@@ -4,16 +4,43 @@ require_once(dirname(__FILE__)."/load.php");
try {
?>
-
+
+
+
save($msg);
}
echo "zzzzzzzzzzzzzzzzzzzzzz";
-?>
\ No newline at end of file
+?>
+
\ No newline at end of file
diff --git a/public/sendCommentoBackend.php b/public/sendCommentoBackend.php
index 84746ff..2695cb8 100644
--- a/public/sendCommentoBackend.php
+++ b/public/sendCommentoBackend.php
@@ -19,8 +19,8 @@ try {
$news->user = UserLoginManager::getLogged();
$commento = new CommentoModel($news);
- $commento->titolo = $titolo;
- $commento->testo = $testo;
+ $commento->titolo = strip_tags($titolo);
+ $commento->testo = strip_tags($testo);
$commento->status = CommentoModel::STATUS_PENDING;
GlobalVariables::get("dao")->save($commento);
diff --git a/public/sendRegistrationBackend.php b/public/sendRegistrationBackend.php
new file mode 100644
index 0000000..618171b
--- /dev/null
+++ b/public/sendRegistrationBackend.php
@@ -0,0 +1,41 @@
+getFirst("UserModel",array("username"=>$userName));
+// GlobalVariables::get("dao")->getFirst("UserModel",array("email"=>$email));
+// GlobalVariables::get("dao")->getFirst("UserModel",array("username"=>$userName));
+ $user = new stdClass();
+ $user->email = $email;
+ $user->password = sha1($pass);
+ $user->username = $userName;
+ $user->newsletter = $newsletter;
+
+
+ $userModel = new UserModel($user);
+// GlobalVariables::get("dao")->save($userModel);
+ echo "salvataggio riuscito";
+ }
+ else{
+ echo "Le due password non coincidono";
+ }
+
+}catch(Exception $exec){
+ $msg = LogModel::fromException($exec);
+ GlobalVariables::get("dao")->save($msg);
+}
+
+?>
\ No newline at end of file
diff --git a/public/style/public.css b/public/style/public.css
index 01d5ce4..8fef4cc 100644
--- a/public/style/public.css
+++ b/public/style/public.css
@@ -89,8 +89,16 @@ body{font-family:lato, arial;}
#floating{
background-color:green;
z-index:4;
+ padding:5px 10px;
}
+.topReg{text-align:right;}
+.topReg > div{display:inline-block;}
+.topReg > span,a{vertical-align:top;}
+.close{vertical-align:top;color:white;}
+
+.modalBody{text-align:right;}
+.modalError{text-algin:center;color:red;font-weight:bold;}
#modalBlock{}/*
margin-left:auto;
margin-right:auto;