Plugins can now register their own custom actions for $_GET["do"]. (Backport from unstable)
authorDan
Sat, 29 Nov 2008 22:50:19 -0500
changeset 314 f379fdf3b4d7
parent 313 6080514218ca
child 317 12e099193850
child 328 17eebd541742
Plugins can now register their own custom actions for $_GET["do"]. (Backport from unstable)
index.php
--- a/index.php	Thu Nov 27 10:57:50 2008 -0500
+++ b/index.php	Sat Nov 29 22:50:19 2008 -0500
@@ -59,7 +59,21 @@
   switch($_GET['do'])
   {
     default:
-      die_friendly('Invalid action', '<p>The action "'.htmlspecialchars($_GET['do']).'" is not defined. Return to <a href="'.makeUrl($paths->page).'">viewing this page\'s text</a>.</p>');
+      $code = $plugins->setHook('page_action');
+      ob_start();
+      foreach ( $code as $cmd )
+      {
+        eval($cmd);
+      }
+      if ( $contents = ob_get_contents() )
+      {
+        ob_end_clean();
+        echo $contents;
+      }
+      else
+      {
+        die_friendly('Invalid action', '<p>The action "'.htmlspecialchars($_GET['do']).'" is not defined. Return to <a href="'.makeUrl($paths->page).'">viewing this page\'s text</a>.</p>');
+      }
       break;
     case 'view':
       // echo PageUtils::getpage($paths->page, true, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));