|
1 | 1 | <?php |
| 2 | + |
2 | 3 | $GLOBALS['showClass']; |
3 | 4 | $GLOBALS['showOther']; |
4 | 5 | $GLOBALS['stevilo'] = 0; |
5 | 6 | $GLOBALS['komentar']; |
6 | 7 | $GLOBALS['status']=1; |
7 | 8 | $GLOBALS['status_message']; |
8 | | -class Config { |
9 | | - function language($a) { |
10 | | - if(file_exists('languages/'.$a.'.php')) { |
11 | | - include('languages/'.$a.'.php'); |
12 | | - $GLOBALS['language'] = $a; |
13 | | - }else { |
14 | | - $GLOBALS['status_message']="I can't find the selected language."; |
15 | | - $GLOBALS['ststus']=0; |
16 | | - } |
17 | | - } |
18 | | - |
19 | | - function showClass ($a) { |
20 | | - if($GLOBALS['status']!=0) { |
21 | | - $GLOBALS['showClass']=$a; |
22 | | - } |
23 | | - } |
24 | | - |
25 | | - function showOther ($a) { |
26 | | - if($GLOBALS['status']!=0) { |
27 | | - $GLOBALS['showOther']=$a; |
28 | | - } |
29 | | - } |
30 | | - |
31 | | - function set($a,$b,$c){ |
32 | | - if($GLOBALS['status']!=0) { |
33 | | - $GLOBALS['stevilo']++; |
34 | | - $this->$a=array($b,$c,$GLOBALS['stevilo']); |
35 | | - } |
36 | | - } |
37 | | - |
38 | | - function toString($class='',$addclass='',$addnoclass=''){ |
39 | | - if($GLOBALS['status']!=0) { |
40 | | - if($GLOBALS['showClass']==''or $GLOBALS['showOther']=='') { |
41 | | - $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]['showClass/showOther'] ; |
42 | | - $GLOBALS['status']=0;} |
43 | | - $string .='<?php |
44 | | -'; if($GLOBALS['showClass']==1) { |
45 | | - $string .= "class ".$class." { |
| 9 | + |
| 10 | +class Config |
| 11 | +{ |
| 12 | + public function language($a) |
| 13 | + { |
| 14 | + if (file_exists('languages/'.$a.'.php')) { |
| 15 | + include('languages/'.$a.'.php'); |
| 16 | + $GLOBALS['language'] = $a; |
| 17 | + } else { |
| 18 | + $GLOBALS['status_message']="I can't find the selected language."; |
| 19 | + $GLOBALS['ststus']=0; |
| 20 | + } |
| 21 | + } |
| 22 | + |
| 23 | + public function showClass($a) |
| 24 | + { |
| 25 | + if ($GLOBALS['status']!=0) { |
| 26 | + $GLOBALS['showClass']=$a; |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + public function showOther($a) |
| 31 | + { |
| 32 | + if ($GLOBALS['status']!=0) { |
| 33 | + $GLOBALS['showOther']=$a; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + public function set($a, $b, $c) |
| 38 | + { |
| 39 | + if ($GLOBALS['status']!=0) { |
| 40 | + $GLOBALS['stevilo']++; |
| 41 | + $this->$a=array($b,$c,$GLOBALS['stevilo']); |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + public function toString($class = '', $addclass = '', $addnoclass = '') |
| 46 | + { |
| 47 | + if ($GLOBALS['status']!=0) { |
| 48 | + if ($GLOBALS['showClass']==''or $GLOBALS['showOther']=='') { |
| 49 | + $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]['showClass/showOther'] ; |
| 50 | + $GLOBALS['status']=0; |
| 51 | + } |
| 52 | + $string .='<?php |
| 53 | +'; if ($GLOBALS['showClass']==1) { |
| 54 | + $string .= "class ".$class." { |
46 | 55 | "; |
47 | | - if (isset($GLOBALS['komentar'][0])) { |
48 | | - $string .= '/*'.$GLOBALS['komentar'][0].'*/ |
| 56 | + if (isset($GLOBALS['komentar'][0])) { |
| 57 | + $string .= '/*'.$GLOBALS['komentar'][0].'*/ |
49 | 58 | '; |
50 | | - } |
51 | | - foreach ($this as $k=>$v) { |
52 | | - if($v['1'] == '') { |
53 | | - $string .= 'public $'.$k." = '".$v[0]."'; |
54 | | - "; |
55 | | - }else{ |
56 | | - $string .= 'public $'.$k." = '".$v[0]."'; //".$v[1]." |
57 | | - "; |
58 | | - } |
59 | | - if($GLOBALS['komentar'][$v[2]] != ''){ |
60 | | - $string .= ' |
| 59 | + } |
| 60 | + foreach ($this as $k => $v) { |
| 61 | + if ($v['1'] == '') { |
| 62 | + $string .= 'public $'.$k." = '".$v[0]."'; |
| 63 | + "; |
| 64 | + } else { |
| 65 | + $string .= 'public $'.$k." = '".$v[0]."'; //".$v[1]." |
| 66 | + "; |
| 67 | + } |
| 68 | + if ($GLOBALS['komentar'][$v[2]] != '') { |
| 69 | + $string .= ' |
61 | 70 | /*'.$GLOBALS['komentar'][$v[2]].'*/ |
62 | 71 | '; |
63 | | - } |
64 | | - } |
65 | | - if($addclass!='') { |
66 | | - $string .=' |
67 | | -'.$addclass.'';} |
68 | | - $string .=" |
| 72 | + } |
| 73 | + } |
| 74 | + if ($addclass!='') { |
| 75 | + $string .=' |
| 76 | +'.$addclass.''; |
| 77 | + } |
| 78 | + $string .=" |
69 | 79 | }";$string .=" |
70 | 80 |
|
71 | | -";} |
72 | | - if($GLOBALS['showOther']==1) { |
73 | | -if (isset($GLOBALS['komentar'][0])) { |
74 | | - $string .= '/*'.$GLOBALS['komentar'][0].'*/'; |
75 | | - } |
76 | | -foreach ($this as $k=>$v) { |
77 | | - if($v['1'] == '') { |
78 | | - $string .= ' |
| 81 | +"; |
| 82 | + } |
| 83 | + if ($GLOBALS['showOther']==1) { |
| 84 | + if (isset($GLOBALS['komentar'][0])) { |
| 85 | + $string .= '/*'.$GLOBALS['komentar'][0].'*/'; |
| 86 | + } |
| 87 | + foreach ($this as $k => $v) { |
| 88 | + if ($v['1'] == '') { |
| 89 | + $string .= ' |
79 | 90 | $'.$k.' = "'.$v[0].'"; '; |
80 | | - }else{ |
81 | | - $string .= ' |
| 91 | + } else { |
| 92 | + $string .= ' |
82 | 93 | $'.$k.' = "'.$v[0].'"; //'.$v[1]; |
83 | | -if($GLOBALS['komentar'][$v[2]] != ''){ |
84 | | - $string .= ' |
| 94 | + if ($GLOBALS['komentar'][$v[2]] != '') { |
| 95 | + $string .= ' |
85 | 96 |
|
86 | 97 | /*'.$GLOBALS['komentar'][$v[2]].'*/'; |
87 | | - } |
88 | | - } |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + if ($addnoclass!='') { |
| 103 | + $string .=' |
89 | 104 |
|
90 | | -} |
91 | | -} |
92 | | -if($addnoclass!='') { |
93 | | -$string .=' |
94 | | -
|
95 | | -'.$addnoclass.''; } |
96 | | -$string .=" |
| 105 | +'.$addnoclass.''; |
| 106 | + } |
| 107 | + $string .=" |
97 | 108 | ?>"; |
98 | | - return $string; |
99 | | - } |
100 | | - } |
101 | | - |
102 | | - function comment($a) { |
103 | | - if($$GLOBALS['status']!=0) { |
104 | | - $GLOBALS['komentar'][''.$GLOBALS['stevilo'].''] = $a; |
105 | | - } |
106 | | - } |
107 | | - |
108 | | - function toFile($file,$data) { |
109 | | - if($GLOBALS['status']!=0) { |
110 | | - $fd = fopen ($file , "w") or $statusek=0; |
111 | | - if($statusek==0) { |
112 | | - $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["can't open"]; |
113 | | - $GLOBALS['status']=0; |
114 | | - } |
115 | | - fwrite($fd, $data); |
116 | | - fclose($fd) ; |
117 | | - |
118 | | - $fd = fopen ($file , "r") or $statusek2=0; |
119 | | - if($statusek2==0) { |
120 | | - $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["can't open"]; |
121 | | - $GLOBALS['status']=0; |
122 | | - } |
123 | | - $data2=fread ($fd , filesize ($file)); |
124 | | - if($data==$data2) { |
125 | | - $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["ok"]; |
126 | | - $GLOBALS['status']=1; |
127 | | - } |
128 | | - fclose($fd) ; |
129 | | - } |
130 | | - } |
131 | | - |
132 | | - function status() { |
133 | | - return $GLOBALS['status']; |
134 | | - } |
135 | | - |
136 | | - function status_message() { |
137 | | - return $GLOBALS['status_message']; |
138 | | - } |
| 109 | + return $string; |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + public function comment($a) |
| 114 | + { |
| 115 | + if ($$GLOBALS['status']!=0) { |
| 116 | + $GLOBALS['komentar'][''.$GLOBALS['stevilo'].''] = $a; |
| 117 | + } |
| 118 | + } |
| 119 | + |
| 120 | + public function toFile($file, $data) |
| 121 | + { |
| 122 | + if ($GLOBALS['status']!=0) { |
| 123 | + $fd = fopen($file, "w") or $statusek=0; |
| 124 | + if ($statusek==0) { |
| 125 | + $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["can't open"]; |
| 126 | + $GLOBALS['status']=0; |
| 127 | + } |
| 128 | + fwrite($fd, $data); |
| 129 | + fclose($fd) ; |
| 130 | + |
| 131 | + $fd = fopen($file, "r") or $statusek2=0; |
| 132 | + if ($statusek2==0) { |
| 133 | + $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["can't open"]; |
| 134 | + $GLOBALS['status']=0; |
| 135 | + } |
| 136 | + $data2=fread($fd, filesize($file)); |
| 137 | + if ($data==$data2) { |
| 138 | + $GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["ok"]; |
| 139 | + $GLOBALS['status']=1; |
| 140 | + } |
| 141 | + fclose($fd) ; |
| 142 | + } |
| 143 | + } |
| 144 | + |
| 145 | + public function status() |
| 146 | + { |
| 147 | + return $GLOBALS['status']; |
| 148 | + } |
| 149 | + |
| 150 | + public function status_message() |
| 151 | + { |
| 152 | + return $GLOBALS['status_message']; |
| 153 | + } |
139 | 154 | } |
140 | | -?> |
|
0 commit comments