cleanup
[xendri.git] / lib / core / htaccess.php
blob6edcdbad8099bf32be787b636619b6e24d8ddeb8
1 <?
2 class htaccess
4 private $order;
5 private $deny;
6 private $allow;
7 private $code;
9 function __construct($dir)
11 if (!is_dir($dir)) throw new XMLException(QConst::X_DIR_NOT_FOUND, "'$dir' isn't a directory!");
12 if (file_exists($dir.'/.htaccess')) $htcode = file_get_contents($dir.'/.htaccess');
13 $this->code = $htcode;
14 $this->order = $this->get_order($htcode);
17 private function get_order($code)
19 $regexp = '/order\\s(deny|allow),\\s?(deny|allow)/i';
20 preg_match($regexp, $code, $matches);
21 array_shift($matches);
22 return $matches;
25 private function get_acces($code)
27 $regexp = '/(deny|allow)\\s+from\\s+(all|[^\\s]+)/i';
28 preg_match_all($regexp, $code, $mathes);
29 return $mathes;