Редакция 63 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 63 | Редакция 70 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | class Core { |
3 | class Core { |
4 | 4 | ||
5 | function getRepList($distro,$version,$dblink) { |
5 | function getRepList($distro,$version,$dblink) { |
6 | $query =& $dblink->query("SELECT * FROM settings"); |
6 | $query =& $dblink->query("SELECT * FROM settings"); |
7 | $settings = array(); |
7 | $settings = array(); |
8 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
8 | while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) { |
9 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
9 | $settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]); |
10 | }; |
10 | }; |
11 | $query =& $dblink->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id JOIN dtype p ON d.disttype=p.type_id WHERE v.dist_id='$distro' AND v.version_id='$version'"); |
11 | $query =& $dblink->query("SELECT * FROM version v JOIN distribution d ON d.dist_id=v.dist_id JOIN dtype p ON d.disttype=p.type_id WHERE v.dist_id='$distro' AND v.version_id='$version'"); |
12 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
12 | $query->fetchInto($infodist, DB_FETCHMODE_ASSOC); |
13 | $query =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN version v2 ON v.ver_id=v2.version_id JOIN scheme s ON s.scheme_id=r.scheme_id WHERE v.ver_id='$version' ORDER BY r.rtype_id, r.scheme_id ASC"); |
13 | $query =& $dblink->query("SELECT * FROM repository r JOIN ver2rep v ON r.rep_id=v.rep_id JOIN version v2 ON v.ver_id=v2.version_id JOIN scheme s ON s.scheme_id=r.scheme_id WHERE v.ver_id='$version' ORDER BY r.rtype_id, r.scheme_id ASC"); |
14 | while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) { |
14 | while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) { |
15 | $repscheme = stripslashes($resinfo["scheme"]); |
15 | $repscheme = stripslashes($resinfo["scheme"]); |
16 | 16 | ||
17 | $querysect =& $dblink->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE |
17 | $querysect =& $dblink->query("SELECT * FROM section s JOIN sect2rep r ON s.sect_id=r.sect_id WHERE |
18 | r.rep_id='$resinfo[rep_id]'"); |
18 | r.rep_id='$resinfo[rep_id]'"); |
19 | $sections = ""; |
19 | $sections = ""; |
20 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
20 | while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) { |
21 | $sections .= stripslashes($section["sectname"])." "; |
21 | $sections .= stripslashes($section["sectname"])." "; |
22 | }
|
22 | }
|
23 | 23 | ||
24 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
24 | $repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme); |
25 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
25 | $repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme); |
26 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
26 | $repscheme = str_replace("{URL}",$settings["url"],$repscheme); |
27 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
27 | $repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme); |
28 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
28 | $repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme); |
29 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
29 | $repscheme = str_replace("{SECT}",$sections,$repscheme); |
30 | 30 | ||
31 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
31 | $result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n"; |
32 | }
|
32 | }
|
33 | return $result; |
33 | return $result; |
34 | }
|
34 | }
|
35 | 35 | ||
36 | function getInfo($message,$dblink){ |
36 | function getInfo($message,$dblink){ |
37 | $answer = array(); |
37 | $answer = array(); |
38 | 38 | ||
39 | if (preg_match("/linux/i",$message)) { |
39 | if (preg_match("/linux/i",$message)) { |
40 | $dist_id = 0; |
40 | $dist_id = 0; |
41 | $dist_info = ""; |
41 | $dist_info = ""; |
42 | $vers_id = 0; |
42 | $vers_id = 0; |
43 | $vers_info = ""; |
43 | $vers_info = ""; |
44 | $qd =& $dblink->query("SELECT * FROM distribution"); |
44 | $qd =& $dblink->query("SELECT * FROM distribution"); |
45 | while ($qd->fetchInto($res, DB_FETCHMODE_ASSOC)) { |
45 | while ($qd->fetchInto($res, DB_FETCHMODE_ASSOC)) { |
46 | if (preg_match("/".stripslashes($res["distua"])."/i",$message)) { |
46 | if (preg_match("/".stripslashes($res["distua"])."/i",$message)) { |
47 | $dist_id = $res["dist_id"]; |
47 | $dist_id = $res["dist_id"]; |
48 | $dist_info = stripslashes($res["distname"]); |
48 | $dist_info = stripslashes($res["distname"]); |
49 | $qv =& $dblink->query("SELECT * FROM version WHERE dist_id='$dist_id'"); |
49 | $qv =& $dblink->query("SELECT * FROM version WHERE dist_id='$dist_id'"); |
50 | while($qv->fetchInto($rev, DB_FETCHMODE_ASSOC)) { |
50 | while($qv->fetchInto($rev, DB_FETCHMODE_ASSOC)) { |
51 | if (preg_match("/".stripslashes($rev["vcodename"])."/i",$message)) { |
51 | if (preg_match("/".stripslashes($rev["vcodename"])."/i",$message)) { |
52 | $vers_id = $rev["version_id"]; |
52 | $vers_id = $rev["version_id"]; |
53 | $vers_info = stripslashes($rev["version"])." “".stripslashes($rev["vname"])."”"; |
53 | $vers_info = stripslashes($rev["version"])." “".stripslashes($rev["vname"])."”"; |
54 | }
|
54 | }
|
55 | }
|
55 | }
|
56 | }
|
56 | }
|
57 | }
|
57 | }
|
58 | $answer[] = "Linux"; |
58 | $answer[] = "Linux"; |
59 | $answer[] = "Судя по всему у Вас операционная система "; |
59 | $answer[] = "Судя по всему у Вас операционная система "; |
60 | if ($dist_id!=0) { |
60 | if ($dist_id!=0) { |
61 | $answer[] = $dist_id; |
61 | $answer[] = $dist_id; |
62 | $answer[] = $dist_info; |
62 | $answer[] = $dist_info; |
63 | }
|
63 | }
|
64 | if ($vers_id!=0) { |
64 | if ($vers_id!=0) { |
65 | $answer[] = $vers_id; |
65 | $answer[] = $vers_id; |
66 | $answer[] = $vers_info; |
66 | $answer[] = $vers_info; |
67 | }
|
67 | }
|
68 | 68 | ||
69 | } else { |
69 | } else { |
70 | $answer[] = "unknown"; |
70 | $answer[] = "unknown"; |
71 | $answer[] = "Ресурс рассчитан явно не на Вашу операционную систему!"; |
71 | $answer[] = "Ресурс рассчитан явно не на Вашу операционную систему!"; |
72 | }
|
72 | }
|
73 | 73 | ||
74 | return $answer; |
74 | return $answer; |
75 | }
|
75 | }
|
- | 76 | ||
- | 77 | function getInterfacesList($current,$dblink) { |
|
- | 78 | $url = parse_url($current); |
|
- | 79 | $path = array(); |
|
- | 80 | $path = split("/",$url["path"]); |
|
- | 81 | $currentIF = str_replace(".php","",$path[count($path)-1]); |
|
- | 82 | $req =& $dblink->query("SELECT * FROM interfaces WHERE interface NOT LIKE '$currentIF'"); |
|
- | 83 | $iflist = "Интерфейсы: "; |
|
- | 84 | while ($req->fetchInto($if, DB_FETCHMODE_ASSOC)) { |
|
- | 85 | $iflist .= "<a href='./".stripslashes($if["interface"]).".php'>".strtolower(stripslashes($if["interfaceinfo"]))."</a>, "; |
|
- | 86 | }
|
|
- | 87 | $iflist = substr($iflist, 0, strlen($iflist)-2); |
|
- | 88 | return $iflist; |
|
- | 89 | }
|
|
76 | }
|
90 | }
|
77 | 91 | ||
78 | ?>
|
92 | ?>
|
79 | 93 |