Move 'isvalid_email' into platal.inc.php
[platal.git] / modules / core.php
index 9043210..cbc40f0 100644 (file)
@@ -30,7 +30,9 @@ class CoreModule extends PLModule
             'send_bug'    => $this->make_hook('bug', AUTH_COOKIE),
             'purge_cache' => $this->make_hook('purge_cache', AUTH_COOKIE, 'admin'),
             'get_rights'  => $this->make_hook('get_rights', AUTH_MDP, 'admin'),
-            'wiki_help'   => $this->make_hook('wiki_help', AUTH_PUBLIC),
+
+            'wiki_help'    => $this->make_hook('wiki_help', AUTH_PUBLIC),
+            'wiki_preview' => $this->make_hook('wiki_preview', AUTH_COOKIE, 'user', NO_AUTH),
 
             'valid.html'  => $this->make_hook('valid', AUTH_PUBLIC),
             'favicon.ico' => $this->make_hook('favicon', AUTH_PUBLIC),
@@ -47,22 +49,14 @@ class CoreModule extends PLModule
     {
         global $globals;
         header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
-        if (!empty($GLOBALS['IS_XNET_SITE']) && $globals->asso()) {
-            new_skinned_page('core/403.tpl');
-        } else {
-            $page->changeTpl('core/403.tpl');
-        }
+        $page->changeTpl('core/403.tpl');
     }
 
     function handler_404(&$page)
     {
         global $globals, $platal;
         header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
-        if (!empty($GLOBALS['IS_XNET_SITE']) && $globals->asso()) {
-            new_group_open_page('core/404.tpl');
-        } else {
-            $page->changeTpl('core/404.tpl');
-        }
+        $page->changeTpl('core/404.tpl');
         $page->assign('near', $platal->near_hook());
     }
 
@@ -135,6 +129,15 @@ class CoreModule extends PLModule
         $page->changeTpl('core/wiki.help.tpl', SIMPLE);
         $page->assign('wiki_help', MiniWiki::help($action == 'title'));
     }
+
+    /// Shared handler for wiki syntax result preview
+    function handler_wiki_preview(&$page, $action = 'title')
+    {
+        header('Content-Type: text/html; charset=utf-8');
+        $text = Get::v('text');
+        echo MiniWiki::wikiToHtml($text, $action == 'title');
+        exit;
+    }
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: