Default skin can be specified in the configuration file.
[platal.git] / include / validations / evts.inc.php
index 1adf6db..f9c2441 100644 (file)
@@ -139,11 +139,32 @@ class EvtReq extends Validate
                               peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide')",
                 $this->uid, $this->titre, $this->texte,
                 $this->peremption, $this->pmin, $this->pmax)) {
+            $eid = XDB::insertId();
             if ($this->img) {
                 XDB::execute("INSERT INTO evenements_photo
                                       SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
                              XDB::insertId(), $this->imgtype, $this->imgx, $this->imgy, $this->img);
             }
+            global $globals;
+            if ($globals->banana->event_forum) {
+                require_once 'user.func.inc.php';
+                $forlife = get_user_forlife($this->uid);
+                require_once 'banana/forum.inc.php';
+                $banana = new ForumsBanana($forlife);
+                $text = strip_tags($this->texte, '<p><br><li><ul><ol><a>');
+                $text = preg_replace(',<a href="([^"]+)">(.*?)</a>,', '$1', $text);
+                $text = preg_replace('/<li>/', '* ', $text);
+                $text = preg_replace(',</?.+?>,i', "\n", $text);
+                $text = preg_replace("/\n{2,}/", "\n\n", $text);
+                $post = $banana->post($globals->banana->event_forum,
+                                      $globals->banana->event_reply,
+                                      $this->titre, pl_entity_decode($text));
+                if ($post != -1) {
+                    XDB::execute("UPDATE  evenements
+                                     SET  creation_date = creation_date, post_id = {?}
+                                   WHERE  id = {?}", $post, $eid);
+                }
+            }
             return true;
         }
         return false;