Załącznik 'patch-lib__CmnFns.class.php'
Download 1 --- ./lib/CmnFns.class.php.orig 2007-06-14 21:00:15.000000000 +0200
2 +++ ./lib/CmnFns.class.php 2016-08-24 11:43:42.130492000 +0200
3 @@ -53,7 +53,7 @@ class CmnFns {
4 * @param double $time time to convert in minutes
5 * @return string time in 12 hour time
6 */
7 - function formatTime($time) {
8 + public static function formatTime($time) {
9 global $conf;
10
11 // Set up time array with $timeArray[0]=hour, $timeArray[1]=minute
12 @@ -82,7 +82,7 @@ class CmnFns {
13 * @param string $date string (yyyy-mm-dd)
14 * @return int timestamp
15 */
16 - function formatDateISO($date) {
17 + public static function formatDateISO($date) {
18
19 $time = strtotime($date);
20 return $time;
21 @@ -94,7 +94,7 @@ class CmnFns {
22 * @param string $format format to put datestamp into
23 * @return string date as $format or as default format
24 */
25 - function formatDate($date, $format = '') {
26 + public static function formatDate($date, $format = '') {
27 global $dates;
28
29 if (empty($format)) $format = $dates['general_date'];
30 @@ -108,7 +108,7 @@ class CmnFns {
31 * @param string $format format to put datestamp into
32 * @return string date/time as $format or as default format
33 */
34 - function formatDateTime($ts, $format = '') {
35 + public static function formatDateTime($ts, $format = '') {
36 global $conf;
37 global $dates;
38
39 @@ -123,7 +123,7 @@ class CmnFns {
40 * @param int $minutes minutes to convert
41 * @return string version of hours and minutes
42 */
43 - function minutes_to_hours($minutes) {
44 + public static function minutes_to_hours($minutes) {
45 if ($minutes == 0)
46 return '0 ' . translate('hours');
47
48 @@ -137,7 +137,7 @@ class CmnFns {
49 * @param none
50 * @return url url of curent script directory
51 */
52 - function getScriptURL() {
53 + public static function getScriptURL() {
54 global $conf;
55 $uri = $conf['app']['weburi'];
56 return (strrpos($uri, '/') === false) ? $uri : substr($uri, 0, strlen($uri));
57 @@ -150,7 +150,7 @@ class CmnFns {
58 * @param string $style inline CSS style definition to apply to box
59 * @param boolean $die whether to kill the app or not
60 */
61 - function do_error_box($msg, $style='', $die = true) {
62 + public static function do_error_box($msg, $style='', $die = true) {
63 global $conf;
64
65 echo '<table border="0" cellspacing="0" cellpadding="0" align="center" class="alert" style="' . $style . '"><tr><td>' . $msg . '</td></tr></table>';
66 @@ -171,7 +171,7 @@ class CmnFns {
67 * @param string $msg message to print out
68 * @param string $style inline CSS style definition to apply to box
69 */
70 - function do_message_box($msg, $style='') {
71 + public static function do_message_box($msg, $style='') {
72 echo '<table border="0" cellspacing="0" cellpadding="0" align="center" class="message" style="' . $style . '"><tr><td>' . $msg . '</td></tr></table>';
73 }
74
75 @@ -181,7 +181,7 @@ class CmnFns {
76 * @param none
77 * @return Link object
78 */
79 - function getNewLink() {
80 + public static function getNewLink() {
81 return new Link();
82 }
83
84 @@ -191,7 +191,7 @@ class CmnFns {
85 * @param none
86 * @return Pager object
87 */
88 - function getNewPager() {
89 + public static function getNewPager() {
90 return new Pager();
91 }
92
93 @@ -200,7 +200,7 @@ class CmnFns {
94 * @param none
95 * @return array of cleaned up POST values
96 */
97 - function cleanPostVals() {
98 + public static function cleanPostVals() {
99 $return = array();
100
101 foreach ($_POST as $key => $val)
102 @@ -214,7 +214,7 @@ class CmnFns {
103 * @param none
104 * @return array of cleaned up data
105 */
106 - function cleanVals($data) {
107 + public static function cleanVals($data) {
108 $return = array();
109
110 foreach ($data as $key => $val)
111 @@ -228,7 +228,7 @@ class CmnFns {
112 * @param string $vert value of vertical order
113 * @return string vertical order
114 */
115 - function get_vert_order($get_name = 'vert') {
116 + public static function get_vert_order($get_name = 'vert') {
117 // If no vertical value is specified, use DESC
118 $vert = isset($_GET[$get_name]) ? $_GET[$get_name] : 'DESC';
119
120 @@ -251,7 +251,7 @@ class CmnFns {
121 * @param array $orders all valid order names
122 * @return string order of recorset
123 */
124 - function get_value_order($orders = array(), $get_name = 'order') {
125 + public static function get_value_order($orders = array(), $get_name = 'order') {
126 if (empty($orders)) // Return null if the order array is empty
127 return NULL;
128
129 @@ -269,12 +269,12 @@ class CmnFns {
130
131
132 /**
133 - * Opposite of php's nl2br function.
134 + * Opposite of php's nl2br public static function.
135 * Subs in a newline for all brs
136 * @param string $subject line to make subs on
137 * @return reformatted line
138 */
139 - function br2nl($subject) {
140 + public static function br2nl($subject) {
141 return str_replace('<br />', "\n", $subject);
142 }
143
144 @@ -284,7 +284,7 @@ class CmnFns {
145 * @param string $userid memeber id of user performing the action
146 * @param string $ip ip address of user performing the action
147 */
148 - function write_log($string, $userid = NULL, $ip = NULL) {
149 + public static function write_log($string, $userid = NULL, $ip = NULL) {
150 global $conf;
151 $delim = "\t";
152 $file = $conf['app']['logfile'];
153 @@ -319,7 +319,7 @@ class CmnFns {
154 * @param int $day_of_week day of the week
155 * @param int $type how to return the day name (0 = full, 1 = one letter, 2 = two letter, 3 = three letter)
156 */
157 - function get_day_name($day_of_week, $type = 0) {
158 + public static function get_day_name($day_of_week, $type = 0) {
159 global $days_full;
160 global $days_abbr;
161 global $days_letter;
162 @@ -343,7 +343,7 @@ class CmnFns {
163 * @param string $location new http location
164 * @param int $time time in seconds to wait before redirect
165 */
166 - function redirect($location, $time = 0, $die = true) {
167 + public static function redirect($location, $time = 0, $die = true) {
168 header("Refresh: $time; URL=$location");
169 if ($die) exit;
170 }
171 @@ -352,7 +352,7 @@ class CmnFns {
172 * Prints out the HTML to choose a language
173 * @param none
174 */
175 - function print_language_pulldown() {
176 + public static function print_language_pulldown() {
177 global $conf;
178 ?>
179 <select name="language" class="textbox" onchange="changeLanguage(this);">
180 @@ -375,7 +375,7 @@ class CmnFns {
181 * @param string $str string to search for links to create
182 * @return string with 'URL-like' text changed into clickable links
183 */
184 - function html_activate_links($str) {
185 + public static function html_activate_links($str) {
186 $str = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)', '<a href="\1" target="_blank">\1</a>', $str);
187 $str = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)', '\1<a href="http://\2" target="_blank">\2</a>', $str);
188 $str = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','<a href="mailto:\1">\1</a>', $str);
189 @@ -388,7 +388,7 @@ class CmnFns {
190 * @param integer $page value of current page number
191 * @return integer current page number
192 */
193 - function get_current_page_number($get_name = 'page') {
194 + public static function get_current_page_number($get_name = 'page') {
195 // If no page number is specified, use 0
196 $page = ( isset($_GET[$get_name]) && is_numeric($_GET[$get_name]) ) ? $_GET[$get_name] : 0;
197 return $page;
198 @@ -399,7 +399,7 @@ class CmnFns {
199 * @param none
200 * @return string mail_id
201 */
202 - function get_mail_id($get_name = 'mail_id') {
203 + public static function get_mail_id($get_name = 'mail_id') {
204 // If there isnt one set, return NULL
205 $mail_id = (isset($_GET[$get_name])) ? $_GET[$get_name] : NULL;
206 return $mail_id;
207 @@ -413,7 +413,7 @@ class CmnFns {
208 * @param array $exclude_vars to be excluded from the resulting string
209 * @param boolean $url_encode_ampersands
210 */
211 - function array_to_query_string( $array, $exclude_vars=array(), $url_encode_ampersands=true )
212 + public static function array_to_query_string( $array, $exclude_vars=array(), $url_encode_ampersands=true )
213 {
214 if( ! is_array( $array ) )
215 return '';
216 @@ -441,7 +441,7 @@ class CmnFns {
217 * @param integer $sizeLimit maximum number of messages per page
218 * @param integer $count total number of messages
219 */
220 - function genMultiPagesLinks( $page, $sizeLimit, $count) {
221 + public static function genMultiPagesLinks( $page, $sizeLimit, $count) {
222 global $link;
223
224 $total_pages = $count / $sizeLimit;
225 @@ -501,7 +501,7 @@ class CmnFns {
226 * Generate HTML for search engine
227 * @param $content_type: 'B' (attachment) or 'S' (spam)
228 */
229 - function searchEngine($content_type, $submit_page, $full_search = false) {
230 + public static function searchEngine($content_type, $submit_page, $full_search = false) {
231 global $conf;
232
233 $fields_array = array("f" => translate('From'),
234 @@ -579,7 +579,7 @@ class CmnFns {
235 * @param none
236 * @return value boolean
237 */
238 - function didSearch() {
239 + public static function didSearch() {
240 $return = false;
241 $strings = array('f_string','s_string','t_string','m_string');
242 foreach ($strings as $string) {
243 @@ -593,7 +593,7 @@ class CmnFns {
244 * @param array of variables to exclude
245 * @return query string
246 */
247 - function querystring_exclude_vars( $excl_array = array() ) {
248 + public static function querystring_exclude_vars( $excl_array = array() ) {
249 return CmnFns::array_to_query_string( $_GET, $excl_array );
250 }
251
252 @@ -602,7 +602,7 @@ class CmnFns {
253 * @param none
254 * @return value
255 */
256 - function get_ctype($get_name = 'ctype') {
257 + public static function get_ctype($get_name = 'ctype') {
258 // If there isnt one set, return NULL
259 $result = NULL;
260 if ( isset($_GET[$get_name]) )
261 @@ -617,7 +617,7 @@ class CmnFns {
262 * @param none
263 * @return value
264 */
265 - function get_action($get_name = 'action') {
266 + public static function get_action($get_name = 'action') {
267 // If there isnt one set, return NULL
268 $result = (isset($_POST[$get_name])) ? $_POST[$get_name] : NULL;
269 return $result;
270 @@ -628,7 +628,7 @@ class CmnFns {
271 * @param none
272 * @return value
273 */
274 - function get_query_string($get_name = 'query_string') {
275 + public static function get_query_string($get_name = 'query_string') {
276 // If there isnt one set, return NULL
277 $result = (isset($_POST[$get_name])) ? $_POST[$get_name] : NULL;
278 return $result;
279 @@ -656,7 +656,7 @@ class CmnFns {
280 * INORDER, SESSION, FORM, POST, GET, SERVER
281 * @return value of var
282 */
283 - function getGlobalVar($name, $search = INORDER) {
284 + public static function getGlobalVar($name, $search = INORDER) {
285
286 switch ($search) {
287
288 @@ -699,7 +699,7 @@ class CmnFns {
289 * Redirect using javascript
290 * @param $location string
291 */
292 - function redirect_js($location) {
293 + public static function redirect_js($location) {
294 echo "<SCRIPT LANGUAGE=\"JavaScript\">";
295 echo "parent.location.href = '" . $location . "';";
296 echo "</SCRIPT>";
Załączone pliki
Aby odnieść się do załącznika na stronie, użyj attachment:filename, jak pokazano poniżej na liście plików. NIGDY nie używaj URLa [get], ponieważ odnośnik może się zmienić i spowodować utratę informacji, którą chcesz przekazać.Nie możesz załączać plików do niniejszej strony.
