public function setUp()
 {
     parent::setUp();
     PermissionsManager::setInstance(mock('PermissionsManager'));
     $this->xml_security = new XML_Security();
     $this->xml_security->enableExternalLoadOfEntities();
 }
Example #2
0
 public function setUp()
 {
     parent::setUp();
     $GLOBALS['Language'] = new MockBaseLanguage($this);
     $this->xml_security = new XML_Security();
     $this->xml_security->enableExternalLoadOfEntities();
 }
Example #3
0
 public function setUp()
 {
     parent::setUp();
     $this->list_rule_dao = mock('Tracker_Rule_List_Dao');
     $this->list_rule_factory = new Tracker_Rule_List_Factory($this->list_rule_dao);
     $this->xml_security = new XML_Security();
     $this->xml_security->enableExternalLoadOfEntities();
 }
 public function __construct($wsdl, array $options = null)
 {
     $xml_security = new XML_Security();
     $xml_security->enableExternalLoadOfEntities();
     parent::__construct($wsdl, $options);
     $xml_security->disableExternalLoadOfEntities();
 }
Example #5
0
 public function setUp()
 {
     parent::setUp();
     $this->tracker = stub('Tracker')->getId()->returns($this->tracker_id);
     $this->date_rule_dao = mock('Tracker_Rule_Date_Dao');
     $this->source_field = mock('Tracker_FormElement_Field_Date');
     stub($this->source_field)->getId()->returns($this->source_field_id);
     $this->target_field = mock('Tracker_FormElement_Field_Date');
     stub($this->target_field)->getId()->returns(465);
     $this->element_factory = mock('Tracker_FormElementFactory');
     stub($this->element_factory)->getFormElementById($this->source_field_id)->returns($this->source_field);
     stub($this->element_factory)->getFormElementById(465)->returns($this->target_field);
     $this->date_rule_factory = new Tracker_Rule_Date_Factory($this->date_rule_dao, $this->element_factory);
     $this->xml_security = new XML_Security();
     $this->xml_security->enableExternalLoadOfEntities();
 }
Example #6
0
 private function loadXML()
 {
     $xml_security = new XML_Security();
     $xml_security->disableExternalLoadOfEntities();
     $xml = simplexml_load_string($this->bad_xml);
     $xml_security->enableExternalLoadOfEntities();
     return $xml;
 }
 public function __construct($wsdl_url, $login, $password)
 {
     $this->temporary_directory = tempnam(ForgeConfig::get('tmp_dir'), 'docmanv1-docmanv2-');
     $this->wsdl_url = $wsdl_url;
     $this->user_login = $login;
     $this->user_password = $password;
     $xml_security = new XML_Security();
     $xml_security->enableExternalLoadOfEntities();
 }
 public function validate(SimpleXMLElement $xml_element, $rng_path)
 {
     $dom = $this->simpleXmlElementToDomDocument($xml_element);
     $xml_security = new XML_Security();
     $xml_security->enableExternalLoadOfEntities();
     $is_valid = @$dom->relaxNGValidate($rng_path);
     $xml_security->disableExternalLoadOfEntities();
     if (!$is_valid) {
         $this->extractErrors($dom, $rng_path);
     }
 }
 /**
  * Output a html view of the given wsdl
  *
  * @param string $wsdl_uri https://example.com/plugins/statistics/soap/?wsdl
  */
 public function render($wsdl_uri)
 {
     $xml_security = new XML_Security();
     $xml_security->enableExternalLoadOfEntities();
     $proc = new XSLTProcessor();
     $xslDoc = new DOMDocument();
     $xslDoc->load(ForgeConfig::get('codendi_dir') . "/src/www/soap/wsdl-viewer.xsl");
     $proc->importStylesheet($xslDoc);
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML(file_get_contents($wsdl_uri));
     echo $proc->transformToXML($xmlDoc);
     $xml_security->disableExternalLoadOfEntities();
 }
 public function setUp()
 {
     parent::setUp();
     $this->xml_security = new XML_Security();
     $this->xml_security->enableExternalLoadOfEntities();
 }
Example #11
0
    $options['tracker_id'] = (int) $arguments['t'];
}
$options['force'] = isset($arguments['f']);
$project = ProjectManager::instance()->getProject($project_id);
if ($project && !$project->isError() && !$project->isDeleted()) {
    try {
        $rng_validator = new XML_RNGValidator();
        $users_collection = new UserXMLExportedCollection($rng_validator, new XML_SimpleXMLCDATAFactory());
        $xml_exporter = new ProjectXMLExporter(EventManager::instance(), new UGroupManager(), $rng_validator, new UserXMLExporter(UserManager::instance(), $users_collection), new ProjectXMLExporterLogger());
        $archive = new ZipArchive();
        if ($archive->open($output, ZipArchive::CREATE) !== true) {
            echo '*** ERROR: Cannot create archive: ' . $archive_path;
            exit(1);
        }
        $xml_security = new XML_Security();
        $xml_security->enableExternalLoadOfEntities();
        $user = UserManager::instance()->forceLogin($username);
        $xml_content = $xml_exporter->export($project, $options, $user, $archive);
        $users_xml_content = $users_collection->toXML();
        if ($display_xml) {
            echo $xml_content;
            echo PHP_EOL;
            echo $users_xml_content;
        }
        if (!$archive->addFromString('project.xml', $xml_content)) {
            fwrite(STDERR, "Unable to add project.xml into archive." . PHP_EOL);
        }
        if (!$archive->addFromString('users.xml', $users_xml_content)) {
            fwrite(STDERR, "Unable to add users.xml into archive." . PHP_EOL);
        }
        $xml_security->disableExternalLoadOfEntities();
Example #12
0
 private function exportTV3Data($tv3_id)
 {
     $this->logger->info('--> Export TV3 data ');
     $xml_path = $this->generateTemporaryPath();
     $indent_xsl_path = $this->getIndentXSLResourcePath();
     $xml = new DOMDocument("1.0", "UTF8");
     $dao = new ArtifactXMLExporterDao();
     $node_helper = new ArtifactXMLNodeHelper($xml);
     $attachment_exporter = new ArtifactAttachmentXMLLinker($node_helper, $dao);
     $exporter = new ArtifactXMLExporter($dao, $attachment_exporter, $node_helper, $this->logger);
     $exporter->exportTrackerData($tv3_id);
     $this->logger->info('<-- TV3 data exported ' . PHP_EOL);
     $xml_security = new XML_Security();
     $xml_security->enableExternalLoadOfEntities();
     $xsl = new DOMDocument();
     $xsl->load($indent_xsl_path);
     $proc = new XSLTProcessor();
     $proc->importStyleSheet($xsl);
     $xml_string = $proc->transformToXML($xml);
     $xml_security->disableExternalLoadOfEntities();
     if (file_put_contents($xml_path, $xml_string) !== strlen($xml_string)) {
         throw new Exception('Something went wrong when writing tv3 xml in ' . $xml_path);
     }
     return $xml_path;
 }