Debian Codegraph @

src/softs/Roundcube.php

raw
1 <?php
2
3 class Roundcube {
4
5 /**
6 * search for a roundcube in that folder.
7 * if this class think that a roundcube is here, returns the version number, normalized.
8 */
9 function search($root) {
10
11 if (is_dir($root."/vendor") && is_dir($root."/skins") && is_dir($root."/program") && is_file($root."/public_html/index.php")) {
12 $f=fopen($root."/public_html/index.php","rb");
13 if (!$f) return false;
14 $line=0; $found=false;
15 while(($s=fgets($f,1024)) && $line<10) {
16 $line++;
17 if (preg_match('#Roundcube Webmail IMAP Client#',$s)) {
18 $found=true;
19 }
20 if ($found && preg_match('#Version ([0-9\.]+)#',$s,$mat)) {
21 fclose($f);
22 return $mat[1];
23 }
24 }
25 fclose($f);
26 return false;
27 } else {
28 return false;
29 }
30
31 } // search
32
33 } // class Roundcube