]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/doc.php
Merge branch 'master' of gitorious.org:statusnet/mainline into testing
[quix0rs-gnu-social.git] / actions / doc.php
index 25d363472a2cca2feadf3d1292c1d226c64f8bd5..459f5f09683ca013af2ffa7335fd06b4fb7a9f4c 100644 (file)
@@ -54,6 +54,9 @@ class DocAction extends Action
         parent::prepare($args);
 
         $this->title  = $this->trimmed('title');
+        if (!preg_match('/^[a-zA-Z0-9_-]*$/', $this->title)) {
+            $this->title = 'help';
+        }
         $this->output = null;
 
         $this->loadDoc();
@@ -170,6 +173,10 @@ class DocAction extends Action
         }
 
         $local = glob(INSTALLDIR.'/local/doc-src/'.$this->title.'.*');
+        if ($local === false) {
+            // Some systems return false, others array(), if dir didn't exist.
+            $local = array();
+        }
 
         if (count($local) || isset($localDef)) {
             return $this->negotiateLanguage($local, $localDef);
@@ -180,6 +187,9 @@ class DocAction extends Action
         }
 
         $dist = glob(INSTALLDIR.'/doc-src/'.$this->title.'.*');
+        if ($dist === false) {
+            $dist = array();
+        }
 
         if (count($dist) || isset($distDef)) {
             return $this->negotiateLanguage($dist, $distDef);