@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | $relModel = $relations[$colInfo['colParams']['relation']]['model']; |
| 208 | 208 | $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel; |
| 209 | 209 | if ($manageHref) { |
| 210 | - $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано'; |
|
| 210 | + $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relModel)."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано'; |
|
| 211 | 211 | } else { |
| 212 | 212 | $value = $relValue ? $relValue->name() : 'Не задано'; |
| 213 | 213 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | case 'image': |
| 218 | 218 | $file = Files\File::get($item->$colName); |
| 219 | 219 | if ($file) { |
| 220 | - $value = '<img src="' . $file->path . '?resize=60x120" />'; |
|
| 220 | + $value = '<img src="'.$file->path.'?resize=60x120" />'; |
|
| 221 | 221 | } else { |
| 222 | 222 | $value = '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
| 223 | 223 | } |
@@ -286,12 +286,12 @@ discard block |
||
| 286 | 286 | return; |
| 287 | 287 | } |
| 288 | 288 | if (!is_array($array)) { |
| 289 | - if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) { |
|
| 289 | + if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) { |
|
| 290 | 290 | static::createCol($array); |
| 291 | 291 | $cols = static::cols(true); |
| 292 | 292 | } |
| 293 | - if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) { |
|
| 294 | - $array = static::colPrefix() . $array; |
|
| 293 | + if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) { |
|
| 294 | + $array = static::colPrefix().$array; |
|
| 295 | 295 | } else { |
| 296 | 296 | static::checkForJoin($array, $rootModel); |
| 297 | 297 | } |
@@ -300,14 +300,14 @@ discard block |
||
| 300 | 300 | switch ($searchtype) { |
| 301 | 301 | case 'key': |
| 302 | 302 | foreach ($array as $key => $item) { |
| 303 | - if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) { |
|
| 303 | + if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) { |
|
| 304 | 304 | static::createCol($key); |
| 305 | 305 | $cols = static::cols(true); |
| 306 | 306 | } |
| 307 | - if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) { |
|
| 308 | - $array[static::colPrefix() . $key] = $item; |
|
| 307 | + if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) { |
|
| 308 | + $array[static::colPrefix().$key] = $item; |
|
| 309 | 309 | unset($array[$key]); |
| 310 | - $key = static::colPrefix() . $key; |
|
| 310 | + $key = static::colPrefix().$key; |
|
| 311 | 311 | } |
| 312 | 312 | if (is_array($array[$key])) { |
| 313 | 313 | static::fixPrefix($array[$key], 'key', $rootModel); |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | break; |
| 319 | 319 | case 'first': |
| 320 | 320 | if (isset($array[0]) && is_string($array[0])) { |
| 321 | - if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) { |
|
| 321 | + if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) { |
|
| 322 | 322 | static::createCol($array[0]); |
| 323 | 323 | $cols = static::cols(true); |
| 324 | 324 | } |
| 325 | - if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) { |
|
| 326 | - $array[0] = static::colPrefix() . $array[0]; |
|
| 325 | + if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) { |
|
| 326 | + $array[0] = static::colPrefix().$array[0]; |
|
| 327 | 327 | } else { |
| 328 | 328 | static::checkForJoin($array[0], $rootModel); |
| 329 | 329 | } |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | case 'to': |
| 356 | 356 | $relCol = $relations[$rel]['col']; |
| 357 | 357 | static::fixPrefix($relCol); |
| 358 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
| 358 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
| 359 | 359 | break; |
| 360 | 360 | case 'one': |
| 361 | 361 | case 'many': |
| 362 | 362 | $relCol = $relations[$rel]['col']; |
| 363 | 363 | $relations[$rel]['model']::fixPrefix($relCol); |
| 364 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
| 364 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
| 365 | 365 | break; |
| 366 | 366 | } |
| 367 | 367 | $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel); |
@@ -400,13 +400,13 @@ discard block |
||
| 400 | 400 | $relCol = $relations[$rel]['col']; |
| 401 | 401 | static::fixPrefix($relCol); |
| 402 | 402 | //$info['modelName'] = $relations[$rel]['model']; |
| 403 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
| 403 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
| 404 | 404 | break; |
| 405 | 405 | case 'one': |
| 406 | 406 | $relCol = $relations[$rel]['col']; |
| 407 | 407 | $relations[$rel]['model']::fixPrefix($relCol); |
| 408 | 408 | //$info['modelName'] = $relations[$rel]['model']; |
| 409 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
| 409 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
| 410 | 410 | break; |
| 411 | 411 | } |
| 412 | 412 | $info = $relations[$rel]['model']::parseColRecursion($info); |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | } else { |
| 425 | 425 | $info['colParams'] = []; |
| 426 | 426 | } |
| 427 | - if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) { |
|
| 428 | - $info['col'] = static::colPrefix() . $info['col']; |
|
| 427 | + if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) { |
|
| 428 | + $info['col'] = static::colPrefix().$info['col']; |
|
| 429 | 429 | } |
| 430 | 430 | $info['modelName'] = get_called_class(); |
| 431 | 431 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if ($params === false) { |
| 529 | 529 | return false; |
| 530 | 530 | } |
| 531 | - return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params); |
|
| 531 | + return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | public static function createTable() { |
@@ -557,28 +557,28 @@ discard block |
||
| 557 | 557 | return true; |
| 558 | 558 | } |
| 559 | 559 | $cols = [ |
| 560 | - $colPrefix . 'id' => 'pk' |
|
| 560 | + $colPrefix.'id' => 'pk' |
|
| 561 | 561 | ]; |
| 562 | 562 | $className = get_called_class(); |
| 563 | 563 | if (!empty($className::$cols)) { |
| 564 | 564 | foreach ($className::$cols as $colName => $colParams) { |
| 565 | 565 | if ($colName == 'date_create') { |
| 566 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 566 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 567 | 567 | continue; |
| 568 | 568 | } |
| 569 | 569 | $params = $className::genColParams($colName); |
| 570 | 570 | if ($params) { |
| 571 | - $cols[$colPrefix . $colName] = $params; |
|
| 571 | + $cols[$colPrefix.$colName] = $params; |
|
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | - if (empty($cols[$colPrefix . 'date_create'])) { |
|
| 576 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 575 | + if (empty($cols[$colPrefix.'date_create'])) { |
|
| 576 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 577 | 577 | } |
| 578 | 578 | $tableIndexes = []; |
| 579 | 579 | if ($indexes) { |
| 580 | 580 | foreach ($indexes as $indexName => $index) { |
| 581 | - $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')'; |
|
| 581 | + $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')'; |
|
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | */ |
| 603 | 603 | public static function index() { |
| 604 | 604 | |
| 605 | - return static::colPrefix() . 'id'; |
|
| 605 | + return static::colPrefix().'id'; |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | /** |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | public static function colPrefix() { |
| 614 | 614 | $classPath = explode('\\', get_called_class()); |
| 615 | 615 | $classPath = array_slice($classPath, 1); |
| 616 | - return strtolower(implode('_', $classPath)) . '_'; |
|
| 616 | + return strtolower(implode('_', $classPath)).'_'; |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | /** |
@@ -674,12 +674,12 @@ discard block |
||
| 674 | 674 | case 'to': |
| 675 | 675 | $relCol = $relations[$rel]['col']; |
| 676 | 676 | static::fixPrefix($relCol); |
| 677 | - App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
| 677 | + App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
| 678 | 678 | break; |
| 679 | 679 | case 'one': |
| 680 | 680 | $col = $relations[$rel]['col']; |
| 681 | 681 | $relations[$rel]['model']::fixPrefix($col); |
| 682 | - App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
| 682 | + App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
| 683 | 683 | break; |
| 684 | 684 | } |
| 685 | 685 | } |
@@ -694,8 +694,8 @@ discard block |
||
| 694 | 694 | } |
| 695 | 695 | if ($param !== null) { |
| 696 | 696 | $cols = static::cols(); |
| 697 | - if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) { |
|
| 698 | - $col = static::colPrefix() . $col; |
|
| 697 | + if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) { |
|
| 698 | + $col = static::colPrefix().$col; |
|
| 699 | 699 | } |
| 700 | 700 | App::$cur->db->where($col, $param); |
| 701 | 701 | } else { |
@@ -759,12 +759,12 @@ discard block |
||
| 759 | 759 | case 'to': |
| 760 | 760 | $relCol = $relations[$rel]['col']; |
| 761 | 761 | static::fixPrefix($relCol); |
| 762 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
| 762 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
| 763 | 763 | break; |
| 764 | 764 | case 'one': |
| 765 | 765 | $col = $relations[$rel]['col']; |
| 766 | 766 | $relations[$rel]['model']::fixPrefix($col); |
| 767 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
| 767 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
| 768 | 768 | break; |
| 769 | 769 | } |
| 770 | 770 | } |
@@ -1078,12 +1078,12 @@ discard block |
||
| 1078 | 1078 | case 'to': |
| 1079 | 1079 | $relCol = $relations[$rel]['col']; |
| 1080 | 1080 | static::fixPrefix($relCol); |
| 1081 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
| 1081 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
| 1082 | 1082 | break; |
| 1083 | 1083 | case 'one': |
| 1084 | 1084 | $col = $relations[$rel]['col']; |
| 1085 | 1085 | $relations[$rel]['model']::fixPrefix($col); |
| 1086 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
| 1086 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
| 1087 | 1087 | break; |
| 1088 | 1088 | } |
| 1089 | 1089 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | } else { |
| 1101 | 1101 | $cols .= '*'; |
| 1102 | 1102 | } |
| 1103 | - $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : ''); |
|
| 1103 | + $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : ''); |
|
| 1104 | 1104 | $query->cols = $cols; |
| 1105 | 1105 | if (!empty($options['group'])) { |
| 1106 | 1106 | $query->group($options['group']); |
@@ -1233,25 +1233,25 @@ discard block |
||
| 1233 | 1233 | $itemModel = $class::$treeCategory; |
| 1234 | 1234 | $oldPath = $this->tree_path; |
| 1235 | 1235 | $this->tree_path = $this->getCatalogTree($this); |
| 1236 | - $itemsTable = \App::$cur->db->table_prefix . $itemModel::table(); |
|
| 1237 | - $itemTreeCol = $itemModel::colPrefix() . 'tree_path'; |
|
| 1236 | + $itemsTable = \App::$cur->db->table_prefix.$itemModel::table(); |
|
| 1237 | + $itemTreeCol = $itemModel::colPrefix().'tree_path'; |
|
| 1238 | 1238 | |
| 1239 | - $categoryTreeCol = $this->colPrefix() . 'tree_path'; |
|
| 1240 | - $categoryTable = \App::$cur->db->table_prefix . $this->table(); |
|
| 1239 | + $categoryTreeCol = $this->colPrefix().'tree_path'; |
|
| 1240 | + $categoryTable = \App::$cur->db->table_prefix.$this->table(); |
|
| 1241 | 1241 | if ($oldPath) { |
| 1242 | 1242 | \App::$cur->db->query('UPDATE |
| 1243 | - ' . $categoryTable . ' |
|
| 1243 | + ' . $categoryTable.' |
|
| 1244 | 1244 | SET |
| 1245 | - ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
| 1246 | - WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
| 1245 | + ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
| 1246 | + WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
| 1247 | 1247 | |
| 1248 | 1248 | \App::$cur->db->query('UPDATE |
| 1249 | - ' . $itemsTable . ' |
|
| 1249 | + ' . $itemsTable.' |
|
| 1250 | 1250 | SET |
| 1251 | - ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
| 1252 | - WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
| 1251 | + ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
| 1252 | + WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
| 1253 | 1253 | } |
| 1254 | - $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]); |
|
| 1254 | + $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | /** |
@@ -1265,9 +1265,9 @@ discard block |
||
| 1265 | 1265 | $catalogParent = $catalogClass::get($catalog->parent_id); |
| 1266 | 1266 | if ($catalog && $catalogParent) { |
| 1267 | 1267 | if ($catalogParent->tree_path) { |
| 1268 | - return $catalogParent->tree_path . $catalogParent->id . '/'; |
|
| 1268 | + return $catalogParent->tree_path.$catalogParent->id.'/'; |
|
| 1269 | 1269 | } else { |
| 1270 | - return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/'; |
|
| 1270 | + return $this->getCatalogTree($catalogParent).$catalogParent->id.'/'; |
|
| 1271 | 1271 | } |
| 1272 | 1272 | } |
| 1273 | 1273 | return '/'; |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | $categoryModel = $class::$categoryModel; |
| 1282 | 1282 | $category = $categoryModel::get($this->{$categoryModel::index()}); |
| 1283 | 1283 | if ($category) { |
| 1284 | - $this->tree_path = $category->tree_path . $category->pk() . '/'; |
|
| 1284 | + $this->tree_path = $category->tree_path.$category->pk().'/'; |
|
| 1285 | 1285 | } else { |
| 1286 | 1286 | $this->tree_path = '/'; |
| 1287 | 1287 | } |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | $this->changeCategoryTree(); |
| 1307 | 1307 | } |
| 1308 | 1308 | if (!empty($this->_changedParams) && $this->pk()) { |
| 1309 | - Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this); |
|
| 1309 | + Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this); |
|
| 1310 | 1310 | } |
| 1311 | 1311 | $this->beforeSave(); |
| 1312 | 1312 | |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | } |
| 1352 | 1352 | $this->_params = $result->fetch(); |
| 1353 | 1353 | if ($new) { |
| 1354 | - Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this); |
|
| 1354 | + Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | $this->afterSave(); |
| 1357 | 1357 | return $this->{$this->index()}; |
@@ -1489,7 +1489,7 @@ discard block |
||
| 1489 | 1489 | static::fixPrefix($params); |
| 1490 | 1490 | $className = get_called_class(); |
| 1491 | 1491 | foreach ($params as $paramName => $value) { |
| 1492 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName); |
|
| 1492 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName); |
|
| 1493 | 1493 | if (!empty($className::$cols[$shortName])) { |
| 1494 | 1494 | switch ($className::$cols[$shortName]['type']) { |
| 1495 | 1495 | case 'decimal': |
@@ -1757,7 +1757,7 @@ discard block |
||
| 1757 | 1757 | public function __set($name, $value) { |
| 1758 | 1758 | static::fixPrefix($name); |
| 1759 | 1759 | $className = get_called_class(); |
| 1760 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name); |
|
| 1760 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name); |
|
| 1761 | 1761 | if (!empty($className::$cols[$shortName])) { |
| 1762 | 1762 | switch ($className::$cols[$shortName]['type']) { |
| 1763 | 1763 | case 'decimal': |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | $newValue = ''; |
| 187 | 187 | foreach ($value as $item) { |
| 188 | 188 | if ($newValue) { |
| 189 | - $newValue.=','; |
|
| 189 | + $newValue .= ','; |
|
| 190 | 190 | } |
| 191 | 191 | if (is_string($item)) { |
| 192 | - $newValue .='"' . $item . '"'; |
|
| 192 | + $newValue .= '"'.$item.'"'; |
|
| 193 | 193 | } else { |
| 194 | - $newValue .=$item; |
|
| 194 | + $newValue .= $item; |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | - $value = '(' . $newValue . ')'; |
|
| 197 | + $value = '('.$newValue.')'; |
|
| 198 | 198 | } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) { |
| 199 | 199 | $value = "({$value})"; |
| 200 | 200 | } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) { |
@@ -270,15 +270,15 @@ discard block |
||
| 270 | 270 | $newValue = ''; |
| 271 | 271 | foreach ($value as $item) { |
| 272 | 272 | if ($newValue) { |
| 273 | - $newValue.=','; |
|
| 273 | + $newValue .= ','; |
|
| 274 | 274 | } |
| 275 | 275 | if (is_string($item)) { |
| 276 | - $newValue .='"' . $item . '"'; |
|
| 276 | + $newValue .= '"'.$item.'"'; |
|
| 277 | 277 | } else { |
| 278 | - $newValue .=$item; |
|
| 278 | + $newValue .= $item; |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | - $value = '(' . $newValue . ')'; |
|
| 281 | + $value = '('.$newValue.')'; |
|
| 282 | 282 | } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) { |
| 283 | 283 | $value = "({$value})"; |
| 284 | 284 | } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) { |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | switch ($this->operation) { |
| 336 | 336 | case 'SELECT': |
| 337 | - $query .= ' ' . ($this->distinct ? 'DISTINCT' : ''); |
|
| 338 | - $query .= ' ' . (!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols))); |
|
| 337 | + $query .= ' '.($this->distinct ? 'DISTINCT' : ''); |
|
| 338 | + $query .= ' '.(!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols))); |
|
| 339 | 339 | case 'DELETE': |
| 340 | 340 | $query .= ' FROM'; |
| 341 | 341 | break; |
@@ -352,9 +352,9 @@ discard block |
||
| 352 | 352 | $this->params = array_merge($this->params, array_values($this->cols)); |
| 353 | 353 | $colsStr = ''; |
| 354 | 354 | if ($this->cols) { |
| 355 | - $colsStr = '`' . implode('`,`', array_keys($this->cols)) . '`'; |
|
| 355 | + $colsStr = '`'.implode('`,`', array_keys($this->cols)).'`'; |
|
| 356 | 356 | } |
| 357 | - $query .= ' (' . $colsStr . ') VALUES (' . rtrim(str_repeat('?,', count($this->cols)), ',') . ')'; |
|
| 357 | + $query .= ' ('.$colsStr.') VALUES ('.rtrim(str_repeat('?,', count($this->cols)), ',').')'; |
|
| 358 | 358 | break; |
| 359 | 359 | case 'CREATE TABLE': |
| 360 | 360 | $query .= " ("; |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | $query = rtrim($query, ','); |
| 368 | 368 | if ($this->indexes) { |
| 369 | - $query .= ', ' . implode(',', $this->indexes); |
|
| 369 | + $query .= ', '.implode(',', $this->indexes); |
|
| 370 | 370 | } |
| 371 | 371 | $query .= ") ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"; |
| 372 | 372 | break; |
@@ -381,27 +381,27 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | $update = implode(',', $updates); |
| 384 | - $query .=" SET {$update}"; |
|
| 384 | + $query .= " SET {$update}"; |
|
| 385 | 385 | case 'SELECT': |
| 386 | 386 | case 'DELETE': |
| 387 | 387 | $this->buildWhere($this->where); |
| 388 | 388 | if ($this->whereString) { |
| 389 | - $query .= ' ' . $this->whereString; |
|
| 389 | + $query .= ' '.$this->whereString; |
|
| 390 | 390 | } |
| 391 | 391 | break; |
| 392 | 392 | } |
| 393 | 393 | if ($this->group) { |
| 394 | - $query .= ' GROUP BY ' . implode(',', $this->group); |
|
| 394 | + $query .= ' GROUP BY '.implode(',', $this->group); |
|
| 395 | 395 | } |
| 396 | 396 | $this->buildHaving($this->having); |
| 397 | 397 | if ($this->havingString) { |
| 398 | - $query .= ' ' . $this->havingString; |
|
| 398 | + $query .= ' '.$this->havingString; |
|
| 399 | 399 | } |
| 400 | 400 | if ($this->order) { |
| 401 | - $query .= ' ORDER BY ' . implode(',', $this->order); |
|
| 401 | + $query .= ' ORDER BY '.implode(',', $this->order); |
|
| 402 | 402 | } |
| 403 | 403 | if ($this->limit) { |
| 404 | - $query .= ' ' . $this->limit; |
|
| 404 | + $query .= ' '.$this->limit; |
|
| 405 | 405 | } |
| 406 | 406 | return ['query' => $query, 'params' => $this->params]; |
| 407 | 407 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | echo $label !== false ? "<label>{$label}</label>" : ''; |
| 5 | 5 | $attributes = [ |
| 6 | 6 | 'name' => $name, |
| 7 | - 'class' => "form-control " . (!empty($options['class']) ? $options['class'] : '') |
|
| 7 | + 'class' => "form-control ".(!empty($options['class']) ? $options['class'] : '') |
|
| 8 | 8 | ]; |
| 9 | 9 | if (!empty($options['required'])) { |
| 10 | 10 | $attributes['required'] = 'required'; |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | echo $col['col']['label']; |
| 25 | 25 | if (!empty($col['col']['model'])) { |
| 26 | 26 | $modelName = $col['col']['model']; |
| 27 | - $onclick = 'inji.Ui.forms.popUp(\'' . addslashes($modelName) . '\',{},function(elem){' |
|
| 27 | + $onclick = 'inji.Ui.forms.popUp(\''.addslashes($modelName).'\',{},function(elem){' |
|
| 28 | 28 | . 'return function(data,modal){inji.Ui.forms.submitAjax($(elem).closest(\'form\')[0], {notSave: true});}}(this));return false;'; |
| 29 | - echo ' (<a href="" onclick="' . $onclick . ';this.disabled=true;return false;">Создать</a>)'; |
|
| 29 | + echo ' (<a href="" onclick="'.$onclick.';this.disabled=true;return false;">Создать</a>)'; |
|
| 30 | 30 | } |
| 31 | 31 | echo "</th>"; |
| 32 | 32 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $input->options['noContainer'] = true; |
| 49 | 49 | $input->colParams['label'] = false; |
| 50 | 50 | $input->colParams['value'] = $row[$colName]; |
| 51 | - $input->colName .= '[' . $colName . '][' . ($i) . ']'; |
|
| 51 | + $input->colName .= '['.$colName.']['.($i).']'; |
|
| 52 | 52 | $input->draw(); |
| 53 | 53 | if (empty($col['hidden'])) { |
| 54 | 54 | echo '</td>'; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | $col['input']->options['noContainer'] = true; |
| 89 | 89 | $col['input']->colParams['label'] = false; |
| 90 | - $col['input']->colName.="[{$colName}][]"; |
|
| 90 | + $col['input']->colName .= "[{$colName}][]"; |
|
| 91 | 91 | $col['input']->draw(); |
| 92 | 92 | if (empty($col['hidden'])) { |
| 93 | 93 | echo '</td>'; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | $str = "<div class = 'fastEdit' "; |
| 19 | 19 | if ($object) { |
| 20 | - $str .= "data-model='" . get_class($object) . "' data-col='{$col}' data-key='" . $object->pk() . "'"; |
|
| 20 | + $str .= "data-model='".get_class($object)."' data-col='{$col}' data-key='".$object->pk()."'"; |
|
| 21 | 21 | } |
| 22 | 22 | $str .= ">"; |
| 23 | 23 | $value = $value !== null ? $value : ($object ? $object->$col : ''); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function colName() { |
| 86 | - return "{$this->activeForm->requestFormName}[{$this->activeForm->modelName}]" . (stristr($this->colName, '[') ? $this->colName : "[{$this->colName}]"); |
|
| 86 | + return "{$this->activeForm->requestFormName}[{$this->activeForm->modelName}]".(stristr($this->colName, '[') ? $this->colName : "[{$this->colName}]"); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function colLabel() { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | public function validate(&$request) { |
| 99 | 99 | if (empty($request[$this->colName]) && !empty($this->colParams['required'])) { |
| 100 | - throw new \Exception('Вы не заполнили: ' . $this->colLabel()); |
|
| 100 | + throw new \Exception('Вы не заполнили: '.$this->colLabel()); |
|
| 101 | 101 | } |
| 102 | 102 | if (!empty($this->colParams['validator'])) { |
| 103 | 103 | $modelName = $this->modelName; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | switch ($this->colParams['source']) { |
| 123 | 123 | case'options': |
| 124 | 124 | foreach ($this->colParams['options']['inputs'] as $colName => $col) { |
| 125 | - $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($col['type']); |
|
| 125 | + $inputClassName = '\Ui\ActiveForm\Input\\'.ucfirst($col['type']); |
|
| 126 | 126 | $input = new $inputClassName(); |
| 127 | 127 | $input->form = $this->form; |
| 128 | 128 | $input->activeForm = $this->activeForm; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $cols['id'] = ['input' => $input, 'hidden' => true]; |
| 162 | 162 | foreach ($this->colParams['options']['cols'] as $colName) { |
| 163 | 163 | $col = $relation['model']::getColInfo($colName); |
| 164 | - $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($col['colParams']['type']); |
|
| 164 | + $inputClassName = '\Ui\ActiveForm\Input\\'.ucfirst($col['colParams']['type']); |
|
| 165 | 165 | $input = new $inputClassName(); |
| 166 | 166 | $input->form = $this->form; |
| 167 | 167 | $input->activeForm = $this->activeForm; |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | * |
| 39 | 39 | */ |
| 40 | - if (filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_session_hash') && filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_id')) { |
|
| 41 | - return $this->cuntinueSession(filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_session_hash'), filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_id')); |
|
| 40 | + if (filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_session_hash') && filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_id')) { |
|
| 41 | + return $this->cuntinueSession(filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_session_hash'), filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_id')); |
|
| 42 | 42 | } |
| 43 | 43 | if (isset($_POST['autorization']) && trim(filter_input(INPUT_POST, 'user_login')) && trim(filter_input(INPUT_POST, 'user_pass'))) { |
| 44 | 44 | unset($_POST['autorization']); |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function logOut($redirect = true) { |
| 56 | - if (!empty($_COOKIE[$this->cookiePrefix . "_user_session_hash"]) && !empty($_COOKIE[$this->cookiePrefix . "_user_id"])) { |
|
| 56 | + if (!empty($_COOKIE[$this->cookiePrefix."_user_session_hash"]) && !empty($_COOKIE[$this->cookiePrefix."_user_id"])) { |
|
| 57 | 57 | $session = Users\Session::get([ |
| 58 | - ['user_id', $_COOKIE[$this->cookiePrefix . "_user_id"]], |
|
| 59 | - ['hash', $_COOKIE[$this->cookiePrefix . "_user_session_hash"]] |
|
| 58 | + ['user_id', $_COOKIE[$this->cookiePrefix."_user_id"]], |
|
| 59 | + ['hash', $_COOKIE[$this->cookiePrefix."_user_session_hash"]] |
|
| 60 | 60 | ]); |
| 61 | 61 | if ($session) { |
| 62 | 62 | $session->delete(); |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | if (!headers_sent()) { |
| 66 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
| 67 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
| 66 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
| 67 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
| 68 | 68 | } |
| 69 | 69 | if ($redirect) { |
| 70 | 70 | if (!empty($this->config['logoutUrl'][$this->app->type])) { |
@@ -81,25 +81,25 @@ discard block |
||
| 81 | 81 | ]); |
| 82 | 82 | if ($session && $session->user && $session->user->blocked) { |
| 83 | 83 | if (!headers_sent()) { |
| 84 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
| 85 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
| 84 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
| 85 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
| 86 | 86 | } |
| 87 | 87 | Msg::add('Ваш аккаунт заблокирован', 'info'); |
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | if ($session && $session->user && !$session->user->blocked) { |
| 91 | 91 | if (!headers_sent()) { |
| 92 | - setcookie($this->cookiePrefix . "_user_session_hash", $session->hash, time() + 360000, "/"); |
|
| 93 | - setcookie($this->cookiePrefix . "_user_id", $session->user_id, time() + 360000, "/"); |
|
| 92 | + setcookie($this->cookiePrefix."_user_session_hash", $session->hash, time() + 360000, "/"); |
|
| 93 | + setcookie($this->cookiePrefix."_user_id", $session->user_id, time() + 360000, "/"); |
|
| 94 | 94 | } |
| 95 | 95 | if (!empty($this->config['needActivation']) && $session->user->activation) { |
| 96 | 96 | if (!headers_sent()) { |
| 97 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
| 98 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
| 97 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
| 98 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
| 99 | 99 | } |
| 100 | - Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $session->user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
| 100 | + Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$session->user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
| 101 | 101 | } elseif ($session->user->activation) { |
| 102 | - Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $session->user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
| 102 | + Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$session->user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
| 103 | 103 | } |
| 104 | 104 | if (!$session->user->mail && !empty($this->config['noMailNotify'])) { |
| 105 | 105 | Msg::add($this->config['noMailNotify']); |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | Users\User::$cur->save(); |
| 110 | 110 | } else { |
| 111 | 111 | if (!headers_sent()) { |
| 112 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
| 113 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
| 112 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
| 113 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
| 114 | 114 | } |
| 115 | 115 | Msg::add('Ваша сессия устарела или более недействительна, вам необходимо пройти <a href = "/users/login">авторизацию</a> заново', 'info'); |
| 116 | 116 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function passre($user_mail) { |
| 120 | 120 | $user = $this->get($user_mail, 'mail'); |
| 121 | 121 | if (!$user) { |
| 122 | - Msg::add('Пользователь ' . $user_mail . ' не найден, проверьте првильность ввода e-mail или зарегистрируйтесь', 'danger'); |
|
| 122 | + Msg::add('Пользователь '.$user_mail.' не найден, проверьте првильность ввода e-mail или зарегистрируйтесь', 'danger'); |
|
| 123 | 123 | return false; |
| 124 | 124 | } |
| 125 | 125 | $passre = Users\Passre::get([['user_id', $user->id], ['status', 1]]); |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | $passre->status = 2; |
| 128 | 128 | $passre->save(); |
| 129 | 129 | } |
| 130 | - $hash = $user->id . '_' . Tools::randomString(50); |
|
| 130 | + $hash = $user->id.'_'.Tools::randomString(50); |
|
| 131 | 131 | $passre = new Users\Passre(['user_id' => $user->id, 'status' => 1, 'hash' => $hash]); |
| 132 | 132 | $passre->save(); |
| 133 | - Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, $user_mail, 'Восстановление пароля на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для продолжения восстановления пароля перейдите по ссылке: <a href = "http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/?passrecont=1&hash=' . $hash . '">' . idn_to_utf8(INJI_DOMAIN_NAME) . '/?passrecont=1&hash=' . $hash . '</a>'); |
|
| 133 | + Tools::sendMail('noreply@'.INJI_DOMAIN_NAME, $user_mail, 'Восстановление пароля на сайте '.idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для продолжения восстановления пароля перейдите по ссылке: <a href = "http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/?passrecont=1&hash='.$hash.'">'.idn_to_utf8(INJI_DOMAIN_NAME).'/?passrecont=1&hash='.$hash.'</a>'); |
|
| 134 | 134 | Tools::redirect('/', 'На указанный почтовый ящик была выслана инструкция по восстановлению пароля', 'success'); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $user->pass = $this->hashpass($pass); |
| 148 | 148 | $user->save(); |
| 149 | 149 | $this->autorization($user->mail, $user->pass, 'mail'); |
| 150 | - Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, $user->mail, 'Новый пароль на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />Ваш новый пароль: ' . $pass); |
|
| 150 | + Tools::sendMail('noreply@'.INJI_DOMAIN_NAME, $user->mail, 'Новый пароль на сайте '.idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />Ваш новый пароль: '.$pass); |
|
| 151 | 151 | Tools::redirect('/', 'На указанный почтовый ящик был выслан новый пароль', 'success'); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | $user = $this->get($login, $ltype); |
| 160 | 160 | if ($user && $this->verifypass($pass, $user->pass) && !$user->blocked) { |
| 161 | 161 | if (!empty($this->config['needActivation']) && $user->activation) { |
| 162 | - Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
| 162 | + Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
| 163 | 163 | } elseif ($user->activation) { |
| 164 | - Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
| 164 | + Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
| 165 | 165 | } |
| 166 | 166 | if (!$user->mail && !empty($this->config['noMailNotify'])) { |
| 167 | 167 | Msg::add($this->config['noMailNotify']); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | if ($user && $user->blocked) { |
| 181 | 181 | Msg::add('Вы заблокированы', 'danger'); |
| 182 | 182 | } elseif ($user) { |
| 183 | - Msg::add('Вы ошиблись при наборе пароля или логина, попробуйте ещё раз или воспользуйтесь <a href = "?passre=1&user_mail=' . $user->mail . '">Восстановлением пароля</a>', 'danger'); |
|
| 183 | + Msg::add('Вы ошиблись при наборе пароля или логина, попробуйте ещё раз или воспользуйтесь <a href = "?passre=1&user_mail='.$user->mail.'">Восстановлением пароля</a>', 'danger'); |
|
| 184 | 184 | } else { |
| 185 | 185 | Msg::add('Данный почтовый ящик не зарегистрирован в системе', 'danger'); |
| 186 | 186 | } |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | $session->save(); |
| 203 | 203 | |
| 204 | 204 | if (!headers_sent()) { |
| 205 | - setcookie($this->cookiePrefix . "_user_session_hash", $session->hash, time() + 360000, "/"); |
|
| 206 | - setcookie($this->cookiePrefix . "_user_id", $session->user_id, time() + 360000, "/"); |
|
| 205 | + setcookie($this->cookiePrefix."_user_session_hash", $session->hash, time() + 360000, "/"); |
|
| 206 | + setcookie($this->cookiePrefix."_user_id", $session->user_id, time() + 360000, "/"); |
|
| 207 | 207 | } else { |
| 208 | 208 | Msg::add('Не удалось провести авторизацию. Попробуйте позже', 'info'); |
| 209 | 209 | } |
@@ -346,20 +346,20 @@ discard block |
||
| 346 | 346 | $this->autorization($data['user_mail'], $pass, 'mail'); |
| 347 | 347 | } |
| 348 | 348 | if (!empty($this->config['needActivation'])) { |
| 349 | - $from = 'noreply@' . INJI_DOMAIN_NAME; |
|
| 349 | + $from = 'noreply@'.INJI_DOMAIN_NAME; |
|
| 350 | 350 | $to = $data['user_mail']; |
| 351 | - $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
| 352 | - $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass; |
|
| 353 | - $text .='<br />'; |
|
| 351 | + $subject = 'Регистрация на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
| 352 | + $text = 'Вы были зарегистрированы на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: '.$pass; |
|
| 354 | 353 | $text .= '<br />'; |
| 355 | - $text .= 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://' . INJI_DOMAIN_NAME . '/users/activation/' . $user->id . '/' . $user->activation . '">http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/users/activation/' . $user->id . '/' . $user->activation . '</a>'; |
|
| 354 | + $text .= '<br />'; |
|
| 355 | + $text .= 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://'.INJI_DOMAIN_NAME.'/users/activation/'.$user->id.'/'.$user->activation.'">http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/users/activation/'.$user->id.'/'.$user->activation.'</a>'; |
|
| 356 | 356 | Tools::sendMail($from, $to, $subject, $text); |
| 357 | 357 | Msg::add('Вы были зарегистрированы. На указанный почтовый ящик был выслан ваш пароль и ссылка для активации', 'success'); |
| 358 | 358 | } else { |
| 359 | - $from = 'noreply@' . INJI_DOMAIN_NAME; |
|
| 359 | + $from = 'noreply@'.INJI_DOMAIN_NAME; |
|
| 360 | 360 | $to = $data['user_mail']; |
| 361 | - $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
| 362 | - $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass; |
|
| 361 | + $subject = 'Регистрация на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
| 362 | + $text = 'Вы были зарегистрированы на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: '.$pass; |
|
| 363 | 363 | Tools::sendMail($from, $to, $subject, $text); |
| 364 | 364 | Msg::add('Вы были зарегистрированы. На указанный почтовый ящик был выслан ваш пароль', 'success'); |
| 365 | 365 | } |
@@ -22,20 +22,20 @@ discard block |
||
| 22 | 22 | 'scope' => 'email', |
| 23 | 23 | 'response_type' => 'code', |
| 24 | 24 | 'display' => 'page', |
| 25 | - 'redirect_uri' => 'http://' . INJI_DOMAIN_NAME . '/users/social/auth/vk' |
|
| 25 | + 'redirect_uri' => 'http://'.INJI_DOMAIN_NAME.'/users/social/auth/vk' |
|
| 26 | 26 | ]; |
| 27 | - \Tools::redirect("https://oauth.vk.com/authorize?" . http_build_query($query)); |
|
| 27 | + \Tools::redirect("https://oauth.vk.com/authorize?".http_build_query($query)); |
|
| 28 | 28 | } |
| 29 | 29 | if (empty($_GET['code']) && !empty($_GET['error'])) { |
| 30 | - \Tools::redirect('/', 'Произошла ошибка во время авторизации через соц. сеть: ' . $_GET['error_description']); |
|
| 30 | + \Tools::redirect('/', 'Произошла ошибка во время авторизации через соц. сеть: '.$_GET['error_description']); |
|
| 31 | 31 | } |
| 32 | 32 | $query = [ |
| 33 | 33 | 'client_id' => $config['appId'], |
| 34 | 34 | 'client_secret' => $config['secret'], |
| 35 | 35 | 'code' => $_GET['code'], |
| 36 | - 'redirect_uri' => 'http://' . INJI_DOMAIN_NAME . '/users/social/auth/vk' |
|
| 36 | + 'redirect_uri' => 'http://'.INJI_DOMAIN_NAME.'/users/social/auth/vk' |
|
| 37 | 37 | ]; |
| 38 | - $result = @file_get_contents("https://oauth.vk.com/access_token?" . http_build_query($query)); |
|
| 38 | + $result = @file_get_contents("https://oauth.vk.com/access_token?".http_build_query($query)); |
|
| 39 | 39 | if ($result === false) { |
| 40 | 40 | \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger'); |
| 41 | 41 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'fields' => 'sex, bdate, photo_max_orig, home_town', |
| 49 | 49 | 'access_token' => $result['access_token'] |
| 50 | 50 | ]; |
| 51 | - $userResult = @file_get_contents("https://api.vk.com/method/users.get?" . http_build_query($userQuery)); |
|
| 51 | + $userResult = @file_get_contents("https://api.vk.com/method/users.get?".http_build_query($userQuery)); |
|
| 52 | 52 | if (!$userResult) { |
| 53 | 53 | \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger'); |
| 54 | 54 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $config = static::getConfig(); |
| 146 | 146 | |
| 147 | - $auth_key = md5($config['appId'] . '_' . $viewer_id . '_' . $config['secret']); |
|
| 147 | + $auth_key = md5($config['appId'].'_'.$viewer_id.'_'.$config['secret']); |
|
| 148 | 148 | |
| 149 | 149 | if ($auth_key !== $get_auth_key) { |
| 150 | 150 | return FALSE; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | 'fields' => 'photo_medium,nickname, domain, sex, bdate, city, country, timezone, photo_50, photo_100, photo_200_orig, has_mobile, contacts, education, online, relation, last_seen, status, can_write_private_message, can_see_all_posts, can_post, universities', |
| 155 | 155 | 'access_token' => filter_input(INPUT_GET, 'access_token', FILTER_SANITIZE_STRING) |
| 156 | 156 | ]; |
| 157 | - $userResult = json_decode(@file_get_contents("https://api.vk.com/method/users.get?" . http_build_query($userQuery)), true); |
|
| 157 | + $userResult = json_decode(@file_get_contents("https://api.vk.com/method/users.get?".http_build_query($userQuery)), true); |
|
| 158 | 158 | $object = static::getObject(); |
| 159 | 159 | |
| 160 | 160 | $socUser = \Users\User\Social::get([['social_id', $object->pk()], ['uid', $viewer_id]]); |