@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return function ($step = NULL, $params = []) { |
|
3 | +return function($step = NULL, $params = []) { |
|
4 | 4 | |
5 | 5 | $groups = [ |
6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return function ($step = NULL, $params = []) { |
|
3 | +return function($step = NULL, $params = []) { |
|
4 | 4 | |
5 | 5 | $groups = [ |
6 | 6 | [ |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | /** |
358 | 358 | * Information extractor for col relations path |
359 | 359 | * |
360 | - * @param string|array $info |
|
360 | + * @param string $info |
|
361 | 361 | * @return array |
362 | 362 | */ |
363 | 363 | public static function parseColRecursion($info) |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * Generate params string for col by name |
434 | 434 | * |
435 | 435 | * @param string $colName |
436 | - * @return boolean|string |
|
436 | + * @return false|string |
|
437 | 437 | */ |
438 | 438 | public static function genColParams($colName) |
439 | 439 | { |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * return relations list |
575 | 575 | * |
576 | - * @return array |
|
576 | + * @return string |
|
577 | 577 | */ |
578 | 578 | public static function relations() |
579 | 579 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * |
1066 | 1066 | * @param array $params |
1067 | 1067 | * @param array $where |
1068 | - * @return boolean |
|
1068 | + * @return false|null |
|
1069 | 1069 | */ |
1070 | 1070 | public static function update($params, $where = []) |
1071 | 1071 | { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $relModel = $relations[$colInfo['colParams']['relation']]['model']; |
212 | 212 | $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel; |
213 | 213 | if ($manageHref) { |
214 | - $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано'; |
|
214 | + $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relModel)."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано'; |
|
215 | 215 | } else { |
216 | 216 | $value = $relValue ? $relValue->name() : 'Не задано'; |
217 | 217 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | case 'image': |
222 | 222 | $file = Files\File::get($item->$colName); |
223 | 223 | if ($file) { |
224 | - $value = '<img src="' . $file->path . '?resize=60x120" />'; |
|
224 | + $value = '<img src="'.$file->path.'?resize=60x120" />'; |
|
225 | 225 | } else { |
226 | 226 | $value = '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
227 | 227 | } |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | return; |
260 | 260 | } |
261 | 261 | if (!is_array($array)) { |
262 | - if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) { |
|
262 | + if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) { |
|
263 | 263 | static::createCol($array); |
264 | 264 | $cols = static::cols(true); |
265 | 265 | } |
266 | - if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) { |
|
267 | - $array = static::colPrefix() . $array; |
|
266 | + if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) { |
|
267 | + $array = static::colPrefix().$array; |
|
268 | 268 | } else { |
269 | 269 | static::checkForJoin($array, $rootModel); |
270 | 270 | } |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | switch ($searchtype) { |
274 | 274 | case 'key': |
275 | 275 | foreach ($array as $key => $item) { |
276 | - if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) { |
|
276 | + if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) { |
|
277 | 277 | static::createCol($key); |
278 | 278 | $cols = static::cols(true); |
279 | 279 | } |
280 | - if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) { |
|
281 | - $array[static::colPrefix() . $key] = $item; |
|
280 | + if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) { |
|
281 | + $array[static::colPrefix().$key] = $item; |
|
282 | 282 | unset($array[$key]); |
283 | - $key = static::colPrefix() . $key; |
|
283 | + $key = static::colPrefix().$key; |
|
284 | 284 | } |
285 | 285 | if (is_array($array[$key])) { |
286 | 286 | static::fixPrefix($array[$key], 'key', $rootModel); |
@@ -291,12 +291,12 @@ discard block |
||
291 | 291 | break; |
292 | 292 | case 'first': |
293 | 293 | if (isset($array[0]) && is_string($array[0])) { |
294 | - if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) { |
|
294 | + if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) { |
|
295 | 295 | static::createCol($array[0]); |
296 | 296 | $cols = static::cols(true); |
297 | 297 | } |
298 | - if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) { |
|
299 | - $array[0] = static::colPrefix() . $array[0]; |
|
298 | + if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) { |
|
299 | + $array[0] = static::colPrefix().$array[0]; |
|
300 | 300 | } else { |
301 | 301 | static::checkForJoin($array[0], $rootModel); |
302 | 302 | } |
@@ -329,13 +329,13 @@ discard block |
||
329 | 329 | case 'to': |
330 | 330 | $relCol = $relations[$rel]['col']; |
331 | 331 | static::fixPrefix($relCol); |
332 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
332 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
333 | 333 | break; |
334 | 334 | case 'one': |
335 | 335 | case 'many': |
336 | 336 | $relCol = $relations[$rel]['col']; |
337 | 337 | $relations[$rel]['model']::fixPrefix($relCol); |
338 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
338 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
339 | 339 | break; |
340 | 340 | } |
341 | 341 | $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel); |
@@ -376,13 +376,13 @@ discard block |
||
376 | 376 | $relCol = $relations[$rel]['col']; |
377 | 377 | static::fixPrefix($relCol); |
378 | 378 | //$info['modelName'] = $relations[$rel]['model']; |
379 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
379 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
380 | 380 | break; |
381 | 381 | case 'one': |
382 | 382 | $relCol = $relations[$rel]['col']; |
383 | 383 | $relations[$rel]['model']::fixPrefix($relCol); |
384 | 384 | //$info['modelName'] = $relations[$rel]['model']; |
385 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
385 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
386 | 386 | break; |
387 | 387 | } |
388 | 388 | $info = $relations[$rel]['model']::parseColRecursion($info); |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | } else { |
401 | 401 | $info['colParams'] = []; |
402 | 402 | } |
403 | - if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) { |
|
404 | - $info['col'] = static::colPrefix() . $info['col']; |
|
403 | + if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) { |
|
404 | + $info['col'] = static::colPrefix().$info['col']; |
|
405 | 405 | } |
406 | 406 | $info['modelName'] = get_called_class(); |
407 | 407 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | if ($params === false) { |
508 | 508 | return false; |
509 | 509 | } |
510 | - return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params); |
|
510 | + return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | public static function createTable() |
@@ -537,28 +537,28 @@ discard block |
||
537 | 537 | return true; |
538 | 538 | } |
539 | 539 | $cols = [ |
540 | - $colPrefix . 'id' => 'pk' |
|
540 | + $colPrefix.'id' => 'pk' |
|
541 | 541 | ]; |
542 | 542 | $className = get_called_class(); |
543 | 543 | if (!empty($className::$cols)) { |
544 | 544 | foreach ($className::$cols as $colName => $colParams) { |
545 | 545 | if ($colName == 'date_create') { |
546 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
546 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
547 | 547 | continue; |
548 | 548 | } |
549 | 549 | $params = $className::genColParams($colName); |
550 | 550 | if ($params) { |
551 | - $cols[$colPrefix . $colName] = $params; |
|
551 | + $cols[$colPrefix.$colName] = $params; |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | } |
555 | - if (empty($cols[$colPrefix . 'date_create'])) { |
|
556 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
555 | + if (empty($cols[$colPrefix.'date_create'])) { |
|
556 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
557 | 557 | } |
558 | 558 | $tableIndexes = []; |
559 | 559 | if ($indexes) { |
560 | 560 | foreach ($indexes as $indexName => $index) { |
561 | - $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')'; |
|
561 | + $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')'; |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | public static function index() |
585 | 585 | { |
586 | 586 | |
587 | - return static::colPrefix() . 'id'; |
|
587 | + return static::colPrefix().'id'; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | /** |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | { |
597 | 597 | $classPath = explode('\\', get_called_class()); |
598 | 598 | $classPath = array_slice($classPath, 1); |
599 | - return strtolower(implode('_', $classPath)) . '_'; |
|
599 | + return strtolower(implode('_', $classPath)).'_'; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | /** |
@@ -661,12 +661,12 @@ discard block |
||
661 | 661 | case 'to': |
662 | 662 | $relCol = $relations[$rel]['col']; |
663 | 663 | static::fixPrefix($relCol); |
664 | - App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
664 | + App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
665 | 665 | break; |
666 | 666 | case 'one': |
667 | 667 | $col = $relations[$rel]['col']; |
668 | 668 | $relations[$rel]['model']::fixPrefix($col); |
669 | - App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
669 | + App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
670 | 670 | break; |
671 | 671 | } |
672 | 672 | } |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | } |
682 | 682 | if ($param !== null) { |
683 | 683 | $cols = static::cols(); |
684 | - if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) { |
|
685 | - $col = static::colPrefix() . $col; |
|
684 | + if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) { |
|
685 | + $col = static::colPrefix().$col; |
|
686 | 686 | } |
687 | 687 | App::$cur->db->where($col, $param); |
688 | 688 | } else { |
@@ -742,12 +742,12 @@ discard block |
||
742 | 742 | case 'to': |
743 | 743 | $relCol = $relations[$rel]['col']; |
744 | 744 | static::fixPrefix($relCol); |
745 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
745 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
746 | 746 | break; |
747 | 747 | case 'one': |
748 | 748 | $col = $relations[$rel]['col']; |
749 | 749 | $relations[$rel]['model']::fixPrefix($col); |
750 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
750 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
751 | 751 | break; |
752 | 752 | } |
753 | 753 | } |
@@ -1063,12 +1063,12 @@ discard block |
||
1063 | 1063 | case 'to': |
1064 | 1064 | $relCol = $relations[$rel]['col']; |
1065 | 1065 | static::fixPrefix($relCol); |
1066 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
1066 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
1067 | 1067 | break; |
1068 | 1068 | case 'one': |
1069 | 1069 | $col = $relations[$rel]['col']; |
1070 | 1070 | $relations[$rel]['model']::fixPrefix($col); |
1071 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
1071 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
1072 | 1072 | break; |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | } else { |
1086 | 1086 | $cols .= '*'; |
1087 | 1087 | } |
1088 | - $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : ''); |
|
1088 | + $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : ''); |
|
1089 | 1089 | $query->cols = $cols; |
1090 | 1090 | if (!empty($options['group'])) { |
1091 | 1091 | $query->group($options['group']); |
@@ -1223,25 +1223,25 @@ discard block |
||
1223 | 1223 | $itemModel = $class::$treeCategory; |
1224 | 1224 | $oldPath = $this->tree_path; |
1225 | 1225 | $this->tree_path = $this->getCatalogTree($this); |
1226 | - $itemsTable = \App::$cur->db->table_prefix . $itemModel::table(); |
|
1227 | - $itemTreeCol = $itemModel::colPrefix() . 'tree_path'; |
|
1226 | + $itemsTable = \App::$cur->db->table_prefix.$itemModel::table(); |
|
1227 | + $itemTreeCol = $itemModel::colPrefix().'tree_path'; |
|
1228 | 1228 | |
1229 | - $categoryTreeCol = $this->colPrefix() . 'tree_path'; |
|
1230 | - $categoryTable = \App::$cur->db->table_prefix . $this->table(); |
|
1229 | + $categoryTreeCol = $this->colPrefix().'tree_path'; |
|
1230 | + $categoryTable = \App::$cur->db->table_prefix.$this->table(); |
|
1231 | 1231 | if ($oldPath) { |
1232 | 1232 | \App::$cur->db->query('UPDATE |
1233 | - ' . $categoryTable . ' |
|
1233 | + ' . $categoryTable.' |
|
1234 | 1234 | SET |
1235 | - ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
1236 | - WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
1235 | + ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
1236 | + WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
1237 | 1237 | |
1238 | 1238 | \App::$cur->db->query('UPDATE |
1239 | - ' . $itemsTable . ' |
|
1239 | + ' . $itemsTable.' |
|
1240 | 1240 | SET |
1241 | - ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
1242 | - WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
1241 | + ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
1242 | + WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
1243 | 1243 | } |
1244 | - $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]); |
|
1244 | + $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | /** |
@@ -1256,9 +1256,9 @@ discard block |
||
1256 | 1256 | $catalogParent = $catalogClass::get($catalog->parent_id); |
1257 | 1257 | if ($catalog && $catalogParent) { |
1258 | 1258 | if ($catalogParent->tree_path) { |
1259 | - return $catalogParent->tree_path . $catalogParent->id . '/'; |
|
1259 | + return $catalogParent->tree_path.$catalogParent->id.'/'; |
|
1260 | 1260 | } else { |
1261 | - return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/'; |
|
1261 | + return $this->getCatalogTree($catalogParent).$catalogParent->id.'/'; |
|
1262 | 1262 | } |
1263 | 1263 | } |
1264 | 1264 | return '/'; |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | $categoryModel = $class::$categoryModel; |
1274 | 1274 | $category = $categoryModel::get($this->{$categoryModel::index()}); |
1275 | 1275 | if ($category) { |
1276 | - $this->tree_path = $category->tree_path . $category->pk() . '/'; |
|
1276 | + $this->tree_path = $category->tree_path.$category->pk().'/'; |
|
1277 | 1277 | } else { |
1278 | 1278 | $this->tree_path = '/'; |
1279 | 1279 | } |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | $this->changeCategoryTree(); |
1300 | 1300 | } |
1301 | 1301 | if (!empty($this->_changedParams) && $this->pk()) { |
1302 | - Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this); |
|
1302 | + Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this); |
|
1303 | 1303 | } |
1304 | 1304 | $this->beforeSave(); |
1305 | 1305 | |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | } |
1338 | 1338 | $this->_params = $result->fetch(); |
1339 | 1339 | if ($new) { |
1340 | - Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this); |
|
1340 | + Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this); |
|
1341 | 1341 | } |
1342 | 1342 | $this->afterSave(); |
1343 | 1343 | return $this->{$this->index()}; |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | static::fixPrefix($params); |
1484 | 1484 | $className = get_called_class(); |
1485 | 1485 | foreach ($params as $paramName => $value) { |
1486 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName); |
|
1486 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName); |
|
1487 | 1487 | if (!empty($className::$cols[$shortName])) { |
1488 | 1488 | switch ($className::$cols[$shortName]['type']) { |
1489 | 1489 | case 'decimal': |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | { |
1764 | 1764 | static::fixPrefix($name); |
1765 | 1765 | $className = get_called_class(); |
1766 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name); |
|
1766 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name); |
|
1767 | 1767 | if (!empty($className::$cols[$shortName])) { |
1768 | 1768 | switch ($className::$cols[$shortName]['type']) { |
1769 | 1769 | case 'decimal': |
@@ -260,8 +260,7 @@ discard block |
||
260 | 260 | } else { |
261 | 261 | $value = $item->$colName; |
262 | 262 | } |
263 | - } |
|
264 | - else { |
|
263 | + } else { |
|
265 | 264 | $value = $item->$colName; |
266 | 265 | } |
267 | 266 | break; |
@@ -751,17 +750,21 @@ discard block |
||
751 | 750 | if (!$query) { |
752 | 751 | return []; |
753 | 752 | } |
754 | - if (!empty($options['where'])) |
|
755 | - $query->where($options['where']); |
|
753 | + if (!empty($options['where'])) { |
|
754 | + $query->where($options['where']); |
|
755 | + } |
|
756 | 756 | if (!empty($options['group'])) { |
757 | 757 | $query->group($options['group']); |
758 | 758 | } |
759 | - if (!empty($options['order'])) |
|
760 | - $query->order($options['order']); |
|
761 | - if (!empty($options['join'])) |
|
762 | - $query->join($options['join']); |
|
763 | - if (!empty($options['distinct'])) |
|
764 | - $query->distinct = $options['distinct']; |
|
759 | + if (!empty($options['order'])) { |
|
760 | + $query->order($options['order']); |
|
761 | + } |
|
762 | + if (!empty($options['join'])) { |
|
763 | + $query->join($options['join']); |
|
764 | + } |
|
765 | + if (!empty($options['distinct'])) { |
|
766 | + $query->distinct = $options['distinct']; |
|
767 | + } |
|
765 | 768 | |
766 | 769 | foreach (static::$relJoins as $join) { |
767 | 770 | $query->join($join[0], $join[1]); |
@@ -787,14 +790,14 @@ discard block |
||
787 | 790 | } |
788 | 791 | static::$needJoin = []; |
789 | 792 | |
790 | - if (!empty($options['limit'])) |
|
791 | - $limit = (int) $options['limit']; |
|
792 | - else { |
|
793 | + if (!empty($options['limit'])) { |
|
794 | + $limit = (int) $options['limit']; |
|
795 | + } else { |
|
793 | 796 | $limit = 0; |
794 | 797 | } |
795 | - if (!empty($options['start'])) |
|
796 | - $start = (int) $options['start']; |
|
797 | - else { |
|
798 | + if (!empty($options['start'])) { |
|
799 | + $start = (int) $options['start']; |
|
800 | + } else { |
|
798 | 801 | $start = 0; |
799 | 802 | } |
800 | 803 | if ($limit || $start) { |
@@ -1061,21 +1064,23 @@ discard block |
||
1061 | 1064 | if (!empty($options['where'])) { |
1062 | 1065 | static::fixPrefix($options['where'], 'first'); |
1063 | 1066 | } |
1064 | - if (!empty($options['where'])) |
|
1065 | - $query->where($options['where']); |
|
1066 | - if (!empty($options['join'])) |
|
1067 | - $query->join($options['join']); |
|
1067 | + if (!empty($options['where'])) { |
|
1068 | + $query->where($options['where']); |
|
1069 | + } |
|
1070 | + if (!empty($options['join'])) { |
|
1071 | + $query->join($options['join']); |
|
1072 | + } |
|
1068 | 1073 | if (!empty($options['order'])) { |
1069 | 1074 | $query->order($options['order']); |
1070 | 1075 | } |
1071 | - if (!empty($options['limit'])) |
|
1072 | - $limit = (int) $options['limit']; |
|
1073 | - else { |
|
1076 | + if (!empty($options['limit'])) { |
|
1077 | + $limit = (int) $options['limit']; |
|
1078 | + } else { |
|
1074 | 1079 | $limit = 0; |
1075 | 1080 | } |
1076 | - if (!empty($options['start'])) |
|
1077 | - $start = (int) $options['start']; |
|
1078 | - else { |
|
1081 | + if (!empty($options['start'])) { |
|
1082 | + $start = (int) $options['start']; |
|
1083 | + } else { |
|
1079 | 1084 | $start = 0; |
1080 | 1085 | } |
1081 | 1086 | if ($limit || $start) { |
@@ -1153,8 +1158,9 @@ discard block |
||
1153 | 1158 | |
1154 | 1159 | $values = []; |
1155 | 1160 | foreach ($cols as $col => $param) { |
1156 | - if (isset($params[$col])) |
|
1157 | - $values[$col] = $params[$col]; |
|
1161 | + if (isset($params[$col])) { |
|
1162 | + $values[$col] = $params[$col]; |
|
1163 | + } |
|
1158 | 1164 | } |
1159 | 1165 | if (empty($values)) { |
1160 | 1166 | return false; |
@@ -1337,8 +1343,9 @@ discard block |
||
1337 | 1343 | $values = []; |
1338 | 1344 | |
1339 | 1345 | foreach ($this->cols() as $col => $param) { |
1340 | - if (isset($this->_params[$col])) |
|
1341 | - $values[$col] = $this->_params[$col]; |
|
1346 | + if (isset($this->_params[$col])) { |
|
1347 | + $values[$col] = $this->_params[$col]; |
|
1348 | + } |
|
1342 | 1349 | } |
1343 | 1350 | if (empty($values) && empty($options['empty'])) { |
1344 | 1351 | return false; |
@@ -1498,8 +1505,9 @@ discard block |
||
1498 | 1505 | { |
1499 | 1506 | |
1500 | 1507 | foreach (static::relations() as $relName => $rel) { |
1501 | - if ($rel['col'] == $col) |
|
1502 | - return $relName; |
|
1508 | + if ($rel['col'] == $col) { |
|
1509 | + return $relName; |
|
1510 | + } |
|
1503 | 1511 | } |
1504 | 1512 | return NULL; |
1505 | 1513 | } |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | ]]); |
59 | 59 | ?>)</h3> |
60 | 60 | <?php |
61 | - foreach (\Dashboard\Comment::getList([ 'where' => [ |
|
62 | - ['item_id', $item->id], |
|
63 | - ['model', $modelName], |
|
64 | - ], 'order' => ['date_create', 'desc']]) as $comment) { |
|
65 | - ?> |
|
61 | + foreach (\Dashboard\Comment::getList([ 'where' => [ |
|
62 | + ['item_id', $item->id], |
|
63 | + ['model', $modelName], |
|
64 | + ], 'order' => ['date_create', 'desc']]) as $comment) { |
|
65 | + ?> |
|
66 | 66 | <div class="row"> |
67 | 67 | <div class="col-sm-3" style="max-width: 300px;"> |
68 | 68 | <a href='/admin/Users/view/User/<?= $comment->user->pk(); ?>'><?= $comment->user->name(); ?></a><br /> |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | </div> |
74 | 74 | </div> |
75 | 75 | <?php |
76 | - } |
|
77 | - ?> |
|
76 | + } |
|
77 | + ?> |
|
78 | 78 | </div> |
79 | 79 | <div> |
80 | 80 | <?php |
81 | - $form = new \Ui\Form(); |
|
82 | - $form->begin(); |
|
83 | - $form->input('textarea', 'comment', 'Комментарий'); |
|
84 | - $form->end(); |
|
85 | - ?> |
|
81 | + $form = new \Ui\Form(); |
|
82 | + $form->begin(); |
|
83 | + $form->input('textarea', 'comment', 'Комментарий'); |
|
84 | + $form->end(); |
|
85 | + ?> |
|
86 | 86 | </div> |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | case 'relation': |
25 | 25 | $relations = $colInfo['modelName']::relations(); |
26 | 26 | $relValue = $relations[$colInfo['colParams']['relation']]['model']::get($item->$colName); |
27 | - $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relations[$colInfo['colParams']['relation']]['model']) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано'; |
|
27 | + $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relations[$colInfo['colParams']['relation']]['model'])."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано'; |
|
28 | 28 | break; |
29 | 29 | } |
30 | 30 | break; |
31 | 31 | case 'image': |
32 | 32 | $file = Files\File::get($item->$colName); |
33 | 33 | if ($file) { |
34 | - $value = '<img src="' . $file->path . '?resize=60x120" />'; |
|
34 | + $value = '<img src="'.$file->path.'?resize=60x120" />'; |
|
35 | 35 | } else { |
36 | 36 | $value = '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
37 | 37 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ]]); |
59 | 59 | ?>)</h3> |
60 | 60 | <?php |
61 | - foreach (\Dashboard\Comment::getList([ 'where' => [ |
|
61 | + foreach (\Dashboard\Comment::getList(['where' => [ |
|
62 | 62 | ['item_id', $item->id], |
63 | 63 | ['model', $modelName], |
64 | 64 | ], 'order' => ['date_create', 'desc']]) as $comment) { |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $buttons = []; |
12 | 12 | foreach ($actions as $action => $actionParams) { |
13 | 13 | if (class_exists($actionParams['className']) && $actionParams['className']::$rowAction) { |
14 | - $buttons[]= $actionParams['className']::rowButton($dataManager, $item, $params, $actionParams); |
|
14 | + $buttons[] = $actionParams['className']::rowButton($dataManager, $item, $params, $actionParams); |
|
15 | 15 | } |
16 | 16 | } |
17 | 17 | echo implode(' ', $buttons); |
@@ -92,6 +92,9 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | + /** |
|
96 | + * @param string $user_mail |
|
97 | + */ |
|
95 | 98 | public function passre($user_mail) |
96 | 99 | { |
97 | 100 | $user = $this->get($user_mail, 'mail'); |
@@ -322,6 +325,9 @@ discard block |
||
322 | 325 | return $user->id; |
323 | 326 | } |
324 | 327 | |
328 | + /** |
|
329 | + * @param string $pass |
|
330 | + */ |
|
325 | 331 | public function hashpass($pass) |
326 | 332 | { |
327 | 333 | return password_hash($pass, PASSWORD_DEFAULT); |
@@ -359,6 +365,9 @@ discard block |
||
359 | 365 | return $return; |
360 | 366 | } |
361 | 367 | |
368 | + /** |
|
369 | + * @param integer $cat_id |
|
370 | + */ |
|
362 | 371 | public function addUserActivity($user_id, $cat_id , $text = '') |
363 | 372 | { |
364 | 373 | $ua = new Users\Activity([ |
@@ -196,17 +196,20 @@ |
||
196 | 196 | */ |
197 | 197 | public function get($idn, $ltype = 'id') |
198 | 198 | { |
199 | - if (!$idn) |
|
200 | - return false; |
|
199 | + if (!$idn) { |
|
200 | + return false; |
|
201 | + } |
|
201 | 202 | |
202 | - if (is_numeric($idn) && $ltype != 'login') |
|
203 | - $user = Users\User::get($idn, 'id'); |
|
204 | - elseif ($ltype == 'login') |
|
205 | - $user = Users\User::get($idn, 'login'); |
|
206 | - else |
|
207 | - $user = Users\User::get($idn, 'mail'); |
|
208 | - if (!$user) |
|
209 | - return []; |
|
203 | + if (is_numeric($idn) && $ltype != 'login') { |
|
204 | + $user = Users\User::get($idn, 'id'); |
|
205 | + } elseif ($ltype == 'login') { |
|
206 | + $user = Users\User::get($idn, 'login'); |
|
207 | + } else { |
|
208 | + $user = Users\User::get($idn, 'mail'); |
|
209 | + } |
|
210 | + if (!$user) { |
|
211 | + return []; |
|
212 | + } |
|
210 | 213 | |
211 | 214 | return $user; |
212 | 215 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | if (isset($_GET['logout'])) { |
25 | 25 | return $this->logOut(); |
26 | 26 | } |
27 | - if (filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_session_hash') && filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_id')) { |
|
28 | - return $this->cuntinueSession(filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_session_hash'), filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_id')); |
|
27 | + if (filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_session_hash') && filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_id')) { |
|
28 | + return $this->cuntinueSession(filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_session_hash'), filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_id')); |
|
29 | 29 | } |
30 | 30 | if (isset($_POST['autorization']) && trim(filter_input(INPUT_POST, 'user_login')) && trim(filter_input(INPUT_POST, 'user_pass'))) { |
31 | 31 | unset($_POST['autorization']); |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | |
42 | 42 | public function logOut($redirect = true) |
43 | 43 | { |
44 | - if (!empty($_COOKIE[$this->cookiePrefix . "_user_session_hash"]) && !empty($_COOKIE[$this->cookiePrefix . "_user_id"])) { |
|
44 | + if (!empty($_COOKIE[$this->cookiePrefix."_user_session_hash"]) && !empty($_COOKIE[$this->cookiePrefix."_user_id"])) { |
|
45 | 45 | $session = Users\Session::get([ |
46 | - ['user_id', $_COOKIE[$this->cookiePrefix . "_user_id"]], |
|
47 | - ['hash', $_COOKIE[$this->cookiePrefix . "_user_session_hash"]] |
|
46 | + ['user_id', $_COOKIE[$this->cookiePrefix."_user_id"]], |
|
47 | + ['hash', $_COOKIE[$this->cookiePrefix."_user_session_hash"]] |
|
48 | 48 | ]); |
49 | 49 | if ($session) { |
50 | 50 | $session->delete(); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (!headers_sent()) { |
54 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
55 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
54 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
55 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
56 | 56 | } |
57 | 57 | if ($redirect) { |
58 | 58 | if (!empty($this->config['logoutUrl'][$this->app->type])) { |
@@ -70,25 +70,25 @@ discard block |
||
70 | 70 | ]); |
71 | 71 | if ($session && $session->user && $session->user->blocked) { |
72 | 72 | if (!headers_sent()) { |
73 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
74 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
73 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
74 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
75 | 75 | } |
76 | 76 | Msg::add('Ваш аккаунт заблокирован', 'info'); |
77 | 77 | return; |
78 | 78 | } |
79 | 79 | if ($session && $session->user && !$session->user->blocked) { |
80 | 80 | if (!headers_sent()) { |
81 | - setcookie($this->cookiePrefix . "_user_session_hash", $session->hash, time() + 360000, "/"); |
|
82 | - setcookie($this->cookiePrefix . "_user_id", $session->user_id, time() + 360000, "/"); |
|
81 | + setcookie($this->cookiePrefix."_user_session_hash", $session->hash, time() + 360000, "/"); |
|
82 | + setcookie($this->cookiePrefix."_user_id", $session->user_id, time() + 360000, "/"); |
|
83 | 83 | } |
84 | 84 | if (!empty($this->config['needActivation']) && $session->user->activation) { |
85 | 85 | if (!headers_sent()) { |
86 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
87 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
86 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
87 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
88 | 88 | } |
89 | - Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $session->user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
89 | + Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$session->user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
90 | 90 | } elseif ($session->user->activation) { |
91 | - Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $session->user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
91 | + Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$session->user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
92 | 92 | } |
93 | 93 | if (!$session->user->mail && !empty($this->config['noMailNotify'])) { |
94 | 94 | Msg::add($this->config['noMailNotify']); |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | Users\User::$cur->save(); |
99 | 99 | } else { |
100 | 100 | if (!headers_sent()) { |
101 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
102 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
101 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
102 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
103 | 103 | } |
104 | 104 | Msg::add('Ваша сессия устарела или более недействительна, вам необходимо пройти <a href = "/users/login">авторизацию</a> заново', 'info'); |
105 | 105 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $user = $this->get($user_mail, 'mail'); |
111 | 111 | if (!$user) { |
112 | - Msg::add('Пользователь ' . $user_mail . ' не найден, проверьте првильность ввода e-mail или зарегистрируйтесь', 'danger'); |
|
112 | + Msg::add('Пользователь '.$user_mail.' не найден, проверьте првильность ввода e-mail или зарегистрируйтесь', 'danger'); |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | $passre = Users\Passre::get([['user_id', $user->id], ['status', 1]]); |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | $passre->status = 2; |
118 | 118 | $passre->save(); |
119 | 119 | } |
120 | - $hash = $user->id . '_' . Tools::randomString(50); |
|
120 | + $hash = $user->id.'_'.Tools::randomString(50); |
|
121 | 121 | $passre = new Users\Passre(['user_id' => $user->id, 'status' => 1, 'hash' => $hash]); |
122 | 122 | $passre->save(); |
123 | - 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>'); |
|
123 | + 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>'); |
|
124 | 124 | Tools::redirect('/', 'На указанный почтовый ящик была выслана инструкция по восстановлению пароля', 'success'); |
125 | 125 | } |
126 | 126 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $user->pass = $this->hashpass($pass); |
139 | 139 | $user->save(); |
140 | 140 | $this->autorization($user->mail, $user->pass, 'mail'); |
141 | - Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, $user->mail, 'Новый пароль на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />Ваш новый пароль: ' . $pass); |
|
141 | + Tools::sendMail('noreply@'.INJI_DOMAIN_NAME, $user->mail, 'Новый пароль на сайте '.idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />Ваш новый пароль: '.$pass); |
|
142 | 142 | Tools::redirect('/', 'На указанный почтовый ящик был выслан новый пароль', 'success'); |
143 | 143 | } |
144 | 144 | } |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | $user = $this->get($login, $ltype); |
152 | 152 | if ($user && $this->verifypass($pass, $user->pass) && !$user->blocked) { |
153 | 153 | if (!empty($this->config['needActivation']) && $user->activation) { |
154 | - Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
154 | + Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
155 | 155 | } elseif ($user->activation) { |
156 | - Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
156 | + Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
157 | 157 | } |
158 | 158 | if (!$user->mail && !empty($this->config['noMailNotify'])) { |
159 | 159 | Msg::add($this->config['noMailNotify']); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if ($user && $user->blocked) { |
173 | 173 | Msg::add('Вы заблокированы', 'danger'); |
174 | 174 | } elseif ($user) { |
175 | - Msg::add('Вы ошиблись при наборе пароля или логина, попробуйте ещё раз или воспользуйтесь <a href = "?passre=1&user_mail=' . $user->mail . '">Восстановлением пароля</a>', 'danger'); |
|
175 | + Msg::add('Вы ошиблись при наборе пароля или логина, попробуйте ещё раз или воспользуйтесь <a href = "?passre=1&user_mail='.$user->mail.'">Восстановлением пароля</a>', 'danger'); |
|
176 | 176 | } else { |
177 | 177 | Msg::add('Данный почтовый ящик не зарегистрирован в системе', 'danger'); |
178 | 178 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | $session->save(); |
196 | 196 | |
197 | 197 | if (!headers_sent()) { |
198 | - setcookie($this->cookiePrefix . "_user_session_hash", $session->hash, time() + 360000, "/"); |
|
199 | - setcookie($this->cookiePrefix . "_user_id", $session->user_id, time() + 360000, "/"); |
|
198 | + setcookie($this->cookiePrefix."_user_session_hash", $session->hash, time() + 360000, "/"); |
|
199 | + setcookie($this->cookiePrefix."_user_id", $session->user_id, time() + 360000, "/"); |
|
200 | 200 | } else { |
201 | 201 | Msg::add('Не удалось провести авторизацию. Попробуйте позже', 'info'); |
202 | 202 | } |
@@ -318,20 +318,20 @@ discard block |
||
318 | 318 | $this->autorization($user_mail, $pass, 'mail'); |
319 | 319 | } |
320 | 320 | if (!empty($this->config['needActivation'])) { |
321 | - $from = 'noreply@' . INJI_DOMAIN_NAME; |
|
321 | + $from = 'noreply@'.INJI_DOMAIN_NAME; |
|
322 | 322 | $to = $user_mail; |
323 | - $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
324 | - $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass; |
|
325 | - $text .='<br />'; |
|
323 | + $subject = 'Регистрация на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
324 | + $text = 'Вы были зарегистрированы на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: '.$pass; |
|
326 | 325 | $text .= '<br />'; |
327 | - $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>'; |
|
326 | + $text .= '<br />'; |
|
327 | + $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>'; |
|
328 | 328 | Tools::sendMail($from, $to, $subject, $text); |
329 | 329 | Msg::add('Вы были зарегистрированы. На указанный почтовый ящик был выслан ваш пароль и ссылка для активации', 'success'); |
330 | 330 | } else { |
331 | - $from = 'noreply@' . INJI_DOMAIN_NAME; |
|
331 | + $from = 'noreply@'.INJI_DOMAIN_NAME; |
|
332 | 332 | $to = $user_mail; |
333 | - $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
334 | - $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass; |
|
333 | + $subject = 'Регистрация на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
334 | + $text = 'Вы были зарегистрированы на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: '.$pass; |
|
335 | 335 | Tools::sendMail($from, $to, $subject, $text); |
336 | 336 | Msg::add('Вы были зарегистрированы. На указанный почтовый ящик был выслан ваш пароль', 'success'); |
337 | 337 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | 'map' => [ |
45 | 45 | ['name', 'type'], |
46 | 46 | ['required', 'save'], |
47 | - [ 'userfield'] |
|
47 | + ['userfield'] |
|
48 | 48 | ] |
49 | 49 | ] |
50 | 50 | ]; |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <fieldset> |
2 | 2 | <?php |
3 | - if (\Users\User::$cur->id) { |
|
4 | - $userAdds = Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id]]); |
|
5 | - $values = []; |
|
6 | - foreach ($userAdds as $userAdd) { |
|
7 | - $values[$userAdd->id] = $userAdd->values(['array' => true]); |
|
8 | - } |
|
9 | - if ($userAdds) { |
|
10 | - $form->input('select', 'userAddsId', 'Ваши контакты', ['values' => ['' => 'Выберите'] + Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id], 'forSelect' => true])]); |
|
11 | - echo '<hr />'; |
|
12 | - } |
|
13 | - ?> |
|
3 | + if (\Users\User::$cur->id) { |
|
4 | + $userAdds = Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id]]); |
|
5 | + $values = []; |
|
6 | + foreach ($userAdds as $userAdd) { |
|
7 | + $values[$userAdd->id] = $userAdd->values(['array' => true]); |
|
8 | + } |
|
9 | + if ($userAdds) { |
|
10 | + $form->input('select', 'userAddsId', 'Ваши контакты', ['values' => ['' => 'Выберите'] + Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id], 'forSelect' => true])]); |
|
11 | + echo '<hr />'; |
|
12 | + } |
|
13 | + ?> |
|
14 | 14 | <script> |
15 | 15 | var userAddsValues = <?= json_encode($values); ?>; |
16 | 16 | inji.onLoad(function () { |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | }) |
25 | 25 | </script> |
26 | 26 | <?php |
27 | - } |
|
28 | - foreach (Ecommerce\UserAdds\Field::getList(['order' => ['weight', 'asc']]) as $field) { |
|
29 | - $form->input($field->type, "userAdds[fields][{$field->id}]", $field->name, ['required' => $field->required]); |
|
30 | - } |
|
31 | - ?> |
|
27 | + } |
|
28 | + foreach (Ecommerce\UserAdds\Field::getList(['order' => ['weight', 'asc']]) as $field) { |
|
29 | + $form->input($field->type, "userAdds[fields][{$field->id}]", $field->name, ['required' => $field->required]); |
|
30 | + } |
|
31 | + ?> |
|
32 | 32 | </fieldset> |
33 | 33 | \ No newline at end of file |
@@ -11,6 +11,11 @@ |
||
11 | 11 | { |
12 | 12 | function indexAction() |
13 | 13 | { |
14 | + |
|
15 | + /** |
|
16 | + * @param DOMDocument $xml |
|
17 | + * @param string $nodeName |
|
18 | + */ |
|
14 | 19 | function addToXml($xml, $parent, $nodeName, $text) |
15 | 20 | { |
16 | 21 | $node = $parent->appendChild($xml->createElement($nodeName)); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | addToXml($xml, $shop, 'name', \App::$cur->config['site']['name']); |
38 | 38 | addToXml($xml, $shop, 'company', \App::$cur->config['site']['company_name']); |
39 | - addToXml($xml, $shop, 'url', 'http://' . INJI_DOMAIN_NAME); |
|
39 | + addToXml($xml, $shop, 'url', 'http://'.INJI_DOMAIN_NAME); |
|
40 | 40 | |
41 | 41 | $currencies = $xml->createElement('currencies'); |
42 | 42 | $currency = $currencies->appendChild($xml->createElement('currency')); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $offers = $xml->createElement('offers'); |
61 | 61 | foreach (App::$cur->ecommerce->getItems() as $item) { |
62 | 62 | $offer = $offers->appendChild($xml->createElement('offer')); |
63 | - addToXml($xml, $offer, 'url', 'http://' . INJI_DOMAIN_NAME . '/ecommerce/view/' . $item->id); |
|
63 | + addToXml($xml, $offer, 'url', 'http://'.INJI_DOMAIN_NAME.'/ecommerce/view/'.$item->id); |
|
64 | 64 | addToXml($xml, $offer, 'price', $item->getPrice()->price); |
65 | 65 | addToXml($xml, $offer, 'currencyId', 'RUR'); |
66 | 66 | addToXml($xml, $offer, 'categoryId', $item->category_id); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | header("Content-Type: text/xml"); |
88 | 88 | header("Expires: Thu, 19 Feb 1998 13:24:18 GMT"); |
89 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
89 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
90 | 90 | header("Cache-Control: no-cache, must-revalidate"); |
91 | 91 | header("Cache-Control: post-check=0,pre-check=0"); |
92 | 92 | header("Cache-Control: max-age=0"); |