@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | // $network seems to be a real network address |
118 | 118 | $x = ip2long($ip_arr[1]); |
119 | 119 | // Evaluate the netmask: <Network Mask> or <CIDR> |
120 | - $mask = ( long2ip($x) == $ip_arr[1] ? $x : 0xffffffff << (32 - $ip_arr[1])); |
|
121 | - $matched = ( ($ip_long & $mask) == ($network_long & $mask) ); |
|
120 | + $mask = (long2ip($x) == $ip_arr[1] ? $x : 0xffffffff << (32 - $ip_arr[1])); |
|
121 | + $matched = (($ip_long & $mask) == ($network_long & $mask)); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $matched; |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | $bytes_addr = unpack("n*", inet_pton($addr)); |
154 | 154 | $bytes_test = unpack("n*", inet_pton($ip)); |
155 | 155 | |
156 | - for ($i = 1; $i <= ceil($preflen / 16); $i++) { |
|
157 | - $left = $preflen - 16 * ($i-1); |
|
156 | + for ($i = 1; $i <= ceil($preflen/16); $i++) { |
|
157 | + $left = $preflen - 16*($i - 1); |
|
158 | 158 | if ($left > 16) { |
159 | 159 | $left = 16; |
160 | 160 | } |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function copy($source, $dest) |
119 | 119 | { |
120 | - if (! is_readable($source)) { |
|
120 | + if (!is_readable($source)) { |
|
121 | 121 | throw new PMF_Exception('/config/constants.php is not readable.'); |
122 | 122 | } |
123 | 123 | |
124 | - if (! is_writable(dirname($dest))) { |
|
124 | + if (!is_writable(dirname($dest))) { |
|
125 | 125 | throw new PMF_Exception(sprintf('%s is not writeable.', $dest)); |
126 | 126 | } |
127 | 127 | |
128 | - if (! copy($source, $dest)) { |
|
128 | + if (!copy($source, $dest)) { |
|
129 | 129 | $error = error_get_last(); |
130 | 130 | throw new PMF_Exception($error['message']); |
131 | 131 | } |
@@ -149,19 +149,19 @@ discard block |
||
149 | 149 | |
150 | 150 | $directoryName = substr($source, strrpos($source, '/') + 1); |
151 | 151 | |
152 | - $this->mkdir($dest . '/' . $directoryName, 0750, true); |
|
152 | + $this->mkdir($dest.'/'.$directoryName, 0750, true); |
|
153 | 153 | |
154 | 154 | while ($file = readdir($directoryHandle)) |
155 | 155 | { |
156 | 156 | if ('.' != $file && '..' != $file) { |
157 | 157 | |
158 | - if (! is_dir($source . '/' . $file)) { |
|
158 | + if (!is_dir($source.'/'.$file)) { |
|
159 | 159 | $this->copy( |
160 | - $source . '/' . $file, |
|
161 | - $dest . '/' . $directoryName . '/' . $file |
|
160 | + $source.'/'.$file, |
|
161 | + $dest.'/'.$directoryName.'/'.$file |
|
162 | 162 | ); |
163 | - } else { |
|
164 | - $this->recursiveCopy($source . '/' . $file, $dest . '/' . $directoryName); |
|
163 | + } else { |
|
164 | + $this->recursiveCopy($source.'/'.$file, $dest.'/'.$directoryName); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -160,7 +160,7 @@ |
||
160 | 160 | $source . '/' . $file, |
161 | 161 | $dest . '/' . $directoryName . '/' . $file |
162 | 162 | ); |
163 | - } else { |
|
163 | + } else { |
|
164 | 164 | $this->recursiveCopy($source . '/' . $file, $dest . '/' . $directoryName); |
165 | 165 | } |
166 | 166 | } |
@@ -92,10 +92,10 @@ |
||
92 | 92 | $result = $this->_config->getDb()->query($query); |
93 | 93 | while ($row = $this->_config->getDb()->fetchObject($result)) { |
94 | 94 | $data[$row->id] = array( |
95 | - 'time' => $row->time, |
|
96 | - 'usr' => $row->usr, |
|
97 | - 'text' => $row->text, |
|
98 | - 'ip' => $row->ip |
|
95 | + 'time' => $row->time, |
|
96 | + 'usr' => $row->usr, |
|
97 | + 'text' => $row->text, |
|
98 | + 'ip' => $row->ip |
|
99 | 99 | ); |
100 | 100 | } |
101 | 101 |
@@ -147,7 +147,7 @@ |
||
147 | 147 | WHERE |
148 | 148 | time < %d", |
149 | 149 | PMF_Db::getTablePrefix(), |
150 | - $_SERVER['REQUEST_TIME'] - 30 * 86400 |
|
150 | + $_SERVER['REQUEST_TIME'] - 30*86400 |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | if ($this->_config->getDb()->query($query)) { |
@@ -210,7 +210,7 @@ |
||
210 | 210 | $tagName = trim($tagName); |
211 | 211 | if (PMF_String::strlen($tagName) > 0) { |
212 | 212 | if (!in_array(PMF_String::strtolower($tagName), |
213 | - array_map(array('PMF_String', 'strtolower'), $currentTags))) { |
|
213 | + array_map(array('PMF_String', 'strtolower'), $currentTags))) { |
|
214 | 214 | // Create the new tag |
215 | 215 | $newTagId = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix().'faqtags', 'tagging_id'); |
216 | 216 | $query = sprintf(" |
@@ -703,7 +703,7 @@ |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | /** |
706 | - * @param $chr |
|
706 | + * @param string $chr |
|
707 | 707 | * |
708 | 708 | * @return bool |
709 | 709 | */ |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $i++; |
445 | 445 | if ($max - $min > 0) { |
446 | 446 | $CSSRelevanceLevel = |
447 | - (int)($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel * ($tag['count'] - $min) / ($max - $min)); |
|
447 | + (int)($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel*($tag['count'] - $min)/($max - $min)); |
|
448 | 448 | } |
449 | 449 | $class = 'relevance'.$CSSRelevanceLevel; |
450 | 450 | $html .= '<span class="'.$class.'">'; |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | foreach ($this->getPopularTags($limit) as $tagId => $tagFreq) { |
613 | 613 | $tagName = $this->getTagNameById($tagId); |
614 | 614 | $direction = $this->is_english($tagName[0]) ? 'ltr' : 'rtl'; |
615 | - $html .= sprintf( |
|
615 | + $html .= sprintf( |
|
616 | 616 | '<a class="btn tag" style="direction:%s;" href="?action=search&tagging_id=%d">%s (%d)</a>', |
617 | 617 | $direction, |
618 | 618 | $tagId, |
@@ -595,8 +595,9 @@ discard block |
||
595 | 595 | if ($result) { |
596 | 596 | while ($row = $this->_config->getDb()->fetchObject($result)) { |
597 | 597 | $tags[$row->tagging_id] = $row->freq; |
598 | - if (--$limit === 0) |
|
599 | - break; |
|
598 | + if (--$limit === 0) { |
|
599 | + break; |
|
600 | + } |
|
600 | 601 | } |
601 | 602 | } |
602 | 603 | return $tags; |
@@ -632,10 +633,12 @@ discard block |
||
632 | 633 | */ |
633 | 634 | public function is_english($chr) |
634 | 635 | { |
635 | - if (($chr >= 'A') && ($chr <= 'Z')) |
|
636 | - return true; |
|
637 | - if (($chr >= 'a') && ($chr <= 'z')) |
|
638 | - return true; |
|
636 | + if (($chr >= 'A') && ($chr <= 'Z')) { |
|
637 | + return true; |
|
638 | + } |
|
639 | + if (($chr >= 'a') && ($chr <= 'z')) { |
|
640 | + return true; |
|
641 | + } |
|
639 | 642 | return false; |
640 | 643 | } |
641 | 644 | } |
@@ -65,12 +65,12 @@ |
||
65 | 65 | $hashtags = ''; |
66 | 66 | |
67 | 67 | if ($tags != '') { |
68 | - $hashtags = '#' . str_replace(',', ' #', $tags); |
|
68 | + $hashtags = '#'.str_replace(',', ' #', $tags); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $message = PMF_String::htmlspecialchars($question); |
72 | - $message .= ' ' . $hashtags; |
|
73 | - $message .= ' ' . $link; |
|
72 | + $message .= ' '.$hashtags; |
|
73 | + $message .= ' '.$link; |
|
74 | 74 | |
75 | 75 | $this->connection->post('statuses/update', array('status' => $message)); |
76 | 76 | } |
@@ -106,7 +106,7 @@ |
||
106 | 106 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
107 | 107 | |
108 | 108 | $counter++; |
109 | - if (($showArchive && ($counter > $this->_config->get('records.numberOfShownNewsEntries'))) || |
|
109 | + if (($showArchive && ($counter > $this->_config->get('records.numberOfShownNewsEntries'))) || |
|
110 | 110 | ((!$showArchive) && (!$forceConfLimit) && |
111 | 111 | ($counter <= $this->_config->get('records.numberOfShownNewsEntries'))) || |
112 | 112 | ((!$showArchive) && $forceConfLimit)) { |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | private $_config; |
43 | 43 | |
44 | 44 | /** |
45 | - * Language strings |
|
46 | - * |
|
47 | - * @var string |
|
48 | - */ |
|
45 | + * Language strings |
|
46 | + * |
|
47 | + * @var string |
|
48 | + */ |
|
49 | 49 | private $pmf_lang; |
50 | 50 | |
51 | 51 | /** |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | foreach ($news as $item) { |
153 | 153 | |
154 | 154 | $url = sprintf('%s?action=news&newsid=%d&newslang=%s', |
155 | - PMF_Link::getSystemRelativeUri(), |
|
156 | - $item['id'], |
|
157 | - $item['lang']); |
|
155 | + PMF_Link::getSystemRelativeUri(), |
|
156 | + $item['id'], |
|
157 | + $item['lang']); |
|
158 | 158 | $oLink = new PMF_Link($url, $this->_config); |
159 | 159 | |
160 | 160 | if (isset($item['header'])) { |
@@ -291,10 +291,10 @@ |
||
291 | 291 | public function update(Array $newConfigs) |
292 | 292 | { |
293 | 293 | $runtimeConfigs = array( |
294 | - 'core.database', // PMF_DB_Driver |
|
295 | - 'core.instance', // PMF_Instance |
|
296 | - 'core.language', // Language |
|
297 | - 'core.ldap', // PMF_Ldap |
|
294 | + 'core.database', // PMF_DB_Driver |
|
295 | + 'core.instance', // PMF_Instance |
|
296 | + 'core.language', // Language |
|
297 | + 'core.ldap', // PMF_Ldap |
|
298 | 298 | 'core.ldapConfig' // $PMF_LDAP |
299 | 299 | ); |
300 | 300 | if (is_array($newConfigs)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if (!self::$instance) { |
69 | 69 | if (extension_loaded('mbstring') && function_exists('mb_regex_encoding')) { |
70 | 70 | self::$instance = PMF_String_Mbstring::getInstance($language); |
71 | - } elseif(self::isLangUTF8ToLatinConvertable($language)) { |
|
71 | + } elseif (self::isLangUTF8ToLatinConvertable($language)) { |
|
72 | 72 | self::$instance = PMF_String_UTF8ToLatinConvertable::getInstance($language); |
73 | 73 | } else { |
74 | 74 | self::$instance = PMF_String_Basic::getInstance($language); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return array|string |
308 | 308 | */ |
309 | - public static function preg_replace_callback($pattern, $callback, $subject, $limit= -1, &$count = 0) |
|
309 | + public static function preg_replace_callback($pattern, $callback, $subject, $limit = -1, &$count = 0) |
|
310 | 310 | { |
311 | 311 | return self::$instance->preg_replace_callback($pattern, $callback, $subject, $limit, $count); |
312 | 312 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @return array|string|null |
325 | 325 | */ |
326 | - public static function preg_replace($pattern, $replacement, $subject, $limit= -1, &$count = 0) |
|
326 | + public static function preg_replace($pattern, $replacement, $subject, $limit = -1, &$count = 0) |
|
327 | 327 | { |
328 | 328 | return self::$instance->preg_replace($pattern, $replacement, $subject, $limit, $count); |
329 | 329 | } |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | |
185 | 185 | |
186 | 186 | /** |
187 | - * Check if a language could be converted to iso-8859-1 |
|
188 | - * |
|
189 | - * @param string $language |
|
190 | - * |
|
191 | - * @return boolean |
|
187 | + * Check if a language could be converted to iso-8859-1 |
|
188 | + * |
|
189 | + * @param string $language |
|
190 | + * |
|
191 | + * @return boolean |
|
192 | 192 | */ |
193 | 193 | public static function isLangUTF8ToLatinConvertable($language) |
194 | 194 | { |
195 | 195 | $iso_languages = array('af', 'sq', 'br', 'ca', 'da', 'en', 'fo', 'gl', 'de', 'is', 'it', |
196 | - 'ku', 'la', 'lb', 'nb', 'oc', 'pt', 'es', 'sw', 'sv', 'wa', 'eu', |
|
197 | - // NOTE this languages are not fully supported by latin1 |
|
198 | - 'nl', 'fr', 'et', 'fi', 'cy' |
|
196 | + 'ku', 'la', 'lb', 'nb', 'oc', 'pt', 'es', 'sw', 'sv', 'wa', 'eu', |
|
197 | + // NOTE this languages are not fully supported by latin1 |
|
198 | + 'nl', 'fr', 'et', 'fi', 'cy' |
|
199 | 199 | ); |
200 | 200 | |
201 | 201 | return in_array($language, $iso_languages); |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | |
204 | 204 | |
205 | 205 | /** |
206 | - * Get last occurence of a string within another |
|
207 | - * |
|
208 | - * @param string $haystack |
|
209 | - * @param string $needle |
|
210 | - * |
|
211 | - * @return string |
|
206 | + * Get last occurence of a string within another |
|
207 | + * |
|
208 | + * @param string $haystack |
|
209 | + * @param string $needle |
|
210 | + * |
|
211 | + * @return string |
|
212 | 212 | */ |
213 | 213 | public static function strrchr($haystack, $needle) |
214 | 214 | { |
@@ -231,13 +231,13 @@ discard block |
||
231 | 231 | |
232 | 232 | |
233 | 233 | /** |
234 | - * Find position of last occurrence of a char in a string |
|
235 | - * |
|
236 | - * @param string $haystack |
|
237 | - * @param string $needle |
|
238 | - * @param int $offset |
|
239 | - * |
|
240 | - * @return int |
|
234 | + * Find position of last occurrence of a char in a string |
|
235 | + * |
|
236 | + * @param string $haystack |
|
237 | + * @param string $needle |
|
238 | + * @param int $offset |
|
239 | + * |
|
240 | + * @return int |
|
241 | 241 | */ |
242 | 242 | public static function strrpos($haystack, $needle, $offset = 0) |
243 | 243 | { |
@@ -104,7 +104,6 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Get a part of string |
106 | 106 | * |
107 | - * @param string $str String |
|
108 | 107 | * @param integer $start Start |
109 | 108 | * @param integer $length Length |
110 | 109 | * |
@@ -121,7 +120,7 @@ discard block |
||
121 | 120 | * |
122 | 121 | * @param string $haystack Haystack |
123 | 122 | * @param string $needle Needle |
124 | - * @param string $offset Offset |
|
123 | + * @param integer $offset Offset |
|
125 | 124 | * |
126 | 125 | * @return int |
127 | 126 | */ |
@@ -298,7 +297,7 @@ discard block |
||
298 | 297 | /** |
299 | 298 | * Search and replace by a regexp using a callback |
300 | 299 | * |
301 | - * @param string|array $pattern |
|
300 | + * @param string $pattern |
|
302 | 301 | * @param function $callback |
303 | 302 | * @param string|array $subject |
304 | 303 | * @param int $limit |
@@ -22,7 +22,7 @@ |
||
22 | 22 | exit(); |
23 | 23 | } |
24 | 24 | |
25 | -require_once PMF_CONFIG_DIR . '/constants.php'; |
|
25 | +require_once PMF_CONFIG_DIR.'/constants.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Export Class |