コード例 #1
0
 /**
  * @todo doc
  * @param $path @todo doc
  * @return @todo doc
  */
 public function check($path)
 {
     $out = false;
     $path = X2WAllowedPaths::cleanPath($path);
     /*
      * Checking if its a known file.
      */
     $out = in_array($path, $this->_paths['files']);
     /*
      * Checking if its a known directory.
      */
     if (!$out) {
         $auxPath = dirname($path);
         if ($this->_isRecursive) {
             foreach ($this->_paths['directories'] as $dir) {
                 if (strpos($auxPath, $dir) === 0) {
                     $out = true;
                     break;
                 }
             }
         } else {
             $out = in_array($auxPath, $this->_paths['directories']);
         }
     }
     return $out;
 }
コード例 #2
0
 /**
  * @todo doc
  * @param $out @todo doc
  */
 protected function getInfoAllowedPaths(&$out)
 {
     global $wgXML2WikiConfig;
     /*
      * Section: Allowed Paths
      * @{
      */
     $out .= "== " . wfMsg('sinfo-allowed-paths') . " ==\n";
     if ($wgXML2WikiConfig['show']['allowedpaths']) {
         $out .= "<p>" . wfMsg('sinfo-allowed-paths-info') . ".</p>\n";
         $out .= "{|class=\"wikitable\"\n";
         $out .= "|-\n";
         $out .= "!colspan=\"2\"|" . wfMsg('sinfo-allowed-paths') . "\n";
         $list = $this->_allowedPaths->directories();
         $len = count($list);
         if ($len) {
             $out .= "|-\n";
             $out .= "!rowspan=\"{$len}\" style=\"vertical-align:top;text-align:left;\"|" . wfMsg('directories') . "\n";
             for ($i = 0, $j = 1; $i < $len; $i++, $j++) {
                 $out .= "|{$list[$i]}\n";
                 if ($j < $len) {
                     $out .= "|-\n";
                 }
             }
         }
         $list = $this->_allowedPaths->files();
         $len = count($list);
         if ($len) {
             $out .= "|-\n";
             $out .= "!rowspan=\"{$len}\" style=\"vertical-align:top;text-align:left;\"|" . wfMsg('files') . "\n";
             for ($i = 0, $j = 1; $i < $len; $i++, $j++) {
                 $out .= "|{$list[$i]}\n";
                 if ($j < $len) {
                     $out .= "|-\n";
                 }
             }
         }
         $list = $this->_allowedPaths->noAccess();
         $len = count($list);
         if ($len) {
             $out .= "|-\n";
             $out .= "!rowspan=\"{$len}\" style=\"vertical-align:top;text-align:left;\"|" . wfMsg('noaccess') . "\n";
             for ($i = 0, $j = 1; $i < $len; $i++, $j++) {
                 $out .= "|style=\"text-decoration:line-through;\"|{$list[$i]}\n";
                 if ($j < $len) {
                     $out .= "|-\n";
                 }
             }
         }
         $list = $this->_allowedPaths->unknown();
         $len = count($list);
         if ($len) {
             $out .= "|-\n";
             $out .= "!rowspan=\"{$len}\" style=\"vertical-align:top;text-align:left;\"|" . wfMsg('unknown') . "\n";
             for ($i = 0, $j = 1; $i < $len; $i++, $j++) {
                 $out .= "|style=\"color:#a60000\"|{$list[$i]}\n";
                 if ($j < $len) {
                     $out .= "|-\n";
                 }
             }
         }
         $out .= "|}\n";
     } else {
         $out .= "<p>" . wfMsg('sinfo-information-disabled') . ".</p>\n";
     }
     /* @} */
 }