/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to wiki.php

  • Committer: Suren A. Chilingaryan
  • Date: 2009-01-31 04:54:46 UTC
  • Revision ID: csa@dside.dyndns.org-20090131045446-e2u52332uayw5u9m
Various fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
546
546
 
547
547
if (preg_match("/services\\/[^\\\]+.php$/", $_SERVER['SCRIPT_FILENAME'])) {
548
548
    $AJAX_MODE = true;
549
 
    
 
549
    $error = false;
 
550
 
550
551
    header("Content-type: text/xml");
551
 
    print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
552
 
    print "<div>" . stripslashes($wiki->getPage((int)$GET_ID)->getHTMLContent(1)) . "</div>";
 
552
 
 
553
    $xslt = $REQ->GetProp('xslt');
 
554
    if ($xslt) {
 
555
        $temp_file = tempnam(sys_get_temp_dir(), 'adei_wiki.');
 
556
        $out = @fopen($temp_file, "w");
 
557
        if (!$out) $error = translate("I'm not able to create temporary file \"%s\"", $temp_file);
 
558
    } else {
 
559
        $out = fopen("php://output", "w");
 
560
    }
 
561
    
 
562
    if ($out) {
 
563
        fwrite($out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
 
564
        fwrite($out, "<div>" . stripslashes($wiki->getPage((int)$GET_ID)->getHTMLContent(1)) . "</div>");
 
565
        fclose($out);
 
566
    }
 
567
 
 
568
    if (($xslt)&&(!$error)) {
 
569
        try {
 
570
            echo $ADEI->TransformXML($xslt, $temp_file);
 
571
        } catch (ADEIException $ex) {
 
572
            $ex->logInfo(NULL, $reader?$reader:$req);
 
573
            $error = $ADEI->EscapeForXML($ex->getInfo());
 
574
        }
 
575
        @unlink($temp_file);
 
576
    }
 
577
    
 
578
    if ($error) {
 
579
        echo "<div>$error</div>";
 
580
    }
 
581
    
553
582
    exit;
554
583
} else {
555
584
    header("Content-type: text/html");