@@ -5,7 +5,7 @@ |
||
| 5 | 5 | * Time: 14:24 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if (include_once(MODX_MANAGER_PATH . 'includes/extenders/export.class.inc.php')) { |
|
| 8 | +if (include_once(MODX_MANAGER_PATH.'includes/extenders/export.class.inc.php')) { |
|
| 9 | 9 | $this->export = new EXPORT_SITE; |
| 10 | 10 | |
| 11 | 11 | return true; |
@@ -279,7 +279,8 @@ discard block |
||
| 279 | 279 | $row['count'] = $this->count; |
| 280 | 280 | $row['url'] = $modx->makeUrl($row['id']); |
| 281 | 281 | |
| 282 | - if (!$row['wasNull']) { // needs writing a document |
|
| 282 | + if (!$row['wasNull']) { |
|
| 283 | +// needs writing a document |
|
| 283 | 284 | $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix); |
| 284 | 285 | $filename = $dirpath . $docname; |
| 285 | 286 | if (!is_file($filename)) { |
@@ -307,7 +308,8 @@ discard block |
||
| 307 | 308 | $this->output[] = $this->parsePlaceholder($_lang['export_site_exporting_document'], $row); |
| 308 | 309 | } |
| 309 | 310 | if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'], |
| 310 | - '.') === false)) { // needs making a folder |
|
| 311 | + '.') === false)) { |
|
| 312 | +// needs making a folder |
|
| 311 | 313 | $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id']; |
| 312 | 314 | $dir_path = $dirpath . $end_dir; |
| 313 | 315 | if (strpos($dir_path, MODX_BASE_PATH) === false) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->count = 0; |
| 58 | 58 | $this->setUrlMode(); |
| 59 | 59 | $this->generate_mode = 'crawl'; |
| 60 | - $this->targetDir = $modx->config['base_path'] . 'temp/export'; |
|
| 60 | + $this->targetDir = $modx->config['base_path'].'temp/export'; |
|
| 61 | 61 | if (!isset($this->total)) { |
| 62 | 62 | $this->getTotal(); |
| 63 | 63 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $ignore_ids = array_filter(array_map('intval', explode(',', $ignore_ids))); |
| 114 | 114 | if (count($ignore_ids) > 0) { |
| 115 | - $ignore_ids = "AND NOT id IN ('" . implode("','", $ignore_ids) . "')"; |
|
| 115 | + $ignore_ids = "AND NOT id IN ('".implode("','", $ignore_ids)."')"; |
|
| 116 | 116 | } else { |
| 117 | 117 | $ignore_ids = ''; |
| 118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $noncache = ($noncache == 1) ? '' : 'AND cacheable=1'; |
| 123 | 123 | $where = "deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) {$noncache} {$ignore_ids}"; |
| 124 | 124 | $rs = $modx->db->select('count(id)', $tbl_site_content, $where); |
| 125 | - $this->total = (int)$modx->db->getValue($rs); |
|
| 125 | + $this->total = (int) $modx->db->getValue($rs); |
|
| 126 | 126 | |
| 127 | 127 | return $this->total; |
| 128 | 128 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } elseif (!is_readable($directory)) { |
| 152 | 152 | return $rs; |
| 153 | 153 | } else { |
| 154 | - $files = glob($directory . '/*'); |
|
| 154 | + $files = glob($directory.'/*'); |
|
| 155 | 155 | if (!empty($files)) { |
| 156 | 156 | foreach ($files as $path) { |
| 157 | 157 | $rs = is_dir($path) ? $this->removeDirectoryAll($path) : unlink($path); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $_lang = $back_lang; |
| 182 | 182 | } else { |
| 183 | - $src = $this->curl_get_contents(MODX_SITE_URL . "index.php?id={$docid}"); |
|
| 183 | + $src = $this->curl_get_contents(MODX_SITE_URL."index.php?id={$docid}"); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
@@ -215,12 +215,12 @@ discard block |
||
| 215 | 215 | $modx = evolutionCMS(); |
| 216 | 216 | |
| 217 | 217 | if ($alias === '') { |
| 218 | - $filename = $prefix . $docid . $suffix; |
|
| 218 | + $filename = $prefix.$docid.$suffix; |
|
| 219 | 219 | } else { |
| 220 | 220 | if ($modx->config['suffix_mode'] === '1' && strpos($alias, '.') !== false) { |
| 221 | 221 | $suffix = ''; |
| 222 | 222 | } |
| 223 | - $filename = $prefix . $alias . $suffix; |
|
| 223 | + $filename = $prefix.$alias.$suffix; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | return $filename; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $tbl_site_content = $modx->getFullTableName('site_content'); |
| 239 | 239 | |
| 240 | 240 | $ignore_ids = $this->ignore_ids; |
| 241 | - $dirpath = $this->targetDir . '/'; |
|
| 241 | + $dirpath = $this->targetDir.'/'; |
|
| 242 | 242 | |
| 243 | 243 | $prefix = $modx->config['friendly_url_prefix']; |
| 244 | 244 | $suffix = $modx->config['friendly_url_suffix']; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | $ph['status'] = 'fail'; |
| 250 | 250 | $ph['msg1'] = $_lang['export_site_failed']; |
| 251 | - $ph['msg2'] = $_lang["export_site_failed_no_write"] . ' - ' . $dirpath; |
|
| 251 | + $ph['msg2'] = $_lang["export_site_failed_no_write"].' - '.$dirpath; |
|
| 252 | 252 | $msg_failed_no_write = $this->parsePlaceholder($tpl, $ph); |
| 253 | 253 | |
| 254 | 254 | $ph['msg2'] = $_lang["export_site_failed_no_retrieve"]; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | if (!$row['wasNull']) { // needs writing a document |
| 283 | 283 | $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix); |
| 284 | - $filename = $dirpath . $docname; |
|
| 284 | + $filename = $dirpath.$docname; |
|
| 285 | 285 | if (!is_file($filename)) { |
| 286 | 286 | if ($row['published'] === '1') { |
| 287 | 287 | $status = $this->makeFile($row['id'], $filename); |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'], |
| 310 | 310 | '.') === false)) { // needs making a folder |
| 311 | 311 | $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id']; |
| 312 | - $dir_path = $dirpath . $end_dir; |
|
| 312 | + $dir_path = $dirpath.$end_dir; |
|
| 313 | 313 | if (strpos($dir_path, MODX_BASE_PATH) === false) { |
| 314 | 314 | return false; |
| 315 | 315 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | if ($modx->config['make_folders'] === '1' && $row['published'] === '1') { |
| 327 | 327 | if (!empty($filename) && is_file($filename)) { |
| 328 | - rename($filename, $dir_path . '/index.html'); |
|
| 328 | + rename($filename, $dir_path.'/index.html'); |
|
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | $this->targetDir = $dir_path; |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | $ch = curl_init(); |
| 351 | 351 | curl_setopt($ch, CURLOPT_URL, $url); |
| 352 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT |
|
| 353 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER |
|
| 352 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT |
|
| 353 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER |
|
| 354 | 354 | curl_setopt($ch, CURLOPT_HEADER, false); |
| 355 | 355 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 356 | 356 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
@@ -225,13 +225,13 @@ discard block |
||
| 225 | 225 | $orderBy = trim($orderBy); |
| 226 | 226 | $limit = trim($limit); |
| 227 | 227 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
| 228 | - $where = "WHERE {$where}"; |
|
| 228 | + $where = "where {$where}"; |
|
| 229 | 229 | } |
| 230 | 230 | if ($orderBy !== '' && stripos($orderBy, 'ORDER BY') !== 0) { |
| 231 | 231 | $orderBy = "ORDER BY {$orderBy}"; |
| 232 | 232 | } |
| 233 | 233 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
| 234 | - $limit = "LIMIT {$limit}"; |
|
| 234 | + $limit = "limit {$limit}"; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $out = $this->query("DELETE FROM {$from} {$where} {$orderBy} {$limit}"); |
@@ -272,16 +272,16 @@ discard block |
||
| 272 | 272 | $orderBy = trim($orderBy); |
| 273 | 273 | $limit = trim($limit); |
| 274 | 274 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
| 275 | - $where = "WHERE {$where}"; |
|
| 275 | + $where = "where {$where}"; |
|
| 276 | 276 | } |
| 277 | 277 | if ($orderBy !== '' && stripos($orderBy, 'ORDER') !== 0) { |
| 278 | 278 | $orderBy = "ORDER BY {$orderBy}"; |
| 279 | 279 | } |
| 280 | 280 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
| 281 | - $limit = "LIMIT {$limit}"; |
|
| 281 | + $limit = "limit {$limit}"; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - return $this->query("SELECT {$fields} FROM {$from} {$where} {$orderBy} {$limit}"); |
|
| 284 | + return $this->query("select {$fields} FROM {$from} {$where} {$orderBy} {$limit}"); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -349,10 +349,10 @@ discard block |
||
| 349 | 349 | $where = trim($where); |
| 350 | 350 | $limit = trim($limit); |
| 351 | 351 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
| 352 | - $where = "WHERE {$where}"; |
|
| 352 | + $where = "where {$where}"; |
|
| 353 | 353 | } |
| 354 | 354 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
| 355 | - $limit = "LIMIT {$limit}"; |
|
| 355 | + $limit = "limit {$limit}"; |
|
| 356 | 356 | } |
| 357 | 357 | $this->query("INSERT INTO {$intotable} {$fields} SELECT {$fromfields} FROM {$fromtable} {$where} {$limit}"); |
| 358 | 358 | } |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | - * @param string|array $fields |
|
| 244 | - * @param string|array $from |
|
| 245 | - * @param string|array $where |
|
| 243 | + * @param string $fields |
|
| 244 | + * @param string $from |
|
| 245 | + * @param string $where |
|
| 246 | 246 | * @param string $orderBy |
| 247 | 247 | * @param string $limit |
| 248 | 248 | * @return bool|mysqli_result |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @param string $fromtable |
| 327 | 327 | * @param string $where |
| 328 | 328 | * @param string $limit |
| 329 | - * @return mixed |
|
| 329 | + * @return null|integer |
|
| 330 | 330 | */ |
| 331 | 331 | public function insert($fields, $intotable, $fromfields = "*", $fromtable = "", $where = "", $limit = "") |
| 332 | 332 | { |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | /** |
| 370 | 370 | * @param $fields |
| 371 | - * @param $table |
|
| 371 | + * @param string $table |
|
| 372 | 372 | * @param string $where |
| 373 | 373 | * @return bool|mixed|mysqli_result |
| 374 | 374 | */ |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | /** |
| 437 | 437 | * @param null|mysqli $conn |
| 438 | - * @return mixed |
|
| 438 | + * @return integer |
|
| 439 | 439 | */ |
| 440 | 440 | public function getInsertId($conn = null) |
| 441 | 441 | { |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | /** |
| 516 | - * @param $name |
|
| 516 | + * @param string $name |
|
| 517 | 517 | * @param mysqli_result|string $dsq |
| 518 | 518 | * @return array |
| 519 | 519 | */ |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | |
| 573 | 573 | /** |
| 574 | 574 | * @param string $table |
| 575 | - * @return array |
|
| 575 | + * @return boolean |
|
| 576 | 576 | */ |
| 577 | 577 | public function getTableMetaData($table) |
| 578 | 578 | { |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
| 622 | - * @param string|mysqli_result $rs |
|
| 622 | + * @param string $rs |
|
| 623 | 623 | * @param bool $index |
| 624 | 624 | * @return array |
| 625 | 625 | */ |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $pre = null, |
| 31 | 31 | $charset = '', |
| 32 | 32 | $connection_method = 'SET CHARACTER SET' |
| 33 | - ) { |
|
| 33 | + ){ |
|
| 34 | 34 | $this->config['host'] = $host ? $host : $GLOBALS['database_server']; |
| 35 | 35 | $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase']; |
| 36 | 36 | $this->config['user'] = $uid ? $uid : $GLOBALS['database_user']; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']); |
| 71 | 71 | $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']); |
| 72 | 72 | $modx->sendmail(array( |
| 73 | - 'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'], |
|
| 73 | + 'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'], |
|
| 74 | 74 | 'body' => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}", |
| 75 | 75 | 'type' => 'text' |
| 76 | 76 | )); |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $tend = $modx->getMicroTime(); |
| 86 | 86 | $totaltime = $tend - $tstart; |
| 87 | 87 | if ($modx->dumpSQL) { |
| 88 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s", |
|
| 89 | - $totaltime) . "</fieldset><br />"; |
|
| 88 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s", |
|
| 89 | + $totaltime)."</fieldset><br />"; |
|
| 90 | 90 | } |
| 91 | 91 | $this->conn->set_charset($this->config['charset']); |
| 92 | 92 | $this->isConnected = true; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | if (1000 < $safeCount) { |
| 120 | 120 | exit("Too many loops '{$safeCount}'"); |
| 121 | 121 | } |
| 122 | - if (! ($this->conn instanceof mysqli)) { |
|
| 122 | + if (!($this->conn instanceof mysqli)) { |
|
| 123 | 123 | $this->connect(); |
| 124 | 124 | } |
| 125 | 125 | if (is_array($s)) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public function query($sql, $watchError = true) |
| 146 | 146 | { |
| 147 | 147 | $modx = evolutionCMS(); |
| 148 | - if (! ($this->conn instanceof mysqli)) { |
|
| 148 | + if (!($this->conn instanceof mysqli)) { |
|
| 149 | 149 | $this->connect(); |
| 150 | 150 | } |
| 151 | 151 | $tStart = $modx->getMicroTime(); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | case 1091: |
| 166 | 166 | break; |
| 167 | 167 | default: |
| 168 | - $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql); |
|
| 168 | + $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql); |
|
| 169 | 169 | } |
| 170 | 170 | } else { |
| 171 | 171 | $tend = $modx->getMicroTime(); |
@@ -179,24 +179,24 @@ discard block |
||
| 179 | 179 | $debug_path[] = $line['function']; |
| 180 | 180 | } |
| 181 | 181 | $debug_path = implode(' > ', array_reverse($debug_path)); |
| 182 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms", |
|
| 183 | - $totalTime * 1000) . "</legend>"; |
|
| 184 | - $modx->queryCode .= $sql . '<br><br>'; |
|
| 182 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms", |
|
| 183 | + $totalTime * 1000)."</legend>"; |
|
| 184 | + $modx->queryCode .= $sql.'<br><br>'; |
|
| 185 | 185 | if ($modx->event->name) { |
| 186 | - $modx->queryCode .= 'Current Event => ' . $modx->event->name . '<br>'; |
|
| 186 | + $modx->queryCode .= 'Current Event => '.$modx->event->name.'<br>'; |
|
| 187 | 187 | } |
| 188 | 188 | if ($modx->event->activePlugin) { |
| 189 | - $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>'; |
|
| 189 | + $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>'; |
|
| 190 | 190 | } |
| 191 | 191 | if ($modx->currentSnippet) { |
| 192 | - $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>'; |
|
| 192 | + $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>'; |
|
| 193 | 193 | } |
| 194 | 194 | if (stripos($sql, 'select') === 0) { |
| 195 | - $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>'; |
|
| 195 | + $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>'; |
|
| 196 | 196 | } else { |
| 197 | - $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>'; |
|
| 197 | + $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>'; |
|
| 198 | 198 | } |
| 199 | - $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>'; |
|
| 199 | + $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>'; |
|
| 200 | 200 | $modx->queryCode .= "</fieldset><br />"; |
| 201 | 201 | } |
| 202 | 202 | $modx->executedQueries++; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $modx = evolutionCMS(); |
| 296 | 296 | $out = false; |
| 297 | 297 | if (!$table) { |
| 298 | - $modx->messageQuit('Empty ' . $table . ' parameter in DBAPI::update().'); |
|
| 298 | + $modx->messageQuit('Empty '.$table.' parameter in DBAPI::update().'); |
|
| 299 | 299 | } else { |
| 300 | 300 | $table = $this->replaceFullTableName($table); |
| 301 | 301 | if (is_array($fields)) { |
@@ -303,18 +303,18 @@ discard block |
||
| 303 | 303 | if ($value === null || strtolower($value) === 'null') { |
| 304 | 304 | $f = 'NULL'; |
| 305 | 305 | } else { |
| 306 | - $f = "'" . $value . "'"; |
|
| 306 | + $f = "'".$value."'"; |
|
| 307 | 307 | } |
| 308 | - $fields[$key] = "`{$key}` = " . $f; |
|
| 308 | + $fields[$key] = "`{$key}` = ".$f; |
|
| 309 | 309 | } |
| 310 | 310 | $fields = implode(',', $fields); |
| 311 | 311 | } |
| 312 | 312 | $where = trim($where); |
| 313 | 313 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
| 314 | - $where = 'WHERE ' . $where; |
|
| 314 | + $where = 'WHERE '.$where; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - return $this->query('UPDATE ' . $table . ' SET ' . $fields . ' ' . $where); |
|
| 317 | + return $this->query('UPDATE '.$table.' SET '.$fields.' '.$where); |
|
| 318 | 318 | } |
| 319 | 319 | return $out; |
| 320 | 320 | } |
@@ -340,12 +340,12 @@ discard block |
||
| 340 | 340 | $this->query("INSERT INTO {$intotable} {$fields}"); |
| 341 | 341 | } else { |
| 342 | 342 | if (empty($fromtable)) { |
| 343 | - $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '", |
|
| 344 | - array_values($fields)) . "')"; |
|
| 343 | + $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '", |
|
| 344 | + array_values($fields))."')"; |
|
| 345 | 345 | $this->query("INSERT INTO {$intotable} {$fields}"); |
| 346 | 346 | } else { |
| 347 | 347 | $fromtable = $this->replaceFullTableName($fromtable); |
| 348 | - $fields = "(" . implode(",", array_keys($fields)) . ")"; |
|
| 348 | + $fields = "(".implode(",", array_keys($fields)).")"; |
|
| 349 | 349 | $where = trim($where); |
| 350 | 350 | $limit = trim($limit); |
| 351 | 351 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | public function getInsertId($conn = null) |
| 441 | 441 | { |
| 442 | - if (! ($conn instanceof mysqli)) { |
|
| 443 | - $conn =& $this->conn; |
|
| 442 | + if (!($conn instanceof mysqli)) { |
|
| 443 | + $conn = & $this->conn; |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | return $conn->insert_id; |
@@ -452,8 +452,8 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | public function getAffectedRows($conn = null) |
| 454 | 454 | { |
| 455 | - if (! ($conn instanceof mysqli)) { |
|
| 456 | - $conn =& $this->conn; |
|
| 455 | + if (!($conn instanceof mysqli)) { |
|
| 456 | + $conn = & $this->conn; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | return $conn->affected_rows; |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public function getLastError($conn = null) |
| 467 | 467 | { |
| 468 | - if (! ($conn instanceof mysqli)) { |
|
| 469 | - $conn =& $this->conn; |
|
| 468 | + if (!($conn instanceof mysqli)) { |
|
| 469 | + $conn = & $this->conn; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | return $conn->error; |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | public function getColumn($name, $dsq) |
| 521 | 521 | { |
| 522 | 522 | $col = array(); |
| 523 | - if (! ($dsq instanceof mysqli_result)) { |
|
| 523 | + if (!($dsq instanceof mysqli_result)) { |
|
| 524 | 524 | $dsq = $this->query($dsq); |
| 525 | 525 | } |
| 526 | 526 | if ($dsq) { |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | public function getColumnNames($dsq) |
| 540 | 540 | { |
| 541 | 541 | $names = array(); |
| 542 | - if (! ($dsq instanceof mysqli_result)) { |
|
| 542 | + if (!($dsq instanceof mysqli_result)) { |
|
| 543 | 543 | $dsq = $this->query($dsq); |
| 544 | 544 | } |
| 545 | 545 | if ($dsq) { |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | public function getValue($dsq) |
| 560 | 560 | { |
| 561 | 561 | $out = false; |
| 562 | - if (! ($dsq instanceof mysqli_result)) { |
|
| 562 | + if (!($dsq instanceof mysqli_result)) { |
|
| 563 | 563 | $dsq = $this->query($dsq); |
| 564 | 564 | } |
| 565 | 565 | if ($dsq) { |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | { |
| 579 | 579 | $metadata = array(); |
| 580 | 580 | if (!empty($table) && is_scalar($table)) { |
| 581 | - $sql = 'SHOW FIELDS FROM ' . $table; |
|
| 581 | + $sql = 'SHOW FIELDS FROM '.$table; |
|
| 582 | 582 | if ($ds = $this->query($sql)) { |
| 583 | 583 | while ($row = $this->getRow($ds)) { |
| 584 | 584 | $fieldName = $row['Field']; |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | $tableName = trim($tableName); |
| 658 | 658 | $dbase = trim($this->config['dbase'], '`'); |
| 659 | 659 | $prefix = $this->config['table_prefix']; |
| 660 | - if ((bool)$force === true) { |
|
| 660 | + if ((bool) $force === true) { |
|
| 661 | 661 | $result = "`{$dbase}`.`{$prefix}{$tableName}`"; |
| 662 | 662 | } elseif (strpos($tableName, '[+prefix+]') !== false) { |
| 663 | 663 | $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName); |
@@ -674,9 +674,9 @@ discard block |
||
| 674 | 674 | */ |
| 675 | 675 | public function optimize($table_name) |
| 676 | 676 | { |
| 677 | - $rs = $this->query('OPTIMIZE TABLE ' . $table_name); |
|
| 677 | + $rs = $this->query('OPTIMIZE TABLE '.$table_name); |
|
| 678 | 678 | if ($rs) { |
| 679 | - $rs = $this->query('ALTER TABLE ' . $table_name); |
|
| 679 | + $rs = $this->query('ALTER TABLE '.$table_name); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | return $rs; |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | */ |
| 689 | 689 | public function truncate($table_name) |
| 690 | 690 | { |
| 691 | - return $this->query('TRUNCATE ' . $table_name); |
|
| 691 | + return $this->query('TRUNCATE '.$table_name); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | $_ = array(); |
| 715 | 715 | foreach ($fields as $k => $v) { |
| 716 | 716 | if ($k !== $v) { |
| 717 | - $_[] = $v . ' as ' . $k; |
|
| 717 | + $_[] = $v.' as '.$k; |
|
| 718 | 718 | } else { |
| 719 | 719 | $_[] = $v; |
| 720 | 720 | } |
@@ -373,7 +373,8 @@ |
||
| 373 | 373 | * @return bool|mixed|mysqli_result |
| 374 | 374 | */ |
| 375 | 375 | public function save($fields, $table, $where = '') |
| 376 | - { // This is similar to "replace into table". |
|
| 376 | + { |
|
| 377 | +// This is similar to "replace into table". |
|
| 377 | 378 | |
| 378 | 379 | if ($where === '') { |
| 379 | 380 | $mode = 'insert'; |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | return true; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -if (!include_once(MODX_MANAGER_PATH . 'includes/extenders/phpass.class.inc.php')) { |
|
| 12 | +if (!include_once(MODX_MANAGER_PATH.'includes/extenders/phpass.class.inc.php')) { |
|
| 13 | 13 | return false; |
| 14 | 14 | } else { |
| 15 | 15 | $this->phpass = new PasswordHash; |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | * Time: 14:38 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if (!include_once MODX_MANAGER_PATH . 'includes/extenders/maketable.class.php') { |
|
| 8 | +if (!include_once MODX_MANAGER_PATH.'includes/extenders/maketable.class.php') { |
|
| 9 | 9 | return false; |
| 10 | 10 | } else { |
| 11 | 11 | $this->table = new MakeTable; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $this->portable_hashes = $portable_hashes; |
| 50 | 50 | |
| 51 | - $this->random_state = microtime() . uniqid(mt_rand(), true); |
|
| 51 | + $this->random_state = microtime().uniqid(mt_rand(), true); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $output = ''; |
| 69 | 69 | for ($i = 0; $i < $count; $i += 16) { |
| 70 | 70 | $this->random_state = |
| 71 | - md5(microtime() . $this->random_state); |
|
| 71 | + md5(microtime().$this->random_state); |
|
| 72 | 72 | $output .= |
| 73 | 73 | pack('H*', md5($this->random_state)); |
| 74 | 74 | } |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | // consequently in lower iteration counts and hashes that are |
| 161 | 161 | // quicker to crack (by non-PHP code). |
| 162 | 162 | |
| 163 | - $hash = md5($salt . $password, true); |
|
| 163 | + $hash = md5($salt.$password, true); |
|
| 164 | 164 | do { |
| 165 | - $hash = md5($hash . $password, true); |
|
| 165 | + $hash = md5($hash.$password, true); |
|
| 166 | 166 | } while (--$count); |
| 167 | 167 | |
| 168 | 168 | $output = substr($setting, 0, 12); |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | for ($i = 0; $i < $tablevel; $i++) { |
| 119 | 119 | $tabs .= "\t"; |
| 120 | 120 | } |
| 121 | - $listhtml = $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n"; |
|
| 121 | + $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n"; |
|
| 122 | 122 | foreach ($array as $key => $value) { |
| 123 | 123 | if (is_array($value)) { |
| 124 | - $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix, |
|
| 125 | - $type, $ordered, $tablevel + 2) . $tabs . "\t</li>\n"; |
|
| 124 | + $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix, |
|
| 125 | + $type, $ordered, $tablevel + 2).$tabs."\t</li>\n"; |
|
| 126 | 126 | } else { |
| 127 | - $listhtml .= $tabs . "\t<li>" . $value . "</li>\n"; |
|
| 127 | + $listhtml .= $tabs."\t<li>".$value."</li>\n"; |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n"; |
|
| 130 | + $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n"; |
|
| 131 | 131 | |
| 132 | 132 | return $listhtml; |
| 133 | 133 | } |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | $msg = addslashes($modx->db->escape($msg)); |
| 299 | 299 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
| 300 | 300 | $act = "__WebAlert();"; |
| 301 | - $fnc = "function __WebAlert(){" . substr($url, 11) . "};"; |
|
| 301 | + $fnc = "function __WebAlert(){".substr($url, 11)."};"; |
|
| 302 | 302 | } else { |
| 303 | - $act = ($url ? "window.location.href='" . addslashes($url) . "';" : ""); |
|
| 303 | + $act = ($url ? "window.location.href='".addslashes($url)."';" : ""); |
|
| 304 | 304 | } |
| 305 | 305 | $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
| 306 | 306 | if ($modx->isFrontend()) { |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | * @deprecated |
| 73 | 73 | * |
| 74 | 74 | * @param $rs |
| 75 | - * @return int|mixed |
|
| 75 | + * @return integer |
|
| 76 | 76 | */ |
| 77 | 77 | public function insertId($rs) |
| 78 | 78 | { |
@@ -177,7 +177,8 @@ |
||
| 177 | 177 | * @return bool|string |
| 178 | 178 | */ |
| 179 | 179 | public function putChunk($chunkName) |
| 180 | - { // alias name >.< |
|
| 180 | + { |
|
| 181 | +// alias name >.< |
|
| 181 | 182 | $modx = evolutionCMS(); |
| 182 | 183 | |
| 183 | 184 | return $modx->getChunk($chunkName); |
@@ -9,6 +9,6 @@ |
||
| 9 | 9 | return true; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -include_once(MODX_MANAGER_PATH . 'includes/extenders/modifiers.class.inc.php'); |
|
| 12 | +include_once(MODX_MANAGER_PATH.'includes/extenders/modifiers.class.inc.php'); |
|
| 13 | 13 | $this->filter = new MODIFIERS; |
| 14 | 14 | return true; |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | * Time: 14:16 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if (!include_once MODX_MANAGER_PATH . 'includes/extenders/manager.api.class.inc.php') { |
|
| 8 | +if (!include_once MODX_MANAGER_PATH.'includes/extenders/manager.api.class.inc.php') { |
|
| 9 | 9 | return false; |
| 10 | 10 | } else { |
| 11 | 11 | $this->manager = new ManagerAPI; |