Completed
Push — 1.10.x ( 986d2b...f19030 )
by Angel Fernando Quiroz
69:29 queued 19:50
created
plugin/advanced_subscription/src/HookAdvancedSubscription.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
68 68
 
69 69
         } elseif ($data['type'] === HOOK_EVENT_TYPE_POST) {
70
-           /** @var \nusoap_server $server */
70
+            /** @var \nusoap_server $server */
71 71
             $server = &$data['server'];
72 72
 
73 73
             /** WSSessionListInCategory */
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         }
425 425
         if (!WSHelperVerifyKey($params)) {
426 426
 
427
-           //return return_error(WS_ERROR_SECRET_KEY);
427
+            //return return_error(WS_ERROR_SECRET_KEY);
428 428
         }
429 429
         // Check if category ID is set
430 430
         if (!empty($params['id']) && empty($params['name'])) {
Please login to merge, or discard this patch.
plugin/resubscription/src/HookResubscription.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
             $resubscriptionLimit = Resubscription::create()->get('resubscription_limit');
33 33
 
34
-             // Initialize variables as a calendar year by default
34
+                // Initialize variables as a calendar year by default
35 35
             $limitDateFormat = 'Y-01-01';
36 36
             $limitDate = gmdate($limitDateFormat);
37 37
             $resubscriptionOffset = "1 year";
Please login to merge, or discard this patch.
plugin/kannelsms/vendor/kannelsms_api.php 1 patch
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 if ( !class_exists('KannelException') ) {
13
-  require_once('exception.php');
13
+    require_once('exception.php');
14 14
 }
15 15
 
16 16
 /**
@@ -21,130 +21,130 @@  discard block
 block discarded – undo
21 21
 */
22 22
 class Kannel {
23 23
 
24
-  /*
24
+    /*
25 25
   * Version of this class
26 26
   */
27
-  const VERSION           = '1.3.1';
28
-
29
-  /**
30
-  * All Kannel API calls start with BASE_URL
31
-  * @author  Martin Steel
32
-  */
33
-  const API_BASE_URL      = 'api.kannelsms.com/xml/';
34
-
35
-  /**
36
-  * string to append to API_BASE_URL to check authentication
37
-  * @author  Martin Steel
38
-  */
39
-  const API_AUTH_METHOD   = 'authenticate';
40
-
41
-  /**
42
-  * string to append to API_BASE_URL for sending SMS
43
-  * @author  Martin Steel
44
-  */
45
-  const API_SMS_METHOD    = 'sms';
46
-
47
-  /**
48
-  * string to append to API_BASE_URL for checking message credit
49
-  * @author  Martin Steel
50
-  */
51
-  const API_CREDIT_METHOD = 'credit';
52
-
53
-  /**
54
-  * string to append to API_BASE_URL for checking account balance
55
-  * @author  Martin Steel
56
-  */
57
-  const API_BALANCE_METHOD = 'balance';
58
-
59
-  /** 
60
-  * Kannel API Key
61
-  * 
62
-  * @var string
63
-  * @author  Martin Steel
64
-  */
65
-  public $key;
66
-
67
-  /**
68
-  * Use SSL when making HTTP requests
69
-  *
70
-  * If this is not set, SSL will be used where PHP supports it
71
-  *
72
-  * @var bool
73
-  * @author  Martin Steel
74
-  */
75
-  public $ssl;
76
-
77
-  /**
78
-  * Proxy server hostname (Optional)
79
-  *
80
-  * @var string
81
-  * @author  Martin Steel
82
-  */
83
-  public $proxy_host;
84
-
85
-  /**
86
-  * Proxy server port (Optional)
87
-  *
88
-  * @var integer
89
-  * @author  Martin Steel
90
-  */
91
-  public $proxy_port;
92
-
93
-  /**
94
-  * From address used on text messages
95
-  *
96
-  * @var string (11 characters or 12 numbers)
97
-  * @author  Martin Steel
98
-  */
99
-  public $from;
100
-
101
-  /**
102
-  * Allow long SMS messages (Cost up to 3 credits)
103
-  *
104
-  * @var bool
105
-  * @author  Martin Steel
106
-  */
107
-  public $long;
108
-
109
-  /**
110
-  * Truncate message text if it is too long
111
-  *
112
-  * @var bool
113
-  * @author  Martin Steel
114
-  */
115
-  public $truncate;
116
-
117
-  /**
118
-  * Enables various logging of messages when true.
119
-  *
120
-  * @var bool
121
-  * @author  Martin Steel
122
-  */
123
-  public $log;
124
-
125
-  /**
126
-  * What Kannel should do if you send an invalid character
127
-  *
128
-  * Possible values:
129
-  *      'error'     - Return an error (Messasge is not sent)
130
-  *      'remove'    - Remove the invalid character(s)
131
-  *      'replace'   - Replace invalid characters where possible, remove others 
132
-  * @author  Martin Steel
133
-  */
134
-  public $invalid_char_action;
135
-
136
-  /**
137
-  * Create a new instance of the Kannel wrapper
138
-  *
139
-  * @param   string  key         Your Kannel API Key
140
-  * @param   array   options     Optional parameters for sending SMS
141
-  * @author  Martin Steel
142
-  */
143
-  public function __construct($key, array $options = array()) {
27
+    const VERSION           = '1.3.1';
28
+
29
+    /**
30
+     * All Kannel API calls start with BASE_URL
31
+     * @author  Martin Steel
32
+     */
33
+    const API_BASE_URL      = 'api.kannelsms.com/xml/';
34
+
35
+    /**
36
+     * string to append to API_BASE_URL to check authentication
37
+     * @author  Martin Steel
38
+     */
39
+    const API_AUTH_METHOD   = 'authenticate';
40
+
41
+    /**
42
+     * string to append to API_BASE_URL for sending SMS
43
+     * @author  Martin Steel
44
+     */
45
+    const API_SMS_METHOD    = 'sms';
46
+
47
+    /**
48
+     * string to append to API_BASE_URL for checking message credit
49
+     * @author  Martin Steel
50
+     */
51
+    const API_CREDIT_METHOD = 'credit';
52
+
53
+    /**
54
+     * string to append to API_BASE_URL for checking account balance
55
+     * @author  Martin Steel
56
+     */
57
+    const API_BALANCE_METHOD = 'balance';
58
+
59
+    /** 
60
+     * Kannel API Key
61
+     * 
62
+     * @var string
63
+     * @author  Martin Steel
64
+     */
65
+    public $key;
66
+
67
+    /**
68
+     * Use SSL when making HTTP requests
69
+     *
70
+     * If this is not set, SSL will be used where PHP supports it
71
+     *
72
+     * @var bool
73
+     * @author  Martin Steel
74
+     */
75
+    public $ssl;
76
+
77
+    /**
78
+     * Proxy server hostname (Optional)
79
+     *
80
+     * @var string
81
+     * @author  Martin Steel
82
+     */
83
+    public $proxy_host;
84
+
85
+    /**
86
+     * Proxy server port (Optional)
87
+     *
88
+     * @var integer
89
+     * @author  Martin Steel
90
+     */
91
+    public $proxy_port;
92
+
93
+    /**
94
+     * From address used on text messages
95
+     *
96
+     * @var string (11 characters or 12 numbers)
97
+     * @author  Martin Steel
98
+     */
99
+    public $from;
100
+
101
+    /**
102
+     * Allow long SMS messages (Cost up to 3 credits)
103
+     *
104
+     * @var bool
105
+     * @author  Martin Steel
106
+     */
107
+    public $long;
108
+
109
+    /**
110
+     * Truncate message text if it is too long
111
+     *
112
+     * @var bool
113
+     * @author  Martin Steel
114
+     */
115
+    public $truncate;
116
+
117
+    /**
118
+     * Enables various logging of messages when true.
119
+     *
120
+     * @var bool
121
+     * @author  Martin Steel
122
+     */
123
+    public $log;
124
+
125
+    /**
126
+     * What Kannel should do if you send an invalid character
127
+     *
128
+     * Possible values:
129
+     *      'error'     - Return an error (Messasge is not sent)
130
+     *      'remove'    - Remove the invalid character(s)
131
+     *      'replace'   - Replace invalid characters where possible, remove others 
132
+     * @author  Martin Steel
133
+     */
134
+    public $invalid_char_action;
135
+
136
+    /**
137
+     * Create a new instance of the Kannel wrapper
138
+     *
139
+     * @param   string  key         Your Kannel API Key
140
+     * @param   array   options     Optional parameters for sending SMS
141
+     * @author  Martin Steel
142
+     */
143
+    public function __construct($key, array $options = array()) {
144 144
     if (empty($key)) {
145
-      throw new KannelException("Key can't be blank");
145
+        throw new KannelException("Key can't be blank");
146 146
     } else {
147
-      $this->key = $key;
147
+        $this->key = $key;
148 148
     }
149 149
         
150 150
     $this->ssl                  = (array_key_exists('ssl', $options)) ? $options['ssl'] : null;
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
     $this->truncate             = (array_key_exists('truncate', $options)) ? $options['truncate'] : null;
156 156
     $this->invalid_char_action  = (array_key_exists('invalid_char_action', $options)) ? $options['invalid_char_action'] : null;
157 157
     $this->log                  = (array_key_exists('log', $options)) ? $options['log'] : false;
158
-  }
158
+    }
159 159
 
160
-  /**
161
-  * Send some text messages
162
-  * 
163
-  *
164
-  * @author  Martin Steel
165
-  */
166
-  public function send(array $sms) {
160
+    /**
161
+     * Send some text messages
162
+     * 
163
+     *
164
+     * @author  Martin Steel
165
+     */
166
+    public function send(array $sms) {
167 167
     if (!is_array($sms)) {
168
-      throw new KannelException("sms parameter must be an array");
168
+        throw new KannelException("sms parameter must be an array");
169 169
     }
170 170
     $single_message = $this->is_assoc($sms);
171 171
 
172 172
     if ($single_message) {
173
-      $sms = array($sms);
173
+        $sms = array($sms);
174 174
     }
175 175
 
176 176
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
@@ -182,70 +182,70 @@  discard block
 block discarded – undo
182 182
     $root->appendChild($user_node);
183 183
 
184 184
     for ($i = 0; $i < count($sms); $i++) {
185
-      $single = $sms[$i];
185
+        $single = $sms[$i];
186 186
 
187
-      $sms_node = $req_doc->createElement('SMS');
187
+        $sms_node = $req_doc->createElement('SMS');
188 188
            
189
-      // Phone number
190
-      $sms_node->appendChild($req_doc->createElement('To', $single['to'])); 
189
+        // Phone number
190
+        $sms_node->appendChild($req_doc->createElement('To', $single['to'])); 
191 191
             
192
-      // Message text
193
-      $content_node = $req_doc->createElement('Content');
194
-      $content_node->appendChild($req_doc->createTextNode($single['message']));
195
-      $sms_node->appendChild($content_node);
192
+        // Message text
193
+        $content_node = $req_doc->createElement('Content');
194
+        $content_node->appendChild($req_doc->createTextNode($single['message']));
195
+        $sms_node->appendChild($content_node);
196 196
 
197
-      // From
198
-      if (array_key_exists('from', $single) || isset($this->from)) {
197
+        // From
198
+        if (array_key_exists('from', $single) || isset($this->from)) {
199 199
         $from_node = $req_doc->createElement('From');
200 200
         $from_node->appendChild($req_doc->createTextNode(array_key_exists('from', $single) ? $single['from'] : $this->from));
201 201
         $sms_node->appendChild($from_node);
202
-      }
202
+        }
203 203
 
204
-      // Client ID
205
-      if (array_key_exists('client_id', $single)) {
204
+        // Client ID
205
+        if (array_key_exists('client_id', $single)) {
206 206
         $client_id_node = $req_doc->createElement('ClientID');
207 207
         $client_id_node->appendChild($req_doc->createTextNode($single['client_id']));
208 208
         $sms_node->appendChild($client_id_node);
209
-      }
209
+        }
210 210
 
211
-      // Long
212
-      if (array_key_exists('long', $single) || isset($this->long)) {
211
+        // Long
212
+        if (array_key_exists('long', $single) || isset($this->long)) {
213 213
         $long = array_key_exists('long', $single) ? $single['long'] : $this->long;
214 214
         $long_node = $req_doc->createElement('Long');
215 215
         $long_node->appendChild($req_doc->createTextNode($long ? 1 : 0));
216 216
         $sms_node->appendChild($long_node);
217
-      }
217
+        }
218 218
 
219
-      // Truncate
220
-      if (array_key_exists('truncate', $single) || isset($this->truncate)) {
219
+        // Truncate
220
+        if (array_key_exists('truncate', $single) || isset($this->truncate)) {
221 221
         $truncate = array_key_exists('truncate', $single) ? $single['truncate'] : $this->truncate;
222 222
         $trunc_node = $req_doc->createElement('Truncate');
223 223
         $trunc_node->appendChild($req_doc->createTextNode($truncate ? 1 : 0));
224 224
         $sms_node->appendChild($trunc_node);
225
-      }
225
+        }
226 226
 
227
-      // Invalid Char Action
228
-      if (array_key_exists('invalid_char_action', $single) || isset($this->invalid_char_action)) {
227
+        // Invalid Char Action
228
+        if (array_key_exists('invalid_char_action', $single) || isset($this->invalid_char_action)) {
229 229
         $action = array_key_exists('invalid_char_action', $single) ? $single['invalid_char_action'] : $this->invalid_char_action;
230 230
         switch (strtolower($action)) {
231
-          case 'error':
231
+            case 'error':
232 232
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 1));
233
-          break;
234
-          case 'remove':
233
+            break;
234
+            case 'remove':
235 235
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 2));
236
-          break;
237
-          case 'replace':
236
+            break;
237
+            case 'replace':
238 238
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 3));
239
+            break;
240
+            default:
239 241
           break;
240
-          default:
241
-          break;
242 242
         }
243
-      }
243
+        }
244 244
 
245
-      // Wrapper ID
246
-      $sms_node->appendChild($req_doc->createElement('WrapperID', $i));
245
+        // Wrapper ID
246
+        $sms_node->appendChild($req_doc->createElement('WrapperID', $i));
247 247
 
248
-      $root->appendChild($sms_node);
248
+        $root->appendChild($sms_node);
249 249
     }
250 250
 
251 251
     $req_xml = $req_doc->saveXML();
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
     $err_desc = null;
260 260
 
261 261
     foreach($resp_doc->documentElement->childNodes AS $doc_child) {
262
-      switch(strtolower($doc_child->nodeName)) {
262
+        switch(strtolower($doc_child->nodeName)) {
263 263
         case 'sms_resp':
264 264
         $resp = array();
265 265
         $wrapper_id = null;
266 266
         foreach($doc_child->childNodes AS $resp_node) {
267
-          switch(strtolower($resp_node->nodeName)) {
267
+            switch(strtolower($resp_node->nodeName)) {
268 268
             case 'messageid':
269 269
             $resp['id'] = $resp_node->nodeValue;
270 270
             break;
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
             case 'wrapperid':
278 278
             $wrapper_id = $resp_node->nodeValue;
279 279
             break;
280
-          }
280
+            }
281 281
         }
282 282
         if( array_key_exists('error_code', $resp ) ) 
283 283
         {
284
-          $resp['success'] = 0;
284
+            $resp['success'] = 0;
285 285
         } else {
286
-          $resp['success'] = 1;
286
+            $resp['success'] = 1;
287 287
         }
288 288
         $resp['sms'] = $sms[$wrapper_id];
289 289
         array_push($response, $resp);
@@ -294,28 +294,28 @@  discard block
 block discarded – undo
294 294
         case 'errdesc':
295 295
         $err_desc = $doc_child->nodeValue;
296 296
         break;
297
-      }
297
+        }
298 298
     }
299 299
 
300 300
     if (isset($err_no)) {
301
-      throw new KannelException($err_desc, $err_no);
301
+        throw new KannelException($err_desc, $err_no);
302 302
     }
303 303
         
304 304
     if ($single_message) {
305
-      return $response[0];
305
+        return $response[0];
306 306
     } else {
307
-      return $response;
307
+        return $response;
308 308
     }
309
-  }
310
-
311
-  /**
312
-  * Check how many SMS credits you have available
313
-  *
314
-  * @return  integer   SMS credits remaining
315
-  * @deprecated Use checkBalance() instead
316
-  * @author  Martin Steel
317
-  */
318
-  public function checkCredit() {
309
+    }
310
+
311
+    /**
312
+     * Check how many SMS credits you have available
313
+     *
314
+     * @return  integer   SMS credits remaining
315
+     * @deprecated Use checkBalance() instead
316
+     * @author  Martin Steel
317
+     */
318
+    public function checkCredit() {
319 319
     // Create XML doc for request
320 320
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
321 321
     $root = $req_doc->createElement('Credit');
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     $err_desc = null;
337 337
         
338 338
     foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
339
-      switch ($doc_child->nodeName) {
339
+        switch ($doc_child->nodeName) {
340 340
         case "Credit":
341 341
         $credit = $doc_child->nodeValue;
342 342
         break;
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
         break;
349 349
         default:
350 350
         break;
351
-      }
351
+        }
352 352
     }
353 353
 
354 354
     if (isset($err_no)) {
355
-      throw new KannelException($err_desc, $err_no);
355
+        throw new KannelException($err_desc, $err_no);
356 356
     }
357 357
     return $credit;
358
-  }
358
+    }
359 359
 
360
-  /**
361
-  * Check your account balance
362
-  *
363
-  * @return  array   Array of account balance: 
364
-  * @author  Martin Steel
365
-  */
366
-  public function checkBalance() {
360
+    /**
361
+     * Check your account balance
362
+     *
363
+     * @return  array   Array of account balance: 
364
+     * @author  Martin Steel
365
+     */
366
+    public function checkBalance() {
367 367
     // Create XML doc for request
368 368
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
369 369
     $root = $req_doc->createElement('Balance');
@@ -384,20 +384,20 @@  discard block
 block discarded – undo
384 384
     $err_desc = null;
385 385
         
386 386
     foreach ($resp_doc->documentElement->childNodes as $doc_child) {
387
-      switch ($doc_child->nodeName) {
387
+        switch ($doc_child->nodeName) {
388 388
         case "Balance":
389 389
         $balance = number_format(floatval($doc_child->nodeValue), 2);
390 390
         break;
391 391
         case "Currency":
392 392
         foreach ($doc_child->childNodes as $resp_node) {
393
-          switch ($resp_node->tagName) {
393
+            switch ($resp_node->tagName) {
394 394
             case "Symbol":
395 395
             $symbol = $resp_node->nodeValue; 
396 396
             break;
397 397
             case "Code":
398 398
             $code = $resp_node->nodeValue; 
399 399
             break;
400
-          }
400
+            }
401 401
         }
402 402
         break;
403 403
         case "ErrNo":
@@ -408,23 +408,23 @@  discard block
 block discarded – undo
408 408
         break;
409 409
         default:
410 410
         break;
411
-      }
411
+        }
412 412
     }
413 413
 
414 414
     if (isset($err_no)) {
415
-      throw new KannelException($err_desc, $err_no);
415
+        throw new KannelException($err_desc, $err_no);
416 416
     }
417 417
         
418 418
     return array( 'symbol' => $symbol, 'balance' => $balance, 'code' => $code );
419
-  }
419
+    }
420 420
 
421
-  /**
422
-  * Check whether the API Key is valid
423
-  *
424
-  * @return  bool    True indicates a valid key
425
-  * @author  Martin Steel
426
-  */
427
-  public function checkKey() {
421
+    /**
422
+     * Check whether the API Key is valid
423
+     *
424
+     * @return  bool    True indicates a valid key
425
+     * @author  Martin Steel
426
+     */
427
+    public function checkKey() {
428 428
     // Create XML doc for request
429 429
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
430 430
     $root = $req_doc->createElement('Authenticate');
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     $err_desc = null;
446 446
 
447 447
     foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
448
-      switch ($doc_child->nodeName) {
448
+        switch ($doc_child->nodeName) {
449 449
         case "CustID":
450 450
         $cust_id = $doc_child->nodeValue;
451 451
         break;
@@ -457,33 +457,33 @@  discard block
 block discarded – undo
457 457
         break;
458 458
         default:
459 459
         break;
460
-      }
460
+        }
461 461
     }
462 462
 
463 463
     if (isset($err_no)) {
464
-      throw new KannelException($err_desc, $err_no);
464
+        throw new KannelException($err_desc, $err_no);
465 465
     }
466 466
     return isset($cust_id);   
467
-  }
468
-
469
-  /**
470
-  * Make an HTTP POST to Kannel
471
-  *
472
-  * @param   string   method Kannel method to call (sms/credit)
473
-  * @param   string   data   Content of HTTP POST
474
-  *
475
-  * @return  string          Response from Kannel
476
-  * @author  Martin Steel
477
-  */
478
-  protected function postToKannel($method, $data) {
467
+    }
468
+
469
+    /**
470
+     * Make an HTTP POST to Kannel
471
+     *
472
+     * @param   string   method Kannel method to call (sms/credit)
473
+     * @param   string   data   Content of HTTP POST
474
+     *
475
+     * @return  string          Response from Kannel
476
+     * @author  Martin Steel
477
+     */
478
+    protected function postToKannel($method, $data) {
479 479
     if ($this->log) {
480
-      $this->logXML("API $method Request XML", $data);
480
+        $this->logXML("API $method Request XML", $data);
481 481
     }
482 482
     
483 483
     if( isset( $this->ssl ) ) {
484
-      $ssl = $this->ssl;
484
+        $ssl = $this->ssl;
485 485
     } else {
486
-      $ssl = $this->sslSupport();
486
+        $ssl = $this->sslSupport();
487 487
     }
488 488
 
489 489
     $url = $ssl ? 'https://' : 'http://';
@@ -492,152 +492,152 @@  discard block
 block discarded – undo
492 492
     $response = $this->xmlPost($url, $data);
493 493
 
494 494
     if ($this->log) {
495
-      $this->logXML("API $method Response XML", $response);
495
+        $this->logXML("API $method Response XML", $response);
496 496
     }
497 497
 
498 498
     return $response;
499
-  }
500
-
501
-  /**
502
-  * Make a HTTP POST
503
-  *
504
-  * cURL will be used if available, otherwise tries the PHP stream functions
505
-  *
506
-  * @param   string url      URL to send to
507
-  * @param   string data     Data to POST
508
-  * @return  string          Response returned by server
509
-  * @author  Martin Steel
510
-  */
511
-  protected function xmlPost($url, $data) {
499
+    }
500
+
501
+    /**
502
+     * Make a HTTP POST
503
+     *
504
+     * cURL will be used if available, otherwise tries the PHP stream functions
505
+     *
506
+     * @param   string url      URL to send to
507
+     * @param   string data     Data to POST
508
+     * @return  string          Response returned by server
509
+     * @author  Martin Steel
510
+     */
511
+    protected function xmlPost($url, $data) {
512 512
     if(extension_loaded('curl')) {
513
-      $ch = curl_init($url);
514
-      curl_setopt($ch, CURLOPT_POST, 1);
515
-      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516
-      curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
-      curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0' . self::VERSION);
518
-      curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519
-      if (isset($this->proxy_host) && isset($this->proxy_port)) {
513
+        $ch = curl_init($url);
514
+        curl_setopt($ch, CURLOPT_POST, 1);
515
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516
+        curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
+        curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0' . self::VERSION);
518
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519
+        if (isset($this->proxy_host) && isset($this->proxy_port)) {
520 520
         curl_setopt($ch, CURLOPT_PROXY, $this->proxy_host);
521 521
         curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy_port);
522
-      }
522
+        }
523 523
 
524
-      $response = curl_exec($ch);
525
-      $info = curl_getinfo($ch);
524
+        $response = curl_exec($ch);
525
+        $info = curl_getinfo($ch);
526 526
 
527
-      if ($response === false || $info['http_code'] != 200) {
527
+        if ($response === false || $info['http_code'] != 200) {
528 528
         throw new \Exception('HTTP Error calling Kannel API - HTTP Status: ' . $info['http_code'] . ' - cURL Erorr: ' . curl_error($ch));
529
-      } elseif (curl_errno($ch) > 0) {
529
+        } elseif (curl_errno($ch) > 0) {
530 530
         throw new \Exception('HTTP Error calling Kannel API - cURL Error: ' . curl_error($ch));
531
-      }
531
+        }
532 532
 
533
-      curl_close($ch);
533
+        curl_close($ch);
534 534
 
535
-      return $response;
535
+        return $response;
536 536
     } elseif (function_exists('stream_get_contents')) {
537
-      // Enable error Track Errors
538
-      $track = ini_get('track_errors');
539
-      ini_set('track_errors',true);
537
+        // Enable error Track Errors
538
+        $track = ini_get('track_errors');
539
+        ini_set('track_errors',true);
540 540
 
541
-      $params = array('http' => array(
542
-      'method'  => 'POST',
543
-      'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
544
-      'content' => $data
545
-      ));
541
+        $params = array('http' => array(
542
+        'method'  => 'POST',
543
+        'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
544
+        'content' => $data
545
+        ));
546 546
 
547
-      if (isset($this->proxy_host) && isset($this->proxy_port)) {
547
+        if (isset($this->proxy_host) && isset($this->proxy_port)) {
548 548
         $params['http']['proxy'] = 'tcp://'.$this->proxy_host . ':' . $this->proxy_port;
549 549
         $params['http']['request_fulluri'] = True;
550
-      }
550
+        }
551 551
 
552
-      $ctx = stream_context_create($params);
553
-      $fp = @fopen($url, 'rb', false, $ctx);
554
-      if (!$fp) {
552
+        $ctx = stream_context_create($params);
553
+        $fp = @fopen($url, 'rb', false, $ctx);
554
+        if (!$fp) {
555 555
         ini_set('track_errors',$track);
556 556
         throw new \Exception("HTTP Error calling Kannel API - fopen Error: $php_errormsg");
557
-      }
558
-      $response = @stream_get_contents($fp);
559
-      if ($response === false) {
557
+        }
558
+        $response = @stream_get_contents($fp);
559
+        if ($response === false) {
560 560
         ini_set('track_errors',$track);
561 561
         throw new \Exception("HTTP Error calling Kannel API - stream Error: $php_errormsg");
562
-      }
563
-      ini_set('track_errors',$track);
564
-      return $response;
562
+        }
563
+        ini_set('track_errors',$track);
564
+        return $response;
565 565
     } else {
566
-      throw new \Exception("Kannel requires PHP5 with cURL or HTTP stream support");
566
+        throw new \Exception("Kannel requires PHP5 with cURL or HTTP stream support");
567 567
     }
568
-  }
569
-
570
-  /**
571
-  * Does the server/HTTP wrapper support SSL
572
-  *
573
-  * This is a best guess effort, some servers have weird setups where even
574
-  * though cURL is compiled with SSL support is still fails to make
575
-  * any requests.
576
-  *
577
-  * @return bool     True if SSL is supported
578
-  * @author  Martin Steel
579
-  */
580
-  protected function sslSupport() {
568
+    }
569
+
570
+    /**
571
+     * Does the server/HTTP wrapper support SSL
572
+     *
573
+     * This is a best guess effort, some servers have weird setups where even
574
+     * though cURL is compiled with SSL support is still fails to make
575
+     * any requests.
576
+     *
577
+     * @return bool     True if SSL is supported
578
+     * @author  Martin Steel
579
+     */
580
+    protected function sslSupport() {
581 581
     $ssl = false;
582 582
     // See if PHP is compiled with cURL
583 583
     if (extension_loaded('curl')) {
584
-      $version = curl_version();
585
-      $ssl = ($version['features'] & CURL_VERSION_SSL) ? true : false;
584
+        $version = curl_version();
585
+        $ssl = ($version['features'] & CURL_VERSION_SSL) ? true : false;
586 586
     } elseif (extension_loaded('openssl')) {
587
-      $ssl = true;
587
+        $ssl = true;
588 588
     }
589 589
     return $ssl;
590
-  }
591
-
592
-  /**
593
-  * Log some XML, tidily if possible, in the PHP error log
594
-  *
595
-  * @param   string  log_msg The log message to prepend to the XML
596
-  * @param   string  xml     An XML formatted string
597
-  *
598
-  * @return  void
599
-  * @author  Martin Steel
600
-  */
601
-  protected function logXML($log_msg, $xml) {
590
+    }
591
+
592
+    /**
593
+     * Log some XML, tidily if possible, in the PHP error log
594
+     *
595
+     * @param   string  log_msg The log message to prepend to the XML
596
+     * @param   string  xml     An XML formatted string
597
+     *
598
+     * @return  void
599
+     * @author  Martin Steel
600
+     */
601
+    protected function logXML($log_msg, $xml) {
602 602
     // Tidy if possible
603 603
     if (class_exists('tidy')) {
604
-      $tidy = new \tidy;
605
-      $config = array(
606
-      'indent'     => true,
607
-      'input-xml'  => true,
608
-      'output-xml' => true,
609
-      'wrap'       => 200
610
-      );
611
-      $tidy->parseString($xml, $config, 'utf8');
612
-      $tidy->cleanRepair();
613
-      $xml = $tidy;
604
+        $tidy = new \tidy;
605
+        $config = array(
606
+        'indent'     => true,
607
+        'input-xml'  => true,
608
+        'output-xml' => true,
609
+        'wrap'       => 200
610
+        );
611
+        $tidy->parseString($xml, $config, 'utf8');
612
+        $tidy->cleanRepair();
613
+        $xml = $tidy;
614 614
     }
615 615
     // Output
616 616
     error_log("Kannel $log_msg: $xml");
617
-  }
618
-
619
-  /**
620
-  * Check if an array is associative
621
-  *
622
-  * @param   array $array Array to check
623
-  * @return  bool
624
-  * @author  Martin Steel
625
-  */
626
-  protected function is_assoc($array) {
617
+    }
618
+
619
+    /**
620
+     * Check if an array is associative
621
+     *
622
+     * @param   array $array Array to check
623
+     * @return  bool
624
+     * @author  Martin Steel
625
+     */
626
+    protected function is_assoc($array) {
627 627
     return (bool)count(array_filter(array_keys($array), 'is_string'));
628
-  }
628
+    }
629 629
   
630
-  /**
631
-   * Check if a number is a valid MSISDN
632
-   *
633
-   * @param string $val Value to check
634
-   * @return bool True if valid MSISDN
635
-   * @author James Inman
636
-   * @since 1.3.0
637
-   * @todo Take an optional country code and check that the number starts with it
638
-   */
639
-  public static function is_valid_msisdn($val) {
630
+    /**
631
+     * Check if a number is a valid MSISDN
632
+     *
633
+     * @param string $val Value to check
634
+     * @return bool True if valid MSISDN
635
+     * @author James Inman
636
+     * @since 1.3.0
637
+     * @todo Take an optional country code and check that the number starts with it
638
+     */
639
+    public static function is_valid_msisdn($val) {
640 640
     return preg_match( '/^[1-9][0-9]{7,12}$/', $val );
641
-  }
641
+    }
642 642
 
643 643
 }
Please login to merge, or discard this patch.
plugin/courselegal/CourseLegalPlugin.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,12 +108,12 @@
 block discarded – undo
108 108
     }
109 109
 
110 110
     /**
111
-    * @param int $userId
112
-    * @param int $courseCode
113
-    * @param int $sessionId
114
-    * @param boolean $sendEmail Optional. Indicate whether the mail must be sent. Default is true
115
-    * @return mixed
116
-    */
111
+     * @param int $userId
112
+     * @param int $courseCode
113
+     * @param int $sessionId
114
+     * @param boolean $sendEmail Optional. Indicate whether the mail must be sent. Default is true
115
+     * @return mixed
116
+     */
117 117
     public function saveUserLegal($userId, $courseCode, $sessionId, $sendEmail = true)
118 118
     {
119 119
         $courseInfo = api_get_course_info($courseCode);
Please login to merge, or discard this patch.
plugin/buycourses/src/paypalfunctions.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
  *		phoneNum:			the phoneNum  entered on the merchant's site
112 112
  */
113 113
 function CallMarkExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL,
114
-                                 $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState,
115
-                                 $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum
114
+                                    $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState,
115
+                                    $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum
116 116
 )
117 117
 {
118 118
     // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
  */
266 266
 
267 267
 function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCardNumber,
268
-                       $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip,
269
-                       $countryCode, $currencyCode)
268
+                        $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip,
269
+                        $countryCode, $currencyCode)
270 270
 {
271 271
     //Construct the parameter string that describes DoDirectPayment
272 272
     $nvpstr = "&AMT=" . $paymentAmount;
Please login to merge, or discard this patch.
plugin/dashboard/block_student_graph/block_student_graph.class.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -22,40 +22,40 @@  discard block
 block discarded – undo
22 22
 {
23 23
 
24 24
     private $user_id;
25
-	private $students;
26
-	private $path;
27
-	private $permission = array(DRH);
25
+    private $students;
26
+    private $path;
27
+    private $permission = array(DRH);
28 28
 
29
-	/**
30
-	 * Constructor
31
-	 */
29
+    /**
30
+     * Constructor
31
+     */
32 32
     public function __construct ($user_id)
33 33
     {
34
-    	$this->user_id  = $user_id;
35
-    	$this->path 	= 'block_student_graph';
36
-    	if ($this->is_block_visible_for_user($user_id)) {
37
-    		/*if (api_is_platform_admin()) {
34
+        $this->user_id  = $user_id;
35
+        $this->path 	= 'block_student_graph';
36
+        if ($this->is_block_visible_for_user($user_id)) {
37
+            /*if (api_is_platform_admin()) {
38 38
 	    		$this->students = UserManager::get_user_list(array('status' => STUDENT));
39 39
 	    	} else if (api_is_drh()) {*/
40
-	    		$this->students =  UserManager::get_users_followed_by_drh($user_id, STUDENT);
41
-	    	//}
42
-    	}
40
+                $this->students =  UserManager::get_users_followed_by_drh($user_id, STUDENT);
41
+            //}
42
+        }
43 43
     }
44 44
 
45 45
     /**
46
-	 * This method check if a user is allowed to see the block inside dashboard interface
47
-	 * @param	int		User id
48
-	 * @return	bool	Is block visible for user
49
-	 */
46
+     * This method check if a user is allowed to see the block inside dashboard interface
47
+     * @param	int		User id
48
+     * @return	bool	Is block visible for user
49
+     */
50 50
     public function is_block_visible_for_user($user_id)
51 51
     {
52
-    	$user_info = api_get_user_info($user_id);
53
-		$user_status = $user_info['status'];
54
-		$is_block_visible_for_user = false;
55
-    	if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
56
-    		$is_block_visible_for_user = true;
57
-    	}
58
-    	return $is_block_visible_for_user;
52
+        $user_info = api_get_user_info($user_id);
53
+        $user_status = $user_info['status'];
54
+        $is_block_visible_for_user = false;
55
+        if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
56
+            $is_block_visible_for_user = true;
57
+        }
58
+        return $is_block_visible_for_user;
59 59
     }
60 60
 
61 61
     /**
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
     public function get_block()
68 68
     {
69 69
 
70
-    	global $charset;
71
-    	$column = 1;
72
-    	$data   = array();
73
-		$students_attendance_graph = $this->get_students_attendance_graph();
70
+        global $charset;
71
+        $column = 1;
72
+        $data   = array();
73
+        $students_attendance_graph = $this->get_students_attendance_graph();
74 74
 
75
-		$html = '<div class="panel panel-default" id="intro">
75
+        $html = '<div class="panel panel-default" id="intro">
76 76
 	                <div class="panel-heading">
77 77
 	                    '.get_lang('StudentsInformationsGraph').'
78 78
 	                    <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
@@ -84,51 +84,51 @@  discard block
 block discarded – undo
84 84
 						'.$students_attendance_graph.'
85 85
 	                </div>
86 86
 	            </div>';
87
-    	$data['column'] = $column;
88
-    	$data['content_html'] = $html;
89
-    	return $data;
87
+        $data['column'] = $column;
88
+        $data['content_html'] = $html;
89
+        return $data;
90 90
     }
91 91
 
92 92
     /**
93
- 	 * This method return a graph containing information about students evaluation,
93
+     * This method return a graph containing information about students evaluation,
94 94
      * it's used inside get_block method for showing it inside dashboard interface
95
- 	 * @return string  img html
96
- 	 */
95
+     * @return string  img html
96
+     */
97 97
     public function get_students_attendance_graph()
98 98
     {
99 99
 
100
-		$students = $this->students;
101
- 		$attendance = new Attendance();
102
-
103
- 		// get data
104
- 		$attendances_faults_avg = array();
105
- 		if (is_array($students) && count($students) > 0) {
106
-	 		foreach ($students as $student) {
107
-	 			$student_id = $student['user_id'];
108
-	 			//$student_info = api_get_user_info($student_id);
109
-				// get average of faults in attendances by student
110
-	 			$results_faults_avg = $attendance->get_faults_average_inside_courses($student_id);
111
-
112
-	 			if (!empty($results_faults_avg)) {
113
-	 				$attendances_faults_avg[$student['lastname']] = $results_faults_avg['porcent'];
114
-	 			} else {
115
-	 				$attendances_faults_avg[$student['lastname']] = 0;
116
-	 			}
117
-	 		}
118
- 		}
100
+        $students = $this->students;
101
+            $attendance = new Attendance();
102
+
103
+            // get data
104
+            $attendances_faults_avg = array();
105
+            if (is_array($students) && count($students) > 0) {
106
+                foreach ($students as $student) {
107
+                    $student_id = $student['user_id'];
108
+                    //$student_info = api_get_user_info($student_id);
109
+                // get average of faults in attendances by student
110
+                    $results_faults_avg = $attendance->get_faults_average_inside_courses($student_id);
111
+
112
+                    if (!empty($results_faults_avg)) {
113
+                        $attendances_faults_avg[$student['lastname']] = $results_faults_avg['porcent'];
114
+                    } else {
115
+                        $attendances_faults_avg[$student['lastname']] = 0;
116
+                    }
117
+                }
118
+            }
119 119
 
120
- 		arsort($attendances_faults_avg);
121
-		$usernames = array_keys($attendances_faults_avg);
120
+            arsort($attendances_faults_avg);
121
+        $usernames = array_keys($attendances_faults_avg);
122 122
 
123
-		$faults = array();
124
-		foreach ($usernames as $username) {
125
-			$faults[] = $attendances_faults_avg[$username];
126
-		}
123
+        $faults = array();
124
+        foreach ($usernames as $username) {
125
+            $faults[] = $attendances_faults_avg[$username];
126
+        }
127 127
 
128
-		$graph = '';
129
-		$img_file = '';
128
+        $graph = '';
129
+        $img_file = '';
130 130
 
131
-		if (is_array($usernames) && count($usernames) > 0) {
131
+        if (is_array($usernames) && count($usernames) > 0) {
132 132
 
133 133
             // Defining data
134 134
             $dataSet = new pData();
@@ -233,19 +233,19 @@  discard block
 block discarded – undo
233 233
                 $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
234 234
             }
235 235
             $graph = '<img src="' . $imgPath . '" >';
236
-		} else {
237
-			$graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
238
-		}
236
+        } else {
237
+            $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
238
+        }
239 239
 
240
- 		return $graph;
241
- 	}
240
+            return $graph;
241
+        }
242 242
 
243 243
     /**
244
-	 * Get number of students
245
-	 * @return int
246
-	 */
247
-	function get_number_of_students()
244
+     * Get number of students
245
+     * @return int
246
+     */
247
+    function get_number_of_students()
248 248
     {
249
-		return count($this->students);
250
-	}
249
+        return count($this->students);
250
+    }
251 251
 }
Please login to merge, or discard this patch.
plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@  discard block
 block discarded – undo
23 23
 class BlockEvaluationGraph extends Block
24 24
 {
25 25
     private $user_id;
26
-	private $courses;
27
-	private $sessions;
28
-	private $path;
29
-	private $permission = array(DRH, SESSIONADMIN);
30
-
31
-	/**
32
-	 * Constructor
33
-	 */
26
+    private $courses;
27
+    private $sessions;
28
+    private $path;
29
+    private $permission = array(DRH, SESSIONADMIN);
30
+
31
+    /**
32
+     * Constructor
33
+     */
34 34
     public function __construct($user_id)
35 35
     {
36
-    	$this->path = 'block_evaluation_graph';
37
-    	$this->user_id 	= $user_id;
38
-    	$this->bg_width = 450;
39
-    	$this->bg_height = 350;
40
-    	if ($this->is_block_visible_for_user($user_id)) {
36
+        $this->path = 'block_evaluation_graph';
37
+        $this->user_id 	= $user_id;
38
+        $this->bg_width = 450;
39
+        $this->bg_height = 350;
40
+        if ($this->is_block_visible_for_user($user_id)) {
41 41
             if (!api_is_session_admin()) {
42 42
                 $this->courses  = CourseManager::get_courses_followed_by_drh($user_id);
43 43
             }
44 44
             $this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
45
-    	}
45
+        }
46 46
     }
47 47
 
48
-	/**
49
-	 * This method check if a user is allowed to see the block inside dashboard interface
50
-	 * @param	int		User id
51
-	 * @return	bool	Is block visible for user
52
-	 */
48
+    /**
49
+     * This method check if a user is allowed to see the block inside dashboard interface
50
+     * @param	int		User id
51
+     * @return	bool	Is block visible for user
52
+     */
53 53
     public function is_block_visible_for_user($user_id)
54 54
     {
55
-    	$user_info = api_get_user_info($user_id);
56
-		$user_status = $user_info['status'];
57
-		$is_block_visible_for_user = false;
58
-    	if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
59
-    		$is_block_visible_for_user = true;
60
-    	}
61
-    	return $is_block_visible_for_user;
55
+        $user_info = api_get_user_info($user_id);
56
+        $user_status = $user_info['status'];
57
+        $is_block_visible_for_user = false;
58
+        if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
59
+            $is_block_visible_for_user = true;
60
+        }
61
+        return $is_block_visible_for_user;
62 62
     }
63 63
 
64 64
     /**
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function get_block()
70 70
     {
71
-		global $charset;
72
-    	$column = 1;
73
-    	$data   = array();
71
+        global $charset;
72
+        $column = 1;
73
+        $data   = array();
74 74
 
75
-		$evaluations_base_courses_graph         = $this->get_evaluations_base_courses_graph();
76
-		$evaluations_courses_in_sessions_graph  = $this->get_evaluations_courses_in_sessions_graph();
75
+        $evaluations_base_courses_graph         = $this->get_evaluations_base_courses_graph();
76
+        $evaluations_courses_in_sessions_graph  = $this->get_evaluations_courses_in_sessions_graph();
77 77
 
78
-		$html = '<div class="panel panel-default" id="intro">
78
+        $html = '<div class="panel panel-default" id="intro">
79 79
                     <div class="panel-heading">
80 80
                         '.get_lang('EvaluationsGraph').'
81 81
                         <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
@@ -105,43 +105,43 @@  discard block
 block discarded – undo
105 105
                 }
106 106
             }
107 107
         }
108
-		$html .= '</div>
108
+        $html .= '</div>
109 109
 			     </div>';
110 110
 
111
-    	$data['column'] = $column;
112
-    	$data['content_html'] = $html;
111
+        $data['column'] = $column;
112
+        $data['content_html'] = $html;
113 113
 
114
-    	return $data;
115
-	}
114
+        return $data;
115
+    }
116 116
 
117 117
     /**
118
- 	 * This method return a graph containing informations about evaluations
118
+     * This method return a graph containing informations about evaluations
119 119
      * inside base courses, it's used inside get_block method for showing
120 120
      * it inside dashboard interface
121
- 	 * @return string  img html
122
- 	 */
121
+     * @return string  img html
122
+     */
123 123
     public function get_evaluations_base_courses_graph()
124 124
     {
125
-		$graphs = array();
126
-		if (!empty($this->courses)) {
127
-			$courses_code = array_keys($this->courses);
128
-			foreach ($courses_code as $course_code) {
129
-				$cats = Category::load(null, null, $course_code, null, null, null, false);
130
-
131
-				if (isset($cats) && isset($cats[0])) {
132
-					$alleval = $cats[0]->get_evaluations(null, true, $course_code);
133
-					$alllinks = $cats[0]->get_links(null, true);
134
-					$users = GradebookUtils::get_all_users($alleval, $alllinks);
135
-					$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
136
-					$evaluation_sumary = $datagen->get_evaluation_sumary_results();
137
-					if (!empty($evaluation_sumary)) {
138
-						$items = array_keys($evaluation_sumary);
139
-						$max = $min = $avg = array();
140
-						foreach ($evaluation_sumary as $evaluation) {
141
-							$max[] = $evaluation['max'];
125
+        $graphs = array();
126
+        if (!empty($this->courses)) {
127
+            $courses_code = array_keys($this->courses);
128
+            foreach ($courses_code as $course_code) {
129
+                $cats = Category::load(null, null, $course_code, null, null, null, false);
130
+
131
+                if (isset($cats) && isset($cats[0])) {
132
+                    $alleval = $cats[0]->get_evaluations(null, true, $course_code);
133
+                    $alllinks = $cats[0]->get_links(null, true);
134
+                    $users = GradebookUtils::get_all_users($alleval, $alllinks);
135
+                    $datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
136
+                    $evaluation_sumary = $datagen->get_evaluation_sumary_results();
137
+                    if (!empty($evaluation_sumary)) {
138
+                        $items = array_keys($evaluation_sumary);
139
+                        $max = $min = $avg = array();
140
+                        foreach ($evaluation_sumary as $evaluation) {
141
+                            $max[] = $evaluation['max'];
142 142
                             $min[] = !empty($evaluation['min']) ? $evaluation['min'] : 0;
143
-							$avg[] = $evaluation['avg'];
144
-						}
143
+                            $avg[] = $evaluation['avg'];
144
+                        }
145 145
                         // Dataset definition
146 146
                         $dataSet = new pData();
147 147
                         $dataSet->addPoints($min, 'Serie3');
@@ -283,43 +283,43 @@  discard block
 block discarded – undo
283 283
                         if (!empty($imgPath)) {
284 284
                             $courses_graph[$course_code] = '<img src="' . $imgPath . '">';
285 285
                         }
286
-					}
287
-				}
288
-			} // end for
289
-		}
290
-    	return $graphs;
291
- 	}
292
-
293
-	/**
294
- 	 * This method return a graph containing information about evaluations
286
+                    }
287
+                }
288
+            } // end for
289
+        }
290
+        return $graphs;
291
+        }
292
+
293
+    /**
294
+     * This method return a graph containing information about evaluations
295 295
      * inside courses in sessions, it's used inside get_block method for
296 296
      * showing it inside dashboard interface
297
- 	 * @return string  img html
298
- 	 */
297
+     * @return string  img html
298
+     */
299 299
     public function get_evaluations_courses_in_sessions_graph()
300 300
     {
301
-		$graphs = array();
302
-		if (!empty($this->sessions)) {
303
-			$session_ids = array_keys($this->sessions);
304
-			foreach ($session_ids as $session_id) {
305
-				$courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
306
-				$courses_graph = array();
307
-				foreach ($courses_code as $course_code) {
308
-					$cats = Category::load(null, null, $course_code, null, null, $session_id);
309
-					if (isset($cats) && isset($cats[0])) {
310
-						$alleval = $cats[0]->get_evaluations(null, true, $course_code);
311
-						$alllinks = $cats[0]->get_links(null, true);
312
-						$users = GradebookUtils::get_all_users($alleval, $alllinks);
313
-						$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
314
-						$evaluation_sumary = $datagen->get_evaluation_sumary_results();
315
-						if (!empty($evaluation_sumary)) {
316
-							$items = array_keys($evaluation_sumary);
317
-							$max = $min = $avg = array();
318
-							foreach ($evaluation_sumary as $evaluation) {
319
-								$max[] = $evaluation['max'];
320
-								$min[] = $evaluation['min'];
321
-								$avg[] = $evaluation['avg'];
322
-							}
301
+        $graphs = array();
302
+        if (!empty($this->sessions)) {
303
+            $session_ids = array_keys($this->sessions);
304
+            foreach ($session_ids as $session_id) {
305
+                $courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
306
+                $courses_graph = array();
307
+                foreach ($courses_code as $course_code) {
308
+                    $cats = Category::load(null, null, $course_code, null, null, $session_id);
309
+                    if (isset($cats) && isset($cats[0])) {
310
+                        $alleval = $cats[0]->get_evaluations(null, true, $course_code);
311
+                        $alllinks = $cats[0]->get_links(null, true);
312
+                        $users = GradebookUtils::get_all_users($alleval, $alllinks);
313
+                        $datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
314
+                        $evaluation_sumary = $datagen->get_evaluation_sumary_results();
315
+                        if (!empty($evaluation_sumary)) {
316
+                            $items = array_keys($evaluation_sumary);
317
+                            $max = $min = $avg = array();
318
+                            foreach ($evaluation_sumary as $evaluation) {
319
+                                $max[] = $evaluation['max'];
320
+                                $min[] = $evaluation['min'];
321
+                                $avg[] = $evaluation['avg'];
322
+                            }
323 323
                             // Dataset definition
324 324
                             $dataSet = new pData();
325 325
                             $dataSet->addPoints($min, 'Serie3');
@@ -455,14 +455,14 @@  discard block
 block discarded – undo
455 455
                             if (!empty($imgPath)) {
456 456
                                 $courses_graph[$course_code] = '<img src="' . $imgPath . '">';
457 457
                             }
458
-						}
459
-					}
460
-				}
461
-				if (!empty($courses_graph)) {
462
-					$graphs[$session_id] = $courses_graph;
463
-				}
464
-			}
465
-		}
466
-    	return $graphs;
467
- 	}
458
+                        }
459
+                    }
460
+                }
461
+                if (!empty($courses_graph)) {
462
+                    $graphs[$session_id] = $courses_graph;
463
+                }
464
+            }
465
+        }
466
+        return $graphs;
467
+        }
468 468
 }
Please login to merge, or discard this patch.
plugin/dashboard/block_global_info/block_global_info.class.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function is_block_visible_for_user($user_id)
47 47
     {
48
-    	$user_info = api_get_user_info($user_id);
49
-    	$user_status = $user_info['status'];
50
-    	$is_block_visible_for_user = false;
51
-    	if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
52
-    		$is_block_visible_for_user = true;
53
-    	}
54
-    	return $is_block_visible_for_user;
48
+        $user_info = api_get_user_info($user_id);
49
+        $user_status = $user_info['status'];
50
+        $is_block_visible_for_user = false;
51
+        if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
52
+            $is_block_visible_for_user = true;
53
+        }
54
+        return $is_block_visible_for_user;
55 55
     }
56 56
 
57 57
 
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function get_block()
64 64
     {
65
-    	global $charset;
66
-    	$column = 2;
67
-    	$data   = array();
65
+        global $charset;
66
+        $column = 2;
67
+        $data   = array();
68 68
         $content = $this->get_content_html();
69
-    	$html = '
69
+        $html = '
70 70
     	            <div class="panel panel-default" id="intro">
71 71
     	                <div class="panel-heading">'.get_lang('GlobalPlatformInformation').'
72 72
     	                    <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
@@ -78,46 +78,46 @@  discard block
 block discarded – undo
78 78
     	                </div>
79 79
     	            </div>
80 80
     			';
81
-    	$data['column'] = $column;
82
-    	$data['content_html'] = $html;
81
+        $data['column'] = $column;
82
+        $data['content_html'] = $html;
83 83
 
84
-    	return $data;
84
+        return $data;
85 85
     }
86 86
 
87
- 	/**
88
- 	 * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
89
- 	 * @return string  content html
90
- 	 */
91
-     public function get_content_html()
92
-     {
93
-         $global_data = $this->get_global_information_data();
94
-         //$content = '<div style="margin:10px;">';
95
-         $content = '<h4>'.get_lang('GlobalPlatformInformation').'</h4>';
96
-         $data_table = null;
97
-         if (!empty($global_data)) {
98
-             $data_table = '<table class="table table-bordered" width:"95%">';
99
-             $i = 1;
100
-             foreach ($global_data as $data) {
101
-                 if ($i%2 == 0) {
102
-                     $class_tr = 'row_odd';
103
-                 } else {
104
-                     $class_tr = 'row_even';
105
-                 }
106
-                 $data_table .= '<tr class="'.$class_tr.'">';
107
-                 foreach ($data as $cell) {
108
-                     $data_table .= '<td align="right">'.$cell.'</td>';
109
-                 }
110
-                 $data_table .= '</tr>';
111
-                 $i++;
112
-             }
113
-             $data_table .= '</table>';
114
-         } else {
115
-             $data_table .= get_lang('ThereIsNoInformationAboutThePlatform');
116
-         }
117
-         $content .= $data_table;
118
-         //$content .= '</div>';
87
+        /**
88
+         * This method return a content html, it's used inside get_block method for showing it inside dashboard interface
89
+         * @return string  content html
90
+         */
91
+        public function get_content_html()
92
+        {
93
+            $global_data = $this->get_global_information_data();
94
+            //$content = '<div style="margin:10px;">';
95
+            $content = '<h4>'.get_lang('GlobalPlatformInformation').'</h4>';
96
+            $data_table = null;
97
+            if (!empty($global_data)) {
98
+                $data_table = '<table class="table table-bordered" width:"95%">';
99
+                $i = 1;
100
+                foreach ($global_data as $data) {
101
+                    if ($i%2 == 0) {
102
+                        $class_tr = 'row_odd';
103
+                    } else {
104
+                        $class_tr = 'row_even';
105
+                    }
106
+                    $data_table .= '<tr class="'.$class_tr.'">';
107
+                    foreach ($data as $cell) {
108
+                        $data_table .= '<td align="right">'.$cell.'</td>';
109
+                    }
110
+                    $data_table .= '</tr>';
111
+                    $i++;
112
+                }
113
+                $data_table .= '</table>';
114
+            } else {
115
+                $data_table .= get_lang('ThereIsNoInformationAboutThePlatform');
116
+            }
117
+            $content .= $data_table;
118
+            //$content .= '</div>';
119 119
 
120
-         return $content;
120
+            return $content;
121 121
     }
122 122
 
123 123
     /**
Please login to merge, or discard this patch.
plugin/jcapture/action.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@
 block discarded – undo
11 11
  
12 12
 class action_plugin_jcapture extends DokuWiki_Action_Plugin {
13 13
  
14
-  /**
15
-   * return some info
16
-   */
17
-  function getInfo(){
14
+    /**
15
+     * return some info
16
+     */
17
+    function getInfo(){
18 18
     return array(
19
-                 'author' => 'Pavel Vlasov',
20
-                 'email'  => '[email protected]',
21
-                 'name'   => 'JCapture',
22
-                 'desc'   => 'Plugin for making screen captures.',
23
-                 'url'    => 'http://www.nasdanika.com/wiki/doku.php?id=products:jcapture:start',
24
-                 );
25
-  }
19
+                    'author' => 'Pavel Vlasov',
20
+                    'email'  => '[email protected]',
21
+                    'name'   => 'JCapture',
22
+                    'desc'   => 'Plugin for making screen captures.',
23
+                    'url'    => 'http://www.nasdanika.com/wiki/doku.php?id=products:jcapture:start',
24
+                    );
25
+    }
26 26
 
27 27
     /**
28 28
      * Register the eventhandlers
Please login to merge, or discard this patch.