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

Revision: 112804
Author:   jeroendedauw
Date:     2012-03-01 13:37:08 +0000 (Thu, 01 Mar 2012)
Log Message:
-----------
fixed token enroll link

Modified Paths:
--------------
    trunk/extensions/EducationProgram/actions/ViewCourseAction.php
    trunk/extensions/EducationProgram/specials/SpecialEnroll.php

Modified: trunk/extensions/EducationProgram/actions/ViewCourseAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/ViewCourseAction.php      
2012-03-01 13:32:07 UTC (rev 112803)
+++ trunk/extensions/EducationProgram/actions/ViewCourseAction.php      
2012-03-01 13:37:08 UTC (rev 112804)
@@ -105,7 +105,7 @@
 
                if ( $this->getUser()->isAllowed( 'ep-token' ) ) {
                        $stats['token'] = Linker::linkKnown(
-                               SpecialPage::getTitleFor( 'Enroll', 
$course->getId() . '/' . $course->getField( 'token' ) ),
+                               SpecialPage::getTitleFor( 'Enroll', 
$course->getField( 'name' ) . '/' . $course->getField( 'token' ) ),
                                htmlspecialchars( $course->getField( 'token' ) )
                        );
                }

Modified: trunk/extensions/EducationProgram/specials/SpecialEnroll.php
===================================================================
--- trunk/extensions/EducationProgram/specials/SpecialEnroll.php        
2012-03-01 13:32:07 UTC (rev 112803)
+++ trunk/extensions/EducationProgram/specials/SpecialEnroll.php        
2012-03-01 13:37:08 UTC (rev 112804)
@@ -45,8 +45,13 @@
        public function execute( $subPage ) {
                parent::execute( $subPage );
 
-               $args = explode( '/', $this->subPage, 2 );
+               $args = explode( '/', $this->subPage );
 
+               if ( count( $args ) > 2 ) {
+                       $args[0] = implode( '/', array_slice( $args, 0, count( 
$args ) - 1 ) );
+                       $args = array_slice( $args, 0, 2 );
+               }
+
                if ( $args[0] === '' ) {
                        $this->showWarning( wfMessage(  'ep-enroll-no-id' ) );
                }


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

Reply via email to