]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/doc.php
Fix reference to sources class variable
[quix0rs-gnu-social.git] / actions / doc.php
index 1adb9b0750cbabc04848c110a0d9f38a13a6997a..836f039d32128d9696d5bbc07b598155fd803218 100644 (file)
@@ -29,7 +29,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('STATUSNET')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -58,12 +58,24 @@ class DocAction extends Action
     function handle($args)
     {
         parent::handle($args);
-        $this->title    = $this->trimmed('title');
-        $this->filename = INSTALLDIR.'/doc-src/'.$this->title;
-        if (!file_exists($this->filename)) {
-            $this->clientError(_('No such document.'));
-            return;
+
+        $this->title  = $this->trimmed('title');
+        $this->output = null;
+
+        if (Event::handle('StartLoadDoc', array(&$this->title, &$this->output))) {
+
+            $this->filename = INSTALLDIR.'/doc-src/'.$this->title;
+            if (!file_exists($this->filename)) {
+                $this->clientError(_('No such document.'));
+                return;
+            }
+
+            $c = file_get_contents($this->filename);
+            $this->output = common_markup_to_html($c);
+
+            Event::handle('EndLoadDoc', array($this->title, &$this->output));
         }
+
         $this->showPage();
     }
 
@@ -93,9 +105,7 @@ class DocAction extends Action
      */
     function showContent()
     {
-        $c      = file_get_contents($this->filename);
-        $output = common_markup_to_html($c);
-        $this->raw($output);
+        $this->raw($this->output);
     }
 
     /**