| 1 |
<?php |
| 2 |
|
| 3 |
class Dokuwiki { |
| 4 |
|
| 5 |
/** |
| 6 |
* search for a dokuwiki in that folder. |
| 7 |
* if this class think that a dokuwiki is here, returns the version number, normalized. |
| 8 |
*/ |
| 9 |
function search($root) { |
| 10 |
|
| 11 |
if (is_file($root."/VERSION") && is_dir($root."/inc") && is_file($root."/doku.php")) { |
| 12 |
$f=fopen($root."/VERSION","rb"); |
| 13 |
if (!$f) return false; |
| 14 |
$s=fgets($f,1024); |
| 15 |
fclose($f); |
| 16 |
if (preg_match('#^([0-9-]{4}-[0-9a-z-]+) #',$s,$mat)) { |
| 17 |
return $mat[1]; |
| 18 |
} |
| 19 |
return false; |
| 20 |
} else { |
| 21 |
return false; |
| 22 |
} |
| 23 |
|
| 24 |
} // search |
| 25 |
|
| 26 |
} // class Dokuwiki |