Хранилища Subversion ant

Редакция

Редакция 74 | Редакция 82 | К новейшей редакции | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
41 alex-w 1
<?php
2
 
3
class Core {
59 alex-w 4
 
5
	function getRepList($distro,$version,$dblink) {
6
		$query =& $dblink->query("SELECT * FROM settings");
7
		$settings = array();
8
		while ($query->fetchInto($setting, DB_FETCHMODE_ASSOC)) {
9
			$settings[stripslashes($setting["opt"])] = stripslashes($setting["optvalue"]);
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'");
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");
14
		while ($query->fetchInto($resinfo, DB_FETCHMODE_ASSOC)) {
15
	    		$repscheme = stripslashes($resinfo["scheme"]);
16
 
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]'");
19
	    		$sections = "";
20
            		while ($querysect->fetchInto($section,DB_FETCHMODE_ASSOC)) {
21
                    		$sections .= stripslashes($section["sectname"])." ";
22
            		}
23
 
24
	    		$repscheme = str_replace("{TYPE}",stripslashes($infodist["type"]),$repscheme);
25
	    		$repscheme = str_replace("{PROTO}",$settings["proto"],$repscheme);
26
	    		$repscheme = str_replace("{URL}",$settings["url"],$repscheme);
27
            		$repscheme = str_replace("{REP}",stripslashes($resinfo["repname"]),$repscheme);
28
	    		$repscheme = str_replace("{DIST}",stripslashes($infodist["vcodename"]),$repscheme);
29
	    		$repscheme = str_replace("{SECT}",$sections,$repscheme);
30
 
31
	    		$result .= "# ".stripslashes($resinfo["repdescribe"])."\n".$repscheme."\n\n";
32
        	}
33
		return $result;
34
	}
35
 
62 alex-w 36
	function getInfo($message,$dblink){
37
		$answer = array();
38
 
41 alex-w 39
		if (preg_match("/linux/i",$message)) {
62 alex-w 40
			$dist_id = 0;
41
			$dist_info = "";
63 alex-w 42
			$vers_id = 0;
43
			$vers_info = "";
62 alex-w 44
			$qd =& $dblink->query("SELECT * FROM distribution");
45
			while ($qd->fetchInto($res, DB_FETCHMODE_ASSOC)) {
46
				if (preg_match("/".stripslashes($res["distua"])."/i",$message)) {
47
					$dist_id = $res["dist_id"];
48
					$dist_info = stripslashes($res["distname"]);
49
					$qv =& $dblink->query("SELECT * FROM version WHERE dist_id='$dist_id'");
50
					while($qv->fetchInto($rev, DB_FETCHMODE_ASSOC)) {
63 alex-w 51
						if (preg_match("/".stripslashes($rev["vcodename"])."/i",$message)) {
52
							$vers_id = $rev["version_id"];
53
							$vers_info = stripslashes($rev["version"])." &#8220;".stripslashes($rev["vname"])."&#8221;";
54
						}
62 alex-w 55
					}
56
				}
57
			}
58
			$answer[] = "Linux";
59
			$answer[] = "Судя по всему у Вас операционная система ";
60
			if ($dist_id!=0) {
61
				$answer[] = $dist_id;
62
				$answer[] = $dist_info;
63
			}
64
			if ($vers_id!=0) {
65
				$answer[] = $vers_id;
66
				$answer[] = $vers_info;
67
			}
68
 
41 alex-w 69
		} else {
62 alex-w 70
			$answer[] = "unknown";
71
			$answer[] = "Ресурс рассчитан явно не на Вашу операционную систему!";
41 alex-w 72
		}
62 alex-w 73
 
42 alex-w 74
		return $answer;
75
	}
70 alex-w 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'");
74 alex-w 83
		$iflist = "<a href='./'>Интерфейсы</a>: ";
70 alex-w 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
	}
79 alex-w 90
 
91
	function getCSSList($dblink) {
92
		$req =& $dblink->query("SELECT * FROM distribution");
93
		if ($req->numRows()>0) {
94
			while ($req->fetchInto($dist, DB_FETCHMODE_ASSOC)) {
95
				if ($dist["distlogo"]) {
96
					$css .= ".".stripslashes($dist["distua"])." { display: inline; padding-left: 15px; background: transparent url(./img/logo/".$dist["distua"].".gif) top left no-repeat; }\n";
97
					$css .= ".".stripslashes($dist["distua"])."-em { display: inline; padding-left: 32px; background: transparent url(./img/logo/".stripslashes($dist["distua"])."-em.gif) top left no-repeat; }\n";
98
				} else {
99
					$css .= "";
100
				}
101
			}
102
		} else {
103
			$css = "";
104
		}
105
		return $css;
106
	}
41 alex-w 107
}
108
 
109
?>