Test Failed
Branch trunk (412648)
by SuperNova.WS
03:40
created
classes/Confirmation.php 2 patches
Doc Comments   +19 added lines patch added patch discarded remove patch
@@ -18,6 +18,11 @@  discard block
 block discarded – undo
18 18
 
19 19
   // TODO - НЕ ОБЯЗАТЕЛЬНО ОТПРАВЛЯТЬ ЧЕРЕЗ ЕМЕЙЛ! ЕСЛИ ЭТО ФЕЙСБУЧЕК ИЛИ ВКШЕЧКА - МОЖНО ЧЕРЕЗ ЛС ПИСАТЬ!!
20 20
   // TODO - OK 4.6
21
+
22
+  /**
23
+   * @param integer $confirmation_type_safe
24
+   * @param string $email_unsafe
25
+   */
21 26
   public function db_confirmation_get_latest_by_type_and_email($confirmation_type_safe, $email_unsafe) {
22 27
     $email_safe = $this->db->db_escape($email_unsafe);
23 28
 
@@ -26,12 +31,21 @@  discard block
 block discarded – undo
26 31
           `type` = {$confirmation_type_safe} AND `email` = '{$email_safe}' ORDER BY create_time DESC LIMIT 1;", true);
27 32
   }
28 33
   // TODO - OK 4.6
34
+
35
+  /**
36
+   * @param integer $confirmation_type_safe
37
+   */
29 38
   public function db_confirmation_delete_by_type_and_email($confirmation_type_safe, $email_unsafe) {
30 39
     $email_safe = $this->db->db_escape($email_unsafe);
31 40
 
32 41
     return $this->db->doquery("DELETE FROM {{confirmations}} WHERE `type` = {$confirmation_type_safe} AND `email` = '{$email_safe}'");
33 42
   }
34 43
   // TODO - OK 4.6
44
+
45
+  /**
46
+   * @param integer $confirmation_type_safe
47
+   * @param string $email_unsafe
48
+   */
35 49
   public function db_confirmation_get_unique_code_by_type_and_email($confirmation_type_safe, $email_unsafe) {
36 50
     $email_safe = $this->db->db_escape($email_unsafe);
37 51
 
@@ -50,6 +64,11 @@  discard block
 block discarded – undo
50 64
     return $confirm_code_unsafe;
51 65
   }
52 66
   // TODO - OK 4.6
67
+
68
+  /**
69
+   * @param integer $confirmation_type_safe
70
+   * @param string $confirmation_code_unsafe
71
+   */
53 72
   public function db_confirmation_get_by_type_and_code($confirmation_type_safe, $confirmation_code_unsafe) {
54 73
     $confirmation_code_safe = $this->db->db_escape($confirmation_code_unsafe);
55 74
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
       // $query = static::$db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' AND `type` = {$confirmation_type_safe} FOR UPDATE", true);
42 42
       // Тип не нужен для проверки - код подтверждения должен быть уникален от слова "совсем"
43 43
       $query = $this->db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE", true);
44
-    } while($query);
44
+    } while ($query);
45 45
 
46 46
     $this->db->doquery(
47 47
       "REPLACE INTO {{confirmations}}
Please login to merge, or discard this patch.
classes/sn_module_payment.php 2 patches
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
    * Рассчёт бонуса ММ
703 703
    *
704 704
    * @param            $dark_matter
705
-   * @param bool|true  $direct
705
+   * @param boolean  $direct
706 706
    * @param bool|false $return_bonus
707 707
    *
708 708
    * @return float|int
@@ -738,6 +738,12 @@  discard block
 block discarded – undo
738 738
 
739 739
   // Дополнительная ре-трансляция адреса, если в каком-то случае платежная система ожидает нелогичный ответ
740 740
   // Пример: иксолла при неправильно заданном пользователе в ордере ожидает НЕПРАВИЛЬНЫЙ_ОРДЕР, а не НЕПРАВИЛЬНЫЙ_ПОЛЬЗОВАТЕЛЬ
741
+
742
+  /**
743
+   * @param integer $error_code
744
+   *
745
+   * @return integer|null
746
+   */
741 747
   function retranslate_error($error_code, $options = array()) {
742 748
     return isset($options['retranslate_error'][$error_code]) ? $options['retranslate_error'][$error_code] : $error_code;
743 749
   }
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
   public function compile_request($request) {
451 451
     global $config, $lang, $user;
452 452
 
453
-    if(!(classSupernova::$auth->account instanceof Account)) {
453
+    if (!(classSupernova::$auth->account instanceof Account)) {
454 454
       // TODO - throw new Exception($lang['pay_msg_mm_request_amount_invalid'], SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT);
455 455
     }
456 456
     $this->account = classSupernova::$auth->account;
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
     $this->payment_currency = $config->payment_currency_default;
472 472
     $this->payment_amount = self::currency_convert($this->payment_dark_matter_paid, 'MM_', $this->payment_currency);
473 473
 
474
-    if(empty($this->payment_external_currency) && !empty($this->config['currency'])) {
474
+    if (empty($this->payment_external_currency) && !empty($this->config['currency'])) {
475 475
       $this->payment_external_currency = $this->config['currency'];
476 476
     }
477
-    if(empty($this->payment_external_currency)) {
477
+    if (empty($this->payment_external_currency)) {
478 478
       throw new Exception($lang['pay_error_internal_no_external_currency_set'], SN_PAYMENT_ERROR_INTERNAL_NO_EXTERNAL_CURRENCY_SET);
479 479
     }
480 480
 
481 481
     $this->payment_external_amount = self::currency_convert($this->payment_dark_matter_paid, 'MM_', $this->payment_external_currency);
482
-    if($this->payment_external_amount < 0.01) {
482
+    if ($this->payment_external_amount < 0.01) {
483 483
       throw new Exception($lang['pay_msg_mm_request_amount_invalid'], SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT);
484 484
     }
485 485
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     $this->generate_description();
489 489
 
490 490
     $this->db_insert();
491
-    if(!$this->is_exists) {
491
+    if (!$this->is_exists) {
492 492
       throw new Exception($lang['pay_msg_request_error_db_payment_create'], SN_PAYMENT_REQUEST_DB_ERROR_PAYMENT_CREATE);
493 493
     }
494 494
   }
@@ -503,24 +503,24 @@  discard block
 block discarded – undo
503 503
   protected function payment_request_process($options = array()) {
504 504
     global $lang, $config;
505 505
 
506
-    if(!$this->manifest['active']) {
506
+    if (!$this->manifest['active']) {
507 507
       throw new Exception($lang['pay_msg_module_disabled'], SN_MODULE_DISABLED);
508 508
     }
509 509
 
510 510
     // Если есть payment_id - загружаем под него данные
511
-    if(!empty($this->payment_params['payment_id'])) {
511
+    if (!empty($this->payment_params['payment_id'])) {
512 512
       $this->request_payment_id = sys_get_param_id($this->payment_params['payment_id']);
513
-      if(!$this->request_payment_id) {
513
+      if (!$this->request_payment_id) {
514 514
         throw new Exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG);
515 515
       }
516 516
 
517
-      if(!$this->db_get_by_id($this->request_payment_id)) {
517
+      if (!$this->db_get_by_id($this->request_payment_id)) {
518 518
         throw new Exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_INTERNAL_ID_WRONG);
519 519
       }
520 520
 
521 521
       // Проверяем - был ли этот платеж обработан?
522 522
       // TODO - Статусы бывают разные. Нужен спецфлаг payment_processed
523
-      if($this->payment_status != PAYMENT_STATUS_NONE) {
523
+      if ($this->payment_status != PAYMENT_STATUS_NONE) {
524 524
         sn_db_transaction_rollback();
525 525
         sys_redirect(SN_ROOT_VIRTUAL . 'metamatter.php?payment_id=' . $this->payment_id);
526 526
         die();
@@ -530,89 +530,89 @@  discard block
 block discarded – undo
530 530
     // Пытаемся получить из запроса ИД аккаунта
531 531
     $request_account_id = !empty($this->payment_params['account_id']) ? sys_get_param_id($this->payment_params['account_id']) : 0;
532 532
     // Если в запросе нет ИД аккаунта - пытаемся использовать payment_account_id
533
-    if(empty($request_account_id) && !empty($this->payment_account_id)) {
533
+    if (empty($request_account_id) && !empty($this->payment_account_id)) {
534 534
       $request_account_id = $this->payment_account_id;
535 535
     }
536 536
     // Если теперь у нас нету ИД аккаунта ни в запросе, ни в записи таблицы - можно паниковать
537
-    if(empty($request_account_id)) {
537
+    if (empty($request_account_id)) {
538 538
       // TODO - аккаунт
539 539
       throw new Exception($lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
540 540
     }
541 541
     // Если нет записи в таблице - тогда берем payment_account_id из запроса
542
-    if(empty($this->payment_account_id)) {
542
+    if (empty($this->payment_account_id)) {
543 543
       $this->payment_account_id = $request_account_id;
544 544
     }
545 545
     // Если у нас отличаются ИД аккаунта в запросе и ИД аккаунта в записи - тоже можно паниковать
546
-    if($this->payment_account_id != $request_account_id) {
546
+    if ($this->payment_account_id != $request_account_id) {
547 547
       // TODO - Поменять сообщение об ошибке
548 548
       throw new Exception($lang['pay_msg_request_user_invalid'], $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
549 549
     }
550 550
     // Проверяем существование аккаунта с данным ИД
551
-    if(!$this->account->db_get_by_id($this->payment_account_id)) {
551
+    if (!$this->account->db_get_by_id($this->payment_account_id)) {
552 552
       throw new Exception($lang['pay_msg_request_user_invalid'] . ' ID ' . $this->payment_account_id, $this->retranslate_error(SN_PAYMENT_REQUEST_USER_NOT_FOUND, $options));
553 553
     }
554 554
 
555 555
     // TODO Проверка на сервер_ид - как бы и не нужна, наверное?
556
-    if(!empty($this->payment_params['server_id'])) {
556
+    if (!empty($this->payment_params['server_id'])) {
557 557
       $this->request_server_id = sys_get_param_str($this->payment_params['server_id']);
558
-      if(SN_ROOT_VIRTUAL != $this->request_server_id) {
558
+      if (SN_ROOT_VIRTUAL != $this->request_server_id) {
559 559
         throw new Exception($lang['pay_msg_request_server_wrong'] . " {$this->request_server_id} вместо " . SN_ROOT_VIRTUAL, SN_PAYMENT_REQUEST_SERVER_WRONG);
560 560
       }
561 561
     }
562 562
 
563 563
     // Сверка количества оплаченной ММ с учётом бонусов
564
-    if(!empty($this->payment_params['payment_dark_matter_gained'])) {
564
+    if (!empty($this->payment_params['payment_dark_matter_gained'])) {
565 565
       $request_mm_amount = sys_get_param_id($this->payment_params['payment_dark_matter_gained']);
566
-      if($request_mm_amount != $this->payment_dark_matter_gained && $this->is_loaded) {
566
+      if ($request_mm_amount != $this->payment_dark_matter_gained && $this->is_loaded) {
567 567
         throw new Exception($lang['pay_msg_mm_request_amount_invalid'] . " пришло {$request_mm_amount} ММ вместо {$this->payment_dark_matter_gained} ММ", SN_PAYMENT_REQUEST_MM_AMOUNT_INVALID);
568 568
       }
569 569
       empty($this->payment_dark_matter_gained) ? $this->payment_dark_matter_gained = $request_mm_amount : false;
570 570
     }
571
-    if(empty($this->payment_dark_matter_paid)) {
571
+    if (empty($this->payment_dark_matter_paid)) {
572 572
       // TODO - обратный расчёт из gained
573 573
     }
574 574
 
575 575
     // Проверка наличия внешнего ИД платежа
576
-    if(!empty($this->payment_params['payment_external_id'])) {
576
+    if (!empty($this->payment_params['payment_external_id'])) {
577 577
       $request_payment_external_id = sys_get_param_id($this->payment_params['payment_external_id']);
578
-      if(empty($request_payment_external_id)) {
578
+      if (empty($request_payment_external_id)) {
579 579
         throw new exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG);
580
-      } elseif(!empty($this->payment_external_id) && $this->payment_external_id != $request_payment_external_id) {
580
+      } elseif (!empty($this->payment_external_id) && $this->payment_external_id != $request_payment_external_id) {
581 581
         // TODO - Может быть поменять сообщение
582 582
         throw new exception($lang['pay_msg_request_payment_id_invalid'], SN_PAYMENT_REQUEST_EXTERNAL_ID_WRONG);
583 583
       }
584 584
       $this->payment_external_id = $request_payment_external_id;
585 585
     }
586 586
     // Сверка суммы, запрошенной СН к оплате
587
-    if(!empty($this->payment_params['payment_external_money'])) {
587
+    if (!empty($this->payment_params['payment_external_money'])) {
588 588
       $request_money_out = sys_get_param_float($this->payment_params['payment_external_money']);
589
-      if($request_money_out != $this->payment_external_amount && $this->is_loaded) {
589
+      if ($request_money_out != $this->payment_external_amount && $this->is_loaded) {
590 590
         throw new Exception($lang['pay_msg_request_payment_amount_invalid'] . " пришло {$request_money_out} денег вместо {$this->payment_external_amount} денег", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
591 591
       }
592 592
       empty($this->payment_external_amount) ? $this->payment_external_amount = $request_money_out : false;
593 593
     }
594 594
     // Заполняем поле валюты платёжной системы
595
-    if(!empty($this->payment_params['payment_external_currency'])) {
595
+    if (!empty($this->payment_params['payment_external_currency'])) {
596 596
       $this->payment_external_currency = sys_get_param_str($this->payment_params['payment_external_currency']);
597
-      if(empty($this->payment_external_currency)) {
597
+      if (empty($this->payment_external_currency)) {
598 598
         // TODO - поменять сообщение
599 599
         throw new Exception($lang['pay_msg_request_payment_amount_invalid'] . " {$this->payment_external_currency}", SN_PAYMENT_REQUEST_CURRENCY_AMOUNT_INVALID);
600 600
       }
601 601
     }
602
-    if(empty($this->payment_external_currency)) {
602
+    if (empty($this->payment_external_currency)) {
603 603
       $this->payment_external_currency = $this->config['currency'];
604 604
     }
605 605
 
606 606
     // Заполнение внутренней суммы и валюты из внешних данных
607
-    if(empty($this->payment_currency)) {
607
+    if (empty($this->payment_currency)) {
608 608
       $this->payment_currency = $config->payment_currency_default;
609 609
     }
610
-    if(empty($this->payment_amount) && !empty($this->payment_external_currency)) {
610
+    if (empty($this->payment_amount) && !empty($this->payment_external_currency)) {
611 611
       $this->payment_amount = self::currency_convert($this->payment_external_amount, $this->payment_external_currency, $this->payment_currency);
612 612
     }
613 613
 
614 614
     // TODO - Тестовый режим
615
-    if(!empty($this->payment_params['test'])) {
615
+    if (!empty($this->payment_params['test'])) {
616 616
       $this->payment_test = $this->config['test'] || sys_get_param_int($this->payment_params['test']);
617 617
     }
618 618
 
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
     sn_db_transaction_start();
642 642
     try {
643 643
       $response = $this->payment_request_process();
644
-    } catch(Exception $e) {
644
+    } catch (Exception $e) {
645 645
       $response['result'] = $e->getCode();
646 646
       $response['message'] = $e->getMessage();
647 647
     }
648 648
 
649
-    if($response['result'] == SN_PAYMENT_REQUEST_OK) {
649
+    if ($response['result'] == SN_PAYMENT_REQUEST_OK) {
650 650
       sn_db_transaction_commit();
651 651
       $debug->warning('Результат операции: код ' . $response['result'] . ' сообщение "' . $response['message'] . '"', 'Успешный платёж', LOG_INFO_PAYMENT);
652 652
     } else {
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
     }
656 656
 
657 657
     // Переводим код результата из СН в код платежной системы
658
-    if(is_array($this->result_translations) && !empty($this->result_translations)) {
658
+    if (is_array($this->result_translations) && !empty($this->result_translations)) {
659 659
       $response['result'] = isset($this->result_translations[$response['result']]) ? $this->result_translations[$response['result']] : $this->result_translations[SN_PAYMENT_REQUEST_UNDEFINED_ERROR];
660 660
     }
661 661
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     $currency_from = strtolower($currency_from);
681 681
     $currency_to = strtolower($currency_to);
682 682
 
683
-    if($currency_from != $currency_to) {
683
+    if ($currency_from != $currency_to) {
684 684
 //      $config_currency_from_name = 'payment_currency_exchange_' . $currency_from;
685 685
 //      $config_currency_to_name = 'payment_currency_exchange_' . $currency_to;
686 686
 
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
   public static function bonus_calculate($dark_matter, $direct = true, $return_bonus = false) {
711 711
     $bonus = 0;
712 712
     $dark_matter_new = $dark_matter;
713
-    if(!empty(self::$bonus_table) && $dark_matter >= self::$bonus_table[0]) {
714
-      if($direct) {
715
-        foreach(self::$bonus_table as $dm_for_bonus => $multiplier) {
716
-          if($dm_for_bonus <= $dark_matter) {
713
+    if (!empty(self::$bonus_table) && $dark_matter >= self::$bonus_table[0]) {
714
+      if ($direct) {
715
+        foreach (self::$bonus_table as $dm_for_bonus => $multiplier) {
716
+          if ($dm_for_bonus <= $dark_matter) {
717 717
             $dark_matter_new = $dark_matter * (1 + $multiplier);
718 718
             $bonus = $multiplier;
719 719
           } else {
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
           }
722 722
         }
723 723
       } else {
724
-        foreach(self::$bonus_table as $dm_for_bonus => $multiplier) {
724
+        foreach (self::$bonus_table as $dm_for_bonus => $multiplier) {
725 725
           $temp = $dm_for_bonus * (1 + $multiplier);
726
-          if($dark_matter >= $temp) {
726
+          if ($dark_matter >= $temp) {
727 727
             $dark_matter_new = round($dark_matter / (1 + $multiplier));
728 728
             $bonus = $multiplier;
729 729
           } else {
@@ -779,13 +779,13 @@  discard block
 block discarded – undo
779 779
     );
780 780
 
781 781
     $replace = false;
782
-    if($this->payment_id) {
782
+    if ($this->payment_id) {
783 783
       $payment['payment_id'] = $this->payment_id;
784 784
       $replace = true;
785 785
     }
786 786
 
787 787
     $query = array();
788
-    foreach($payment as $key => $value) {
788
+    foreach ($payment as $key => $value) {
789 789
       $value = is_string($value) ? '"' . db_escape($value) . '"' : $value;
790 790
       $query[] = "`{$key}` = {$value}";
791 791
     }
@@ -797,12 +797,12 @@  discard block
 block discarded – undo
797 797
 
798 798
 
799 799
   function payment_adjust_mm_new() {
800
-    if(!$this->payment_test) {
800
+    if (!$this->payment_test) {
801 801
       // Not a test payment. Adding DM to account
802 802
       $this->account = new Account($this->db);
803 803
       $this->account->db_get_by_id($this->payment_account_id);
804 804
       $result = $this->account->metamatter_change(RPG_PURCHASE, $this->payment_dark_matter_gained, $this->payment_comment);
805
-      if(!$result) {
805
+      if (!$result) {
806 806
         throw new Exception('Ошибка начисления ММ', SN_METAMATTER_ERROR_ADJUST);
807 807
       }
808 808
     }
@@ -812,25 +812,25 @@  discard block
 block discarded – undo
812 812
     die('{НЕ РАБОТАЕТ! СООБЩИТЕ АДМИНИСТРАЦИИ!}');
813 813
     global $lang;
814 814
 
815
-    if(!isset($payment['payment_status'])) {
815
+    if (!isset($payment['payment_status'])) {
816 816
       throw new exception($lang['pay_msg_request_payment_not_found'], SN_PAYMENT_REQUEST_ORDER_NOT_FOUND);
817 817
     }
818 818
 
819
-    if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) {
820
-      $safe_comment = db_escape($payment['payment_comment'] = $lang['pay_msg_request_payment_cancelled'] .' ' . $payment['payment_comment']);
819
+    if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) {
820
+      $safe_comment = db_escape($payment['payment_comment'] = $lang['pay_msg_request_payment_cancelled'] . ' ' . $payment['payment_comment']);
821 821
 
822
-      if(!$payment['payment_test']) {
822
+      if (!$payment['payment_test']) {
823 823
         $result = $this->account->metamatter_change(RPG_PURCHASE_CANCEL, -$payment['payment_dark_matter_gained'], $payment['payment_comment']);
824
-        if(!$result) {
824
+        if (!$result) {
825 825
           throw new exception('Ошибка начисления ММ', SN_METAMATTER_ERROR_ADJUST);
826 826
         }
827 827
       }
828 828
       $payment['payment_status'] = PAYMENT_STATUS_CANCELED;
829 829
       doquery("UPDATE {{payment}} SET payment_status = {$payment['payment_status']}, payment_comment = '{$safe_comment}' WHERE payment_id = {$payment['payment_id']};");
830 830
       throw new exception($lang['pay_msg_request_payment_cancel_complete'], SN_PAYMENT_REQUEST_OK);
831
-    } elseif($payment['payment_status'] == PAYMENT_STATUS_CANCELED) {
831
+    } elseif ($payment['payment_status'] == PAYMENT_STATUS_CANCELED) {
832 832
       throw new exception($lang['pay_msg_request_payment_cancelled_already'], SN_PAYMENT_REQUEST_OK);
833
-    } elseif($payment['payment_status'] == PAYMENT_STATUS_NONE) {
833
+    } elseif ($payment['payment_status'] == PAYMENT_STATUS_NONE) {
834 834
       throw new exception($lang['pay_msg_request_payment_cancel_not_complete'], SN_PAYMENT_REQUEST_PAYMENT_NOT_COMPLETE);
835 835
     }
836 836
   }
@@ -844,8 +844,8 @@  discard block
 block discarded – undo
844 844
 
845 845
   protected function db_complete_payment() {
846 846
     // TODO - поле payment_processed
847
-    if($this->payment_status == PAYMENT_STATUS_NONE) {
848
-      if(!defined('PAYMENT_EXPIRE_TIME') || PAYMENT_EXPIRE_TIME == 0 || empty($this->payment_date) || strtotime($this->payment_date) + PAYMENT_EXPIRE_TIME <= SN_TIME_NOW) {
847
+    if ($this->payment_status == PAYMENT_STATUS_NONE) {
848
+      if (!defined('PAYMENT_EXPIRE_TIME') || PAYMENT_EXPIRE_TIME == 0 || empty($this->payment_date) || strtotime($this->payment_date) + PAYMENT_EXPIRE_TIME <= SN_TIME_NOW) {
849 849
         $this->payment_adjust_mm_new();
850 850
         $this->payment_status = PAYMENT_STATUS_COMPLETE;
851 851
       } else {
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
   protected function db_assign_payment($payment = null) {
893 893
     $this->payment_reset();
894 894
 
895
-    if(is_array($payment) && isset($payment['payment_id'])) {
895
+    if (is_array($payment) && isset($payment['payment_id'])) {
896 896
       $this->payment_id = $payment['payment_id'];
897 897
       $this->payment_status = $payment['payment_status'];
898 898
       $this->payment_date = $payment['payment_date'];
Please login to merge, or discard this patch.
classes/template.php 5 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -103,6 +103,7 @@
 block discarded – undo
103 103
   /**
104 104
   * Set custom template location (able to use directory outside of phpBB)
105 105
   * @access public
106
+  * @param string $template_path
106 107
   */
107 108
   function set_custom_template($template_path, $template_name, $fallback_template_path = false)
108 109
   {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
       // Search array to get correct position
587 587
       list($search_key, $search_value) = @each($key);
588 588
 
589
-      $key = NULL;
589
+      $key = null;
590 590
       foreach ($this->_tpldata[$blockname] as $i => $val_ary)
591 591
       {
592 592
         if ($val_ary[$search_key] === $search_value)
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
       }
598 598
 
599 599
       // key/value pair not found
600
-      if ($key === NULL)
600
+      if ($key === null)
601 601
       {
602 602
         return false;
603 603
       }
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 class template
26 26
 {
27 27
   /** variable that holds all the data we'll be substituting into
28
-  * the compiled templates. Takes form:
29
-  * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
30
-  * if it's a root-level variable, it'll be like this:
31
-  * --> $this->_tpldata[.][0][varname] == value
32
-  */
28
+   * the compiled templates. Takes form:
29
+   * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
30
+   * if it's a root-level variable, it'll be like this:
31
+   * --> $this->_tpldata[.][0][varname] == value
32
+   */
33 33
   var $_tpldata = array('.' => array(0 => array()));
34 34
   var $_rootref;
35 35
 //  var $_block_counter = array();
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
   }
80 80
 
81 81
   /**
82
-  * Set template location
83
-  * @access public
84
-  */
82
+   * Set template location
83
+   * @access public
84
+   */
85 85
   function set_template()
86 86
   {
87 87
     global $user;
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
   }
121 121
 
122 122
   /**
123
-  * Set custom template location (able to use directory outside of phpBB)
124
-  * @access public
125
-  */
123
+   * Set custom template location (able to use directory outside of phpBB)
124
+   * @access public
125
+   */
126 126
   function set_custom_template($template_path, $template_name, $fallback_template_path = false)
127 127
   {
128 128
     global $user;
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
   }
162 162
 
163 163
   /**
164
-  * Sets the template filenames for handles. $filename_array
165
-  * should be a hash of handle => filename pairs.
166
-  * @access public
167
-  */
164
+   * Sets the template filenames for handles. $filename_array
165
+   * should be a hash of handle => filename pairs.
166
+   * @access public
167
+   */
168 168
   function set_filenames($filename_array)
169 169
   {
170 170
     if (!is_array($filename_array))
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
   }
192 192
 
193 193
   /**
194
-  * Destroy template data set
195
-  * @access public
196
-  */
194
+   * Destroy template data set
195
+   * @access public
196
+   */
197 197
   function destroy()
198 198
   {
199 199
     $this->_tpldata = array('.' => array(0 => array()));
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
   }
202 202
 
203 203
   /**
204
-  * Reset/empty complete block
205
-  * @access public
206
-  */
204
+   * Reset/empty complete block
205
+   * @access public
206
+   */
207 207
   function destroy_block_vars($blockname)
208 208
   {
209 209
     if (strpos($blockname, '.') !== false)
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
   }
232 232
 
233 233
   /**
234
-  * Display handle
235
-  * @access public
236
-  */
234
+   * Display handle
235
+   * @access public
236
+   */
237 237
   function display($handle, $include_once = true)
238 238
   {
239 239
     global $phpbb_hook,
240 240
           // This is used for accessing from compiled templates via include
241
-           $user, $lang, $config;
241
+            $user, $lang, $config;
242 242
 
243 243
     if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
244 244
     {
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
   }
271 271
 
272 272
   /**
273
-  * Display the handle and assign the output to a template variable or return the compiled result.
274
-  * @access public
275
-  */
273
+   * Display the handle and assign the output to a template variable or return the compiled result.
274
+   * @access public
275
+   */
276 276
   function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
277 277
   {
278 278
     ob_start();
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
   }
291 291
 
292 292
   /**
293
-  * Load a compiled template if possible, if not, recompile it
294
-  * @access private
295
-  */
293
+   * Load a compiled template if possible, if not, recompile it
294
+   * @access private
295
+   */
296 296
   function _tpl_load(&$handle)
297 297
   {
298 298
     global $user, $config;
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
   }
471 471
 
472 472
   /**
473
-  * Assign key variable pairs from an array
474
-  * @access public
475
-  */
473
+   * Assign key variable pairs from an array
474
+   * @access public
475
+   */
476 476
   function assign_vars($vararray)
477 477
   {
478 478
     foreach ($vararray as $key => $val)
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
   }
485 485
 
486 486
   /**
487
-  * Assign a single variable to a single key
488
-  * @access public
489
-  */
487
+   * Assign a single variable to a single key
488
+   * @access public
489
+   */
490 490
   function assign_var($varname, $varval)
491 491
   {
492 492
     $this->_rootref[$varname] = $varval;
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
   }
496 496
 
497 497
   /**
498
-  * Assign key variable pairs from an array to a specified block
499
-  * @access public
500
-  */
498
+   * Assign key variable pairs from an array to a specified block
499
+   * @access public
500
+   */
501 501
   function assign_block_vars($blockname, $vararray)
502 502
   {
503 503
     if (strpos($blockname, '.') !== false)
@@ -562,33 +562,33 @@  discard block
 block discarded – undo
562 562
   }
563 563
 
564 564
   /**
565
-  * Change already assigned key variable pair (one-dimensional - single loop entry)
566
-  *
567
-  * An example of how to use this function:
568
-  * {@example alter_block_array.php}
569
-  *
570
-  * @param  string  $blockname  the blockname, for example 'loop'
571
-  * @param  array $vararray the var array to insert/add or merge
572
-  * @param  mixed $key    Key to search for
573
-  *
574
-  * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
575
-  *
576
-  * int: Position [the position to change or insert at directly given]
577
-  *
578
-  * If key is false the position is set to 0
579
-  * If key is true the position is set to the last entry
580
-  *
581
-  * @param  string  $mode   Mode to execute (valid modes are 'insert' and 'change')
582
-  *
583
-  * If insert, the vararray is inserted at the given position (position counting from zero).
584
-  * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
585
-  *
586
-  * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
587
-  * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
588
-  *
589
-  * @return bool false on error, true on success
590
-  * @access public
591
-  */
565
+   * Change already assigned key variable pair (one-dimensional - single loop entry)
566
+   *
567
+   * An example of how to use this function:
568
+   * {@example alter_block_array.php}
569
+   *
570
+   * @param  string  $blockname  the blockname, for example 'loop'
571
+   * @param  array $vararray the var array to insert/add or merge
572
+   * @param  mixed $key    Key to search for
573
+   *
574
+   * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
575
+   *
576
+   * int: Position [the position to change or insert at directly given]
577
+   *
578
+   * If key is false the position is set to 0
579
+   * If key is true the position is set to the last entry
580
+   *
581
+   * @param  string  $mode   Mode to execute (valid modes are 'insert' and 'change')
582
+   *
583
+   * If insert, the vararray is inserted at the given position (position counting from zero).
584
+   * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
585
+   *
586
+   * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
587
+   * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
588
+   *
589
+   * @return bool false on error, true on success
590
+   * @access public
591
+   */
592 592
   function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
593 593
   {
594 594
     if (strpos($blockname, '.') !== false)
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
   }
673 673
 
674 674
   /**
675
-  * Include a separate template
676
-  * @access private
677
-  */
675
+   * Include a separate template
676
+   * @access private
677
+   */
678 678
   function _tpl_include($filename, $include = true)
679 679
   {
680 680
     global $lang, $config;
@@ -703,9 +703,9 @@  discard block
 block discarded – undo
703 703
   }
704 704
 
705 705
   /**
706
-  * Include a php-file
707
-  * @access private
708
-  */
706
+   * Include a php-file
707
+   * @access private
708
+   */
709 709
   function _php_include($filename)
710 710
   {
711 711
     $file = $this->rootPhysical . $filename;
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
720 720
   }
721 721
 
722 722
   /**
723
-  * Assign key variable pairs from an array with block support
724
-  * @access public
725
-  */
723
+   * Assign key variable pairs from an array with block support
724
+   * @access public
725
+   */
726 726
   function assign_recursive($values, $name = '')
727 727
   {
728 728
     if(isset($values['.']))
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
   {
87 87
     global $user;
88 88
 
89
-    if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template'))
89
+    if (file_exists($this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template'))
90 90
     {
91 91
       $this->root = $this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template';
92 92
       $this->cachepath = $this->rootPhysical . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_';
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
       // Re-position template blocks
646 646
       for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--)
647 647
       {
648
-        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
648
+        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1];
649 649
         $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
650 650
       }
651 651
 
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
   */
726 726
   function assign_recursive($values, $name = '')
727 727
   {
728
-    if(isset($values['.']))
728
+    if (isset($values['.']))
729 729
     {
730 730
       $values_extra = $values['.'];
731 731
       unset($values['.']);
732 732
     }
733 733
 
734
-    if(!$name)
734
+    if (!$name)
735 735
     {
736 736
       $this->assign_vars($values);
737 737
     }
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
       $this->assign_block_vars($name, $values);
741 741
     }
742 742
 
743
-    if(isset($values_extra))
743
+    if (isset($values_extra))
744 744
     {
745
-      foreach($values_extra as $sub_array_name => $sub_array)
745
+      foreach ($values_extra as $sub_array_name => $sub_array)
746 746
       {
747 747
         $new_name = $name . ($name ? '.' : '') . $sub_array_name;
748
-        foreach($sub_array as $sub_element)
748
+        foreach ($sub_array as $sub_element)
749 749
         {
750 750
           $this->assign_recursive($sub_element, $new_name);
751 751
         }
Please login to merge, or discard this patch.
Braces   +29 added lines, -58 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 * Base Template class.
23 23
 * @package phpBB3
24 24
 */
25
-class template
26
-{
25
+class template {
27 26
   /** variable that holds all the data we'll be substituting into
28 27
   * the compiled templates. Takes form:
29 28
   * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
@@ -82,8 +81,7 @@  discard block
 block discarded – undo
82 81
   * Set template location
83 82
   * @access public
84 83
   */
85
-  function set_template()
86
-  {
84
+  function set_template() {
87 85
     global $user;
88 86
 
89 87
     if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template'))
@@ -108,8 +106,7 @@  discard block
 block discarded – undo
108 106
       {
109 107
         $this->inherit_root = $this->rootPhysical . 'styles/' . $user->theme['template_inherit_path'] . '/template';
110 108
       }
111
-    }
112
-    else
109
+    } else
113 110
     {
114 111
       trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
115 112
     }
@@ -123,8 +120,7 @@  discard block
 block discarded – undo
123 120
   * Set custom template location (able to use directory outside of phpBB)
124 121
   * @access public
125 122
   */
126
-  function set_custom_template($template_path, $template_name, $fallback_template_path = false)
127
-  {
123
+  function set_custom_template($template_path, $template_name, $fallback_template_path = false) {
128 124
     global $user;
129 125
 
130 126
     // Make sure $template_path has no ending slash
@@ -145,8 +141,7 @@  discard block
 block discarded – undo
145 141
 
146 142
       $this->inherit_root = $fallback_template_path;
147 143
       $this->orig_tpl_inherits_id = true;
148
-    }
149
-    else
144
+    } else
150 145
     {
151 146
       $this->orig_tpl_inherits_id = false;
152 147
     }
@@ -165,8 +160,7 @@  discard block
 block discarded – undo
165 160
   * should be a hash of handle => filename pairs.
166 161
   * @access public
167 162
   */
168
-  function set_filenames($filename_array)
169
-  {
163
+  function set_filenames($filename_array) {
170 164
     if (!is_array($filename_array))
171 165
     {
172 166
       return false;
@@ -194,8 +188,7 @@  discard block
 block discarded – undo
194 188
   * Destroy template data set
195 189
   * @access public
196 190
   */
197
-  function destroy()
198
-  {
191
+  function destroy() {
199 192
     $this->_tpldata = array('.' => array(0 => array()));
200 193
     $this->_rootref = &$this->_tpldata['.'][0];
201 194
   }
@@ -204,8 +197,7 @@  discard block
 block discarded – undo
204 197
   * Reset/empty complete block
205 198
   * @access public
206 199
   */
207
-  function destroy_block_vars($blockname)
208
-  {
200
+  function destroy_block_vars($blockname) {
209 201
     if (strpos($blockname, '.') !== false)
210 202
     {
211 203
       // Nested block.
@@ -220,8 +212,7 @@  discard block
 block discarded – undo
220 212
       }
221 213
 
222 214
       unset($str[$blocks[$blockcount]]);
223
-    }
224
-    else
215
+    } else
225 216
     {
226 217
       // Top-level block.
227 218
       unset($this->_tpldata[$blockname]);
@@ -234,8 +225,7 @@  discard block
 block discarded – undo
234 225
   * Display handle
235 226
   * @access public
236 227
   */
237
-  function display($handle, $include_once = true)
238
-  {
228
+  function display($handle, $include_once = true) {
239 229
     global $phpbb_hook,
240 230
           // This is used for accessing from compiled templates via include
241 231
            $user, $lang, $config;
@@ -260,8 +250,7 @@  discard block
 block discarded – undo
260 250
     if ($filename = $this->_tpl_load($handle))
261 251
     {
262 252
       ($include_once) ? include_once($filename) : include($filename);
263
-    }
264
-    else
253
+    } else
265 254
     {
266 255
       eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
267 256
     }
@@ -273,8 +262,7 @@  discard block
 block discarded – undo
273 262
   * Display the handle and assign the output to a template variable or return the compiled result.
274 263
   * @access public
275 264
   */
276
-  function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
277
-  {
265
+  function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) {
278 266
     ob_start();
279 267
     $this->display($handle, $include_once);
280 268
     $contents = ob_get_clean();
@@ -293,8 +281,7 @@  discard block
 block discarded – undo
293 281
   * Load a compiled template if possible, if not, recompile it
294 282
   * @access private
295 283
   */
296
-  function _tpl_load(&$handle)
297
-  {
284
+  function _tpl_load(&$handle) {
298 285
     global $user, $config;
299 286
 
300 287
     if (!isset($this->filename[$handle]))
@@ -315,8 +302,7 @@  discard block
 block discarded – undo
315 302
     if (!file_exists($filename) || @filesize($filename) === 0)
316 303
     {
317 304
       $recompile = true;
318
-    }
319
-    else if ($config->load_tplcompile)
305
+    } else if ($config->load_tplcompile)
320 306
     {
321 307
       // No way around it: we need to check inheritance here
322 308
       if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
@@ -399,15 +385,13 @@  discard block
 block discarded – undo
399 385
               $this->files[$row['template_filename']] = $file;
400 386
               $this->files_inherit[$row['template_filename']] = $file;
401 387
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
402
-            }
403
-            else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
388
+            } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
404 389
             {
405 390
               // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that.
406 391
               $force_reload = true;
407 392
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
408 393
             }
409
-          }
410
-          else
394
+          } else
411 395
           {
412 396
             $this->files_template[$row['template_filename']] = $user->theme['template_id'];
413 397
           }
@@ -417,8 +401,7 @@  discard block
 block discarded – undo
417 401
             if ($row['template_filename'] == $this->filename[$handle])
418 402
             {
419 403
               $compile->_tpl_load_file($handle, true);
420
-            }
421
-            else
404
+            } else
422 405
             {
423 406
               $this->files[$row['template_filename']] = $file;
424 407
               $this->filename[$row['template_filename']] = $row['template_filename'];
@@ -433,8 +416,7 @@  discard block
 block discarded – undo
433 416
           {
434 417
             $this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
435 418
             $compile->compile_write($handle, $this->compiled_code[$handle]);
436
-          }
437
-          else
419
+          } else
438 420
           {
439 421
             // Only bother compiling if it doesn't already exist
440 422
             if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX))
@@ -445,8 +427,7 @@  discard block
 block discarded – undo
445 427
             }
446 428
           }
447 429
         }
448
-      }
449
-      else
430
+      } else
450 431
       {
451 432
         $file = $this->root . '/' . $row['template_filename'];
452 433
 
@@ -473,8 +454,7 @@  discard block
 block discarded – undo
473 454
   * Assign key variable pairs from an array
474 455
   * @access public
475 456
   */
476
-  function assign_vars($vararray)
477
-  {
457
+  function assign_vars($vararray) {
478 458
     foreach ($vararray as $key => $val)
479 459
     {
480 460
       $this->_rootref[$key] = $val;
@@ -487,8 +467,7 @@  discard block
 block discarded – undo
487 467
   * Assign a single variable to a single key
488 468
   * @access public
489 469
   */
490
-  function assign_var($varname, $varval)
491
-  {
470
+  function assign_var($varname, $varval) {
492 471
     $this->_rootref[$varname] = $varval;
493 472
 
494 473
     return true;
@@ -498,8 +477,7 @@  discard block
 block discarded – undo
498 477
   * Assign key variable pairs from an array to a specified block
499 478
   * @access public
500 479
   */
501
-  function assign_block_vars($blockname, $vararray)
502
-  {
480
+  function assign_block_vars($blockname, $vararray) {
503 481
     if (strpos($blockname, '.') !== false)
504 482
     {
505 483
       // Nested block.
@@ -534,8 +512,7 @@  discard block
 block discarded – undo
534 512
       // We're adding a new iteration to this block with the given
535 513
       // variable assignments.
536 514
       $str[$blocks[$blockcount]][] = $vararray;
537
-    }
538
-    else
515
+    } else
539 516
     {
540 517
       // Top-level block.
541 518
       $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
@@ -589,8 +566,7 @@  discard block
 block discarded – undo
589 566
   * @return bool false on error, true on success
590 567
   * @access public
591 568
   */
592
-  function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
593
-  {
569
+  function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') {
594 570
     if (strpos($blockname, '.') !== false)
595 571
     {
596 572
       // Nested blocks are not supported
@@ -635,8 +611,7 @@  discard block
 block discarded – undo
635 611
         $key = sizeof($this->_tpldata[$blockname]);
636 612
         unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
637 613
         $vararray['S_LAST_ROW'] = true;
638
-      }
639
-      else if ($key === 0)
614
+      } else if ($key === 0)
640 615
       {
641 616
         unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
642 617
         $vararray['S_FIRST_ROW'] = true;
@@ -675,8 +650,7 @@  discard block
 block discarded – undo
675 650
   * Include a separate template
676 651
   * @access private
677 652
   */
678
-  function _tpl_include($filename, $include = true)
679
-  {
653
+  function _tpl_include($filename, $include = true) {
680 654
     global $lang, $config;
681 655
 
682 656
     $handle = $filename;
@@ -706,8 +680,7 @@  discard block
 block discarded – undo
706 680
   * Include a php-file
707 681
   * @access private
708 682
   */
709
-  function _php_include($filename)
710
-  {
683
+  function _php_include($filename) {
711 684
     $file = $this->rootPhysical . $filename;
712 685
 
713 686
     if (!file_exists($file))
@@ -723,8 +696,7 @@  discard block
 block discarded – undo
723 696
   * Assign key variable pairs from an array with block support
724 697
   * @access public
725 698
   */
726
-  function assign_recursive($values, $name = '')
727
-  {
699
+  function assign_recursive($values, $name = '') {
728 700
     if(isset($values['.']))
729 701
     {
730 702
       $values_extra = $values['.'];
@@ -734,8 +706,7 @@  discard block
 block discarded – undo
734 706
     if(!$name)
735 707
     {
736 708
       $this->assign_vars($values);
737
-    }
738
-    else
709
+    } else
739 710
     {
740 711
       $this->assign_block_vars($name, $values);
741 712
     }
Please login to merge, or discard this patch.
classes/userOptions.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -151,6 +151,9 @@
 block discarded – undo
151 151
   }
152 152
 
153 153
 
154
+  /**
155
+   * @param integer $user_id
156
+   */
154 157
   public function __construct($user_id) {
155 158
     $this->user_change($user_id);
156 159
   }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 
123 123
     $update_cache = false;
124 124
 
125
-    if(!empty($this->to_write)) {
126
-      foreach($this->to_write as $key => $cork) {
125
+    if (!empty($this->to_write)) {
126
+      foreach ($this->to_write as $key => $cork) {
127 127
         $value = is_array($this->data[$key]) ? serialize($this->data[$key]) : $this->data[$key]; // Сериализация для массивов при сохранении в БД
128 128
         $this->to_write[$key] = "({$this->user_id}, '" . db_escape($key) . "', '" . db_escape($value) . "')";
129 129
       }
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
       $update_cache = true;
135 135
     }
136 136
 
137
-    if(!empty($this->to_delete)) {
138
-      foreach($this->to_delete as $key => &$value) {
139
-        $value = is_string($key) ? "'". db_escape($key) . "'" : $key;
137
+    if (!empty($this->to_delete)) {
138
+      foreach ($this->to_delete as $key => &$value) {
139
+        $value = is_string($key) ? "'" . db_escape($key) . "'" : $key;
140 140
       }
141 141
 
142
-      doquery("DELETE FROM {{player_options}} WHERE `player_id` = {$this->user_id} AND `option_id` IN (". implode(',', $this->to_delete) . ") ");
142
+      doquery("DELETE FROM {{player_options}} WHERE `player_id` = {$this->user_id} AND `option_id` IN (" . implode(',', $this->to_delete) . ") ");
143 143
 
144 144
       $this->to_delete = array();
145 145
       $update_cache = true;
146 146
     }
147 147
 
148
-    if($update_cache) {
148
+    if ($update_cache) {
149 149
       global $sn_cache;
150 150
 
151 151
       $field_name = $this->cached_name();
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
   protected function load() {
173 173
     global $sn_cache;
174 174
 
175
-    if($this->loaded) {
175
+    if ($this->loaded) {
176 176
       return;
177 177
     }
178 178
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     $this->to_write = array();
181 181
     $this->to_delete = array();
182 182
 
183
-    if(!$this->user_id) {
183
+    if (!$this->user_id) {
184 184
       $this->loaded = true;
185 185
       return;
186 186
     }
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
     $field_name = $this->cached_name();
189 189
     $a_data = $sn_cache->$field_name;
190 190
 
191
-    if(!empty($a_data)) {
191
+    if (!empty($a_data)) {
192 192
       $this->data = array_replace_recursive($this->data, $a_data);
193 193
       return;
194 194
     }
195 195
 
196 196
     $query = doquery("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE");
197
-    while($row = db_fetch($query)) {
197
+    while ($row = db_fetch($query)) {
198 198
       // $this->data[$row['option_id']] = $row['value'];
199 199
       $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация
200 200
     }
Please login to merge, or discard this patch.
classes/auth_abstract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
    */
36 36
   // OK 4.9
37 37
   public function __construct($filename = __FILE__) {
38
-    if($this->provider_id == ACCOUNT_PROVIDER_NONE) {
38
+    if ($this->provider_id == ACCOUNT_PROVIDER_NONE) {
39 39
       die('У всех провайдеров должен быть $provider_id!');
40 40
     }
41 41
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
   // OK 4.6
134 134
   public function player_name_suggest() {
135 135
     $name = '';
136
-    if(is_object($this->account) && !empty($this->account->account_email)) {
136
+    if (is_object($this->account) && !empty($this->account->account_email)) {
137 137
       list($name) = explode('@', $this->account->account_email);
138 138
     }
139 139
 
Please login to merge, or discard this patch.
classes/Pimple/Container.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@
 block discarded – undo
239 239
 
240 240
         $factory = $this->values[$id];
241 241
 
242
-        $extended = function ($c) use ($callable, $factory) {
242
+        $extended = function($c) use ($callable, $factory) {
243 243
             return $callable($factory($c), $c);
244 244
         };
245 245
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * @author  Fabien Potencier
33 33
  */
34
-class Container implements \ArrayAccess
35
-{
34
+class Container implements \ArrayAccess {
36 35
     private $values = array();
37 36
     private $factories;
38 37
     private $protected;
@@ -47,8 +46,7 @@  discard block
 block discarded – undo
47 46
      *
48 47
      * @param array $values The parameters or objects.
49 48
      */
50
-    public function __construct(array $values = array())
51
-    {
49
+    public function __construct(array $values = array()) {
52 50
         $this->factories = new \SplObjectStorage();
53 51
         $this->protected = new \SplObjectStorage();
54 52
 
@@ -71,8 +69,7 @@  discard block
 block discarded – undo
71 69
      *
72 70
      * @throws \RuntimeException Prevent override of a frozen service
73 71
      */
74
-    public function offsetSet($id, $value)
75
-    {
72
+    public function offsetSet($id, $value) {
76 73
         if (isset($this->frozen[$id])) {
77 74
             throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id));
78 75
         }
@@ -90,8 +87,7 @@  discard block
 block discarded – undo
90 87
      *
91 88
      * @throws \InvalidArgumentException if the identifier is not defined
92 89
      */
93
-    public function offsetGet($id)
94
-    {
90
+    public function offsetGet($id) {
95 91
         if (!isset($this->keys[$id])) {
96 92
             throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
97 93
         }
@@ -125,8 +121,7 @@  discard block
 block discarded – undo
125 121
      *
126 122
      * @return bool
127 123
      */
128
-    public function offsetExists($id)
129
-    {
124
+    public function offsetExists($id) {
130 125
         return isset($this->keys[$id]);
131 126
     }
132 127
 
@@ -135,8 +130,7 @@  discard block
 block discarded – undo
135 130
      *
136 131
      * @param string $id The unique identifier for the parameter or object
137 132
      */
138
-    public function offsetUnset($id)
139
-    {
133
+    public function offsetUnset($id) {
140 134
         if (isset($this->keys[$id])) {
141 135
             if (is_object($this->values[$id])) {
142 136
                 unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]);
@@ -155,8 +149,7 @@  discard block
 block discarded – undo
155 149
      *
156 150
      * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
157 151
      */
158
-    public function factory($callable)
159
-    {
152
+    public function factory($callable) {
160 153
         if (!method_exists($callable, '__invoke')) {
161 154
             throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.');
162 155
         }
@@ -177,8 +170,7 @@  discard block
 block discarded – undo
177 170
      *
178 171
      * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
179 172
      */
180
-    public function protect($callable)
181
-    {
173
+    public function protect($callable) {
182 174
         if (!method_exists($callable, '__invoke')) {
183 175
             throw new \InvalidArgumentException('Callable is not a Closure or invokable object.');
184 176
         }
@@ -197,8 +189,7 @@  discard block
 block discarded – undo
197 189
      *
198 190
      * @throws \InvalidArgumentException if the identifier is not defined
199 191
      */
200
-    public function raw($id)
201
-    {
192
+    public function raw($id) {
202 193
         if (!isset($this->keys[$id])) {
203 194
             throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
204 195
         }
@@ -223,8 +214,7 @@  discard block
 block discarded – undo
223 214
      *
224 215
      * @throws \InvalidArgumentException if the identifier is not defined or not a service definition
225 216
      */
226
-    public function extend($id, $callable)
227
-    {
217
+    public function extend($id, $callable) {
228 218
         if (!isset($this->keys[$id])) {
229 219
             throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
230 220
         }
@@ -256,8 +246,7 @@  discard block
 block discarded – undo
256 246
      *
257 247
      * @return array An array of value names
258 248
      */
259
-    public function keys()
260
-    {
249
+    public function keys() {
261 250
         return array_keys($this->values);
262 251
     }
263 252
 
@@ -269,8 +258,7 @@  discard block
 block discarded – undo
269 258
      *
270 259
      * @return static
271 260
      */
272
-    public function register(ServiceProviderInterface $provider, array $values = array())
273
-    {
261
+    public function register(ServiceProviderInterface $provider, array $values = array()) {
274 262
         $provider->register($this);
275 263
 
276 264
         foreach ($values as $key => $value) {
Please login to merge, or discard this patch.
classes/PlayerToAccountTranslate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   protected static $is_init = false;
20 20
 
21 21
   protected static function init() {
22
-    if(!empty(static::$db)) {
22
+    if (!empty(static::$db)) {
23 23
       return;
24 24
     }
25 25
     static::$db = classSupernova::$db;
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
     $provider_id_safe = intval($provider_id_unsafe);
67 67
     !is_array($account_list) ? $account_list = array($account_list) : false;
68 68
 
69
-    foreach($account_list as $provider_account_id_unsafe) {
69
+    foreach ($account_list as $provider_account_id_unsafe) {
70 70
       $provider_account_id_safe = intval($provider_account_id_unsafe);
71 71
 
72 72
       // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером
73 73
       $query = static::$db->doquery("SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE");
74
-      while($row = static::$db->db_fetch($query)) {
74
+      while ($row = static::$db->db_fetch($query)) {
75 75
         $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true;
76 76
       }
77 77
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
       "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} " .
92 92
       ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') .
93 93
       "ORDER BY `timestamp` FOR UPDATE");
94
-    while($row = static::$db->db_fetch($query)) {
94
+    while ($row = static::$db->db_fetch($query)) {
95 95
       $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row;
96 96
     }
97 97
 
Please login to merge, or discard this patch.
classes/classCache.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
   public function unset_by_prefix($prefix_unset = '') {
149 149
     static $array_clear;
150
-    !$array_clear ? $array_clear = function (&$v, $k, $p) {
150
+    !$array_clear ? $array_clear = function(&$v, $k, $p) {
151 151
       strpos($k, $p) === 0 ? $v = null : false;
152 152
     } : false;
153 153
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     if ($this->$name[0] === null) {
203 203
       for ($i = count($name) - 1; $i > 0; $i--) {
204 204
         $cName = "{$name[$i]}_COUNT";
205
-        $cName1 = "{$name[$i-1]}_COUNT";
205
+        $cName1 = "{$name[$i - 1]}_COUNT";
206 206
         if ($this->$cName1 == null || $i == 1) {
207 207
           $this->$cName++;
208 208
         }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
     for ($i = 1; $i < count($name); $i++) {
249 249
       $cName = "{$name[$i]}_COUNT";
250
-      $cName1 = "{$name[$i-1]}_COUNT";
250
+      $cName1 = "{$name[$i - 1]}_COUNT";
251 251
 
252 252
       if ($i == 1 || $this->$cName1 === null) {
253 253
         $this->$cName--;
Please login to merge, or discard this patch.
classes/Pimple/ServiceProviderInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@
 block discarded – undo
32 32
  * @author  Fabien Potencier
33 33
  * @author  Dominik Zogg
34 34
  */
35
-interface ServiceProviderInterface
36
-{
35
+interface ServiceProviderInterface {
37 36
     /**
38 37
      * Registers services on the given container.
39 38
      *
Please login to merge, or discard this patch.