https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113725

Revision: 113725
Author:   jeroendedauw
Date:     2012-03-13 15:39:31 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
fix bug 35180

Modified Paths:
--------------
    trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php
    trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php

Modified: 
trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php   
2012-03-13 15:22:00 UTC (rev 113724)
+++ trunk/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php   
2012-03-13 15:39:31 UTC (rev 113725)
@@ -410,7 +410,7 @@
         *
         * @param $id string id of a property
         * @param $label string alias label for the property
-        * 
+        *
         * @note Always use registerProperty() for the first label. No property
         * that has used "false" for a label on registration should have an
         * alias.

Modified: 
trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php 
2012-03-13 15:22:00 UTC (rev 113724)
+++ trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php 
2012-03-13 15:39:31 UTC (rev 113725)
@@ -22,12 +22,15 @@
 
        public function execute( $page ) {
                global $wgOut, $wgRequest;
+
                $wgOut->setPageTitle( wfMsg( 'exportrdf' ) );
-               
+
                // see if we can find something to export:
-               $page = ( $page === '' ) ? $wgRequest->getVal( 'page' ) : 
rawurldecode( $page );
+               $page = is_null( $page ) ? $wgRequest->getVal( 'page' ) : 
rawurldecode( $page );
+
                if ( $page === '' ) { // Try to get POST list; some settings 
are only available via POST.
                        $pageblob = $wgRequest->getText( 'pages' );
+
                        if ( $pageblob !== '' ) {
                                $pages = explode( "\n", $pageblob );
                        }
@@ -40,12 +43,14 @@
                        return;
                } else {
                        $offset = $wgRequest->getVal( 'offset' );
+
                        if ( isset( $offset ) ) {
                                $this->startRDFExport();                        
         
                                $this->export_controller->printPageList( 
$offset );
                                return;
                        } else {
                                $stats = $wgRequest->getVal( 'stats' );
+
                                if ( isset( $stats ) ) {
                                        $this->startRDFExport();
                                        
$this->export_controller->printWikiInfo();
@@ -71,13 +76,16 @@
                if ( $wgUser->isAllowed( 'delete' ) || 
$smwgAllowRecursiveExport ) {
                        $html .= '<input type="checkbox" name="recursive" 
value="1" id="rec">&#160;<label for="rec">' . wfMsg( 'smw_exportrdf_recursive' 
) . '</label></input><br />' . "\n";
                }
+
                if ( $wgUser->isAllowed( 'delete' ) || $smwgExportBacklinks ) {
                        $html .= '<input type="checkbox" name="backlinks" 
value="1" default="true" id="bl">&#160;<label for="bl">' . wfMsg( 
'smw_exportrdf_backlinks' ) . '</label></input><br />' . "\n";
                }
+
                if ( $wgUser->isAllowed( 'delete' ) || $smwgExportAll ) {
                        $html .= '<br />';
                        $html .= '<input type="text" name="date" value="' . 
date( DATE_W3C, mktime( 0, 0, 0, 1, 1, 2000 ) ) . '" id="date">&#160;<label 
for="ea">' . wfMsg( 'smw_exportrdf_lastdate' ) . '</label></input><br />' . 
"\n";
                }
+
                $html .= '<br /><input type="submit"  value="' . wfMsg( 
'smw_exportrdf_submit' ) . "\"/>\n</form>";
                
                $wgOut->addHTML( $html );
@@ -88,10 +96,16 @@
         */
        protected function startRDFExport() {
                global $wgOut, $wgRequest;
+
                $syntax = $wgRequest->getText( 'syntax' );
-               if ( $syntax === '' ) $syntax = $wgRequest->getVal( 'syntax' );
+
+               if ( $syntax === '' ) {
+                       $syntax = $wgRequest->getVal( 'syntax' );
+               }
+
                $wgOut->disable();
                ob_start();
+
                if ( $syntax == 'turtle' ) {
                        $mimetype = 'application/x-turtle'; // may change to 
'text/turtle' at some time, watch Turtle development
                        $serializer = new SMWTurtleSerializer();
@@ -104,7 +118,9 @@
                        $mimetype = ( $wgRequest->getVal( 'xmlmime' ) == 'rdf' 
) ? 'application/rdf+xml' : 'application/xml';
                        $serializer = new SMWRDFXMLSerializer();
                }
+
                header( "Content-type: $mimetype; charset=UTF-8" );
+
                $this->export_controller = new SMWExportController( $serializer 
);
        }
        
@@ -120,14 +136,23 @@
 
                $recursive = 0;  // default, no recursion
                $rec = $wgRequest->getText( 'recursive' );
-               if ( $rec === '' ) $rec = $wgRequest->getVal( 'recursive' );
+
+               if ( $rec === '' ) {
+                       $rec = $wgRequest->getVal( 'recursive' );
+               }
+
                if ( ( $rec == '1' ) && ( $smwgAllowRecursiveExport || 
$wgUser->isAllowed( 'delete' ) ) ) {
                        $recursive = 1; // users may be allowed to switch it on
                }
 
                $backlinks = $smwgExportBacklinks; // default
                $bl = $wgRequest->getText( 'backlinks' );
-               if ( $bl === '' ) $bl = $wgRequest->getVal( 'backlinks' );
+
+               if ( $bl === '' ) {
+                       // TODO: wtf? this does not make a lot of sense...
+                       $bl = $wgRequest->getVal( 'backlinks' );
+               }
+
                if ( ( $bl == '1' ) && ( $wgUser->isAllowed( 'delete' ) ) ) {
                        $backlinks = true; // admins can always switch on 
backlinks
                } elseif ( ( $bl == '0' ) || ( '' == $bl && $postform ) ) {
@@ -135,7 +160,10 @@
                }
 
                $date = $wgRequest->getText( 'date' );
-               if ( $date === '' ) $date = $wgRequest->getVal( 'date' );
+               if ( $date === '' ) {
+                       $date = $wgRequest->getVal( 'date' );
+               }
+               
                if ( $date !== '' ) {
                        $timeint = strtotime( $date );
                        $stamp = date( "YmdHis", $timeint );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to