@@ -433,7 +433,7 @@ |
||
| 433 | 433 | /** |
| 434 | 434 | * Validate attached file with the real hash |
| 435 | 435 | * |
| 436 | - * @return boolean |
|
| 436 | + * @return boolean|null |
|
| 437 | 437 | */ |
| 438 | 438 | public function validate() |
| 439 | 439 | { |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Abstract attachment class |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Attachment |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @copyright 2009-2015 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2009-08-21 |
|
| 18 | - */ |
|
| 3 | + * Abstract attachment class |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Attachment |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @copyright 2009-2015 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2009-08-21 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | null === $this->realHash || null === $this->filename || |
| 376 | 376 | null === $this->key) { |
| 377 | 377 | throw new PMF_Attachment_Exception('All of id, ' . |
| 378 | - 'recordId, hash, filename, ' . |
|
| 379 | - 'key is needed to generate ' . |
|
| 380 | - 'fs hash for encrypted files'); |
|
| 378 | + 'recordId, hash, filename, ' . |
|
| 379 | + 'key is needed to generate ' . |
|
| 380 | + 'fs hash for encrypted files'); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $src = $this->id . $this->recordId . $this->realHash . |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return PMF_Attachment_Abstract |
| 133 | 133 | */ |
| 134 | - public function __construct ($id = null) |
|
| 134 | + public function __construct($id = null) |
|
| 135 | 135 | { |
| 136 | 136 | $this->db = PMF_Db::getInstance(); |
| 137 | 137 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return string |
| 150 | 150 | */ |
| 151 | - public function buildUrl ($forHTML = true) |
|
| 151 | + public function buildUrl($forHTML = true) |
|
| 152 | 152 | { |
| 153 | 153 | $amp = true == $forHTML ? '&' : '&'; |
| 154 | 154 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | - public function setKey ($key, $default = true) |
|
| 166 | + public function setKey($key, $default = true) |
|
| 167 | 167 | { |
| 168 | 168 | $this->key = $key; |
| 169 | 169 | $this->encrypted = null !== $key; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * Not default means the key was set explicitly |
| 173 | 173 | * for this attachment, so lets hash it |
| 174 | 174 | */ |
| 175 | - if($this->encrypted && !$default) { |
|
| 175 | + if ($this->encrypted && !$default) { |
|
| 176 | 176 | $this->passwordHash = sha1($key); |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @return null |
| 186 | 186 | */ |
| 187 | - public function setRecordId ($id) |
|
| 187 | + public function setRecordId($id) |
|
| 188 | 188 | { |
| 189 | 189 | $this->recordId = $id; |
| 190 | 190 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @return null |
| 198 | 198 | */ |
| 199 | - public function setRecordLang ($lang) |
|
| 199 | + public function setRecordLang($lang) |
|
| 200 | 200 | { |
| 201 | 201 | $this->recordLang = $lang; |
| 202 | 202 | } |
@@ -370,18 +370,18 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | protected function mkVirtualHash() |
| 372 | 372 | { |
| 373 | - if($this->encrypted) { |
|
| 374 | - if(null === $this->id || null === $this->recordId || |
|
| 373 | + if ($this->encrypted) { |
|
| 374 | + if (null === $this->id || null === $this->recordId || |
|
| 375 | 375 | null === $this->realHash || null === $this->filename || |
| 376 | 376 | null === $this->key) { |
| 377 | - throw new PMF_Attachment_Exception('All of id, ' . |
|
| 378 | - 'recordId, hash, filename, ' . |
|
| 379 | - 'key is needed to generate ' . |
|
| 377 | + throw new PMF_Attachment_Exception('All of id, '. |
|
| 378 | + 'recordId, hash, filename, '. |
|
| 379 | + 'key is needed to generate '. |
|
| 380 | 380 | 'fs hash for encrypted files'); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - $src = $this->id . $this->recordId . $this->realHash . |
|
| 384 | - $this->filename . $this->key; |
|
| 383 | + $src = $this->id.$this->recordId.$this->realHash. |
|
| 384 | + $this->filename.$this->key; |
|
| 385 | 385 | $this->virtualHash = md5($src); |
| 386 | 386 | } else { |
| 387 | 387 | $this->virtualHash = $this->realHash; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * Delete attachment |
| 51 | 51 | * |
| 52 | - * @return boolean |
|
| 52 | + * @return boolean|null |
|
| 53 | 53 | */ |
| 54 | 54 | function delete() |
| 55 | 55 | { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * Save current attachment to the appropriate storage |
| 61 | 61 | * |
| 62 | - * @return boolean |
|
| 62 | + * @return boolean|null |
|
| 63 | 63 | */ |
| 64 | 64 | public function save() |
| 65 | 65 | { |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @param int $id attachment id |
| 42 | 42 | */ |
| 43 | - public function __construct ($id = null) |
|
| 43 | + public function __construct($id = null) |
|
| 44 | 44 | { |
| 45 | 45 | // TODO implement this |
| 46 | 46 | throw new PMF_Attachment_Exception('The database attachment storage type is not yet implemented'); |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | * @param PMF_Configuration $config |
| 109 | 109 | * @param integer $recordId ID of the record |
| 110 | 110 | * |
| 111 | - * @return array |
|
| 111 | + * @return integer|null |
|
| 112 | 112 | */ |
| 113 | 113 | public static function fetchByRecordId(PMF_Configuration $config, $recordId) |
| 114 | 114 | { |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | protected $aes; |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * @param $filepath |
|
| 55 | - * @param $mode |
|
| 56 | - * @param $key |
|
| 54 | + * @param string $filepath |
|
| 55 | + * @param string $mode |
|
| 56 | + * @param string $key |
|
| 57 | 57 | * |
| 58 | 58 | * @return PMF_Attachment_Filesystem_File_Encrypted |
| 59 | 59 | */ |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | exit(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -require PMF_ROOT_DIR . '/inc/libs/phpseclib/Crypt/AES.php'; |
|
| 24 | +require PMF_ROOT_DIR.'/inc/libs/phpseclib/Crypt/AES.php'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * PMF_Attachment_Abstract |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $chunk = ''; |
| 78 | 78 | $chunkDelimLen = strlen(self::chunkDelimiter); |
| 79 | 79 | |
| 80 | - while(!$readEnd && !$this->eof()) { |
|
| 80 | + while (!$readEnd && !$this->eof()) { |
|
| 81 | 81 | $chunk .= fread($this->handle, 1); |
| 82 | 82 | $readEnd = self::chunkDelimiter == substr($chunk, -$chunkDelimLen); |
| 83 | 83 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function putChunk($chunk) |
| 103 | 103 | { |
| 104 | - $content = $this->aes->encrypt($chunk) . self::chunkDelimiter; |
|
| 104 | + $content = $this->aes->encrypt($chunk).self::chunkDelimiter; |
|
| 105 | 105 | |
| 106 | 106 | return fwrite($this->handle, $content); |
| 107 | 107 | } |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $retval = false; |
| 115 | 115 | |
| 116 | - if(is_string($target)) { |
|
| 116 | + if (is_string($target)) { |
|
| 117 | 117 | $target = new PMF_Attachment_Filesystem_File_Vanilla($target, self::MODE_WRITE); |
| 118 | 118 | } else { |
| 119 | 119 | $target->setMode(self::MODE_WRITE); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if($target->isOk()) { |
|
| 123 | - while(!$this->eof()) { |
|
| 122 | + if ($target->isOk()) { |
|
| 123 | + while (!$this->eof()) { |
|
| 124 | 124 | $target->putChunk($this->getChunk()); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * @param $dir |
|
| 92 | + * @param boolean $dir |
|
| 93 | 93 | * @return array |
| 94 | 94 | */ |
| 95 | 95 | protected function getOldFileList($dir) |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Attachment migration handler |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Attachment |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @copyright 2009-2015 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2009-09-13 |
|
| 18 | - */ |
|
| 3 | + * Attachment migration handler |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Attachment |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @copyright 2009-2015 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2009-09-13 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | case PMF_Attachment_Migration::MIGRATION_TYPE1: |
| 163 | 163 | |
| 164 | 164 | PMF_Attachment_Factory::init(PMF_Attachment::STORAGE_TYPE_FILESYSTEM, |
| 165 | - '', |
|
| 166 | - false); |
|
| 165 | + '', |
|
| 166 | + false); |
|
| 167 | 167 | $this->migrateFromOldFormatToFs(); |
| 168 | 168 | // FIXME should attachment settings update be triggered here? |
| 169 | 169 | |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | if(isset($options['defaultKey']) && !empty($options['defaultKey'])) { |
| 177 | 177 | PMF_Attachment_Factory::init(PMF_Attachment::STORAGE_TYPE_FILESYSTEM, |
| 178 | - $options['defaultKey'], |
|
| 179 | - true); |
|
| 178 | + $options['defaultKey'], |
|
| 179 | + true); |
|
| 180 | 180 | $this->migrateFromOldFormatToFs(); |
| 181 | 181 | } else { |
| 182 | 182 | $this->error[] = 'Default key required to be set for this option'; |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | $records = $faq->faqRecords; |
| 102 | 102 | |
| 103 | 103 | reset($records); |
| 104 | - while(list(,$record) = each($records)) { |
|
| 104 | + while (list(,$record) = each($records)) { |
|
| 105 | 105 | |
| 106 | 106 | $recordDir = "$dir/$record[id]"; |
| 107 | - if(file_exists($recordDir) && is_dir($recordDir)) { |
|
| 107 | + if (file_exists($recordDir) && is_dir($recordDir)) { |
|
| 108 | 108 | |
| 109 | 109 | $list[$record['id']]['files'] = array(); |
| 110 | - foreach(new DirectoryIterator($recordDir) as $entry) { |
|
| 111 | - if(!$entry->isDot() && $entry->isFile()) { |
|
| 110 | + foreach (new DirectoryIterator($recordDir) as $entry) { |
|
| 111 | + if (!$entry->isDot() && $entry->isFile()) { |
|
| 112 | 112 | $list[$record['id']]['files'][] = "$recordDir/{$entry->getFilename()}"; |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -129,20 +129,20 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $list = $this->getOldFileList(PMF_ATTACHMENTS_DIR); |
| 131 | 131 | |
| 132 | - foreach($list as $recordId => $item) { |
|
| 132 | + foreach ($list as $recordId => $item) { |
|
| 133 | 133 | $recordLang = $item['lang']; |
| 134 | - foreach($item['files'] as $file) { |
|
| 134 | + foreach ($item['files'] as $file) { |
|
| 135 | 135 | $att = PMF_Attachment_Factory::create(); |
| 136 | 136 | $att->setRecordId($recordId); |
| 137 | 137 | $att->setRecordLang($recordLang); |
| 138 | 138 | |
| 139 | - if(!$att->save($file)) { |
|
| 139 | + if (!$att->save($file)) { |
|
| 140 | 140 | $this->error[] = "File $file couldn't be migrated"; |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $recordDir = PMF_ATTACHMENTS_DIR . "/$recordId"; |
|
| 145 | - if(!@rmdir(PMF_ATTACHMENTS_DIR . "/$file")) { |
|
| 144 | + $recordDir = PMF_ATTACHMENTS_DIR."/$recordId"; |
|
| 145 | + if (!@rmdir(PMF_ATTACHMENTS_DIR."/$file")) { |
|
| 146 | 146 | $this->warning[] = "Couldn't remove dir $recordDir after migration"; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function doMigrate($migrationType, $options) |
| 160 | 160 | { |
| 161 | - switch($migrationType) { |
|
| 161 | + switch ($migrationType) { |
|
| 162 | 162 | case PMF_Attachment_Migration::MIGRATION_TYPE1: |
| 163 | 163 | |
| 164 | 164 | PMF_Attachment_Factory::init(PMF_Attachment::STORAGE_TYPE_FILESYSTEM, |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Awaiting new default key here |
| 175 | 175 | */ |
| 176 | - if(isset($options['defaultKey']) && !empty($options['defaultKey'])) { |
|
| 176 | + if (isset($options['defaultKey']) && !empty($options['defaultKey'])) { |
|
| 177 | 177 | PMF_Attachment_Factory::init(PMF_Attachment::STORAGE_TYPE_FILESYSTEM, |
| 178 | 178 | $options['defaultKey'], |
| 179 | 179 | true); |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | * |
| 115 | 115 | * @param string $login Loginname |
| 116 | 116 | * @param array $optionalData Optional data |
| 117 | - * @return integer |
|
| 117 | + * @return boolean |
|
| 118 | 118 | */ |
| 119 | 119 | public function checkLogin($login, Array $optionalData = null) |
| 120 | 120 | { |
@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Manages user authentication with Apache's HTTP authentication |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Auth |
|
| 13 | - * @author Thorsten Rinne <[email protected]> |
|
| 14 | - * @author Alberto Cabello <[email protected]> |
|
| 15 | - * @copyright 2009-2015 phpMyFAQ Team |
|
| 16 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | - * @link http://www.phpmyfaq.de |
|
| 18 | - * @since 2009-03-01 |
|
| 19 | - */ |
|
| 3 | + * Manages user authentication with Apache's HTTP authentication |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Auth |
|
| 13 | + * @author Thorsten Rinne <[email protected]> |
|
| 14 | + * @author Alberto Cabello <[email protected]> |
|
| 15 | + * @copyright 2009-2015 phpMyFAQ Team |
|
| 16 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | + * @link http://www.phpmyfaq.de |
|
| 18 | + * @since 2009-03-01 |
|
| 19 | + */ |
|
| 20 | 20 | |
| 21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 22 | 22 | exit(); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $login Loginname |
| 61 | 61 | * @param string $pass Password |
| 62 | 62 | * @return boolean |
| 63 | - */ |
|
| 63 | + */ |
|
| 64 | 64 | public function changePassword($login, $pass) |
| 65 | 65 | { |
| 66 | 66 | return true; |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @static |
| 63 | - * @return null|PMF_Cache |
|
| 63 | + * @return PMF_Cache |
|
| 64 | 64 | */ |
| 65 | 65 | public static function getInstance() |
| 66 | 66 | { |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The Cache class implements caching factory to be used with different concrete cache services |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Cache |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @copyright 2002-2015 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2011-09-23 |
|
| 18 | - */ |
|
| 3 | + * The Cache class implements caching factory to be used with different concrete cache services |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Cache |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @copyright 2002-2015 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2011-09-23 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -1082,7 +1082,7 @@ |
||
| 1082 | 1082 | * |
| 1083 | 1083 | * @param integer $category_id Category id |
| 1084 | 1084 | * @param string $category_lang Category language |
| 1085 | - * @return boolean |
|
| 1085 | + * @return integer |
|
| 1086 | 1086 | */ |
| 1087 | 1087 | public function checkLanguage($category_id, $category_lang) |
| 1088 | 1088 | { |
@@ -1,24 +1,24 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The main category class |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Category |
|
| 13 | - * @author Thorsten Rinne <[email protected]> |
|
| 14 | - * @author Lars Tiedemann <[email protected]> |
|
| 15 | - * @author Matteo Scaramuccia <[email protected]> |
|
| 16 | - * @author Rudi Ferrari <[email protected]> |
|
| 17 | - * @copyright 2004-2015 phpMyFAQ Team |
|
| 18 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 19 | - * @link http://www.phpmyfaq.de |
|
| 20 | - * @since 2004-02-16 |
|
| 21 | - */ |
|
| 3 | + * The main category class |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Category |
|
| 13 | + * @author Thorsten Rinne <[email protected]> |
|
| 14 | + * @author Lars Tiedemann <[email protected]> |
|
| 15 | + * @author Matteo Scaramuccia <[email protected]> |
|
| 16 | + * @author Rudi Ferrari <[email protected]> |
|
| 17 | + * @copyright 2004-2015 phpMyFAQ Team |
|
| 18 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 19 | + * @link http://www.phpmyfaq.de |
|
| 20 | + * @since 2004-02-16 |
|
| 21 | + */ |
|
| 22 | 22 | |
| 23 | 23 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 24 | 24 | exit(); |
@@ -574,10 +574,10 @@ discard block |
||
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /** |
| 577 | - * print the static tree with the number of records |
|
| 578 | - * |
|
| 579 | - * @return string |
|
| 580 | - */ |
|
| 577 | + * print the static tree with the number of records |
|
| 578 | + * |
|
| 579 | + * @return string |
|
| 580 | + */ |
|
| 581 | 581 | public function viewTree() |
| 582 | 582 | { |
| 583 | 583 | global $sids, $PMF_LANG, $plr; |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | PMF_Db::getTablePrefix(), |
| 1220 | 1220 | $category_id); |
| 1221 | 1221 | if (!$delete_all) { |
| 1222 | - $query .= " AND lang = '".$category_lang."'"; |
|
| 1222 | + $query .= " AND lang = '".$category_lang."'"; |
|
| 1223 | 1223 | } |
| 1224 | 1224 | $this->_config->getDb()->query($query); |
| 1225 | 1225 | |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | PMF_Db::getTablePrefix(), |
| 1244 | 1244 | $category_id); |
| 1245 | 1245 | if (!$delete_all) { |
| 1246 | - $query .= " AND category_lang = '".$category_lang."'"; |
|
| 1246 | + $query .= " AND category_lang = '".$category_lang."'"; |
|
| 1247 | 1247 | } |
| 1248 | 1248 | $this->_config->getDb()->query($query); |
| 1249 | 1249 | |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | $translated = array(); |
| 1268 | 1268 | |
| 1269 | 1269 | foreach ($existcatlang as $language) { |
| 1270 | - $query = sprintf(" |
|
| 1270 | + $query = sprintf(" |
|
| 1271 | 1271 | SELECT |
| 1272 | 1272 | name, description |
| 1273 | 1273 | FROM |
@@ -1276,13 +1276,13 @@ discard block |
||
| 1276 | 1276 | id = %d |
| 1277 | 1277 | AND |
| 1278 | 1278 | lang = '%s'", |
| 1279 | - PMF_Db::getTablePrefix(), |
|
| 1280 | - $category_id, |
|
| 1281 | - $language); |
|
| 1282 | - $result = $this->_config->getDb()->query($query); |
|
| 1283 | - if ($row = $this->_config->getDb()->fetchArray($result)) { |
|
| 1284 | - $translated[$languageCodes[strtoupper($language)]] = $row['name'].('' == $row['description'] ? '' : ' ('.$row['description'].')'); |
|
| 1285 | - } |
|
| 1279 | + PMF_Db::getTablePrefix(), |
|
| 1280 | + $category_id, |
|
| 1281 | + $language); |
|
| 1282 | + $result = $this->_config->getDb()->query($query); |
|
| 1283 | + if ($row = $this->_config->getDb()->fetchArray($result)) { |
|
| 1284 | + $translated[$languageCodes[strtoupper($language)]] = $row['name'].('' == $row['description'] ? '' : ' ('.$row['description'].')'); |
|
| 1285 | + } |
|
| 1286 | 1286 | } |
| 1287 | 1287 | ksort($translated); |
| 1288 | 1288 | |
@@ -1336,9 +1336,9 @@ discard block |
||
| 1336 | 1336 | $result = $this->_config->getDb()->query($query); |
| 1337 | 1337 | while ($row = $this->_config->getDb()->fetchArray($result)) { |
| 1338 | 1338 | if (!array_key_exists($row['id'],$this->categoryName)) { |
| 1339 | - $this->categoryName[$row['id']] = $row; |
|
| 1340 | - $this->categories[] =& $this->categoryName[$row['id']]; |
|
| 1341 | - $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']]; |
|
| 1339 | + $this->categoryName[$row['id']] = $row; |
|
| 1340 | + $this->categories[] =& $this->categoryName[$row['id']]; |
|
| 1341 | + $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']]; |
|
| 1342 | 1342 | } |
| 1343 | 1343 | } |
| 1344 | 1344 | } |
@@ -1534,8 +1534,8 @@ discard block |
||
| 1534 | 1534 | fd.lang = fcr.category_lang |
| 1535 | 1535 | ORDER BY |
| 1536 | 1536 | fcr.category_id, fd.id', |
| 1537 | - PMF_Db::getTablePrefix(), |
|
| 1538 | - PMF_Db::getTablePrefix()); |
|
| 1537 | + PMF_Db::getTablePrefix(), |
|
| 1538 | + PMF_Db::getTablePrefix()); |
|
| 1539 | 1539 | $result = $this->_config->getDb()->query($query); |
| 1540 | 1540 | |
| 1541 | 1541 | if ($this->_config->getDb()->numRows($result) > 0) { |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | while ($row = $this->_config->getDb()->fetchArray($result)) { |
| 227 | 227 | $this->categoryName[$row['id']] = $row; |
| 228 | - $this->categories[] =& $this->categoryName[$row['id']]; |
|
| 229 | - $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']]; |
|
| 228 | + $this->categories[] = & $this->categoryName[$row['id']]; |
|
| 229 | + $this->children[$row['parent_id']][$row['id']] = & $this->categoryName[$row['id']]; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | return $this->categories; |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | $symbol = 'minus'; |
| 393 | 393 | } else { |
| 394 | 394 | $temp = isset($this->children[$thisParent_id]) ? array_keys($this->children[$thisParent_id]) : array(); |
| 395 | - if (isset($temp[count($temp)-1])) { |
|
| 396 | - $symbol = ($id == $temp[count($temp)-1]) ? 'angle' : 'medium'; |
|
| 395 | + if (isset($temp[count($temp) - 1])) { |
|
| 396 | + $symbol = ($id == $temp[count($temp) - 1]) ? 'angle' : 'medium'; |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | $childs = array(); |
| 467 | 467 | |
| 468 | 468 | if (isset($this->children[$id])) { |
| 469 | - foreach(array_keys($this->children[$id]) as $childId) { |
|
| 469 | + foreach (array_keys($this->children[$id]) as $childId) { |
|
| 470 | 470 | $childs = array_merge($childs, array($childId)); |
| 471 | 471 | $childs = array_merge($childs, $this->getChildNodes($childId)); |
| 472 | 472 | } |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | $open = 0; |
| 620 | 620 | $this->expandAll(); |
| 621 | 621 | |
| 622 | - for ($y = 0 ;$y < $this->height(); $y = $this->getNextLineTree($y)) { |
|
| 622 | + for ($y = 0; $y < $this->height(); $y = $this->getNextLineTree($y)) { |
|
| 623 | 623 | |
| 624 | 624 | list($categoryName, $parent, $description) = $this->getLineDisplay($y); |
| 625 | 625 | $level = $this->treeTab[$y]['level']; |
@@ -661,14 +661,14 @@ discard block |
||
| 661 | 661 | $num_entries = ''; |
| 662 | 662 | } else { |
| 663 | 663 | $totFaqRecords += $number[$parent]; |
| 664 | - $num_entries = '<span class="rssCategoryLink"> ('.$plr->GetMsg('plmsgEntries',$number[$parent]); |
|
| 664 | + $num_entries = '<span class="rssCategoryLink"> ('.$plr->GetMsg('plmsgEntries', $number[$parent]); |
|
| 665 | 665 | $num_entries .= sprintf( |
| 666 | 666 | ' <a href="feed/category/rss.php?category_id=%d&category_lang=%s" target="_blank"><img id="category_%d_RSS" src="assets/img/feed.png" width="16" height="16" alt="RSS"></a>', |
| 667 | 667 | $parent, |
| 668 | 668 | $this->language, |
| 669 | 669 | $parent |
| 670 | 670 | ); |
| 671 | - $num_entries .= ')</span>'; |
|
| 671 | + $num_entries .= ')</span>'; |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | $url = sprintf( |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | $oLink->text = $categoryName; |
| 683 | 683 | $oLink->tooltip = $description; |
| 684 | 684 | |
| 685 | - $output .= $oLink->toHtmlAnchor() . $num_entries; |
|
| 685 | + $output .= $oLink->toHtmlAnchor().$num_entries; |
|
| 686 | 686 | $open = $level; |
| 687 | 687 | } |
| 688 | 688 | |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | return $l + 1; |
| 726 | 726 | } else { |
| 727 | 727 | for ($i = $l + 1; $i < $this->height(); $i++) { |
| 728 | - if ($this->treeTab[$i]["level"]<=$this->treeTab[$l]["level"]) { |
|
| 728 | + if ($this->treeTab[$i]["level"] <= $this->treeTab[$l]["level"]) { |
|
| 729 | 729 | return $i; |
| 730 | 730 | } |
| 731 | 731 | } |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | ); |
| 766 | 766 | |
| 767 | 767 | $oLink = new PMF_Link($url, $this->_config); |
| 768 | - $oLink->id = 'category_' . $categoryId; |
|
| 768 | + $oLink->id = 'category_'.$categoryId; |
|
| 769 | 769 | $oLink->itemTitle = $categoryName; |
| 770 | 770 | $oLink->text = $categoryName; |
| 771 | 771 | |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | return sprintf( |
| 847 | 847 | '<ul class="%s">%s</ul>', |
| 848 | 848 | $useCssClass, |
| 849 | - implode('<li class="divider">' . $separator . '</li>', $temp) |
|
| 849 | + implode('<li class="divider">'.$separator.'</li>', $temp) |
|
| 850 | 850 | ); |
| 851 | 851 | } else { |
| 852 | 852 | return implode($separator, $temp); |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | if ($lang == $selected_lang) { |
| 1309 | 1309 | $output .= " selected=\"selected\""; |
| 1310 | 1310 | } |
| 1311 | - $output .= ">".$langname."</option>\n"; |
|
| 1311 | + $output .= ">".$langname."</option>\n"; |
|
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | 1314 | |
@@ -1335,10 +1335,10 @@ discard block |
||
| 1335 | 1335 | $query .= ' ORDER BY id'; |
| 1336 | 1336 | $result = $this->_config->getDb()->query($query); |
| 1337 | 1337 | while ($row = $this->_config->getDb()->fetchArray($result)) { |
| 1338 | - if (!array_key_exists($row['id'],$this->categoryName)) { |
|
| 1338 | + if (!array_key_exists($row['id'], $this->categoryName)) { |
|
| 1339 | 1339 | $this->categoryName[$row['id']] = $row; |
| 1340 | - $this->categories[] =& $this->categoryName[$row['id']]; |
|
| 1341 | - $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']]; |
|
| 1340 | + $this->categories[] = & $this->categoryName[$row['id']]; |
|
| 1341 | + $this->children[$row['parent_id']][$row['id']] = & $this->categoryName[$row['id']]; |
|
| 1342 | 1342 | } |
| 1343 | 1343 | } |
| 1344 | 1344 | } |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | /** |
| 127 | 127 | * Returns date formatted according to user defined format |
| 128 | 128 | * |
| 129 | - * @param string $date |
|
| 129 | + * @param string $unformattedDate |
|
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | 132 | public function format($unformattedDate) |
@@ -1,23 +1,22 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * phpMyFAQ Date class |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package PMF_Date |
|
| 13 | - * @author Thorsten Rinne <[email protected]> |
|
| 14 | - * @author Matteo Scaramuccia <[email protected]> |
|
| 15 | - * @copyright 2009-2015 phpMyFAQ Team |
|
| 16 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | - |
|
| 18 | - * @link http://www.phpmyfaq.de |
|
| 19 | - * @since 2009-09-24 |
|
| 20 | - */ |
|
| 3 | + * phpMyFAQ Date class |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package PMF_Date |
|
| 13 | + * @author Thorsten Rinne <[email protected]> |
|
| 14 | + * @author Matteo Scaramuccia <[email protected]> |
|
| 15 | + * @copyright 2009-2015 phpMyFAQ Team |
|
| 16 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | + * @link http://www.phpmyfaq.de |
|
| 18 | + * @since 2009-09-24 |
|
| 19 | + */ |
|
| 21 | 20 | |
| 22 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 23 | 22 | exit(); |
@@ -68,10 +68,10 @@ |
||
| 68 | 68 | { |
| 69 | 69 | if ($pmfFormat) { |
| 70 | 70 | $dateString = strtotime( |
| 71 | - substr($date, 0, 4) . '-' . |
|
| 72 | - substr($date, 4, 2) . '-' . |
|
| 73 | - substr($date, 6, 2) . ' ' . |
|
| 74 | - substr($date, 8, 2) . ':' . |
|
| 71 | + substr($date, 0, 4).'-'. |
|
| 72 | + substr($date, 4, 2).'-'. |
|
| 73 | + substr($date, 6, 2).' '. |
|
| 74 | + substr($date, 8, 2).':'. |
|
| 75 | 75 | substr($date, 10, 2) |
| 76 | 76 | ); |
| 77 | 77 | } else { |