@@ -13,37 +13,37 @@ |
||
13 | 13 | * @param string |
14 | 14 | * @return string |
15 | 15 | */ |
16 | -function smarty_modifier_timeAgo( $date) |
|
16 | +function smarty_modifier_timeAgo($date) |
|
17 | 17 | { |
18 | 18 | if ($date == "") |
19 | 19 | return "n/a"; |
20 | - $timeStrings = array( 'now', // 0 |
|
21 | - 'Sec', 'Secs', // 1,1 |
|
22 | - 'Min','Mins', // 3,3 |
|
23 | - 'Hour', 'Hrs', // 5,5 |
|
20 | + $timeStrings = array('now', // 0 |
|
21 | + 'Sec', 'Secs', // 1,1 |
|
22 | + 'Min', 'Mins', // 3,3 |
|
23 | + 'Hour', 'Hrs', // 5,5 |
|
24 | 24 | 'Day', 'Days'); |
25 | - $sec = time() - (( !is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
|
26 | - if ( $sec <= 0) return $timeStrings[0]; |
|
27 | - if ( $sec < 2) return $sec." ".$timeStrings[1]; |
|
28 | - if ( $sec < 60) return $sec." ".$timeStrings[2]; |
|
25 | + $sec = time() - ((!is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
|
26 | + if ($sec <= 0) return $timeStrings[0]; |
|
27 | + if ($sec < 2) return $sec . " " . $timeStrings[1]; |
|
28 | + if ($sec < 60) return $sec . " " . $timeStrings[2]; |
|
29 | 29 | $min = $sec / 60; |
30 | - if ( floor($min+0.5) < 2) return floor($min+0.5)." ".$timeStrings[3]; |
|
31 | - if ( $min < 60) return floor($min+0.5)." ".$timeStrings[4]; |
|
30 | + if (floor($min + 0.5) < 2) return floor($min + 0.5) . " " . $timeStrings[3]; |
|
31 | + if ($min < 60) return floor($min + 0.5) . " " . $timeStrings[4]; |
|
32 | 32 | $hrs = $min / 60; |
33 | - if ( floor($hrs+0.5) < 2) return floor($hrs+0.5)." ".$timeStrings[5]; |
|
34 | - if ( $hrs < 24) return floor($hrs+0.5)." ".$timeStrings[6]; |
|
35 | - $days = $sec/60/60/24; |
|
33 | + if (floor($hrs + 0.5) < 2) return floor($hrs + 0.5) . " " . $timeStrings[5]; |
|
34 | + if ($hrs < 24) return floor($hrs + 0.5) . " " . $timeStrings[6]; |
|
35 | + $days = $sec / 60 / 60 / 24; |
|
36 | 36 | if ($days > 365) |
37 | 37 | { |
38 | - return round(($days/365), 1).' Yrs'; |
|
38 | + return round(($days / 365), 1) . ' Yrs'; |
|
39 | 39 | } |
40 | 40 | else if ($days > 90) |
41 | 41 | { |
42 | - return round($days/7).' Wks'; |
|
42 | + return round($days / 7) . ' Wks'; |
|
43 | 43 | } |
44 | 44 | else |
45 | 45 | { |
46 | - return round($days, 1).'d'; |
|
46 | + return round($days, 1) . 'd'; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | ?> |
50 | 50 | \ No newline at end of file |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | case 'name': |
54 | 54 | case 'class': |
55 | 55 | case 'id': |
56 | - $$_key = (string) $_val; |
|
56 | + $$_key = (string)$_val; |
|
57 | 57 | break; |
58 | 58 | case 'options': |
59 | - $options = (array) $_val; |
|
59 | + $options = (array)$_val; |
|
60 | 60 | break; |
61 | 61 | case 'values': |
62 | 62 | case 'output': |
63 | - $$_key = array_values((array) $_val); |
|
63 | + $$_key = array_values((array)$_val); |
|
64 | 64 | break; |
65 | 65 | case 'selected': |
66 | 66 | if (is_array($_val)) { |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | foreach ($_val as $_sel) { |
69 | 69 | if (is_object($_sel)) { |
70 | 70 | if (method_exists($_sel, "__toString")) { |
71 | - $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); |
|
71 | + $_sel = smarty_function_escape_special_chars((string)$_sel->__toString()); |
|
72 | 72 | } else { |
73 | - trigger_error("html_options_multiple: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE); |
|
73 | + trigger_error("html_options_multiple: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE); |
|
74 | 74 | continue; |
75 | 75 | } |
76 | 76 | } else { |
77 | - $_sel = smarty_function_escape_special_chars((string) $_sel); |
|
77 | + $_sel = smarty_function_escape_special_chars((string)$_sel); |
|
78 | 78 | } |
79 | 79 | $selected[$_sel] = true; |
80 | 80 | } |
81 | 81 | } elseif (is_object($_val)) { |
82 | 82 | if (method_exists($_val, "__toString")) { |
83 | - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); |
|
83 | + $selected = smarty_function_escape_special_chars((string)$_val->__toString()); |
|
84 | 84 | } else { |
85 | - trigger_error("html_options_multiple: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE); |
|
85 | + trigger_error("html_options_multiple: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE); |
|
86 | 86 | } |
87 | 87 | } else { |
88 | - $selected = smarty_function_escape_special_chars((string) $_val); |
|
88 | + $selected = smarty_function_escape_special_chars((string)$_val); |
|
89 | 89 | } |
90 | 90 | break; |
91 | 91 | case 'strict': break; |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | if (!empty($name)) { |
130 | - $_html_class = !empty($class) ? ' class="'.$class.'"' : ''; |
|
131 | - $_html_id = !empty($id) ? ' id="'.$id.'"' : ''; |
|
130 | + $_html_class = !empty($class) ? ' class="' . $class . '"' : ''; |
|
131 | + $_html_id = !empty($id) ? ' id="' . $id . '"' : ''; |
|
132 | 132 | // the name needs to have [] added (this is html text [] not PHP, so that the return for the multiselect is an array |
133 | 133 | $_html_result = '<select multiple="multiple" name="' . $name . '[]"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result . '</select>' . "\n"; |
134 | 134 | } |
@@ -146,23 +146,23 @@ discard block |
||
146 | 146 | } elseif ($_key === $selected) { |
147 | 147 | $_html_result .= ' selected="selected"'; |
148 | 148 | } |
149 | - $_html_class = !empty($class) ? ' class="'.$class.' option"' : ''; |
|
150 | - $_html_id = !empty($id) ? ' id="'.$id.'-'.$idx.'"' : ''; |
|
149 | + $_html_class = !empty($class) ? ' class="' . $class . ' option"' : ''; |
|
150 | + $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : ''; |
|
151 | 151 | if (is_object($value)) { |
152 | 152 | if (method_exists($value, "__toString")) { |
153 | - $value = smarty_function_escape_special_chars((string) $value->__toString()); |
|
153 | + $value = smarty_function_escape_special_chars((string)$value->__toString()); |
|
154 | 154 | } else { |
155 | - trigger_error("html_options_multiple: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE); |
|
155 | + trigger_error("html_options_multiple: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE); |
|
156 | 156 | return ''; |
157 | 157 | } |
158 | 158 | } else { |
159 | - $value = smarty_function_escape_special_chars((string) $value); |
|
159 | + $value = smarty_function_escape_special_chars((string)$value); |
|
160 | 160 | } |
161 | 161 | $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n"; |
162 | 162 | $idx++; |
163 | 163 | } else { |
164 | 164 | $_idx = 0; |
165 | - $_html_result = smarty_function_html_options_multiple_optgroup($key, $value, $selected, !empty($id) ? ($id.'-'.$idx) : null, $class, $_idx); |
|
165 | + $_html_result = smarty_function_html_options_multiple_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, $class, $_idx); |
|
166 | 166 | $idx++; |
167 | 167 | } |
168 | 168 | return $_html_result; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * @param string |
15 | 15 | * @return string |
16 | 16 | */ |
17 | -function smarty_modifier_magicurl($str, $dereferrer="") { |
|
18 | - return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="'.$dereferrer.'$1://$2" target="_blank">$1://$2</a>', $str); |
|
17 | +function smarty_modifier_magicurl($str, $dereferrer = "") { |
|
18 | + return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="' . $dereferrer . '$1://$2" target="_blank">$1://$2</a>', $str); |
|
19 | 19 | } |
20 | 20 | ?> |
21 | 21 | \ No newline at end of file |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | -function smarty_modifier_parray ($string,$explode,$limit=NULL) |
|
2 | +function smarty_modifier_parray($string, $explode, $limit = NULL) |
|
3 | 3 | { |
4 | - if($limit == NULL) |
|
5 | - return explode( $explode , $string ); |
|
4 | + if ($limit == NULL) |
|
5 | + return explode($explode, $string); |
|
6 | 6 | else |
7 | - return explode( $explode , $string , $limit); |
|
7 | + return explode($explode, $string, $limit); |
|
8 | 8 | } |
9 | 9 | ?> |
10 | 10 | \ No newline at end of file |
@@ -29,28 +29,28 @@ |
||
29 | 29 | * 2003-02-21 Version 0.1 - initial release |
30 | 30 | * ------------------------------------------------------------- |
31 | 31 | */ |
32 | -function smarty_modifier_fsize_format($size,$format = '',$precision = 2, $dec_point = ".", $thousands_sep = ",") |
|
32 | +function smarty_modifier_fsize_format($size, $format = '', $precision = 2, $dec_point = ".", $thousands_sep = ",") |
|
33 | 33 | { |
34 | 34 | $format = strtoupper($format); |
35 | 35 | static $sizes = array(); |
36 | - if(!count($sizes)) { |
|
36 | + if (!count($sizes)) { |
|
37 | 37 | $b = 1024; |
38 | - $sizes["B"] = 1; |
|
39 | - $sizes["KB"] = $sizes["B"] * $b; |
|
40 | - $sizes["MB"] = $sizes["KB"] * $b; |
|
41 | - $sizes["GB"] = $sizes["MB"] * $b; |
|
42 | - $sizes["TB"] = $sizes["GB"] * $b; |
|
43 | - $sizes["PB"] = $sizes["TB"] * $b; |
|
44 | - $sizes["EB"] = $sizes["PB"] * $b; |
|
45 | - $sizes["ZB"] = $sizes["EB"] * $b; |
|
46 | - $sizes["YB"] = $sizes["ZB"] * $b; |
|
47 | - $sizes = array_reverse($sizes,true); |
|
38 | + $sizes["B"] = 1; |
|
39 | + $sizes["KB"] = $sizes["B"] * $b; |
|
40 | + $sizes["MB"] = $sizes["KB"] * $b; |
|
41 | + $sizes["GB"] = $sizes["MB"] * $b; |
|
42 | + $sizes["TB"] = $sizes["GB"] * $b; |
|
43 | + $sizes["PB"] = $sizes["TB"] * $b; |
|
44 | + $sizes["EB"] = $sizes["PB"] * $b; |
|
45 | + $sizes["ZB"] = $sizes["EB"] * $b; |
|
46 | + $sizes["YB"] = $sizes["ZB"] * $b; |
|
47 | + $sizes = array_reverse($sizes, true); |
|
48 | 48 | } |
49 | 49 | //~ get "human" filesize |
50 | - foreach($sizes AS $unit => $bytes) { |
|
51 | - if($size > $bytes || $unit == $format) { |
|
50 | + foreach ($sizes AS $unit => $bytes) { |
|
51 | + if ($size > $bytes || $unit == $format) { |
|
52 | 52 | //~ return formatted size |
53 | - return number_format($size / $bytes,$precision,$dec_point,$thousands_sep)." ".$unit; |
|
53 | + return number_format($size / $bytes, $precision, $dec_point, $thousands_sep) . " " . $unit; |
|
54 | 54 | } //~ end if |
55 | 55 | } //~ end foreach |
56 | 56 | } //~ end function |
@@ -34,15 +34,15 @@ discard block |
||
34 | 34 | $content = new Contents(['Settings' => $this->settings]); |
35 | 35 | $f = new Forum(); |
36 | 36 | $menu = new Menu($this->settings); |
37 | - $this->smarty->assign('menulist',$menu->get($role, $this->serverurl)); |
|
37 | + $this->smarty->assign('menulist', $menu->get($role, $this->serverurl)); |
|
38 | 38 | $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role)); |
39 | 39 | $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role)); |
40 | 40 | if ($this->userdata != null) |
41 | - $this->smarty->assign('recentforumpostslist',$f->getPosts($this->settings->getSetting('showrecentforumposts'))); |
|
41 | + $this->smarty->assign('recentforumpostslist', $f->getPosts($this->settings->getSetting('showrecentforumposts'))); |
|
42 | 42 | |
43 | - $this->smarty->assign('main_menu',$this->smarty->fetch('mainmenu.tpl')); |
|
44 | - $this->smarty->assign('useful_menu',$this->smarty->fetch('usefullinksmenu.tpl')); |
|
45 | - $this->smarty->assign('article_menu',$this->smarty->fetch('articlesmenu.tpl')); |
|
43 | + $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl')); |
|
44 | + $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl')); |
|
45 | + $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl')); |
|
46 | 46 | |
47 | 47 | $category = new Category(['Settings' => $content->pdo]); |
48 | 48 | if ($this->userdata != null) |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | else |
51 | 51 | $parentcatlist = $category->getForMenu(); |
52 | 52 | |
53 | - $this->smarty->assign('parentcatlist',$parentcatlist); |
|
53 | + $this->smarty->assign('parentcatlist', $parentcatlist); |
|
54 | 54 | $this->smarty->assign('catClass', $category); |
55 | 55 | $searchStr = ''; |
56 | 56 | if ($this->page == 'search' && isset($_REQUEST["id"])) |
57 | - $searchStr = (string) $_REQUEST["id"]; |
|
58 | - $this->smarty->assign('header_menu_search',$searchStr); |
|
57 | + $searchStr = (string)$_REQUEST["id"]; |
|
58 | + $this->smarty->assign('header_menu_search', $searchStr); |
|
59 | 59 | |
60 | 60 | if (isset($_REQUEST["t"])) { |
61 | 61 | $this->smarty->assign('header_menu_cat', $_REQUEST["t"]); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->smarty->assign('header_menu_cat', ''); |
64 | 64 | } |
65 | 65 | $header_menu = $this->smarty->fetch('headermenu.tpl'); |
66 | - $this->smarty->assign('header_menu',$header_menu); |
|
66 | + $this->smarty->assign('header_menu', $header_menu); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function render() |
73 | 73 | { |
74 | - $this->smarty->assign('page',$this); |
|
74 | + $this->smarty->assign('page', $this); |
|
75 | 75 | $this->page_template = "basepage.tpl"; |
76 | 76 | |
77 | 77 | parent::render(); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use nntmux\CouchPotato; |
4 | 4 | |
5 | -if (!$page->users->isLoggedIn()){ |
|
5 | +if (!$page->users->isLoggedIn()) { |
|
6 | 6 | $page->show403(); |
7 | 7 | } |
8 | 8 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | if (!$ret) |
11 | 11 | print "Invite not sent."; |
12 | 12 | else |
13 | - print "Invite sent. Alternatively paste them following link to register - ".$ret; |
|
13 | + print "Invite sent. Alternatively paste them following link to register - " . $ret; |
|
14 | 14 | } |
15 | 15 | else |
16 | 16 | { |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | if ($page->isPostBack()) |
12 | 12 | { |
13 | 13 | $forum->add($id, $page->users->currentUserId(), "", $_POST["addMessage"]); |
14 | - header("Location:".WWW_TOP."/forumpost/".$id."#last"); |
|
14 | + header("Location:" . WWW_TOP . "/forumpost/" . $id . "#last"); |
|
15 | 15 | die(); |
16 | 16 | } |
17 | 17 | |
18 | 18 | $results = $forum->getPosts($id); |
19 | 19 | if (count($results) == 0) |
20 | 20 | { |
21 | - header("Location:".WWW_TOP."/forum"); |
|
21 | + header("Location:" . WWW_TOP . "/forum"); |
|
22 | 22 | die(); |
23 | 23 | } |
24 | 24 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $page->meta_description = "View forum post"; |
28 | 28 | |
29 | 29 | $page->smarty->assign('results', $results); |
30 | -$page->smarty->assign('privateprofiles', ($page->settings->getSetting('privateprofiles') == 1) ? true : false ); |
|
30 | +$page->smarty->assign('privateprofiles', ($page->settings->getSetting('privateprofiles') == 1) ? true : false); |
|
31 | 31 | |
32 | 32 | $page->content = $page->smarty->fetch('forumpost.tpl'); |
33 | 33 | $page->render(); |