Completed
Push — master ( 0afdc4...0e57e6 )
by Alexey
04:27
created
system/modules/Ui/widgets/Form/text.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
     'value' => !empty($options['value']) ? addcslashes($options['value'], "'") : (!empty($form->userDataTree[$name]) ? addcslashes($form->userDataTree[$name], "'") : '')
10 10
 ];
11 11
 if (!empty($options['disabled'])) {
12
-  $attributes['disabled'] = 'disabled';
12
+    $attributes['disabled'] = 'disabled';
13 13
 }
14 14
 if (!empty($options['placeholder'])) {
15
-  $attributes['placeholder'] = $options['placeholder'];
15
+    $attributes['placeholder'] = $options['placeholder'];
16 16
 }
17 17
 if (!empty($options['checked'])) {
18
-  $attributes['checked'] = 'checked';
18
+    $attributes['checked'] = 'checked';
19 19
 }
20 20
 if (!empty($options['attributes'])) {
21
-  $attributes = array_merge($attributes, $options['attributes']);
21
+    $attributes = array_merge($attributes, $options['attributes']);
22 22
 }
23 23
 echo Html::el('input', $attributes, '', null);
24 24
 echo!empty($options['helpText']) ? "<div class='help-block'>{$options['helpText']}</div>" : '';
Please login to merge, or discard this patch.
system/modules/Ui/widgets/Form/dynamicList.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
     <?= $label; ?>
7 7
   </h3>
8 8
   <?php
9
-  if ($options['source'] == 'relation' && empty($options['modelPk'])) {
9
+    if ($options['source'] == 'relation' && empty($options['modelPk'])) {
10 10
     echo '<h4 class=" text-muted">Чтобы добавить связи, сначала создайте объект</h4>';
11 11
     echo '<p class=" text-muted">Просто заполните доступные поля и нажмите кнопку внизу формы. После этого дополнительные поля разблокируются</p>';
12
-  } else {
12
+    } else {
13 13
     ?>
14 14
     <div class="table-responsive">
15 15
       <table class ='table table-striped'>
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
           <tr>
18 18
             <?php
19 19
             foreach ($options['cols'] as $colName => $col) {
20
-              if (!empty($col['hidden'])) {
20
+                if (!empty($col['hidden'])) {
21 21
                 continue;
22
-              }
23
-              echo "<th>";
24
-              echo $col['col']['label'];
25
-              if (!empty($col['col']['model'])) {
22
+                }
23
+                echo "<th>";
24
+                echo $col['col']['label'];
25
+                if (!empty($col['col']['model'])) {
26 26
                 $modelName = $col['col']['model'];
27 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 29
                 echo ' (<a href="" onclick="' . $onclick . ';this.disabled=true;return false;">Создать</a>)';
30
-              }
31
-              echo "</th>";
30
+                }
31
+                echo "</th>";
32 32
             }
33 33
             ?>
34 34
             <td>&nbsp;</td>
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
         </thead>
37 37
         <tbody class="listBody">
38 38
           <?php
39
-          $i = 0;
40
-          if (!empty($options['values'])) {
39
+            $i = 0;
40
+            if (!empty($options['values'])) {
41 41
             foreach ($options['values'] as $row) {
42
-              echo '<tr>';
43
-              foreach ($options['cols'] as $colName => $col) {
42
+                echo '<tr>';
43
+                foreach ($options['cols'] as $colName => $col) {
44 44
                 $input = clone $col['input'];
45 45
                 if (empty($col['hidden'])) {
46
-                  echo '<td>';
46
+                    echo '<td>';
47 47
                 }
48 48
                 $input->options['noContainer'] = true;
49 49
                 $input->colParams['label'] = false;
@@ -51,24 +51,24 @@  discard block
 block discarded – undo
51 51
                 $input->colName .= '[' . $colName . '][' . ($i) . ']';
52 52
                 $input->draw();
53 53
                 if (empty($col['hidden'])) {
54
-                  echo '</td>';
54
+                    echo '</td>';
55
+                }
55 56
                 }
56
-              }
57
-              $i++;
58
-              echo '<td class="actionTd"><a class="btn btn-danger btn-xs" onclick="inji.Ui.forms.delRowFromList(this);"><i class="glyphicon glyphicon-remove"></i></a></td>';
59
-              echo '</tr>';
57
+                $i++;
58
+                echo '<td class="actionTd"><a class="btn btn-danger btn-xs" onclick="inji.Ui.forms.delRowFromList(this);"><i class="glyphicon glyphicon-remove"></i></a></td>';
59
+                echo '</tr>';
60 60
             }
61
-          }
62
-          ?>
61
+            }
62
+            ?>
63 63
         </tbody>
64 64
         <tfoot>
65 65
           <tr>
66 66
             <?php
67 67
             foreach ($options['cols'] as $colName => $col) {
68
-              if (!empty($col['hidden'])) {
68
+                if (!empty($col['hidden'])) {
69 69
                 continue;
70
-              }
71
-              echo "<th>{$col['col']['label']}</th>";
70
+                }
71
+                echo "<th>{$col['col']['label']}</th>";
72 72
             }
73 73
             ?>
74 74
             <td>&nbsp;</td>
@@ -81,26 +81,26 @@  discard block
 block discarded – undo
81 81
       <script>/*
82 82
        <tr>
83 83
   <?php
84
-  foreach ($options['cols'] as $colName => $col) {
84
+    foreach ($options['cols'] as $colName => $col) {
85 85
     if (empty($col['hidden'])) {
86
-      echo '<td>';
86
+        echo '<td>';
87 87
     }
88 88
     $col['input']->options['noContainer'] = true;
89 89
     $col['input']->colParams['label'] = false;
90 90
     $col['input']->colName.="[{$colName}][]";
91 91
     $col['input']->draw();
92 92
     if (empty($col['hidden'])) {
93
-      echo '</td>';
93
+        echo '</td>';
94
+    }
94 95
     }
95
-  }
96
-  ?>
96
+    ?>
97 97
        <td class="actionTd"><a class="btn btn-danger btn-xs" onclick="inji.Ui.forms.delRowFromList(this);"><i class="glyphicon glyphicon-remove"></i></a></td>
98 98
        </tr>
99 99
        */</script>
100 100
     </div>
101 101
     <?php
102
-  }
103
-  ?>
102
+    }
103
+    ?>
104 104
 </div>
105 105
 <?php
106 106
 //exit();
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.
system/modules/Ui/objects/FastEdit.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,22 +13,22 @@
 block discarded – undo
13 13
 
14 14
 class FastEdit extends \Object {
15 15
 
16
-  public static function block($object, $col, $value = null, $parse = false) {
16
+    public static function block($object, $col, $value = null, $parse = false) {
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 : '');
24 24
     if ($parse) {
25
-      \App::$cur->view->parseSource($value);
25
+        \App::$cur->view->parseSource($value);
26 26
     } else {
27
-      $str .= $value;
27
+        $str .= $value;
28 28
     }
29 29
 
30 30
     $str .= "</div>";
31 31
     return $str;
32
-  }
32
+    }
33 33
 
34 34
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
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 : '');
Please login to merge, or discard this patch.
system/modules/Ui/objects/ActiveForm/Input/DynamicList.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class DynamicList extends \Ui\ActiveForm\Input {
15 15
 
16
-  public function draw() {
16
+    public function draw() {
17 17
     $inputName = $this->colName();
18 18
     $inputLabel = $this->colLabel();
19 19
     $inputOptions = [
@@ -25,119 +25,119 @@  discard block
 block discarded – undo
25 25
     ];
26 26
     $this->form->input('dynamicList', $inputName, $inputLabel, $inputOptions);
27 27
     return true;
28
-  }
28
+    }
29 29
 
30
-  public function parseRequest($request) {
30
+    public function parseRequest($request) {
31 31
     $modelName = $this->modelName;
32 32
     switch ($this->colParams['source']) {
33
-      case'options':
33
+        case'options':
34 34
 
35 35
         break;
36
-      default:
36
+        default:
37 37
         $rels = [];
38 38
         $relation = $modelName::getRelation($this->colParams['relation']);
39 39
         if ($this->activeForm->model->pk()) {
40
-          switch ($relation['type']) {
40
+            switch ($relation['type']) {
41 41
             case 'relModel':
42 42
               foreach ($request[$this->colName] as $row) {
43 43
                 $rels[$row['relItem']] = true;
44
-              }
45
-              $relModels = $relation['relModel']::getList(['where' => [$modelName::index(), $this->activeForm->model->pk()], 'key' => $relation['model']::index()]);
46
-              foreach ($relModels as $model) {
44
+                }
45
+                $relModels = $relation['relModel']::getList(['where' => [$modelName::index(), $this->activeForm->model->pk()], 'key' => $relation['model']::index()]);
46
+                foreach ($relModels as $model) {
47 47
                 if (empty($rels[$model->{$relation['model']::index()}])) {
48
-                  $model->delete();
48
+                    $model->delete();
49 49
                 } else {
50
-                  unset($rels[$model->{$relation['model']::index()}]);
50
+                    unset($rels[$model->{$relation['model']::index()}]);
51
+                }
51 52
                 }
52
-              }
53
-              foreach ($rels as $relId => $trash) {
53
+                foreach ($rels as $relId => $trash) {
54 54
                 $model = new $relation['relModel']([
55 55
                     $modelName::index() => $this->activeForm->model->pk(),
56 56
                     $relation['model']::index() => $relId
57 57
                 ]);
58 58
                 $model->save();
59
-              }
60
-              break;
59
+                }
60
+                break;
61 61
 
62 62
             case 'many':
63 63
               $requestData = [];
64
-              if (!empty($request[$this->colName])) {
64
+                if (!empty($request[$this->colName])) {
65 65
                 foreach ($request[$this->colName] as $colName => $items) {
66
-                  foreach ($request[$this->colName][$colName] as $key => $data) {
66
+                    foreach ($request[$this->colName][$colName] as $key => $data) {
67 67
                     $requestData[$key][$colName] = $data;
68
-                  }
68
+                    }
69
+                }
69 70
                 }
70
-              }
71
-              foreach ($requestData as $key => $row) {
71
+                foreach ($requestData as $key => $row) {
72 72
                 if (!empty($row['id'])) {
73
-                  $rels[$row['id']] = $row;
74
-                  unset($requestData[$key]);
73
+                    $rels[$row['id']] = $row;
74
+                    unset($requestData[$key]);
75 75
                 }
76
-              }
77
-              $relModels = $this->activeForm->model->{$this->colParams['relation']};
78
-              foreach ($relModels as $model) {
76
+                }
77
+                $relModels = $this->activeForm->model->{$this->colParams['relation']};
78
+                foreach ($relModels as $model) {
79 79
                 if (empty($rels[$model->pk()])) {
80
-                  $model->delete();
80
+                    $model->delete();
81 81
                 } else {
82
-                  $model->setParams($rels[$model->pk()]);
83
-                  $model->save();
82
+                    $model->setParams($rels[$model->pk()]);
83
+                    $model->save();
84
+                }
84 85
                 }
85
-              }
86
-              foreach ($requestData as $row) {
86
+                foreach ($requestData as $row) {
87 87
                 $row[$relation['col']] = $this->activeForm->model->pk();
88 88
                 $model = new $relation['model']($row);
89 89
                 $model->save();
90
-              }
91
-              $this->activeForm->model->loadRelation($this->colParams['relation']);
92
-          }
90
+                }
91
+                $this->activeForm->model->loadRelation($this->colParams['relation']);
92
+            }
93 93
         }
94 94
     }
95
-  }
95
+    }
96 96
 
97
-  public function value() {
97
+    public function value() {
98 98
     $values = [];
99 99
     switch ($this->colParams['source']) {
100
-      case'options':
100
+        case'options':
101 101
 
102 102
         break;
103
-      default:
103
+        default:
104 104
         if ($this->activeForm->model) {
105
-          $items = $this->activeForm->model->{$this->colParams['relation']};
106
-          foreach ($items as $key => $item) {
105
+            $items = $this->activeForm->model->{$this->colParams['relation']};
106
+            foreach ($items as $key => $item) {
107 107
             $value = ['id' => $item->id];
108 108
             foreach ($this->colParams['options']['cols'] as $colName) {
109
-              $value[$colName] = $item->$colName;
109
+                $value[$colName] = $item->$colName;
110 110
             }
111 111
             $values[] = $value;
112
-          }
112
+            }
113 113
         }
114 114
     }
115 115
 
116 116
     return $values;
117
-  }
117
+    }
118 118
 
119
-  public function getCols() {
119
+    public function getCols() {
120 120
     $modelName = $this->modelName;
121 121
     $cols = [];
122 122
     switch ($this->colParams['source']) {
123
-      case'options':
123
+        case'options':
124 124
         foreach ($this->colParams['options']['inputs'] as $colName => $col) {
125
-          $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($col['type']);
126
-          $input = new $inputClassName();
127
-          $input->form = $this->form;
128
-          $input->activeForm = $this->activeForm;
129
-          $input->activeFormParams = $this->activeFormParams;
130
-          $input->modelName = $this->modelName;
131
-          $input->colName = "[{$this->colName}]";
132
-          $input->colParams = $col;
133
-          $input->options = !empty($col['options']) ? $col['options'] : [];
134
-          $cols[$colName] = ['input' => $input, 'col' => $col];
125
+            $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($col['type']);
126
+            $input = new $inputClassName();
127
+            $input->form = $this->form;
128
+            $input->activeForm = $this->activeForm;
129
+            $input->activeFormParams = $this->activeFormParams;
130
+            $input->modelName = $this->modelName;
131
+            $input->colName = "[{$this->colName}]";
132
+            $input->colParams = $col;
133
+            $input->options = !empty($col['options']) ? $col['options'] : [];
134
+            $cols[$colName] = ['input' => $input, 'col' => $col];
135 135
         }
136 136
         break;
137
-      default:
137
+        default:
138 138
         $relation = $modelName::getRelation($this->colParams['relation']);
139 139
         switch ($relation['type']) {
140
-          case 'relModel':
140
+            case 'relModel':
141 141
             $cols['relItem'] = [
142 142
                 'col' => [
143 143
                     'label' => $relation['model']::objectName(),
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 ]
149 149
             ];
150 150
             break;
151
-          case 'many':
151
+            case 'many':
152 152
             $inputClassName = '\Ui\ActiveForm\Input\Hidden';
153 153
             $input = new $inputClassName();
154 154
             $input->form = $this->form;
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
             $input->options = [];
161 161
             $cols['id'] = ['input' => $input, 'hidden' => true];
162 162
             foreach ($this->colParams['options']['cols'] as $colName) {
163
-              $col = $relation['model']::getColInfo($colName);
164
-              $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($col['colParams']['type']);
165
-              $input = new $inputClassName();
166
-              $input->form = $this->form;
167
-              $input->activeForm = $this->activeForm;
168
-              $input->activeFormParams = $this->activeFormParams;
169
-              $input->modelName = $relation['model'];
170
-              $input->colName = "[{$this->colName}]";
171
-              $input->colParams = $col;
172
-              $input->options = !empty($col['options']) ? $col['options'] : [];
173
-              $cols[$colName] = ['input' => $input, 'col' => $col];
163
+                $col = $relation['model']::getColInfo($colName);
164
+                $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($col['colParams']['type']);
165
+                $input = new $inputClassName();
166
+                $input->form = $this->form;
167
+                $input->activeForm = $this->activeForm;
168
+                $input->activeFormParams = $this->activeFormParams;
169
+                $input->modelName = $relation['model'];
170
+                $input->colName = "[{$this->colName}]";
171
+                $input->colParams = $col;
172
+                $input->options = !empty($col['options']) ? $col['options'] : [];
173
+                $cols[$colName] = ['input' => $input, 'col' => $col];
174 174
             }
175 175
             break;
176 176
         }
177 177
     }
178 178
     return $cols;
179
-  }
179
+    }
180 180
 
181 181
 }
Please login to merge, or discard this patch.
system/modules/Users/appControllers/content/login.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@
 block discarded – undo
5 5
         <h3>Вход</h3>
6 6
         <div class="form-group">
7 7
           <?php
8
-          $socials = Users\Social::getList(['where' => ['active', 1]]);
9
-          if ($socials) {
8
+            $socials = Users\Social::getList(['where' => ['active', 1]]);
9
+            if ($socials) {
10 10
             echo 'Войти через: ';
11 11
             foreach (Users\Social::getList(['where' => ['active', 1]]) as $social) {
12
-              $text = $social->image ? '<img src ="' . Statics::file($social->image->path) . '">' : $social->name();
13
-              echo "<a href = '/users/social/auth/{$social->code}'>{$text}</a> ";
12
+                $text = $social->image ? '<img src ="' . Statics::file($social->image->path) . '">' : $social->name();
13
+                echo "<a href = '/users/social/auth/{$social->code}'>{$text}</a> ";
14 14
             }
15
-          }
16
-          ?>
15
+            }
16
+            ?>
17 17
         </div>
18 18
         <form action = '' method = 'POST' >
19 19
           <div class ='row'>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
           if ($socials) {
10 10
             echo 'Войти через: ';
11 11
             foreach (Users\Social::getList(['where' => ['active', 1]]) as $social) {
12
-              $text = $social->image ? '<img src ="' . Statics::file($social->image->path) . '">' : $social->name();
12
+              $text = $social->image ? '<img src ="'.Statics::file($social->image->path).'">' : $social->name();
13 13
               echo "<a href = '/users/social/auth/{$social->code}'>{$text}</a> ";
14 14
             }
15 15
           }
Please login to merge, or discard this patch.
system/modules/Users/appControllers/UsersController.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,96 +10,96 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class UsersController extends Controller {
12 12
 
13
-  public function indexAction() {
13
+    public function indexAction() {
14 14
     Tools::redirect('/users/cabinet/profile');
15
-  }
15
+    }
16 16
 
17
-  public function cabinetAction($activeSection = '') {
17
+    public function cabinetAction($activeSection = '') {
18 18
     $bread = [];
19 19
 
20 20
     $sections = $this->module->getSnippets('cabinetSection');
21 21
     if (!empty($sections[$activeSection]['name'])) {
22
-      $this->view->setTitle($sections[$activeSection]['name'] . ' - Личный кабинет');
23
-      $bread[] = ['text' => 'Личный кабинет', 'href' => '/users/cabinet'];
24
-      $bread[] = ['text' => $sections[$activeSection]['name']];
22
+        $this->view->setTitle($sections[$activeSection]['name'] . ' - Личный кабинет');
23
+        $bread[] = ['text' => 'Личный кабинет', 'href' => '/users/cabinet'];
24
+        $bread[] = ['text' => $sections[$activeSection]['name']];
25 25
     } else {
26
-      $this->view->setTitle('Личный кабинет');
27
-      $bread[] = ['text' => 'Личный кабинет'];
26
+        $this->view->setTitle('Личный кабинет');
27
+        $bread[] = ['text' => 'Личный кабинет'];
28 28
     }
29 29
     $this->view->page(['data' => compact('widgets', 'sections', 'activeSection', 'bread')]);
30
-  }
30
+    }
31 31
 
32
-  public function loginAction() {
32
+    public function loginAction() {
33 33
     $this->view->setTitle('Авторизация');
34 34
     $bread = [];
35 35
     $bread[] = ['text' => 'Авторизация'];
36 36
     $this->view->page(['data' => compact('bread')]);
37
-  }
37
+    }
38 38
 
39
-  public function passreAction() {
39
+    public function passreAction() {
40 40
     $this->view->setTitle('Восстановление пароля');
41 41
     $bread = [];
42 42
     $bread[] = ['text' => 'Восстановление пароля'];
43 43
     $this->view->page(['data' => compact('bread')]);
44
-  }
44
+    }
45 45
 
46
-  public function registrationAction() {
46
+    public function registrationAction() {
47 47
     $this->view->setTitle('Регистрация');
48 48
     if (Users\User::$cur->user_id) {
49
-      Tools::redirect('/', 'Вы уже зарегистрированы');
49
+        Tools::redirect('/', 'Вы уже зарегистрированы');
50 50
     }
51 51
     if (!empty($_POST)) {
52
-      $error = false;
53
-      if ($this->Recaptcha) {
52
+        $error = false;
53
+        if ($this->Recaptcha) {
54 54
         $response = $this->Recaptcha->check($_POST['g-recaptcha-response']);
55 55
         if ($response) {
56
-          if (!$response->success) {
56
+            if (!$response->success) {
57 57
             Msg::add('Вы не прошли проверку на робота', 'danger');
58 58
             $error = true;
59
-          }
59
+            }
60 60
         } else {
61
-          Msg::add('Произошла ошибка, попробуйте ещё раз');
62
-          $error = true;
61
+            Msg::add('Произошла ошибка, попробуйте ещё раз');
62
+            $error = true;
63
+        }
63 64
         }
64
-      }
65
-      if (!$error) {
65
+        if (!$error) {
66 66
         if ($this->Users->registration($_POST)) {
67
-          Tools::redirect('/');
67
+            Tools::redirect('/');
68
+        }
68 69
         }
69
-      }
70 70
     }
71 71
     $this->view->setTitle('Регистрация');
72 72
     $bread = [];
73 73
     $bread[] = ['text' => 'Регистрация'];
74 74
     $this->view->page(['data' => compact('bread')]);
75
-  }
75
+    }
76 76
 
77
-  public function activationAction($userId = 0, $hash = '') {
77
+    public function activationAction($userId = 0, $hash = '') {
78 78
     $user = \Users\User::get((int) $userId);
79 79
     if (!$user || !$hash || $user->activation !== (string) $hash) {
80
-      Tools::redirect('/', 'Во время активации произошли ошибки', 'danger');
80
+        Tools::redirect('/', 'Во время активации произошли ошибки', 'danger');
81 81
     }
82 82
     $user->activation = '';
83 83
     $user->save();
84 84
     Inji::$inst->event('Users-completeActivation', $user);
85 85
     Tools::redirect('/', 'Вы успешно активировали ваш аккаунт', 'success');
86
-  }
86
+    }
87 87
 
88
-  public function attachEmailAction() {
88
+    public function attachEmailAction() {
89 89
     if (Users\User::$cur->mail) {
90
-      Tools::redirect('/', 'К вашему аккаунту уже привязан E-Mail');
90
+        Tools::redirect('/', 'К вашему аккаунту уже привязан E-Mail');
91 91
     }
92 92
     if (!empty($_POST['mail'])) {
93
-      $user_mail = trim($_POST['mail']);
94
-      if (!filter_var($user_mail, FILTER_VALIDATE_EMAIL)) {
93
+        $user_mail = trim($_POST['mail']);
94
+        if (!filter_var($user_mail, FILTER_VALIDATE_EMAIL)) {
95 95
         Msg::add('Вы ввели не корректный E-mail', 'danger');
96
-      } else {
96
+        } else {
97 97
         $user = Users\User::get($user_mail, 'mail');
98 98
         if ($user && $user->id != Users\User::$cur->id) {
99
-          Msg::add('Данный E-mail уже привязан к другому аккаунту', 'danger');
99
+            Msg::add('Данный E-mail уже привязан к другому аккаунту', 'danger');
100 100
         } else {
101
-          Users\User::$cur->mail = $user_mail;
102
-          if (!empty($this->module->config['needActivation'])) {
101
+            Users\User::$cur->mail = $user_mail;
102
+            if (!empty($this->module->config['needActivation'])) {
103 103
             Users\User::$cur->activation = Tools::randomString();
104 104
             $from = 'noreply@' . INJI_DOMAIN_NAME;
105 105
             $to = $user_mail;
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
             $text = 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://' . INJI_DOMAIN_NAME . '/users/activation/' . Users\User::$cur->id . '/' . Users\User::$cur->activation . '">http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/users/activation/' . Users\User::$cur->id . '/' . Users\User::$cur->activation . '</a>';
108 108
             Tools::sendMail($from, $to, $subject, $text);
109 109
             Msg::add('На указанный почтовый ящик была выслана ваша ссылка для подтверждения E-Mail', 'success');
110
-          } else {
110
+            } else {
111 111
             Msg::add('Вы успешно привязали E-Mail к своему аккаунту', 'success');
112
-          }
113
-          Users\User::$cur->save();
114
-          Tools::redirect('/');
112
+            }
113
+            Users\User::$cur->save();
114
+            Tools::redirect('/');
115
+        }
115 116
         }
116
-      }
117 117
     }
118 118
     $this->view->page();
119
-  }
119
+    }
120 120
 
121
-  public function resendActivationAction($userId = 0) {
121
+    public function resendActivationAction($userId = 0) {
122 122
     $user = \Users\User::get((int) $userId);
123 123
     if (!$user) {
124
-      Tools::redirect('/', 'Не указан пользователь', 'danger');
124
+        Tools::redirect('/', 'Не указан пользователь', 'danger');
125 125
     }
126 126
     if (!$user->activation) {
127
-      Tools::redirect('/', 'Пользователь уже активирован');
127
+        Tools::redirect('/', 'Пользователь уже активирован');
128 128
     }
129 129
     $from = 'noreply@' . INJI_DOMAIN_NAME;
130 130
     $to = $user->mail;
@@ -132,21 +132,21 @@  discard block
 block discarded – undo
132 132
     $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>';
133 133
     Tools::sendMail($from, $to, $subject, $text);
134 134
     Tools::redirect('/', 'На указанный почтовый ящик была выслана ваша ссылка для подтверждения E-Mail', 'success');
135
-  }
135
+    }
136 136
 
137
-  public function getPartnerInfoAction($userId = 0) {
137
+    public function getPartnerInfoAction($userId = 0) {
138 138
     $userId = (int) $userId;
139 139
     $result = new \Server\Result();
140 140
     if (!$userId) {
141
-      $result->success = FALSE;
142
-      $result->content = 'Не указан пользователь';
143
-      $result->send();
141
+        $result->success = FALSE;
142
+        $result->content = 'Не указан пользователь';
143
+        $result->send();
144 144
     }
145 145
     $partners = App::$cur->users->getUserPartners(Users\User::$cur, 8);
146 146
     if (empty($partners['users'][$userId])) {
147
-      $result->success = FALSE;
148
-      $result->content = 'Этот пользователь не находится в вашей структуре';
149
-      $result->send();
147
+        $result->success = FALSE;
148
+        $result->content = 'Этот пользователь не находится в вашей структуре';
149
+        $result->send();
150 150
     }
151 151
     $user = $partners['users'][$userId];
152 152
     ob_start();
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
         'event' => 'Событие'
162 162
     ];
163 163
     foreach ($rewards as $reward) {
164
-      foreach ($reward->conditions as $condition) {
164
+        foreach ($reward->conditions as $condition) {
165 165
         $complete = $condition->checkComplete($userId);
166 166
         ?>
167 167
         <h5 class="<?= $complete ? 'text-success' : 'text-danger'; ?>"><?= $condition->name(); ?></h5>
168 168
         <ul>
169 169
           <?php
170
-          foreach ($condition->items as $item) {
170
+            foreach ($condition->items as $item) {
171 171
             $itemComplete = $item->checkComplete($userId);
172 172
             switch ($item->type) {
173
-              case 'event':
173
+                case 'event':
174 174
                 $name = \Events\Event::get($item->value, 'event')->name();
175 175
                 break;
176 176
             }
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
               <b class="<?= $itemComplete ? 'text-success' : 'text-danger'; ?>"><?= $name; ?> <?= $item->recivedCount($userId); ?></b>/<?= $item->count; ?> <br />
180 180
             </li>
181 181
             <?php
182
-          }
183
-          ?>
182
+            }
183
+            ?>
184 184
         </ul>
185 185
         <?php
186
-      }
186
+        }
187 187
     }
188 188
     $result->content = ob_get_contents();
189 189
     ob_end_clean();
190 190
     $result->send();
191
-  }
191
+    }
192 192
 
193 193
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     $sections = $this->module->getSnippets('cabinetSection');
21 21
     if (!empty($sections[$activeSection]['name'])) {
22
-      $this->view->setTitle($sections[$activeSection]['name'] . ' - Личный кабинет');
22
+      $this->view->setTitle($sections[$activeSection]['name'].' - Личный кабинет');
23 23
       $bread[] = ['text' => 'Личный кабинет', 'href' => '/users/cabinet'];
24 24
       $bread[] = ['text' => $sections[$activeSection]['name']];
25 25
     } else {
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
           Users\User::$cur->mail = $user_mail;
102 102
           if (!empty($this->module->config['needActivation'])) {
103 103
             Users\User::$cur->activation = Tools::randomString();
104
-            $from = 'noreply@' . INJI_DOMAIN_NAME;
104
+            $from = 'noreply@'.INJI_DOMAIN_NAME;
105 105
             $to = $user_mail;
106
-            $subject = 'Активация аккаунта на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME);
107
-            $text = 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://' . INJI_DOMAIN_NAME . '/users/activation/' . Users\User::$cur->id . '/' . Users\User::$cur->activation . '">http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/users/activation/' . Users\User::$cur->id . '/' . Users\User::$cur->activation . '</a>';
106
+            $subject = 'Активация аккаунта на сайте '.idn_to_utf8(INJI_DOMAIN_NAME);
107
+            $text = 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://'.INJI_DOMAIN_NAME.'/users/activation/'.Users\User::$cur->id.'/'.Users\User::$cur->activation.'">http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/users/activation/'.Users\User::$cur->id.'/'.Users\User::$cur->activation.'</a>';
108 108
             Tools::sendMail($from, $to, $subject, $text);
109 109
             Msg::add('На указанный почтовый ящик была выслана ваша ссылка для подтверждения E-Mail', 'success');
110 110
           } else {
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
     if (!$user->activation) {
127 127
       Tools::redirect('/', 'Пользователь уже активирован');
128 128
     }
129
-    $from = 'noreply@' . INJI_DOMAIN_NAME;
129
+    $from = 'noreply@'.INJI_DOMAIN_NAME;
130 130
     $to = $user->mail;
131
-    $subject = 'Активация аккаунта на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME);
132
-    $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>';
131
+    $subject = 'Активация аккаунта на сайте '.idn_to_utf8(INJI_DOMAIN_NAME);
132
+    $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>';
133 133
     Tools::sendMail($from, $to, $subject, $text);
134 134
     Tools::redirect('/', 'На указанный почтовый ящик была выслана ваша ссылка для подтверждения E-Mail', 'success');
135 135
   }
Please login to merge, or discard this patch.
system/modules/Users/objects/SocialHelper/Vk.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Vk extends \Users\SocialHelper {
15 15
 
16
-  public static function auth() {
16
+    public static function auth() {
17 17
     $config = static::getConfig();
18 18
     if (empty($_GET['code']) && empty($_GET['error'])) {
19
-      $query = [
20
-          'client_id' => $config['appId'],
21
-          'scope' => 'email',
22
-          'response_type' => 'code',
23
-          'display' => 'page',
24
-          'redirect_uri' => 'http://' . INJI_DOMAIN_NAME . '/users/social/auth/vk'
25
-      ];
26
-      \Tools::redirect("https://oauth.vk.com/authorize?" . http_build_query($query));
19
+        $query = [
20
+            'client_id' => $config['appId'],
21
+            'scope' => 'email',
22
+            'response_type' => 'code',
23
+            'display' => 'page',
24
+            'redirect_uri' => 'http://' . INJI_DOMAIN_NAME . '/users/social/auth/vk'
25
+        ];
26
+        \Tools::redirect("https://oauth.vk.com/authorize?" . http_build_query($query));
27 27
     }
28 28
     if (empty($_GET['code']) && !empty($_GET['error'])) {
29
-      \Tools::redirect('/', 'Произошла ошибка во время авторизации через соц. сеть: ' . $_GET['error_description']);
29
+        \Tools::redirect('/', 'Произошла ошибка во время авторизации через соц. сеть: ' . $_GET['error_description']);
30 30
     }
31 31
     $query = [
32 32
         'client_id' => $config['appId'],
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
     ];
37 37
     $result = @file_get_contents("https://oauth.vk.com/access_token?" . http_build_query($query));
38 38
     if ($result === false) {
39
-      \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
39
+        \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
40 40
     }
41 41
     $result = json_decode($result, true);
42 42
     if (empty($result['user_id'])) {
43
-      \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
43
+        \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
44 44
     }
45 45
     $userQuery = [
46 46
         'user_id' => $result['user_id'],
@@ -49,94 +49,94 @@  discard block
 block discarded – undo
49 49
     ];
50 50
     $userResult = @file_get_contents("https://api.vk.com/method/users.get?" . http_build_query($userQuery));
51 51
     if (!$userResult) {
52
-      \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
52
+        \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
53 53
     }
54 54
     $userDetail = json_decode($userResult, true);
55 55
     if (empty($userDetail['response'][0])) {
56
-      \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
56
+        \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
57 57
     }
58 58
     $social = static::getObject();
59 59
     $userSocial = \Users\User\Social::get([['uid', $result['user_id']], ['social_id', $social->id]]);
60 60
     if ($userSocial && $userSocial->user) {
61
-      \App::$cur->users->newSession($userSocial->user);
62
-      if (!empty(\App::$cur->users->config['loginUrl'][\App::$cur->type])) {
61
+        \App::$cur->users->newSession($userSocial->user);
62
+        if (!empty(\App::$cur->users->config['loginUrl'][\App::$cur->type])) {
63 63
         \Tools::redirect(\App::$cur->users->config['loginUrl'][\App::$cur->type]);
64
-      }
64
+        }
65 65
     } else {
66
-      if ($userSocial && !$userSocial->user) {
66
+        if ($userSocial && !$userSocial->user) {
67 67
         $userSocial->delete();
68
-      }
69
-      if (!\Users\User::$cur->id) {
68
+        }
69
+        if (!\Users\User::$cur->id) {
70 70
         $user = false;
71 71
         if (!empty($result['email'])) {
72
-          $user = \Users\User::get($result['email'], 'mail');
72
+            $user = \Users\User::get($result['email'], 'mail');
73 73
         }
74 74
         if (!$user) {
75
-          $user = new \Users\User();
76
-          $user->group_id = 2;
77
-          $user->role_id = 2;
78
-          if (!empty($result['email'])) {
75
+            $user = new \Users\User();
76
+            $user->group_id = 2;
77
+            $user->role_id = 2;
78
+            if (!empty($result['email'])) {
79 79
             $user->login = $user->mail = $result['email'];
80
-          }
81
-          $invite_code = (!empty($_POST['invite_code']) ? $_POST['invite_code'] : ((!empty($_COOKIE['invite_code']) ? $_COOKIE['invite_code'] : ((!empty($_GET['invite_code']) ? $_GET['invite_code'] : '')))));
82
-          if (!empty($invite_code)) {
80
+            }
81
+            $invite_code = (!empty($_POST['invite_code']) ? $_POST['invite_code'] : ((!empty($_COOKIE['invite_code']) ? $_COOKIE['invite_code'] : ((!empty($_GET['invite_code']) ? $_GET['invite_code'] : '')))));
82
+            if (!empty($invite_code)) {
83 83
             $invite = \Users\User\Invite::get($invite_code, 'code');
84 84
             $inveiteError = false;
85 85
             if (!$invite) {
86
-              Msg::add('Такой код пришлашения не найден', 'danger');
87
-              $inveiteError = true;
86
+                Msg::add('Такой код пришлашения не найден', 'danger');
87
+                $inveiteError = true;
88 88
             }
89 89
             if ($invite->limit && !($invite->limit - $invite->count)) {
90
-              Msg::add('Лимит приглашений для данного кода исчерпан', 'danger');
91
-              $inveiteError = true;
90
+                Msg::add('Лимит приглашений для данного кода исчерпан', 'danger');
91
+                $inveiteError = true;
92 92
             }
93 93
             if (!$inveiteError) {
94
-              $user->parent_id = $invite->user_id;
95
-              $invite->count++;
96
-              $invite->save();
94
+                $user->parent_id = $invite->user_id;
95
+                $invite->count++;
96
+                $invite->save();
97
+            }
97 98
             }
98
-          }
99
-          if (!$user->parent_id && !empty(\App::$cur->Users->config['defaultPartner'])) {
99
+            if (!$user->parent_id && !empty(\App::$cur->Users->config['defaultPartner'])) {
100 100
             $user->parent_id = \App::$cur->Users->config['defaultPartner'];
101
-          }
102
-          $user->save();
103
-          $userInfo = new \Users\User\Info();
104
-          $userInfo->user_id = $user->id;
105
-          $userInfo->save();
101
+            }
102
+            $user->save();
103
+            $userInfo = new \Users\User\Info();
104
+            $userInfo->user_id = $user->id;
105
+            $userInfo->save();
106 106
         }
107
-      } else {
107
+        } else {
108 108
         $user = \Users\User::$cur;
109
-      }
110
-      if (!$user->info->photo_file_id && !empty($userDetail['response'][0]['photo_max_orig'])) {
109
+        }
110
+        if (!$user->info->photo_file_id && !empty($userDetail['response'][0]['photo_max_orig'])) {
111 111
         $user->info->photo_file_id = \App::$cur->files->uploadFromUrl($userDetail['response'][0]['photo_max_orig']);
112
-      }
113
-      if (!$user->info->first_name && !empty($userDetail['response'][0]['first_name'])) {
112
+        }
113
+        if (!$user->info->first_name && !empty($userDetail['response'][0]['first_name'])) {
114 114
         $user->info->first_name = $userDetail['response'][0]['first_name'];
115
-      }
116
-      if (!$user->info->last_name && !empty($userDetail['response'][0]['last_name'])) {
115
+        }
116
+        if (!$user->info->last_name && !empty($userDetail['response'][0]['last_name'])) {
117 117
         $user->info->last_name = $userDetail['response'][0]['last_name'];
118
-      }
119
-      if (!$user->info->city && !empty($userDetail['response'][0]['home_town'])) {
118
+        }
119
+        if (!$user->info->city && !empty($userDetail['response'][0]['home_town'])) {
120 120
         $user->info->city = $userDetail['response'][0]['home_town'];
121
-      }
122
-      if (!$user->info->sex && !empty($userDetail['response'][0]['sex'])) {
121
+        }
122
+        if (!$user->info->sex && !empty($userDetail['response'][0]['sex'])) {
123 123
         $user->info->sex = $userDetail['response'][0]['sex'] == 2 ? 1 : ($userDetail['response'][0]['sex'] == 1 ? 2 : 0);
124
-      }
125
-      if ($user->info->bday == '0000-00-00' && !empty($userDetail['response'][0]['bdate'])) {
124
+        }
125
+        if ($user->info->bday == '0000-00-00' && !empty($userDetail['response'][0]['bdate'])) {
126 126
         $user->info->bday = substr_count($userDetail['response'][0]['bdate'], '.') == 2 ? \DateTime::createFromFormat('d.m.Y', $userDetail['response'][0]['bdate'])->format('Y-m-d') : (substr_count($userDetail['response'][0]['bdate'], '.') == 1 ? \DateTime::createFromFormat('d.m', $userDetail['response'][0]['bdate'])->format('Y-m-1') : '0000-00-00');
127
-      }
128
-      $user->info->save();
129
-      $userSocial = new \Users\User\Social();
130
-      $userSocial->uid = $result['user_id'];
131
-      $userSocial->social_id = $social->id;
132
-      $userSocial->user_id = $user->id;
133
-      $userSocial->save();
134
-      \App::$cur->users->newSession($user);
135
-      \Tools::redirect(\App::$cur->users->config['loginUrl'][\App::$cur->type], 'Вы успешно зарегистрировались через ВКонтакте', 'success');
127
+        }
128
+        $user->info->save();
129
+        $userSocial = new \Users\User\Social();
130
+        $userSocial->uid = $result['user_id'];
131
+        $userSocial->social_id = $social->id;
132
+        $userSocial->user_id = $user->id;
133
+        $userSocial->save();
134
+        \App::$cur->users->newSession($user);
135
+        \Tools::redirect(\App::$cur->users->config['loginUrl'][\App::$cur->type], 'Вы успешно зарегистрировались через ВКонтакте', 'success');
136
+    }
136 137
     }
137
-  }
138 138
 
139
-  public static function checkAppAccess() {
139
+    public static function checkAppAccess() {
140 140
     $viewer_id = filter_input(INPUT_GET, 'viewer_id', FILTER_SANITIZE_NUMBER_INT);
141 141
     $get_auth_key = filter_input(INPUT_GET, 'auth_key', FILTER_SANITIZE_STRING);
142 142
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     $auth_key = md5($config['appId'] . '_' . $viewer_id . '_' . $config['secret']);
146 146
 
147 147
     if ($auth_key !== $get_auth_key) {
148
-      return FALSE;
148
+        return FALSE;
149 149
     }
150 150
     $userQuery = [
151 151
         'user_id' => $viewer_id,
@@ -157,25 +157,25 @@  discard block
 block discarded – undo
157 157
 
158 158
     $socUser = \Users\User\Social::get([['social_id', $object->pk()], ['uid', $viewer_id]]);
159 159
     if (!$socUser) {
160
-      $user = new \Users\User();
161
-      $user->login = $userResult['response'][0]['domain'];
162
-      $user->save();
163
-      $info = new \Users\User\Info();
164
-      $info->user_id = $user->id;
165
-      $info->sex = $userResult['response'][0]['sex'] == 2 ? 1 : ($userResult['response'][0]['sex'] == 1 ? 2 : 0);
166
-      $info->first_name = $userResult['response'][0]['first_name'];
167
-      $info->last_name = $userResult['response'][0]['last_name'];
168
-      $info->photo_file_id = \App::$cur->files->uploadFromUrl($userResult['response'][0]['photo_200_orig'], ['accept_group' => 'image']);
169
-      $info->save();
170
-      $social = new \Users\User\Social();
171
-      $social->user_id = $user->id;
172
-      $social->social_id = 1;
173
-      $social->uid = $userResult['response'][0]['uid'];
174
-      $social->save();
160
+        $user = new \Users\User();
161
+        $user->login = $userResult['response'][0]['domain'];
162
+        $user->save();
163
+        $info = new \Users\User\Info();
164
+        $info->user_id = $user->id;
165
+        $info->sex = $userResult['response'][0]['sex'] == 2 ? 1 : ($userResult['response'][0]['sex'] == 1 ? 2 : 0);
166
+        $info->first_name = $userResult['response'][0]['first_name'];
167
+        $info->last_name = $userResult['response'][0]['last_name'];
168
+        $info->photo_file_id = \App::$cur->files->uploadFromUrl($userResult['response'][0]['photo_200_orig'], ['accept_group' => 'image']);
169
+        $info->save();
170
+        $social = new \Users\User\Social();
171
+        $social->user_id = $user->id;
172
+        $social->social_id = 1;
173
+        $social->uid = $userResult['response'][0]['uid'];
174
+        $social->save();
175 175
     } else {
176
-      $user = $socUser->user;
176
+        $user = $socUser->user;
177 177
     }
178 178
     return $user;
179
-  }
179
+    }
180 180
 
181 181
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
           'scope' => 'email',
22 22
           'response_type' => 'code',
23 23
           'display' => 'page',
24
-          'redirect_uri' => 'http://' . INJI_DOMAIN_NAME . '/users/social/auth/vk'
24
+          'redirect_uri' => 'http://'.INJI_DOMAIN_NAME.'/users/social/auth/vk'
25 25
       ];
26
-      \Tools::redirect("https://oauth.vk.com/authorize?" . http_build_query($query));
26
+      \Tools::redirect("https://oauth.vk.com/authorize?".http_build_query($query));
27 27
     }
28 28
     if (empty($_GET['code']) && !empty($_GET['error'])) {
29
-      \Tools::redirect('/', 'Произошла ошибка во время авторизации через соц. сеть: ' . $_GET['error_description']);
29
+      \Tools::redirect('/', 'Произошла ошибка во время авторизации через соц. сеть: '.$_GET['error_description']);
30 30
     }
31 31
     $query = [
32 32
         'client_id' => $config['appId'],
33 33
         'client_secret' => $config['secret'],
34 34
         'code' => $_GET['code'],
35
-        'redirect_uri' => 'http://' . INJI_DOMAIN_NAME . '/users/social/auth/vk'
35
+        'redirect_uri' => 'http://'.INJI_DOMAIN_NAME.'/users/social/auth/vk'
36 36
     ];
37
-    $result = @file_get_contents("https://oauth.vk.com/access_token?" . http_build_query($query));
37
+    $result = @file_get_contents("https://oauth.vk.com/access_token?".http_build_query($query));
38 38
     if ($result === false) {
39 39
       \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
40 40
     }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         'fields' => 'sex, bdate, photo_max_orig, home_town',
48 48
         'access_token' => $result['access_token']
49 49
     ];
50
-    $userResult = @file_get_contents("https://api.vk.com/method/users.get?" . http_build_query($userQuery));
50
+    $userResult = @file_get_contents("https://api.vk.com/method/users.get?".http_build_query($userQuery));
51 51
     if (!$userResult) {
52 52
       \Tools::redirect('/', 'Во время авторизации произошли ошибки', 'danger');
53 53
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     $config = static::getConfig();
144 144
 
145
-    $auth_key = md5($config['appId'] . '_' . $viewer_id . '_' . $config['secret']);
145
+    $auth_key = md5($config['appId'].'_'.$viewer_id.'_'.$config['secret']);
146 146
 
147 147
     if ($auth_key !== $get_auth_key) {
148 148
       return FALSE;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         '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',
153 153
         'access_token' => filter_input(INPUT_GET, 'access_token', FILTER_SANITIZE_STRING)
154 154
     ];
155
-    $userResult = json_decode(@file_get_contents("https://api.vk.com/method/users.get?" . http_build_query($userQuery)), true);
155
+    $userResult = json_decode(@file_get_contents("https://api.vk.com/method/users.get?".http_build_query($userQuery)), true);
156 156
     $object = static::getObject();
157 157
 
158 158
     $socUser = \Users\User\Social::get([['social_id', $object->pk()], ['uid', $viewer_id]]);
Please login to merge, or discard this patch.
system/modules/Users/objects/SocialHelper/Twitter.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Twitter extends \Users\SocialHelper {
15 15
 
16
-  private static function requestToken() {
16
+    private static function requestToken() {
17 17
     $config = static::getConfig();
18 18
     $oauthNonce = md5(uniqid(rand(), true));
19 19
     $oauthTimestamp = time();
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
     $response = file_get_contents($url);
40 40
     parse_str($response, $result);
41 41
     return $result;
42
-  }
42
+    }
43 43
 
44
-  private static function verify() {
44
+    private static function verify() {
45 45
     $config = static::getConfig();
46 46
     $oauthNonce = md5(uniqid(rand(), true));
47 47
     $oauthTimestamp = time();
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
     $response = file_get_contents($url);
77 77
     parse_str($response, $result);
78 78
     return $result;
79
-  }
79
+    }
80 80
 
81
-  private static function getInfo($result) {
81
+    private static function getInfo($result) {
82 82
     $config = static::getConfig();
83 83
     $oauth_nonce = md5(uniqid(rand(), true));
84 84
     $oauth_timestamp = time();
@@ -114,82 +114,82 @@  discard block
 block discarded – undo
114 114
     $response = file_get_contents($url);
115 115
 
116 116
     return json_decode($response, true);
117
-  }
117
+    }
118 118
 
119
-  public static function auth() {
119
+    public static function auth() {
120 120
     $config = static::getConfig();
121 121
     if (empty($_GET['oauth_verifier']) || empty($_SESSION['oauth_token_secret'])) {
122
-      $tokens = self::requestToken();
123
-      $_SESSION['oauth_token_secret'] = $tokens['oauth_token_secret'];
124
-      \Tools::redirect("https://api.twitter.com/oauth/authorize?oauth_token={$tokens['oauth_token']}");
122
+        $tokens = self::requestToken();
123
+        $_SESSION['oauth_token_secret'] = $tokens['oauth_token_secret'];
124
+        \Tools::redirect("https://api.twitter.com/oauth/authorize?oauth_token={$tokens['oauth_token']}");
125 125
     }
126 126
     $verify = static::verify();
127 127
 
128 128
     if (!$verify['user_id']) {
129
-      \Tools::redirect('/', 'Не удалось авторизоваться через twitter');
129
+        \Tools::redirect('/', 'Не удалось авторизоваться через twitter');
130 130
     }
131 131
     $userDetail = static::getInfo($verify);
132 132
 
133 133
     $social = static::getObject();
134 134
     $userSocial = \Users\User\Social::get([['uid', $userDetail['id']], ['social_id', $social->id]]);
135 135
     if ($userSocial && $userSocial->user) {
136
-      \App::$cur->users->newSession($userSocial->user);
137
-      if (!empty(\App::$cur->users->config['loginUrl'][\App::$cur->type])) {
136
+        \App::$cur->users->newSession($userSocial->user);
137
+        if (!empty(\App::$cur->users->config['loginUrl'][\App::$cur->type])) {
138 138
         \Tools::redirect(\App::$cur->users->config['loginUrl'][\App::$cur->type]);
139
-      }
139
+        }
140 140
     } else {
141
-      if ($userSocial && !$userSocial->user) {
141
+        if ($userSocial && !$userSocial->user) {
142 142
         $userSocial->delete();
143
-      }
144
-      if (!\Users\User::$cur->id) {
143
+        }
144
+        if (!\Users\User::$cur->id) {
145 145
         $user = new \Users\User();
146 146
         $user->group_id = 2;
147 147
         $user->role_id = 2;
148 148
         $invite_code = (!empty($_POST['invite_code']) ? $_POST['invite_code'] : ((!empty($_COOKIE['invite_code']) ? $_COOKIE['invite_code'] : ((!empty($_GET['invite_code']) ? $_GET['invite_code'] : '')))));
149 149
         if (!empty($invite_code)) {
150
-          $invite = \Users\User\Invite::get($invite_code, 'code');
151
-          $inveiteError = false;
152
-          if (!$invite) {
150
+            $invite = \Users\User\Invite::get($invite_code, 'code');
151
+            $inveiteError = false;
152
+            if (!$invite) {
153 153
             Msg::add('Такой код пришлашения не найден', 'danger');
154 154
             $inveiteError = true;
155
-          }
156
-          if ($invite->limit && !($invite->limit - $invite->count)) {
155
+            }
156
+            if ($invite->limit && !($invite->limit - $invite->count)) {
157 157
             Msg::add('Лимит приглашений для данного кода исчерпан', 'danger');
158 158
             $inveiteError = true;
159
-          }
160
-          if (!$inveiteError) {
159
+            }
160
+            if (!$inveiteError) {
161 161
             $user->parent_id = $invite->user_id;
162 162
             $invite->count++;
163 163
             $invite->save();
164
-          }
164
+            }
165 165
         }
166 166
         if (!$user->parent_id && !empty(\App::$cur->Users->config['defaultPartner'])) {
167
-          $user->parent_id = \App::$cur->Users->config['defaultPartner'];
167
+            $user->parent_id = \App::$cur->Users->config['defaultPartner'];
168 168
         }
169 169
         $user->save();
170 170
         $userInfo = new \Users\User\Info();
171 171
         $userInfo->user_id = $user->id;
172 172
         $userInfo->save();
173
-      } else {
173
+        } else {
174 174
         $user = \Users\User::$cur;
175
-      }
176
-      $name = explode(' ', $userDetail['name']);
177
-      $user->info->first_name = $name[0];
178
-      $user->info->last_name = $name[1];
179
-      $user->info->city = $userDetail['location'];
180
-      $user->info->save();
181
-      $userSocial = new \Users\User\Social();
182
-      $userSocial->uid = $userDetail['id'];
183
-      $userSocial->social_id = $social->id;
184
-      $userSocial->user_id = $user->id;
185
-      $userSocial->save();
186
-      \App::$cur->users->newSession($user);
187
-      if (!empty(\App::$cur->users->config['loginUrl'][\App::$cur->type])) {
175
+        }
176
+        $name = explode(' ', $userDetail['name']);
177
+        $user->info->first_name = $name[0];
178
+        $user->info->last_name = $name[1];
179
+        $user->info->city = $userDetail['location'];
180
+        $user->info->save();
181
+        $userSocial = new \Users\User\Social();
182
+        $userSocial->uid = $userDetail['id'];
183
+        $userSocial->social_id = $social->id;
184
+        $userSocial->user_id = $user->id;
185
+        $userSocial->save();
186
+        \App::$cur->users->newSession($user);
187
+        if (!empty(\App::$cur->users->config['loginUrl'][\App::$cur->type])) {
188 188
         \Tools::redirect(\App::$cur->users->config['loginUrl'][\App::$cur->type], 'Вы успешно зарегистрировались через Twitter', 'success');
189
-      } else {
189
+        } else {
190 190
         \Tools::redirect('/users/cabinet/profile', 'Вы успешно зарегистрировались через Twitter', 'success');
191
-      }
191
+        }
192
+    }
192 193
     }
193
-  }
194 194
 
195 195
 }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
     $oauthTimestamp = time();
20 20
     //string
21 21
     $oauth_base_text = "GET&";
22
-    $oauth_base_text .= urlencode('https://api.twitter.com/oauth/request_token') . "&";
23
-    $oauth_base_text .= urlencode("oauth_callback=" . urlencode('http://' . INJI_DOMAIN_NAME . '/users/social/auth/twitter') . "&");
24
-    $oauth_base_text .= urlencode("oauth_consumer_key=" . $config['consumer_key'] . "&");
25
-    $oauth_base_text .= urlencode("oauth_nonce=" . $oauthNonce . "&");
22
+    $oauth_base_text .= urlencode('https://api.twitter.com/oauth/request_token')."&";
23
+    $oauth_base_text .= urlencode("oauth_callback=".urlencode('http://'.INJI_DOMAIN_NAME.'/users/social/auth/twitter')."&");
24
+    $oauth_base_text .= urlencode("oauth_consumer_key=".$config['consumer_key']."&");
25
+    $oauth_base_text .= urlencode("oauth_nonce=".$oauthNonce."&");
26 26
     $oauth_base_text .= urlencode("oauth_signature_method=HMAC-SHA1&");
27
-    $oauth_base_text .= urlencode("oauth_timestamp=" . $oauthTimestamp . "&");
27
+    $oauth_base_text .= urlencode("oauth_timestamp=".$oauthTimestamp."&");
28 28
     $oauth_base_text .= urlencode("oauth_version=1.0");
29
-    $oauthSignature = base64_encode(hash_hmac("sha1", $oauth_base_text, $config['consumer_secret'] . "&", true));
29
+    $oauthSignature = base64_encode(hash_hmac("sha1", $oauth_base_text, $config['consumer_secret']."&", true));
30 30
     //request
31 31
     $url = 'https://api.twitter.com/oauth/request_token';
32
-    $url .= '?oauth_callback=' . urlencode('http://' . INJI_DOMAIN_NAME . '/users/social/auth/twitter');
33
-    $url .= '&oauth_consumer_key=' . $config['consumer_key'];
34
-    $url .= '&oauth_nonce=' . $oauthNonce;
35
-    $url .= '&oauth_signature=' . urlencode($oauthSignature);
32
+    $url .= '?oauth_callback='.urlencode('http://'.INJI_DOMAIN_NAME.'/users/social/auth/twitter');
33
+    $url .= '&oauth_consumer_key='.$config['consumer_key'];
34
+    $url .= '&oauth_nonce='.$oauthNonce;
35
+    $url .= '&oauth_signature='.urlencode($oauthSignature);
36 36
     $url .= '&oauth_signature_method=HMAC-SHA1';
37
-    $url .= '&oauth_timestamp=' . $oauthTimestamp;
37
+    $url .= '&oauth_timestamp='.$oauthTimestamp;
38 38
     $url .= '&oauth_version=1.0';
39 39
     $response = file_get_contents($url);
40 40
     parse_str($response, $result);
@@ -50,26 +50,26 @@  discard block
 block discarded – undo
50 50
     $oauth_token_secret = $_SESSION['oauth_token_secret'];
51 51
     //string
52 52
     $oauth_base_text = "GET&";
53
-    $oauth_base_text .= urlencode('https://api.twitter.com/oauth/access_token') . "&";
54
-    $oauth_base_text .= urlencode("oauth_consumer_key=" . $config['consumer_key'] . "&");
55
-    $oauth_base_text .= urlencode("oauth_nonce=" . $oauthNonce . "&");
53
+    $oauth_base_text .= urlencode('https://api.twitter.com/oauth/access_token')."&";
54
+    $oauth_base_text .= urlencode("oauth_consumer_key=".$config['consumer_key']."&");
55
+    $oauth_base_text .= urlencode("oauth_nonce=".$oauthNonce."&");
56 56
     $oauth_base_text .= urlencode("oauth_signature_method=HMAC-SHA1&");
57
-    $oauth_base_text .= urlencode("oauth_token=" . $oauth_token . "&");
58
-    $oauth_base_text .= urlencode("oauth_timestamp=" . $oauthTimestamp . "&");
59
-    $oauth_base_text .= urlencode("oauth_verifier=" . $oauth_verifier . "&");
57
+    $oauth_base_text .= urlencode("oauth_token=".$oauth_token."&");
58
+    $oauth_base_text .= urlencode("oauth_timestamp=".$oauthTimestamp."&");
59
+    $oauth_base_text .= urlencode("oauth_verifier=".$oauth_verifier."&");
60 60
     $oauth_base_text .= urlencode("oauth_version=1.0");
61 61
 
62
-    $key = $config['consumer_secret'] . "&" . $oauth_token_secret;
62
+    $key = $config['consumer_secret']."&".$oauth_token_secret;
63 63
     //request
64 64
     $oauth_signature = base64_encode(hash_hmac("sha1", $oauth_base_text, $key, true));
65 65
     $url = 'https://api.twitter.com/oauth/access_token';
66
-    $url .= '?oauth_nonce=' . $oauthNonce;
66
+    $url .= '?oauth_nonce='.$oauthNonce;
67 67
     $url .= '&oauth_signature_method=HMAC-SHA1';
68
-    $url .= '&oauth_timestamp=' . $oauthTimestamp;
69
-    $url .= '&oauth_consumer_key=' . $config['consumer_key'];
70
-    $url .= '&oauth_token=' . urlencode($oauth_token);
71
-    $url .= '&oauth_verifier=' . urlencode($oauth_verifier);
72
-    $url .= '&oauth_signature=' . urlencode($oauth_signature);
68
+    $url .= '&oauth_timestamp='.$oauthTimestamp;
69
+    $url .= '&oauth_consumer_key='.$config['consumer_key'];
70
+    $url .= '&oauth_token='.urlencode($oauth_token);
71
+    $url .= '&oauth_verifier='.urlencode($oauth_verifier);
72
+    $url .= '&oauth_signature='.urlencode($oauth_signature);
73 73
     $url .= '&oauth_version=1.0';
74 74
 
75 75
 
@@ -88,28 +88,28 @@  discard block
 block discarded – undo
88 88
     $screen_name = $result['screen_name'];
89 89
 
90 90
     $oauth_base_text = "GET&";
91
-    $oauth_base_text .= urlencode('https://api.twitter.com/1.1/users/show.json') . '&';
92
-    $oauth_base_text .= urlencode('oauth_consumer_key=' . $config['consumer_key'] . '&');
93
-    $oauth_base_text .= urlencode('oauth_nonce=' . $oauth_nonce . '&');
91
+    $oauth_base_text .= urlencode('https://api.twitter.com/1.1/users/show.json').'&';
92
+    $oauth_base_text .= urlencode('oauth_consumer_key='.$config['consumer_key'].'&');
93
+    $oauth_base_text .= urlencode('oauth_nonce='.$oauth_nonce.'&');
94 94
     $oauth_base_text .= urlencode('oauth_signature_method=HMAC-SHA1&');
95
-    $oauth_base_text .= urlencode('oauth_timestamp=' . $oauth_timestamp . "&");
96
-    $oauth_base_text .= urlencode('oauth_token=' . $oauth_token . "&");
95
+    $oauth_base_text .= urlencode('oauth_timestamp='.$oauth_timestamp."&");
96
+    $oauth_base_text .= urlencode('oauth_token='.$oauth_token."&");
97 97
     $oauth_base_text .= urlencode('oauth_version=1.0&');
98
-    $oauth_base_text .= urlencode('screen_name=' . $screen_name);
98
+    $oauth_base_text .= urlencode('screen_name='.$screen_name);
99 99
 
100
-    $key = $config['consumer_secret'] . '&' . $oauth_token_secret;
100
+    $key = $config['consumer_secret'].'&'.$oauth_token_secret;
101 101
     $signature = base64_encode(hash_hmac("sha1", $oauth_base_text, $key, true));
102 102
 
103 103
 
104 104
     $url = 'https://api.twitter.com/1.1/users/show.json';
105
-    $url .= '?oauth_consumer_key=' . $config['consumer_key'];
106
-    $url .= '&oauth_nonce=' . $oauth_nonce;
107
-    $url .= '&oauth_signature=' . urlencode($signature);
105
+    $url .= '?oauth_consumer_key='.$config['consumer_key'];
106
+    $url .= '&oauth_nonce='.$oauth_nonce;
107
+    $url .= '&oauth_signature='.urlencode($signature);
108 108
     $url .= '&oauth_signature_method=HMAC-SHA1';
109
-    $url .= '&oauth_timestamp=' . $oauth_timestamp;
110
-    $url .= '&oauth_token=' . urlencode($oauth_token);
109
+    $url .= '&oauth_timestamp='.$oauth_timestamp;
110
+    $url .= '&oauth_token='.urlencode($oauth_token);
111 111
     $url .= '&oauth_version=1.0';
112
-    $url .= '&screen_name=' . $screen_name;
112
+    $url .= '&screen_name='.$screen_name;
113 113
 
114 114
     $response = file_get_contents($url);
115 115
 
Please login to merge, or discard this patch.
system/modules/Ui/widgets/Form/date.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
     'value' => !empty($options['value']) ? addcslashes($options['value'], "'") : (!empty($form->userDataTree[$name]) ? addcslashes($form->userDataTree[$name], "'") : '')
10 10
 ];
11 11
 if (!empty($options['disabled'])) {
12
-  $attributes['disabled'] = 'disabled';
12
+    $attributes['disabled'] = 'disabled';
13 13
 }
14 14
 if (!empty($options['placeholder'])) {
15
-  $attributes['placeholder'] = $options['placeholder'];
15
+    $attributes['placeholder'] = $options['placeholder'];
16 16
 }
17 17
 if (!empty($options['checked'])) {
18
-  $attributes['checked'] = 'checked';
18
+    $attributes['checked'] = 'checked';
19 19
 }
20 20
 if (!empty($options['attributes'])) {
21
-  $attributes = array_merge($attributes, $options['attributes']);
21
+    $attributes = array_merge($attributes, $options['attributes']);
22 22
 }
23 23
 echo Html::el('input', $attributes, '', null);
24 24
 echo!empty($options['helpText']) ? "<div class='help-block'>{$options['helpText']}</div>" : '';
Please login to merge, or discard this patch.