Commit 3a94dc815ecb3b259e9fa04385420cd99c291e41

Authored by Андрей Ларионов
1 parent 232c33a826
Exists in master

Баг с избранными

Showing 1 changed file with 15 additions and 8 deletions Side-by-side Diff

app/Classes/RusDate.php
... ... @@ -46,18 +46,25 @@ class RusDate
46 46 }
47 47  
48 48 public static function selected_item($item) {
49   - $Str = json_decode($_COOKIE['favorite_house'], true);
50   - //$Arr = explode(",", $Str);
51   - if (in_array($item, $Str))
52   - return " active ";
53   - else
  49 + if (empty($_COOKIE['favorite_house']))
54 50 return "";
55   -
  51 + else {
  52 + $Str = json_decode($_COOKIE['favorite_house'], true);
  53 + //$Arr = explode(",", $Str);
  54 + if (in_array($item, $Str))
  55 + return " active ";
  56 + else
  57 + return "";
  58 + }
56 59 }
57 60  
58 61 public static function count_item_fav() {
59   - $Arr = json_decode($_COOKIE['favorite_house'], true);
60   - return count($Arr);
  62 + if (empty($_COOKIE['favorite_house']))
  63 + return 0;
  64 + else {
  65 + $Arr = json_decode($_COOKIE['favorite_house'], true);
  66 + return count($Arr);
  67 + }
61 68 }
62 69  
63 70 public static function clear_items() {