浏览代码

Minor - add check_certificate_path() when using general certificate

Julio Montoya 5 年之前
父节点
当前提交
da322e57fa
共有 1 个文件被更改,包括 4 次插入16 次删除
  1. 4 16
      main/inc/lib/certificate.lib.php

+ 4 - 16
main/inc/lib/certificate.lib.php

@@ -87,8 +87,8 @@ class Certificate extends Model
             $this->html_file = $this->certification_user_path.basename($this->certificate_data['path_certificate']);
             $this->qr_file = $this->certification_user_path.$pathinfo['filename'].'_qr.png';
         } else {
-            $value = api_get_configuration_value('allow_general_certificate');
-            if ($value === true) {
+            $this->check_certificate_path();
+            if (api_get_configuration_value('allow_general_certificate')) {
                 // General certificate
                 $name = md5($this->user_id).'.html';
                 $my_path_certificate = $this->certification_user_path.$name;
@@ -125,13 +125,6 @@ class Certificate extends Model
                         $updateCertificateData
                     );
                     $this->certificate_data['path_certificate'] = $path_certificate;
-
-                    if ($this->isHtmlFileGenerated()) {
-                        if (!empty($file_info)) {
-                            //$text = $this->parse_certificate_variables($new_content_html['variables']);
-                            //$this->generate_qr($text, $qr_code_filename);
-                        }
-                    }
                 }
             }
         }
@@ -332,6 +325,8 @@ class Certificate extends Model
                 }
             }
         } else {
+            $this->check_certificate_path();
+
             // General certificate
             $name = md5($this->user_id).'.html';
             $my_path_certificate = $this->certification_user_path.$name;
@@ -366,13 +361,6 @@ class Certificate extends Model
                     $path_certificate
                 );
                 $this->certificate_data['path_certificate'] = $path_certificate;
-
-                if ($this->isHtmlFileGenerated()) {
-                    if (!empty($file_info)) {
-                        //$text = $this->parse_certificate_variables($new_content_html['variables']);
-                        //$this->generate_qr($text, $qr_code_filename);
-                    }
-                }
             }
 
             return $result;