syntaxe POO (visibilite) et maj indentation
[mw_sourceml] / app / controllers / forms / sourceml.php
index 46fc014..5f6f608 100644 (file)
@@ -2,9 +2,9 @@
 
   class mw_forms_sourceml extends mw_controller{
 
-    var $forms_contact_mod;
+    public $forms_contact_mod;
 
-    function validate(){
+    public function validate(){
       $env = $this->env();
       if($this->forms_contact_mod = $env->get_controller("forms/contact")){
         return $this->forms_contact_mod->validate();
       return "impossible de trouver le controlleur forms/contact";
     }
 
-    function contact_author(){
+    public function contact_author(){
       $env = $this->env();
       if(file_exists($env->path("mw_dir")."libs/ptitcaptcha.php")) require_once $env->path("mw_dir")."libs/ptitcaptcha.php";
       $data = $env->data();
-      if(($status = $data->source_status()) !== false)
-      { foreach($status as $id_source_status => $source_status)
-        { if($source_status["nom"] == "album") $album_status_id = $id_source_status;
+      if(($status = $data->source_status()) !== false){
+        foreach($status as $id_source_status => $source_status){
+          if($source_status["nom"] == "album") $album_status_id = $id_source_status;
           if(isset($album_status_id)) break;
         }
-        if(isset($album_status_id))
-        { if($groupe = $data->groupe($_GET[$env->param("id")]))
-          { if($groupe["contact_form"] && $groupe["email"])
-            { $env->set_out("groupe", $groupe);
+        if(isset($album_status_id)){
+          if($groupe = $data->groupe($_GET[$env->param("id")])){
+            if($groupe["contact_form"] && $groupe["email"]){
+              $env->set_out("groupe", $groupe);
               $select = array("status" => $album_status_id);
               $select["id_groupe"] = $groupe["id"];
-              if(($albums = $data->sources($select)) !== false)
-              { $env->set_out("albums", $albums);
-                if($_POST)
-                { if
-                  ( $this->send
-                    ( $env,
+              if(($albums = $data->sources($select)) !== false){
+                $env->set_out("albums", $albums);
+                if($_POST){
+                  if(
+                    $this->send(
+                      $env,
                       $_POST["email"],
                       "[".$env->config("site_name")." - ".$groupe["nom"]."] nouveau message",
                       $_POST["message"],
                       $groupe["email"],
                       $groupe["captcha"]
                     )
-                  )
-                  { $env->redirect
-                    ( $env->url("sources/groupe/view", array("id" => $_GET[$env->param("id")])),
+                  ){
+                    $env->redirect(
+                      $env->url("sources/groupe/view", array("id" => $_GET[$env->param("id")])),
                       "Le message a été envoyé"
                     );
                   }
@@ -49,8 +49,8 @@
               }
               else $env->erreur("impossible de lire la liste des albums");
             }
-            else
-            { $env->run("sources/groupe/view", array("get" => array("id" => $groupe["id"])));
+            else{
+              $env->run("sources/groupe/view", array("get" => array("id" => $groupe["id"])));
               return;
             }
           }
       else $env->erreur("Impossible de lire la liste des status de source");
     }
 
-    function send(&$env, $from, $titre, $message, $dest, $captcha)
-    { $env->set_out("ENVOYE", false);
+    public function send(&$env, $from, $titre, $message, $dest, $captcha){
+      $env->set_out("ENVOYE", false);
       if($captcha && !class_exists("PtitCaptchaHelper")){
         $env->erreur("fichier du captcha introuvable");
         return false;
       }
-      if(!$captcha || PtitCaptchaHelper::checkCaptcha())
-      { if($from)
-        { if($dest)
-          { if
-            ( mail
-              ( $dest,
+      if(!$captcha || PtitCaptchaHelper::checkCaptcha()){
+        if($from){
+          if($dest){
+            if(
+              mail(
+                $dest,
                 $titre,
                 $message,
                  "From: ".$from."\r\n"
                 ."Reply-To: ".$from."\r\n"
               )
-            )
-            { $env->set_out("ENVOYE", true);
+            ){
+              $env->set_out("ENVOYE", true);
               return true;
             }
             else $env->erreur("Erreur à l'envoi du mail");
@@ -93,5 +93,3 @@
     }
 
   }
-
-?>
\ No newline at end of file