@@ -97,7 +97,7 @@ |
||
| 97 | 97 | </main> |
| 98 | 98 | <script> |
| 99 | 99 | var subfolders = '<?=$request::$subfolders?>', |
| 100 | - cmsSubfolders = '<?=$request::$subfolders . $cmsPrefix?>'; |
|
| 100 | + cmsSubfolders = '<?=$request::$subfolders.$cmsPrefix?>'; |
|
| 101 | 101 | </script> |
| 102 | 102 | <script src="<?= $request::$subfolders ?>js/cms.js"></script> |
| 103 | 103 | </body> |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | <? include('documents/function.renderFolder.php'); ?> |
| 4 | 4 | <script>window.onload = function () { |
| 5 | 5 | History.init(); |
| 6 | - History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders . $cmsPrefix?>/documents?path=/'); |
|
| 6 | + History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders.$cmsPrefix?>/documents?path=/'); |
|
| 7 | 7 | };</script> |
| 8 | 8 | <section class="documents"> |
| 9 | 9 | <h2><i class="fa fa-file-text-o"></i> Documents</h2> |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | $event->getIO()->write("*** Checking installation of Cloud Control framework ***"); |
| 37 | 37 | |
| 38 | 38 | $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); |
| 39 | - $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); |
|
| 39 | + $rootDir = realpath($vendorDir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR); |
|
| 40 | 40 | |
| 41 | - $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json'; |
|
| 41 | + $baseConfigTargetPath = $rootDir.DIRECTORY_SEPARATOR.'config.json'; |
|
| 42 | 42 | $configObject = self::getConfig($baseConfigTargetPath); |
| 43 | 43 | |
| 44 | 44 | $configObject->{'vendorDir'} = realpath($vendorDir); |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // TODO Fie FilesStorage to use filesDir from config, similar to ImagesStorage |
| 55 | 55 | |
| 56 | - $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json'; |
|
| 57 | - $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql'; |
|
| 56 | + $baseStorageDefaultPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.json'; |
|
| 57 | + $baseStorageSqlPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.sql'; |
|
| 58 | 58 | |
| 59 | 59 | self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath); |
| 60 | 60 | self::saveConfig($event, $baseConfigTargetPath, $configObject); |
@@ -81,23 +81,23 @@ discard block |
||
| 81 | 81 | private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject) |
| 82 | 82 | { |
| 83 | 83 | file_put_contents($baseConfigTargetPath, json_encode($configObject)); |
| 84 | - $event->getIO()->write("Saved config to: " . $baseConfigTargetPath); |
|
| 84 | + $event->getIO()->write("Saved config to: ".$baseConfigTargetPath); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null) |
| 88 | 88 | { |
| 89 | - $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName); |
|
| 89 | + $sourceFilePath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install/_'.$sourceFileName); |
|
| 90 | 90 | |
| 91 | 91 | if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) { |
| 92 | 92 | if ($destinationFileName !== null) { |
| 93 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName); |
|
| 93 | + copy($sourceFilePath, realpath($destinationPath).DIRECTORY_SEPARATOR.$destinationFileName); |
|
| 94 | 94 | } else { |
| 95 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $sourceFileName); |
|
| 95 | + copy($sourceFilePath, realpath($destinationPath).DIRECTORY_SEPARATOR.$sourceFileName); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $event->getIO()->write("Copied file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 98 | + $event->getIO()->write("Copied file: ".$sourceFileName.' to '.$destinationPath); |
|
| 99 | 99 | } else { |
| 100 | - $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 100 | + $event->getIO()->write("[ERROR] Couldnt copy file: ".$sourceFileName.' to '.$destinationPath); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | private static function createDir(Event $event, $rootDir, $dirName) |
| 116 | 116 | { |
| 117 | - $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR; |
|
| 117 | + $dir = $rootDir.DIRECTORY_SEPARATOR.$dirName.DIRECTORY_SEPARATOR; |
|
| 118 | 118 | if (!is_dir($dir)) { |
| 119 | 119 | mkdir($dir); |
| 120 | - $event->getIO()->write("Created dir: " . $dir); |
|
| 120 | + $event->getIO()->write("Created dir: ".$dir); |
|
| 121 | 121 | } |
| 122 | 122 | return realpath($dir); |
| 123 | 123 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private static function getConfig($configTargetPath) |
| 130 | 130 | { |
| 131 | - $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_config.json'); |
|
| 131 | + $baseConfigDefaultPath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install/_config.json'); |
|
| 132 | 132 | |
| 133 | 133 | if (file_exists($configTargetPath)) { |
| 134 | 134 | $config = json_decode(file_get_contents($configTargetPath)); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $debug_backtrace = current(debug_backtrace()); |
| 13 | 13 | if (PHP_SAPI == 'cli') { |
| 14 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
| 14 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
| 15 | 15 | foreach (func_get_args() as $data) { |
| 16 | 16 | var_dump($data); |
| 17 | 17 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | <body> |
| 30 | 30 | END; |
| 31 | 31 | |
| 32 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
| 32 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
| 33 | 33 | echo '<pre>'; |
| 34 | 34 | foreach (func_get_args() as $data) { |
| 35 | 35 | echo "<code>"; |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function utf8Convert($array) |
| 55 | 55 | { |
| 56 | - array_walk_recursive($array, function(&$item){ |
|
| 57 | - if(!mb_detect_encoding($item, 'utf-8', true)){ |
|
| 56 | + array_walk_recursive($array, function(&$item) { |
|
| 57 | + if (!mb_detect_encoding($item, 'utf-8', true)) { |
|
| 58 | 58 | $item = utf8_encode($item); |
| 59 | 59 | } |
| 60 | 60 | }); |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $file = $cmsComponent->storage->getFiles()->getFileByName($slug); |
| 42 | 42 | // TODO FIX THIS PATH |
| 43 | - $path = realpath(__DIR__ . '/../www/files/'); |
|
| 44 | - $quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\')); |
|
| 45 | - $size = filesize($path . '/' . $file->file); |
|
| 43 | + $path = realpath(__DIR__.'/../www/files/'); |
|
| 44 | + $quoted = sprintf('"%s"', addcslashes(basename($path.'/'.$file->file), '"\\')); |
|
| 45 | + $size = filesize($path.'/'.$file->file); |
|
| 46 | 46 | |
| 47 | 47 | header('Content-Description: File Transfer'); |
| 48 | - header('Content-Type: ' . $file->type); |
|
| 49 | - header('Content-Disposition: attachment; filename=' . $quoted); |
|
| 48 | + header('Content-Type: '.$file->type); |
|
| 49 | + header('Content-Disposition: attachment; filename='.$quoted); |
|
| 50 | 50 | header('Content-Transfer-Encoding: binary'); |
| 51 | 51 | header('Connection: Keep-Alive'); |
| 52 | 52 | header('Expires: 0'); |
| 53 | 53 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 54 | 54 | header('Pragma: public'); |
| 55 | - header('Content-Length: ' . $size); |
|
| 55 | + header('Content-Length: '.$size); |
|
| 56 | 56 | |
| 57 | - readfile($path . '/' . $file->file); |
|
| 57 | + readfile($path.'/'.$file->file); |
|
| 58 | 58 | exit; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_FILES); |
| 79 | 79 | if (isset($_FILES[CmsComponent::FILES_PARAMETER_FILE])) { |
| 80 | 80 | $cmsComponent->storage->getFiles()->addFile($_FILES[CmsComponent::FILES_PARAMETER_FILE]); |
| 81 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
| 81 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
| 82 | 82 | exit; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | private function deleteRoute($request, $cmsComponent) |
| 91 | 91 | { |
| 92 | 92 | $cmsComponent->storage->getFiles()->deleteFileByName($request::$get[CmsComponent::FILES_PARAMETER_FILE]); |
| 93 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
| 93 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
| 94 | 94 | exit; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param array $parameters |
| 41 | 41 | * @param $matchedSitemapItem |
| 42 | 42 | */ |
| 43 | - public function __construct($template='', Request $request, $parameters=array(), $matchedSitemapItem) |
|
| 43 | + public function __construct($template = '', Request $request, $parameters = array(), $matchedSitemapItem) |
|
| 44 | 44 | { |
| 45 | 45 | $this->template = $template; |
| 46 | 46 | $this->request = $request; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @throws \Exception |
| 67 | 67 | */ |
| 68 | - public function render($application=null) |
|
| 68 | + public function render($application = null) |
|
| 69 | 69 | { |
| 70 | 70 | $this->renderedContent = $this->renderTemplate($this->template, true, $application); |
| 71 | 71 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return string |
| 92 | 92 | * @throws \Exception |
| 93 | 93 | */ |
| 94 | - public function renderTemplate($template='', $obClean = true, $application=null) |
|
| 94 | + public function renderTemplate($template = '', $obClean = true, $application = null) |
|
| 95 | 95 | { |
| 96 | 96 | $templatePath = $this->getTemplatePath($template, $application); |
| 97 | 97 | if (realpath($templatePath) !== false) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | return ob_get_contents(); |
| 111 | 111 | } else { |
| 112 | 112 | if ($template !== null) { // If template is null, its a application component, which doesnt have a template |
| 113 | - throw new \Exception('Couldnt find template ' . $templatePath); |
|
| 113 | + throw new \Exception('Couldnt find template '.$templatePath); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @return string |
| 126 | 126 | * @throws \Exception |
| 127 | 127 | */ |
| 128 | - public function includeTemplate($template='', $parameters = array()) |
|
| 128 | + public function includeTemplate($template = '', $parameters = array()) |
|
| 129 | 129 | { |
| 130 | 130 | if (is_array($parameters)) { |
| 131 | 131 | foreach ($parameters as $name => $value) { |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | * @param null $application |
| 146 | 146 | * @return string |
| 147 | 147 | */ |
| 148 | - protected function getTemplatePath($template, $application=null) |
|
| 148 | + protected function getTemplatePath($template, $application = null) |
|
| 149 | 149 | { |
| 150 | 150 | $templatePath = $application->getTemplatePath(); |
| 151 | - $templatePath = $templatePath . DIRECTORY_SEPARATOR . $template . '.php'; |
|
| 151 | + $templatePath = $templatePath.DIRECTORY_SEPARATOR.$template.'.php'; |
|
| 152 | 152 | return $templatePath; |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $whitelistIps = explode(',', $this->parameters[self::PARAMETER_WHITELIST_IPS]); |
| 171 | 171 | $whitelistIps = array_map("trim", $whitelistIps); |
| 172 | 172 | if (!in_array($remoteAddress, $whitelistIps)) { |
| 173 | - throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist'); |
|
| 173 | + throw new \Exception('Ip address '.$remoteAddress.' is not on whitelist'); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $blacklistIps = explode(',', $this->parameters[self::PARAMETER_BLACKLIST_IPS]); |
| 187 | 187 | $blacklistIps = array_map("trim", $blacklistIps); |
| 188 | 188 | if (in_array($remoteAddress, $blacklistIps)) { |
| 189 | - throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist'); |
|
| 189 | + throw new \Exception('Ip address '.$remoteAddress.' is on blacklist'); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | if ($relativeCmsUri == '/log-off') { |
| 231 | 231 | $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = null; |
| 232 | 232 | unset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]); |
| 233 | - header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
| 233 | + header('Location: '.$request::$subfolders.$this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
| 234 | 234 | exit; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | protected function getTemplatePath($template, $application = null) |
| 373 | 373 | { |
| 374 | - return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php'; |
|
| 374 | + return __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$template.'.php'; |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | \ No newline at end of file |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | protected function applyFilters($tokens) |
| 47 | 47 | { |
| 48 | 48 | foreach ($this->filters as $filterName) { |
| 49 | - $filterClassName = '\CloudControl\Cms\search\filters\\' . $filterName; |
|
| 49 | + $filterClassName = '\CloudControl\Cms\search\filters\\'.$filterName; |
|
| 50 | 50 | $filter = new $filterClassName($tokens); |
| 51 | 51 | $tokens = $filter->getFilterResults(); |
| 52 | 52 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | foreach ($documentTermCount as $field => $countArray) { |
| 67 | 67 | $quotedField = $db->quote($field); |
| 68 | 68 | foreach ($countArray as $term => $count) { |
| 69 | - $values[] = $quotedDocumentPath . ', ' . $db->quote($term) . ', ' . $db->quote($count) . ', ' . $quotedField; |
|
| 69 | + $values[] = $quotedDocumentPath.', '.$db->quote($term).', '.$db->quote($count).', '.$quotedField; |
|
| 70 | 70 | $i += 1; |
| 71 | 71 | if ($i >= Indexer::SQLITE_MAX_COMPOUND_SELECT) { |
| 72 | 72 | $this->executeStoreDocumentTermCount($values, $sql, $db); |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function executeStoreDocumentTermCount($values, $sql, $db) |
| 92 | 92 | { |
| 93 | - $sql .= '(' . implode('),' . PHP_EOL . '(', $values) . ');'; |
|
| 93 | + $sql .= '('.implode('),'.PHP_EOL.'(', $values).');'; |
|
| 94 | 94 | $stmt = $db->prepare($sql); |
| 95 | 95 | if ($stmt === false || !$stmt->execute()) { |
| 96 | 96 | $errorInfo = $db->errorInfo(); |
| 97 | 97 | $errorMsg = $errorInfo[2]; |
| 98 | - throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
|
| 98 | + throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>'); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | if (!$stmt = $db->query($sql)) { |
| 80 | 80 | $errorInfo = $db->errorInfo(); |
| 81 | 81 | $errorMsg = $errorInfo[2]; |
| 82 | - throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
|
| 82 | + throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>'); |
|
| 83 | 83 | } |
| 84 | 84 | $result = $stmt->fetch(\PDO::FETCH_COLUMN); |
| 85 | 85 | if (false === $result) { |
| 86 | 86 | $errorInfo = $db->errorInfo(); |
| 87 | 87 | $errorMsg = $errorInfo[2]; |
| 88 | - throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
|
| 88 | + throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>'); |
|
| 89 | 89 | } |
| 90 | 90 | return intval($result); |
| 91 | 91 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | protected function applyFilters($tokens) |
| 119 | 119 | { |
| 120 | 120 | foreach ($this->filters as $filterName) { |
| 121 | - $filterClassName = '\CloudControl\Cms\search\filters\\' . $filterName; |
|
| 121 | + $filterClassName = '\CloudControl\Cms\search\filters\\'.$filterName; |
|
| 122 | 122 | $filter = new $filterClassName($tokens); |
| 123 | 123 | $tokens = $filter->getFilterResults(); |
| 124 | 124 | } |
@@ -154,13 +154,13 @@ discard block |
||
| 154 | 154 | GROUP BY term_frequency.documentPath, term_frequency.term |
| 155 | 155 | ORDER BY score DESC |
| 156 | 156 | '; |
| 157 | - if(!$stmt = $db->prepare($sql)) { |
|
| 158 | - throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>'); |
|
| 157 | + if (!$stmt = $db->prepare($sql)) { |
|
| 158 | + throw new \Exception('SQLite exception: <pre>'.print_r($db->errorInfo(), true).'</pre> for SQL:<pre>'.$sql.'</pre>'); |
|
| 159 | 159 | } |
| 160 | 160 | $stmt->bindValue(':query', $token); |
| 161 | 161 | $stmt->bindValue(':queryNorm', $queryNorm); |
| 162 | 162 | if (!$stmt->execute()) { |
| 163 | - throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>'); |
|
| 163 | + throw new \Exception('SQLite exception: <pre>'.print_r($db->errorInfo(), true).'</pre> for SQL:<pre>'.$sql.'</pre>'); |
|
| 164 | 164 | } |
| 165 | 165 | return $stmt->fetchAll(\PDO::FETCH_CLASS, '\CloudControl\Cms\search\results\SearchResult'); |
| 166 | 166 | } |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | $sql = ' |
| 217 | 217 | SELECT (1 / sqrt(SUM(inverseDocumentFrequency))) as queryNorm |
| 218 | 218 | FROM inverse_document_frequency |
| 219 | - WHERE term IN (' . $terms . ') |
|
| 219 | + WHERE term IN (' . $terms.') |
|
| 220 | 220 | '; |
| 221 | - if(!$stmt = $db->prepare($sql)) { |
|
| 222 | - throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>'); |
|
| 221 | + if (!$stmt = $db->prepare($sql)) { |
|
| 222 | + throw new \Exception('SQLite exception: <pre>'.print_r($db->errorInfo(), true).'</pre> for SQL:<pre>'.$sql.'</pre>'); |
|
| 223 | 223 | } |
| 224 | 224 | if (!$stmt->execute()) { |
| 225 | - throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>'); |
|
| 225 | + throw new \Exception('SQLite exception: <pre>'.print_r($db->errorInfo(), true).'</pre> for SQL:<pre>'.$sql.'</pre>'); |
|
| 226 | 226 | } |
| 227 | 227 | $result = $stmt->fetch(\PDO::FETCH_OBJ); |
| 228 | 228 | return $result->queryNorm == null ? 1 : $result->queryNorm; |
@@ -272,11 +272,11 @@ discard block |
||
| 272 | 272 | '; |
| 273 | 273 | $stmt = $db->prepare($sql); |
| 274 | 274 | if ($stmt === false) { |
| 275 | - throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>'); |
|
| 275 | + throw new \Exception('SQLite exception: <pre>'.print_r($db->errorInfo(), true).'</pre> for SQL:<pre>'.$sql.'</pre>'); |
|
| 276 | 276 | } |
| 277 | 277 | $stmt->bindValue(':token', $token); |
| 278 | 278 | if (($stmt === false) | (!$stmt->execute())) { |
| 279 | - throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>'); |
|
| 279 | + throw new \Exception('SQLite exception: <pre>'.print_r($db->errorInfo(), true).'</pre> for SQL:<pre>'.$sql.'</pre>'); |
|
| 280 | 280 | } |
| 281 | 281 | $result = $stmt->fetchAll(\PDO::FETCH_CLASS, '\CloudControl\Cms\search\results\SearchSuggestion'); |
| 282 | 282 | $allResults = array_merge($result, $allResults); |