public function testAvailableProfilesConformToSchema() { $va_profiles = caGetAvailableXMLProfiles(dirname(__FILE__) . '/../../install/'); $this->assertGreaterThan(0, sizeof($va_profiles)); foreach ($va_profiles as $vs_profile) { $vo_installer = new Installer(dirname(__FILE__) . '/../../install/profiles/xml/', $vs_profile, '*****@*****.**', false, false); $this->assertEquals(0, $vo_installer->numErrors(), "The profile '{$vs_profile}' doesn't conform to the XML schema"); } }
<?php _p("Administrator's e-mail address"); ?> :<br/> <input type='text' name='email' value='<?php print htmlspecialchars($ps_email, ENT_QUOTES, 'UTF-8'); ?> ' size='40' maxlength='100'/> </div><!-- end formItem --> <div class='formItem'><?php _p("Installation profile"); ?> :<br/> <div id="profileChooser"> <?php print caHTMLSelect('profile', caGetAvailableXMLProfiles(), array('id' => 'profileSelect'), array('value' => $ps_profile)); if (defined('__CA_ALLOW_DRAG_AND_DROP_PROFILE_UPLOAD_IN_INSTALLER__') && __CA_ALLOW_DRAG_AND_DROP_PROFILE_UPLOAD_IN_INSTALLER__) { ?> <div id="batchProcessingTableProgressGroup" style="display: none;"> <div class="batchProcessingStatus"><span id="batchProcessingTableStatus" > </span></div> <div id="progressbar"></div> </div> <div id="profileUpload" style="border: 2px dashed #999999; text-align: center; padding: 20px; margin-top: 10px;"> <span style="font-size: 20px; color: #aaaaaa; font-weight: bold;"><?php print _t("Drag profiles here to add or update"); ?> </span> </div> <?php } ?>
$vo_profile = new DOMDocument(); @$vo_profile->load($vs_tmp_name); if (!@$vo_profile->schemaValidate($vs_profile_dir . "/profile.xsd")) { $va_response['skippedMessage'][] = _t('%1 is not a valid profile', $_FILES['files']['name'][$vn_i]); continue; } $vb_exists = file_exists($vs_profile_dir . '/' . $_FILES['files']['name'][$vn_i]); // attempt to write to profile dir if (@copy($vs_tmp_name, $vs_profile_dir . '/' . $_FILES['files']['name'][$vn_i])) { $va_response['added'][] = pathinfo($_FILES['files']['name'][$vn_i], PATHINFO_FILENAME); $va_response['uploadMessage'][] = $vb_exists ? _t('Updated %1', $_FILES['files']['name'][$vn_i]) : _t('Added %1', $_FILES['files']['name'][$vn_i]); } } } // return list of profiles $va_response['profiles'] = caGetAvailableXMLProfiles(); print json_encode($va_response); return; } } $ps_email = isset($_REQUEST['email']) ? $_REQUEST['email'] : ''; $ps_profile = isset($_REQUEST['profile']) ? $_REQUEST['profile'] : ''; $pb_overwrite = isset($_REQUEST['overwrite']) && defined('__CA_ALLOW_INSTALLER_TO_OVERWRITE_EXISTING_INSTALLS__') ? (bool) $_REQUEST['overwrite'] : false; $pb_debug = isset($_REQUEST['debug']) && defined('__CA_ALLOW_INSTALLER_TO_OVERWRITE_EXISTING_INSTALLS__') ? (bool) $_REQUEST['debug'] : false; $va_errors = array(); $va_tmp = explode("/", str_replace("\\", "/", $_SERVER['SCRIPT_NAME'])); array_pop($va_tmp); $vs_url_path = join("/", $va_tmp); // get current locale $locale = 'en_US'; // get current theme