Selaa lähdekoodia

Update app_defaults.php

FusionPBX 6 vuotta sitten
vanhempi
commit
5a56f27fb5
1 muutettua tiedostoa jossa 50 lisäystä ja 41 poistoa
  1. 50 41
      core/users/app_defaults.php

+ 50 - 41
core/users/app_defaults.php

@@ -86,48 +86,57 @@ if ($domains_processed == 1) {
 
 	//insert default password reset email template
 		if (file_exists($_SERVER['DOCUMENT_ROOT'].'/app/email_templates')) {
-			//build the array
-			$x = 0;
-			$array['email_templates'][$x]['email_template_uuid'] = '05b529c4-fba7-4071-bab3-143b076392e7';
-			$array['email_templates'][$x]['template_language'] = 'en-us';
-			$array['email_templates'][$x]['template_category'] = 'password_reset';
-			$array['email_templates'][$x]['template_subcategory'] = 'default';
-			$array['email_templates'][$x]['template_subject'] = 'Password Reset';
-			$array['email_templates'][$x]['template_body'] .= "<html>\n";
-			$array['email_templates'][$x]['template_body'] .= "<body>\n";
-			$array['email_templates'][$x]['template_body'] .= "<center><a href='https://\${domain}'><img src='\${logo_full}' style='width: 200px; height: auto; border: none;'></a></center><br />\n";
-			$array['email_templates'][$x]['template_body'] .= "A password reset was just requested for the FusionPBX user account associated with this email address.<br /><br />\n";
-			$array['email_templates'][$x]['template_body'] .= "<b>If you submitted this request</b>, click the button below to begin the password reset process for your user account.<br /><br />";
-			$array['email_templates'][$x]['template_body'] .= "\${reset_button}<br /><br />\n";
-			$array['email_templates'][$x]['template_body'] .= "If you did not initiate this action, however, please ignore this message and your password will remain unchanged.\n";
-			$array['email_templates'][$x]['template_body'] .= "If you have questions or concerns regarding this email, please contact your system administrator.";
-			$array['email_templates'][$x]['template_body'] .= "<br /><br /><br />\n";
-			$array['email_templates'][$x]['template_body'] .= "<a href='https://\${domain}'><img src='\${logo_shield}' width='31' height='30' border='0' align='left' style='margin-top: 3px; margin-right: 5px;'></a>\n";
-			$array['email_templates'][$x]['template_body'] .= "<i><b>FusionPBX</b></i><br />\n";
-			$array['email_templates'][$x]['template_body'] .= "<a href='https://\${domain}'>\${domain}</a>\n";
-			$array['email_templates'][$x]['template_body'] .= "<br /><br /><br />\n";
-			$array['email_templates'][$x]['template_body'] .= "</body>\n";
-			$array['email_templates'][$x]['template_body'] .= "</html>\n";
-			$array['email_templates'][$x]['template_type'] = 'html';
-			$array['email_templates'][$x]['template_enabled'] = 'true';
-			$array['email_templates'][$x]['template_description'] = 'Default password reset email template.';
-			$x++;
-
-			//add the temporary permission
-			$p = new permissions;
-			$p->add("email_template_add", 'temp');
-			$p->add("email_template_edit", 'temp');
-
-			//save to the data
+
+			//add the email templates to the database
+			$sql = "select count(*) as num_rows from v_email_templates ";
+			$sql .= "where email_template_uuid = '05b529c4-fba7-4071-bab3-143b076392e7' ";
 			$database = new database;
-			$database->app_name = 'email_templates';
-			$database->app_uuid = '8173e738-2523-46d5-8943-13883befd2fd';
-			$database->save($array);
-			unset($array);
-
-			//remove the temporary permission
-			$p->delete("email_template_add", 'temp');
-			$p->delete("email_template_edit", 'temp');
+			$num_rows = $database->select($sql, $parameters, 'column');
+			if ($row['num_rows'] == 0) {
+
+				//build the array
+				$x = 0;
+				$array['email_templates'][$x]['email_template_uuid'] = '05b529c4-fba7-4071-bab3-143b076392e7';
+				$array['email_templates'][$x]['template_language'] = 'en-us';
+				$array['email_templates'][$x]['template_category'] = 'password_reset';
+				$array['email_templates'][$x]['template_subcategory'] = 'default';
+				$array['email_templates'][$x]['template_subject'] = 'Password Reset';
+				$array['email_templates'][$x]['template_body'] .= "<html>\n";
+				$array['email_templates'][$x]['template_body'] .= "<body>\n";
+				$array['email_templates'][$x]['template_body'] .= "<center><a href='https://\${domain}'><img src='\${logo_full}' style='width: 200px; height: auto; border: none;'></a></center><br />\n";
+				$array['email_templates'][$x]['template_body'] .= "A password reset was just requested for the FusionPBX user account associated with this email address.<br /><br />\n";
+				$array['email_templates'][$x]['template_body'] .= "<b>If you submitted this request</b>, click the button below to begin the password reset process for your user account.<br /><br />";
+				$array['email_templates'][$x]['template_body'] .= "\${reset_button}<br /><br />\n";
+				$array['email_templates'][$x]['template_body'] .= "If you did not initiate this action, however, please ignore this message and your password will remain unchanged.\n";
+				$array['email_templates'][$x]['template_body'] .= "If you have questions or concerns regarding this email, please contact your system administrator.";
+				$array['email_templates'][$x]['template_body'] .= "<br /><br /><br />\n";
+				$array['email_templates'][$x]['template_body'] .= "<a href='https://\${domain}'><img src='\${logo_shield}' width='31' height='30' border='0' align='left' style='margin-top: 3px; margin-right: 5px;'></a>\n";
+				$array['email_templates'][$x]['template_body'] .= "<i><b>FusionPBX</b></i><br />\n";
+				$array['email_templates'][$x]['template_body'] .= "<a href='https://\${domain}'>\${domain}</a>\n";
+				$array['email_templates'][$x]['template_body'] .= "<br /><br /><br />\n";
+				$array['email_templates'][$x]['template_body'] .= "</body>\n";
+				$array['email_templates'][$x]['template_body'] .= "</html>\n";
+				$array['email_templates'][$x]['template_type'] = 'html';
+				$array['email_templates'][$x]['template_enabled'] = 'true';
+				$array['email_templates'][$x]['template_description'] = 'Default password reset email template.';
+				$x++;
+
+				//add the temporary permission
+				$p = new permissions;
+				$p->add("email_template_add", 'temp');
+				$p->add("email_template_edit", 'temp');
+
+				//save to the data
+				$database = new database;
+				$database->app_name = 'email_templates';
+				$database->app_uuid = '8173e738-2523-46d5-8943-13883befd2fd';
+				$database->save($array);
+				unset($array);
+
+				//remove the temporary permission
+				$p->delete("email_template_add", 'temp');
+				$p->delete("email_template_edit", 'temp');
+			}
 		}
 
 }